@bpmn-io/form-js-playground 1.8.2 → 1.8.3

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.
@@ -51445,16 +51445,6 @@
51445
51445
  }, [func]);
51446
51446
  return [debounceFunc, flushFunc];
51447
51447
  }
51448
- function useEffectOnChange(value, callback, dependencies = []) {
51449
- const previousValue = usePrevious$1(value);
51450
- y(() => {
51451
- if (value !== previousValue) {
51452
- callback();
51453
- }
51454
-
51455
- // eslint-disable-next-line react-hooks/exhaustive-deps
51456
- }, [value, ...dependencies]);
51457
- }
51458
51448
 
51459
51449
  /**
51460
51450
  * Template a string reactively based on form data. If the string is not a template, it is returned as is.
@@ -51645,6 +51635,18 @@
51645
51635
  function isInvalidDateString(value) {
51646
51636
  return isNaN(new Date(Date.parse(value)).getTime());
51647
51637
  }
51638
+ function getNullDateTime() {
51639
+ return {
51640
+ date: new Date(Date.parse(null)),
51641
+ time: null
51642
+ };
51643
+ }
51644
+ function isValidDate(date) {
51645
+ return date && !isNaN(date.getTime());
51646
+ }
51647
+ function isValidTime(time) {
51648
+ return !isNaN(parseInt(time));
51649
+ }
51648
51650
  function _getSignedPaddedHours(minutes) {
51649
51651
  if (minutes > 0) {
51650
51652
  return '-' + _getZeroPaddedString(Math.floor(minutes / 60));
@@ -52126,7 +52128,8 @@
52126
52128
  };
52127
52129
  }, [eventBus, viewerCommands]);
52128
52130
  y(() => {
52129
- if (initialValidationTrigger && initialValue) {
52131
+ const hasInitialValue = initialValue && !isEqual$1(initialValue, []);
52132
+ if (initialValidationTrigger && hasInitialValue) {
52130
52133
  setInitialValidationTrigger(false);
52131
52134
  viewerCommands.updateFieldValidation(field, initialValue, indexes);
52132
52135
  }
@@ -52948,14 +52951,8 @@
52948
52951
  formId
52949
52952
  } = F$1(FormContext);
52950
52953
  const dateTimeGroupRef = s$1();
52951
- const getNullDateTime = () => ({
52952
- date: new Date(Date.parse(null)),
52953
- time: null
52954
- });
52955
52954
  const [dateTime, setDateTime] = l$1(getNullDateTime());
52956
52955
  const [dateTimeUpdateRequest, setDateTimeUpdateRequest] = l$1(null);
52957
- const isValidDate = date => date && !isNaN(date.getTime());
52958
- const isValidTime = time => !isNaN(parseInt(time));
52959
52956
  const useDatePicker = d(() => subtype === DATETIME_SUBTYPES.DATE || subtype === DATETIME_SUBTYPES.DATETIME, [subtype]);
52960
52957
  const useTimePicker = d(() => subtype === DATETIME_SUBTYPES.TIME || subtype === DATETIME_SUBTYPES.DATETIME, [subtype]);
52961
52958
  const onDateTimeBlur = A$1(e => {
@@ -53010,11 +53007,14 @@
53010
53007
  } else if (subtype === DATETIME_SUBTYPES.DATETIME && isValidDate(date) && isValidTime(time)) {
53011
53008
  newDateTimeValue = serializeDateTime(date, time, timeSerializingFormat);
53012
53009
  }
53010
+ if (value === newDateTimeValue) {
53011
+ return;
53012
+ }
53013
53013
  onChange({
53014
53014
  value: newDateTimeValue,
53015
53015
  field
53016
53016
  });
53017
- }, [field, onChange, subtype, timeSerializingFormat]);
53017
+ }, [value, field, onChange, subtype, timeSerializingFormat]);
53018
53018
  y(() => {
53019
53019
  if (dateTimeUpdateRequest) {
53020
53020
  if (dateTimeUpdateRequest.refreshOnly) {
@@ -55351,7 +55351,7 @@
55351
55351
  Html.config = {
55352
55352
  type: type$4,
55353
55353
  keyed: false,
55354
- label: 'HTML',
55354
+ label: 'HTML view',
55355
55355
  group: 'presentation',
55356
55356
  create: (options = {}) => ({
55357
55357
  content: '',
@@ -55362,7 +55362,8 @@
55362
55362
  function ExpressionField(props) {
55363
55363
  const {
55364
55364
  field,
55365
- onChange
55365
+ onChange,
55366
+ value
55366
55367
  } = props;
55367
55368
  const {
55368
55369
  computeOn,
@@ -55377,12 +55378,12 @@
55377
55378
  value: evaluationMemo
55378
55379
  });
55379
55380
  }, [field, evaluationMemo, onChange]);
55380
- useEffectOnChange(evaluationMemo, () => {
55381
- if (computeOn !== 'change') {
55381
+ y(() => {
55382
+ if (computeOn !== 'change' || evaluationMemo === value) {
55382
55383
  return;
55383
55384
  }
55384
55385
  sendValue();
55385
- }, [computeOn, sendValue]);
55386
+ }, [computeOn, evaluationMemo, sendValue, value]);
55386
55387
  y(() => {
55387
55388
  if (computeOn === 'presubmit') {
55388
55389
  eventBus.on('presubmit', sendValue);
@@ -55396,6 +55397,7 @@
55396
55397
  label: 'Expression',
55397
55398
  group: 'basic-input',
55398
55399
  keyed: true,
55400
+ emptyValue: null,
55399
55401
  escapeGridRender: true,
55400
55402
  create: (options = {}) => ({
55401
55403
  computeOn: 'change',
@@ -65143,7 +65145,7 @@
65143
65145
  class: "fjs-form-field-placeholder",
65144
65146
  children: [e(Icon, {
65145
65147
  viewBox: "0 0 54 54"
65146
- }), "Html is empty"]
65148
+ }), "Html view is empty"]
65147
65149
  })
65148
65150
  });
65149
65151
  }
@@ -65154,7 +65156,7 @@
65154
65156
  class: "fjs-form-field-placeholder",
65155
65157
  children: [e(Icon, {
65156
65158
  viewBox: "0 0 54 54"
65157
- }), "Html is populated by an expression"]
65159
+ }), "Html view is populated by an expression"]
65158
65160
  })
65159
65161
  });
65160
65162
  }
@@ -65165,7 +65167,7 @@
65165
65167
  class: "fjs-form-field-placeholder",
65166
65168
  children: [e(Icon, {
65167
65169
  viewBox: "0 0 54 54"
65168
- }), "Html is templated"]
65170
+ }), "Html view is templated"]
65169
65171
  })
65170
65172
  });
65171
65173
  }
@@ -65244,13 +65246,14 @@
65244
65246
  field
65245
65247
  } = props;
65246
65248
  const {
65247
- expression = ''
65249
+ expression = '',
65250
+ key
65248
65251
  } = field;
65249
65252
  const Icon = iconsByType('expression');
65250
65253
  const expressionLanguage = useService$1('expressionLanguage');
65251
65254
  let placeholderContent = 'Expression is empty';
65252
65255
  if (expression.trim() && expressionLanguage.isExpression(expression)) {
65253
- placeholderContent = 'Expression';
65256
+ placeholderContent = `Expression for '${key}'`;
65254
65257
  }
65255
65258
  return e("div", {
65256
65259
  class: editorFormFieldClasses(type),
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-playground",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "A form-js playground",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
8
  "exports": {
9
9
  ".": {
10
+ "types": "./dist/types/index.d.ts",
10
11
  "import": "./dist/index.es.js",
11
12
  "require": "./dist/index.cjs"
12
13
  },
@@ -44,8 +45,8 @@
44
45
  "url": "https://github.com/bpmn-io"
45
46
  },
46
47
  "dependencies": {
47
- "@bpmn-io/form-js-editor": "^1.8.2",
48
- "@bpmn-io/form-js-viewer": "^1.8.1",
48
+ "@bpmn-io/form-js-editor": "^1.8.3",
49
+ "@bpmn-io/form-js-viewer": "^1.8.3",
49
50
  "@codemirror/autocomplete": "^6.12.0",
50
51
  "@codemirror/commands": "^6.1.2",
51
52
  "@codemirror/lang-json": "^6.0.1",
@@ -70,5 +71,5 @@
70
71
  "rollup-plugin-css-only": "^4.0.0",
71
72
  "style-loader": "^3.3.0"
72
73
  },
73
- "gitHead": "b2a7445d094381999756e3d08b252e00db30f05f"
74
+ "gitHead": "5b065bf91f29907ff39fee7f4252d639890bb84f"
74
75
  }