11import { DialogField } from "../Dialog/Dialog" ;
22
3+
4+ const PatternDenyRegex = "[ ,:~]" ;
5+ const PatternDenyErr = " cannot contain spaces, commas, colons, or tildes." ;
36const capitalize = ( s : string ) : string => { return s ?. length ? s . charAt ( 0 ) . toUpperCase ( ) + s . slice ( 1 ) : "" ; }
47
58/** Dev Note: Once we get actual user data we should use that for Contributor and ContributorOrganization */
@@ -13,12 +16,21 @@ export const entityCreateFields = (model: any): DialogField[] => {
1316 hidden : true ,
1417 defaultValue : model ?. Id ,
1518 } ,
16- { name : "Name" , type : "text" as const , label : "Name" , required : true } ,
19+ {
20+ name : "Name" ,
21+ type : "text" as const ,
22+ label : "Name" ,
23+ required : true ,
24+ patternDeny : PatternDenyRegex ,
25+ patternErr : "Name" + PatternDenyErr ,
26+ } ,
1727 {
1828 name : "UniqueName" ,
1929 type : "text" as const ,
2030 label : "Unique Name" ,
2131 required : true ,
32+ patternDeny : PatternDenyRegex ,
33+ patternErr : "Unique Name" + PatternDenyErr ,
2234 } ,
2335 { name : "Description" , type : "text" as const , label : "Description" } ,
2436 {
@@ -90,12 +102,21 @@ export const attributeCreateFields = (model: any, valueSetId: string | number |
90102 hidden : true ,
91103 defaultValue : valueSetId ?. toString ( ) ,
92104 } ,
93- { name : "Name" , type : "text" as const , label : "Name" , required : true } ,
105+ {
106+ name : "Name" ,
107+ type : "text" as const ,
108+ label : "Name" ,
109+ required : true ,
110+ patternDeny : PatternDenyRegex ,
111+ patternErr : "Name" + PatternDenyErr ,
112+ } ,
94113 {
95114 name : "UniqueName" ,
96115 type : "text" as const ,
97116 label : "Unique Name" ,
98117 required : true ,
118+ patternDeny : PatternDenyRegex ,
119+ patternErr : "Unique Name" + PatternDenyErr ,
99120 } ,
100121 {
101122 name : "DataType" ,
@@ -173,7 +194,14 @@ export const valueSetCreateFields = (model: any): DialogField[] => {
173194 hidden : true ,
174195 defaultValue : model ?. Id ,
175196 } ,
176- { name : "Name" , type : "text" as const , label : "Name" , required : true } ,
197+ {
198+ name : "Name" ,
199+ type : "text" as const ,
200+ label : "Name" ,
201+ required : true ,
202+ patternDeny : PatternDenyRegex ,
203+ patternErr : "Name" + PatternDenyErr ,
204+ } ,
177205 { name : "Description" , type : "text" as const , label : "Description" } ,
178206 {
179207 name : "Use Considerations" ,
@@ -223,6 +251,8 @@ export const valueCreateFields = (model: any): DialogField[] => {
223251 type : "text" as const ,
224252 label : "Value Name" ,
225253 required : true ,
254+ patternDeny : PatternDenyRegex ,
255+ patternErr : "Value Name" + PatternDenyErr ,
226256 } ,
227257 { name : "Description" , type : "text" as const , label : "Description" } ,
228258 {
0 commit comments