formeo 4.0.0 → 4.1.1
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 +2 -2
- package/dist/demo/assets/css/demo.min.css +1 -1
- package/dist/demo/assets/css/demo.min.css.gz +0 -0
- package/dist/demo/assets/css/formeo.min.css +1 -1
- package/dist/demo/assets/js/demo.min.js +2 -2
- package/dist/demo/assets/js/demo.min.js.gz +0 -0
- package/dist/demo/assets/js/formeo.cjs.js +218 -95
- package/dist/demo/assets/js/formeo.es.js +134 -12
- package/dist/demo/assets/js/formeo.min.cjs.js +3 -3
- package/dist/demo/assets/js/formeo.min.es.js +134 -12
- package/dist/demo/assets/js/formeo.min.js +218 -95
- package/dist/demo/assets/js/formeo.min.umd.js +3 -3
- package/dist/demo/assets/js/formeo.umd.js +218 -95
- package/dist/demo/assets/js/index.min.js +1 -1
- package/dist/demo/assets/js/index.min2.js +1 -1
- package/dist/demo/assets/js/index.min3.js +1 -1
- package/dist/demo/assets/js/mode-json.min.js +1 -1
- package/dist/demo/assets/js/mode-json.min.js.gz +0 -0
- package/dist/demo/assets/js/theme-github_light_default.min.js +1 -1
- package/dist/demo/index.html +1 -1
- package/dist/formeo.cjs.js +218 -95
- package/dist/formeo.css +1 -1
- package/dist/formeo.es.js +134 -12
- package/dist/formeo.min.cjs.js +3 -3
- package/dist/formeo.min.css +1 -1
- package/dist/formeo.min.es.js +134 -12
- package/dist/formeo.min.js +218 -95
- package/dist/formeo.min.umd.js +3 -3
- package/dist/formeo.umd.js +218 -95
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version:
|
|
4
|
+
Version: 4.1.0
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -12,6 +12,7 @@ Author: Draggable https://draggable.io
|
|
|
12
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
13
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
14
14
|
|
|
15
|
+
var _a;
|
|
15
16
|
async function fetchData(url) {
|
|
16
17
|
try {
|
|
17
18
|
const response = await fetch(url);
|
|
@@ -88,8 +89,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
88
89
|
* @return {String} language string or undefined
|
|
89
90
|
*/
|
|
90
91
|
getValue(key, locale = this.locale) {
|
|
91
|
-
var
|
|
92
|
-
const value = (
|
|
92
|
+
var _a2;
|
|
93
|
+
const value = (_a2 = this.langs[locale]) == null ? void 0 : _a2[key];
|
|
93
94
|
return value || this.getFallbackValue(key);
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
@@ -438,7 +439,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
438
439
|
window.SmartTooltip = SmartTooltip;
|
|
439
440
|
}
|
|
440
441
|
const name$1 = "formeo";
|
|
441
|
-
const version$2 = "
|
|
442
|
+
const version$2 = "4.1.0";
|
|
442
443
|
const type = "module";
|
|
443
444
|
const main = "dist/formeo.cjs.js";
|
|
444
445
|
const module2 = "dist/formeo.es.js";
|
|
@@ -569,7 +570,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
569
570
|
sortablejs: "^1.15.3"
|
|
570
571
|
};
|
|
571
572
|
const release = {
|
|
572
|
-
branch: "
|
|
573
|
+
branch: "main",
|
|
573
574
|
verifyConditions: [
|
|
574
575
|
"@semantic-release/changelog",
|
|
575
576
|
"@semantic-release/npm",
|
|
@@ -1559,14 +1560,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1559
1560
|
}
|
|
1560
1561
|
};
|
|
1561
1562
|
const componentType = (node) => {
|
|
1562
|
-
var
|
|
1563
|
-
const classMatch = (
|
|
1563
|
+
var _a2;
|
|
1564
|
+
const classMatch = (_a2 = node.className) == null ? void 0 : _a2.match(COMPONENT_TYPE_CLASSNAMES_REGEXP);
|
|
1564
1565
|
return classMatch && COMPONENT_TYPE_CLASSNAMES_LOOKUP[classMatch[0]];
|
|
1565
1566
|
};
|
|
1566
1567
|
const unique = (array) => Array.from(new Set(array));
|
|
1567
1568
|
const uuid = (elem) => {
|
|
1568
|
-
var
|
|
1569
|
-
return ((
|
|
1569
|
+
var _a2;
|
|
1570
|
+
return ((_a2 = elem == null ? void 0 : elem.attrs) == null ? void 0 : _a2.id) || (elem == null ? void 0 : elem.id) || shortId();
|
|
1570
1571
|
};
|
|
1571
1572
|
const merge = (obj1, obj2) => {
|
|
1572
1573
|
const customizer = (objValue, srcValue) => {
|
|
@@ -1620,8 +1621,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1620
1621
|
const sessionStorage = Object.create(null, {
|
|
1621
1622
|
get: {
|
|
1622
1623
|
value: (key) => {
|
|
1623
|
-
var
|
|
1624
|
-
const itemValue = (
|
|
1624
|
+
var _a2;
|
|
1625
|
+
const itemValue = (_a2 = window.sessionStorage) == null ? void 0 : _a2.getItem(key);
|
|
1625
1626
|
try {
|
|
1626
1627
|
return JSON.parse(itemValue);
|
|
1627
1628
|
} catch (_err) {
|
|
@@ -1631,9 +1632,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1631
1632
|
},
|
|
1632
1633
|
set: {
|
|
1633
1634
|
value: (key, itemValue) => {
|
|
1634
|
-
var
|
|
1635
|
+
var _a2;
|
|
1635
1636
|
try {
|
|
1636
|
-
return (
|
|
1637
|
+
return (_a2 = window.sessionStorage) == null ? void 0 : _a2.setItem(key, JSON.stringify(itemValue));
|
|
1637
1638
|
} catch (error) {
|
|
1638
1639
|
console.error(error);
|
|
1639
1640
|
}
|
|
@@ -1683,7 +1684,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1683
1684
|
}
|
|
1684
1685
|
const cleanFormData = (formData) => formData ? clone$1(parseData(formData)) : DEFAULT_FORMDATA();
|
|
1685
1686
|
function buildFlatDataStructure(data, componentId, componentType2, result = {}) {
|
|
1686
|
-
var
|
|
1687
|
+
var _a2;
|
|
1687
1688
|
if (!componentId || !data[componentType2][componentId]) {
|
|
1688
1689
|
return result;
|
|
1689
1690
|
}
|
|
@@ -1691,7 +1692,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1691
1692
|
result[key] = data[componentType2][componentId];
|
|
1692
1693
|
const childType = CHILD_TYPE_INDEX_MAP.get(componentType2);
|
|
1693
1694
|
if (childType) {
|
|
1694
|
-
const childrenIds = ((
|
|
1695
|
+
const childrenIds = ((_a2 = data[componentType2][componentId].data) == null ? void 0 : _a2.children) || [];
|
|
1695
1696
|
for (const childId of childrenIds) {
|
|
1696
1697
|
buildFlatDataStructure(data, childId, childType, result);
|
|
1697
1698
|
}
|
|
@@ -1709,7 +1710,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1709
1710
|
];
|
|
1710
1711
|
const relativeSpritePath = `../../lib/icons/${formeoSpriteId}.svg`;
|
|
1711
1712
|
const localSpriteUrl = false ? (void 0)(relativeSpritePath) : relativeSpritePath;
|
|
1712
|
-
const isDev = process.env.NODE_ENV === "development" || false;
|
|
1713
|
+
const isDev = typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.NODE_ENV) === "development" || false;
|
|
1713
1714
|
const SVG_SPRITE_URL = isDev ? localSpriteUrl : `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
1714
1715
|
const FALLBACK_SVG_SPRITE_URL = `https://draggable.github.io/formeo/assets/img/${formeoSpriteId}.svg`;
|
|
1715
1716
|
const CSS_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/formeo.min.css`;
|
|
@@ -4956,8 +4957,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4956
4957
|
};
|
|
4957
4958
|
const inputTags = /* @__PURE__ */ new Set(["input", "textarea", "select"]);
|
|
4958
4959
|
const getName = (elem = {}) => {
|
|
4959
|
-
var
|
|
4960
|
-
let name2 = ((
|
|
4960
|
+
var _a2, _b, _c;
|
|
4961
|
+
let name2 = ((_a2 = elem == null ? void 0 : elem.attrs) == null ? void 0 : _a2.name) || (elem == null ? void 0 : elem.name);
|
|
4961
4962
|
if (name2) {
|
|
4962
4963
|
return name2;
|
|
4963
4964
|
}
|
|
@@ -5003,7 +5004,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5003
5004
|
}
|
|
5004
5005
|
const _this = this;
|
|
5005
5006
|
const processed = ["children", "content"];
|
|
5006
|
-
const { className, options, dataset,
|
|
5007
|
+
const { className, options, dataset, ...elem } = this.processElemArg(elemArg);
|
|
5007
5008
|
processed.push("tag");
|
|
5008
5009
|
let childType;
|
|
5009
5010
|
const { tag } = elem;
|
|
@@ -5291,12 +5292,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5291
5292
|
* @return {String} icon markup
|
|
5292
5293
|
*/
|
|
5293
5294
|
icon(name2, config2) {
|
|
5294
|
-
var
|
|
5295
|
+
var _a2, _b;
|
|
5295
5296
|
if (!name2) {
|
|
5296
5297
|
return;
|
|
5297
5298
|
}
|
|
5298
5299
|
const cacheKey = `${name2}?${new URLSearchParams(config2).toString()}`;
|
|
5299
|
-
if ((
|
|
5300
|
+
if ((_a2 = this.cachedIcons) == null ? void 0 : _a2[cacheKey]) {
|
|
5300
5301
|
return this.cachedIcons[cacheKey];
|
|
5301
5302
|
}
|
|
5302
5303
|
const iconConfig = this.icons[name2];
|
|
@@ -5367,7 +5368,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5367
5368
|
const fieldType = attrs.type || elem.tag;
|
|
5368
5369
|
const id = attrs.id || elem.id;
|
|
5369
5370
|
const optionMap = (option, i) => {
|
|
5370
|
-
var
|
|
5371
|
+
var _a2;
|
|
5371
5372
|
const { label, value, ...rest } = option;
|
|
5372
5373
|
const defaultInput = () => {
|
|
5373
5374
|
const input = {
|
|
@@ -5434,7 +5435,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5434
5435
|
checkbox: defaultInput,
|
|
5435
5436
|
radio: defaultInput
|
|
5436
5437
|
};
|
|
5437
|
-
return (
|
|
5438
|
+
return (_a2 = optionMarkup[fieldType]) == null ? void 0 : _a2.call(optionMarkup, option);
|
|
5438
5439
|
};
|
|
5439
5440
|
const mappedOptions = options.map(optionMap);
|
|
5440
5441
|
return mappedOptions;
|
|
@@ -6109,7 +6110,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6109
6110
|
* @param {Object} selectedOption - option - 'li' element - to be selected in autocomplete list
|
|
6110
6111
|
*/
|
|
6111
6112
|
selectOption(selectedOption, list = this.list) {
|
|
6112
|
-
var
|
|
6113
|
+
var _a2;
|
|
6113
6114
|
const options = list.querySelectorAll("li");
|
|
6114
6115
|
for (const option of options) {
|
|
6115
6116
|
const {
|
|
@@ -6118,7 +6119,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6118
6119
|
option.classList.remove("active-option");
|
|
6119
6120
|
if (isAddress(value)) {
|
|
6120
6121
|
const component = components.getAddress(value);
|
|
6121
|
-
(
|
|
6122
|
+
(_a2 = component == null ? void 0 : component.dom) == null ? void 0 : _a2.classList.remove(HIGHLIGHT_CLASSNAME);
|
|
6122
6123
|
}
|
|
6123
6124
|
}
|
|
6124
6125
|
if (selectedOption) {
|
|
@@ -6139,7 +6140,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6139
6140
|
* Highlight a component that maps to the option
|
|
6140
6141
|
*/
|
|
6141
6142
|
highlightComponent(option) {
|
|
6142
|
-
var
|
|
6143
|
+
var _a2;
|
|
6143
6144
|
const {
|
|
6144
6145
|
dataset: { value }
|
|
6145
6146
|
} = option;
|
|
@@ -6168,7 +6169,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6168
6169
|
component.dom.classList.add(HIGHLIGHT_CLASSNAME);
|
|
6169
6170
|
if (isOptionAddress) {
|
|
6170
6171
|
const checkboxes = component.dom.querySelectorAll(".field-preview .f-checkbox, .field-preview .f-radio");
|
|
6171
|
-
(
|
|
6172
|
+
(_a2 = checkboxes[optionIndex]) == null ? void 0 : _a2.classList.add(HIGHLIGHT_CLASSNAME);
|
|
6172
6173
|
}
|
|
6173
6174
|
}
|
|
6174
6175
|
}
|
|
@@ -6187,13 +6188,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6187
6188
|
* @param {String} value display text
|
|
6188
6189
|
*/
|
|
6189
6190
|
setValue(target) {
|
|
6190
|
-
var
|
|
6191
|
+
var _a2;
|
|
6191
6192
|
const { label, value } = target.dataset;
|
|
6192
6193
|
this.displayField.value = label;
|
|
6193
6194
|
this.hiddenField.value = value;
|
|
6194
6195
|
this.value = value;
|
|
6195
6196
|
this.clearButton.classList.toggle("hidden", !value.length);
|
|
6196
|
-
(
|
|
6197
|
+
(_a2 = this.onChange) == null ? void 0 : _a2.call(this, { target: this.hiddenField });
|
|
6197
6198
|
}
|
|
6198
6199
|
}
|
|
6199
6200
|
function inputConfigBase({ key, value, type: type2 = "text", checked }) {
|
|
@@ -6395,16 +6396,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6395
6396
|
}
|
|
6396
6397
|
};
|
|
6397
6398
|
const toggleFieldVisibility = (fields2) => {
|
|
6398
|
-
var
|
|
6399
|
+
var _a2;
|
|
6399
6400
|
for (const [fieldName, field2] of fields2) {
|
|
6400
|
-
const shouldHide = !!((
|
|
6401
|
+
const shouldHide = !!((_a2 = fieldVisibilityMap[fieldName]) == null ? void 0 : _a2.call(fieldVisibilityMap, fields2)) || false;
|
|
6401
6402
|
field2.classList.toggle(hiddenPropertyClassname, shouldHide);
|
|
6402
6403
|
}
|
|
6403
6404
|
};
|
|
6404
6405
|
const isCheckedValue = "isChecked";
|
|
6405
6406
|
const isCheckedOption = (option) => option.value.endsWith("Checked");
|
|
6406
6407
|
const toggleCheckablePropertyOptions = (isCheckable, propertyField) => {
|
|
6407
|
-
var
|
|
6408
|
+
var _a2;
|
|
6408
6409
|
if (isCheckable && isCheckedOption(propertyField)) {
|
|
6409
6410
|
return null;
|
|
6410
6411
|
}
|
|
@@ -6419,7 +6420,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6419
6420
|
option.classList.toggle(hiddenOptionClassname, shouldHide);
|
|
6420
6421
|
}
|
|
6421
6422
|
if (hiddenOptionValues.includes(propertyField.value)) {
|
|
6422
|
-
propertyField.value = isCheckable ? isCheckedValue : ((
|
|
6423
|
+
propertyField.value = isCheckable ? isCheckedValue : ((_a2 = options.find((opt) => !isCheckedOption(opt))) == null ? void 0 : _a2.value) || propertyField.value;
|
|
6423
6424
|
}
|
|
6424
6425
|
};
|
|
6425
6426
|
function orderConditionValues(conditionValues, fieldOrder = CONDITION_INPUT_ORDER) {
|
|
@@ -6716,9 +6717,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6716
6717
|
return controls;
|
|
6717
6718
|
}
|
|
6718
6719
|
itemInput(key, value) {
|
|
6719
|
-
var
|
|
6720
|
+
var _a2, _b;
|
|
6720
6721
|
const valType = dom.childType(value) || "string";
|
|
6721
|
-
const dataKey = ((
|
|
6722
|
+
const dataKey = ((_a2 = panelDataKeyMap.get(this.panelName)) == null ? void 0 : _a2({ itemKey: this.itemKey, key })) || this.itemKey;
|
|
6722
6723
|
const labelKey = dataKey.split(".").filter(Number.isNaN).join(".") || key;
|
|
6723
6724
|
const baseConfig = ITEM_INPUT_TYPE_MAP[valType]({ key, value });
|
|
6724
6725
|
const name2 = `${this.field.shortId}-${slugifyAddress(dataKey).replace(/-\d+-(selected)/g, "-$1")}`;
|
|
@@ -6763,7 +6764,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6763
6764
|
* @param {String|Array} val
|
|
6764
6765
|
*/
|
|
6765
6766
|
__publicField(this, "addAttribute", (attr, valArg) => {
|
|
6766
|
-
var
|
|
6767
|
+
var _a2;
|
|
6767
6768
|
let val = valArg;
|
|
6768
6769
|
const safeAttr = safeAttrName(attr);
|
|
6769
6770
|
const itemKey = `attrs.${safeAttr}`;
|
|
@@ -6774,7 +6775,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6774
6775
|
val = JSON.parse(val);
|
|
6775
6776
|
}
|
|
6776
6777
|
this.component.set(`attrs.${attr}`, val);
|
|
6777
|
-
(
|
|
6778
|
+
(_a2 = addAttributeActions[safeAttr]) == null ? void 0 : _a2.call(addAttributeActions, val, this.component);
|
|
6778
6779
|
const existingAttr = this.props.querySelector(`.${this.component.name}-attrs-${safeAttr}`);
|
|
6779
6780
|
const newAttr = new EditPanelItem({
|
|
6780
6781
|
key: itemKey,
|
|
@@ -6992,10 +6993,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
6992
6993
|
*/
|
|
6993
6994
|
constructor(options) {
|
|
6994
6995
|
__publicField(this, "toggleTabbedLayout", () => {
|
|
6995
|
-
var
|
|
6996
|
+
var _a2;
|
|
6996
6997
|
this.getPanelDisplay();
|
|
6997
6998
|
const isTabbed = this.isTabbed;
|
|
6998
|
-
(
|
|
6999
|
+
(_a2 = this.panelsWrap.parentElement) == null ? void 0 : _a2.classList.toggle("tabbed-panels", isTabbed);
|
|
6999
7000
|
if (isTabbed) {
|
|
7000
7001
|
this.panelNav.removeAttribute("style");
|
|
7001
7002
|
}
|
|
@@ -7035,7 +7036,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7035
7036
|
}
|
|
7036
7037
|
getPanelDisplay() {
|
|
7037
7038
|
const column = this.panelsWrap;
|
|
7038
|
-
const width = Number.parseInt(dom.getStyle(column, "width"));
|
|
7039
|
+
const width = Number.parseInt(dom.getStyle(column, "width"), 10);
|
|
7039
7040
|
const autoDisplayType = width > 390 ? "tabbed" : "slider";
|
|
7040
7041
|
const isAuto = this.opts.displayType === "auto";
|
|
7041
7042
|
this.panelDisplay = isAuto ? autoDisplayType : this.opts.displayType || defaults$2.displayType;
|
|
@@ -7291,6 +7292,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7291
7292
|
}
|
|
7292
7293
|
const parent = this.parent;
|
|
7293
7294
|
const children = this.children;
|
|
7295
|
+
this.dispatchComponentEvent("onRemove", {
|
|
7296
|
+
path,
|
|
7297
|
+
parent,
|
|
7298
|
+
children: [...children]
|
|
7299
|
+
// copy array since children will be modified
|
|
7300
|
+
});
|
|
7294
7301
|
forEach(children, (child) => child.remove());
|
|
7295
7302
|
this.dom.parentElement.removeChild(this.dom);
|
|
7296
7303
|
remove(components.getAddress(`${parent.name}s.${parent.id}.children`), this.id);
|
|
@@ -7432,6 +7439,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7432
7439
|
if (this.name !== "field") {
|
|
7433
7440
|
this.cloneChildren(newClone);
|
|
7434
7441
|
}
|
|
7442
|
+
this.dispatchComponentEvent("onClone", {
|
|
7443
|
+
original: this,
|
|
7444
|
+
clone: newClone,
|
|
7445
|
+
parent
|
|
7446
|
+
});
|
|
7435
7447
|
return newClone;
|
|
7436
7448
|
});
|
|
7437
7449
|
__publicField(this, "createChildWrap", (children) => dom.create({
|
|
@@ -7503,11 +7515,91 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7503
7515
|
this.address = `${this.name}s.${this.id}`;
|
|
7504
7516
|
this.dataPath = `${this.address}.`;
|
|
7505
7517
|
this.editPanels = /* @__PURE__ */ new Map();
|
|
7518
|
+
this.eventListeners = /* @__PURE__ */ new Map();
|
|
7519
|
+
this.initEventHandlers();
|
|
7520
|
+
}
|
|
7521
|
+
/**
|
|
7522
|
+
* Initialize event handlers based on config
|
|
7523
|
+
*/
|
|
7524
|
+
initEventHandlers() {
|
|
7525
|
+
if (!this.config.events) {
|
|
7526
|
+
return;
|
|
7527
|
+
}
|
|
7528
|
+
Object.entries(this.config.events).forEach(([eventName, handler]) => {
|
|
7529
|
+
this.addEventListener(eventName, handler);
|
|
7530
|
+
});
|
|
7531
|
+
}
|
|
7532
|
+
/**
|
|
7533
|
+
* Add an event listener to this component
|
|
7534
|
+
* @param {string} eventName - Name of the event
|
|
7535
|
+
* @param {function} handler - Event handler function
|
|
7536
|
+
*/
|
|
7537
|
+
addEventListener(eventName, handler) {
|
|
7538
|
+
if (!this.eventListeners.has(eventName)) {
|
|
7539
|
+
this.eventListeners.set(eventName, []);
|
|
7540
|
+
}
|
|
7541
|
+
this.eventListeners.get(eventName).push(handler);
|
|
7542
|
+
}
|
|
7543
|
+
/**
|
|
7544
|
+
* Remove an event listener from this component
|
|
7545
|
+
* @param {string} eventName - Name of the event
|
|
7546
|
+
* @param {function} handler - Event handler function to remove
|
|
7547
|
+
*/
|
|
7548
|
+
removeEventListener(eventName, handler) {
|
|
7549
|
+
var _a2;
|
|
7550
|
+
if (!((_a2 = this.eventListeners) == null ? void 0 : _a2.has(eventName))) {
|
|
7551
|
+
return;
|
|
7552
|
+
}
|
|
7553
|
+
const handlers = this.eventListeners.get(eventName);
|
|
7554
|
+
const index2 = handlers.indexOf(handler);
|
|
7555
|
+
if (index2 > -1) {
|
|
7556
|
+
handlers.splice(index2, 1);
|
|
7557
|
+
}
|
|
7558
|
+
}
|
|
7559
|
+
/**
|
|
7560
|
+
* Dispatch a component event to all registered listeners
|
|
7561
|
+
* @param {string} eventName - Name of the event to dispatch
|
|
7562
|
+
* @param {object} eventData - Data to pass to event handlers
|
|
7563
|
+
*/
|
|
7564
|
+
dispatchComponentEvent(eventName, eventData = {}) {
|
|
7565
|
+
var _a2;
|
|
7566
|
+
const fullEventData = {
|
|
7567
|
+
component: this,
|
|
7568
|
+
type: eventName,
|
|
7569
|
+
timestamp: Date.now(),
|
|
7570
|
+
...eventData
|
|
7571
|
+
};
|
|
7572
|
+
if ((_a2 = this.eventListeners) == null ? void 0 : _a2.has(eventName)) {
|
|
7573
|
+
this.eventListeners.get(eventName).forEach((handler) => {
|
|
7574
|
+
try {
|
|
7575
|
+
if (typeof handler === "function") {
|
|
7576
|
+
handler(fullEventData);
|
|
7577
|
+
}
|
|
7578
|
+
} catch (error) {
|
|
7579
|
+
console.error(`Error in ${eventName} event handler for ${this.name} ${this.id}:`, error);
|
|
7580
|
+
}
|
|
7581
|
+
});
|
|
7582
|
+
}
|
|
7583
|
+
return fullEventData;
|
|
7584
|
+
}
|
|
7585
|
+
/**
|
|
7586
|
+
* Override Data.set to dispatch component update events
|
|
7587
|
+
*/
|
|
7588
|
+
set(path, newVal) {
|
|
7589
|
+
const oldVal = this.get(path);
|
|
7590
|
+
const result = super.set(path, newVal);
|
|
7591
|
+
if (oldVal !== newVal && this.dom) {
|
|
7592
|
+
this.dispatchComponentEvent("onUpdate", {
|
|
7593
|
+
path,
|
|
7594
|
+
oldValue: oldVal,
|
|
7595
|
+
newValue: newVal
|
|
7596
|
+
});
|
|
7597
|
+
}
|
|
7598
|
+
return result;
|
|
7506
7599
|
}
|
|
7507
7600
|
// mutationHandler = mutations =>
|
|
7508
7601
|
// mutations.map(mutation => {
|
|
7509
|
-
// @todo pull handler form config
|
|
7510
|
-
// see dom.create.onRender for implementation pattern
|
|
7602
|
+
// @todo pull handler form config see dom.create.onRender for implementation pattern
|
|
7511
7603
|
// })
|
|
7512
7604
|
// observe(container) {
|
|
7513
7605
|
// this.observer.disconnect()
|
|
@@ -7655,8 +7747,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7655
7747
|
const { buttons, disabled } = this.config.actionButtons;
|
|
7656
7748
|
const activeButtons = buttons.filter((btn) => !disabled.includes(btn));
|
|
7657
7749
|
const actionButtonsConfigs = activeButtons.map((btn) => {
|
|
7658
|
-
var
|
|
7659
|
-
return ((
|
|
7750
|
+
var _a2;
|
|
7751
|
+
return ((_a2 = buttonConfig[btn]) == null ? void 0 : _a2.call(buttonConfig)) || btn;
|
|
7660
7752
|
});
|
|
7661
7753
|
this.actionButtons = actionButtonsConfigs;
|
|
7662
7754
|
return this.actionButtons;
|
|
@@ -7697,7 +7789,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7697
7789
|
* @return {Object} child DOM element
|
|
7698
7790
|
*/
|
|
7699
7791
|
addChild(childData = {}, index2 = this.domChildren.length) {
|
|
7700
|
-
var
|
|
7792
|
+
var _a2, _b;
|
|
7701
7793
|
let data = childData;
|
|
7702
7794
|
if (typeof childData !== "object") {
|
|
7703
7795
|
data = { id: data };
|
|
@@ -7710,8 +7802,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7710
7802
|
}
|
|
7711
7803
|
const childComponentType = `${childGroup}s`;
|
|
7712
7804
|
const child = components.getAddress(`${childComponentType}.${childId}`) || components[childComponentType].add(childId, data);
|
|
7713
|
-
|
|
7714
|
-
|
|
7805
|
+
if (index2 >= childWrap.children.length) {
|
|
7806
|
+
childWrap.appendChild(child.dom);
|
|
7807
|
+
} else {
|
|
7808
|
+
childWrap.children[index2].before(child.dom);
|
|
7809
|
+
}
|
|
7810
|
+
this.dispatchComponentEvent("onAddChild", {
|
|
7811
|
+
parent: this,
|
|
7812
|
+
target: child,
|
|
7813
|
+
child,
|
|
7814
|
+
index: index2
|
|
7815
|
+
});
|
|
7816
|
+
child.dispatchComponentEvent("onAdd", {
|
|
7817
|
+
parent: this,
|
|
7818
|
+
target: child,
|
|
7819
|
+
index: index2,
|
|
7820
|
+
addedVia: "addChild"
|
|
7821
|
+
// indicate how the component was added
|
|
7822
|
+
});
|
|
7823
|
+
(_b = (_a2 = this.config.events) == null ? void 0 : _a2.onAddChild) == null ? void 0 : _b.call(_a2, { parent: this, child });
|
|
7715
7824
|
const grandChildren = child.get("children");
|
|
7716
7825
|
if (grandChildren == null ? void 0 : grandChildren.length) {
|
|
7717
7826
|
child.loadChildren(grandChildren);
|
|
@@ -7727,7 +7836,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7727
7836
|
* @return {Object} Component
|
|
7728
7837
|
*/
|
|
7729
7838
|
onAdd({ from, to, item, newIndex: newIndex2 }) {
|
|
7730
|
-
var
|
|
7839
|
+
var _a2;
|
|
7731
7840
|
if (!from.classList.contains(CONTROL_GROUP_CLASSNAME)) {
|
|
7732
7841
|
from = from.parentElement;
|
|
7733
7842
|
}
|
|
@@ -7818,7 +7927,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7818
7927
|
return action == null ? void 0 : action(item.id);
|
|
7819
7928
|
}
|
|
7820
7929
|
};
|
|
7821
|
-
const component = (
|
|
7930
|
+
const component = (_a2 = onAddConditions[fromType]) == null ? void 0 : _a2.call(onAddConditions, item, newIndex2);
|
|
7931
|
+
this.dispatchComponentEvent("onAdd", {
|
|
7932
|
+
from,
|
|
7933
|
+
to,
|
|
7934
|
+
item,
|
|
7935
|
+
newIndex: newIndex2,
|
|
7936
|
+
fromType,
|
|
7937
|
+
toType,
|
|
7938
|
+
addedComponent: component,
|
|
7939
|
+
addedVia: "dragDrop"
|
|
7940
|
+
// indicate how the component was added
|
|
7941
|
+
});
|
|
7822
7942
|
defaultOnAdd();
|
|
7823
7943
|
return component;
|
|
7824
7944
|
}
|
|
@@ -7841,6 +7961,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7841
7961
|
* Callback for onRender, executes any defined onRender for component
|
|
7842
7962
|
*/
|
|
7843
7963
|
onRender() {
|
|
7964
|
+
this.dispatchComponentEvent("onRender", {
|
|
7965
|
+
dom: this.dom
|
|
7966
|
+
});
|
|
7844
7967
|
const { events: events2 } = this.config;
|
|
7845
7968
|
if (!events2) {
|
|
7846
7969
|
return null;
|
|
@@ -8763,8 +8886,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8763
8886
|
this.id = controlData.id || uuid();
|
|
8764
8887
|
}
|
|
8765
8888
|
get controlId() {
|
|
8766
|
-
var
|
|
8767
|
-
return ((
|
|
8889
|
+
var _a2, _b;
|
|
8890
|
+
return ((_a2 = this.controlData.meta) == null ? void 0 : _a2.id) || ((_b = this.controlData.config) == null ? void 0 : _b.controlId);
|
|
8768
8891
|
}
|
|
8769
8892
|
get dom() {
|
|
8770
8893
|
const { meta, config: config2 } = this.controlData;
|
|
@@ -8786,8 +8909,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8786
8909
|
return group && Controls$2.panels.nav.refresh(indexOfNode(group));
|
|
8787
8910
|
},
|
|
8788
8911
|
click: ({ target }) => {
|
|
8789
|
-
var
|
|
8790
|
-
const controlId = (
|
|
8912
|
+
var _a2;
|
|
8913
|
+
const controlId = (_a2 = target.closest(".field-control")) == null ? void 0 : _a2.id;
|
|
8791
8914
|
if (controlId) {
|
|
8792
8915
|
Controls$2.addElement(controlId);
|
|
8793
8916
|
}
|
|
@@ -8815,9 +8938,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8815
8938
|
* @return {String} the translated label
|
|
8816
8939
|
*/
|
|
8817
8940
|
i18n(lookup, args) {
|
|
8818
|
-
var
|
|
8941
|
+
var _a2, _b;
|
|
8819
8942
|
const locale = mi18n.locale;
|
|
8820
|
-
const controlTranslations = (
|
|
8943
|
+
const controlTranslations = (_a2 = this.definition) == null ? void 0 : _a2.i18n;
|
|
8821
8944
|
const localeTranslations = (controlTranslations == null ? void 0 : controlTranslations[locale]) || {};
|
|
8822
8945
|
return (((_b = localeTranslations[lookup]) == null ? void 0 : _b.call(localeTranslations)) ?? localeTranslations[lookup]) || mi18n.get(lookup, args);
|
|
8823
8946
|
}
|
|
@@ -9194,8 +9317,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9194
9317
|
this.controlId = this.get("config.controlId") || this.get("meta.id");
|
|
9195
9318
|
const actionButtons = this.getActionButtons();
|
|
9196
9319
|
const hasEditButton = this.actionButtons.some((child) => {
|
|
9197
|
-
var
|
|
9198
|
-
return ((
|
|
9320
|
+
var _a2;
|
|
9321
|
+
return ((_a2 = child.meta) == null ? void 0 : _a2.id) === "edit";
|
|
9199
9322
|
});
|
|
9200
9323
|
this.updateEditPanels();
|
|
9201
9324
|
const field2 = dom.create({
|
|
@@ -9278,13 +9401,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9278
9401
|
get defaultPreviewActions() {
|
|
9279
9402
|
return {
|
|
9280
9403
|
change: (evt) => {
|
|
9281
|
-
var
|
|
9404
|
+
var _a2;
|
|
9282
9405
|
const { target } = evt;
|
|
9283
9406
|
const { type: type2 } = target;
|
|
9284
9407
|
if (isSelectableType.has(type2)) {
|
|
9285
9408
|
const selectedOptions = this.preview.querySelectorAll(":checked");
|
|
9286
9409
|
const optionsData = this.get("options");
|
|
9287
|
-
const checkedType = ((
|
|
9410
|
+
const checkedType = ((_a2 = optionsData == null ? void 0 : optionsData[0]) == null ? void 0 : _a2.selected) !== void 0 ? "selected" : "checked";
|
|
9288
9411
|
const optionsDataMap = optionsData.reduce((acc, option) => {
|
|
9289
9412
|
acc[option.value] = option;
|
|
9290
9413
|
acc[option.value][checkedType] = false;
|
|
@@ -9303,12 +9426,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9303
9426
|
}
|
|
9304
9427
|
},
|
|
9305
9428
|
input: ({ target }) => {
|
|
9306
|
-
var
|
|
9429
|
+
var _a2;
|
|
9307
9430
|
if (["input", "meter", "progress", "button"].includes(target.tagName.toLowerCase())) {
|
|
9308
9431
|
super.set("attrs.value", target.value);
|
|
9309
9432
|
return this.debouncedUpdateEditPanels();
|
|
9310
9433
|
}
|
|
9311
|
-
if (target.contentEditable && !((
|
|
9434
|
+
if (target.contentEditable && !((_a2 = target.type) == null ? void 0 : _a2.startsWith("select-"))) {
|
|
9312
9435
|
const parentClassList = target.parentElement.classList;
|
|
9313
9436
|
const isOption = parentClassList.contains("f-checkbox") || parentClassList.contains("f-radio");
|
|
9314
9437
|
if (isOption) {
|
|
@@ -9327,14 +9450,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9327
9450
|
* @return {Object} fieldPreview
|
|
9328
9451
|
*/
|
|
9329
9452
|
fieldPreview() {
|
|
9330
|
-
var
|
|
9453
|
+
var _a2;
|
|
9331
9454
|
const { action = {}, ...prevData } = clone$1(this.data);
|
|
9332
9455
|
prevData.id = `prev-${this.id}`;
|
|
9333
9456
|
prevData.action = Object.entries(action).reduce((acc, [key, value]) => {
|
|
9334
9457
|
acc[key] = value.bind(this);
|
|
9335
9458
|
return acc;
|
|
9336
9459
|
}, {});
|
|
9337
|
-
if ((
|
|
9460
|
+
if ((_a2 = this.data) == null ? void 0 : _a2.config.editableContent) {
|
|
9338
9461
|
prevData.attrs = { ...prevData.attrs, contenteditable: true };
|
|
9339
9462
|
}
|
|
9340
9463
|
const fieldPreview = {
|
|
@@ -9554,28 +9677,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9554
9677
|
},
|
|
9555
9678
|
onChange: (...args) => defaults$1.onUpdate(...args),
|
|
9556
9679
|
onUpdate: (evt) => {
|
|
9557
|
-
var
|
|
9558
|
-
return ((
|
|
9680
|
+
var _a2;
|
|
9681
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9559
9682
|
},
|
|
9560
9683
|
onUpdateStage: (evt) => {
|
|
9561
|
-
var
|
|
9562
|
-
return ((
|
|
9684
|
+
var _a2;
|
|
9685
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9563
9686
|
},
|
|
9564
9687
|
onUpdateRow: (evt) => {
|
|
9565
|
-
var
|
|
9566
|
-
return ((
|
|
9688
|
+
var _a2;
|
|
9689
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9567
9690
|
},
|
|
9568
9691
|
onUpdateColumn: (evt) => {
|
|
9569
|
-
var
|
|
9570
|
-
return ((
|
|
9692
|
+
var _a2;
|
|
9693
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9571
9694
|
},
|
|
9572
9695
|
onUpdateField: (evt) => {
|
|
9573
|
-
var
|
|
9574
|
-
return ((
|
|
9696
|
+
var _a2;
|
|
9697
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9575
9698
|
},
|
|
9576
9699
|
onRender: (evt) => {
|
|
9577
|
-
var
|
|
9578
|
-
return ((
|
|
9700
|
+
var _a2;
|
|
9701
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9579
9702
|
},
|
|
9580
9703
|
onSave: (_evt) => {
|
|
9581
9704
|
},
|
|
@@ -9586,10 +9709,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9586
9709
|
}
|
|
9587
9710
|
};
|
|
9588
9711
|
const defaultCustomEvent = ({ src, ...evtData }, type2 = EVENT_FORMEO_UPDATED) => {
|
|
9589
|
-
var
|
|
9712
|
+
var _a2, _b;
|
|
9590
9713
|
const evt = new window.CustomEvent(type2, {
|
|
9591
9714
|
detail: evtData,
|
|
9592
|
-
bubbles: ((
|
|
9715
|
+
bubbles: ((_a2 = events.opts) == null ? void 0 : _a2.debug) || ((_b = events.opts) == null ? void 0 : _b.bubbles)
|
|
9593
9716
|
});
|
|
9594
9717
|
evt.data = (src || document).dispatchEvent(evt);
|
|
9595
9718
|
return evt;
|
|
@@ -9850,7 +9973,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9850
9973
|
* @return {Promise} asynchronously loaded remote resources
|
|
9851
9974
|
*/
|
|
9852
9975
|
async loadResources() {
|
|
9853
|
-
var
|
|
9976
|
+
var _a2;
|
|
9854
9977
|
document.removeEventListener("DOMContentLoaded", this.loadResources);
|
|
9855
9978
|
const promises = [];
|
|
9856
9979
|
if (this.opts.polyfills) {
|
|
@@ -9858,7 +9981,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9858
9981
|
}
|
|
9859
9982
|
await fetchIcons(this.opts.svgSprite);
|
|
9860
9983
|
promises.push(fetchFormeoStyle(this.opts.style));
|
|
9861
|
-
promises.push(mi18n.init({ ...this.opts.i18n, locale: (
|
|
9984
|
+
promises.push(mi18n.init({ ...this.opts.i18n, locale: (_a2 = window.sessionStorage) == null ? void 0 : _a2.getItem(SESSION_LOCALE_KEY) }));
|
|
9862
9985
|
const resolvedPromises = await Promise.all(promises);
|
|
9863
9986
|
if (this.opts.allowEdit) {
|
|
9864
9987
|
this.init();
|
|
@@ -9872,21 +9995,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9872
9995
|
*/
|
|
9873
9996
|
init() {
|
|
9874
9997
|
return Controls$2.init(this.opts.controls, this.opts.stickyControls).then((controls) => {
|
|
9875
|
-
var
|
|
9998
|
+
var _a2, _b;
|
|
9876
9999
|
this.controls = controls;
|
|
9877
10000
|
this.load(this.userFormData, this.opts);
|
|
9878
10001
|
this.formId = components.get("id");
|
|
9879
10002
|
this.i18n = {
|
|
9880
10003
|
setLang: (formeoLocale) => {
|
|
9881
|
-
var
|
|
9882
|
-
(
|
|
10004
|
+
var _a3;
|
|
10005
|
+
(_a3 = window.sessionStorage) == null ? void 0 : _a3.setItem(SESSION_LOCALE_KEY, formeoLocale);
|
|
9883
10006
|
const loadLang = mi18n.setCurrent(formeoLocale);
|
|
9884
10007
|
loadLang.then(() => {
|
|
9885
10008
|
this.init();
|
|
9886
10009
|
}, console.error);
|
|
9887
10010
|
}
|
|
9888
10011
|
};
|
|
9889
|
-
(_b = (
|
|
10012
|
+
(_b = (_a2 = this.opts).onLoad) == null ? void 0 : _b.call(_a2, this);
|
|
9890
10013
|
});
|
|
9891
10014
|
}
|
|
9892
10015
|
load(formData = this.userFormData, opts = this.opts) {
|
|
@@ -10011,8 +10134,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10011
10134
|
elem.checked = false;
|
|
10012
10135
|
},
|
|
10013
10136
|
value: (elem, { assignment, ...rest }) => {
|
|
10014
|
-
var
|
|
10015
|
-
const assignmentAction = (
|
|
10137
|
+
var _a2;
|
|
10138
|
+
const assignmentAction = (_a2 = assignmentMap[assignment]) == null ? void 0 : _a2.call(assignmentMap, elem, rest);
|
|
10016
10139
|
const event = new Event("input", { bubbles: true });
|
|
10017
10140
|
elem.dispatchEvent(event);
|
|
10018
10141
|
return assignmentAction;
|
|
@@ -10120,8 +10243,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10120
10243
|
);
|
|
10121
10244
|
});
|
|
10122
10245
|
__publicField(this, "processFields", (fieldIds) => this.orderChildren("fields", fieldIds).map(({ id, ...field2 }) => {
|
|
10123
|
-
var
|
|
10124
|
-
const controlId = ((
|
|
10246
|
+
var _a2, _b;
|
|
10247
|
+
const controlId = ((_a2 = field2.config) == null ? void 0 : _a2.controlId) || ((_b = field2.meta) == null ? void 0 : _b.id);
|
|
10125
10248
|
const { action = {}, dependencies: dependencies2 = {} } = this.elements[controlId] || {};
|
|
10126
10249
|
if (dependencies2) {
|
|
10127
10250
|
fetchDependencies(dependencies2);
|
|
@@ -10187,27 +10310,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10187
10310
|
* Evaulate conditions
|
|
10188
10311
|
*/
|
|
10189
10312
|
__publicField(this, "evaluateCondition", ({ source, sourceProperty, targetProperty, comparison, target }) => {
|
|
10190
|
-
var
|
|
10313
|
+
var _a2;
|
|
10191
10314
|
const sourceValue = this.getComponentProperty(source, sourceProperty);
|
|
10192
10315
|
if (typeof sourceValue === "boolean") {
|
|
10193
10316
|
return sourceValue;
|
|
10194
10317
|
}
|
|
10195
10318
|
const targetValue = String(isAddress(target) ? this.getComponentProperty(target, targetProperty) : target);
|
|
10196
|
-
return (
|
|
10319
|
+
return (_a2 = comparisonMap[comparison]) == null ? void 0 : _a2.call(comparisonMap, sourceValue, targetValue);
|
|
10197
10320
|
});
|
|
10198
10321
|
__publicField(this, "execResult", ({ target, targetProperty, assignment, value }) => {
|
|
10199
|
-
var
|
|
10322
|
+
var _a2;
|
|
10200
10323
|
if (isAddress(target)) {
|
|
10201
10324
|
const { component, option } = this.getComponent(target);
|
|
10202
10325
|
const elem = option || component;
|
|
10203
|
-
(
|
|
10326
|
+
(_a2 = targetPropertyMap[targetProperty]) == null ? void 0 : _a2.call(targetPropertyMap, elem, { targetProperty, assignment, value });
|
|
10204
10327
|
}
|
|
10205
10328
|
});
|
|
10206
10329
|
__publicField(this, "getComponentProperty", (address, propertyName) => {
|
|
10207
|
-
var
|
|
10330
|
+
var _a2;
|
|
10208
10331
|
const { component, option } = this.getComponent(address);
|
|
10209
10332
|
const elem = option || component;
|
|
10210
|
-
return ((
|
|
10333
|
+
return ((_a2 = propertyMap[propertyName]) == null ? void 0 : _a2.call(propertyMap, elem)) || elem[propertyName];
|
|
10211
10334
|
});
|
|
10212
10335
|
__publicField(this, "getComponent", (address) => {
|
|
10213
10336
|
const result = {
|
|
@@ -10581,7 +10704,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10581
10704
|
}
|
|
10582
10705
|
class SelectControl extends Control {
|
|
10583
10706
|
constructor(controlConfig = {}) {
|
|
10584
|
-
var
|
|
10707
|
+
var _a2;
|
|
10585
10708
|
const selectConfig = {
|
|
10586
10709
|
tag: "select",
|
|
10587
10710
|
config: {
|
|
@@ -10597,7 +10720,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10597
10720
|
icon: "select",
|
|
10598
10721
|
id: "select"
|
|
10599
10722
|
},
|
|
10600
|
-
options: generateOptionConfig({ type: "option", isMultiple: (
|
|
10723
|
+
options: generateOptionConfig({ type: "option", isMultiple: (_a2 = controlConfig.attrs) == null ? void 0 : _a2.multiple })
|
|
10601
10724
|
};
|
|
10602
10725
|
const mergedConfig = merge(selectConfig, controlConfig);
|
|
10603
10726
|
super(mergedConfig);
|