@bpmn-io/properties-panel 3.15.0 → 3.17.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.js CHANGED
@@ -305,7 +305,9 @@ function Tooltip(props) {
305
305
  const {
306
306
  forId,
307
307
  value,
308
- parent
308
+ parent,
309
+ direction = 'right',
310
+ position
309
311
  } = props;
310
312
  const [visible, setShow] = hooks.useState(false);
311
313
  const [focusedViaKeyboard, setFocusedViaKeyboard] = hooks.useState(false);
@@ -374,11 +376,11 @@ function Tooltip(props) {
374
376
  }, [wrapperRef.current, visible, focusedViaKeyboard]);
375
377
  const renderTooltip = () => {
376
378
  return jsxRuntime.jsxs("div", {
377
- class: "bio-properties-panel-tooltip",
379
+ class: `bio-properties-panel-tooltip ${direction}`,
378
380
  role: "tooltip",
379
381
  id: "bio-properties-panel-tooltip",
380
382
  "aria-labelledby": forId,
381
- style: getTooltipPosition(wrapperRef.current),
383
+ style: position || getTooltipPosition(wrapperRef.current),
382
384
  ref: tooltipRef,
383
385
  onClick: e => e.stopPropagation(),
384
386
  children: [jsxRuntime.jsx("div", {
@@ -1031,7 +1033,7 @@ const CodeEditor = compat.forwardRef((props, ref) => {
1031
1033
  tooltipContainer: tooltipContainer,
1032
1034
  value: localValue,
1033
1035
  variables: variables,
1034
- extensions: [...(enableGutters ? [view.lineNumbers()] : [])]
1036
+ extensions: [...(enableGutters ? [view.lineNumbers()] : []), view.EditorView.lineWrapping]
1035
1037
  });
1036
1038
  setEditor(editor);
1037
1039
  return () => {
@@ -1289,6 +1291,7 @@ function PopupComponent(props, globalRef) {
1289
1291
  }
1290
1292
  return () => focusTrapRef.current && focusTrapRef.current.deactivate();
1291
1293
  }, [popupRef]);
1294
+ useEvent('propertiesPanel.detach', onClose);
1292
1295
  return compat.createPortal(jsxRuntime.jsx("div", {
1293
1296
  "aria-label": title,
1294
1297
  tabIndex: -1,
@@ -1468,7 +1471,13 @@ function FEELPopupRoot(props) {
1468
1471
  setSourceElement(_sourceElement);
1469
1472
  emit('open');
1470
1473
  };
1471
- const handleClose = () => {
1474
+ const handleClose = (event = {}) => {
1475
+ const {
1476
+ id
1477
+ } = event;
1478
+ if (id && id !== source) {
1479
+ return;
1480
+ }
1472
1481
  setOpen(false);
1473
1482
  setSource(null);
1474
1483
  };
@@ -1637,7 +1646,7 @@ function FeelPopupComponent(props) {
1637
1646
  }), jsxRuntime.jsx(Popup.Footer, {
1638
1647
  children: jsxRuntime.jsx("button", {
1639
1648
  type: "button",
1640
- onClick: onClose,
1649
+ onClick: () => onClose(),
1641
1650
  title: "Close pop-up editor",
1642
1651
  class: "bio-properties-panel-feel-popup__close-btn",
1643
1652
  children: "Close"
@@ -1899,7 +1908,7 @@ function NumberFieldEntry(props) {
1899
1908
  const newValidationError = validate(value) || null;
1900
1909
  setLocalError(newValidationError);
1901
1910
  }
1902
- }, [value]);
1911
+ }, [value, validate]);
1903
1912
  const onInput = newValue => {
1904
1913
  let newValidationError = null;
1905
1914
  if (minDash.isFunction(validate)) {
@@ -1945,7 +1954,7 @@ function prefixId$6(id) {
1945
1954
  }
1946
1955
 
1947
1956
  const noop$2 = () => {};
1948
- function FeelTextfield(props) {
1957
+ function FeelTextfieldComponent(props) {
1949
1958
  const {
1950
1959
  debounce,
1951
1960
  id,
@@ -2147,6 +2156,7 @@ function FeelTextfield(props) {
2147
2156
  })]
2148
2157
  });
2149
2158
  }
2159
+ const FeelTextfield = withAutoClosePopup(FeelTextfieldComponent);
2150
2160
  const OptionalFeelInput = compat.forwardRef((props, ref) => {
2151
2161
  const {
2152
2162
  id,
@@ -2399,7 +2409,7 @@ function FeelEntry(props) {
2399
2409
  const newValidationError = validate(value) || null;
2400
2410
  setValidationError(newValidationError);
2401
2411
  }
2402
- }, [value]);
2412
+ }, [value, validate]);
2403
2413
  const onInput = useStaticCallback(newValue => {
2404
2414
  let newValidationError = null;
2405
2415
  if (minDash.isFunction(validate)) {
@@ -2625,6 +2635,27 @@ function getPopupTitle(element, label) {
2625
2635
  }
2626
2636
  return `${popupTitle}${label}`;
2627
2637
  }
2638
+ function withAutoClosePopup(Component) {
2639
+ return function (props) {
2640
+ const {
2641
+ id
2642
+ } = props;
2643
+ const {
2644
+ close
2645
+ } = hooks.useContext(FeelPopupContext);
2646
+ const closePopup = useStaticCallback(close);
2647
+ hooks.useEffect(() => {
2648
+ return () => {
2649
+ closePopup({
2650
+ id
2651
+ });
2652
+ };
2653
+ }, []);
2654
+ return jsxRuntime.jsx(Component, {
2655
+ ...props
2656
+ });
2657
+ };
2658
+ }
2628
2659
 
2629
2660
  const DEFAULT_LAYOUT = {};
2630
2661
  const DEFAULT_DESCRIPTION = {};
@@ -3465,7 +3496,7 @@ function TemplatingEntry(props) {
3465
3496
  const newValidationError = validate(value) || null;
3466
3497
  setValidationError(newValidationError);
3467
3498
  }
3468
- }, [value]);
3499
+ }, [value, validate]);
3469
3500
  const onInput = useStaticCallback(newValue => {
3470
3501
  let newValidationError = null;
3471
3502
  if (minDash.isFunction(validate)) {
@@ -3887,7 +3918,7 @@ function SelectEntry(props) {
3887
3918
  const newValidationError = validate(value) || null;
3888
3919
  setLocalError(newValidationError);
3889
3920
  }
3890
- }, [value]);
3921
+ }, [value, validate]);
3891
3922
  const onChange = newValue => {
3892
3923
  let newValidationError = null;
3893
3924
  if (minDash.isFunction(validate)) {
@@ -4096,7 +4127,7 @@ function TextAreaEntry(props) {
4096
4127
  const newValidationError = validate(value) || null;
4097
4128
  setLocalError(newValidationError);
4098
4129
  }
4099
- }, [value]);
4130
+ }, [value, validate]);
4100
4131
  const onInput = newValue => {
4101
4132
  let newValidationError = null;
4102
4133
  if (minDash.isFunction(validate)) {
@@ -4236,7 +4267,7 @@ function TextfieldEntry(props) {
4236
4267
  const newValidationError = validate(value) || null;
4237
4268
  setLocalError(newValidationError);
4238
4269
  }
4239
- }, [value]);
4270
+ }, [value, validate]);
4240
4271
  const onInput = newValue => {
4241
4272
  let newValidationError = null;
4242
4273
  if (minDash.isFunction(validate)) {
@@ -4380,6 +4411,7 @@ exports.TextAreaEntry = TextAreaEntry;
4380
4411
  exports.TextFieldEntry = TextfieldEntry;
4381
4412
  exports.ToggleSwitchEntry = ToggleSwitchEntry;
4382
4413
  exports.TooltipContext = TooltipContext;
4414
+ exports.TooltipEntry = TooltipWrapper;
4383
4415
  exports.isCheckboxEntryEdited = isEdited$5;
4384
4416
  exports.isFeelEntryEdited = isEdited$6;
4385
4417
  exports.isNumberFieldEntryEdited = isEdited$7;