@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.es.js CHANGED
@@ -2364,10 +2364,40 @@ class KeyBehavior extends CommandInterceptor {
2364
2364
  }
2365
2365
  KeyBehavior.$inject = ['eventBus', 'modeling'];
2366
2366
 
2367
+ class ValidateBehavior extends CommandInterceptor {
2368
+ constructor(eventBus) {
2369
+ super(eventBus);
2370
+
2371
+ /**
2372
+ * Remove custom validation if <validationType> is about to be added.
2373
+ */
2374
+ // @ts-ignore-next-line
2375
+ this.preExecute('formField.edit', function (context) {
2376
+ const {
2377
+ properties
2378
+ } = context;
2379
+ const {
2380
+ validate = {}
2381
+ } = properties;
2382
+ if (validate.validationType) {
2383
+ const newValidate = {
2384
+ ...validate
2385
+ };
2386
+ delete newValidate.minLength;
2387
+ delete newValidate.maxLength;
2388
+ delete newValidate.pattern;
2389
+ properties['validate'] = newValidate;
2390
+ }
2391
+ }, true);
2392
+ }
2393
+ }
2394
+ ValidateBehavior.$inject = ['eventBus'];
2395
+
2367
2396
  var behaviorModule = {
2368
- __init__: ['idBehavior', 'keyBehavior'],
2397
+ __init__: ['idBehavior', 'keyBehavior', 'validateBehavior'],
2369
2398
  idBehavior: ['type', IdBehavior],
2370
- keyBehavior: ['type', KeyBehavior]
2399
+ keyBehavior: ['type', KeyBehavior],
2400
+ validateBehavior: ['type', ValidateBehavior]
2371
2401
  };
2372
2402
 
2373
2403
  /**
@@ -7030,6 +7060,7 @@ function ValidationGroup(field, editField) {
7030
7060
  component: ValidationType,
7031
7061
  getValue,
7032
7062
  field,
7063
+ editField,
7033
7064
  isEdited: isEdited$1,
7034
7065
  onChange
7035
7066
  });
@@ -7196,15 +7227,7 @@ function ValidationType(props) {
7196
7227
  onChange
7197
7228
  } = props;
7198
7229
  const debounce = useService('debounce');
7199
- const clearCustomValidation = () => {
7200
- onChange('minLength')(undefined);
7201
- onChange('maxLength')(undefined);
7202
- onChange('pattern')(undefined);
7203
- };
7204
7230
  const setValue = validationType => {
7205
- if (validationType) {
7206
- clearCustomValidation();
7207
- }
7208
7231
  onChange('validationType')(validationType || undefined);
7209
7232
  };
7210
7233
  return SelectEntry({