@bpmn-io/form-js-playground 1.7.0-alpha.0 → 1.7.0
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/form-playground.umd.js +41 -10
- package/package.json +4 -4
|
@@ -54369,6 +54369,10 @@
|
|
|
54369
54369
|
const {
|
|
54370
54370
|
formId
|
|
54371
54371
|
} = F$1(FormContext);
|
|
54372
|
+
|
|
54373
|
+
// track whether we should trigger initial validation on certain actions, e.g. field blur
|
|
54374
|
+
// disabled straight away, if viewerCommands are not available
|
|
54375
|
+
const [initialValidationTrigger, setInitialValidationTrigger] = l$1(!!viewerCommands);
|
|
54372
54376
|
const FormFieldComponent = formFields.get(field.type);
|
|
54373
54377
|
if (!FormFieldComponent) {
|
|
54374
54378
|
throw new Error(`cannot render field <${field.type}>`);
|
|
@@ -54382,26 +54386,47 @@
|
|
|
54382
54386
|
|
|
54383
54387
|
// add precedence: global readonly > form field disabled
|
|
54384
54388
|
const disabled = !properties.readOnly && (properties.disabled || field.disabled || false);
|
|
54389
|
+
|
|
54390
|
+
// ensures the initial validation behavior can be re-triggered upon form reset
|
|
54391
|
+
y(() => {
|
|
54392
|
+
if (!viewerCommands) {
|
|
54393
|
+
return;
|
|
54394
|
+
}
|
|
54395
|
+
const resetValidation = () => {
|
|
54396
|
+
setInitialValidationTrigger(true);
|
|
54397
|
+
};
|
|
54398
|
+
eventBus.on('import.done', resetValidation);
|
|
54399
|
+
eventBus.on('reset', resetValidation);
|
|
54400
|
+
return () => {
|
|
54401
|
+
eventBus.off('import.done', resetValidation);
|
|
54402
|
+
eventBus.off('reset', resetValidation);
|
|
54403
|
+
};
|
|
54404
|
+
}, [eventBus, viewerCommands]);
|
|
54405
|
+
y(() => {
|
|
54406
|
+
if (initialValidationTrigger && initialValue) {
|
|
54407
|
+
setInitialValidationTrigger(false);
|
|
54408
|
+
viewerCommands.updateFieldValidation(field, initialValue, indexes);
|
|
54409
|
+
}
|
|
54410
|
+
}, [viewerCommands, field, initialValue, initialValidationTrigger, indexes]);
|
|
54385
54411
|
const onBlur = A$1(() => {
|
|
54386
|
-
if (
|
|
54412
|
+
if (initialValidationTrigger) {
|
|
54413
|
+
setInitialValidationTrigger(false);
|
|
54387
54414
|
viewerCommands.updateFieldValidation(field, value, indexes);
|
|
54388
54415
|
}
|
|
54389
54416
|
eventBus.fire('formField.blur', {
|
|
54390
54417
|
formField: field
|
|
54391
54418
|
});
|
|
54392
|
-
}, [eventBus,
|
|
54419
|
+
}, [eventBus, field, indexes, value, viewerCommands, initialValidationTrigger]);
|
|
54393
54420
|
const onFocus = A$1(() => {
|
|
54394
54421
|
eventBus.fire('formField.focus', {
|
|
54395
54422
|
formField: field
|
|
54396
54423
|
});
|
|
54397
54424
|
}, [eventBus, field]);
|
|
54398
|
-
y(() => {
|
|
54399
|
-
if (viewerCommands && initialValue) {
|
|
54400
|
-
viewerCommands.updateFieldValidation(field, initialValue, indexes);
|
|
54401
|
-
}
|
|
54402
|
-
}, [viewerCommands, field, initialValue, indexes]);
|
|
54403
54425
|
const hidden = useCondition(field.conditional && field.conditional.hide || null);
|
|
54404
54426
|
const onChangeIndexed = A$1(update => {
|
|
54427
|
+
// any data change will trigger validation
|
|
54428
|
+
setInitialValidationTrigger(false);
|
|
54429
|
+
|
|
54405
54430
|
// add indexes of the keyed field to the update, if any
|
|
54406
54431
|
onChange(FormFieldComponent.config.keyed ? {
|
|
54407
54432
|
...update,
|
|
@@ -57734,7 +57759,7 @@
|
|
|
57734
57759
|
required
|
|
57735
57760
|
} = validate;
|
|
57736
57761
|
const textareaRef = s$1();
|
|
57737
|
-
const [
|
|
57762
|
+
const [onChange, flushOnChange] = useFlushDebounce(({
|
|
57738
57763
|
target
|
|
57739
57764
|
}) => {
|
|
57740
57765
|
props.onChange({
|
|
@@ -57749,6 +57774,12 @@
|
|
|
57749
57774
|
const onInputFocus = () => {
|
|
57750
57775
|
onFocus && onFocus();
|
|
57751
57776
|
};
|
|
57777
|
+
const onInputChange = event => {
|
|
57778
|
+
onChange({
|
|
57779
|
+
target: event.target
|
|
57780
|
+
});
|
|
57781
|
+
autoSizeTextarea(textareaRef.current);
|
|
57782
|
+
};
|
|
57752
57783
|
h$1(() => {
|
|
57753
57784
|
autoSizeTextarea(textareaRef.current);
|
|
57754
57785
|
}, [value]);
|
|
@@ -60981,10 +61012,10 @@
|
|
|
60981
61012
|
}
|
|
60982
61013
|
}
|
|
60983
61014
|
clear() {
|
|
60984
|
-
// clear
|
|
61015
|
+
// clear diagram services (e.g. EventBus)
|
|
60985
61016
|
this._emit('diagram.clear');
|
|
60986
61017
|
|
|
60987
|
-
// clear
|
|
61018
|
+
// clear form services
|
|
60988
61019
|
this._emit('form.clear');
|
|
60989
61020
|
}
|
|
60990
61021
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-io/form-js-playground",
|
|
3
|
-
"version": "1.7.0
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "A form-js playground",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"url": "https://github.com/bpmn-io"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@bpmn-io/form-js-editor": "^1.7.0
|
|
48
|
-
"@bpmn-io/form-js-viewer": "^1.7.0
|
|
47
|
+
"@bpmn-io/form-js-editor": "^1.7.0",
|
|
48
|
+
"@bpmn-io/form-js-viewer": "^1.7.0",
|
|
49
49
|
"@codemirror/autocomplete": "^6.12.0",
|
|
50
50
|
"@codemirror/commands": "^6.1.2",
|
|
51
51
|
"@codemirror/lang-json": "^6.0.1",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"rollup-plugin-css-only": "^4.0.0",
|
|
71
71
|
"style-loader": "^3.3.0"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "8e289cb810b1fe7bea10b625263a67d9502d47bc"
|
|
74
74
|
}
|