@bpmn-io/form-js-editor 1.0.0 → 1.1.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/assets/form-js-editor-base.css +22 -0
- package/dist/assets/form-js-editor.css +22 -0
- package/dist/index.cjs +196 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +196 -82
- package/dist/index.es.js.map +1 -1
- package/dist/types/features/properties-panel/entries/SpacerEntry.d.ts +9 -0
- package/dist/types/features/properties-panel/entries/index.d.ts +1 -0
- package/dist/types/render/components/icons/index.d.ts +1 -1
- package/package.json +4 -4
|
@@ -280,6 +280,23 @@
|
|
|
280
280
|
user-select: none;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
.fjs-editor-container .fjs-empty-editor {
|
|
284
|
+
display: flex;
|
|
285
|
+
align-items: center;
|
|
286
|
+
justify-content: center;
|
|
287
|
+
position: absolute;
|
|
288
|
+
top: 0;
|
|
289
|
+
left: 0;
|
|
290
|
+
width: 100%;
|
|
291
|
+
height: 100%;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.fjs-editor-container .fjs-empty-editor .fjs-empty-editor-card {
|
|
295
|
+
display: flex;
|
|
296
|
+
flex-direction: column;
|
|
297
|
+
padding: 20px;
|
|
298
|
+
}
|
|
299
|
+
|
|
283
300
|
.fjs-editor-container .fjs-drop-container-horizontal {
|
|
284
301
|
width: 100%;
|
|
285
302
|
}
|
|
@@ -639,6 +656,11 @@
|
|
|
639
656
|
margin-right: 2px;
|
|
640
657
|
}
|
|
641
658
|
|
|
659
|
+
.fjs-editor-container .fjs-form-field-spacer {
|
|
660
|
+
min-height: 30px;
|
|
661
|
+
background: repeating-linear-gradient( 45deg, #ffffff, #ffffff 10px, #f5f5f5 10px, #f5f5f5 20px);
|
|
662
|
+
}
|
|
663
|
+
|
|
642
664
|
/**
|
|
643
665
|
* Custom Dragula Styles
|
|
644
666
|
*/
|
|
@@ -258,6 +258,23 @@
|
|
|
258
258
|
user-select: none;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
.fjs-editor-container .fjs-empty-editor {
|
|
262
|
+
display: flex;
|
|
263
|
+
align-items: center;
|
|
264
|
+
justify-content: center;
|
|
265
|
+
position: absolute;
|
|
266
|
+
top: 0;
|
|
267
|
+
left: 0;
|
|
268
|
+
width: 100%;
|
|
269
|
+
height: 100%;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.fjs-editor-container .fjs-empty-editor .fjs-empty-editor-card {
|
|
273
|
+
display: flex;
|
|
274
|
+
flex-direction: column;
|
|
275
|
+
padding: 20px;
|
|
276
|
+
}
|
|
277
|
+
|
|
261
278
|
.fjs-editor-container .fjs-drop-container-horizontal {
|
|
262
279
|
width: 100%;
|
|
263
280
|
}
|
|
@@ -615,6 +632,11 @@
|
|
|
615
632
|
margin-right: 2px;
|
|
616
633
|
}
|
|
617
634
|
|
|
635
|
+
.fjs-editor-container .fjs-form-field-spacer {
|
|
636
|
+
min-height: 30px;
|
|
637
|
+
background: repeating-linear-gradient(45deg, #ffffff, #ffffff 10px, #f5f5f5 10px, #f5f5f5 20px);
|
|
638
|
+
}
|
|
639
|
+
|
|
618
640
|
/**
|
|
619
641
|
* Custom Dragula Styles
|
|
620
642
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -953,15 +953,15 @@ function useService$1 (type, strict) {
|
|
|
953
953
|
return getService(type, strict);
|
|
954
954
|
}
|
|
955
955
|
|
|
956
|
-
var _path$
|
|
957
|
-
function _extends$
|
|
956
|
+
var _path$4;
|
|
957
|
+
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); }
|
|
958
958
|
var SvgClose = function SvgClose(props) {
|
|
959
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
959
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
960
960
|
xmlns: "http://www.w3.org/2000/svg",
|
|
961
961
|
width: 16,
|
|
962
962
|
height: 16,
|
|
963
963
|
fill: "currentColor"
|
|
964
|
-
}, props), _path$
|
|
964
|
+
}, props), _path$4 || (_path$4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
965
965
|
fillRule: "evenodd",
|
|
966
966
|
d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
|
|
967
967
|
clipRule: "evenodd"
|
|
@@ -969,10 +969,10 @@ var SvgClose = function SvgClose(props) {
|
|
|
969
969
|
};
|
|
970
970
|
var CloseIcon = SvgClose;
|
|
971
971
|
|
|
972
|
-
var _path$
|
|
973
|
-
function _extends$
|
|
972
|
+
var _path$3, _path2$1;
|
|
973
|
+
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); }
|
|
974
974
|
var SvgDelete = function SvgDelete(props) {
|
|
975
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
975
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
|
|
976
976
|
xmlns: "http://www.w3.org/2000/svg",
|
|
977
977
|
width: 16,
|
|
978
978
|
height: 16,
|
|
@@ -993,27 +993,27 @@ var SvgDelete = function SvgDelete(props) {
|
|
|
993
993
|
mixBlendMode: "multiply"
|
|
994
994
|
},
|
|
995
995
|
transform: "translate(.536)"
|
|
996
|
-
}), _path$
|
|
996
|
+
}), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
997
997
|
fill: "currentcolor",
|
|
998
998
|
d: "M7.536 6h-1v6h1V6Zm3 0h-1v6h1V6Z"
|
|
999
|
-
})), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
999
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1000
1000
|
fill: "currentcolor",
|
|
1001
1001
|
d: "M2.536 3v1h1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4h1V3h-12Zm2 11V4h8v10h-8Zm6-13h-4v1h4V1Z"
|
|
1002
1002
|
})));
|
|
1003
1003
|
};
|
|
1004
1004
|
var DeleteIcon$1 = SvgDelete;
|
|
1005
1005
|
|
|
1006
|
-
var _path$
|
|
1007
|
-
function _extends$
|
|
1006
|
+
var _path$2;
|
|
1007
|
+
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); }
|
|
1008
1008
|
var SvgDraggable = function SvgDraggable(props) {
|
|
1009
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
1009
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
1010
1010
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1011
1011
|
xmlSpace: "preserve",
|
|
1012
1012
|
width: 16,
|
|
1013
1013
|
height: 16,
|
|
1014
1014
|
fill: "currentcolor",
|
|
1015
1015
|
viewBox: "0 0 32 32"
|
|
1016
|
-
}, props), _path$
|
|
1016
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1017
1017
|
d: "M10 6h4v4h-4zm8 0h4v4h-4zm-8 8h4v4h-4zm8 0h4v4h-4zm-8 8h4v4h-4zm8 0h4v4h-4z"
|
|
1018
1018
|
})), /*#__PURE__*/React__namespace.createElement("path", {
|
|
1019
1019
|
d: "M0 0h32v32H0z",
|
|
@@ -1024,21 +1024,76 @@ var SvgDraggable = function SvgDraggable(props) {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
var DraggableIcon = SvgDraggable;
|
|
1026
1026
|
|
|
1027
|
-
var _path;
|
|
1028
|
-
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); }
|
|
1027
|
+
var _path$1;
|
|
1028
|
+
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); }
|
|
1029
1029
|
var SvgSearch = function SvgSearch(props) {
|
|
1030
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1030
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
1031
1031
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1032
1032
|
width: 15,
|
|
1033
1033
|
height: 15,
|
|
1034
1034
|
fill: "none"
|
|
1035
|
-
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1035
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1036
1036
|
fill: "currentColor",
|
|
1037
1037
|
d: "m14.5 13.793-3.776-3.776a5.508 5.508 0 1 0-.707.707l3.776 3.776.707-.707ZM2 6.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0Z"
|
|
1038
1038
|
})));
|
|
1039
1039
|
};
|
|
1040
1040
|
var SearchIcon = SvgSearch;
|
|
1041
1041
|
|
|
1042
|
+
var _path, _rect, _mask, _path2, _path3, _path4, _path5, _path6;
|
|
1043
|
+
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); }
|
|
1044
|
+
var SvgEmptyForm = function SvgEmptyForm(props) {
|
|
1045
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
1046
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1047
|
+
width: 126,
|
|
1048
|
+
height: 96,
|
|
1049
|
+
fill: "none"
|
|
1050
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1051
|
+
fill: "#FF832B",
|
|
1052
|
+
fillRule: "evenodd",
|
|
1053
|
+
d: "M70 78v8a3 3 0 0 1-3 3h-8v-5h6v-6h5Zm0-16h-5V46h5v16Zm0-32h-5v-6h-6v-5h8a3 3 0 0 1 3 3v8ZM43 19v5H27v-5h16Zm-32 0v5H5v6H0v-8a3 3 0 0 1 3-3h8ZM0 46h5v16H0V46Zm0 32h5v6h6v5H3a3 3 0 0 1-3-3v-8Zm27 11v-5h16v5H27Z",
|
|
1054
|
+
clipRule: "evenodd"
|
|
1055
|
+
})), _rect || (_rect = /*#__PURE__*/React__namespace.createElement("rect", {
|
|
1056
|
+
width: 70,
|
|
1057
|
+
height: 70,
|
|
1058
|
+
fill: "#E5E5E5",
|
|
1059
|
+
rx: 3,
|
|
1060
|
+
transform: "matrix(-1 0 0 1 94 0)"
|
|
1061
|
+
})), _mask || (_mask = /*#__PURE__*/React__namespace.createElement("mask", {
|
|
1062
|
+
id: "EmptyForm_svg__a",
|
|
1063
|
+
fill: "#fff"
|
|
1064
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
1065
|
+
fillRule: "evenodd",
|
|
1066
|
+
d: "M87.085 88.684 75.43 45.185l43.499 11.656-11.044 8.072 8.557 8.556-12.728 12.728-8.557-8.556-8.072 11.043Z",
|
|
1067
|
+
clipRule: "evenodd"
|
|
1068
|
+
}))), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1069
|
+
fill: "#393939",
|
|
1070
|
+
fillRule: "evenodd",
|
|
1071
|
+
d: "M87.085 88.684 75.43 45.185l43.499 11.656-11.044 8.072 8.557 8.556-12.728 12.728-8.557-8.556-8.072 11.043Z",
|
|
1072
|
+
clipRule: "evenodd"
|
|
1073
|
+
})), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1074
|
+
fill: "#393939",
|
|
1075
|
+
d: "M75.43 45.185 70.6 46.48l-2.241-8.365 8.365 2.242-1.294 4.83Zm11.655 43.499 4.037 2.95-6.163 8.432-2.704-10.088 4.83-1.294Zm31.844-31.843 1.294-4.83 10.088 2.703-8.432 6.163-2.95-4.036Zm-11.044 8.072-3.535 3.535-4.128-4.127 4.713-3.445 2.95 4.037Zm8.557 8.556 3.535-3.535 3.536 3.535-3.536 3.536-3.535-3.536Zm-12.728 12.728 3.536 3.536-3.536 3.535-3.536-3.535 3.536-3.536Zm-8.557-8.556-4.036-2.951 3.444-4.713 4.128 4.128-3.536 3.535ZM80.26 43.89 91.915 87.39l-9.66 2.588L70.6 46.48l9.66-2.588Zm37.375 17.78L74.136 50.014l2.588-9.66 43.499 11.656-2.589 9.66Zm-12.699-.795 11.043-8.072 5.901 8.073-11.043 8.072-5.901-8.073Zm7.971 16.129-8.556-8.557 7.071-7.07 8.556 8.556-7.071 7.07Zm-12.728 5.657 12.728-12.728 7.071 7.07-12.727 12.729-7.072-7.071Zm-1.485-8.557 8.557 8.557-7.072 7.07-8.556-8.556 7.07-7.071ZM83.049 85.733 91.12 74.69l8.073 5.901-8.072 11.044-8.073-5.902Z",
|
|
1076
|
+
mask: "url(#EmptyForm_svg__a)"
|
|
1077
|
+
})), _path4 || (_path4 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1078
|
+
stroke: "#000",
|
|
1079
|
+
strokeLinecap: "round",
|
|
1080
|
+
strokeWidth: 3,
|
|
1081
|
+
d: "m69.431 39.163-9.192-9.192"
|
|
1082
|
+
})), _path5 || (_path5 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1083
|
+
stroke: "#000",
|
|
1084
|
+
strokeLinecap: "round",
|
|
1085
|
+
strokeWidth: 3,
|
|
1086
|
+
d: "M1.5-1.5h8",
|
|
1087
|
+
transform: "matrix(-1 0 0 1 68.213 50.123)"
|
|
1088
|
+
})), _path6 || (_path6 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1089
|
+
stroke: "#000",
|
|
1090
|
+
strokeLinecap: "round",
|
|
1091
|
+
strokeWidth: 3,
|
|
1092
|
+
d: "M78.969 36.367v-8"
|
|
1093
|
+
})));
|
|
1094
|
+
};
|
|
1095
|
+
var EmptyFormIcon = SvgEmptyForm;
|
|
1096
|
+
|
|
1042
1097
|
function EditorText(props) {
|
|
1043
1098
|
const {
|
|
1044
1099
|
type,
|
|
@@ -1047,7 +1102,7 @@ function EditorText(props) {
|
|
|
1047
1102
|
const Icon = formJsViewer.iconsByType('text');
|
|
1048
1103
|
const templating = useService$1('templating');
|
|
1049
1104
|
const expressionLanguage = useService$1('expressionLanguage');
|
|
1050
|
-
if (!text) {
|
|
1105
|
+
if (!text || !text.trim()) {
|
|
1051
1106
|
return jsxRuntime.jsx("div", {
|
|
1052
1107
|
class: editorFormFieldClasses(type),
|
|
1053
1108
|
children: jsxRuntime.jsxs("div", {
|
|
@@ -1948,7 +2003,19 @@ function ContextPad(props) {
|
|
|
1948
2003
|
});
|
|
1949
2004
|
}
|
|
1950
2005
|
function Empty(props) {
|
|
1951
|
-
return
|
|
2006
|
+
return jsxRuntime.jsx("div", {
|
|
2007
|
+
class: "fjs-empty-editor",
|
|
2008
|
+
children: jsxRuntime.jsxs("div", {
|
|
2009
|
+
class: "fjs-empty-editor-card",
|
|
2010
|
+
children: [jsxRuntime.jsx(EmptyFormIcon, {}), jsxRuntime.jsx("h2", {
|
|
2011
|
+
children: "Build your form"
|
|
2012
|
+
}), jsxRuntime.jsx("span", {
|
|
2013
|
+
children: "Drag and drop components here to start designing."
|
|
2014
|
+
}), jsxRuntime.jsx("span", {
|
|
2015
|
+
children: "Use the preview window to test your form."
|
|
2016
|
+
})]
|
|
2017
|
+
})
|
|
2018
|
+
});
|
|
1952
2019
|
}
|
|
1953
2020
|
function Element$1(props) {
|
|
1954
2021
|
const eventBus = useService$1('eventBus'),
|
|
@@ -6108,11 +6175,9 @@ function NumberFieldEntry(props) {
|
|
|
6108
6175
|
onBlur,
|
|
6109
6176
|
validate
|
|
6110
6177
|
} = props;
|
|
6111
|
-
const [cachedInvalidValue, setCachedInvalidValue] = hooks.useState(null);
|
|
6112
6178
|
const globalError = useError(id);
|
|
6113
6179
|
const [localError, setLocalError] = hooks.useState(null);
|
|
6114
6180
|
let value = getValue(element);
|
|
6115
|
-
const previousValue = usePrevious(value);
|
|
6116
6181
|
hooks.useEffect(() => {
|
|
6117
6182
|
if (minDash.isFunction(validate)) {
|
|
6118
6183
|
const newValidationError = validate(value) || null;
|
|
@@ -6124,16 +6189,9 @@ function NumberFieldEntry(props) {
|
|
|
6124
6189
|
if (minDash.isFunction(validate)) {
|
|
6125
6190
|
newValidationError = validate(newValue) || null;
|
|
6126
6191
|
}
|
|
6127
|
-
|
|
6128
|
-
setCachedInvalidValue(newValue);
|
|
6129
|
-
} else {
|
|
6130
|
-
setValue(newValue);
|
|
6131
|
-
}
|
|
6192
|
+
setValue(newValue, newValidationError);
|
|
6132
6193
|
setLocalError(newValidationError);
|
|
6133
6194
|
};
|
|
6134
|
-
if (previousValue === value && localError) {
|
|
6135
|
-
value = cachedInvalidValue;
|
|
6136
|
-
}
|
|
6137
6195
|
const error = globalError || localError;
|
|
6138
6196
|
return jsxRuntime.jsxs("div", {
|
|
6139
6197
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
@@ -6580,11 +6638,9 @@ function FeelEntry(props) {
|
|
|
6580
6638
|
onFocus,
|
|
6581
6639
|
onBlur
|
|
6582
6640
|
} = props;
|
|
6583
|
-
const [cachedInvalidValue, setCachedInvalidValue] = hooks.useState(null);
|
|
6584
6641
|
const [validationError, setValidationError] = hooks.useState(null);
|
|
6585
6642
|
const [localError, setLocalError] = hooks.useState(null);
|
|
6586
6643
|
let value = getValue(element);
|
|
6587
|
-
const previousValue = usePrevious(value);
|
|
6588
6644
|
hooks.useEffect(() => {
|
|
6589
6645
|
if (minDash.isFunction(validate)) {
|
|
6590
6646
|
const newValidationError = validate(value) || null;
|
|
@@ -6596,22 +6652,16 @@ function FeelEntry(props) {
|
|
|
6596
6652
|
if (minDash.isFunction(validate)) {
|
|
6597
6653
|
newValidationError = validate(newValue) || null;
|
|
6598
6654
|
}
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
if (newValue !== value) {
|
|
6604
|
-
setValue(newValue);
|
|
6605
|
-
}
|
|
6655
|
+
|
|
6656
|
+
// don't create multiple commandStack entries for the same value
|
|
6657
|
+
if (newValue !== value) {
|
|
6658
|
+
setValue(newValue, newValidationError);
|
|
6606
6659
|
}
|
|
6607
6660
|
setValidationError(newValidationError);
|
|
6608
6661
|
});
|
|
6609
6662
|
const onError = hooks.useCallback(err => {
|
|
6610
6663
|
setLocalError(err);
|
|
6611
6664
|
}, []);
|
|
6612
|
-
if (previousValue === value && validationError) {
|
|
6613
|
-
value = cachedInvalidValue;
|
|
6614
|
-
}
|
|
6615
6665
|
const temporaryError = useError(id);
|
|
6616
6666
|
const error = localError || temporaryError || validationError;
|
|
6617
6667
|
return jsxRuntime.jsxs("div", {
|
|
@@ -6842,11 +6892,9 @@ function SelectEntry(props) {
|
|
|
6842
6892
|
validate
|
|
6843
6893
|
} = props;
|
|
6844
6894
|
const options = getOptions(element);
|
|
6845
|
-
const [cachedInvalidValue, setCachedInvalidValue] = hooks.useState(null);
|
|
6846
6895
|
const globalError = useError(id);
|
|
6847
6896
|
const [localError, setLocalError] = hooks.useState(null);
|
|
6848
6897
|
let value = getValue(element);
|
|
6849
|
-
const previousValue = usePrevious(value);
|
|
6850
6898
|
hooks.useEffect(() => {
|
|
6851
6899
|
if (minDash.isFunction(validate)) {
|
|
6852
6900
|
const newValidationError = validate(value) || null;
|
|
@@ -6858,16 +6906,9 @@ function SelectEntry(props) {
|
|
|
6858
6906
|
if (minDash.isFunction(validate)) {
|
|
6859
6907
|
newValidationError = validate(newValue) || null;
|
|
6860
6908
|
}
|
|
6861
|
-
|
|
6862
|
-
setCachedInvalidValue(newValue);
|
|
6863
|
-
} else {
|
|
6864
|
-
setValue(newValue);
|
|
6865
|
-
}
|
|
6909
|
+
setValue(newValue, newValidationError);
|
|
6866
6910
|
setLocalError(newValidationError);
|
|
6867
6911
|
};
|
|
6868
|
-
if (previousValue === value && localError) {
|
|
6869
|
-
value = cachedInvalidValue;
|
|
6870
|
-
}
|
|
6871
6912
|
const error = globalError || localError;
|
|
6872
6913
|
return jsxRuntime.jsxs("div", {
|
|
6873
6914
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
@@ -6998,11 +7039,9 @@ function TextAreaEntry(props) {
|
|
|
6998
7039
|
onBlur,
|
|
6999
7040
|
autoResize
|
|
7000
7041
|
} = props;
|
|
7001
|
-
const [cachedInvalidValue, setCachedInvalidValue] = hooks.useState(null);
|
|
7002
7042
|
const globalError = useError(id);
|
|
7003
7043
|
const [localError, setLocalError] = hooks.useState(null);
|
|
7004
7044
|
let value = getValue(element);
|
|
7005
|
-
const previousValue = usePrevious(value);
|
|
7006
7045
|
hooks.useEffect(() => {
|
|
7007
7046
|
if (minDash.isFunction(validate)) {
|
|
7008
7047
|
const newValidationError = validate(value) || null;
|
|
@@ -7014,16 +7053,9 @@ function TextAreaEntry(props) {
|
|
|
7014
7053
|
if (minDash.isFunction(validate)) {
|
|
7015
7054
|
newValidationError = validate(newValue) || null;
|
|
7016
7055
|
}
|
|
7017
|
-
|
|
7018
|
-
setCachedInvalidValue(newValue);
|
|
7019
|
-
} else {
|
|
7020
|
-
setValue(newValue);
|
|
7021
|
-
}
|
|
7056
|
+
setValue(newValue, newValidationError);
|
|
7022
7057
|
setLocalError(newValidationError);
|
|
7023
7058
|
};
|
|
7024
|
-
if (previousValue === value && localError) {
|
|
7025
|
-
value = cachedInvalidValue;
|
|
7026
|
-
}
|
|
7027
7059
|
const error = globalError || localError;
|
|
7028
7060
|
return jsxRuntime.jsxs("div", {
|
|
7029
7061
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
@@ -7138,11 +7170,9 @@ function TextfieldEntry(props) {
|
|
|
7138
7170
|
onFocus,
|
|
7139
7171
|
onBlur
|
|
7140
7172
|
} = props;
|
|
7141
|
-
const [cachedInvalidValue, setCachedInvalidValue] = hooks.useState(null);
|
|
7142
7173
|
const globalError = useError(id);
|
|
7143
7174
|
const [localError, setLocalError] = hooks.useState(null);
|
|
7144
7175
|
let value = getValue(element);
|
|
7145
|
-
const previousValue = usePrevious(value);
|
|
7146
7176
|
hooks.useEffect(() => {
|
|
7147
7177
|
if (minDash.isFunction(validate)) {
|
|
7148
7178
|
const newValidationError = validate(value) || null;
|
|
@@ -7154,16 +7184,9 @@ function TextfieldEntry(props) {
|
|
|
7154
7184
|
if (minDash.isFunction(validate)) {
|
|
7155
7185
|
newValidationError = validate(newValue) || null;
|
|
7156
7186
|
}
|
|
7157
|
-
|
|
7158
|
-
setCachedInvalidValue(newValue);
|
|
7159
|
-
} else {
|
|
7160
|
-
setValue(newValue);
|
|
7161
|
-
}
|
|
7187
|
+
setValue(newValue, newValidationError);
|
|
7162
7188
|
setLocalError(newValidationError);
|
|
7163
7189
|
};
|
|
7164
|
-
if (previousValue === value && localError) {
|
|
7165
|
-
value = cachedInvalidValue;
|
|
7166
|
-
}
|
|
7167
7190
|
const error = globalError || localError;
|
|
7168
7191
|
return jsxRuntime.jsxs("div", {
|
|
7169
7192
|
class: classnames('bio-properties-panel-entry', error ? 'has-error' : ''),
|
|
@@ -7248,6 +7271,7 @@ const labelsByType = {
|
|
|
7248
7271
|
number: 'NUMBER',
|
|
7249
7272
|
radio: 'RADIO',
|
|
7250
7273
|
select: 'SELECT',
|
|
7274
|
+
spacer: 'SPACER',
|
|
7251
7275
|
taglist: 'TAGLIST',
|
|
7252
7276
|
text: 'TEXT VIEW',
|
|
7253
7277
|
textfield: 'TEXT FIELD',
|
|
@@ -7450,7 +7474,10 @@ function Columns(props) {
|
|
|
7450
7474
|
const validate = value => {
|
|
7451
7475
|
return formLayoutValidator.validateField(field, value ? parseInt(value) : null);
|
|
7452
7476
|
};
|
|
7453
|
-
const setValue = value => {
|
|
7477
|
+
const setValue = (value, error) => {
|
|
7478
|
+
if (error) {
|
|
7479
|
+
return;
|
|
7480
|
+
}
|
|
7454
7481
|
const layout = minDash.get(field, ['layout'], {});
|
|
7455
7482
|
const newValue = value ? parseInt(value) : null;
|
|
7456
7483
|
editField(field, ['layout'], minDash.set(layout, ['columns'], newValue));
|
|
@@ -7658,7 +7685,10 @@ function DefaultValueNumber(props) {
|
|
|
7658
7685
|
// Enforces decimal notation so that we do not submit defaults in exponent form
|
|
7659
7686
|
return serializeToString ? Big(value).toFixed() : value;
|
|
7660
7687
|
};
|
|
7661
|
-
const setValue = value => {
|
|
7688
|
+
const setValue = (value, error) => {
|
|
7689
|
+
if (error) {
|
|
7690
|
+
return;
|
|
7691
|
+
}
|
|
7662
7692
|
let newValue;
|
|
7663
7693
|
if (isValidNumber(value)) {
|
|
7664
7694
|
newValue = serializeToString ? value : Number(value);
|
|
@@ -7849,7 +7879,10 @@ function Id(props) {
|
|
|
7849
7879
|
const getValue = () => {
|
|
7850
7880
|
return minDash.get(field, path, '');
|
|
7851
7881
|
};
|
|
7852
|
-
const setValue = value => {
|
|
7882
|
+
const setValue = (value, error) => {
|
|
7883
|
+
if (error) {
|
|
7884
|
+
return;
|
|
7885
|
+
}
|
|
7853
7886
|
return editField(field, path, value);
|
|
7854
7887
|
};
|
|
7855
7888
|
const validate = value => {
|
|
@@ -7929,7 +7962,10 @@ function Key$1(props) {
|
|
|
7929
7962
|
const getValue = () => {
|
|
7930
7963
|
return minDash.get(field, path, '');
|
|
7931
7964
|
};
|
|
7932
|
-
const setValue = value => {
|
|
7965
|
+
const setValue = (value, error) => {
|
|
7966
|
+
if (error) {
|
|
7967
|
+
return;
|
|
7968
|
+
}
|
|
7933
7969
|
return editField(field, path, value);
|
|
7934
7970
|
};
|
|
7935
7971
|
const validate = value => {
|
|
@@ -8184,7 +8220,7 @@ function Text(props) {
|
|
|
8184
8220
|
return minDash.get(field, path, '');
|
|
8185
8221
|
};
|
|
8186
8222
|
const setValue = value => {
|
|
8187
|
-
return editField(field, path, value);
|
|
8223
|
+
return editField(field, path, value || '');
|
|
8188
8224
|
};
|
|
8189
8225
|
const description = hooks.useMemo(() => jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
8190
8226
|
children: ["Supports markdown and templating. ", jsxRuntime.jsx("a", {
|
|
@@ -8206,6 +8242,57 @@ function Text(props) {
|
|
|
8206
8242
|
});
|
|
8207
8243
|
}
|
|
8208
8244
|
|
|
8245
|
+
function SpacerEntry(props) {
|
|
8246
|
+
const {
|
|
8247
|
+
editField,
|
|
8248
|
+
field,
|
|
8249
|
+
id
|
|
8250
|
+
} = props;
|
|
8251
|
+
const {
|
|
8252
|
+
type
|
|
8253
|
+
} = field;
|
|
8254
|
+
if (type !== 'spacer') {
|
|
8255
|
+
return [];
|
|
8256
|
+
}
|
|
8257
|
+
const entries = [];
|
|
8258
|
+
entries.push({
|
|
8259
|
+
id: id + '-height',
|
|
8260
|
+
component: SpacerHeight,
|
|
8261
|
+
isEdited: isEdited$6,
|
|
8262
|
+
editField,
|
|
8263
|
+
field
|
|
8264
|
+
});
|
|
8265
|
+
return entries;
|
|
8266
|
+
}
|
|
8267
|
+
function SpacerHeight(props) {
|
|
8268
|
+
const {
|
|
8269
|
+
editField,
|
|
8270
|
+
field,
|
|
8271
|
+
id
|
|
8272
|
+
} = props;
|
|
8273
|
+
const debounce = useService('debounce');
|
|
8274
|
+
const getValue = e => minDash.get(field, ['height']);
|
|
8275
|
+
const setValue = (value, error) => {
|
|
8276
|
+
if (error) {
|
|
8277
|
+
return;
|
|
8278
|
+
}
|
|
8279
|
+
editField(field, ['height'], value);
|
|
8280
|
+
};
|
|
8281
|
+
return NumberFieldEntry({
|
|
8282
|
+
debounce,
|
|
8283
|
+
label: 'Height',
|
|
8284
|
+
element: field,
|
|
8285
|
+
id,
|
|
8286
|
+
getValue,
|
|
8287
|
+
setValue,
|
|
8288
|
+
validate: value => {
|
|
8289
|
+
if (value === undefined || value === null) return;
|
|
8290
|
+
if (value < 1) return 'Should be greater than zero.';
|
|
8291
|
+
if (!Number.isInteger(value)) return 'Should be an integer.';
|
|
8292
|
+
}
|
|
8293
|
+
});
|
|
8294
|
+
}
|
|
8295
|
+
|
|
8209
8296
|
function NumberEntries(props) {
|
|
8210
8297
|
const {
|
|
8211
8298
|
editField,
|
|
@@ -8243,7 +8330,12 @@ function NumberDecimalDigits(props) {
|
|
|
8243
8330
|
} = props;
|
|
8244
8331
|
const debounce = useService('debounce');
|
|
8245
8332
|
const getValue = e => minDash.get(field, ['decimalDigits']);
|
|
8246
|
-
const setValue = value =>
|
|
8333
|
+
const setValue = (value, error) => {
|
|
8334
|
+
if (error) {
|
|
8335
|
+
return;
|
|
8336
|
+
}
|
|
8337
|
+
editField(field, ['decimalDigits'], value);
|
|
8338
|
+
};
|
|
8247
8339
|
return NumberFieldEntry({
|
|
8248
8340
|
debounce,
|
|
8249
8341
|
label: 'Decimal digits',
|
|
@@ -8279,7 +8371,12 @@ function NumberArrowStep(props) {
|
|
|
8279
8371
|
const trimmed = value.replace(/^0+/g, '');
|
|
8280
8372
|
return (trimmed.startsWith('.') ? '0' : '') + trimmed;
|
|
8281
8373
|
};
|
|
8282
|
-
const setValue = value =>
|
|
8374
|
+
const setValue = (value, error) => {
|
|
8375
|
+
if (error) {
|
|
8376
|
+
return;
|
|
8377
|
+
}
|
|
8378
|
+
editField(field, ['increment'], clearLeadingZeroes(value));
|
|
8379
|
+
};
|
|
8283
8380
|
const decimalDigitsSet = decimalDigits || decimalDigits === 0;
|
|
8284
8381
|
return TextfieldEntry({
|
|
8285
8382
|
debounce,
|
|
@@ -8688,7 +8785,10 @@ function Label(props) {
|
|
|
8688
8785
|
validateFactory
|
|
8689
8786
|
} = props;
|
|
8690
8787
|
const debounce = useService('debounce');
|
|
8691
|
-
const setValue = value => {
|
|
8788
|
+
const setValue = (value, error) => {
|
|
8789
|
+
if (error) {
|
|
8790
|
+
return;
|
|
8791
|
+
}
|
|
8692
8792
|
const values = minDash.get(field, ['values']);
|
|
8693
8793
|
return editField(field, 'values', minDash.set(values, [index, 'label'], value));
|
|
8694
8794
|
};
|
|
@@ -8714,7 +8814,10 @@ function Value$1(props) {
|
|
|
8714
8814
|
validateFactory
|
|
8715
8815
|
} = props;
|
|
8716
8816
|
const debounce = useService('debounce');
|
|
8717
|
-
const setValue = value => {
|
|
8817
|
+
const setValue = (value, error) => {
|
|
8818
|
+
if (error) {
|
|
8819
|
+
return;
|
|
8820
|
+
}
|
|
8718
8821
|
const values = minDash.get(field, ['values']);
|
|
8719
8822
|
return editField(field, 'values', minDash.set(values, [index, 'value'], value));
|
|
8720
8823
|
};
|
|
@@ -8768,7 +8871,10 @@ function Key(props) {
|
|
|
8768
8871
|
validateFactory
|
|
8769
8872
|
} = props;
|
|
8770
8873
|
const debounce = useService('debounce');
|
|
8771
|
-
const setValue = value => {
|
|
8874
|
+
const setValue = (value, error) => {
|
|
8875
|
+
if (error) {
|
|
8876
|
+
return;
|
|
8877
|
+
}
|
|
8772
8878
|
const properties = minDash.get(field, ['properties']);
|
|
8773
8879
|
const key = Object.keys(properties)[index];
|
|
8774
8880
|
return editField(field, 'properties', updateKey(properties, key, value));
|
|
@@ -8979,7 +9085,12 @@ function InputValuesKey(props) {
|
|
|
8979
9085
|
const debounce = useService('debounce');
|
|
8980
9086
|
const path = formJsViewer.VALUES_SOURCES_PATHS[formJsViewer.VALUES_SOURCES.INPUT];
|
|
8981
9087
|
const getValue = () => minDash.get(field, path, '');
|
|
8982
|
-
const setValue = value
|
|
9088
|
+
const setValue = (value, error) => {
|
|
9089
|
+
if (error) {
|
|
9090
|
+
return;
|
|
9091
|
+
}
|
|
9092
|
+
editField(field, path, value || '');
|
|
9093
|
+
};
|
|
8983
9094
|
const validate = value => {
|
|
8984
9095
|
if (minDash.isUndefined(value) || !value.length) {
|
|
8985
9096
|
return 'Must not be empty.';
|
|
@@ -9336,6 +9447,9 @@ function GeneralGroup(field, editField, getService) {
|
|
|
9336
9447
|
field,
|
|
9337
9448
|
editField,
|
|
9338
9449
|
getService
|
|
9450
|
+
}), ...SpacerEntry({
|
|
9451
|
+
field,
|
|
9452
|
+
editField
|
|
9339
9453
|
}), ...NumberEntries({
|
|
9340
9454
|
field,
|
|
9341
9455
|
editField
|