formeo 4.1.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/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 +94 -93
- package/dist/demo/assets/js/formeo.es.js +6 -6
- package/dist/demo/assets/js/formeo.min.cjs.js +3 -3
- package/dist/demo/assets/js/formeo.min.es.js +6 -6
- package/dist/demo/assets/js/formeo.min.js +94 -93
- package/dist/demo/assets/js/formeo.min.umd.js +3 -3
- package/dist/demo/assets/js/formeo.umd.js +94 -93
- 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 +94 -93
- package/dist/formeo.css +1 -1
- package/dist/formeo.es.js +6 -6
- package/dist/formeo.min.cjs.js +3 -3
- package/dist/formeo.min.css +1 -1
- package/dist/formeo.min.es.js +6 -6
- package/dist/formeo.min.js +94 -93
- package/dist/formeo.min.umd.js +3 -3
- package/dist/formeo.umd.js +94 -93
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version: 4.
|
|
4
|
+
Version: 4.1.0
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
10
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
11
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
12
12
|
async function fetchData(url) {
|
|
13
13
|
try {
|
|
14
14
|
const response = await fetch(url);
|
|
@@ -435,7 +435,7 @@ if (window !== void 0) {
|
|
|
435
435
|
window.SmartTooltip = SmartTooltip;
|
|
436
436
|
}
|
|
437
437
|
const name$1 = "formeo";
|
|
438
|
-
const version$2 = "4.
|
|
438
|
+
const version$2 = "4.1.0";
|
|
439
439
|
const type = "module";
|
|
440
440
|
const main = "dist/formeo.cjs.js";
|
|
441
441
|
const module = "dist/formeo.es.js";
|
|
@@ -1706,7 +1706,7 @@ const POLYFILLS = [
|
|
|
1706
1706
|
];
|
|
1707
1707
|
const relativeSpritePath = `../../lib/icons/${formeoSpriteId}.svg`;
|
|
1708
1708
|
const localSpriteUrl = typeof import.meta.resolve === "function" ? import.meta.resolve(relativeSpritePath) : relativeSpritePath;
|
|
1709
|
-
const isDev = ((_b = (_a = import.meta) == null ? void 0 : _a.env) == null ? void 0 : _b.DEV) || process.env.NODE_ENV === "development" || false;
|
|
1709
|
+
const isDev = ((_b = (_a = import.meta) == null ? void 0 : _a.env) == null ? void 0 : _b.DEV) || typeof process !== "undefined" && ((_c = process.env) == null ? void 0 : _c.NODE_ENV) === "development" || false;
|
|
1710
1710
|
const SVG_SPRITE_URL = isDev ? localSpriteUrl : `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
1711
1711
|
const FALLBACK_SVG_SPRITE_URL = `https://draggable.github.io/formeo/assets/img/${formeoSpriteId}.svg`;
|
|
1712
1712
|
const CSS_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/formeo.min.css`;
|
|
@@ -4953,13 +4953,13 @@ const iconFontTemplates = {
|
|
|
4953
4953
|
};
|
|
4954
4954
|
const inputTags = /* @__PURE__ */ new Set(["input", "textarea", "select"]);
|
|
4955
4955
|
const getName = (elem = {}) => {
|
|
4956
|
-
var _a2, _b2,
|
|
4956
|
+
var _a2, _b2, _c2;
|
|
4957
4957
|
let name2 = ((_a2 = elem == null ? void 0 : elem.attrs) == null ? void 0 : _a2.name) || (elem == null ? void 0 : elem.name);
|
|
4958
4958
|
if (name2) {
|
|
4959
4959
|
return name2;
|
|
4960
4960
|
}
|
|
4961
4961
|
const id = uuid(elem);
|
|
4962
|
-
let label = ((_b2 = elem.config) == null ? void 0 : _b2.label) || ((
|
|
4962
|
+
let label = ((_b2 = elem.config) == null ? void 0 : _b2.label) || ((_c2 = elem.attrs) == null ? void 0 : _c2.label) || (elem == null ? void 0 : elem.label);
|
|
4963
4963
|
if (label) {
|
|
4964
4964
|
if (typeof label === "object") {
|
|
4965
4965
|
label = dom.create(label).textContent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version: 4.
|
|
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 = "4.
|
|
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";
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -7545,8 +7546,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7545
7546
|
* @param {function} handler - Event handler function to remove
|
|
7546
7547
|
*/
|
|
7547
7548
|
removeEventListener(eventName, handler) {
|
|
7548
|
-
var
|
|
7549
|
-
if (!((
|
|
7549
|
+
var _a2;
|
|
7550
|
+
if (!((_a2 = this.eventListeners) == null ? void 0 : _a2.has(eventName))) {
|
|
7550
7551
|
return;
|
|
7551
7552
|
}
|
|
7552
7553
|
const handlers = this.eventListeners.get(eventName);
|
|
@@ -7561,14 +7562,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7561
7562
|
* @param {object} eventData - Data to pass to event handlers
|
|
7562
7563
|
*/
|
|
7563
7564
|
dispatchComponentEvent(eventName, eventData = {}) {
|
|
7564
|
-
var
|
|
7565
|
+
var _a2;
|
|
7565
7566
|
const fullEventData = {
|
|
7566
7567
|
component: this,
|
|
7567
7568
|
type: eventName,
|
|
7568
7569
|
timestamp: Date.now(),
|
|
7569
7570
|
...eventData
|
|
7570
7571
|
};
|
|
7571
|
-
if ((
|
|
7572
|
+
if ((_a2 = this.eventListeners) == null ? void 0 : _a2.has(eventName)) {
|
|
7572
7573
|
this.eventListeners.get(eventName).forEach((handler) => {
|
|
7573
7574
|
try {
|
|
7574
7575
|
if (typeof handler === "function") {
|
|
@@ -7746,8 +7747,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7746
7747
|
const { buttons, disabled } = this.config.actionButtons;
|
|
7747
7748
|
const activeButtons = buttons.filter((btn) => !disabled.includes(btn));
|
|
7748
7749
|
const actionButtonsConfigs = activeButtons.map((btn) => {
|
|
7749
|
-
var
|
|
7750
|
-
return ((
|
|
7750
|
+
var _a2;
|
|
7751
|
+
return ((_a2 = buttonConfig[btn]) == null ? void 0 : _a2.call(buttonConfig)) || btn;
|
|
7751
7752
|
});
|
|
7752
7753
|
this.actionButtons = actionButtonsConfigs;
|
|
7753
7754
|
return this.actionButtons;
|
|
@@ -7788,7 +7789,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7788
7789
|
* @return {Object} child DOM element
|
|
7789
7790
|
*/
|
|
7790
7791
|
addChild(childData = {}, index2 = this.domChildren.length) {
|
|
7791
|
-
var
|
|
7792
|
+
var _a2, _b;
|
|
7792
7793
|
let data = childData;
|
|
7793
7794
|
if (typeof childData !== "object") {
|
|
7794
7795
|
data = { id: data };
|
|
@@ -7819,7 +7820,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7819
7820
|
addedVia: "addChild"
|
|
7820
7821
|
// indicate how the component was added
|
|
7821
7822
|
});
|
|
7822
|
-
(_b = (
|
|
7823
|
+
(_b = (_a2 = this.config.events) == null ? void 0 : _a2.onAddChild) == null ? void 0 : _b.call(_a2, { parent: this, child });
|
|
7823
7824
|
const grandChildren = child.get("children");
|
|
7824
7825
|
if (grandChildren == null ? void 0 : grandChildren.length) {
|
|
7825
7826
|
child.loadChildren(grandChildren);
|
|
@@ -7835,7 +7836,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7835
7836
|
* @return {Object} Component
|
|
7836
7837
|
*/
|
|
7837
7838
|
onAdd({ from, to, item, newIndex: newIndex2 }) {
|
|
7838
|
-
var
|
|
7839
|
+
var _a2;
|
|
7839
7840
|
if (!from.classList.contains(CONTROL_GROUP_CLASSNAME)) {
|
|
7840
7841
|
from = from.parentElement;
|
|
7841
7842
|
}
|
|
@@ -7926,7 +7927,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7926
7927
|
return action == null ? void 0 : action(item.id);
|
|
7927
7928
|
}
|
|
7928
7929
|
};
|
|
7929
|
-
const component = (
|
|
7930
|
+
const component = (_a2 = onAddConditions[fromType]) == null ? void 0 : _a2.call(onAddConditions, item, newIndex2);
|
|
7930
7931
|
this.dispatchComponentEvent("onAdd", {
|
|
7931
7932
|
from,
|
|
7932
7933
|
to,
|
|
@@ -8885,8 +8886,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8885
8886
|
this.id = controlData.id || uuid();
|
|
8886
8887
|
}
|
|
8887
8888
|
get controlId() {
|
|
8888
|
-
var
|
|
8889
|
-
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);
|
|
8890
8891
|
}
|
|
8891
8892
|
get dom() {
|
|
8892
8893
|
const { meta, config: config2 } = this.controlData;
|
|
@@ -8908,8 +8909,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8908
8909
|
return group && Controls$2.panels.nav.refresh(indexOfNode(group));
|
|
8909
8910
|
},
|
|
8910
8911
|
click: ({ target }) => {
|
|
8911
|
-
var
|
|
8912
|
-
const controlId = (
|
|
8912
|
+
var _a2;
|
|
8913
|
+
const controlId = (_a2 = target.closest(".field-control")) == null ? void 0 : _a2.id;
|
|
8913
8914
|
if (controlId) {
|
|
8914
8915
|
Controls$2.addElement(controlId);
|
|
8915
8916
|
}
|
|
@@ -8937,9 +8938,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8937
8938
|
* @return {String} the translated label
|
|
8938
8939
|
*/
|
|
8939
8940
|
i18n(lookup, args) {
|
|
8940
|
-
var
|
|
8941
|
+
var _a2, _b;
|
|
8941
8942
|
const locale = mi18n.locale;
|
|
8942
|
-
const controlTranslations = (
|
|
8943
|
+
const controlTranslations = (_a2 = this.definition) == null ? void 0 : _a2.i18n;
|
|
8943
8944
|
const localeTranslations = (controlTranslations == null ? void 0 : controlTranslations[locale]) || {};
|
|
8944
8945
|
return (((_b = localeTranslations[lookup]) == null ? void 0 : _b.call(localeTranslations)) ?? localeTranslations[lookup]) || mi18n.get(lookup, args);
|
|
8945
8946
|
}
|
|
@@ -9316,8 +9317,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9316
9317
|
this.controlId = this.get("config.controlId") || this.get("meta.id");
|
|
9317
9318
|
const actionButtons = this.getActionButtons();
|
|
9318
9319
|
const hasEditButton = this.actionButtons.some((child) => {
|
|
9319
|
-
var
|
|
9320
|
-
return ((
|
|
9320
|
+
var _a2;
|
|
9321
|
+
return ((_a2 = child.meta) == null ? void 0 : _a2.id) === "edit";
|
|
9321
9322
|
});
|
|
9322
9323
|
this.updateEditPanels();
|
|
9323
9324
|
const field2 = dom.create({
|
|
@@ -9400,13 +9401,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9400
9401
|
get defaultPreviewActions() {
|
|
9401
9402
|
return {
|
|
9402
9403
|
change: (evt) => {
|
|
9403
|
-
var
|
|
9404
|
+
var _a2;
|
|
9404
9405
|
const { target } = evt;
|
|
9405
9406
|
const { type: type2 } = target;
|
|
9406
9407
|
if (isSelectableType.has(type2)) {
|
|
9407
9408
|
const selectedOptions = this.preview.querySelectorAll(":checked");
|
|
9408
9409
|
const optionsData = this.get("options");
|
|
9409
|
-
const checkedType = ((
|
|
9410
|
+
const checkedType = ((_a2 = optionsData == null ? void 0 : optionsData[0]) == null ? void 0 : _a2.selected) !== void 0 ? "selected" : "checked";
|
|
9410
9411
|
const optionsDataMap = optionsData.reduce((acc, option) => {
|
|
9411
9412
|
acc[option.value] = option;
|
|
9412
9413
|
acc[option.value][checkedType] = false;
|
|
@@ -9425,12 +9426,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9425
9426
|
}
|
|
9426
9427
|
},
|
|
9427
9428
|
input: ({ target }) => {
|
|
9428
|
-
var
|
|
9429
|
+
var _a2;
|
|
9429
9430
|
if (["input", "meter", "progress", "button"].includes(target.tagName.toLowerCase())) {
|
|
9430
9431
|
super.set("attrs.value", target.value);
|
|
9431
9432
|
return this.debouncedUpdateEditPanels();
|
|
9432
9433
|
}
|
|
9433
|
-
if (target.contentEditable && !((
|
|
9434
|
+
if (target.contentEditable && !((_a2 = target.type) == null ? void 0 : _a2.startsWith("select-"))) {
|
|
9434
9435
|
const parentClassList = target.parentElement.classList;
|
|
9435
9436
|
const isOption = parentClassList.contains("f-checkbox") || parentClassList.contains("f-radio");
|
|
9436
9437
|
if (isOption) {
|
|
@@ -9449,14 +9450,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9449
9450
|
* @return {Object} fieldPreview
|
|
9450
9451
|
*/
|
|
9451
9452
|
fieldPreview() {
|
|
9452
|
-
var
|
|
9453
|
+
var _a2;
|
|
9453
9454
|
const { action = {}, ...prevData } = clone$1(this.data);
|
|
9454
9455
|
prevData.id = `prev-${this.id}`;
|
|
9455
9456
|
prevData.action = Object.entries(action).reduce((acc, [key, value]) => {
|
|
9456
9457
|
acc[key] = value.bind(this);
|
|
9457
9458
|
return acc;
|
|
9458
9459
|
}, {});
|
|
9459
|
-
if ((
|
|
9460
|
+
if ((_a2 = this.data) == null ? void 0 : _a2.config.editableContent) {
|
|
9460
9461
|
prevData.attrs = { ...prevData.attrs, contenteditable: true };
|
|
9461
9462
|
}
|
|
9462
9463
|
const fieldPreview = {
|
|
@@ -9676,28 +9677,28 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9676
9677
|
},
|
|
9677
9678
|
onChange: (...args) => defaults$1.onUpdate(...args),
|
|
9678
9679
|
onUpdate: (evt) => {
|
|
9679
|
-
var
|
|
9680
|
-
return ((
|
|
9680
|
+
var _a2;
|
|
9681
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9681
9682
|
},
|
|
9682
9683
|
onUpdateStage: (evt) => {
|
|
9683
|
-
var
|
|
9684
|
-
return ((
|
|
9684
|
+
var _a2;
|
|
9685
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9685
9686
|
},
|
|
9686
9687
|
onUpdateRow: (evt) => {
|
|
9687
|
-
var
|
|
9688
|
-
return ((
|
|
9688
|
+
var _a2;
|
|
9689
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9689
9690
|
},
|
|
9690
9691
|
onUpdateColumn: (evt) => {
|
|
9691
|
-
var
|
|
9692
|
-
return ((
|
|
9692
|
+
var _a2;
|
|
9693
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9693
9694
|
},
|
|
9694
9695
|
onUpdateField: (evt) => {
|
|
9695
|
-
var
|
|
9696
|
-
return ((
|
|
9696
|
+
var _a2;
|
|
9697
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9697
9698
|
},
|
|
9698
9699
|
onRender: (evt) => {
|
|
9699
|
-
var
|
|
9700
|
-
return ((
|
|
9700
|
+
var _a2;
|
|
9701
|
+
return ((_a2 = events.opts) == null ? void 0 : _a2.debug) && console.log(evt);
|
|
9701
9702
|
},
|
|
9702
9703
|
onSave: (_evt) => {
|
|
9703
9704
|
},
|
|
@@ -9708,10 +9709,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9708
9709
|
}
|
|
9709
9710
|
};
|
|
9710
9711
|
const defaultCustomEvent = ({ src, ...evtData }, type2 = EVENT_FORMEO_UPDATED) => {
|
|
9711
|
-
var
|
|
9712
|
+
var _a2, _b;
|
|
9712
9713
|
const evt = new window.CustomEvent(type2, {
|
|
9713
9714
|
detail: evtData,
|
|
9714
|
-
bubbles: ((
|
|
9715
|
+
bubbles: ((_a2 = events.opts) == null ? void 0 : _a2.debug) || ((_b = events.opts) == null ? void 0 : _b.bubbles)
|
|
9715
9716
|
});
|
|
9716
9717
|
evt.data = (src || document).dispatchEvent(evt);
|
|
9717
9718
|
return evt;
|
|
@@ -9972,7 +9973,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9972
9973
|
* @return {Promise} asynchronously loaded remote resources
|
|
9973
9974
|
*/
|
|
9974
9975
|
async loadResources() {
|
|
9975
|
-
var
|
|
9976
|
+
var _a2;
|
|
9976
9977
|
document.removeEventListener("DOMContentLoaded", this.loadResources);
|
|
9977
9978
|
const promises = [];
|
|
9978
9979
|
if (this.opts.polyfills) {
|
|
@@ -9980,7 +9981,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9980
9981
|
}
|
|
9981
9982
|
await fetchIcons(this.opts.svgSprite);
|
|
9982
9983
|
promises.push(fetchFormeoStyle(this.opts.style));
|
|
9983
|
-
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) }));
|
|
9984
9985
|
const resolvedPromises = await Promise.all(promises);
|
|
9985
9986
|
if (this.opts.allowEdit) {
|
|
9986
9987
|
this.init();
|
|
@@ -9994,21 +9995,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9994
9995
|
*/
|
|
9995
9996
|
init() {
|
|
9996
9997
|
return Controls$2.init(this.opts.controls, this.opts.stickyControls).then((controls) => {
|
|
9997
|
-
var
|
|
9998
|
+
var _a2, _b;
|
|
9998
9999
|
this.controls = controls;
|
|
9999
10000
|
this.load(this.userFormData, this.opts);
|
|
10000
10001
|
this.formId = components.get("id");
|
|
10001
10002
|
this.i18n = {
|
|
10002
10003
|
setLang: (formeoLocale) => {
|
|
10003
|
-
var
|
|
10004
|
-
(
|
|
10004
|
+
var _a3;
|
|
10005
|
+
(_a3 = window.sessionStorage) == null ? void 0 : _a3.setItem(SESSION_LOCALE_KEY, formeoLocale);
|
|
10005
10006
|
const loadLang = mi18n.setCurrent(formeoLocale);
|
|
10006
10007
|
loadLang.then(() => {
|
|
10007
10008
|
this.init();
|
|
10008
10009
|
}, console.error);
|
|
10009
10010
|
}
|
|
10010
10011
|
};
|
|
10011
|
-
(_b = (
|
|
10012
|
+
(_b = (_a2 = this.opts).onLoad) == null ? void 0 : _b.call(_a2, this);
|
|
10012
10013
|
});
|
|
10013
10014
|
}
|
|
10014
10015
|
load(formData = this.userFormData, opts = this.opts) {
|
|
@@ -10133,8 +10134,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10133
10134
|
elem.checked = false;
|
|
10134
10135
|
},
|
|
10135
10136
|
value: (elem, { assignment, ...rest }) => {
|
|
10136
|
-
var
|
|
10137
|
-
const assignmentAction = (
|
|
10137
|
+
var _a2;
|
|
10138
|
+
const assignmentAction = (_a2 = assignmentMap[assignment]) == null ? void 0 : _a2.call(assignmentMap, elem, rest);
|
|
10138
10139
|
const event = new Event("input", { bubbles: true });
|
|
10139
10140
|
elem.dispatchEvent(event);
|
|
10140
10141
|
return assignmentAction;
|
|
@@ -10242,8 +10243,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10242
10243
|
);
|
|
10243
10244
|
});
|
|
10244
10245
|
__publicField(this, "processFields", (fieldIds) => this.orderChildren("fields", fieldIds).map(({ id, ...field2 }) => {
|
|
10245
|
-
var
|
|
10246
|
-
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);
|
|
10247
10248
|
const { action = {}, dependencies: dependencies2 = {} } = this.elements[controlId] || {};
|
|
10248
10249
|
if (dependencies2) {
|
|
10249
10250
|
fetchDependencies(dependencies2);
|
|
@@ -10309,27 +10310,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10309
10310
|
* Evaulate conditions
|
|
10310
10311
|
*/
|
|
10311
10312
|
__publicField(this, "evaluateCondition", ({ source, sourceProperty, targetProperty, comparison, target }) => {
|
|
10312
|
-
var
|
|
10313
|
+
var _a2;
|
|
10313
10314
|
const sourceValue = this.getComponentProperty(source, sourceProperty);
|
|
10314
10315
|
if (typeof sourceValue === "boolean") {
|
|
10315
10316
|
return sourceValue;
|
|
10316
10317
|
}
|
|
10317
10318
|
const targetValue = String(isAddress(target) ? this.getComponentProperty(target, targetProperty) : target);
|
|
10318
|
-
return (
|
|
10319
|
+
return (_a2 = comparisonMap[comparison]) == null ? void 0 : _a2.call(comparisonMap, sourceValue, targetValue);
|
|
10319
10320
|
});
|
|
10320
10321
|
__publicField(this, "execResult", ({ target, targetProperty, assignment, value }) => {
|
|
10321
|
-
var
|
|
10322
|
+
var _a2;
|
|
10322
10323
|
if (isAddress(target)) {
|
|
10323
10324
|
const { component, option } = this.getComponent(target);
|
|
10324
10325
|
const elem = option || component;
|
|
10325
|
-
(
|
|
10326
|
+
(_a2 = targetPropertyMap[targetProperty]) == null ? void 0 : _a2.call(targetPropertyMap, elem, { targetProperty, assignment, value });
|
|
10326
10327
|
}
|
|
10327
10328
|
});
|
|
10328
10329
|
__publicField(this, "getComponentProperty", (address, propertyName) => {
|
|
10329
|
-
var
|
|
10330
|
+
var _a2;
|
|
10330
10331
|
const { component, option } = this.getComponent(address);
|
|
10331
10332
|
const elem = option || component;
|
|
10332
|
-
return ((
|
|
10333
|
+
return ((_a2 = propertyMap[propertyName]) == null ? void 0 : _a2.call(propertyMap, elem)) || elem[propertyName];
|
|
10333
10334
|
});
|
|
10334
10335
|
__publicField(this, "getComponent", (address) => {
|
|
10335
10336
|
const result = {
|
|
@@ -10703,7 +10704,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10703
10704
|
}
|
|
10704
10705
|
class SelectControl extends Control {
|
|
10705
10706
|
constructor(controlConfig = {}) {
|
|
10706
|
-
var
|
|
10707
|
+
var _a2;
|
|
10707
10708
|
const selectConfig = {
|
|
10708
10709
|
tag: "select",
|
|
10709
10710
|
config: {
|
|
@@ -10719,7 +10720,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
10719
10720
|
icon: "select",
|
|
10720
10721
|
id: "select"
|
|
10721
10722
|
},
|
|
10722
|
-
options: generateOptionConfig({ type: "option", isMultiple: (
|
|
10723
|
+
options: generateOptionConfig({ type: "option", isMultiple: (_a2 = controlConfig.attrs) == null ? void 0 : _a2.multiple })
|
|
10723
10724
|
};
|
|
10724
10725
|
const mergedConfig = merge(selectConfig, controlConfig);
|
|
10725
10726
|
super(mergedConfig);
|