@bpmn-io/form-js-viewer 1.6.2 → 1.6.3
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 +42 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +42 -51
- package/dist/index.es.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3078,40 +3078,6 @@ Image.config = {
|
|
|
3078
3078
|
})
|
|
3079
3079
|
};
|
|
3080
3080
|
|
|
3081
|
-
function useFlushDebounce(func, additionalDeps = []) {
|
|
3082
|
-
const timeoutRef = hooks.useRef(null);
|
|
3083
|
-
const lastArgsRef = hooks.useRef(null);
|
|
3084
|
-
const config = useService('config', false);
|
|
3085
|
-
const debounce = config && config.debounce;
|
|
3086
|
-
const shouldDebounce = debounce !== false && debounce !== 0;
|
|
3087
|
-
const delay = typeof debounce === 'number' ? debounce : 300;
|
|
3088
|
-
const debounceFunc = hooks.useCallback((...args) => {
|
|
3089
|
-
if (!shouldDebounce) {
|
|
3090
|
-
func(...args);
|
|
3091
|
-
return;
|
|
3092
|
-
}
|
|
3093
|
-
lastArgsRef.current = args;
|
|
3094
|
-
if (timeoutRef.current) {
|
|
3095
|
-
clearTimeout(timeoutRef.current);
|
|
3096
|
-
}
|
|
3097
|
-
timeoutRef.current = setTimeout(() => {
|
|
3098
|
-
func(...lastArgsRef.current);
|
|
3099
|
-
lastArgsRef.current = null;
|
|
3100
|
-
}, delay);
|
|
3101
|
-
}, [func, delay, shouldDebounce, ...additionalDeps]);
|
|
3102
|
-
const flushFunc = hooks.useCallback(() => {
|
|
3103
|
-
if (timeoutRef.current) {
|
|
3104
|
-
clearTimeout(timeoutRef.current);
|
|
3105
|
-
if (lastArgsRef.current !== null) {
|
|
3106
|
-
func(...lastArgsRef.current);
|
|
3107
|
-
lastArgsRef.current = null;
|
|
3108
|
-
}
|
|
3109
|
-
timeoutRef.current = null;
|
|
3110
|
-
}
|
|
3111
|
-
}, [func, ...additionalDeps]);
|
|
3112
|
-
return [debounceFunc, flushFunc];
|
|
3113
|
-
}
|
|
3114
|
-
|
|
3115
3081
|
function TemplatedInputAdorner(props) {
|
|
3116
3082
|
const {
|
|
3117
3083
|
pre,
|
|
@@ -3202,7 +3168,8 @@ function Numberfield(props) {
|
|
|
3202
3168
|
onFocus,
|
|
3203
3169
|
field,
|
|
3204
3170
|
value,
|
|
3205
|
-
readonly
|
|
3171
|
+
readonly,
|
|
3172
|
+
onChange
|
|
3206
3173
|
} = props;
|
|
3207
3174
|
const {
|
|
3208
3175
|
description,
|
|
@@ -3222,16 +3189,6 @@ function Numberfield(props) {
|
|
|
3222
3189
|
} = validate;
|
|
3223
3190
|
const inputRef = hooks.useRef();
|
|
3224
3191
|
const [stringValueCache, setStringValueCache] = hooks.useState('');
|
|
3225
|
-
const [onChangeDebounced, flushOnChange] = useFlushDebounce(params => {
|
|
3226
|
-
props.onChange(params);
|
|
3227
|
-
}, [props.onChange]);
|
|
3228
|
-
const onInputBlur = () => {
|
|
3229
|
-
flushOnChange && flushOnChange();
|
|
3230
|
-
onBlur && onBlur();
|
|
3231
|
-
};
|
|
3232
|
-
const onInputFocus = () => {
|
|
3233
|
-
onFocus && onFocus();
|
|
3234
|
-
};
|
|
3235
3192
|
|
|
3236
3193
|
// checks whether the value currently in the form data is practically different from the one in the input field cache
|
|
3237
3194
|
// this allows us to guarantee the field always displays valid form data, but without auto-simplifying values like 1.000 to 1
|
|
@@ -3255,7 +3212,7 @@ function Numberfield(props) {
|
|
|
3255
3212
|
const setValue = hooks.useCallback(stringValue => {
|
|
3256
3213
|
if (isNullEquivalentValue(stringValue)) {
|
|
3257
3214
|
setStringValueCache('');
|
|
3258
|
-
|
|
3215
|
+
onChange({
|
|
3259
3216
|
field,
|
|
3260
3217
|
value: null
|
|
3261
3218
|
});
|
|
@@ -3270,18 +3227,18 @@ function Numberfield(props) {
|
|
|
3270
3227
|
}
|
|
3271
3228
|
if (isNaN(Number(stringValue))) {
|
|
3272
3229
|
setStringValueCache('NaN');
|
|
3273
|
-
|
|
3230
|
+
onChange({
|
|
3274
3231
|
field,
|
|
3275
3232
|
value: 'NaN'
|
|
3276
3233
|
});
|
|
3277
3234
|
return;
|
|
3278
3235
|
}
|
|
3279
3236
|
setStringValueCache(stringValue);
|
|
3280
|
-
|
|
3237
|
+
onChange({
|
|
3281
3238
|
field,
|
|
3282
3239
|
value: serializeToString ? stringValue : Number(stringValue)
|
|
3283
3240
|
});
|
|
3284
|
-
}, [field,
|
|
3241
|
+
}, [field, onChange, serializeToString]);
|
|
3285
3242
|
const increment = () => {
|
|
3286
3243
|
if (readonly) {
|
|
3287
3244
|
return;
|
|
@@ -3365,8 +3322,8 @@ function Numberfield(props) {
|
|
|
3365
3322
|
id: domId,
|
|
3366
3323
|
onKeyDown: onKeyDown,
|
|
3367
3324
|
onKeyPress: onKeyPress,
|
|
3368
|
-
onBlur:
|
|
3369
|
-
onFocus:
|
|
3325
|
+
onBlur: onBlur,
|
|
3326
|
+
onFocus: onFocus
|
|
3370
3327
|
|
|
3371
3328
|
// @ts-ignore
|
|
3372
3329
|
,
|
|
@@ -4376,6 +4333,40 @@ function DisabledLink({
|
|
|
4376
4333
|
});
|
|
4377
4334
|
}
|
|
4378
4335
|
|
|
4336
|
+
function useFlushDebounce(func, additionalDeps = []) {
|
|
4337
|
+
const timeoutRef = hooks.useRef(null);
|
|
4338
|
+
const lastArgsRef = hooks.useRef(null);
|
|
4339
|
+
const config = useService('config', false);
|
|
4340
|
+
const debounce = config && config.debounce;
|
|
4341
|
+
const shouldDebounce = debounce !== false && debounce !== 0;
|
|
4342
|
+
const delay = typeof debounce === 'number' ? debounce : 300;
|
|
4343
|
+
const debounceFunc = hooks.useCallback((...args) => {
|
|
4344
|
+
if (!shouldDebounce) {
|
|
4345
|
+
func(...args);
|
|
4346
|
+
return;
|
|
4347
|
+
}
|
|
4348
|
+
lastArgsRef.current = args;
|
|
4349
|
+
if (timeoutRef.current) {
|
|
4350
|
+
clearTimeout(timeoutRef.current);
|
|
4351
|
+
}
|
|
4352
|
+
timeoutRef.current = setTimeout(() => {
|
|
4353
|
+
func(...lastArgsRef.current);
|
|
4354
|
+
lastArgsRef.current = null;
|
|
4355
|
+
}, delay);
|
|
4356
|
+
}, [func, delay, shouldDebounce, ...additionalDeps]);
|
|
4357
|
+
const flushFunc = hooks.useCallback(() => {
|
|
4358
|
+
if (timeoutRef.current) {
|
|
4359
|
+
clearTimeout(timeoutRef.current);
|
|
4360
|
+
if (lastArgsRef.current !== null) {
|
|
4361
|
+
func(...lastArgsRef.current);
|
|
4362
|
+
lastArgsRef.current = null;
|
|
4363
|
+
}
|
|
4364
|
+
timeoutRef.current = null;
|
|
4365
|
+
}
|
|
4366
|
+
}, [func, ...additionalDeps]);
|
|
4367
|
+
return [debounceFunc, flushFunc];
|
|
4368
|
+
}
|
|
4369
|
+
|
|
4379
4370
|
const type$2 = 'textfield';
|
|
4380
4371
|
function Textfield(props) {
|
|
4381
4372
|
const {
|