@bpmn-io/form-js-editor 0.10.0-alpha.1 → 0.10.0-alpha.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.
package/dist/index.cjs CHANGED
@@ -14,6 +14,7 @@ var minDom = require('min-dom');
14
14
  var arrayMove = require('array-move');
15
15
  var classnames = require('classnames');
16
16
  var FeelEditor = require('@bpmn-io/feel-editor');
17
+ var Big = require('big.js');
17
18
 
18
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
20
 
@@ -22,6 +23,7 @@ var dragula__default = /*#__PURE__*/_interopDefaultLegacy(dragula);
22
23
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
24
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
24
25
  var FeelEditor__default = /*#__PURE__*/_interopDefaultLegacy(FeelEditor);
26
+ var Big__default = /*#__PURE__*/_interopDefaultLegacy(Big);
25
27
 
26
28
  var FN_REF = '__fn';
27
29
  var DEFAULT_PRIORITY$2 = 1000;
@@ -703,11 +705,11 @@ function useService$1 (type, strict) {
703
705
  return getService(type, strict);
704
706
  }
705
707
 
706
- function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
708
+ function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
707
709
  var ListDeleteIcon = (({
708
710
  styles = {},
709
711
  ...props
710
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$c({
712
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$d({
711
713
  xmlns: "http://www.w3.org/2000/svg",
712
714
  width: "11",
713
715
  height: "14"
@@ -715,11 +717,11 @@ var ListDeleteIcon = (({
715
717
  d: "M10 4v8c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V4h9zM8 6H3v4.8c0 .66.5 1.2 1.111 1.2H6.89C7.5 12 8 11.46 8 10.8V6zm3-5H8.5l-1-1h-4l-1 1H0v1.5h11V1z"
716
718
  })));
717
719
 
718
- function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
720
+ function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
719
721
  var ButtonIcon = (({
720
722
  styles = {},
721
723
  ...props
722
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
724
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$c({
723
725
  xmlns: "http://www.w3.org/2000/svg",
724
726
  width: "54",
725
727
  height: "54"
@@ -728,11 +730,11 @@ var ButtonIcon = (({
728
730
  d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
729
731
  })));
730
732
 
731
- function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
733
+ function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
732
734
  var CheckboxIcon = (({
733
735
  styles = {},
734
736
  ...props
735
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$a({
737
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
736
738
  xmlns: "http://www.w3.org/2000/svg",
737
739
  width: "54",
738
740
  height: "54"
@@ -740,11 +742,11 @@ var CheckboxIcon = (({
740
742
  d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
741
743
  })));
742
744
 
743
- function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
745
+ function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
744
746
  var ChecklistIcon = (({
745
747
  styles = {},
746
748
  ...props
747
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$9({
749
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$a({
748
750
  width: "54",
749
751
  height: "54",
750
752
  fill: "none",
@@ -759,11 +761,11 @@ var ChecklistIcon = (({
759
761
  fill: "#22242A"
760
762
  })));
761
763
 
762
- function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
764
+ function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
763
765
  var TaglistIcon = (({
764
766
  styles = {},
765
767
  ...props
766
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$8({
768
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$9({
767
769
  width: "54",
768
770
  height: "54",
769
771
  fill: "none",
@@ -778,11 +780,11 @@ var TaglistIcon = (({
778
780
  fill: "#505562"
779
781
  })));
780
782
 
781
- function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
783
+ function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
782
784
  var FormIcon = (({
783
785
  styles = {},
784
786
  ...props
785
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$7({
787
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$8({
786
788
  xmlns: "http://www.w3.org/2000/svg",
787
789
  width: "54",
788
790
  height: "54"
@@ -806,11 +808,11 @@ var FormIcon = (({
806
808
  rx: "1"
807
809
  })));
808
810
 
809
- function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
811
+ function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
810
812
  var ColumnsIcon = (({
811
813
  styles = {},
812
814
  ...props
813
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$6({
815
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$7({
814
816
  xmlns: "http://www.w3.org/2000/svg",
815
817
  width: "54",
816
818
  height: "54"
@@ -819,11 +821,11 @@ var ColumnsIcon = (({
819
821
  d: "M8 33v5a1 1 0 001 1h4v2H9a3 3 0 01-3-3v-5h2zm18 6v2H15v-2h11zm13 0v2H28v-2h11zm9-6v5a3 3 0 01-3 3h-4v-2h4a1 1 0 00.993-.883L46 38v-5h2zM8 22v9H6v-9h2zm40 0v9h-2v-9h2zm-35-9v2H9a1 1 0 00-.993.883L8 16v4H6v-4a3 3 0 013-3h4zm32 0a3 3 0 013 3v4h-2v-4a1 1 0 00-.883-.993L45 15h-4v-2h4zm-6 0v2H28v-2h11zm-13 0v2H15v-2h11z"
820
822
  })));
821
823
 
822
- function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
824
+ function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
823
825
  var NumberIcon = (({
824
826
  styles = {},
825
827
  ...props
826
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$5({
828
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$6({
827
829
  xmlns: "http://www.w3.org/2000/svg",
828
830
  width: "54",
829
831
  height: "54"
@@ -832,11 +834,11 @@ var NumberIcon = (({
832
834
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
833
835
  })));
834
836
 
835
- function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
837
+ function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
836
838
  var RadioIcon = (({
837
839
  styles = {},
838
840
  ...props
839
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$4({
841
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$5({
840
842
  xmlns: "http://www.w3.org/2000/svg",
841
843
  width: "54",
842
844
  height: "54"
@@ -844,11 +846,11 @@ var RadioIcon = (({
844
846
  d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
845
847
  })));
846
848
 
847
- function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
849
+ function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
848
850
  var SelectIcon = (({
849
851
  styles = {},
850
852
  ...props
851
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$3({
853
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$4({
852
854
  xmlns: "http://www.w3.org/2000/svg",
853
855
  width: "54",
854
856
  height: "54"
@@ -857,11 +859,11 @@ var SelectIcon = (({
857
859
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
858
860
  })));
859
861
 
860
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
862
+ function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
861
863
  var TextIcon = (({
862
864
  styles = {},
863
865
  ...props
864
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$2({
866
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$3({
865
867
  xmlns: "http://www.w3.org/2000/svg",
866
868
  width: "54",
867
869
  height: "54"
@@ -869,11 +871,11 @@ var TextIcon = (({
869
871
  d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zM44.35 28.79l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
870
872
  })));
871
873
 
872
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
874
+ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
873
875
  var TextfieldIcon = (({
874
876
  styles = {},
875
877
  ...props
876
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$1({
878
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$2({
877
879
  xmlns: "http://www.w3.org/2000/svg",
878
880
  width: "54",
879
881
  height: "54"
@@ -882,11 +884,11 @@ var TextfieldIcon = (({
882
884
  d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-32 4v10h-2V22h2z"
883
885
  })));
884
886
 
885
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
887
+ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
886
888
  var TextareaIcon = (({
887
889
  styles = {},
888
890
  ...props
889
- }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
891
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$1({
890
892
  xmlns: "http://www.w3.org/2000/svg",
891
893
  width: "54",
892
894
  height: "54"
@@ -895,11 +897,33 @@ var TextareaIcon = (({
895
897
  d: "M45 13a3 3 0 013 3v22a3 3 0 01-3 3H9a3 3 0 01-3-3V16a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v22a1 1 0 001 1h36a1 1 0 001-1V16a1 1 0 00-1-1zm-1.136 15.5l.848.849-6.363 6.363-.849-.848 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
896
898
  })));
897
899
 
900
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
901
+ var ImageIcon = (({
902
+ styles = {},
903
+ ...props
904
+ }) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
905
+ width: "54",
906
+ height: "54",
907
+ fill: "none",
908
+ xmlns: "http://www.w3.org/2000/svg"
909
+ }, props), /*#__PURE__*/React__default['default'].createElement("path", {
910
+ fillRule: "evenodd",
911
+ clipRule: "evenodd",
912
+ d: "M34.636 21.91A3.818 3.818 0 1127 21.908a3.818 3.818 0 017.636 0zm-2 0A1.818 1.818 0 1129 21.908a1.818 1.818 0 013.636 0z",
913
+ fill: "#000"
914
+ }), /*#__PURE__*/React__default['default'].createElement("path", {
915
+ fillRule: "evenodd",
916
+ clipRule: "evenodd",
917
+ d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754c.06-.038.116-.083.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
918
+ fill: "#000"
919
+ })));
920
+
898
921
  const iconsByType = {
899
922
  button: ButtonIcon,
900
923
  checkbox: CheckboxIcon,
901
924
  checklist: ChecklistIcon,
902
925
  columns: ColumnsIcon,
926
+ image: ImageIcon,
903
927
  number: NumberIcon,
904
928
  radio: RadioIcon,
905
929
  select: SelectIcon,
@@ -1539,14 +1563,10 @@ var EditorActionsModule = {
1539
1563
  editorActions: ['type', FormEditorActions]
1540
1564
  };
1541
1565
 
1542
- var KEYCODE_C = 67;
1543
- var KEYCODE_V = 86;
1544
- var KEYCODE_Y$1 = 89;
1545
- var KEYCODE_Z$1 = 90;
1546
- var KEYS_COPY = ['c', 'C', KEYCODE_C];
1547
- var KEYS_PASTE = ['v', 'V', KEYCODE_V];
1548
- var KEYS_REDO$1 = ['y', 'Y', KEYCODE_Y$1];
1549
- var KEYS_UNDO$1 = ['z', 'Z', KEYCODE_Z$1];
1566
+ var KEYS_COPY = ['c', 'C', 'KeyC'];
1567
+ var KEYS_PASTE = ['v', 'V', 'KeyV'];
1568
+ var KEYS_REDO$1 = ['y', 'Y', 'KeyY'];
1569
+ var KEYS_UNDO$1 = ['z', 'Z', 'KeyZ'];
1550
1570
 
1551
1571
  /**
1552
1572
  * Returns true if event was triggered with any modifier
@@ -1576,7 +1596,7 @@ function isCmd(event) {
1576
1596
  */
1577
1597
  function isKey(keys, event) {
1578
1598
  keys = minDash.isArray(keys) ? keys : [keys];
1579
- return keys.indexOf(event.key) !== -1 || keys.indexOf(event.keyCode) !== -1;
1599
+ return keys.indexOf(event.key) !== -1 || keys.indexOf(event.code) !== -1;
1580
1600
  }
1581
1601
 
1582
1602
  /**
@@ -1605,7 +1625,7 @@ var DEFAULT_PRIORITY$1 = 1000;
1605
1625
 
1606
1626
  /**
1607
1627
  * A keyboard abstraction that may be activated and
1608
- * deactivated by users at will, consuming key events
1628
+ * deactivated by users at will, consuming global key events
1609
1629
  * and triggering diagram actions.
1610
1630
  *
1611
1631
  * For keys pressed down, keyboard fires `keyboard.keydown` event.
@@ -1672,6 +1692,9 @@ Keyboard.prototype._keyHandler = function (event, type) {
1672
1692
  }
1673
1693
  };
1674
1694
  Keyboard.prototype._isEventIgnored = function (event) {
1695
+ if (event.defaultPrevented) {
1696
+ return true;
1697
+ }
1675
1698
  return isInput(event.target) && this._isModifiedKeyIgnored(event);
1676
1699
  };
1677
1700
  Keyboard.prototype._isModifiedKeyIgnored = function (event) {
@@ -1694,8 +1717,8 @@ Keyboard.prototype.bind = function (node) {
1694
1717
  this._node = node;
1695
1718
 
1696
1719
  // bind key events
1697
- minDom.event.bind(node, 'keydown', this._keydownHandler, true);
1698
- minDom.event.bind(node, 'keyup', this._keyupHandler, true);
1720
+ minDom.event.bind(node, 'keydown', this._keydownHandler);
1721
+ minDom.event.bind(node, 'keyup', this._keyupHandler);
1699
1722
  this._fire('bind');
1700
1723
  };
1701
1724
  Keyboard.prototype.getBinding = function () {
@@ -1707,8 +1730,8 @@ Keyboard.prototype.unbind = function () {
1707
1730
  this._fire('unbind');
1708
1731
 
1709
1732
  // unbind key events
1710
- minDom.event.unbind(node, 'keydown', this._keydownHandler, true);
1711
- minDom.event.unbind(node, 'keyup', this._keyupHandler, true);
1733
+ minDom.event.unbind(node, 'keydown', this._keydownHandler);
1734
+ minDom.event.unbind(node, 'keyup', this._keyupHandler);
1712
1735
  }
1713
1736
  this._node = null;
1714
1737
  };
@@ -1750,10 +1773,8 @@ function isInput(target) {
1750
1773
  }
1751
1774
 
1752
1775
  var LOW_PRIORITY$1 = 500;
1753
- var KEYCODE_Y = 89;
1754
- var KEYCODE_Z = 90;
1755
- var KEYS_REDO = ['y', 'Y', KEYCODE_Y];
1756
- var KEYS_UNDO = ['z', 'Z', KEYCODE_Z];
1776
+ var KEYS_REDO = ['y', 'Y', 'KeyY'];
1777
+ var KEYS_UNDO = ['z', 'Z', 'KeyZ'];
1757
1778
 
1758
1779
  /**
1759
1780
  * Adds default keyboard bindings.
@@ -3103,6 +3124,9 @@ const types = [{
3103
3124
  }, {
3104
3125
  label: 'Text',
3105
3126
  type: 'text'
3127
+ }, {
3128
+ label: 'Image view',
3129
+ type: 'image'
3106
3130
  }, {
3107
3131
  label: 'Button',
3108
3132
  type: 'button'
@@ -3267,6 +3291,47 @@ ExternalLinkIcon.defaultProps = {
3267
3291
  fill: "none",
3268
3292
  xmlns: "http://www.w3.org/2000/svg"
3269
3293
  };
3294
+ var FeelRequiredIcon = function FeelRequiredIcon(props) {
3295
+ return jsxRuntime.jsxs("svg", {
3296
+ ...props,
3297
+ children: [jsxRuntime.jsx("path", {
3298
+ d: "M5.8 7.06V5.95h4.307v1.11H5.8Zm0 3.071v-1.11h4.307v1.11H5.8Z",
3299
+ fill: "currentColor"
3300
+ }), jsxRuntime.jsx("path", {
3301
+ fillRule: "evenodd",
3302
+ clipRule: "evenodd",
3303
+ d: "M8 3.268A4.732 4.732 0 1 0 12.732 8H14a6 6 0 1 1-6-6v1.268Z",
3304
+ fill: "currentColor"
3305
+ }), jsxRuntime.jsx("path", {
3306
+ 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",
3307
+ fill: "currentColor"
3308
+ })]
3309
+ });
3310
+ };
3311
+ FeelRequiredIcon.defaultProps = {
3312
+ viewBox: "0 0 16 16",
3313
+ fill: "none",
3314
+ xmlns: "http://www.w3.org/2000/svg"
3315
+ };
3316
+ var FeelOptionalIcon = function FeelOptionalIcon(props) {
3317
+ return jsxRuntime.jsxs("svg", {
3318
+ ...props,
3319
+ children: [jsxRuntime.jsx("path", {
3320
+ d: "M5.845 7.04V5.93h4.307v1.11H5.845Zm0 3.07V9h4.307v1.11H5.845Z",
3321
+ fill: "currentColor"
3322
+ }), jsxRuntime.jsx("path", {
3323
+ fillRule: "evenodd",
3324
+ clipRule: "evenodd",
3325
+ 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",
3326
+ fill: "currentColor"
3327
+ })]
3328
+ });
3329
+ };
3330
+ FeelOptionalIcon.defaultProps = {
3331
+ viewBox: "0 0 16 16",
3332
+ fill: "none",
3333
+ xmlns: "http://www.w3.org/2000/svg"
3334
+ };
3270
3335
  function Header(props) {
3271
3336
  const {
3272
3337
  element,
@@ -4285,7 +4350,7 @@ const useBufferedFocus = function (editor, ref) {
4285
4350
  }
4286
4351
  }, [editor, buffer]);
4287
4352
  };
4288
- React.forwardRef((props, ref) => {
4353
+ const CodeEditor = React.forwardRef((props, ref) => {
4289
4354
  const {
4290
4355
  value,
4291
4356
  onInput,
@@ -4366,7 +4431,215 @@ React.forwardRef((props, ref) => {
4366
4431
  })
4367
4432
  });
4368
4433
  });
4369
- React.forwardRef((props, ref) => {
4434
+ function FeelIndicator(props) {
4435
+ const {
4436
+ active
4437
+ } = props;
4438
+ if (!active) {
4439
+ return null;
4440
+ }
4441
+ return jsxRuntime.jsx("span", {
4442
+ class: "bio-properties-panel-feel-indicator",
4443
+ children: "="
4444
+ });
4445
+ }
4446
+ const noop$1 = () => {};
4447
+
4448
+ /**
4449
+ * @param {Object} props
4450
+ * @param {Object} props.label
4451
+ * @param {String} props.feel
4452
+ */
4453
+ function FeelIcon(props) {
4454
+ const {
4455
+ label,
4456
+ feel = false,
4457
+ active,
4458
+ disabled = false,
4459
+ onClick = noop$1
4460
+ } = props;
4461
+ const feelRequiredLabel = ' must be a FEEL expression';
4462
+ const feelOptionalLabel = ' can optionally be a FEEL expression';
4463
+ const handleClick = e => {
4464
+ onClick(e);
4465
+
4466
+ // when pointer event was created from keyboard, keep focus on button
4467
+ if (!e.pointerType) {
4468
+ e.stopPropagation();
4469
+ }
4470
+ };
4471
+ return jsxRuntime.jsx("button", {
4472
+ class: classnames__default['default']('bio-properties-panel-feel-icon', active ? 'active' : null, feel === 'required' ? 'required' : 'optional'),
4473
+ onClick: handleClick,
4474
+ disabled: feel === 'required' || disabled,
4475
+ title: label + (feel === 'required' ? feelRequiredLabel : feelOptionalLabel),
4476
+ children: feel === 'required' ? jsxRuntime.jsx(FeelRequiredIcon, {}) : jsxRuntime.jsx(FeelOptionalIcon, {})
4477
+ });
4478
+ }
4479
+ const noop = () => {};
4480
+ function FeelTextfield(props) {
4481
+ const {
4482
+ debounce,
4483
+ id,
4484
+ label,
4485
+ onInput,
4486
+ onError,
4487
+ feel,
4488
+ value = '',
4489
+ disabled = false,
4490
+ variables,
4491
+ tooltipContainer,
4492
+ OptionalComponent = OptionalFeelInput
4493
+ } = props;
4494
+ const [localValue, _setLocalValue] = hooks$1.useState(value);
4495
+ const editorRef = useShowEntryEvent(id);
4496
+ const containerRef = hooks$1.useRef();
4497
+ const feelActive = localValue.startsWith('=') || feel === 'required';
4498
+ const feelOnlyValue = localValue.startsWith('=') ? localValue.substring(1) : localValue;
4499
+ const [focus, _setFocus] = hooks$1.useState(undefined);
4500
+ const setFocus = (offset = 0) => {
4501
+ const hasFocus = containerRef.current.contains(document.activeElement);
4502
+
4503
+ // Keep caret position if it is already focused, otherwise focus at the end
4504
+ const position = hasFocus ? document.activeElement.selectionStart : Infinity;
4505
+ _setFocus(position + offset);
4506
+ };
4507
+ const handleInputCallback = hooks$1.useMemo(() => {
4508
+ return debounce(newValue => {
4509
+ onInput(newValue);
4510
+ });
4511
+ }, [onInput, debounce]);
4512
+ const setLocalValue = newValue => {
4513
+ _setLocalValue(newValue);
4514
+ if (!newValue || newValue === '=') {
4515
+ handleInputCallback(undefined);
4516
+ } else {
4517
+ handleInputCallback(newValue);
4518
+ }
4519
+ };
4520
+ const handleFeelToggle = useStaticCallback(() => {
4521
+ if (feel === 'required') {
4522
+ return;
4523
+ }
4524
+ if (!feelActive) {
4525
+ setLocalValue('=' + localValue);
4526
+ } else {
4527
+ setLocalValue(feelOnlyValue);
4528
+ }
4529
+ });
4530
+ const handleLocalInput = newValue => {
4531
+ if (feelActive) {
4532
+ newValue = '=' + newValue;
4533
+ }
4534
+ if (newValue === localValue) {
4535
+ return;
4536
+ }
4537
+ setLocalValue(newValue);
4538
+ if (!feelActive && newValue.startsWith('=')) {
4539
+ // focus is behind `=` sign that will be removed
4540
+ setFocus(-1);
4541
+ }
4542
+ };
4543
+ const handleLint = useStaticCallback(lint => {
4544
+ if (!(lint && lint.length)) {
4545
+ onError(undefined);
4546
+ return;
4547
+ }
4548
+ const error = lint[0];
4549
+ const message = `${error.source}: ${error.message}`;
4550
+ onError(message);
4551
+ });
4552
+ hooks$1.useEffect(() => {
4553
+ if (typeof focus !== 'undefined') {
4554
+ editorRef.current.focus(focus);
4555
+ _setFocus(undefined);
4556
+ }
4557
+ }, [focus]);
4558
+ hooks$1.useEffect(() => {
4559
+ if (value === localValue) {
4560
+ return;
4561
+ }
4562
+
4563
+ // External value change removed content => keep FEEL configuration
4564
+ if (!value) {
4565
+ setLocalValue(feelActive ? '=' : '');
4566
+ return;
4567
+ }
4568
+ setLocalValue(value);
4569
+ }, [value]);
4570
+
4571
+ // copy-paste integration
4572
+ hooks$1.useEffect(() => {
4573
+ const copyHandler = event => {
4574
+ if (!feelActive) {
4575
+ return;
4576
+ }
4577
+ event.clipboardData.setData('application/FEEL', event.clipboardData.getData('text'));
4578
+ };
4579
+ const pasteHandler = event => {
4580
+ if (feelActive) {
4581
+ return;
4582
+ }
4583
+ const data = event.clipboardData.getData('application/FEEL');
4584
+ if (data) {
4585
+ setTimeout(() => {
4586
+ handleFeelToggle();
4587
+ setFocus();
4588
+ });
4589
+ }
4590
+ };
4591
+ containerRef.current.addEventListener('copy', copyHandler);
4592
+ containerRef.current.addEventListener('cut', copyHandler);
4593
+ containerRef.current.addEventListener('paste', pasteHandler);
4594
+ return () => {
4595
+ containerRef.current.removeEventListener('copy', copyHandler);
4596
+ containerRef.current.removeEventListener('cut', copyHandler);
4597
+ containerRef.current.removeEventListener('paste', pasteHandler);
4598
+ };
4599
+ }, [containerRef, feelActive, handleFeelToggle, setFocus]);
4600
+ return jsxRuntime.jsxs("div", {
4601
+ class: "bio-properties-panel-feel-entry",
4602
+ children: [jsxRuntime.jsxs("label", {
4603
+ for: prefixId$6(id),
4604
+ class: "bio-properties-panel-label",
4605
+ onClick: () => setFocus(),
4606
+ children: [label, jsxRuntime.jsx(FeelIcon, {
4607
+ label: label,
4608
+ feel: feel,
4609
+ onClick: handleFeelToggle,
4610
+ active: feelActive
4611
+ })]
4612
+ }), jsxRuntime.jsxs("div", {
4613
+ class: "bio-properties-panel-feel-container",
4614
+ ref: containerRef,
4615
+ children: [jsxRuntime.jsx(FeelIndicator, {
4616
+ active: feelActive,
4617
+ disabled: feel !== 'optional' || disabled,
4618
+ onClick: handleFeelToggle
4619
+ }), feelActive ? jsxRuntime.jsx(CodeEditor, {
4620
+ id: prefixId$6(id),
4621
+ name: id,
4622
+ onInput: handleLocalInput,
4623
+ disabled: disabled,
4624
+ onFeelToggle: () => {
4625
+ handleFeelToggle();
4626
+ setFocus(true);
4627
+ },
4628
+ onLint: handleLint,
4629
+ value: feelOnlyValue,
4630
+ variables: variables,
4631
+ ref: editorRef,
4632
+ tooltipContainer: tooltipContainer
4633
+ }) : jsxRuntime.jsx(OptionalComponent, {
4634
+ ...props,
4635
+ onInput: handleLocalInput,
4636
+ value: localValue,
4637
+ ref: editorRef
4638
+ })]
4639
+ })]
4640
+ });
4641
+ }
4642
+ const OptionalFeelInput = React.forwardRef((props, ref) => {
4370
4643
  const {
4371
4644
  id,
4372
4645
  disabled,
@@ -4444,10 +4717,109 @@ React.forwardRef((props, ref) => {
4444
4717
  onInput: e => onInput(e.target.value),
4445
4718
  onFocus: onFocus,
4446
4719
  onBlur: onBlur,
4447
- value: value || ''
4720
+ value: value || '',
4721
+ "data-gramm": "false"
4448
4722
  });
4449
4723
  });
4450
4724
 
4725
+ /**
4726
+ * @param {Object} props
4727
+ * @param {Object} props.element
4728
+ * @param {String} props.id
4729
+ * @param {String} props.description
4730
+ * @param {Boolean} props.debounce
4731
+ * @param {Boolean} props.disabled
4732
+ * @param {String} props.label
4733
+ * @param {Function} props.getValue
4734
+ * @param {Function} props.setValue
4735
+ * @param {Function} props.validate
4736
+ */
4737
+ function FeelEntry(props) {
4738
+ const {
4739
+ element,
4740
+ id,
4741
+ description,
4742
+ debounce,
4743
+ disabled,
4744
+ feel,
4745
+ label,
4746
+ getValue,
4747
+ setValue,
4748
+ tooltipContainer,
4749
+ validate,
4750
+ show = noop,
4751
+ example,
4752
+ variables,
4753
+ onFocus,
4754
+ onBlur
4755
+ } = props;
4756
+ const [cachedInvalidValue, setCachedInvalidValue] = hooks$1.useState(null);
4757
+ const [validationError, setValidationError] = hooks$1.useState(null);
4758
+ const [localError, setLocalError] = hooks$1.useState(null);
4759
+ let value = getValue(element);
4760
+ const previousValue = usePrevious(value);
4761
+ hooks$1.useEffect(() => {
4762
+ if (minDash.isFunction(validate)) {
4763
+ const newValidationError = validate(value) || null;
4764
+ setValidationError(newValidationError);
4765
+ }
4766
+ }, [value]);
4767
+ const onInput = useStaticCallback(newValue => {
4768
+ let newValidationError = null;
4769
+ if (minDash.isFunction(validate)) {
4770
+ newValidationError = validate(newValue) || null;
4771
+ }
4772
+ if (newValidationError) {
4773
+ setCachedInvalidValue(newValue);
4774
+ } else {
4775
+ // don't create multiple commandStack entries for the same value
4776
+ if (newValue !== value) {
4777
+ setValue(newValue);
4778
+ }
4779
+ }
4780
+ setValidationError(newValidationError);
4781
+ });
4782
+ const onError = hooks$1.useCallback(err => {
4783
+ setLocalError(err);
4784
+ }, []);
4785
+ if (previousValue === value && validationError) {
4786
+ value = cachedInvalidValue;
4787
+ }
4788
+ const temporaryError = useError(id);
4789
+ const error = localError || temporaryError || validationError;
4790
+ return jsxRuntime.jsxs("div", {
4791
+ class: classnames__default['default'](props.class, 'bio-properties-panel-entry', error ? 'has-error' : ''),
4792
+ "data-entry-id": id,
4793
+ children: [jsxRuntime.jsx(FeelTextfield, {
4794
+ debounce: debounce,
4795
+ disabled: disabled,
4796
+ feel: feel,
4797
+ id: id,
4798
+ label: label,
4799
+ onInput: onInput,
4800
+ onError: onError,
4801
+ onFocus: onFocus,
4802
+ onBlur: onBlur,
4803
+ example: example,
4804
+ show: show,
4805
+ value: value,
4806
+ variables: variables,
4807
+ tooltipContainer: tooltipContainer,
4808
+ OptionalComponent: props.OptionalComponent
4809
+ }, element), error && jsxRuntime.jsx("div", {
4810
+ class: "bio-properties-panel-error",
4811
+ children: error
4812
+ }), jsxRuntime.jsx(Description$1, {
4813
+ forId: id,
4814
+ element: element,
4815
+ value: description
4816
+ })]
4817
+ });
4818
+ }
4819
+ function isEdited$6(node) {
4820
+ return node && (!!node.value || node.classList.contains('edited'));
4821
+ }
4822
+
4451
4823
  // helpers /////////////////
4452
4824
 
4453
4825
  function prefixId$6(id) {
@@ -4740,7 +5112,8 @@ function TextArea(props) {
4740
5112
  onBlur: onBlur,
4741
5113
  rows: rows,
4742
5114
  value: localValue,
4743
- disabled: disabled
5115
+ disabled: disabled,
5116
+ "data-gramm": "false"
4744
5117
  })]
4745
5118
  });
4746
5119
  }
@@ -4964,6 +5337,14 @@ function arrayAdd(array, index, item) {
4964
5337
  copy.splice(index, 0, item);
4965
5338
  return copy;
4966
5339
  }
5340
+ function countDecimals(number) {
5341
+ const num = Big__default['default'](number);
5342
+ if (num.toString() === num.toFixed(0)) return 0;
5343
+ return num.toFixed().split('.')[1].length || 0;
5344
+ }
5345
+ function isValidNumber(value) {
5346
+ return (typeof value === 'number' || typeof value === 'string') && value !== '' && !isNaN(Number(value));
5347
+ }
4967
5348
  function textToLabel(text) {
4968
5349
  if (typeof text != 'string') return null;
4969
5350
  for (const line of text.split('\n')) {
@@ -4985,6 +5366,7 @@ const labelsByType = {
4985
5366
  checklist: 'CHECKLIST',
4986
5367
  columns: 'COLUMNS',
4987
5368
  default: 'FORM',
5369
+ image: 'IMAGE',
4988
5370
  number: 'NUMBER',
4989
5371
  radio: 'RADIO',
4990
5372
  select: 'SELECT',
@@ -5001,6 +5383,9 @@ const PropertiesPanelHeaderProvider = {
5001
5383
  if (type === 'text') {
5002
5384
  return textToLabel(field.text);
5003
5385
  }
5386
+ if (type === 'image') {
5387
+ return field.alt;
5388
+ }
5004
5389
  if (type === 'default') {
5005
5390
  return field.id;
5006
5391
  }
@@ -5100,6 +5485,66 @@ function useService (type, strict) {
5100
5485
  return getService(type, strict);
5101
5486
  }
5102
5487
 
5488
+ /**
5489
+ * Retrieve list of variables from the form schema.
5490
+ *
5491
+ * @returns { string[] } list of variables used in form schema
5492
+ */
5493
+ function useVariables() {
5494
+ const form = useService('formEditor');
5495
+ const schema = form.getSchema();
5496
+ return formJsViewer.getSchemaVariables(schema);
5497
+ }
5498
+
5499
+ function AltTextEntry(props) {
5500
+ const {
5501
+ editField,
5502
+ field
5503
+ } = props;
5504
+ const {
5505
+ type
5506
+ } = field;
5507
+ const entries = [];
5508
+ if (type === 'image') {
5509
+ entries.push({
5510
+ id: 'alt',
5511
+ component: AltText,
5512
+ editField: editField,
5513
+ field: field,
5514
+ isEdited: isEdited$6
5515
+ });
5516
+ }
5517
+ return entries;
5518
+ }
5519
+ function AltText(props) {
5520
+ const {
5521
+ editField,
5522
+ field,
5523
+ id
5524
+ } = props;
5525
+ const debounce = useService('debounce');
5526
+ const variables = useVariables().map(name => ({
5527
+ name
5528
+ }));
5529
+ const path = ['alt'];
5530
+ const getValue = () => {
5531
+ return minDash.get(field, path, '');
5532
+ };
5533
+ const setValue = value => {
5534
+ return editField(field, path, value);
5535
+ };
5536
+ return FeelEntry({
5537
+ debounce,
5538
+ element: field,
5539
+ feel: 'optional',
5540
+ getValue,
5541
+ id,
5542
+ label: 'Alternative text',
5543
+ setValue,
5544
+ variables
5545
+ });
5546
+ }
5547
+
5103
5548
  function ColumnsEntry(props) {
5104
5549
  const {
5105
5550
  editField,
@@ -5228,7 +5673,7 @@ function DefaultOptionEntry(props) {
5228
5673
  entries.push({
5229
5674
  ...defaultOptions,
5230
5675
  component: DefaultValueNumber,
5231
- isEdited: isEdited$5
5676
+ isEdited: isEdited$1
5232
5677
  });
5233
5678
  }
5234
5679
  if (type === 'radio' || type === 'select') {
@@ -5299,21 +5744,39 @@ function DefaultValueNumber(props) {
5299
5744
  id,
5300
5745
  label
5301
5746
  } = props;
5747
+ const {
5748
+ decimalDigits,
5749
+ serializeToString = false
5750
+ } = field;
5302
5751
  const debounce = useService('debounce');
5303
5752
  const path = ['defaultValue'];
5304
- const getValue = () => {
5305
- return minDash.get(field, path, '');
5753
+ const getValue = e => {
5754
+ let value = minDash.get(field, path);
5755
+ if (!isValidNumber(value)) return;
5756
+
5757
+ // Enforces decimal notation so that we do not submit defaults in exponent form
5758
+ return serializeToString ? Big__default['default'](value).toFixed() : value;
5306
5759
  };
5307
5760
  const setValue = value => {
5308
- return editField(field, path, value);
5761
+ let newValue;
5762
+ if (isValidNumber(value)) {
5763
+ newValue = serializeToString ? value : Number(value);
5764
+ }
5765
+ return editField(field, path, newValue);
5309
5766
  };
5310
- return NumberFieldEntry({
5767
+ const decimalDigitsSet = decimalDigits || decimalDigits === 0;
5768
+ return TextfieldEntry({
5311
5769
  debounce,
5770
+ label,
5312
5771
  element: field,
5313
5772
  getValue,
5314
5773
  id,
5315
- label,
5316
- setValue
5774
+ setValue,
5775
+ validate: value => {
5776
+ if (value === undefined || value === null) return;
5777
+ if (!isValidNumber(value)) return 'Should be a valid number';
5778
+ if (decimalDigitsSet && countDecimals(value) > decimalDigits) return `Should not contain more than ${decimalDigits} decimal digits`;
5779
+ }
5317
5780
  });
5318
5781
  }
5319
5782
  function DefaultValueSingleSelect(props) {
@@ -5635,6 +6098,56 @@ function Label$1(props) {
5635
6098
  });
5636
6099
  }
5637
6100
 
6101
+ function SourceEntry(props) {
6102
+ const {
6103
+ editField,
6104
+ field
6105
+ } = props;
6106
+ const {
6107
+ type
6108
+ } = field;
6109
+ const entries = [];
6110
+ if (type === 'image') {
6111
+ entries.push({
6112
+ id: 'source',
6113
+ component: Source,
6114
+ editField: editField,
6115
+ field: field,
6116
+ isEdited: isEdited$6
6117
+ });
6118
+ }
6119
+ return entries;
6120
+ }
6121
+ function Source(props) {
6122
+ const {
6123
+ editField,
6124
+ field,
6125
+ id
6126
+ } = props;
6127
+ const debounce = useService('debounce');
6128
+ const variables = useVariables().map(name => ({
6129
+ name
6130
+ }));
6131
+ const path = ['source'];
6132
+ const getValue = () => {
6133
+ return minDash.get(field, path, '');
6134
+ };
6135
+ const setValue = value => {
6136
+ return editField(field, path, value);
6137
+ };
6138
+ return FeelEntry({
6139
+ debounce,
6140
+ description: 'Expression or static value (link/data URI)',
6141
+ element: field,
6142
+ feel: 'optional',
6143
+ getValue,
6144
+ id,
6145
+ label: 'Image source',
6146
+ setValue,
6147
+ variables
6148
+ });
6149
+ }
6150
+
5638
6151
  function TextEntry(props) {
5639
6152
  const {
5640
6153
  editField,
@@ -5681,6 +6194,144 @@ function Text(props) {
5681
6194
  });
5682
6195
  }
5683
6196
 
6197
+ function NumberEntries(props) {
6198
+ const {
6199
+ editField,
6200
+ field,
6201
+ id
6202
+ } = props;
6203
+ const {
6204
+ type
6205
+ } = field;
6206
+ if (type !== 'number') {
6207
+ return [];
6208
+ }
6209
+ const entries = [];
6210
+ entries.push({
6211
+ id: id + '-decimalDigits',
6212
+ component: NumberDecimalDigits,
6213
+ isEdited: isEdited$5,
6214
+ editField,
6215
+ field
6216
+ });
6217
+ entries.push({
6218
+ id: id + '-step',
6219
+ component: NumberArrowStep,
6220
+ isEdited: isEdited$1,
6221
+ editField,
6222
+ field
6223
+ });
6224
+ return entries;
6225
+ }
6226
+ function NumberDecimalDigits(props) {
6227
+ const {
6228
+ editField,
6229
+ field,
6230
+ id
6231
+ } = props;
6232
+ const debounce = useService('debounce');
6233
+ const getValue = e => minDash.get(field, ['decimalDigits']);
6234
+ const setValue = value => editField(field, ['decimalDigits'], value);
6235
+ return NumberFieldEntry({
6236
+ debounce,
6237
+ label: 'Decimal digits',
6238
+ element: field,
6239
+ min: 0,
6240
+ step: 1,
6241
+ getValue,
6242
+ id,
6243
+ setValue
6244
+ });
6245
+ }
6246
+ function NumberArrowStep(props) {
6247
+ const {
6248
+ editField,
6249
+ field,
6250
+ id
6251
+ } = props;
6252
+ const {
6253
+ decimalDigits
6254
+ } = field;
6255
+ const debounce = useService('debounce');
6256
+ const getValue = e => {
6257
+ let value = minDash.get(field, ['increment']);
6258
+ if (!isValidNumber(value)) return null;
6259
+ return value;
6260
+ };
6261
+ const setValue = value => editField(field, ['increment'], value);
6262
+ const decimalDigitsSet = decimalDigits || decimalDigits === 0;
6263
+ return TextfieldEntry({
6264
+ debounce,
6265
+ label: 'Increment',
6266
+ element: field,
6267
+ getValue,
6268
+ id,
6269
+ setValue,
6270
+ validate: value => {
6271
+ if (value === undefined || value === null) return;
6272
+ if (!isValidNumber(value)) return 'Should be a valid number.';
6273
+ if (Big__default['default'](value).cmp(0) <= 0) return 'Should be greater than zero.';
6274
+ if (decimalDigitsSet) {
6275
+ const minimumValue = Big__default['default'](`1e-${decimalDigits}`);
6276
+ if (Big__default['default'](value).cmp(minimumValue) < 0) return `Should be at least ${minimumValue.toString()}.`;
6277
+ if (countDecimals(value) > decimalDigits) return `Should not contain more than ${decimalDigits} decimal digits.`;
6278
+ }
6279
+ }
6280
+ });
6281
+ }
6282
+
6283
+ function NumberSerializationEntry(props) {
6284
+ const {
6285
+ editField,
6286
+ field,
6287
+ id
6288
+ } = props;
6289
+ const {
6290
+ type
6291
+ } = field;
6292
+ if (type !== 'number') {
6293
+ return [];
6294
+ }
6295
+ const entries = [];
6296
+ entries.push({
6297
+ id: id + '-serialize-to-string',
6298
+ component: SerializeToString,
6299
+ isEdited: isEdited$7,
6300
+ editField,
6301
+ field
6302
+ });
6303
+ return entries;
6304
+ }
6305
+ function SerializeToString(props) {
6306
+ const {
6307
+ editField,
6308
+ field,
6309
+ id
6310
+ } = props;
6311
+ const {
6312
+ defaultValue
6313
+ } = field;
6314
+ const path = ['serializeToString'];
6315
+ const getValue = () => {
6316
+ return minDash.get(field, path, '');
6317
+ };
6318
+ const setValue = value => {
6319
+ // Whenever changing the formatting, make sure to change the default value type along with it
6320
+ if (defaultValue || defaultValue === 0) {
6321
+ editField(field, ['defaultValue'], value ? Big__default['default'](defaultValue).toFixed() : Number(defaultValue));
6322
+ }
6323
+ return editField(field, path, value);
6324
+ };
6325
+ return CheckboxEntry({
6326
+ element: field,
6327
+ getValue,
6328
+ id,
6329
+ label: 'Serialize to string',
6330
+ description: 'Allows arbitrary precision values',
6331
+ setValue
6332
+ });
6333
+ }
6334
+
5684
6335
  function ValueEntry(props) {
5685
6336
  const {
5686
6337
  editField,
@@ -5989,6 +6640,15 @@ function InputValuesKey(props) {
5989
6640
  const path = VALUES_SOURCES_PATHS[VALUES_SOURCES.INPUT];
5990
6641
  const getValue = () => minDash.get(field, path, '');
5991
6642
  const setValue = value => editField(field, path, value || '');
6643
+ const validate = value => {
6644
+ if (minDash.isUndefined(value) || !value.length) {
6645
+ return 'Must not be empty.';
6646
+ }
6647
+ if (/\s/.test(value)) {
6648
+ return 'Must not contain spaces.';
6649
+ }
6650
+ return null;
6651
+ };
5992
6652
  return TextfieldEntry({
5993
6653
  debounce,
5994
6654
  description,
@@ -5996,7 +6656,8 @@ function InputValuesKey(props) {
5996
6656
  getValue,
5997
6657
  id,
5998
6658
  label,
5999
- setValue
6659
+ setValue,
6660
+ validate
6000
6661
  });
6001
6662
  }
6002
6663
 
@@ -6069,6 +6730,54 @@ function getIndexedEntry(index) {
6069
6730
  return entry;
6070
6731
  }
6071
6732
 
6733
+ function ConditionEntry(props) {
6734
+ const {
6735
+ editField,
6736
+ field
6737
+ } = props;
6738
+ return [{
6739
+ id: 'conditional-hide',
6740
+ component: Condition,
6741
+ editField: editField,
6742
+ field: field,
6743
+ isEdited: isEdited$6
6744
+ }];
6745
+ }
6746
+ function Condition(props) {
6747
+ const {
6748
+ editField,
6749
+ field,
6750
+ id
6751
+ } = props;
6752
+ const debounce = useService('debounce');
6753
+ const variables = useVariables().map(name => ({
6754
+ name
6755
+ }));
6756
+ const path = ['conditional', 'hide'];
6757
+ const getValue = () => {
6758
+ return minDash.get(field, path, '');
6759
+ };
6760
+ const setValue = value => {
6761
+ if (!value) {
6762
+ return editField(field, 'conditional', undefined);
6763
+ }
6764
+ return editField(field, 'conditional', {
6765
+ hide: value
6766
+ });
6767
+ };
6768
+ return FeelEntry({
6769
+ debounce,
6770
+ description: 'Condition under which the field is hidden',
6771
+ element: field,
6772
+ feel: 'required',
6773
+ getValue,
6774
+ id,
6775
+ label: 'Hide if',
6776
+ setValue,
6777
+ variables
6778
+ });
6779
+ }
6780
+
6072
6781
  function GeneralGroup(field, editField) {
6073
6782
  const entries = [...IdEntry({
6074
6783
  field,
@@ -6094,6 +6803,15 @@ function GeneralGroup(field, editField) {
6094
6803
  }), ...TextEntry({
6095
6804
  field,
6096
6805
  editField
6806
+ }), ...NumberEntries({
6807
+ field,
6808
+ editField
6809
+ }), ...SourceEntry({
6810
+ field,
6811
+ editField
6812
+ }), ...AltTextEntry({
6813
+ field,
6814
+ editField
6097
6815
  }), ...DisabledEntry({
6098
6816
  field,
6099
6817
  editField
@@ -6105,6 +6823,21 @@ function GeneralGroup(field, editField) {
6105
6823
  };
6106
6824
  }
6107
6825
 
6826
+ function SerializationGroup(field, editField) {
6827
+ const entries = [...NumberSerializationEntry({
6828
+ field,
6829
+ editField
6830
+ })];
6831
+ if (!entries.length) {
6832
+ return null;
6833
+ }
6834
+ return {
6835
+ id: 'serialization',
6836
+ label: 'Serialization',
6837
+ entries
6838
+ };
6839
+ }
6840
+
6108
6841
  const VALIDATION_TYPE_OPTIONS = {
6109
6842
  custom: {
6110
6843
  value: 'custom',
@@ -6469,11 +7202,29 @@ function removeKey(properties, oldKey) {
6469
7202
  }, {});
6470
7203
  }
6471
7204
 
7205
+ function ConditionGroup(field, editField) {
7206
+ const {
7207
+ type
7208
+ } = field;
7209
+ if (type === 'default') {
7210
+ return null;
7211
+ }
7212
+ const entries = [...ConditionEntry({
7213
+ field,
7214
+ editField
7215
+ })];
7216
+ return {
7217
+ id: 'condition',
7218
+ label: 'Condition',
7219
+ entries
7220
+ };
7221
+ }
7222
+
6472
7223
  function getGroups(field, editField) {
6473
7224
  if (!field) {
6474
7225
  return [];
6475
7226
  }
6476
- const groups = [GeneralGroup(field, editField), ...ValuesGroups(field, editField), ValidationGroup(field, editField), CustomValuesGroup(field, editField)];
7227
+ const groups = [GeneralGroup(field, editField), ConditionGroup(field, editField), SerializationGroup(field, editField), ...ValuesGroups(field, editField), ValidationGroup(field, editField), CustomValuesGroup(field, editField)];
6477
7228
 
6478
7229
  // contract: if a group returns null, it should not be displayed at all
6479
7230
  return groups.filter(group => group !== null);