@bpmn-io/form-js-editor 1.11.0-alpha.0 → 1.11.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/README.md +1 -0
- package/dist/assets/form-js-editor.css +6 -0
- package/dist/assets/properties-panel.css +6 -0
- package/dist/index.cjs +188 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +189 -161
- package/dist/index.es.js.map +1 -1
- package/dist/types/features/modeling/cmd/Util.d.ts +1 -1
- package/dist/types/features/properties-panel/Util.d.ts +0 -1
- package/dist/types/features/properties-panel/entries/DefaultValueEntry.d.ts +1 -1
- package/dist/types/render/components/editor-form-fields/EditorExpressionField.d.ts +1 -1
- package/package.json +9 -9
- /package/dist/assets/{dragula.css → draggle.css} +0 -0
package/README.md
CHANGED
|
@@ -1986,6 +1986,12 @@ textarea.bio-properties-panel-input {
|
|
|
1986
1986
|
white-space: pre-wrap;
|
|
1987
1987
|
}
|
|
1988
1988
|
|
|
1989
|
+
.bio-properties-panel-tooltip-content h1 {
|
|
1990
|
+
font-size: var(--text-size-base);
|
|
1991
|
+
font-weight: bold;
|
|
1992
|
+
margin: 0;
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1989
1995
|
.bio-properties-panel-tooltip-content code,
|
|
1990
1996
|
.bio-properties-panel-tooltip-content pre {
|
|
1991
1997
|
color: var(--description-color);
|
|
@@ -1183,6 +1183,12 @@ textarea.bio-properties-panel-input {
|
|
|
1183
1183
|
white-space: pre-wrap;
|
|
1184
1184
|
}
|
|
1185
1185
|
|
|
1186
|
+
.bio-properties-panel-tooltip-content h1 {
|
|
1187
|
+
font-size: var(--text-size-base);
|
|
1188
|
+
font-weight: bold;
|
|
1189
|
+
margin: 0;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1186
1192
|
.bio-properties-panel-tooltip-content code,
|
|
1187
1193
|
.bio-properties-panel-tooltip-content pre {
|
|
1188
1194
|
color: var(--description-color);
|
package/dist/index.cjs
CHANGED
|
@@ -877,7 +877,7 @@ function useDebounce(fn) {
|
|
|
877
877
|
}
|
|
878
878
|
|
|
879
879
|
var _path$5;
|
|
880
|
-
function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (
|
|
880
|
+
function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
|
|
881
881
|
var SvgClose = function SvgClose(props) {
|
|
882
882
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$5({
|
|
883
883
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -892,7 +892,7 @@ var SvgClose = function SvgClose(props) {
|
|
|
892
892
|
};
|
|
893
893
|
|
|
894
894
|
var _path$4, _path2$1;
|
|
895
|
-
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (
|
|
895
|
+
function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
|
|
896
896
|
var SvgDelete = function SvgDelete(props) {
|
|
897
897
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$4({
|
|
898
898
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -925,7 +925,7 @@ var SvgDelete = function SvgDelete(props) {
|
|
|
925
925
|
};
|
|
926
926
|
|
|
927
927
|
var _path$3;
|
|
928
|
-
function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (
|
|
928
|
+
function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
|
|
929
929
|
var SvgDraggable = function SvgDraggable(props) {
|
|
930
930
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
|
|
931
931
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -945,7 +945,7 @@ var SvgDraggable = function SvgDraggable(props) {
|
|
|
945
945
|
};
|
|
946
946
|
|
|
947
947
|
var _path$2;
|
|
948
|
-
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (
|
|
948
|
+
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
949
949
|
var SvgSearch = function SvgSearch(props) {
|
|
950
950
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
951
951
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -959,7 +959,7 @@ var SvgSearch = function SvgSearch(props) {
|
|
|
959
959
|
};
|
|
960
960
|
|
|
961
961
|
var _path$1, _rect, _mask, _path2, _path3, _path4, _path5, _path6;
|
|
962
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (
|
|
962
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
963
963
|
var SvgEmptyForm = function SvgEmptyForm(props) {
|
|
964
964
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
965
965
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1516,6 +1516,8 @@ function Palette(props) {
|
|
|
1516
1516
|
const initialPaletteEntries = hooks.useRef(collectPaletteEntries(formFields));
|
|
1517
1517
|
const [paletteEntries, setPaletteEntries] = hooks.useState(initialPaletteEntries.current);
|
|
1518
1518
|
const [searchTerm, setSearchTerm] = hooks.useState('');
|
|
1519
|
+
|
|
1520
|
+
/** @type {import("preact").RefObject<HTMLInputElement>} */
|
|
1519
1521
|
const inputRef = hooks.useRef();
|
|
1520
1522
|
const groups = groupEntries(paletteEntries);
|
|
1521
1523
|
const simplifyString = hooks.useCallback(str => {
|
|
@@ -1638,7 +1640,8 @@ function collectPaletteEntries(formFields) {
|
|
|
1638
1640
|
config: fieldConfig
|
|
1639
1641
|
} = formField;
|
|
1640
1642
|
return {
|
|
1641
|
-
|
|
1643
|
+
// fieldConfig.label is used to maintain backwards compatibility with custom form fields
|
|
1644
|
+
label: fieldConfig.name || fieldConfig.label,
|
|
1642
1645
|
type: type,
|
|
1643
1646
|
group: fieldConfig.group,
|
|
1644
1647
|
icon: fieldConfig.icon,
|
|
@@ -1941,6 +1944,29 @@ class Dragging {
|
|
|
1941
1944
|
}
|
|
1942
1945
|
return !target.classList.contains(DRAG_NO_DROP_CLS);
|
|
1943
1946
|
},
|
|
1947
|
+
transformOffset: (offset, event, element) => {
|
|
1948
|
+
if (element.classList.contains(DRAG_ROW_MOVE_CLS)) {
|
|
1949
|
+
const rowOffset = {
|
|
1950
|
+
x: -5,
|
|
1951
|
+
y: -60
|
|
1952
|
+
};
|
|
1953
|
+
return {
|
|
1954
|
+
left: event.clientX + rowOffset.x,
|
|
1955
|
+
top: event.clientY + rowOffset.y
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
if (element.classList.contains(DRAG_MOVE_CLS)) {
|
|
1959
|
+
const iconOffset = {
|
|
1960
|
+
x: -5,
|
|
1961
|
+
y: -15
|
|
1962
|
+
};
|
|
1963
|
+
return {
|
|
1964
|
+
left: event.clientX + iconOffset.x,
|
|
1965
|
+
top: event.clientY + iconOffset.y
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
return offset;
|
|
1969
|
+
},
|
|
1944
1970
|
slideFactorX: 10,
|
|
1945
1971
|
slideFactorY: 5
|
|
1946
1972
|
};
|
|
@@ -2236,6 +2262,8 @@ function Element$1(props) {
|
|
|
2236
2262
|
type,
|
|
2237
2263
|
showOutline
|
|
2238
2264
|
} = field;
|
|
2265
|
+
|
|
2266
|
+
/** @type {import("preact").RefObject<HTMLDivElement>} */
|
|
2239
2267
|
const ref = hooks.useRef();
|
|
2240
2268
|
const [hovered, setHovered] = hooks.useState(false);
|
|
2241
2269
|
hooks.useEffect(() => {
|
|
@@ -4691,7 +4719,7 @@ class MoveFormFieldHandler {
|
|
|
4691
4719
|
updateRow(formField, targetRow ? targetRow.id : this._formLayouter.nextRowId());
|
|
4692
4720
|
|
|
4693
4721
|
// (2) Move form field
|
|
4694
|
-
arrayMove.
|
|
4722
|
+
arrayMove.arrayMoveMutable(minDash.get(schema, sourcePath), sourceIndex, targetIndex);
|
|
4695
4723
|
|
|
4696
4724
|
// (3) Update internal paths of new form field and its siblings (and their children)
|
|
4697
4725
|
minDash.get(schema, sourcePath).forEach((formField, index) => updatePath(this._formFieldRegistry, formField, index));
|
|
@@ -5893,6 +5921,23 @@ function useStaticCallback(callback) {
|
|
|
5893
5921
|
callbackRef.current = callback;
|
|
5894
5922
|
return hooks.useCallback((...args) => callbackRef.current(...args), []);
|
|
5895
5923
|
}
|
|
5924
|
+
function useElementVisible(element) {
|
|
5925
|
+
const [visible, setVisible] = hooks.useState(!!element && !!element.clientHeight);
|
|
5926
|
+
hooks.useLayoutEffect(() => {
|
|
5927
|
+
if (!element) return;
|
|
5928
|
+
const resizeObserver = new ResizeObserver(([entry]) => {
|
|
5929
|
+
requestAnimationFrame(() => {
|
|
5930
|
+
const newVisible = !!entry.contentRect.height;
|
|
5931
|
+
if (newVisible !== visible) {
|
|
5932
|
+
setVisible(newVisible);
|
|
5933
|
+
}
|
|
5934
|
+
});
|
|
5935
|
+
});
|
|
5936
|
+
resizeObserver.observe(element);
|
|
5937
|
+
return () => resizeObserver.disconnect();
|
|
5938
|
+
}, [element, visible]);
|
|
5939
|
+
return visible;
|
|
5940
|
+
}
|
|
5896
5941
|
function Group(props) {
|
|
5897
5942
|
const {
|
|
5898
5943
|
element,
|
|
@@ -7227,12 +7272,13 @@ function FeelTextfieldComponent(props) {
|
|
|
7227
7272
|
setFocus(-1);
|
|
7228
7273
|
}
|
|
7229
7274
|
};
|
|
7230
|
-
const handleLint = useStaticCallback(lint => {
|
|
7231
|
-
|
|
7275
|
+
const handleLint = useStaticCallback((lint = []) => {
|
|
7276
|
+
const syntaxError = lint.some(report => report.type === 'Syntax Error');
|
|
7277
|
+
if (syntaxError) {
|
|
7278
|
+
onError('Unparsable FEEL expression.');
|
|
7279
|
+
} else {
|
|
7232
7280
|
onError(undefined);
|
|
7233
|
-
return;
|
|
7234
7281
|
}
|
|
7235
|
-
onError('Unparsable FEEL expression.');
|
|
7236
7282
|
});
|
|
7237
7283
|
const handlePopupOpen = (type = 'feel') => {
|
|
7238
7284
|
const popupOptions = {
|
|
@@ -8080,6 +8126,28 @@ function useUpdateLayoutEffect(effect, deps) {
|
|
|
8080
8126
|
}
|
|
8081
8127
|
}, deps);
|
|
8082
8128
|
}
|
|
8129
|
+
|
|
8130
|
+
/**
|
|
8131
|
+
* @typedef { {
|
|
8132
|
+
* [key: string]: string;
|
|
8133
|
+
* } } TranslateReplacements
|
|
8134
|
+
*/
|
|
8135
|
+
|
|
8136
|
+
/**
|
|
8137
|
+
* A simple translation stub to be used for multi-language support.
|
|
8138
|
+
* Can be easily replaced with a more sophisticated solution.
|
|
8139
|
+
*
|
|
8140
|
+
* @param {string} template to interpolate
|
|
8141
|
+
* @param {TranslateReplacements} [replacements] a map with substitutes
|
|
8142
|
+
*
|
|
8143
|
+
* @return {string} the translated string
|
|
8144
|
+
*/
|
|
8145
|
+
function translateFallback(template, replacements) {
|
|
8146
|
+
replacements = replacements || {};
|
|
8147
|
+
return template.replace(/{([^}]+)}/g, function (_, key) {
|
|
8148
|
+
return replacements[key] || '{' + key + '}';
|
|
8149
|
+
});
|
|
8150
|
+
}
|
|
8083
8151
|
function CollapsibleEntry(props) {
|
|
8084
8152
|
const {
|
|
8085
8153
|
element,
|
|
@@ -8087,7 +8155,8 @@ function CollapsibleEntry(props) {
|
|
|
8087
8155
|
id,
|
|
8088
8156
|
label,
|
|
8089
8157
|
open: shouldOpen,
|
|
8090
|
-
remove
|
|
8158
|
+
remove,
|
|
8159
|
+
translate = translateFallback
|
|
8091
8160
|
} = props;
|
|
8092
8161
|
const [open, setOpen] = hooks.useState(shouldOpen);
|
|
8093
8162
|
const toggleOpen = () => setOpen(!open);
|
|
@@ -8103,9 +8172,7 @@ function CollapsibleEntry(props) {
|
|
|
8103
8172
|
}
|
|
8104
8173
|
}, [onShow, setOpen])
|
|
8105
8174
|
};
|
|
8106
|
-
|
|
8107
|
-
// todo(pinussilvestrus): translate once we have a translate mechanism for the core
|
|
8108
|
-
const placeholderLabel = '<empty>';
|
|
8175
|
+
const placeholderLabel = translate('<empty>');
|
|
8109
8176
|
return jsxRuntime.jsxs("div", {
|
|
8110
8177
|
"data-entry-id": id,
|
|
8111
8178
|
class: classnames('bio-properties-panel-collapsible-entry', open ? 'open' : ''),
|
|
@@ -8118,14 +8185,14 @@ function CollapsibleEntry(props) {
|
|
|
8118
8185
|
children: label || placeholderLabel
|
|
8119
8186
|
}), jsxRuntime.jsx("button", {
|
|
8120
8187
|
type: "button",
|
|
8121
|
-
title:
|
|
8188
|
+
title: translate('Toggle list item'),
|
|
8122
8189
|
class: "bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow",
|
|
8123
8190
|
children: jsxRuntime.jsx(ArrowIcon, {
|
|
8124
8191
|
class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
|
|
8125
8192
|
})
|
|
8126
8193
|
}), remove ? jsxRuntime.jsx("button", {
|
|
8127
8194
|
type: "button",
|
|
8128
|
-
title:
|
|
8195
|
+
title: translate('Delete item'),
|
|
8129
8196
|
class: "bio-properties-panel-remove-entry",
|
|
8130
8197
|
onClick: remove,
|
|
8131
8198
|
children: jsxRuntime.jsx(DeleteIcon, {})
|
|
@@ -8152,7 +8219,8 @@ function CollapsibleEntry(props) {
|
|
|
8152
8219
|
function ListItem(props) {
|
|
8153
8220
|
const {
|
|
8154
8221
|
autoFocusEntry,
|
|
8155
|
-
autoOpen
|
|
8222
|
+
autoOpen,
|
|
8223
|
+
translate = translateFallback
|
|
8156
8224
|
} = props;
|
|
8157
8225
|
|
|
8158
8226
|
// focus specified entry on auto open
|
|
@@ -8174,7 +8242,8 @@ function ListItem(props) {
|
|
|
8174
8242
|
class: "bio-properties-panel-list-item",
|
|
8175
8243
|
children: jsxRuntime.jsx(CollapsibleEntry, {
|
|
8176
8244
|
...props,
|
|
8177
|
-
open: autoOpen
|
|
8245
|
+
open: autoOpen,
|
|
8246
|
+
translate: translate
|
|
8178
8247
|
})
|
|
8179
8248
|
});
|
|
8180
8249
|
}
|
|
@@ -8190,7 +8259,8 @@ function ListGroup(props) {
|
|
|
8190
8259
|
id,
|
|
8191
8260
|
items,
|
|
8192
8261
|
label,
|
|
8193
|
-
shouldOpen =
|
|
8262
|
+
shouldOpen = false,
|
|
8263
|
+
translate = translateFallback
|
|
8194
8264
|
} = props;
|
|
8195
8265
|
hooks.useEffect(() => {
|
|
8196
8266
|
if (props.shouldSort != undefined) {
|
|
@@ -8198,57 +8268,25 @@ function ListGroup(props) {
|
|
|
8198
8268
|
}
|
|
8199
8269
|
}, [props.shouldSort]);
|
|
8200
8270
|
const groupRef = hooks.useRef(null);
|
|
8201
|
-
const [open, setOpen] = useLayoutState(['groups', id, 'open'],
|
|
8271
|
+
const [open, setOpen] = useLayoutState(['groups', id, 'open'], shouldOpen);
|
|
8202
8272
|
const [sticky, setSticky] = hooks.useState(false);
|
|
8203
8273
|
const onShow = hooks.useCallback(() => setOpen(true), [setOpen]);
|
|
8204
8274
|
const [localItems, setLocalItems] = hooks.useState([]);
|
|
8205
|
-
const [newlyAddedItemIds, setNewlyAddedItemIds] = hooks.useState([]);
|
|
8206
8275
|
|
|
8207
8276
|
// Flag to mark that add button was clicked in the last render cycle
|
|
8208
8277
|
const [addTriggered, setAddTriggered] = hooks.useState(false);
|
|
8209
8278
|
const prevElement = usePrevious(element);
|
|
8210
|
-
const
|
|
8211
|
-
const
|
|
8212
|
-
|
|
8213
|
-
// (0) delay setting items
|
|
8214
|
-
//
|
|
8215
|
-
// We need to this to align the render cycles of items
|
|
8216
|
-
// with the detection of newly added items.
|
|
8217
|
-
// This is important, because the autoOpen property can
|
|
8218
|
-
// only set per list item on its very first render.
|
|
8219
|
-
hooks.useEffect(() => {
|
|
8220
|
-
setLocalItems(items);
|
|
8221
|
-
}, [items]);
|
|
8279
|
+
const toggleOpen = hooks.useCallback(() => setOpen(!open), [open]);
|
|
8280
|
+
const openItemIds = element === prevElement && open && addTriggered ? getNewItemIds(items, localItems) : [];
|
|
8222
8281
|
|
|
8223
|
-
//
|
|
8282
|
+
// reset local state after items changed
|
|
8224
8283
|
hooks.useEffect(() => {
|
|
8225
|
-
|
|
8284
|
+
setLocalItems(items);
|
|
8226
8285
|
setAddTriggered(false);
|
|
8227
|
-
|
|
8228
|
-
if (addTriggered) {
|
|
8229
|
-
const previousItemIds = localItems.map(item => item.id);
|
|
8230
|
-
const currentItemsIds = items.map(item => item.id);
|
|
8231
|
-
const newItemIds = currentItemsIds.filter(itemId => !previousItemIds.includes(itemId));
|
|
8232
|
-
|
|
8233
|
-
// open if not open, configured and triggered by add button
|
|
8234
|
-
//
|
|
8235
|
-
// TODO(marstamm): remove once we refactor layout handling for listGroups.
|
|
8236
|
-
// Ideally, opening should be handled as part of the `add` callback and
|
|
8237
|
-
// not be a concern for the ListGroup component.
|
|
8238
|
-
if (!open && shouldOpen && newItemIds.length > 0) {
|
|
8239
|
-
toggleOpen();
|
|
8240
|
-
}
|
|
8241
|
-
setNewlyAddedItemIds(newItemIds);
|
|
8242
|
-
} else {
|
|
8243
|
-
// ignore newly added items that do not result from a triggered add
|
|
8244
|
-
setNewlyAddedItemIds([]);
|
|
8245
|
-
}
|
|
8246
|
-
}
|
|
8247
|
-
}, [items, open, shouldHandleEffects, addTriggered, localItems]);
|
|
8286
|
+
}, [items]);
|
|
8248
8287
|
|
|
8249
8288
|
// set css class when group is sticky to top
|
|
8250
8289
|
useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky);
|
|
8251
|
-
const toggleOpen = () => setOpen(!open);
|
|
8252
8290
|
const hasItems = !!items.length;
|
|
8253
8291
|
const propertiesPanelContext = {
|
|
8254
8292
|
...hooks.useContext(LayoutContext),
|
|
@@ -8256,6 +8294,7 @@ function ListGroup(props) {
|
|
|
8256
8294
|
};
|
|
8257
8295
|
const handleAddClick = e => {
|
|
8258
8296
|
setAddTriggered(true);
|
|
8297
|
+
setOpen(true);
|
|
8259
8298
|
add(e);
|
|
8260
8299
|
};
|
|
8261
8300
|
const allErrors = useErrors();
|
|
@@ -8292,20 +8331,22 @@ function ListGroup(props) {
|
|
|
8292
8331
|
class: "bio-properties-panel-group-header-buttons",
|
|
8293
8332
|
children: [add ? jsxRuntime.jsxs("button", {
|
|
8294
8333
|
type: "button",
|
|
8295
|
-
title:
|
|
8334
|
+
title: translate('Create new list item'),
|
|
8296
8335
|
class: "bio-properties-panel-group-header-button bio-properties-panel-add-entry",
|
|
8297
8336
|
onClick: handleAddClick,
|
|
8298
8337
|
children: [jsxRuntime.jsx(CreateIcon, {}), !hasItems ? jsxRuntime.jsx("span", {
|
|
8299
8338
|
class: "bio-properties-panel-add-entry-label",
|
|
8300
|
-
children:
|
|
8339
|
+
children: translate('Create')
|
|
8301
8340
|
}) : null]
|
|
8302
8341
|
}) : null, hasItems ? jsxRuntime.jsx("div", {
|
|
8303
|
-
title: `List contains
|
|
8342
|
+
title: translate(`List contains {numOfItems} item${items.length != 1 ? 's' : ''}`, {
|
|
8343
|
+
numOfItems: items.length
|
|
8344
|
+
}),
|
|
8304
8345
|
class: classnames('bio-properties-panel-list-badge', hasError ? 'bio-properties-panel-list-badge--error' : ''),
|
|
8305
8346
|
children: items.length
|
|
8306
8347
|
}) : null, hasItems ? jsxRuntime.jsx("button", {
|
|
8307
8348
|
type: "button",
|
|
8308
|
-
title:
|
|
8349
|
+
title: translate('Toggle section'),
|
|
8309
8350
|
class: "bio-properties-panel-group-header-button bio-properties-panel-arrow",
|
|
8310
8351
|
children: jsxRuntime.jsx(ArrowIcon, {
|
|
8311
8352
|
class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right'
|
|
@@ -8316,7 +8357,7 @@ function ListGroup(props) {
|
|
|
8316
8357
|
class: classnames('bio-properties-panel-list', open && hasItems ? 'open' : ''),
|
|
8317
8358
|
children: jsxRuntime.jsx(LayoutContext.Provider, {
|
|
8318
8359
|
value: propertiesPanelContext,
|
|
8319
|
-
children:
|
|
8360
|
+
children: items.map((item, index) => {
|
|
8320
8361
|
if (!item) {
|
|
8321
8362
|
return;
|
|
8322
8363
|
}
|
|
@@ -8325,20 +8366,27 @@ function ListGroup(props) {
|
|
|
8325
8366
|
} = item;
|
|
8326
8367
|
|
|
8327
8368
|
// if item was added, open it
|
|
8328
|
-
//
|
|
8329
|
-
|
|
8369
|
+
// existing items will not be affected as autoOpen
|
|
8370
|
+
// is only applied on first render
|
|
8371
|
+
const autoOpen = openItemIds.includes(item.id);
|
|
8330
8372
|
return preact.createElement(ListItem, {
|
|
8331
8373
|
...item,
|
|
8332
8374
|
autoOpen: autoOpen,
|
|
8333
8375
|
element: element,
|
|
8334
8376
|
index: index,
|
|
8335
|
-
key: id
|
|
8377
|
+
key: id,
|
|
8378
|
+
translate: translate
|
|
8336
8379
|
});
|
|
8337
8380
|
})
|
|
8338
8381
|
})
|
|
8339
8382
|
})]
|
|
8340
8383
|
});
|
|
8341
8384
|
}
|
|
8385
|
+
function getNewItemIds(newItems, oldItems) {
|
|
8386
|
+
const newIds = newItems.map(item => item.id);
|
|
8387
|
+
const oldIds = oldItems.map(item => item.id);
|
|
8388
|
+
return newIds.filter(itemId => !oldIds.includes(itemId));
|
|
8389
|
+
}
|
|
8342
8390
|
function Checkbox(props) {
|
|
8343
8391
|
const {
|
|
8344
8392
|
id,
|
|
@@ -8624,13 +8672,14 @@ function TextArea(props) {
|
|
|
8624
8672
|
monospace,
|
|
8625
8673
|
onFocus,
|
|
8626
8674
|
onBlur,
|
|
8627
|
-
autoResize,
|
|
8675
|
+
autoResize = true,
|
|
8628
8676
|
placeholder,
|
|
8629
8677
|
rows = autoResize ? 1 : 2,
|
|
8630
8678
|
tooltip
|
|
8631
8679
|
} = props;
|
|
8632
8680
|
const [localValue, setLocalValue] = hooks.useState(value);
|
|
8633
8681
|
const ref = useShowEntryEvent(id);
|
|
8682
|
+
const visible = useElementVisible(ref.current);
|
|
8634
8683
|
const handleInputCallback = hooks.useMemo(() => {
|
|
8635
8684
|
return debounce(target => onInput(target.value.length ? target.value : undefined));
|
|
8636
8685
|
}, [onInput, debounce]);
|
|
@@ -8642,6 +8691,9 @@ function TextArea(props) {
|
|
|
8642
8691
|
hooks.useLayoutEffect(() => {
|
|
8643
8692
|
autoResize && resizeToContents(ref.current);
|
|
8644
8693
|
}, []);
|
|
8694
|
+
hooks.useLayoutEffect(() => {
|
|
8695
|
+
visible && autoResize && resizeToContents(ref.current);
|
|
8696
|
+
}, [visible]);
|
|
8645
8697
|
hooks.useEffect(() => {
|
|
8646
8698
|
if (value === localValue) {
|
|
8647
8699
|
return;
|
|
@@ -8958,82 +9010,6 @@ const FormPropertiesPanelContext = preact.createContext({
|
|
|
8958
9010
|
getService
|
|
8959
9011
|
});
|
|
8960
9012
|
|
|
8961
|
-
function arrayAdd(array, index, item) {
|
|
8962
|
-
const copy = [...array];
|
|
8963
|
-
copy.splice(index, 0, item);
|
|
8964
|
-
return copy;
|
|
8965
|
-
}
|
|
8966
|
-
function countDecimals(number) {
|
|
8967
|
-
const num = Big(number);
|
|
8968
|
-
if (num.toString() === num.toFixed(0)) return 0;
|
|
8969
|
-
return num.toFixed().split('.')[1].length || 0;
|
|
8970
|
-
}
|
|
8971
|
-
|
|
8972
|
-
/**
|
|
8973
|
-
*
|
|
8974
|
-
* @param {unknown} value
|
|
8975
|
-
* @returns {boolean}
|
|
8976
|
-
*/
|
|
8977
|
-
function isValidNumber(value) {
|
|
8978
|
-
return (typeof value === 'number' || typeof value === 'string') && value !== '' && !isNaN(Number(value));
|
|
8979
|
-
}
|
|
8980
|
-
function textToLabel(text) {
|
|
8981
|
-
if (typeof text != 'string') return null;
|
|
8982
|
-
for (const line of text.split('\n')) {
|
|
8983
|
-
const displayLine = line.trim();
|
|
8984
|
-
|
|
8985
|
-
// we use the first non-whitespace line in the text as label
|
|
8986
|
-
if (displayLine !== '') {
|
|
8987
|
-
return displayLine;
|
|
8988
|
-
}
|
|
8989
|
-
}
|
|
8990
|
-
return null;
|
|
8991
|
-
}
|
|
8992
|
-
|
|
8993
|
-
/**
|
|
8994
|
-
* @param {string} path
|
|
8995
|
-
*/
|
|
8996
|
-
function isValidDotPath(path) {
|
|
8997
|
-
return /^\w+(\.\w+)*$/.test(path);
|
|
8998
|
-
}
|
|
8999
|
-
|
|
9000
|
-
/**
|
|
9001
|
-
* @param {string} path
|
|
9002
|
-
*/
|
|
9003
|
-
function isProhibitedPath(path) {
|
|
9004
|
-
const prohibitedSegments = ['__proto__', 'prototype', 'constructor'];
|
|
9005
|
-
return path.split('.').some(segment => prohibitedSegments.includes(segment));
|
|
9006
|
-
}
|
|
9007
|
-
const LABELED_NON_INPUTS = ['button', 'group', 'dynamiclist', 'iframe', 'table'];
|
|
9008
|
-
const INPUTS = ['checkbox', 'checklist', 'datetime', 'number', 'radio', 'select', 'taglist', 'textfield', 'textarea', 'filepicker'];
|
|
9009
|
-
const OPTIONS_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
|
|
9010
|
-
function hasEntryConfigured(formFieldDefinition, entryId) {
|
|
9011
|
-
const {
|
|
9012
|
-
propertiesPanelEntries = []
|
|
9013
|
-
} = formFieldDefinition;
|
|
9014
|
-
if (!propertiesPanelEntries.length) {
|
|
9015
|
-
return false;
|
|
9016
|
-
}
|
|
9017
|
-
return propertiesPanelEntries.some(id => id === entryId);
|
|
9018
|
-
}
|
|
9019
|
-
function hasOptionsGroupsConfigured(formFieldDefinition) {
|
|
9020
|
-
const {
|
|
9021
|
-
propertiesPanelEntries = []
|
|
9022
|
-
} = formFieldDefinition;
|
|
9023
|
-
if (!propertiesPanelEntries.length) {
|
|
9024
|
-
return false;
|
|
9025
|
-
}
|
|
9026
|
-
return propertiesPanelEntries.some(id => id === 'values');
|
|
9027
|
-
}
|
|
9028
|
-
|
|
9029
|
-
/**
|
|
9030
|
-
* @param {string} path
|
|
9031
|
-
*/
|
|
9032
|
-
function hasIntegerPathSegment(path) {
|
|
9033
|
-
return path.split('.').some(segment => /^\d+$/.test(segment));
|
|
9034
|
-
}
|
|
9035
|
-
|
|
9036
|
-
const headerlessTypes = ['spacer', 'separator', 'expression', 'html'];
|
|
9037
9013
|
function getPropertiesPanelHeaderProvider(options = {}) {
|
|
9038
9014
|
const {
|
|
9039
9015
|
getDocumentationRef,
|
|
@@ -9044,19 +9020,8 @@ function getPropertiesPanelHeaderProvider(options = {}) {
|
|
|
9044
9020
|
const {
|
|
9045
9021
|
type
|
|
9046
9022
|
} = field;
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
}
|
|
9050
|
-
if (type === 'text') {
|
|
9051
|
-
return textToLabel(field.text);
|
|
9052
|
-
}
|
|
9053
|
-
if (type === 'image') {
|
|
9054
|
-
return field.alt;
|
|
9055
|
-
}
|
|
9056
|
-
if (type === 'default') {
|
|
9057
|
-
return field.id;
|
|
9058
|
-
}
|
|
9059
|
-
return field.label;
|
|
9023
|
+
const fieldDefinition = formFields.get(type).config;
|
|
9024
|
+
return fieldDefinition.getSubheading ? fieldDefinition.getSubheading(field) : field.label;
|
|
9060
9025
|
},
|
|
9061
9026
|
getElementIcon: field => {
|
|
9062
9027
|
const {
|
|
@@ -9085,7 +9050,7 @@ function getPropertiesPanelHeaderProvider(options = {}) {
|
|
|
9085
9050
|
return 'Form';
|
|
9086
9051
|
}
|
|
9087
9052
|
const fieldDefinition = formFields.get(type).config;
|
|
9088
|
-
return fieldDefinition.label || type;
|
|
9053
|
+
return fieldDefinition.name || fieldDefinition.label || type;
|
|
9089
9054
|
},
|
|
9090
9055
|
getDocumentationRef
|
|
9091
9056
|
};
|
|
@@ -9486,6 +9451,69 @@ function asArray(length) {
|
|
|
9486
9451
|
}).map((_, i) => i + 1);
|
|
9487
9452
|
}
|
|
9488
9453
|
|
|
9454
|
+
function arrayAdd(array, index, item) {
|
|
9455
|
+
const copy = [...array];
|
|
9456
|
+
copy.splice(index, 0, item);
|
|
9457
|
+
return copy;
|
|
9458
|
+
}
|
|
9459
|
+
function countDecimals(number) {
|
|
9460
|
+
const num = Big(number);
|
|
9461
|
+
if (num.toString() === num.toFixed(0)) return 0;
|
|
9462
|
+
return num.toFixed().split('.')[1].length || 0;
|
|
9463
|
+
}
|
|
9464
|
+
|
|
9465
|
+
/**
|
|
9466
|
+
*
|
|
9467
|
+
* @param {unknown} value
|
|
9468
|
+
* @returns {boolean}
|
|
9469
|
+
*/
|
|
9470
|
+
function isValidNumber(value) {
|
|
9471
|
+
return (typeof value === 'number' || typeof value === 'string') && value !== '' && !isNaN(Number(value));
|
|
9472
|
+
}
|
|
9473
|
+
|
|
9474
|
+
/**
|
|
9475
|
+
* @param {string} path
|
|
9476
|
+
*/
|
|
9477
|
+
function isValidDotPath(path) {
|
|
9478
|
+
return /^\w+(\.\w+)*$/.test(path);
|
|
9479
|
+
}
|
|
9480
|
+
|
|
9481
|
+
/**
|
|
9482
|
+
* @param {string} path
|
|
9483
|
+
*/
|
|
9484
|
+
function isProhibitedPath(path) {
|
|
9485
|
+
const prohibitedSegments = ['__proto__', 'prototype', 'constructor'];
|
|
9486
|
+
return path.split('.').some(segment => prohibitedSegments.includes(segment));
|
|
9487
|
+
}
|
|
9488
|
+
const LABELED_NON_INPUTS = ['button', 'group', 'dynamiclist', 'iframe', 'table'];
|
|
9489
|
+
const INPUTS = ['checkbox', 'checklist', 'datetime', 'number', 'radio', 'select', 'taglist', 'textfield', 'textarea', 'filepicker'];
|
|
9490
|
+
const OPTIONS_INPUTS = ['checklist', 'radio', 'select', 'taglist'];
|
|
9491
|
+
function hasEntryConfigured(formFieldDefinition, entryId) {
|
|
9492
|
+
const {
|
|
9493
|
+
propertiesPanelEntries = []
|
|
9494
|
+
} = formFieldDefinition;
|
|
9495
|
+
if (!propertiesPanelEntries.length) {
|
|
9496
|
+
return false;
|
|
9497
|
+
}
|
|
9498
|
+
return propertiesPanelEntries.some(id => id === entryId);
|
|
9499
|
+
}
|
|
9500
|
+
function hasOptionsGroupsConfigured(formFieldDefinition) {
|
|
9501
|
+
const {
|
|
9502
|
+
propertiesPanelEntries = []
|
|
9503
|
+
} = formFieldDefinition;
|
|
9504
|
+
if (!propertiesPanelEntries.length) {
|
|
9505
|
+
return false;
|
|
9506
|
+
}
|
|
9507
|
+
return propertiesPanelEntries.some(id => id === 'values');
|
|
9508
|
+
}
|
|
9509
|
+
|
|
9510
|
+
/**
|
|
9511
|
+
* @param {string} path
|
|
9512
|
+
*/
|
|
9513
|
+
function hasIntegerPathSegment(path) {
|
|
9514
|
+
return path.split('.').some(segment => /^\d+$/.test(segment));
|
|
9515
|
+
}
|
|
9516
|
+
|
|
9489
9517
|
function DescriptionEntry(props) {
|
|
9490
9518
|
const {
|
|
9491
9519
|
editField,
|
|
@@ -9531,7 +9559,7 @@ function Description(props) {
|
|
|
9531
9559
|
});
|
|
9532
9560
|
}
|
|
9533
9561
|
|
|
9534
|
-
const EMPTY_OPTION =
|
|
9562
|
+
const EMPTY_OPTION = '';
|
|
9535
9563
|
function DefaultValueEntry(props) {
|
|
9536
9564
|
const {
|
|
9537
9565
|
editField,
|
|
@@ -12643,7 +12671,7 @@ function Multiple(props) {
|
|
|
12643
12671
|
feel: 'optional',
|
|
12644
12672
|
getValue,
|
|
12645
12673
|
id,
|
|
12646
|
-
label: '
|
|
12674
|
+
label: 'Upload multiple files',
|
|
12647
12675
|
inline: true,
|
|
12648
12676
|
setValue,
|
|
12649
12677
|
variables
|
|
@@ -13464,7 +13492,7 @@ const RenderInjectionModule = {
|
|
|
13464
13492
|
};
|
|
13465
13493
|
|
|
13466
13494
|
var _path;
|
|
13467
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
13495
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13468
13496
|
var SvgRepeat = function SvgRepeat(props) {
|
|
13469
13497
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
13470
13498
|
xmlns: "http://www.w3.org/2000/svg",
|