@bpmn-io/form-js-editor 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs
CHANGED
|
@@ -2376,10 +2376,40 @@ class KeyBehavior extends CommandInterceptor {
|
|
|
2376
2376
|
}
|
|
2377
2377
|
KeyBehavior.$inject = ['eventBus', 'modeling'];
|
|
2378
2378
|
|
|
2379
|
+
class ValidateBehavior extends CommandInterceptor {
|
|
2380
|
+
constructor(eventBus) {
|
|
2381
|
+
super(eventBus);
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* Remove custom validation if <validationType> is about to be added.
|
|
2385
|
+
*/
|
|
2386
|
+
// @ts-ignore-next-line
|
|
2387
|
+
this.preExecute('formField.edit', function (context) {
|
|
2388
|
+
const {
|
|
2389
|
+
properties
|
|
2390
|
+
} = context;
|
|
2391
|
+
const {
|
|
2392
|
+
validate = {}
|
|
2393
|
+
} = properties;
|
|
2394
|
+
if (validate.validationType) {
|
|
2395
|
+
const newValidate = {
|
|
2396
|
+
...validate
|
|
2397
|
+
};
|
|
2398
|
+
delete newValidate.minLength;
|
|
2399
|
+
delete newValidate.maxLength;
|
|
2400
|
+
delete newValidate.pattern;
|
|
2401
|
+
properties['validate'] = newValidate;
|
|
2402
|
+
}
|
|
2403
|
+
}, true);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
ValidateBehavior.$inject = ['eventBus'];
|
|
2407
|
+
|
|
2379
2408
|
var behaviorModule = {
|
|
2380
|
-
__init__: ['idBehavior', 'keyBehavior'],
|
|
2409
|
+
__init__: ['idBehavior', 'keyBehavior', 'validateBehavior'],
|
|
2381
2410
|
idBehavior: ['type', IdBehavior],
|
|
2382
|
-
keyBehavior: ['type', KeyBehavior]
|
|
2411
|
+
keyBehavior: ['type', KeyBehavior],
|
|
2412
|
+
validateBehavior: ['type', ValidateBehavior]
|
|
2383
2413
|
};
|
|
2384
2414
|
|
|
2385
2415
|
/**
|
|
@@ -7042,6 +7072,7 @@ function ValidationGroup(field, editField) {
|
|
|
7042
7072
|
component: ValidationType,
|
|
7043
7073
|
getValue,
|
|
7044
7074
|
field,
|
|
7075
|
+
editField,
|
|
7045
7076
|
isEdited: isEdited$1,
|
|
7046
7077
|
onChange
|
|
7047
7078
|
});
|
|
@@ -7208,15 +7239,7 @@ function ValidationType(props) {
|
|
|
7208
7239
|
onChange
|
|
7209
7240
|
} = props;
|
|
7210
7241
|
const debounce = useService('debounce');
|
|
7211
|
-
const clearCustomValidation = () => {
|
|
7212
|
-
onChange('minLength')(undefined);
|
|
7213
|
-
onChange('maxLength')(undefined);
|
|
7214
|
-
onChange('pattern')(undefined);
|
|
7215
|
-
};
|
|
7216
7242
|
const setValue = validationType => {
|
|
7217
|
-
if (validationType) {
|
|
7218
|
-
clearCustomValidation();
|
|
7219
|
-
}
|
|
7220
7243
|
onChange('validationType')(validationType || undefined);
|
|
7221
7244
|
};
|
|
7222
7245
|
return SelectEntry({
|