@bpmn-io/properties-panel 3.34.0 → 3.35.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 CHANGED
@@ -552,8 +552,6 @@ function useEvent(event, callback, eventBus) {
552
552
  }, [callback, event, eventBus]);
553
553
  }
554
554
 
555
- const KEY_LENGTH = 6;
556
-
557
555
  /**
558
556
  * Create a persistent key factory for plain objects without id.
559
557
  *
@@ -578,7 +576,7 @@ function useKeyFactory(dependencies = []) {
578
576
  const getKey = el => {
579
577
  let key = map.get(el);
580
578
  if (!key) {
581
- key = Math.random().toString().slice(-KEY_LENGTH);
579
+ key = Math.random().toString().slice(-6);
582
580
  map.set(el, key);
583
581
  }
584
582
  return key;
@@ -2342,6 +2340,7 @@ function FeelTextfield(props) {
2342
2340
  const [localValue, setLocalValue] = useState(value);
2343
2341
  const editorRef = useShowEntryEvent(id);
2344
2342
  const containerRef = useRef();
2343
+ const isTogglingFromPasteRef = useRef(false);
2345
2344
  const onInput = useCallback(newValue => {
2346
2345
  // we don't commit empty FEEL expressions,
2347
2346
  // but instead serialize them as <undefined>
@@ -2384,9 +2383,6 @@ function FeelTextfield(props) {
2384
2383
  if (feelActive) {
2385
2384
  newValue = '=' + newValue;
2386
2385
  }
2387
- if (newValue === localValue) {
2388
- return;
2389
- }
2390
2386
  setLocalValue(newValue);
2391
2387
  if (useDebounce) {
2392
2388
  handleInput(newValue);
@@ -2399,6 +2395,11 @@ function FeelTextfield(props) {
2399
2395
  }
2400
2396
  };
2401
2397
  const handleOnBlur = e => {
2398
+ // Ignore blur when toggling from paste to avoid interference
2399
+ if (isTogglingFromPasteRef.current) {
2400
+ isTogglingFromPasteRef.current = false;
2401
+ return;
2402
+ }
2402
2403
  handleInput.cancel?.();
2403
2404
  if (e.target.type === 'checkbox') {
2404
2405
  onInput(e.target.checked);
@@ -2497,6 +2498,10 @@ function FeelTextfield(props) {
2497
2498
  const trimmedValue = textData.trim();
2498
2499
  setLocalValue(trimmedValue);
2499
2500
  handleInput(trimmedValue);
2501
+ if (!feelActive && isString(trimmedValue) && trimmedValue.startsWith('=')) {
2502
+ isTogglingFromPasteRef.current = true;
2503
+ setFocus(trimmedValue.length - 1);
2504
+ }
2500
2505
  event.preventDefault();
2501
2506
  }
2502
2507
  };