@bpmn-io/form-js-playground 1.6.2 → 1.6.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.
@@ -55675,39 +55675,6 @@
55675
55675
  ...options
55676
55676
  })
55677
55677
  };
55678
- function useFlushDebounce(func, additionalDeps = []) {
55679
- const timeoutRef = s$1(null);
55680
- const lastArgsRef = s$1(null);
55681
- const config = useService$2('config', false);
55682
- const debounce = config && config.debounce;
55683
- const shouldDebounce = debounce !== false && debounce !== 0;
55684
- const delay = typeof debounce === 'number' ? debounce : 300;
55685
- const debounceFunc = A$1((...args) => {
55686
- if (!shouldDebounce) {
55687
- func(...args);
55688
- return;
55689
- }
55690
- lastArgsRef.current = args;
55691
- if (timeoutRef.current) {
55692
- clearTimeout(timeoutRef.current);
55693
- }
55694
- timeoutRef.current = setTimeout(() => {
55695
- func(...lastArgsRef.current);
55696
- lastArgsRef.current = null;
55697
- }, delay);
55698
- }, [func, delay, shouldDebounce, ...additionalDeps]);
55699
- const flushFunc = A$1(() => {
55700
- if (timeoutRef.current) {
55701
- clearTimeout(timeoutRef.current);
55702
- if (lastArgsRef.current !== null) {
55703
- func(...lastArgsRef.current);
55704
- lastArgsRef.current = null;
55705
- }
55706
- timeoutRef.current = null;
55707
- }
55708
- }, [func, ...additionalDeps]);
55709
- return [debounceFunc, flushFunc];
55710
- }
55711
55678
  function TemplatedInputAdorner(props) {
55712
55679
  const {
55713
55680
  pre,
@@ -55820,7 +55787,8 @@
55820
55787
  onFocus,
55821
55788
  field,
55822
55789
  value,
55823
- readonly
55790
+ readonly,
55791
+ onChange
55824
55792
  } = props;
55825
55793
  const {
55826
55794
  description,
@@ -55840,16 +55808,6 @@
55840
55808
  } = validate;
55841
55809
  const inputRef = s$1();
55842
55810
  const [stringValueCache, setStringValueCache] = l$2('');
55843
- const [onChangeDebounced, flushOnChange] = useFlushDebounce(params => {
55844
- props.onChange(params);
55845
- }, [props.onChange]);
55846
- const onInputBlur = () => {
55847
- flushOnChange && flushOnChange();
55848
- onBlur && onBlur();
55849
- };
55850
- const onInputFocus = () => {
55851
- onFocus && onFocus();
55852
- };
55853
55811
 
55854
55812
  // checks whether the value currently in the form data is practically different from the one in the input field cache
55855
55813
  // this allows us to guarantee the field always displays valid form data, but without auto-simplifying values like 1.000 to 1
@@ -55873,7 +55831,7 @@
55873
55831
  const setValue = A$1(stringValue => {
55874
55832
  if (isNullEquivalentValue(stringValue)) {
55875
55833
  setStringValueCache('');
55876
- onChangeDebounced({
55834
+ onChange({
55877
55835
  field,
55878
55836
  value: null
55879
55837
  });
@@ -55888,18 +55846,18 @@
55888
55846
  }
55889
55847
  if (isNaN(Number(stringValue))) {
55890
55848
  setStringValueCache('NaN');
55891
- onChangeDebounced({
55849
+ onChange({
55892
55850
  field,
55893
55851
  value: 'NaN'
55894
55852
  });
55895
55853
  return;
55896
55854
  }
55897
55855
  setStringValueCache(stringValue);
55898
- onChangeDebounced({
55856
+ onChange({
55899
55857
  field,
55900
55858
  value: serializeToString ? stringValue : Number(stringValue)
55901
55859
  });
55902
- }, [field, onChangeDebounced, serializeToString]);
55860
+ }, [field, onChange, serializeToString]);
55903
55861
  const increment = () => {
55904
55862
  if (readonly) {
55905
55863
  return;
@@ -55983,8 +55941,8 @@
55983
55941
  id: domId,
55984
55942
  onKeyDown: onKeyDown,
55985
55943
  onKeyPress: onKeyPress,
55986
- onBlur: onInputBlur,
55987
- onFocus: onInputFocus
55944
+ onBlur: onBlur,
55945
+ onFocus: onFocus
55988
55946
 
55989
55947
  // @ts-ignore
55990
55948
  ,
@@ -56995,6 +56953,39 @@
56995
56953
  children: children
56996
56954
  });
56997
56955
  }
56956
+ function useFlushDebounce(func, additionalDeps = []) {
56957
+ const timeoutRef = s$1(null);
56958
+ const lastArgsRef = s$1(null);
56959
+ const config = useService$2('config', false);
56960
+ const debounce = config && config.debounce;
56961
+ const shouldDebounce = debounce !== false && debounce !== 0;
56962
+ const delay = typeof debounce === 'number' ? debounce : 300;
56963
+ const debounceFunc = A$1((...args) => {
56964
+ if (!shouldDebounce) {
56965
+ func(...args);
56966
+ return;
56967
+ }
56968
+ lastArgsRef.current = args;
56969
+ if (timeoutRef.current) {
56970
+ clearTimeout(timeoutRef.current);
56971
+ }
56972
+ timeoutRef.current = setTimeout(() => {
56973
+ func(...lastArgsRef.current);
56974
+ lastArgsRef.current = null;
56975
+ }, delay);
56976
+ }, [func, delay, shouldDebounce, ...additionalDeps]);
56977
+ const flushFunc = A$1(() => {
56978
+ if (timeoutRef.current) {
56979
+ clearTimeout(timeoutRef.current);
56980
+ if (lastArgsRef.current !== null) {
56981
+ func(...lastArgsRef.current);
56982
+ lastArgsRef.current = null;
56983
+ }
56984
+ timeoutRef.current = null;
56985
+ }
56986
+ }, [func, ...additionalDeps]);
56987
+ return [debounceFunc, flushFunc];
56988
+ }
56998
56989
  const type$2 = 'textfield';
56999
56990
  function Textfield$1(props) {
57000
56991
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-playground",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "A form-js playground",
5
5
  "files": [
6
6
  "dist"
@@ -44,8 +44,8 @@
44
44
  "url": "https://github.com/bpmn-io"
45
45
  },
46
46
  "dependencies": {
47
- "@bpmn-io/form-js-editor": "^1.6.2",
48
- "@bpmn-io/form-js-viewer": "^1.6.2",
47
+ "@bpmn-io/form-js-editor": "^1.6.3",
48
+ "@bpmn-io/form-js-viewer": "^1.6.3",
49
49
  "@codemirror/autocomplete": "^6.3.4",
50
50
  "@codemirror/commands": "^6.1.2",
51
51
  "@codemirror/lang-json": "^6.0.0",
@@ -70,5 +70,5 @@
70
70
  "rollup-plugin-css-only": "^4.0.0",
71
71
  "style-loader": "^3.3.0"
72
72
  },
73
- "gitHead": "c5673979a48cf9c87b99157c8697e973e029636f"
73
+ "gitHead": "d3c930ad19aa6a68179e47b1a24fd8353e962ebf"
74
74
  }