@bpmn-io/properties-panel 3.27.3 → 3.27.5
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 +31 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, useState, useRef, useEffect, useMemo,
|
|
1
|
+
import { useContext, useState, useRef, useCallback, useEffect, useMemo, useLayoutEffect } from '../preact/hooks';
|
|
2
2
|
import { isFunction, isString, isArray, get, assign, set, isNumber, debounce } from 'min-dash';
|
|
3
3
|
import { createPortal, forwardRef } from '../preact/compat';
|
|
4
4
|
import { jsx, jsxs, Fragment } from '../preact/jsx-runtime';
|
|
@@ -402,6 +402,18 @@ function useDescriptionContext(id, element) {
|
|
|
402
402
|
return getDescriptionForId(id, element);
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
+
function useDebounce(callback, debounceFn) {
|
|
406
|
+
const debouncedCallback = useCallback(debounceFn(callback), [callback, debounceFn]);
|
|
407
|
+
|
|
408
|
+
// make sure previous call is not stalled
|
|
409
|
+
useEffect(() => {
|
|
410
|
+
return () => {
|
|
411
|
+
debouncedCallback.flush?.();
|
|
412
|
+
};
|
|
413
|
+
}, [debouncedCallback]);
|
|
414
|
+
return debouncedCallback;
|
|
415
|
+
}
|
|
416
|
+
|
|
405
417
|
function useError(id) {
|
|
406
418
|
const {
|
|
407
419
|
errors
|
|
@@ -2008,11 +2020,7 @@ function FeelTextfieldComponent(props) {
|
|
|
2008
2020
|
/**
|
|
2009
2021
|
* @type { import('min-dash').DebouncedFunction }
|
|
2010
2022
|
*/
|
|
2011
|
-
const handleInputCallback =
|
|
2012
|
-
return debounce(newValue => {
|
|
2013
|
-
onInput(newValue);
|
|
2014
|
-
});
|
|
2015
|
-
}, [onInput, debounce]);
|
|
2023
|
+
const handleInputCallback = useDebounce(onInput, debounce);
|
|
2016
2024
|
const handleInput = newValue => {
|
|
2017
2025
|
// we don't commit empty FEEL expressions,
|
|
2018
2026
|
// but instead serialize them as <undefined>
|
|
@@ -2046,14 +2054,10 @@ function FeelTextfieldComponent(props) {
|
|
|
2046
2054
|
}
|
|
2047
2055
|
};
|
|
2048
2056
|
const handleOnBlur = e => {
|
|
2049
|
-
const
|
|
2057
|
+
const trimmedValue = e.target.value.trim();
|
|
2050
2058
|
|
|
2051
|
-
//
|
|
2052
|
-
|
|
2053
|
-
if (value.trim() !== value) {
|
|
2054
|
-
setLocalValue(value.trim());
|
|
2055
|
-
handleInput(value.trim());
|
|
2056
|
-
}
|
|
2059
|
+
// trim and commit on blur
|
|
2060
|
+
onInput(trimmedValue);
|
|
2057
2061
|
if (onBlur) {
|
|
2058
2062
|
onBlur(e);
|
|
2059
2063
|
}
|
|
@@ -2464,7 +2468,7 @@ function FeelEntry(props) {
|
|
|
2464
2468
|
setValue(newValue, newValidationError);
|
|
2465
2469
|
}
|
|
2466
2470
|
setValidationError(newValidationError);
|
|
2467
|
-
}, [element]);
|
|
2471
|
+
}, [element, getValue, setValue, validate]);
|
|
2468
2472
|
const onError = useCallback(err => {
|
|
2469
2473
|
setLocalError(err);
|
|
2470
2474
|
}, []);
|
|
@@ -4005,11 +4009,7 @@ function TextArea(props) {
|
|
|
4005
4009
|
/**
|
|
4006
4010
|
* @type { import('min-dash').DebouncedFunction }
|
|
4007
4011
|
*/
|
|
4008
|
-
const handleInputCallback =
|
|
4009
|
-
return debounce(newValue => {
|
|
4010
|
-
onInput(newValue);
|
|
4011
|
-
});
|
|
4012
|
-
}, [onInput, debounce]);
|
|
4012
|
+
const handleInputCallback = useDebounce(onInput, debounce);
|
|
4013
4013
|
const handleInput = newValue => {
|
|
4014
4014
|
const newModelValue = newValue === '' ? undefined : newValue;
|
|
4015
4015
|
handleInputCallback(newModelValue);
|
|
@@ -4023,11 +4023,10 @@ function TextArea(props) {
|
|
|
4023
4023
|
handleInput(e.target.value);
|
|
4024
4024
|
};
|
|
4025
4025
|
const handleOnBlur = e => {
|
|
4026
|
-
const
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
}
|
|
4026
|
+
const trimmedValue = e.target.value.trim();
|
|
4027
|
+
|
|
4028
|
+
// trim and commit on blur
|
|
4029
|
+
onInput(trimmedValue);
|
|
4031
4030
|
if (onBlur) {
|
|
4032
4031
|
onBlur(e);
|
|
4033
4032
|
}
|
|
@@ -4127,7 +4126,7 @@ function TextAreaEntry(props) {
|
|
|
4127
4126
|
setValue(newValue, newValidationError);
|
|
4128
4127
|
}
|
|
4129
4128
|
setLocalError(newValidationError);
|
|
4130
|
-
}, [element]);
|
|
4129
|
+
}, [element, getValue, setValue, validate]);
|
|
4131
4130
|
const error = globalError || localError;
|
|
4132
4131
|
return jsxs("div", {
|
|
4133
4132
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
@@ -4186,17 +4185,12 @@ function Textfield(props) {
|
|
|
4186
4185
|
/**
|
|
4187
4186
|
* @type { import('min-dash').DebouncedFunction }
|
|
4188
4187
|
*/
|
|
4189
|
-
const handleInputCallback =
|
|
4190
|
-
return debounce(newValue => {
|
|
4191
|
-
onInput(newValue);
|
|
4192
|
-
});
|
|
4193
|
-
}, [onInput, debounce]);
|
|
4188
|
+
const handleInputCallback = useDebounce(onInput, debounce);
|
|
4194
4189
|
const handleOnBlur = e => {
|
|
4195
|
-
const
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
}
|
|
4190
|
+
const trimmedValue = e.target.value.trim();
|
|
4191
|
+
|
|
4192
|
+
// trim and commit on blur
|
|
4193
|
+
onInput(trimmedValue);
|
|
4200
4194
|
if (onBlur) {
|
|
4201
4195
|
onBlur(e);
|
|
4202
4196
|
}
|
|
@@ -4297,7 +4291,7 @@ function TextfieldEntry(props) {
|
|
|
4297
4291
|
setValue(newValue, newValidationError);
|
|
4298
4292
|
}
|
|
4299
4293
|
setLocalError(newValidationError);
|
|
4300
|
-
}, [element]);
|
|
4294
|
+
}, [element, getValue, setValue, validate]);
|
|
4301
4295
|
const error = globalError || localError;
|
|
4302
4296
|
return jsxs("div", {
|
|
4303
4297
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
@@ -4415,5 +4409,5 @@ var index = {
|
|
|
4415
4409
|
feelPopup: ['type', FeelPopupModule]
|
|
4416
4410
|
};
|
|
4417
4411
|
|
|
4418
|
-
export { ArrowIcon, CheckboxEntry, CloseIcon, CollapsibleEntry, CreateIcon, index$1 as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DragIcon, DropdownButton, ErrorsContext, EventContext, ExternalLinkIcon, FeelCheckboxEntry, FeelEntry, FeelIcon$1 as FeelIcon, FeelNumberEntry, index as FeelPopupModule, FeelTemplatingEntry, FeelTextAreaEntry, FeelToggleSwitchEntry, Group, Header, HeaderButton, LaunchIcon, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, Placeholder, Popup, PopupIcon, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TemplatingEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, TooltipContext, TooltipWrapper as TooltipEntry, isEdited$5 as isCheckboxEntryEdited, isEdited$6 as isFeelEntryEdited, isEdited$7 as isNumberFieldEntryEdited, isEdited$3 as isSelectEntryEdited, isEdited$2 as isSimpleEntryEdited, isEdited$4 as isTemplatingEntryEdited, isEdited$1 as isTextAreaEntryEdited, isEdited as isTextFieldEntryEdited, isEdited$8 as isToggleSwitchEntryEdited, useDescriptionContext, useElementVisible, useError, useErrors, useEvent, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver, useTooltipContext };
|
|
4412
|
+
export { ArrowIcon, CheckboxEntry, CloseIcon, CollapsibleEntry, CreateIcon, index$1 as DebounceInputModule, DeleteIcon, DescriptionContext, Description as DescriptionEntry, DragIcon, DropdownButton, ErrorsContext, EventContext, ExternalLinkIcon, FeelCheckboxEntry, FeelEntry, FeelIcon$1 as FeelIcon, FeelNumberEntry, index as FeelPopupModule, FeelTemplatingEntry, FeelTextAreaEntry, FeelToggleSwitchEntry, Group, Header, HeaderButton, LaunchIcon, LayoutContext, List as ListEntry, ListGroup, ListItem, NumberFieldEntry, Placeholder, Popup, PopupIcon, PropertiesPanel, LayoutContext as PropertiesPanelContext, SelectEntry, Simple as SimpleEntry, TemplatingEntry, TextAreaEntry, TextfieldEntry as TextFieldEntry, ToggleSwitchEntry, TooltipContext, TooltipWrapper as TooltipEntry, isEdited$5 as isCheckboxEntryEdited, isEdited$6 as isFeelEntryEdited, isEdited$7 as isNumberFieldEntryEdited, isEdited$3 as isSelectEntryEdited, isEdited$2 as isSimpleEntryEdited, isEdited$4 as isTemplatingEntryEdited, isEdited$1 as isTextAreaEntryEdited, isEdited as isTextFieldEntryEdited, isEdited$8 as isToggleSwitchEntryEdited, useDebounce, useDescriptionContext, useElementVisible, useError, useErrors, useEvent, useKeyFactory, useLayoutState, usePrevious, useShowEntryEvent, useStaticCallback, useStickyIntersectionObserver, useTooltipContext };
|
|
4419
4413
|
//# sourceMappingURL=index.esm.js.map
|