@bpmn-io/properties-panel 3.28.2 → 3.28.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.esm.js +75 -107
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +75 -107
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2164,6 +2164,50 @@ function prefixId$6(id) {
|
|
|
2164
2164
|
return `bio-properties-panel-${id}`;
|
|
2165
2165
|
}
|
|
2166
2166
|
|
|
2167
|
+
function TextInput({
|
|
2168
|
+
debounce,
|
|
2169
|
+
element,
|
|
2170
|
+
id,
|
|
2171
|
+
getValue,
|
|
2172
|
+
onBlur,
|
|
2173
|
+
setValue,
|
|
2174
|
+
validate,
|
|
2175
|
+
Component,
|
|
2176
|
+
...props
|
|
2177
|
+
}) {
|
|
2178
|
+
const modelValue = getValue(element);
|
|
2179
|
+
const setModelValue = hooks.useCallback((newValue, error) => {
|
|
2180
|
+
if (minDash.isFunction(validate)) {
|
|
2181
|
+
error = validate(newValue) || null;
|
|
2182
|
+
}
|
|
2183
|
+
setValue(newValue, error);
|
|
2184
|
+
}, [setValue, validate]);
|
|
2185
|
+
const debouncedSetValue = useDebounce(setModelValue, debounce);
|
|
2186
|
+
const handleInput = hooks.useCallback(newValue => {
|
|
2187
|
+
if (newValue !== modelValue) {
|
|
2188
|
+
debouncedSetValue(newValue);
|
|
2189
|
+
}
|
|
2190
|
+
}, [modelValue, debouncedSetValue]);
|
|
2191
|
+
const handleBlur = hooks.useCallback(value => {
|
|
2192
|
+
const newValue = value.trim?.() || value;
|
|
2193
|
+
if (newValue !== modelValue) {
|
|
2194
|
+
setModelValue(newValue);
|
|
2195
|
+
}
|
|
2196
|
+
if (minDash.isFunction(onBlur)) {
|
|
2197
|
+
onBlur(newValue);
|
|
2198
|
+
}
|
|
2199
|
+
}, [modelValue, setModelValue]);
|
|
2200
|
+
return jsxRuntime.jsx(Component, {
|
|
2201
|
+
...props,
|
|
2202
|
+
debounce: debounce,
|
|
2203
|
+
element: element,
|
|
2204
|
+
id: id,
|
|
2205
|
+
onInput: handleInput,
|
|
2206
|
+
onBlur: handleBlur,
|
|
2207
|
+
value: modelValue
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2167
2211
|
const noop$2 = () => {};
|
|
2168
2212
|
|
|
2169
2213
|
/**
|
|
@@ -2192,7 +2236,6 @@ const noop$2 = () => {};
|
|
|
2192
2236
|
*/
|
|
2193
2237
|
function FeelTextfield(props) {
|
|
2194
2238
|
const {
|
|
2195
|
-
debounce,
|
|
2196
2239
|
id,
|
|
2197
2240
|
element,
|
|
2198
2241
|
label,
|
|
@@ -2227,16 +2270,11 @@ function FeelTextfield(props) {
|
|
|
2227
2270
|
const position = hasFocus ? document.activeElement.selectionStart : Infinity;
|
|
2228
2271
|
_setFocus(position + offset);
|
|
2229
2272
|
};
|
|
2230
|
-
|
|
2231
|
-
/**
|
|
2232
|
-
* @type { import('min-dash').DebouncedFunction }
|
|
2233
|
-
*/
|
|
2234
|
-
const handleInputCallback = useDebounce(onInput, debounce);
|
|
2235
2273
|
const handleInput = newValue => {
|
|
2236
2274
|
// we don't commit empty FEEL expressions,
|
|
2237
2275
|
// but instead serialize them as <undefined>
|
|
2238
2276
|
const newModelValue = newValue === '' || newValue === '=' ? undefined : newValue;
|
|
2239
|
-
|
|
2277
|
+
onInput(newModelValue);
|
|
2240
2278
|
};
|
|
2241
2279
|
const handleFeelToggle = useStaticCallback(() => {
|
|
2242
2280
|
if (feel === 'required') {
|
|
@@ -2264,14 +2302,8 @@ function FeelTextfield(props) {
|
|
|
2264
2302
|
setFocus(-1);
|
|
2265
2303
|
}
|
|
2266
2304
|
};
|
|
2267
|
-
const handleOnBlur =
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
// trim and commit on blur
|
|
2271
|
-
onInput(trimmedValue);
|
|
2272
|
-
if (onBlur) {
|
|
2273
|
-
onBlur(e);
|
|
2274
|
-
}
|
|
2305
|
+
const handleOnBlur = () => {
|
|
2306
|
+
onBlur?.(localValue);
|
|
2275
2307
|
};
|
|
2276
2308
|
const handleLint = useStaticCallback((lint = []) => {
|
|
2277
2309
|
const syntaxError = lint.some(report => report.type === 'Syntax Error');
|
|
@@ -2668,46 +2700,28 @@ function FeelEntry(props) {
|
|
|
2668
2700
|
placeholder,
|
|
2669
2701
|
tooltip
|
|
2670
2702
|
} = props;
|
|
2671
|
-
const [validationError, setValidationError] = hooks.useState(null);
|
|
2672
2703
|
const [localError, setLocalError] = hooks.useState(null);
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
if (minDash.isFunction(validate)) {
|
|
2676
|
-
const newValidationError = validate(value) || null;
|
|
2677
|
-
setValidationError(newValidationError);
|
|
2678
|
-
}
|
|
2679
|
-
}, [value, validate]);
|
|
2680
|
-
const onInput = hooks.useCallback(newValue => {
|
|
2681
|
-
const value = getValue(element);
|
|
2682
|
-
let newValidationError = null;
|
|
2683
|
-
if (minDash.isFunction(validate)) {
|
|
2684
|
-
newValidationError = validate(newValue) || null;
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
|
-
// don't create multiple commandStack entries for the same value
|
|
2688
|
-
if (newValue !== value) {
|
|
2689
|
-
setValue(newValue, newValidationError);
|
|
2690
|
-
}
|
|
2691
|
-
setValidationError(newValidationError);
|
|
2692
|
-
}, [element, getValue, setValue, validate]);
|
|
2693
|
-
const onError = hooks.useCallback(err => {
|
|
2694
|
-
setLocalError(err);
|
|
2695
|
-
}, []);
|
|
2704
|
+
const value = getValue(element);
|
|
2705
|
+
const validationError = validate?.(value) || null;
|
|
2696
2706
|
const temporaryError = useError(id);
|
|
2697
2707
|
const error = temporaryError || localError || validationError;
|
|
2698
2708
|
return jsxRuntime.jsxs("div", {
|
|
2699
2709
|
class: classnames(props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
2700
2710
|
"data-entry-id": id,
|
|
2701
|
-
children: [preact.createElement(
|
|
2711
|
+
children: [preact.createElement(TextInput, {
|
|
2702
2712
|
...props,
|
|
2713
|
+
Component: FeelTextfield,
|
|
2714
|
+
element: element,
|
|
2715
|
+
getValue: getValue,
|
|
2703
2716
|
debounce: debounce,
|
|
2717
|
+
setValue: setValue,
|
|
2718
|
+
validate: validate,
|
|
2704
2719
|
disabled: disabled,
|
|
2705
2720
|
feel: feel,
|
|
2706
2721
|
id: id,
|
|
2707
2722
|
key: element,
|
|
2708
2723
|
label: label,
|
|
2709
|
-
|
|
2710
|
-
onError: onError,
|
|
2724
|
+
onError: setLocalError,
|
|
2711
2725
|
onFocus: onFocus,
|
|
2712
2726
|
onBlur: onBlur,
|
|
2713
2727
|
placeholder: placeholder,
|
|
@@ -3449,14 +3463,8 @@ function TextArea(props) {
|
|
|
3449
3463
|
setLocalValue(e.target.value);
|
|
3450
3464
|
handleInput(e.target.value);
|
|
3451
3465
|
};
|
|
3452
|
-
const handleOnBlur =
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
// trim and commit on blur
|
|
3456
|
-
onInput(trimmedValue);
|
|
3457
|
-
if (onBlur) {
|
|
3458
|
-
onBlur(e);
|
|
3459
|
-
}
|
|
3466
|
+
const handleOnBlur = () => {
|
|
3467
|
+
onBlur?.(localValue);
|
|
3460
3468
|
};
|
|
3461
3469
|
hooks.useLayoutEffect(() => {
|
|
3462
3470
|
autoResize && resizeToContents(ref.current);
|
|
@@ -3534,35 +3542,21 @@ function TextAreaEntry(props) {
|
|
|
3534
3542
|
autoResize,
|
|
3535
3543
|
tooltip
|
|
3536
3544
|
} = props;
|
|
3545
|
+
const value = getValue(element);
|
|
3537
3546
|
const globalError = useError(id);
|
|
3538
|
-
const
|
|
3539
|
-
let value = getValue(element);
|
|
3540
|
-
hooks.useEffect(() => {
|
|
3541
|
-
if (minDash.isFunction(validate)) {
|
|
3542
|
-
const newValidationError = validate(value) || null;
|
|
3543
|
-
setLocalError(newValidationError);
|
|
3544
|
-
}
|
|
3545
|
-
}, [value, validate]);
|
|
3546
|
-
const onInput = hooks.useCallback(newValue => {
|
|
3547
|
-
const value = getValue(element);
|
|
3548
|
-
let newValidationError = null;
|
|
3549
|
-
if (minDash.isFunction(validate)) {
|
|
3550
|
-
newValidationError = validate(newValue) || null;
|
|
3551
|
-
}
|
|
3552
|
-
if (newValue !== value) {
|
|
3553
|
-
setValue(newValue, newValidationError);
|
|
3554
|
-
}
|
|
3555
|
-
setLocalError(newValidationError);
|
|
3556
|
-
}, [element, getValue, setValue, validate]);
|
|
3547
|
+
const localError = validate?.(value) || null;
|
|
3557
3548
|
const error = globalError || localError;
|
|
3558
3549
|
return jsxRuntime.jsxs("div", {
|
|
3559
3550
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
3560
3551
|
"data-entry-id": id,
|
|
3561
|
-
children: [jsxRuntime.jsx(
|
|
3552
|
+
children: [jsxRuntime.jsx(TextInput, {
|
|
3553
|
+
Component: TextArea,
|
|
3554
|
+
getValue: getValue,
|
|
3555
|
+
setValue: setValue,
|
|
3556
|
+
validate: validate,
|
|
3562
3557
|
id: id,
|
|
3563
3558
|
label: label,
|
|
3564
3559
|
value: value,
|
|
3565
|
-
onInput: onInput,
|
|
3566
3560
|
onFocus: onFocus,
|
|
3567
3561
|
onBlur: onBlur,
|
|
3568
3562
|
rows: rows,
|
|
@@ -3595,7 +3589,6 @@ function prefixId$2(id) {
|
|
|
3595
3589
|
|
|
3596
3590
|
function Textfield(props) {
|
|
3597
3591
|
const {
|
|
3598
|
-
debounce,
|
|
3599
3592
|
disabled = false,
|
|
3600
3593
|
id,
|
|
3601
3594
|
label,
|
|
@@ -3608,23 +3601,12 @@ function Textfield(props) {
|
|
|
3608
3601
|
} = props;
|
|
3609
3602
|
const [localValue, setLocalValue] = hooks.useState(value || '');
|
|
3610
3603
|
const ref = useShowEntryEvent(id);
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
* @type { import('min-dash').DebouncedFunction }
|
|
3614
|
-
*/
|
|
3615
|
-
const handleInputCallback = useDebounce(onInput, debounce);
|
|
3616
|
-
const handleOnBlur = e => {
|
|
3617
|
-
const trimmedValue = e.target.value.trim();
|
|
3618
|
-
|
|
3619
|
-
// trim and commit on blur
|
|
3620
|
-
onInput(trimmedValue);
|
|
3621
|
-
if (onBlur) {
|
|
3622
|
-
onBlur(e);
|
|
3623
|
-
}
|
|
3604
|
+
const handleOnBlur = () => {
|
|
3605
|
+
onBlur?.(localValue);
|
|
3624
3606
|
};
|
|
3625
3607
|
const handleInput = newValue => {
|
|
3626
3608
|
const newModelValue = newValue === '' ? undefined : newValue;
|
|
3627
|
-
|
|
3609
|
+
onInput(newModelValue);
|
|
3628
3610
|
};
|
|
3629
3611
|
const handleLocalInput = e => {
|
|
3630
3612
|
if (e.target.value === localValue) {
|
|
@@ -3699,39 +3681,25 @@ function TextfieldEntry(props) {
|
|
|
3699
3681
|
placeholder,
|
|
3700
3682
|
tooltip
|
|
3701
3683
|
} = props;
|
|
3684
|
+
const value = getValue(element);
|
|
3702
3685
|
const globalError = useError(id);
|
|
3703
|
-
const
|
|
3704
|
-
let value = getValue(element);
|
|
3705
|
-
hooks.useEffect(() => {
|
|
3706
|
-
if (minDash.isFunction(validate)) {
|
|
3707
|
-
const newValidationError = validate(value) || null;
|
|
3708
|
-
setLocalError(newValidationError);
|
|
3709
|
-
}
|
|
3710
|
-
}, [value, validate]);
|
|
3711
|
-
const onInput = hooks.useCallback(newValue => {
|
|
3712
|
-
const value = getValue(element);
|
|
3713
|
-
let newValidationError = null;
|
|
3714
|
-
if (minDash.isFunction(validate)) {
|
|
3715
|
-
newValidationError = validate(newValue) || null;
|
|
3716
|
-
}
|
|
3717
|
-
if (newValue !== value) {
|
|
3718
|
-
setValue(newValue, newValidationError);
|
|
3719
|
-
}
|
|
3720
|
-
setLocalError(newValidationError);
|
|
3721
|
-
}, [element, getValue, setValue, validate]);
|
|
3686
|
+
const localError = validate?.(value) || null;
|
|
3722
3687
|
const error = globalError || localError;
|
|
3723
3688
|
return jsxRuntime.jsxs("div", {
|
|
3724
3689
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
3725
3690
|
"data-entry-id": id,
|
|
3726
|
-
children: [jsxRuntime.jsx(
|
|
3691
|
+
children: [jsxRuntime.jsx(TextInput, {
|
|
3692
|
+
Component: Textfield,
|
|
3727
3693
|
debounce: debounce,
|
|
3728
3694
|
disabled: disabled,
|
|
3695
|
+
getValue: getValue,
|
|
3729
3696
|
id: id,
|
|
3730
3697
|
label: label,
|
|
3731
|
-
onInput: onInput,
|
|
3732
3698
|
onFocus: onFocus,
|
|
3733
3699
|
onBlur: onBlur,
|
|
3734
3700
|
placeholder: placeholder,
|
|
3701
|
+
setValue: setValue,
|
|
3702
|
+
validate: validate,
|
|
3735
3703
|
value: value,
|
|
3736
3704
|
tooltip: tooltip,
|
|
3737
3705
|
element: element
|