@bpmn-io/properties-panel 3.38.0 → 3.40.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/index.esm.js +67 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +67 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2384,7 +2384,7 @@ function prefixId$6(id) {
|
|
|
2384
2384
|
const noop$2 = () => {};
|
|
2385
2385
|
|
|
2386
2386
|
/**
|
|
2387
|
-
* @typedef {'required'|'optional'|'static'} FeelType
|
|
2387
|
+
* @typedef {'required'|'optional'|'optional-default-enabled'|'static'} FeelType
|
|
2388
2388
|
*/
|
|
2389
2389
|
|
|
2390
2390
|
/**
|
|
@@ -2427,7 +2427,7 @@ function FeelTextfield(props) {
|
|
|
2427
2427
|
OptionalComponent = OptionalFeelInput,
|
|
2428
2428
|
tooltip
|
|
2429
2429
|
} = props;
|
|
2430
|
-
const [localValue, setLocalValue] = hooks.useState(value);
|
|
2430
|
+
const [localValue, setLocalValue] = hooks.useState(getInitialFeelLocalValue(feel, value));
|
|
2431
2431
|
const editorRef = useShowEntryEvent(id);
|
|
2432
2432
|
const containerRef = hooks.useRef();
|
|
2433
2433
|
const onInput = hooks.useCallback(newValue => {
|
|
@@ -2436,8 +2436,8 @@ function FeelTextfield(props) {
|
|
|
2436
2436
|
const newModelValue = newValue === '' || newValue === '=' ? undefined : newValue;
|
|
2437
2437
|
commitValue(newModelValue);
|
|
2438
2438
|
}, [commitValue]);
|
|
2439
|
-
const feelActive =
|
|
2440
|
-
const feelOnlyValue =
|
|
2439
|
+
const feelActive = isFeelActive(feel, localValue);
|
|
2440
|
+
const feelOnlyValue = getFeelValue(localValue);
|
|
2441
2441
|
const feelLanguageContext = hooks.useContext(FeelLanguageContext);
|
|
2442
2442
|
const [focus, _setFocus] = hooks.useState(undefined);
|
|
2443
2443
|
const {
|
|
@@ -2624,7 +2624,7 @@ function FeelTextfield(props) {
|
|
|
2624
2624
|
ref: containerRef,
|
|
2625
2625
|
children: [jsxRuntime.jsx(FeelIndicator, {
|
|
2626
2626
|
active: feelActive,
|
|
2627
|
-
disabled: feel
|
|
2627
|
+
disabled: !isFeelOptional(feel) || disabled,
|
|
2628
2628
|
onClick: handleFeelToggle
|
|
2629
2629
|
}), feelActive ? jsxRuntime.jsx(FeelEditor, {
|
|
2630
2630
|
name: id,
|
|
@@ -3137,6 +3137,68 @@ function prefixId$5(id) {
|
|
|
3137
3137
|
return `bio-properties-panel-${id}`;
|
|
3138
3138
|
}
|
|
3139
3139
|
|
|
3140
|
+
/**
|
|
3141
|
+
* Determine if FEEL is optional for the configured {@link FeelType}.
|
|
3142
|
+
*
|
|
3143
|
+
* @param {FeelType} feelType
|
|
3144
|
+
*
|
|
3145
|
+
* @return {boolean}
|
|
3146
|
+
*/
|
|
3147
|
+
function isFeelOptional(feelType) {
|
|
3148
|
+
return feelType === 'optional' || feelType === 'optional-default-enabled';
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
/**
|
|
3152
|
+
* Determine if FEEL editing is currently active.
|
|
3153
|
+
*
|
|
3154
|
+
* @param {FeelType} feelType
|
|
3155
|
+
* @param {string} localValue
|
|
3156
|
+
*
|
|
3157
|
+
* @return {boolean}
|
|
3158
|
+
*/
|
|
3159
|
+
function isFeelActive(feelType, localValue) {
|
|
3160
|
+
if (feelType === 'required') {
|
|
3161
|
+
return true;
|
|
3162
|
+
}
|
|
3163
|
+
if (minDash.isString(localValue)) {
|
|
3164
|
+
if (localValue.startsWith('=')) {
|
|
3165
|
+
return true;
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
return false;
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
/**
|
|
3172
|
+
* @template T
|
|
3173
|
+
* @param {T} value
|
|
3174
|
+
*
|
|
3175
|
+
* @return {string|T}
|
|
3176
|
+
*/
|
|
3177
|
+
function getFeelValue(value) {
|
|
3178
|
+
if (minDash.isString(value) && value.startsWith('=')) {
|
|
3179
|
+
return value.substring(1);
|
|
3180
|
+
}
|
|
3181
|
+
return value;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3184
|
+
/**
|
|
3185
|
+
* Initialize local FEEL value.
|
|
3186
|
+
*
|
|
3187
|
+
* `optional-default-enabled` starts in FEEL mode if no value or empty string is provided.
|
|
3188
|
+
*
|
|
3189
|
+
* @template T
|
|
3190
|
+
* @param {FeelType} feelType
|
|
3191
|
+
* @param {T} value
|
|
3192
|
+
*
|
|
3193
|
+
* @return {string|T}
|
|
3194
|
+
*/
|
|
3195
|
+
function getInitialFeelLocalValue(feelType, value) {
|
|
3196
|
+
if (feelType === 'optional-default-enabled' && (value === undefined || value === '')) {
|
|
3197
|
+
return '=';
|
|
3198
|
+
}
|
|
3199
|
+
return value;
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3140
3202
|
const noop$1 = () => {};
|
|
3141
3203
|
|
|
3142
3204
|
/**
|