@bpmn-io/form-js-editor 0.10.0-alpha.2 → 0.10.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.es.js CHANGED
@@ -1,12 +1,12 @@
1
- import { FormFieldRegistry as FormFieldRegistry$1, clone, FormContext, FormRenderContext, FormComponent, FormFields, getSchemaVariables, Default, createFormContainer, createInjector, schemaVersion } from '@bpmn-io/form-js-viewer';
1
+ import { FormFieldRegistry as FormFieldRegistry$1, clone, FormContext, FormRenderContext, FormComponent, iconsByType, FormFields, getSchemaVariables, Default, DATETIME_SUBTYPES, DATE_LABEL_PATH, TIME_LABEL_PATH, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES_LABELS, TIME_SERIALISING_FORMAT_PATH, TIME_SERIALISING_FORMATS, TIME_INTERVAL_PATH, TIME_USE24H_PATH, DATE_DISALLOW_PAST_PATH, TIME_SERIALISINGFORMAT_LABELS, getValuesSource, VALUES_SOURCES, VALUES_SOURCES_DEFAULTS, VALUES_SOURCES_PATHS, VALUES_SOURCES_LABELS, createFormContainer, createInjector, schemaVersion } from '@bpmn-io/form-js-viewer';
2
2
  export { schemaVersion } from '@bpmn-io/form-js-viewer';
3
3
  import Ids from 'ids';
4
4
  import { isArray, isFunction, isNumber, bind, assign, debounce, forEach, get, isObject, uniqueBy, sortBy, find, set, isUndefined, without, has, isString } from 'min-dash';
5
5
  import { createContext, render, createElement } from 'preact';
6
6
  import { useContext, useRef, useState, useEffect, useCallback, useMemo, useLayoutEffect } from 'preact/hooks';
7
7
  import dragula from 'dragula';
8
- import React, { forwardRef } from 'preact/compat';
9
8
  import { jsxs, jsx } from 'preact/jsx-runtime';
9
+ import React, { forwardRef } from 'preact/compat';
10
10
  import { matches, closest, event, domify, query } from 'min-dom';
11
11
  import { mutate } from 'array-move';
12
12
  import classnames from 'classnames';
@@ -693,11 +693,11 @@ function useService$1 (type, strict) {
693
693
  return getService(type, strict);
694
694
  }
695
695
 
696
- 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); }
696
+ 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); }
697
697
  var ListDeleteIcon = (({
698
698
  styles = {},
699
699
  ...props
700
- }) => /*#__PURE__*/React.createElement("svg", _extends$d({
700
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
701
701
  xmlns: "http://www.w3.org/2000/svg",
702
702
  width: "11",
703
703
  height: "14"
@@ -705,223 +705,6 @@ var ListDeleteIcon = (({
705
705
  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"
706
706
  })));
707
707
 
708
- 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); }
709
- var ButtonIcon = (({
710
- styles = {},
711
- ...props
712
- }) => /*#__PURE__*/React.createElement("svg", _extends$c({
713
- xmlns: "http://www.w3.org/2000/svg",
714
- width: "54",
715
- height: "54"
716
- }, props), /*#__PURE__*/React.createElement("path", {
717
- fillRule: "evenodd",
718
- 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"
719
- })));
720
-
721
- 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); }
722
- var CheckboxIcon = (({
723
- styles = {},
724
- ...props
725
- }) => /*#__PURE__*/React.createElement("svg", _extends$b({
726
- xmlns: "http://www.w3.org/2000/svg",
727
- width: "54",
728
- height: "54"
729
- }, props), /*#__PURE__*/React.createElement("path", {
730
- 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"
731
- })));
732
-
733
- 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); }
734
- var ChecklistIcon = (({
735
- styles = {},
736
- ...props
737
- }) => /*#__PURE__*/React.createElement("svg", _extends$a({
738
- width: "54",
739
- height: "54",
740
- fill: "none",
741
- xmlns: "http://www.w3.org/2000/svg"
742
- }, props), /*#__PURE__*/React.createElement("path", {
743
- fillRule: "evenodd",
744
- clipRule: "evenodd",
745
- d: "M19 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6 18h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6-30h-6v6h6V8zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2V8a2 2 0 00-2-2h-6z",
746
- fill: "#22242A"
747
- }), /*#__PURE__*/React.createElement("path", {
748
- d: "M26 26a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0 16a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0-32a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2z",
749
- fill: "#22242A"
750
- })));
751
-
752
- 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); }
753
- var TaglistIcon = (({
754
- styles = {},
755
- ...props
756
- }) => /*#__PURE__*/React.createElement("svg", _extends$9({
757
- width: "54",
758
- height: "54",
759
- fill: "none",
760
- xmlns: "http://www.w3.org/2000/svg"
761
- }, props), /*#__PURE__*/React.createElement("path", {
762
- fillRule: "evenodd",
763
- clipRule: "evenodd",
764
- 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-1z",
765
- fill: "#000"
766
- }), /*#__PURE__*/React.createElement("path", {
767
- d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
768
- fill: "#505562"
769
- })));
770
-
771
- 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); }
772
- var FormIcon = (({
773
- styles = {},
774
- ...props
775
- }) => /*#__PURE__*/React.createElement("svg", _extends$8({
776
- xmlns: "http://www.w3.org/2000/svg",
777
- width: "54",
778
- height: "54"
779
- }, props), /*#__PURE__*/React.createElement("rect", {
780
- x: "15",
781
- y: "17",
782
- width: "24",
783
- height: "4",
784
- rx: "1"
785
- }), /*#__PURE__*/React.createElement("rect", {
786
- x: "15",
787
- y: "25",
788
- width: "24",
789
- height: "4",
790
- rx: "1"
791
- }), /*#__PURE__*/React.createElement("rect", {
792
- x: "15",
793
- y: "33",
794
- width: "13",
795
- height: "4",
796
- rx: "1"
797
- })));
798
-
799
- 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); }
800
- var ColumnsIcon = (({
801
- styles = {},
802
- ...props
803
- }) => /*#__PURE__*/React.createElement("svg", _extends$7({
804
- xmlns: "http://www.w3.org/2000/svg",
805
- width: "54",
806
- height: "54"
807
- }, props), /*#__PURE__*/React.createElement("path", {
808
- fillRule: "evenodd",
809
- 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"
810
- })));
811
-
812
- 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); }
813
- var NumberIcon = (({
814
- styles = {},
815
- ...props
816
- }) => /*#__PURE__*/React.createElement("svg", _extends$6({
817
- xmlns: "http://www.w3.org/2000/svg",
818
- width: "54",
819
- height: "54"
820
- }, props), /*#__PURE__*/React.createElement("path", {
821
- fillRule: "evenodd",
822
- 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"
823
- })));
824
-
825
- 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); }
826
- var RadioIcon = (({
827
- styles = {},
828
- ...props
829
- }) => /*#__PURE__*/React.createElement("svg", _extends$5({
830
- xmlns: "http://www.w3.org/2000/svg",
831
- width: "54",
832
- height: "54"
833
- }, props), /*#__PURE__*/React.createElement("path", {
834
- 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"
835
- })));
836
-
837
- 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); }
838
- var SelectIcon = (({
839
- styles = {},
840
- ...props
841
- }) => /*#__PURE__*/React.createElement("svg", _extends$4({
842
- xmlns: "http://www.w3.org/2000/svg",
843
- width: "54",
844
- height: "54"
845
- }, props), /*#__PURE__*/React.createElement("path", {
846
- fillRule: "evenodd",
847
- 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"
848
- })));
849
-
850
- 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); }
851
- var TextIcon = (({
852
- styles = {},
853
- ...props
854
- }) => /*#__PURE__*/React.createElement("svg", _extends$3({
855
- xmlns: "http://www.w3.org/2000/svg",
856
- width: "54",
857
- height: "54"
858
- }, props), /*#__PURE__*/React.createElement("path", {
859
- 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"
860
- })));
861
-
862
- 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); }
863
- var TextfieldIcon = (({
864
- styles = {},
865
- ...props
866
- }) => /*#__PURE__*/React.createElement("svg", _extends$2({
867
- xmlns: "http://www.w3.org/2000/svg",
868
- width: "54",
869
- height: "54"
870
- }, props), /*#__PURE__*/React.createElement("path", {
871
- fillRule: "evenodd",
872
- 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"
873
- })));
874
-
875
- 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); }
876
- var TextareaIcon = (({
877
- styles = {},
878
- ...props
879
- }) => /*#__PURE__*/React.createElement("svg", _extends$1({
880
- xmlns: "http://www.w3.org/2000/svg",
881
- width: "54",
882
- height: "54"
883
- }, props), /*#__PURE__*/React.createElement("path", {
884
- fillRule: "evenodd",
885
- 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"
886
- })));
887
-
888
- 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); }
889
- var ImageIcon = (({
890
- styles = {},
891
- ...props
892
- }) => /*#__PURE__*/React.createElement("svg", _extends({
893
- width: "54",
894
- height: "54",
895
- fill: "none",
896
- xmlns: "http://www.w3.org/2000/svg"
897
- }, props), /*#__PURE__*/React.createElement("path", {
898
- fillRule: "evenodd",
899
- clipRule: "evenodd",
900
- 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",
901
- fill: "#000"
902
- }), /*#__PURE__*/React.createElement("path", {
903
- fillRule: "evenodd",
904
- clipRule: "evenodd",
905
- 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",
906
- fill: "#000"
907
- })));
908
-
909
- const iconsByType = {
910
- button: ButtonIcon,
911
- checkbox: CheckboxIcon,
912
- checklist: ChecklistIcon,
913
- columns: ColumnsIcon,
914
- image: ImageIcon,
915
- number: NumberIcon,
916
- radio: RadioIcon,
917
- select: SelectIcon,
918
- taglist: TaglistIcon,
919
- text: TextIcon,
920
- textfield: TextfieldIcon,
921
- textarea: TextareaIcon,
922
- default: FormIcon
923
- };
924
-
925
708
  function ContextPad(props) {
926
709
  if (!props.children) {
927
710
  return null;
@@ -3094,6 +2877,9 @@ const types = [{
3094
2877
  }, {
3095
2878
  label: 'Number',
3096
2879
  type: 'number'
2880
+ }, {
2881
+ label: 'Datetime',
2882
+ type: 'datetime'
3097
2883
  }, {
3098
2884
  label: 'Checkbox',
3099
2885
  type: 'checkbox'
@@ -3110,7 +2896,7 @@ const types = [{
3110
2896
  label: 'Select',
3111
2897
  type: 'select'
3112
2898
  }, {
3113
- label: 'Text',
2899
+ label: 'Text view',
3114
2900
  type: 'text'
3115
2901
  }, {
3116
2902
  label: 'Image view',
@@ -4670,7 +4456,7 @@ const OptionalFeelInput = forwardRef((props, ref) => {
4670
4456
  value: value || ''
4671
4457
  });
4672
4458
  });
4673
- forwardRef((props, ref) => {
4459
+ const OptionalFeelTextArea = forwardRef((props, ref) => {
4674
4460
  const {
4675
4461
  id,
4676
4462
  disabled,
@@ -4804,6 +4590,28 @@ function FeelEntry(props) {
4804
4590
  })]
4805
4591
  });
4806
4592
  }
4593
+
4594
+ /**
4595
+ * @param {Object} props
4596
+ * @param {Object} props.element
4597
+ * @param {String} props.id
4598
+ * @param {String} props.description
4599
+ * @param {Boolean} props.debounce
4600
+ * @param {Boolean} props.disabled
4601
+ * @param {String} props.label
4602
+ * @param {Function} props.getValue
4603
+ * @param {Function} props.setValue
4604
+ * @param {Function} props.onFocus
4605
+ * @param {Function} props.onBlur
4606
+ * @param {Function} props.validate
4607
+ */
4608
+ function FeelTextArea(props) {
4609
+ return jsx(FeelEntry, {
4610
+ class: "bio-properties-panel-feel-textarea",
4611
+ OptionalComponent: OptionalFeelTextArea,
4612
+ ...props
4613
+ });
4614
+ }
4807
4615
  function isEdited$6(node) {
4808
4616
  return node && (!!node.value || node.classList.contains('edited'));
4809
4617
  }
@@ -5345,7 +5153,7 @@ function textToLabel(text) {
5345
5153
  }
5346
5154
  return null;
5347
5155
  }
5348
- const INPUTS = ['checkbox', 'checklist', 'number', 'radio', 'select', 'taglist', 'textfield', 'textarea'];
5156
+ const INPUTS = ['checkbox', 'checklist', 'datetime', 'number', 'radio', 'select', 'taglist', 'textfield', 'textarea'];
5349
5157
  const VALUES_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
5350
5158
 
5351
5159
  const labelsByType = {
@@ -5354,12 +5162,13 @@ const labelsByType = {
5354
5162
  checklist: 'CHECKLIST',
5355
5163
  columns: 'COLUMNS',
5356
5164
  default: 'FORM',
5357
- image: 'IMAGE',
5165
+ datetime: 'DATETIME',
5166
+ image: 'IMAGE VIEW',
5358
5167
  number: 'NUMBER',
5359
5168
  radio: 'RADIO',
5360
5169
  select: 'SELECT',
5361
5170
  taglist: 'TAGLIST',
5362
- text: 'TEXT',
5171
+ text: 'TEXT VIEW',
5363
5172
  textfield: 'TEXT FIELD',
5364
5173
  textarea: 'TEXT AREA'
5365
5174
  };
@@ -6042,48 +5851,83 @@ function Key$1(props) {
6042
5851
  });
6043
5852
  }
6044
5853
 
6045
- function LabelEntry(props) {
5854
+ function simpleStringEntryFactory(options) {
5855
+ const {
5856
+ id,
5857
+ label,
5858
+ path,
5859
+ props
5860
+ } = options;
6046
5861
  const {
6047
5862
  editField,
6048
5863
  field
6049
5864
  } = props;
6050
- const {
6051
- type
6052
- } = field;
6053
- const entries = [];
6054
- if (INPUTS.includes(type) || type === 'button') {
6055
- entries.push({
6056
- id: 'label',
6057
- component: Label$1,
6058
- editField: editField,
6059
- field: field,
6060
- isEdited: isEdited$1
6061
- });
6062
- }
6063
- return entries;
5865
+ return {
5866
+ id,
5867
+ label,
5868
+ path,
5869
+ field,
5870
+ editField,
5871
+ component: SimpleStringComponent,
5872
+ isEdited: isEdited$1
5873
+ };
6064
5874
  }
6065
- function Label$1(props) {
5875
+ const SimpleStringComponent = props => {
6066
5876
  const {
6067
- editField,
5877
+ id,
5878
+ label,
5879
+ path,
6068
5880
  field,
6069
- id
5881
+ editField
6070
5882
  } = props;
6071
5883
  const debounce = useService('debounce');
6072
- const path = ['label'];
6073
- const getValue = () => {
6074
- return get(field, path, '');
6075
- };
6076
- const setValue = value => {
6077
- return editField(field, path, value);
6078
- };
5884
+ const getValue = () => get(field, path, '');
5885
+ const setValue = value => editField(field, path, value);
6079
5886
  return TextfieldEntry({
6080
5887
  debounce,
6081
5888
  element: field,
6082
5889
  getValue,
6083
5890
  id,
6084
- label: 'Field label',
5891
+ label,
6085
5892
  setValue
6086
5893
  });
5894
+ };
5895
+
5896
+ function LabelEntry(props) {
5897
+ const {
5898
+ field
5899
+ } = props;
5900
+ const {
5901
+ type,
5902
+ subtype
5903
+ } = field;
5904
+ const entries = [];
5905
+ if (type === 'datetime') {
5906
+ if (subtype === DATETIME_SUBTYPES.DATE || subtype === DATETIME_SUBTYPES.DATETIME) {
5907
+ entries.push(simpleStringEntryFactory({
5908
+ id: 'date-label',
5909
+ path: DATE_LABEL_PATH,
5910
+ label: 'Date label',
5911
+ props
5912
+ }));
5913
+ }
5914
+ if (subtype === DATETIME_SUBTYPES.TIME || subtype === DATETIME_SUBTYPES.DATETIME) {
5915
+ entries.push(simpleStringEntryFactory({
5916
+ id: 'time-label',
5917
+ path: TIME_LABEL_PATH,
5918
+ label: 'Time label',
5919
+ props
5920
+ }));
5921
+ }
5922
+ } else if (INPUTS.includes(type) || type === 'button') {
5923
+ entries.push(simpleStringEntryFactory({
5924
+ id: 'label',
5925
+ path: ['label'],
5926
+ label: 'Field label',
5927
+ props
5928
+ }));
5929
+ }
5930
+ return entries;
6087
5931
  }
6088
5932
 
6089
5933
  function SourceEntry(props) {
@@ -6144,17 +5988,16 @@ function TextEntry(props) {
6144
5988
  const {
6145
5989
  type
6146
5990
  } = field;
6147
- const entries = [];
6148
- if (type === 'text') {
6149
- entries.push({
6150
- id: 'text',
6151
- component: Text,
6152
- editField: editField,
6153
- field: field,
6154
- isEdited: isEdited$2
6155
- });
5991
+ if (type !== 'text') {
5992
+ return [];
6156
5993
  }
6157
- return entries;
5994
+ return [{
5995
+ id: 'text',
5996
+ component: Text,
5997
+ editField: editField,
5998
+ field: field,
5999
+ isEdited: isEdited$6
6000
+ }];
6158
6001
  }
6159
6002
  function Text(props) {
6160
6003
  const {
@@ -6163,6 +6006,9 @@ function Text(props) {
6163
6006
  id
6164
6007
  } = props;
6165
6008
  const debounce = useService('debounce');
6009
+ const variables = useVariables().map(name => ({
6010
+ name
6011
+ }));
6166
6012
  const path = ['text'];
6167
6013
  const getValue = () => {
6168
6014
  return get(field, path, '');
@@ -6170,15 +6016,17 @@ function Text(props) {
6170
6016
  const setValue = value => {
6171
6017
  return editField(field, path, value);
6172
6018
  };
6173
- return TextAreaEntry({
6019
+ return FeelTextArea({
6174
6020
  debounce,
6175
- description: 'Use Markdown or basic HTML to format.',
6021
+ description: 'Use an Expression, Markdown or basic HTML to format.',
6176
6022
  element: field,
6023
+ feel: 'optional',
6177
6024
  getValue,
6178
6025
  id,
6179
6026
  label: 'Text',
6180
6027
  rows: 10,
6181
- setValue
6028
+ setValue,
6029
+ variables
6182
6030
  });
6183
6031
  }
6184
6032
 
@@ -6271,8 +6119,7 @@ function NumberArrowStep(props) {
6271
6119
  function NumberSerializationEntry(props) {
6272
6120
  const {
6273
6121
  editField,
6274
- field,
6275
- id
6122
+ field
6276
6123
  } = props;
6277
6124
  const {
6278
6125
  type
@@ -6282,7 +6129,7 @@ function NumberSerializationEntry(props) {
6282
6129
  }
6283
6130
  const entries = [];
6284
6131
  entries.push({
6285
- id: id + '-serialize-to-string',
6132
+ id: 'serialize-to-string',
6286
6133
  component: SerializeToString,
6287
6134
  isEdited: isEdited$7,
6288
6135
  editField,
@@ -6320,6 +6167,243 @@ function SerializeToString(props) {
6320
6167
  });
6321
6168
  }
6322
6169
 
6170
+ function DateTimeEntry(props) {
6171
+ const {
6172
+ editField,
6173
+ field
6174
+ } = props;
6175
+ const {
6176
+ type,
6177
+ subtype
6178
+ } = field;
6179
+ if (type !== 'datetime') {
6180
+ return [];
6181
+ }
6182
+ const entries = [{
6183
+ id: 'subtype',
6184
+ component: DateTimeSubtypeSelect,
6185
+ isEdited: isEdited$4,
6186
+ editField,
6187
+ field
6188
+ }];
6189
+ if (subtype === DATETIME_SUBTYPES.TIME || subtype === DATETIME_SUBTYPES.DATETIME) {
6190
+ entries.push({
6191
+ id: 'use24h',
6192
+ component: Use24h,
6193
+ isEdited: isEdited$7,
6194
+ editField,
6195
+ field
6196
+ });
6197
+ }
6198
+ return entries;
6199
+ }
6200
+ function DateTimeSubtypeSelect(props) {
6201
+ const {
6202
+ editField,
6203
+ field,
6204
+ id
6205
+ } = props;
6206
+ const getValue = e => get(field, DATETIME_SUBTYPE_PATH);
6207
+ const clearTimeConfig = () => {
6208
+ const timeConfigPaths = [TIME_LABEL_PATH, TIME_USE24H_PATH, TIME_INTERVAL_PATH, TIME_SERIALISING_FORMAT_PATH];
6209
+ for (const path of timeConfigPaths) {
6210
+ editField(field, path, undefined);
6211
+ }
6212
+ };
6213
+ const initTimeConfig = () => {
6214
+ editField(field, TIME_LABEL_PATH, 'Time');
6215
+ editField(field, TIME_SERIALISING_FORMAT_PATH, TIME_SERIALISING_FORMATS.UTC_OFFSET);
6216
+ editField(field, TIME_INTERVAL_PATH, 15);
6217
+ };
6218
+ const clearDateConfig = () => {
6219
+ const dateConfigPaths = [DATE_LABEL_PATH, DATE_DISALLOW_PAST_PATH];
6220
+ for (const path of dateConfigPaths) {
6221
+ editField(field, path, undefined);
6222
+ }
6223
+ };
6224
+ const initDateConfig = () => {
6225
+ editField(field, DATE_LABEL_PATH, 'Date');
6226
+ };
6227
+ const setValue = value => {
6228
+ const oldValue = getValue();
6229
+ if (oldValue === value) return;
6230
+ if (value === DATETIME_SUBTYPES.DATE) {
6231
+ clearTimeConfig();
6232
+ oldValue === DATETIME_SUBTYPES.TIME && initDateConfig();
6233
+ } else if (value === DATETIME_SUBTYPES.TIME) {
6234
+ clearDateConfig();
6235
+ oldValue === DATETIME_SUBTYPES.DATE && initTimeConfig();
6236
+ } else if (value === DATETIME_SUBTYPES.DATETIME) {
6237
+ oldValue === DATETIME_SUBTYPES.DATE && initTimeConfig();
6238
+ oldValue === DATETIME_SUBTYPES.TIME && initDateConfig();
6239
+ }
6240
+ return editField(field, DATETIME_SUBTYPE_PATH, value);
6241
+ };
6242
+ const getDatetimeSubtypes = () => {
6243
+ return Object.values(DATETIME_SUBTYPES).map(subtype => ({
6244
+ label: DATETIME_SUBTYPES_LABELS[subtype],
6245
+ value: subtype
6246
+ }));
6247
+ };
6248
+ return SelectEntry({
6249
+ label: 'Subtype',
6250
+ element: field,
6251
+ getOptions: getDatetimeSubtypes,
6252
+ getValue,
6253
+ id,
6254
+ setValue
6255
+ });
6256
+ }
6257
+ function Use24h(props) {
6258
+ const {
6259
+ editField,
6260
+ field,
6261
+ id
6262
+ } = props;
6263
+ const path = TIME_USE24H_PATH;
6264
+ const getValue = () => {
6265
+ return get(field, path, '');
6266
+ };
6267
+ const setValue = value => {
6268
+ return editField(field, path, value);
6269
+ };
6270
+ return CheckboxEntry({
6271
+ element: field,
6272
+ getValue,
6273
+ id,
6274
+ label: 'Use 24h',
6275
+ setValue
6276
+ });
6277
+ }
6278
+
6279
+ function DateTimeConstraintsEntry(props) {
6280
+ const {
6281
+ editField,
6282
+ field,
6283
+ id
6284
+ } = props;
6285
+ const {
6286
+ type,
6287
+ subtype
6288
+ } = field;
6289
+ if (type !== 'datetime') {
6290
+ return [];
6291
+ }
6292
+ const entries = [];
6293
+ if (subtype === DATETIME_SUBTYPES.TIME || subtype === DATETIME_SUBTYPES.DATETIME) {
6294
+ entries.push({
6295
+ id: id + '-timeInterval',
6296
+ component: TimeIntervalSelect,
6297
+ isEdited: isEdited$4,
6298
+ editField,
6299
+ field
6300
+ });
6301
+ }
6302
+ if (subtype === DATETIME_SUBTYPES.DATE || subtype === DATETIME_SUBTYPES.DATETIME) {
6303
+ entries.push({
6304
+ id: id + '-disallowPassedDates',
6305
+ component: DisallowPassedDates,
6306
+ isEdited: isEdited$7,
6307
+ editField,
6308
+ field
6309
+ });
6310
+ }
6311
+ return entries;
6312
+ }
6313
+ function DisallowPassedDates(props) {
6314
+ const {
6315
+ editField,
6316
+ field,
6317
+ id
6318
+ } = props;
6319
+ const path = DATE_DISALLOW_PAST_PATH;
6320
+ const getValue = () => {
6321
+ return get(field, path, '');
6322
+ };
6323
+ const setValue = value => {
6324
+ return editField(field, path, value);
6325
+ };
6326
+ return CheckboxEntry({
6327
+ element: field,
6328
+ getValue,
6329
+ id,
6330
+ label: 'Disallow past dates',
6331
+ setValue
6332
+ });
6333
+ }
6334
+ function TimeIntervalSelect(props) {
6335
+ const {
6336
+ editField,
6337
+ field,
6338
+ id
6339
+ } = props;
6340
+ const timeIntervals = [1, 5, 10, 15, 30, 60];
6341
+ const getValue = e => get(field, TIME_INTERVAL_PATH);
6342
+ const setValue = value => editField(field, TIME_INTERVAL_PATH, parseInt(value));
6343
+ const getTimeIntervals = () => {
6344
+ return timeIntervals.map(timeInterval => ({
6345
+ label: timeInterval === 60 ? '1h' : timeInterval + 'm',
6346
+ value: timeInterval
6347
+ }));
6348
+ };
6349
+ return SelectEntry({
6350
+ label: 'Time interval',
6351
+ element: field,
6352
+ getOptions: getTimeIntervals,
6353
+ getValue,
6354
+ id,
6355
+ setValue
6356
+ });
6357
+ }
6358
+
6359
+ function DateTimeFormatEntry(props) {
6360
+ const {
6361
+ editField,
6362
+ field
6363
+ } = props;
6364
+ const {
6365
+ type,
6366
+ subtype
6367
+ } = field;
6368
+ if (type !== 'datetime') {
6369
+ return [];
6370
+ }
6371
+ const entries = [];
6372
+ if (subtype === DATETIME_SUBTYPES.TIME || subtype === DATETIME_SUBTYPES.DATETIME) {
6373
+ entries.push({
6374
+ id: 'time-format',
6375
+ component: TimeFormatSelect,
6376
+ isEdited: isEdited$4,
6377
+ editField,
6378
+ field
6379
+ });
6380
+ }
6381
+ return entries;
6382
+ }
6383
+ function TimeFormatSelect(props) {
6384
+ const {
6385
+ editField,
6386
+ field,
6387
+ id
6388
+ } = props;
6389
+ const getValue = e => get(field, TIME_SERIALISING_FORMAT_PATH);
6390
+ const setValue = value => editField(field, TIME_SERIALISING_FORMAT_PATH, value);
6391
+ const getTimeSerialisingFormats = () => {
6392
+ return Object.values(TIME_SERIALISING_FORMATS).map(format => ({
6393
+ label: TIME_SERIALISINGFORMAT_LABELS[format],
6394
+ value: format
6395
+ }));
6396
+ };
6397
+ return SelectEntry({
6398
+ label: 'Time format',
6399
+ element: field,
6400
+ getOptions: getTimeSerialisingFormats,
6401
+ getValue,
6402
+ id,
6403
+ setValue
6404
+ });
6405
+ }
6406
+
6323
6407
  function ValueEntry(props) {
6324
6408
  const {
6325
6409
  editField,
@@ -6521,37 +6605,6 @@ function updateKey(properties, oldKey, newKey) {
6521
6605
  }, {});
6522
6606
  }
6523
6607
 
6524
- // config ///////////////////
6525
-
6526
- const VALUES_SOURCES = {
6527
- STATIC: 'static',
6528
- INPUT: 'input'
6529
- };
6530
- const VALUES_SOURCE_DEFAULT = VALUES_SOURCES.STATIC;
6531
- const VALUES_SOURCES_LABELS = {
6532
- [VALUES_SOURCES.STATIC]: 'Static',
6533
- [VALUES_SOURCES.INPUT]: 'Input data'
6534
- };
6535
- const VALUES_SOURCES_PATHS = {
6536
- [VALUES_SOURCES.STATIC]: ['values'],
6537
- [VALUES_SOURCES.INPUT]: ['valuesKey']
6538
- };
6539
- const VALUES_SOURCES_DEFAULTS = {
6540
- [VALUES_SOURCES.STATIC]: [],
6541
- [VALUES_SOURCES.INPUT]: ''
6542
- };
6543
-
6544
- // helpers ///////////////////
6545
-
6546
- function getValuesSource(field) {
6547
- for (const source of Object.values(VALUES_SOURCES)) {
6548
- if (get(field, VALUES_SOURCES_PATHS[source]) !== undefined) {
6549
- return source;
6550
- }
6551
- }
6552
- return VALUES_SOURCE_DEFAULT;
6553
- }
6554
-
6555
6608
  function ValuesSourceSelectEntry(props) {
6556
6609
  const {
6557
6610
  editField,
@@ -6718,6 +6771,83 @@ function getIndexedEntry(index) {
6718
6771
  return entry;
6719
6772
  }
6720
6773
 
6774
+ function AdornerEntry(props) {
6775
+ const {
6776
+ editField,
6777
+ field
6778
+ } = props;
6779
+ const {
6780
+ type
6781
+ } = field;
6782
+ const entries = [];
6783
+ const onChange = key => {
6784
+ return value => {
6785
+ const appearance = get(field, ['appearance'], {});
6786
+ editField(field, ['appearance'], set(appearance, [key], value));
6787
+ };
6788
+ };
6789
+ const getValue = key => {
6790
+ return () => {
6791
+ return get(field, ['appearance', key]);
6792
+ };
6793
+ };
6794
+ if (['number', 'textfield'].includes(type)) {
6795
+ entries.push({
6796
+ id: 'prefix-adorner',
6797
+ component: PrefixAdorner,
6798
+ isEdited: isEdited$1,
6799
+ editField,
6800
+ field,
6801
+ onChange,
6802
+ getValue
6803
+ });
6804
+ entries.push({
6805
+ id: 'suffix-adorner',
6806
+ component: SuffixAdorner,
6807
+ isEdited: isEdited$1,
6808
+ editField,
6809
+ field,
6810
+ onChange,
6811
+ getValue
6812
+ });
6813
+ }
6814
+ return entries;
6815
+ }
6816
+ function PrefixAdorner(props) {
6817
+ const {
6818
+ field,
6819
+ id,
6820
+ onChange,
6821
+ getValue
6822
+ } = props;
6823
+ const debounce = useService('debounce');
6824
+ return TextfieldEntry({
6825
+ debounce,
6826
+ element: field,
6827
+ getValue: getValue('prefixAdorner'),
6828
+ id,
6829
+ label: 'Prefix',
6830
+ setValue: onChange('prefixAdorner')
6831
+ });
6832
+ }
6833
+ function SuffixAdorner(props) {
6834
+ const {
6835
+ field,
6836
+ id,
6837
+ onChange,
6838
+ getValue
6839
+ } = props;
6840
+ const debounce = useService('debounce');
6841
+ return TextfieldEntry({
6842
+ debounce,
6843
+ element: field,
6844
+ getValue: getValue('suffixAdorner'),
6845
+ id,
6846
+ label: 'Suffix',
6847
+ setValue: onChange('suffixAdorner')
6848
+ });
6849
+ }
6850
+
6721
6851
  function ConditionEntry(props) {
6722
6852
  const {
6723
6853
  editField,
@@ -6788,6 +6918,9 @@ function GeneralGroup(field, editField) {
6788
6918
  }), ...ColumnsEntry({
6789
6919
  field,
6790
6920
  editField
6921
+ }), ...DateTimeEntry({
6922
+ field,
6923
+ editField
6791
6924
  }), ...TextEntry({
6792
6925
  field,
6793
6926
  editField
@@ -6815,6 +6948,9 @@ function SerializationGroup(field, editField) {
6815
6948
  const entries = [...NumberSerializationEntry({
6816
6949
  field,
6817
6950
  editField
6951
+ }), ...DateTimeFormatEntry({
6952
+ field,
6953
+ editField
6818
6954
  })];
6819
6955
  if (!entries.length) {
6820
6956
  return null;
@@ -6826,6 +6962,21 @@ function SerializationGroup(field, editField) {
6826
6962
  };
6827
6963
  }
6828
6964
 
6965
+ function ConstraintsGroup(field, editField) {
6966
+ const entries = [...DateTimeConstraintsEntry({
6967
+ field,
6968
+ editField
6969
+ })];
6970
+ if (!entries.length) {
6971
+ return null;
6972
+ }
6973
+ return {
6974
+ id: 'constraints',
6975
+ label: 'Constraints',
6976
+ entries
6977
+ };
6978
+ }
6979
+
6829
6980
  const VALIDATION_TYPE_OPTIONS = {
6830
6981
  custom: {
6831
6982
  value: 'custom',
@@ -7190,6 +7341,21 @@ function removeKey(properties, oldKey) {
7190
7341
  }, {});
7191
7342
  }
7192
7343
 
7344
+ function AppearanceGroup(field, editField) {
7345
+ const entries = [...AdornerEntry({
7346
+ field,
7347
+ editField
7348
+ })];
7349
+ if (!entries.length) {
7350
+ return null;
7351
+ }
7352
+ return {
7353
+ id: 'appearance',
7354
+ label: 'Appearance',
7355
+ entries
7356
+ };
7357
+ }
7358
+
7193
7359
  function ConditionGroup(field, editField) {
7194
7360
  const {
7195
7361
  type
@@ -7212,7 +7378,7 @@ function getGroups(field, editField) {
7212
7378
  if (!field) {
7213
7379
  return [];
7214
7380
  }
7215
- const groups = [GeneralGroup(field, editField), ConditionGroup(field, editField), SerializationGroup(field, editField), ...ValuesGroups(field, editField), ValidationGroup(field, editField), CustomValuesGroup(field, editField)];
7381
+ const groups = [GeneralGroup(field, editField), ConditionGroup(field, editField), AppearanceGroup(field, editField), SerializationGroup(field, editField), ...ValuesGroups(field, editField), ConstraintsGroup(field, editField), ValidationGroup(field, editField), CustomValuesGroup(field, editField)];
7216
7382
 
7217
7383
  // contract: if a group returns null, it should not be displayed at all
7218
7384
  return groups.filter(group => group !== null);