@bpmn-io/properties-panel 0.20.0 → 0.20.1

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.
@@ -517,7 +517,12 @@ textarea.bio-properties-panel-input {
517
517
  background-color: var(--input-error-background-color);
518
518
  }
519
519
 
520
- .bio-properties-panel-entry.has-error .bio-properties-panel-input:focus {
520
+ .bio-properties-panel-entry.has-error .bio-properties-panel-feel-indicator {
521
+ border-color: var(--input-error-border-color);
522
+ }
523
+
524
+ .bio-properties-panel-entry.has-error .bio-properties-panel-input:focus,
525
+ .bio-properties-panel-entry.has-error .bio-properties-panel-feel-indicator:focus {
521
526
  border-color: var(--input-error-focus-border-color);
522
527
  }
523
528
 
package/dist/index.esm.js CHANGED
@@ -10,7 +10,7 @@ var ArrowIcon = function ArrowIcon(props) {
10
10
  return jsx("svg", { ...props,
11
11
  children: jsx("path", {
12
12
  fillRule: "evenodd",
13
- d: "m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8z"
13
+ d: "m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8Z"
14
14
  })
15
15
  });
16
16
  };
@@ -25,7 +25,7 @@ var CreateIcon = function CreateIcon(props) {
25
25
  return jsx("svg", { ...props,
26
26
  children: jsx("path", {
27
27
  fillRule: "evenodd",
28
- d: "M9 13V9h4a1 1 0 0 0 0-2H9V3a1 1 0 1 0-2 0v4H3a1 1 0 1 0 0 2h4v4a1 1 0 0 0 2 0z"
28
+ d: "M9 13V9h4a1 1 0 0 0 0-2H9V3a1 1 0 1 0-2 0v4H3a1 1 0 1 0 0 2h4v4a1 1 0 0 0 2 0Z"
29
29
  })
30
30
  });
31
31
  };
@@ -40,7 +40,7 @@ var DeleteIcon = function DeleteIcon(props) {
40
40
  return jsx("svg", { ...props,
41
41
  children: jsx("path", {
42
42
  fillRule: "evenodd",
43
- d: "M12 6v7c0 1.1-.4 1.55-1.5 1.55h-5C4.4 14.55 4 14.1 4 13V6h8zm-1.5 1.5h-5v4.3c0 .66.5 1.2 1.111 1.2H9.39c.611 0 1.111-.54 1.111-1.2V7.5zM13 3h-2l-1-1H6L5 3H3v1.5h10V3z"
43
+ d: "M12 6v7c0 1.1-.4 1.55-1.5 1.55h-5C4.4 14.55 4 14.1 4 13V6h8Zm-1.5 1.5h-5v4.3c0 .66.5 1.2 1.111 1.2H9.39c.611 0 1.111-.54 1.111-1.2V7.5ZM13 3h-2l-1-1H6L5 3H3v1.5h10V3Z"
44
44
  })
45
45
  });
46
46
  };
@@ -56,7 +56,7 @@ var ExternalLinkIcon = function ExternalLinkIcon(props) {
56
56
  children: jsx("path", {
57
57
  fillRule: "evenodd",
58
58
  clipRule: "evenodd",
59
- d: "M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274zM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2z",
59
+ d: "M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274ZM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2Z",
60
60
  fill: "#818798"
61
61
  })
62
62
  });
@@ -72,15 +72,15 @@ ExternalLinkIcon.defaultProps = {
72
72
  var FeelRequiredIcon = function FeelRequiredIcon(props) {
73
73
  return jsxs("svg", { ...props,
74
74
  children: [jsx("path", {
75
- d: "M5.8 7.06V5.95h4.307v1.11H5.8zm0 3.071v-1.11h4.307v1.11H5.8z",
75
+ d: "M5.8 7.06V5.95h4.307v1.11H5.8Zm0 3.071v-1.11h4.307v1.11H5.8Z",
76
76
  fill: "currentColor"
77
77
  }), jsx("path", {
78
78
  fillRule: "evenodd",
79
79
  clipRule: "evenodd",
80
- d: "M8 3.268A4.732 4.732 0 1 0 12.732 8H14a6 6 0 1 1-6-6v1.268z",
80
+ d: "M8 3.268A4.732 4.732 0 1 0 12.732 8H14a6 6 0 1 1-6-6v1.268Z",
81
81
  fill: "currentColor"
82
82
  }), jsx("path", {
83
- d: "m11.28 6.072-.832-.56 1.016-1.224L10 3.848l.312-.912 1.392.584L11.632 2h1.032l-.072 1.52 1.392-.584.312.912-1.464.44 1.008 1.224-.832.552-.864-1.296-.864 1.304z",
83
+ d: "m11.28 6.072-.832-.56 1.016-1.224L10 3.848l.312-.912 1.392.584L11.632 2h1.032l-.072 1.52 1.392-.584.312.912-1.464.44 1.008 1.224-.832.552-.864-1.296-.864 1.304Z",
84
84
  fill: "currentColor"
85
85
  })]
86
86
  });
@@ -95,12 +95,12 @@ FeelRequiredIcon.defaultProps = {
95
95
  var FeelOptionalIcon = function FeelOptionalIcon(props) {
96
96
  return jsxs("svg", { ...props,
97
97
  children: [jsx("path", {
98
- d: "M5.845 7.04V5.93h4.307v1.11H5.845zm0 3.07V9h4.307v1.11H5.845z",
98
+ d: "M5.845 7.04V5.93h4.307v1.11H5.845Zm0 3.07V9h4.307v1.11H5.845Z",
99
99
  fill: "currentColor"
100
100
  }), jsx("path", {
101
101
  fillRule: "evenodd",
102
102
  clipRule: "evenodd",
103
- d: "M3.286 8a4.714 4.714 0 1 0 9.428 0 4.714 4.714 0 0 0-9.428 0zM8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z",
103
+ d: "M3.286 8a4.714 4.714 0 1 0 9.428 0 4.714 4.714 0 0 0-9.428 0ZM8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Z",
104
104
  fill: "currentColor"
105
105
  })]
106
106
  });
@@ -4965,6 +4965,7 @@ const CodeEditor = forwardRef((props, ref) => {
4965
4965
  value,
4966
4966
  onInput,
4967
4967
  onFeelToggle,
4968
+ onLint = () => {},
4968
4969
  disabled,
4969
4970
  variables
4970
4971
  } = props;
@@ -5001,11 +5002,13 @@ const CodeEditor = forwardRef((props, ref) => {
5001
5002
  container: inputRef.current,
5002
5003
  onChange: handleInput,
5003
5004
  onKeyDown: onKeyDown,
5005
+ onLint: onLint,
5004
5006
  value: localValue,
5005
5007
  variables: variables
5006
5008
  });
5007
5009
  setEditor(editor);
5008
5010
  return () => {
5011
+ onLint([]);
5009
5012
  inputRef.current.innerHTML = '';
5010
5013
  setEditor(null);
5011
5014
  };
@@ -5022,12 +5025,18 @@ const CodeEditor = forwardRef((props, ref) => {
5022
5025
  editor.setValue(value);
5023
5026
  setLocalValue(value);
5024
5027
  }, [value]);
5028
+
5029
+ const handleClick = () => {
5030
+ ref.current.focus();
5031
+ };
5032
+
5025
5033
  return jsx("div", {
5026
5034
  class: classnames('bio-properties-panel-feel-editor-container', disabled ? 'disabled' : null),
5027
5035
  children: jsx("div", {
5028
5036
  name: props.name,
5029
5037
  class: classnames('bio-properties-panel-input', localValue ? 'edited' : null),
5030
- ref: inputRef
5038
+ ref: inputRef,
5039
+ onClick: handleClick
5031
5040
  })
5032
5041
  });
5033
5042
  });
@@ -5091,6 +5100,7 @@ function FeelTextfield(props) {
5091
5100
  id,
5092
5101
  label,
5093
5102
  onInput,
5103
+ onError,
5094
5104
  feel,
5095
5105
  value = '',
5096
5106
  disabled = false,
@@ -5156,6 +5166,16 @@ function FeelTextfield(props) {
5156
5166
  }
5157
5167
  };
5158
5168
 
5169
+ const handleLint = useStaticCallback(lint => {
5170
+ if (!(lint && lint.length)) {
5171
+ onError(undefined);
5172
+ return;
5173
+ }
5174
+
5175
+ const error = lint[0];
5176
+ const message = `${error.source}: ${error.message}`;
5177
+ onError(message);
5178
+ });
5159
5179
  useEffect(() => {
5160
5180
  if (typeof focus !== 'undefined') {
5161
5181
  editorRef.current.focus(focus);
@@ -5236,8 +5256,9 @@ function FeelTextfield(props) {
5236
5256
  disabled: disabled,
5237
5257
  onFeelToggle: () => {
5238
5258
  handleFeelToggle();
5239
- setFocus();
5259
+ setFocus(true);
5240
5260
  },
5261
+ onLint: handleLint,
5241
5262
  value: feelOnlyValue,
5242
5263
  variables: props.variables,
5243
5264
  ref: editorRef
@@ -5360,6 +5381,7 @@ function FeelEntry(props) {
5360
5381
  } = props;
5361
5382
  const [cachedInvalidValue, setCachedInvalidValue] = useState(null);
5362
5383
  const [validationError, setValidationError] = useState(null);
5384
+ const [localError, setLocalError] = useState(null);
5363
5385
  let value = getValue(element);
5364
5386
  const previousValue = usePrevious(value);
5365
5387
  useEffect(() => {
@@ -5386,13 +5408,16 @@ function FeelEntry(props) {
5386
5408
 
5387
5409
  setValidationError(newValidationError);
5388
5410
  });
5411
+ const onError = useCallback(err => {
5412
+ setLocalError(err);
5413
+ }, []);
5389
5414
 
5390
5415
  if (previousValue === value && validationError) {
5391
5416
  value = cachedInvalidValue;
5392
5417
  }
5393
5418
 
5394
5419
  const temporaryError = useError(id);
5395
- const error = temporaryError || validationError;
5420
+ const error = temporaryError || validationError || localError;
5396
5421
  return jsxs("div", {
5397
5422
  class: classnames(props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''),
5398
5423
  "data-entry-id": id,
@@ -5403,6 +5428,7 @@ function FeelEntry(props) {
5403
5428
  id: id,
5404
5429
  label: label,
5405
5430
  onInput: onInput,
5431
+ onError: onError,
5406
5432
  example: props.example,
5407
5433
  show: show,
5408
5434
  value: value,