formeo 4.1.4 → 4.2.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 +2 -2
- package/dist/demo/assets/css/demo.min.css.gz +0 -0
- package/dist/demo/assets/css/formeo.min.css +2 -2
- package/dist/demo/assets/img/formeo-sprite.svg +1 -1
- package/dist/demo/assets/js/demo.min.js +61 -61
- package/dist/demo/assets/js/demo.min.js.gz +0 -0
- package/dist/demo/assets/js/formeo.cjs.js +393 -318
- package/dist/demo/assets/js/formeo.es.js +393 -318
- package/dist/demo/assets/js/formeo.min.cjs.js +2 -2
- package/dist/demo/assets/js/formeo.min.es.js +3 -3
- package/dist/demo/assets/js/formeo.min.js +393 -318
- package/dist/demo/assets/js/formeo.min.umd.js +2 -2
- package/dist/demo/assets/js/formeo.umd.js +393 -318
- 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-sprite.svg +1 -1
- package/dist/formeo.cjs.js +393 -318
- package/dist/formeo.css +1 -36
- package/dist/formeo.es.js +393 -318
- package/dist/formeo.min.cjs.js +2 -2
- package/dist/formeo.min.css +2 -2
- package/dist/formeo.min.es.js +3 -3
- package/dist/formeo.min.js +393 -318
- package/dist/formeo.min.umd.js +2 -2
- package/dist/formeo.umd.js +393 -318
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
formeo - https://formeo.io
|
|
4
|
-
Version: 4.
|
|
4
|
+
Version: 4.2.0
|
|
5
5
|
Author: Draggable https://draggable.io
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -51,8 +51,8 @@ class I18N {
|
|
|
51
51
|
this.config = { location: parsedLocation, ...restOptions };
|
|
52
52
|
const { override, preloaded = {} } = this.config;
|
|
53
53
|
const allLangs = Object.entries(this.langs).concat(Object.entries(override || preloaded));
|
|
54
|
-
this.langs = allLangs.reduce((acc, [
|
|
55
|
-
acc[
|
|
54
|
+
this.langs = allLangs.reduce((acc, [locale2, lang]) => {
|
|
55
|
+
acc[locale2] = this.applyLanguage(locale2, lang);
|
|
56
56
|
return acc;
|
|
57
57
|
}, {});
|
|
58
58
|
this.locale = this.config.locale || this.config.langs[0];
|
|
@@ -71,9 +71,9 @@ class I18N {
|
|
|
71
71
|
* @param {String} locale
|
|
72
72
|
* @param {String|Object} lang
|
|
73
73
|
*/
|
|
74
|
-
addLanguage(
|
|
74
|
+
addLanguage(locale2, lang = {}) {
|
|
75
75
|
lang = typeof lang === "string" ? I18N.processFile(lang) : lang;
|
|
76
|
-
this.applyLanguage(
|
|
76
|
+
this.applyLanguage(locale2, lang);
|
|
77
77
|
this.config.langs.push("locale");
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
@@ -82,9 +82,9 @@ class I18N {
|
|
|
82
82
|
* @param {String} locale - locale to check for value
|
|
83
83
|
* @return {String} language string or undefined
|
|
84
84
|
*/
|
|
85
|
-
getValue(key,
|
|
85
|
+
getValue(key, locale2 = this.locale) {
|
|
86
86
|
var _a;
|
|
87
|
-
const value = (_a = this.langs[
|
|
87
|
+
const value = (_a = this.langs[locale2]) == null ? void 0 : _a[key];
|
|
88
88
|
return value || this.getFallbackValue(key);
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
@@ -161,9 +161,9 @@ class I18N {
|
|
|
161
161
|
static fromFile(rawText) {
|
|
162
162
|
const lines = rawText.split("\n");
|
|
163
163
|
const lang = {};
|
|
164
|
-
for (let matches2,
|
|
164
|
+
for (let matches2, i2 = 0; i2 < lines.length; i2++) {
|
|
165
165
|
const regex = /^(.+?) *?= *?([^\n]+)/;
|
|
166
|
-
matches2 = regex.exec(lines[
|
|
166
|
+
matches2 = regex.exec(lines[i2]);
|
|
167
167
|
if (matches2) {
|
|
168
168
|
lang[matches2[1]] = matches2[2].replace(/(^\s+|\s+$)/g, "");
|
|
169
169
|
}
|
|
@@ -176,22 +176,22 @@ class I18N {
|
|
|
176
176
|
* @param {Boolean} useCache
|
|
177
177
|
* @return {Promise} resolves response
|
|
178
178
|
*/
|
|
179
|
-
loadLang(
|
|
179
|
+
loadLang(locale2, useCache = true) {
|
|
180
180
|
const _this = this;
|
|
181
181
|
return new Promise(function(resolve, reject) {
|
|
182
|
-
if (_this.loaded.indexOf(
|
|
183
|
-
_this.applyLanguage(_this.langs[
|
|
184
|
-
return resolve(_this.langs[
|
|
182
|
+
if (_this.loaded.indexOf(locale2) !== -1 && useCache) {
|
|
183
|
+
_this.applyLanguage(_this.langs[locale2]);
|
|
184
|
+
return resolve(_this.langs[locale2]);
|
|
185
185
|
} else {
|
|
186
|
-
const langFile = [_this.config.location,
|
|
186
|
+
const langFile = [_this.config.location, locale2, _this.config.extension].join("");
|
|
187
187
|
return fetchData(langFile).then((lang) => {
|
|
188
188
|
const processedFile = I18N.processFile(lang);
|
|
189
|
-
_this.applyLanguage(
|
|
190
|
-
_this.loaded.push(
|
|
191
|
-
return resolve(_this.langs[
|
|
189
|
+
_this.applyLanguage(locale2, processedFile);
|
|
190
|
+
_this.loaded.push(locale2);
|
|
191
|
+
return resolve(_this.langs[locale2]);
|
|
192
192
|
}).catch((err) => {
|
|
193
193
|
console.error(err);
|
|
194
|
-
const lang = _this.applyLanguage(
|
|
194
|
+
const lang = _this.applyLanguage(locale2);
|
|
195
195
|
resolve(lang);
|
|
196
196
|
});
|
|
197
197
|
}
|
|
@@ -203,11 +203,11 @@ class I18N {
|
|
|
203
203
|
* @param {Object} lang
|
|
204
204
|
* @return {Object} overriden language
|
|
205
205
|
*/
|
|
206
|
-
applyLanguage(
|
|
207
|
-
const override = this.config.override[
|
|
208
|
-
const existingLang = this.langs[
|
|
209
|
-
this.langs[
|
|
210
|
-
return this.langs[
|
|
206
|
+
applyLanguage(locale2, lang = {}) {
|
|
207
|
+
const override = this.config.override[locale2] || {};
|
|
208
|
+
const existingLang = this.langs[locale2] || {};
|
|
209
|
+
this.langs[locale2] = { ...existingLang, ...lang, ...override };
|
|
210
|
+
return this.langs[locale2];
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* return currently available languages
|
|
@@ -221,10 +221,10 @@ class I18N {
|
|
|
221
221
|
* @param {String} locale
|
|
222
222
|
* @return {Promise} language
|
|
223
223
|
*/
|
|
224
|
-
async setCurrent(
|
|
225
|
-
await this.loadLang(
|
|
226
|
-
this.locale =
|
|
227
|
-
this.current = this.langs[
|
|
224
|
+
async setCurrent(locale2 = "en-US") {
|
|
225
|
+
await this.loadLang(locale2);
|
|
226
|
+
this.locale = locale2;
|
|
227
|
+
this.current = this.langs[locale2];
|
|
228
228
|
return this.current;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -257,9 +257,9 @@ class SmartTooltip {
|
|
|
257
257
|
__publicField(this, "tooltip");
|
|
258
258
|
__publicField(this, "activeTriggerType", null);
|
|
259
259
|
__publicField(this, "spacing", 12);
|
|
260
|
-
__publicField(this, "handleClick", (
|
|
260
|
+
__publicField(this, "handleClick", (e2) => {
|
|
261
261
|
const triggerName = this.triggerName;
|
|
262
|
-
const trigger =
|
|
262
|
+
const trigger = e2.target.closest(`[${triggerName}][${triggerName}-type="click"]`);
|
|
263
263
|
if (trigger) {
|
|
264
264
|
if (this.isVisible()) {
|
|
265
265
|
this.hide();
|
|
@@ -272,9 +272,9 @@ class SmartTooltip {
|
|
|
272
272
|
this.hide();
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
|
-
__publicField(this, "handleMouseOver", (
|
|
275
|
+
__publicField(this, "handleMouseOver", (e2) => {
|
|
276
276
|
const triggerName = this.triggerName;
|
|
277
|
-
const trigger =
|
|
277
|
+
const trigger = e2.target.closest(`[${triggerName}]`);
|
|
278
278
|
if (this.activeTriggerType !== "click" && (trigger == null ? void 0 : trigger.getAttribute(`${triggerName}-type`)) !== "click") {
|
|
279
279
|
const content = trigger == null ? void 0 : trigger.getAttribute(`${triggerName}`);
|
|
280
280
|
if (content) {
|
|
@@ -283,9 +283,9 @@ class SmartTooltip {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
});
|
|
286
|
-
__publicField(this, "handleMouseOut", (
|
|
286
|
+
__publicField(this, "handleMouseOut", (e2) => {
|
|
287
287
|
const triggerName = this.triggerName;
|
|
288
|
-
const trigger =
|
|
288
|
+
const trigger = e2.target.closest(`[${triggerName}]`);
|
|
289
289
|
if (this.activeTriggerType !== "click" && (trigger == null ? void 0 : trigger.getAttribute(`${triggerName}-type`)) !== "click") {
|
|
290
290
|
this.hide();
|
|
291
291
|
}
|
|
@@ -433,7 +433,7 @@ if (window !== void 0) {
|
|
|
433
433
|
window.SmartTooltip = SmartTooltip;
|
|
434
434
|
}
|
|
435
435
|
const name$1 = "formeo";
|
|
436
|
-
const version$2 = "4.
|
|
436
|
+
const version$2 = "4.2.0";
|
|
437
437
|
const pkg = {
|
|
438
438
|
name: name$1,
|
|
439
439
|
version: version$2
|
|
@@ -667,7 +667,7 @@ function require_getRawTag() {
|
|
|
667
667
|
try {
|
|
668
668
|
value[symToStringTag] = void 0;
|
|
669
669
|
var unmasked = true;
|
|
670
|
-
} catch (
|
|
670
|
+
} catch (e2) {
|
|
671
671
|
}
|
|
672
672
|
var result = nativeObjectToString.call(value);
|
|
673
673
|
if (unmasked) {
|
|
@@ -778,11 +778,11 @@ function require_toSource() {
|
|
|
778
778
|
if (func != null) {
|
|
779
779
|
try {
|
|
780
780
|
return funcToString.call(func);
|
|
781
|
-
} catch (
|
|
781
|
+
} catch (e2) {
|
|
782
782
|
}
|
|
783
783
|
try {
|
|
784
784
|
return func + "";
|
|
785
|
-
} catch (
|
|
785
|
+
} catch (e2) {
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
788
|
return "";
|
|
@@ -1128,7 +1128,7 @@ function require_defineProperty() {
|
|
|
1128
1128
|
var func = getNative(Object, "defineProperty");
|
|
1129
1129
|
func({}, "", {});
|
|
1130
1130
|
return func;
|
|
1131
|
-
} catch (
|
|
1131
|
+
} catch (e2) {
|
|
1132
1132
|
}
|
|
1133
1133
|
})();
|
|
1134
1134
|
_defineProperty$1 = defineProperty;
|
|
@@ -1539,7 +1539,7 @@ function require_nodeUtil() {
|
|
|
1539
1539
|
return types;
|
|
1540
1540
|
}
|
|
1541
1541
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1542
|
-
} catch (
|
|
1542
|
+
} catch (e2) {
|
|
1543
1543
|
}
|
|
1544
1544
|
})();
|
|
1545
1545
|
module2.exports = nodeUtil;
|
|
@@ -2072,8 +2072,8 @@ const clone$1 = (obj) => {
|
|
|
2072
2072
|
}
|
|
2073
2073
|
if (Array.isArray(obj)) {
|
|
2074
2074
|
copy = [];
|
|
2075
|
-
for (let
|
|
2076
|
-
copy[
|
|
2075
|
+
for (let i2 = 0, len = obj.length; i2 < len; i2++) {
|
|
2076
|
+
copy[i2] = clone$1(obj[i2]);
|
|
2077
2077
|
}
|
|
2078
2078
|
return copy;
|
|
2079
2079
|
}
|
|
@@ -2145,8 +2145,8 @@ function parseData(data = /* @__PURE__ */ Object.create(null)) {
|
|
|
2145
2145
|
if (typeof data === "string") {
|
|
2146
2146
|
try {
|
|
2147
2147
|
return JSON.parse(data);
|
|
2148
|
-
} catch (
|
|
2149
|
-
console.error("Invalid JSON string provided:",
|
|
2148
|
+
} catch (e2) {
|
|
2149
|
+
console.error("Invalid JSON string provided:", e2);
|
|
2150
2150
|
return /* @__PURE__ */ Object.create(null);
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
@@ -2168,20 +2168,17 @@ function buildFlatDataStructure(data, componentId, componentType2, result = {})
|
|
|
2168
2168
|
}
|
|
2169
2169
|
return result;
|
|
2170
2170
|
}
|
|
2171
|
+
let BUNDLED_SVG_SPRITE = null;
|
|
2172
|
+
try {
|
|
2173
|
+
BUNDLED_SVG_SPRITE = require("../../lib/icons/formeo-sprite.svg?raw");
|
|
2174
|
+
} catch (e2) {
|
|
2175
|
+
}
|
|
2171
2176
|
const name = pkg.name;
|
|
2172
2177
|
const version$1 = pkg.version;
|
|
2173
2178
|
const PACKAGE_NAME = name;
|
|
2174
2179
|
const formeoSpriteId = "formeo-sprite";
|
|
2175
|
-
const
|
|
2176
|
-
|
|
2177
|
-
{ name: "mutationObserver", src: "//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js" },
|
|
2178
|
-
{ name: "fetch", src: "https://unpkg.com/unfetch/polyfill" }
|
|
2179
|
-
];
|
|
2180
|
-
const relativeSpritePath = `../../lib/icons/${formeoSpriteId}.svg`;
|
|
2181
|
-
const localSpriteUrl = false ? (void 0)(relativeSpritePath) : relativeSpritePath;
|
|
2182
|
-
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development" || false;
|
|
2183
|
-
const SVG_SPRITE_URL = isDev ? localSpriteUrl : `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
2184
|
-
const FALLBACK_SVG_SPRITE_URL = `https://draggable.github.io/formeo/assets/img/${formeoSpriteId}.svg`;
|
|
2180
|
+
const SVG_SPRITE_URL = null;
|
|
2181
|
+
const FALLBACK_SVG_SPRITE_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
2185
2182
|
const CSS_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/formeo.min.css`;
|
|
2186
2183
|
const FALLBACK_CSS_URL = "https://draggable.github.io/formeo/assets/css/formeo.min.css";
|
|
2187
2184
|
const PANEL_CLASSNAME = "f-panel";
|
|
@@ -2281,6 +2278,7 @@ const ANIMATION_SPEED_FAST = Math.round(ANIMATION_SPEED_BASE / 2);
|
|
|
2281
2278
|
const ANIMATION_SPEED_SLOW = Math.round(ANIMATION_SPEED_BASE * 2);
|
|
2282
2279
|
const EVENT_FORMEO_SAVED = "formeoSaved";
|
|
2283
2280
|
const EVENT_FORMEO_UPDATED = "formeoUpdated";
|
|
2281
|
+
const EVENT_FORMEO_CHANGED = "formeoChanged";
|
|
2284
2282
|
const EVENT_FORMEO_UPDATED_STAGE = "formeoUpdatedStage";
|
|
2285
2283
|
const EVENT_FORMEO_UPDATED_ROW = "formeoUpdatedRow";
|
|
2286
2284
|
const EVENT_FORMEO_UPDATED_COLUMN = "formeoUpdatedColumn";
|
|
@@ -2288,6 +2286,12 @@ const EVENT_FORMEO_UPDATED_FIELD = "formeoUpdatedField";
|
|
|
2288
2286
|
const EVENT_FORMEO_CLEARED = "formeoCleared";
|
|
2289
2287
|
const EVENT_FORMEO_ON_RENDER = "formeoOnRender";
|
|
2290
2288
|
const EVENT_FORMEO_CONDITION_UPDATED = "formeoConditionUpdated";
|
|
2289
|
+
const EVENT_FORMEO_ADDED_ROW = "formeoAddedRow";
|
|
2290
|
+
const EVENT_FORMEO_ADDED_COLUMN = "formeoAddedColumn";
|
|
2291
|
+
const EVENT_FORMEO_ADDED_FIELD = "formeoAddedField";
|
|
2292
|
+
const EVENT_FORMEO_REMOVED_ROW = "formeoRemovedRow";
|
|
2293
|
+
const EVENT_FORMEO_REMOVED_COLUMN = "formeoRemovedColumn";
|
|
2294
|
+
const EVENT_FORMEO_REMOVED_FIELD = "formeoRemovedField";
|
|
2291
2295
|
const COMPARISON_OPERATORS = {
|
|
2292
2296
|
equals: "==",
|
|
2293
2297
|
notEquals: "!=",
|
|
@@ -3294,6 +3298,18 @@ class Data {
|
|
|
3294
3298
|
evtData.previousValue = oldVal;
|
|
3295
3299
|
}
|
|
3296
3300
|
events.formeoUpdated(evtData);
|
|
3301
|
+
if (this.name) {
|
|
3302
|
+
const componentEventMap = {
|
|
3303
|
+
stage: EVENT_FORMEO_UPDATED_STAGE,
|
|
3304
|
+
row: EVENT_FORMEO_UPDATED_ROW,
|
|
3305
|
+
column: EVENT_FORMEO_UPDATED_COLUMN,
|
|
3306
|
+
field: EVENT_FORMEO_UPDATED_FIELD
|
|
3307
|
+
};
|
|
3308
|
+
const specificEvent = componentEventMap[this.name];
|
|
3309
|
+
if (specificEvent) {
|
|
3310
|
+
events.formeoUpdated(evtData, specificEvent);
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3297
3313
|
}
|
|
3298
3314
|
return data;
|
|
3299
3315
|
}
|
|
@@ -3363,6 +3379,23 @@ class ComponentData extends Data {
|
|
|
3363
3379
|
const component = this.Component({ ...data, id: elemId });
|
|
3364
3380
|
this.data[elemId] = component;
|
|
3365
3381
|
this.active = component;
|
|
3382
|
+
const componentEventMap = {
|
|
3383
|
+
row: EVENT_FORMEO_ADDED_ROW,
|
|
3384
|
+
column: EVENT_FORMEO_ADDED_COLUMN,
|
|
3385
|
+
field: EVENT_FORMEO_ADDED_FIELD
|
|
3386
|
+
};
|
|
3387
|
+
const addEvent = componentEventMap[this.name];
|
|
3388
|
+
if (addEvent) {
|
|
3389
|
+
events.formeoUpdated(
|
|
3390
|
+
{
|
|
3391
|
+
entity: component,
|
|
3392
|
+
componentId: elemId,
|
|
3393
|
+
componentType: this.name,
|
|
3394
|
+
data: component.data
|
|
3395
|
+
},
|
|
3396
|
+
addEvent
|
|
3397
|
+
);
|
|
3398
|
+
}
|
|
3366
3399
|
return component;
|
|
3367
3400
|
};
|
|
3368
3401
|
/**
|
|
@@ -3428,9 +3461,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
3428
3461
|
return keys;
|
|
3429
3462
|
}
|
|
3430
3463
|
function _objectSpread2(target) {
|
|
3431
|
-
for (var
|
|
3432
|
-
var source = arguments[
|
|
3433
|
-
if (
|
|
3464
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3465
|
+
var source = arguments[i2] != null ? arguments[i2] : {};
|
|
3466
|
+
if (i2 % 2) {
|
|
3434
3467
|
ownKeys(Object(source), true).forEach(function(key) {
|
|
3435
3468
|
_defineProperty(target, key, source[key]);
|
|
3436
3469
|
});
|
|
@@ -3472,8 +3505,8 @@ function _defineProperty(obj, key, value) {
|
|
|
3472
3505
|
}
|
|
3473
3506
|
function _extends() {
|
|
3474
3507
|
_extends = Object.assign || function(target) {
|
|
3475
|
-
for (var
|
|
3476
|
-
var source = arguments[
|
|
3508
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3509
|
+
var source = arguments[i2];
|
|
3477
3510
|
for (var key in source) {
|
|
3478
3511
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3479
3512
|
target[key] = source[key];
|
|
@@ -3488,9 +3521,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
3488
3521
|
if (source == null) return {};
|
|
3489
3522
|
var target = {};
|
|
3490
3523
|
var sourceKeys = Object.keys(source);
|
|
3491
|
-
var key,
|
|
3492
|
-
for (
|
|
3493
|
-
key = sourceKeys[
|
|
3524
|
+
var key, i2;
|
|
3525
|
+
for (i2 = 0; i2 < sourceKeys.length; i2++) {
|
|
3526
|
+
key = sourceKeys[i2];
|
|
3494
3527
|
if (excluded.indexOf(key) >= 0) continue;
|
|
3495
3528
|
target[key] = source[key];
|
|
3496
3529
|
}
|
|
@@ -3499,11 +3532,11 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
3499
3532
|
function _objectWithoutProperties(source, excluded) {
|
|
3500
3533
|
if (source == null) return {};
|
|
3501
3534
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
3502
|
-
var key,
|
|
3535
|
+
var key, i2;
|
|
3503
3536
|
if (Object.getOwnPropertySymbols) {
|
|
3504
3537
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
3505
|
-
for (
|
|
3506
|
-
key = sourceSymbolKeys[
|
|
3538
|
+
for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
|
|
3539
|
+
key = sourceSymbolKeys[i2];
|
|
3507
3540
|
if (excluded.indexOf(key) >= 0) continue;
|
|
3508
3541
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
3509
3542
|
target[key] = source[key];
|
|
@@ -3612,10 +3645,10 @@ function matrix(el, selfOnly) {
|
|
|
3612
3645
|
}
|
|
3613
3646
|
function find(ctx, tagName, iterator) {
|
|
3614
3647
|
if (ctx) {
|
|
3615
|
-
var list = ctx.getElementsByTagName(tagName),
|
|
3648
|
+
var list = ctx.getElementsByTagName(tagName), i2 = 0, n = list.length;
|
|
3616
3649
|
if (iterator) {
|
|
3617
|
-
for (;
|
|
3618
|
-
iterator(list[
|
|
3650
|
+
for (; i2 < n; i2++) {
|
|
3651
|
+
iterator(list[i2], i2);
|
|
3619
3652
|
}
|
|
3620
3653
|
}
|
|
3621
3654
|
return list;
|
|
@@ -3698,15 +3731,15 @@ function isScrolledPast(el, elSide, parentSide) {
|
|
|
3698
3731
|
return false;
|
|
3699
3732
|
}
|
|
3700
3733
|
function getChild(el, childNum, options, includeDragEl) {
|
|
3701
|
-
var currentChild = 0,
|
|
3702
|
-
while (
|
|
3703
|
-
if (children[
|
|
3734
|
+
var currentChild = 0, i2 = 0, children = el.children;
|
|
3735
|
+
while (i2 < children.length) {
|
|
3736
|
+
if (children[i2].style.display !== "none" && children[i2] !== Sortable.ghost && (includeDragEl || children[i2] !== Sortable.dragged) && closest(children[i2], options.draggable, el, false)) {
|
|
3704
3737
|
if (currentChild === childNum) {
|
|
3705
|
-
return children[
|
|
3738
|
+
return children[i2];
|
|
3706
3739
|
}
|
|
3707
3740
|
currentChild++;
|
|
3708
3741
|
}
|
|
3709
|
-
|
|
3742
|
+
i2++;
|
|
3710
3743
|
}
|
|
3711
3744
|
return null;
|
|
3712
3745
|
}
|
|
@@ -3741,10 +3774,10 @@ function getRelativeScrollOffset(el) {
|
|
|
3741
3774
|
return [offsetLeft, offsetTop];
|
|
3742
3775
|
}
|
|
3743
3776
|
function indexOfObject(arr, obj) {
|
|
3744
|
-
for (var
|
|
3745
|
-
if (!arr.hasOwnProperty(
|
|
3777
|
+
for (var i2 in arr) {
|
|
3778
|
+
if (!arr.hasOwnProperty(i2)) continue;
|
|
3746
3779
|
for (var key in obj) {
|
|
3747
|
-
if (obj.hasOwnProperty(key) && obj[key] === arr[
|
|
3780
|
+
if (obj.hasOwnProperty(key) && obj[key] === arr[i2][key]) return Number(i2);
|
|
3748
3781
|
}
|
|
3749
3782
|
}
|
|
3750
3783
|
return -1;
|
|
@@ -4197,9 +4230,9 @@ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt)
|
|
|
4197
4230
|
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
|
|
4198
4231
|
if (nearest) {
|
|
4199
4232
|
var event = {};
|
|
4200
|
-
for (var
|
|
4201
|
-
if (evt.hasOwnProperty(
|
|
4202
|
-
event[
|
|
4233
|
+
for (var i2 in evt) {
|
|
4234
|
+
if (evt.hasOwnProperty(i2)) {
|
|
4235
|
+
event[i2] = evt[i2];
|
|
4203
4236
|
}
|
|
4204
4237
|
}
|
|
4205
4238
|
event.target = event.rootEl = nearest;
|
|
@@ -4448,8 +4481,8 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
4448
4481
|
}
|
|
4449
4482
|
}
|
|
4450
4483
|
},
|
|
4451
|
-
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
|
|
4452
|
-
var touch =
|
|
4484
|
+
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e2) {
|
|
4485
|
+
var touch = e2.touches ? e2.touches[0] : e2;
|
|
4453
4486
|
if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
|
|
4454
4487
|
this._disableDelayedDrag();
|
|
4455
4488
|
}
|
|
@@ -5050,9 +5083,9 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
5050
5083
|
* @returns {String[]}
|
|
5051
5084
|
*/
|
|
5052
5085
|
toArray: function toArray() {
|
|
5053
|
-
var order = [], el, children = this.el.children,
|
|
5054
|
-
for (;
|
|
5055
|
-
el = children[
|
|
5086
|
+
var order = [], el, children = this.el.children, i2 = 0, n = children.length, options = this.options;
|
|
5087
|
+
for (; i2 < n; i2++) {
|
|
5088
|
+
el = children[i2];
|
|
5056
5089
|
if (closest(el, options.draggable, this.el, false)) {
|
|
5057
5090
|
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
|
5058
5091
|
}
|
|
@@ -5065,8 +5098,8 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
5065
5098
|
*/
|
|
5066
5099
|
sort: function sort(order, useAnimation) {
|
|
5067
5100
|
var items = {}, rootEl2 = this.el;
|
|
5068
|
-
this.toArray().forEach(function(id,
|
|
5069
|
-
var el = rootEl2.children[
|
|
5101
|
+
this.toArray().forEach(function(id, i2) {
|
|
5102
|
+
var el = rootEl2.children[i2];
|
|
5070
5103
|
if (closest(el, this.options.draggable, rootEl2, false)) {
|
|
5071
5104
|
items[id] = el;
|
|
5072
5105
|
}
|
|
@@ -5259,9 +5292,9 @@ function _getInsertDirection(target) {
|
|
|
5259
5292
|
}
|
|
5260
5293
|
}
|
|
5261
5294
|
function _generateId(el) {
|
|
5262
|
-
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
|
5263
|
-
while (
|
|
5264
|
-
sum += str.charCodeAt(
|
|
5295
|
+
var str = el.tagName + el.className + el.src + el.href + el.textContent, i2 = str.length, sum = 0;
|
|
5296
|
+
while (i2--) {
|
|
5297
|
+
sum += str.charCodeAt(i2);
|
|
5265
5298
|
}
|
|
5266
5299
|
return sum.toString(36);
|
|
5267
5300
|
}
|
|
@@ -5453,9 +5486,9 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
|
|
|
5453
5486
|
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
|
|
5454
5487
|
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
|
|
5455
5488
|
if (!autoScrolls[layersOut]) {
|
|
5456
|
-
for (var
|
|
5457
|
-
if (!autoScrolls[
|
|
5458
|
-
autoScrolls[
|
|
5489
|
+
for (var i2 = 0; i2 <= layersOut; i2++) {
|
|
5490
|
+
if (!autoScrolls[i2]) {
|
|
5491
|
+
autoScrolls[i2] = {};
|
|
5459
5492
|
}
|
|
5460
5493
|
}
|
|
5461
5494
|
}
|
|
@@ -5655,13 +5688,13 @@ const orderObjectsBy = (elements, order, path) => {
|
|
|
5655
5688
|
return unique(orderedElements);
|
|
5656
5689
|
};
|
|
5657
5690
|
const forEach = (arr, cb, scope) => {
|
|
5658
|
-
for (let
|
|
5659
|
-
cb.call(scope, arr[
|
|
5691
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
5692
|
+
cb.call(scope, arr[i2], i2);
|
|
5660
5693
|
}
|
|
5661
5694
|
};
|
|
5662
5695
|
const map = (arr, cb) => {
|
|
5663
5696
|
const newArray = [];
|
|
5664
|
-
forEach(arr, (elem,
|
|
5697
|
+
forEach(arr, (elem, i2) => newArray.push(cb(elem, i2)));
|
|
5665
5698
|
return newArray;
|
|
5666
5699
|
};
|
|
5667
5700
|
const sanitizedAttributeNames = {};
|
|
@@ -5680,7 +5713,6 @@ const safeAttrName = (name2) => {
|
|
|
5680
5713
|
const capitalize = (str) => str.replace(/\b\w/g, (m) => m.toUpperCase());
|
|
5681
5714
|
const copyObj = (obj) => window.JSON.parse(window.JSON.stringify(obj));
|
|
5682
5715
|
const subtract = (arr, from) => from.filter((a) => !~arr.indexOf(a));
|
|
5683
|
-
const isIE = () => window.navigator.userAgent.indexOf("MSIE ") !== -1;
|
|
5684
5716
|
const helpers = {
|
|
5685
5717
|
capitalize,
|
|
5686
5718
|
safeAttrName,
|
|
@@ -5692,8 +5724,119 @@ const helpers = {
|
|
|
5692
5724
|
indexOfNode,
|
|
5693
5725
|
isInt,
|
|
5694
5726
|
get,
|
|
5695
|
-
orderObjectsBy
|
|
5696
|
-
|
|
5727
|
+
orderObjectsBy
|
|
5728
|
+
};
|
|
5729
|
+
const loaded = {
|
|
5730
|
+
js: /* @__PURE__ */ new Set(),
|
|
5731
|
+
css: /* @__PURE__ */ new Set(),
|
|
5732
|
+
formeoSprite: null
|
|
5733
|
+
};
|
|
5734
|
+
const ajax = (fileUrl, callback, onError = noop) => {
|
|
5735
|
+
return new Promise((resolve) => {
|
|
5736
|
+
return fetch(fileUrl).then((data) => {
|
|
5737
|
+
if (!data.ok) {
|
|
5738
|
+
return resolve(onError(data));
|
|
5739
|
+
}
|
|
5740
|
+
resolve(callback ? callback(data) : data);
|
|
5741
|
+
}).catch((err) => onError(err));
|
|
5742
|
+
});
|
|
5743
|
+
};
|
|
5744
|
+
const onLoadStylesheet = (elem, cb) => {
|
|
5745
|
+
elem.removeEventListener("load", onLoadStylesheet);
|
|
5746
|
+
cb(elem.src);
|
|
5747
|
+
};
|
|
5748
|
+
const onLoadJavascript = (elem, cb) => {
|
|
5749
|
+
elem.removeEventListener("load", onLoadJavascript);
|
|
5750
|
+
cb(elem.src);
|
|
5751
|
+
};
|
|
5752
|
+
const insertScript = (src) => {
|
|
5753
|
+
return new Promise((resolve, reject) => {
|
|
5754
|
+
if (loaded.js.has(src)) {
|
|
5755
|
+
return resolve(src);
|
|
5756
|
+
}
|
|
5757
|
+
loaded.js.add(src);
|
|
5758
|
+
const script = dom.create({
|
|
5759
|
+
tag: "script",
|
|
5760
|
+
attrs: {
|
|
5761
|
+
type: "text/javascript",
|
|
5762
|
+
async: true,
|
|
5763
|
+
src
|
|
5764
|
+
},
|
|
5765
|
+
action: {
|
|
5766
|
+
load: () => onLoadJavascript(script, resolve),
|
|
5767
|
+
error: () => reject(new Error(`${src} failed to load.`))
|
|
5768
|
+
}
|
|
5769
|
+
});
|
|
5770
|
+
document.head.appendChild(script);
|
|
5771
|
+
});
|
|
5772
|
+
};
|
|
5773
|
+
const insertStyle = (srcs) => {
|
|
5774
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5775
|
+
const promises = srcs.map(
|
|
5776
|
+
(src) => new Promise((resolve, reject) => {
|
|
5777
|
+
if (loaded.css.has(src)) {
|
|
5778
|
+
return resolve(src);
|
|
5779
|
+
}
|
|
5780
|
+
loaded.css.add(src);
|
|
5781
|
+
const styleLink = dom.create({
|
|
5782
|
+
tag: "link",
|
|
5783
|
+
attrs: {
|
|
5784
|
+
rel: "stylesheet",
|
|
5785
|
+
href: src
|
|
5786
|
+
},
|
|
5787
|
+
action: {
|
|
5788
|
+
load: () => onLoadStylesheet(styleLink, resolve),
|
|
5789
|
+
error: () => reject(new Error(`${(void 0).src} failed to load.`))
|
|
5790
|
+
}
|
|
5791
|
+
});
|
|
5792
|
+
document.head.appendChild(styleLink);
|
|
5793
|
+
})
|
|
5794
|
+
);
|
|
5795
|
+
return Promise.all(promises);
|
|
5796
|
+
};
|
|
5797
|
+
const insertScripts = (srcs) => {
|
|
5798
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5799
|
+
const promises = srcs.map((src) => insertScript(src));
|
|
5800
|
+
return Promise.all(promises);
|
|
5801
|
+
};
|
|
5802
|
+
const insertStyles = (srcs) => {
|
|
5803
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5804
|
+
const promises = srcs.map((src) => insertStyle(src));
|
|
5805
|
+
return Promise.all(promises);
|
|
5806
|
+
};
|
|
5807
|
+
const insertIcons = (iconSvgStr) => {
|
|
5808
|
+
const parser = new DOMParser();
|
|
5809
|
+
const svgDoc = parser.parseFromString(iconSvgStr, "image/svg+xml");
|
|
5810
|
+
loaded.formeoSprite = svgDoc.documentElement;
|
|
5811
|
+
return loaded.formeoSprite;
|
|
5812
|
+
};
|
|
5813
|
+
const fetchIcons = async (iconSpriteUrl = SVG_SPRITE_URL) => {
|
|
5814
|
+
if (loaded.formeoSprite) {
|
|
5815
|
+
return loaded.formeoSprite;
|
|
5816
|
+
}
|
|
5817
|
+
if (!iconSpriteUrl) {
|
|
5818
|
+
return insertIcons(BUNDLED_SVG_SPRITE);
|
|
5819
|
+
}
|
|
5820
|
+
const parseResp = async (resp) => insertIcons(await resp.text());
|
|
5821
|
+
return ajax(iconSpriteUrl, parseResp, () => ajax(FALLBACK_SVG_SPRITE_URL, parseResp));
|
|
5822
|
+
};
|
|
5823
|
+
const LOADER_MAP = {
|
|
5824
|
+
js: insertScripts,
|
|
5825
|
+
css: insertStyles
|
|
5826
|
+
};
|
|
5827
|
+
const fetchDependencies = (dependencies) => {
|
|
5828
|
+
const promises = Object.entries(dependencies).map(([type, src]) => {
|
|
5829
|
+
return LOADER_MAP[type](src);
|
|
5830
|
+
});
|
|
5831
|
+
return Promise.all(promises);
|
|
5832
|
+
};
|
|
5833
|
+
const fetchFormeoStyle = async (cssUrl) => {
|
|
5834
|
+
if (!loaded.css.has(cssUrl)) {
|
|
5835
|
+
await insertStyle(cssUrl);
|
|
5836
|
+
if (!loaded.css.has(FALLBACK_CSS_URL)) {
|
|
5837
|
+
return await insertStyle(FALLBACK_CSS_URL);
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5697
5840
|
};
|
|
5698
5841
|
const iconFontTemplates = {
|
|
5699
5842
|
glyphicons: (icon) => `<span class="glyphicon glyphicon-${icon}" aria-hidden="true"></span>`,
|
|
@@ -5788,7 +5931,7 @@ class DOM {
|
|
|
5788
5931
|
processed.push("tag");
|
|
5789
5932
|
let childType;
|
|
5790
5933
|
const { tag } = elem;
|
|
5791
|
-
let
|
|
5934
|
+
let i2;
|
|
5792
5935
|
const wrap = {
|
|
5793
5936
|
attrs: {},
|
|
5794
5937
|
className: [helpers.get(elem, "config.inputWrap")],
|
|
@@ -5882,8 +6025,8 @@ class DOM {
|
|
|
5882
6025
|
processed.push("action");
|
|
5883
6026
|
}
|
|
5884
6027
|
const remaining = helpers.subtract(processed, Object.keys(elem));
|
|
5885
|
-
for (
|
|
5886
|
-
element[remaining[
|
|
6028
|
+
for (i2 = remaining.length - 1; i2 >= 0; i2--) {
|
|
6029
|
+
element[remaining[i2]] = elem[remaining[i2]];
|
|
5887
6030
|
}
|
|
5888
6031
|
if (wrap.children.length) {
|
|
5889
6032
|
element = this.create(wrap);
|
|
@@ -5923,25 +6066,26 @@ class DOM {
|
|
|
5923
6066
|
if (this.iconSymbols) {
|
|
5924
6067
|
return this.iconSymbols;
|
|
5925
6068
|
}
|
|
5926
|
-
const iconSymbolNodes =
|
|
5927
|
-
const createSvgIconConfig = (
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
}
|
|
5940
|
-
|
|
5941
|
-
|
|
6069
|
+
const iconSymbolNodes = loaded.formeoSprite.querySelectorAll("svg symbol");
|
|
6070
|
+
const createSvgIconConfig = (symbol) => {
|
|
6071
|
+
const viewBox = symbol.getAttribute("viewBox") || "0 0 24 24";
|
|
6072
|
+
const children = Array.from(symbol.children).map((child) => {
|
|
6073
|
+
const clonedNode = child.cloneNode(true);
|
|
6074
|
+
return clonedNode.outerHTML;
|
|
6075
|
+
}).join("");
|
|
6076
|
+
return {
|
|
6077
|
+
tag: "svg",
|
|
6078
|
+
attrs: {
|
|
6079
|
+
className: ["svg-icon", symbol.id],
|
|
6080
|
+
viewBox,
|
|
6081
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
6082
|
+
},
|
|
6083
|
+
children
|
|
6084
|
+
};
|
|
6085
|
+
};
|
|
5942
6086
|
this.iconSymbols = Array.from(iconSymbolNodes).reduce((acc, symbol) => {
|
|
5943
6087
|
const name2 = symbol.id.replace(iconPrefix, "");
|
|
5944
|
-
acc[name2] = createSvgIconConfig(symbol
|
|
6088
|
+
acc[name2] = createSvgIconConfig(symbol);
|
|
5945
6089
|
return acc;
|
|
5946
6090
|
}, {});
|
|
5947
6091
|
this.cachedIcons = {};
|
|
@@ -6049,19 +6193,19 @@ class DOM {
|
|
|
6049
6193
|
});
|
|
6050
6194
|
return elementsContainingText;
|
|
6051
6195
|
};
|
|
6052
|
-
generateOption = ({ type = "option", label, value, i = 0, selected }) => {
|
|
6196
|
+
generateOption = ({ type = "option", label, value, i: i2 = 0, selected }) => {
|
|
6053
6197
|
const isOption = type === "option";
|
|
6054
6198
|
return {
|
|
6055
6199
|
tag: isOption ? "option" : "input",
|
|
6056
6200
|
attrs: {
|
|
6057
6201
|
type,
|
|
6058
|
-
value: value || `${type}-${
|
|
6059
|
-
[type === "option" ? "selected" : "checked"]: selected || !
|
|
6202
|
+
value: value || `${type}-${i2}`,
|
|
6203
|
+
[type === "option" ? "selected" : "checked"]: selected || !i2
|
|
6060
6204
|
},
|
|
6061
6205
|
config: {
|
|
6062
6206
|
label: label || mi18n.get("labelCount", {
|
|
6063
6207
|
label: mi18n.get("option"),
|
|
6064
|
-
count:
|
|
6208
|
+
count: i2
|
|
6065
6209
|
})
|
|
6066
6210
|
}
|
|
6067
6211
|
};
|
|
@@ -6077,7 +6221,7 @@ class DOM {
|
|
|
6077
6221
|
const { action, attrs = {} } = elem;
|
|
6078
6222
|
const fieldType = attrs.type || elem.tag;
|
|
6079
6223
|
const id = attrs.id || elem.id;
|
|
6080
|
-
const optionMap = (option2,
|
|
6224
|
+
const optionMap = (option2, i2) => {
|
|
6081
6225
|
const { label, value, ...rest } = option2;
|
|
6082
6226
|
const defaultInput = () => {
|
|
6083
6227
|
const input = {
|
|
@@ -6086,7 +6230,7 @@ class DOM {
|
|
|
6086
6230
|
name: id,
|
|
6087
6231
|
type: fieldType,
|
|
6088
6232
|
value: value || "",
|
|
6089
|
-
id: `${id}-${
|
|
6233
|
+
id: `${id}-${i2}`,
|
|
6090
6234
|
...rest
|
|
6091
6235
|
},
|
|
6092
6236
|
action
|
|
@@ -6094,7 +6238,7 @@ class DOM {
|
|
|
6094
6238
|
const optionLabel = {
|
|
6095
6239
|
tag: "label",
|
|
6096
6240
|
attrs: {
|
|
6097
|
-
for: `${id}-${
|
|
6241
|
+
for: `${id}-${i2}`
|
|
6098
6242
|
},
|
|
6099
6243
|
children: label
|
|
6100
6244
|
};
|
|
@@ -6627,7 +6771,7 @@ class Autocomplete {
|
|
|
6627
6771
|
* @return {Object} DOM Element to be injected into the form.
|
|
6628
6772
|
*/
|
|
6629
6773
|
build() {
|
|
6630
|
-
const keyboardNav = (
|
|
6774
|
+
const keyboardNav = (e2) => {
|
|
6631
6775
|
const list = this.list;
|
|
6632
6776
|
const activeOption = this.getActiveOption();
|
|
6633
6777
|
const keyCodeMap = /* @__PURE__ */ new Map([
|
|
@@ -6664,7 +6808,7 @@ class Autocomplete {
|
|
|
6664
6808
|
this.hideList();
|
|
6665
6809
|
}
|
|
6666
6810
|
}
|
|
6667
|
-
|
|
6811
|
+
e2.preventDefault();
|
|
6668
6812
|
}
|
|
6669
6813
|
],
|
|
6670
6814
|
[
|
|
@@ -6675,7 +6819,7 @@ class Autocomplete {
|
|
|
6675
6819
|
}
|
|
6676
6820
|
]
|
|
6677
6821
|
]);
|
|
6678
|
-
let direction = keyCodeMap.get(
|
|
6822
|
+
let direction = keyCodeMap.get(e2.keyCode);
|
|
6679
6823
|
if (!direction) {
|
|
6680
6824
|
direction = () => false;
|
|
6681
6825
|
}
|
|
@@ -7568,7 +7712,7 @@ class EditPanel {
|
|
|
7568
7712
|
};
|
|
7569
7713
|
const editPanelButtons = [];
|
|
7570
7714
|
if (type === "conditions") {
|
|
7571
|
-
if (!mi18n.current.clearAll) {
|
|
7715
|
+
if (mi18n.current && !mi18n.current.clearAll) {
|
|
7572
7716
|
mi18n.put("clearAll", "Clear All");
|
|
7573
7717
|
}
|
|
7574
7718
|
const clearAllBtn = {
|
|
@@ -7864,7 +8008,7 @@ class Panels {
|
|
|
7864
8008
|
placement: "top"
|
|
7865
8009
|
},
|
|
7866
8010
|
action: {
|
|
7867
|
-
click: (
|
|
8011
|
+
click: (e2) => this.nav.nextGroup(e2)
|
|
7868
8012
|
},
|
|
7869
8013
|
content: dom.icon("triangle-right")
|
|
7870
8014
|
};
|
|
@@ -7880,7 +8024,7 @@ class Panels {
|
|
|
7880
8024
|
placement: "top"
|
|
7881
8025
|
},
|
|
7882
8026
|
action: {
|
|
7883
|
-
click: (
|
|
8027
|
+
click: (e2) => this.nav.prevGroup(e2)
|
|
7884
8028
|
},
|
|
7885
8029
|
content: dom.icon("triangle-left")
|
|
7886
8030
|
};
|
|
@@ -8062,6 +8206,7 @@ class Component extends Data {
|
|
|
8062
8206
|
dispatchComponentEvent(eventName, eventData = {}) {
|
|
8063
8207
|
const fullEventData = {
|
|
8064
8208
|
component: this,
|
|
8209
|
+
target: this,
|
|
8065
8210
|
type: eventName,
|
|
8066
8211
|
timestamp: Date.now(),
|
|
8067
8212
|
...eventData
|
|
@@ -8147,6 +8292,22 @@ class Component extends Data {
|
|
|
8147
8292
|
if (parent.name === "row") {
|
|
8148
8293
|
parent.autoColumnWidths();
|
|
8149
8294
|
}
|
|
8295
|
+
const componentEventMap = {
|
|
8296
|
+
row: EVENT_FORMEO_REMOVED_ROW,
|
|
8297
|
+
column: EVENT_FORMEO_REMOVED_COLUMN,
|
|
8298
|
+
field: EVENT_FORMEO_REMOVED_FIELD
|
|
8299
|
+
};
|
|
8300
|
+
const removeEvent = componentEventMap[this.name];
|
|
8301
|
+
if (removeEvent) {
|
|
8302
|
+
events.formeoUpdated(
|
|
8303
|
+
{
|
|
8304
|
+
componentId: this.id,
|
|
8305
|
+
componentType: this.name,
|
|
8306
|
+
parent
|
|
8307
|
+
},
|
|
8308
|
+
removeEvent
|
|
8309
|
+
);
|
|
8310
|
+
}
|
|
8150
8311
|
return components[`${this.name}s`].delete(this.id);
|
|
8151
8312
|
};
|
|
8152
8313
|
/**
|
|
@@ -8200,12 +8361,7 @@ class Component extends Data {
|
|
|
8200
8361
|
return dom.create({
|
|
8201
8362
|
tag: "span",
|
|
8202
8363
|
className: ["component-tag", `${this.name}-tag`],
|
|
8203
|
-
children: [
|
|
8204
|
-
(this.isColumn || this.isField) && dom.icon("component-corner", { className: "bottom-left" }),
|
|
8205
|
-
dom.icon(`handle-${this.name}`),
|
|
8206
|
-
toTitleCase(this.name),
|
|
8207
|
-
(this.isColumn || this.isRow) && dom.icon("component-corner", { className: "bottom-right" })
|
|
8208
|
-
].filter(Boolean)
|
|
8364
|
+
children: [dom.icon(`handle-${this.name}`), toTitleCase(this.name)].filter(Boolean)
|
|
8209
8365
|
});
|
|
8210
8366
|
};
|
|
8211
8367
|
/**
|
|
@@ -9269,8 +9425,8 @@ class Row extends Component {
|
|
|
9269
9425
|
if (typeof widths === "string") {
|
|
9270
9426
|
widths = widths.split(",");
|
|
9271
9427
|
}
|
|
9272
|
-
this.children.forEach((column,
|
|
9273
|
-
column.setWidth(`${widths[
|
|
9428
|
+
this.children.forEach((column, i2) => {
|
|
9429
|
+
column.setWidth(`${widths[i2]}%`);
|
|
9274
9430
|
column.refreshFieldPanels();
|
|
9275
9431
|
});
|
|
9276
9432
|
};
|
|
@@ -9443,7 +9599,7 @@ class Stage extends Component {
|
|
|
9443
9599
|
}
|
|
9444
9600
|
onAdd(...args) {
|
|
9445
9601
|
const component = super.onAdd(...args);
|
|
9446
|
-
if (component
|
|
9602
|
+
if (component?.name === "column") {
|
|
9447
9603
|
component.parent.autoColumnWidths();
|
|
9448
9604
|
}
|
|
9449
9605
|
}
|
|
@@ -9471,133 +9627,6 @@ let Stages$1 = class Stages extends ComponentData {
|
|
|
9471
9627
|
}
|
|
9472
9628
|
};
|
|
9473
9629
|
const stages = new Stages$1();
|
|
9474
|
-
const loaded = {
|
|
9475
|
-
js: /* @__PURE__ */ new Set(),
|
|
9476
|
-
css: /* @__PURE__ */ new Set()
|
|
9477
|
-
};
|
|
9478
|
-
const ajax = (fileUrl, callback, onError = noop) => {
|
|
9479
|
-
return new Promise((resolve) => {
|
|
9480
|
-
return fetch(fileUrl).then((data) => {
|
|
9481
|
-
if (!data.ok) {
|
|
9482
|
-
return resolve(onError(data));
|
|
9483
|
-
}
|
|
9484
|
-
resolve(callback ? callback(data) : data);
|
|
9485
|
-
}).catch((err) => onError(err));
|
|
9486
|
-
});
|
|
9487
|
-
};
|
|
9488
|
-
const onLoadStylesheet = (elem, cb) => {
|
|
9489
|
-
elem.removeEventListener("load", onLoadStylesheet);
|
|
9490
|
-
cb(elem.src);
|
|
9491
|
-
};
|
|
9492
|
-
const onLoadJavascript = (elem, cb) => {
|
|
9493
|
-
elem.removeEventListener("load", onLoadJavascript);
|
|
9494
|
-
cb(elem.src);
|
|
9495
|
-
};
|
|
9496
|
-
const insertScript = (src) => {
|
|
9497
|
-
return new Promise((resolve, reject) => {
|
|
9498
|
-
if (loaded.js.has(src)) {
|
|
9499
|
-
return resolve(src);
|
|
9500
|
-
}
|
|
9501
|
-
loaded.js.add(src);
|
|
9502
|
-
const script = dom.create({
|
|
9503
|
-
tag: "script",
|
|
9504
|
-
attrs: {
|
|
9505
|
-
type: "text/javascript",
|
|
9506
|
-
async: true,
|
|
9507
|
-
src
|
|
9508
|
-
},
|
|
9509
|
-
action: {
|
|
9510
|
-
load: () => onLoadJavascript(script, resolve),
|
|
9511
|
-
error: () => reject(new Error(`${src} failed to load.`))
|
|
9512
|
-
}
|
|
9513
|
-
});
|
|
9514
|
-
document.head.appendChild(script);
|
|
9515
|
-
});
|
|
9516
|
-
};
|
|
9517
|
-
const insertStyle = (srcs) => {
|
|
9518
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9519
|
-
const promises = srcs.map(
|
|
9520
|
-
(src) => new Promise((resolve, reject) => {
|
|
9521
|
-
if (loaded.css.has(src)) {
|
|
9522
|
-
return resolve(src);
|
|
9523
|
-
}
|
|
9524
|
-
loaded.css.add(src);
|
|
9525
|
-
const styleLink = dom.create({
|
|
9526
|
-
tag: "link",
|
|
9527
|
-
attrs: {
|
|
9528
|
-
rel: "stylesheet",
|
|
9529
|
-
href: src
|
|
9530
|
-
},
|
|
9531
|
-
action: {
|
|
9532
|
-
load: () => onLoadStylesheet(styleLink, resolve),
|
|
9533
|
-
error: () => reject(new Error(`${(void 0).src} failed to load.`))
|
|
9534
|
-
}
|
|
9535
|
-
});
|
|
9536
|
-
document.head.appendChild(styleLink);
|
|
9537
|
-
})
|
|
9538
|
-
);
|
|
9539
|
-
return Promise.all(promises);
|
|
9540
|
-
};
|
|
9541
|
-
const insertScripts = (srcs) => {
|
|
9542
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9543
|
-
const promises = srcs.map((src) => insertScript(src));
|
|
9544
|
-
return Promise.all(promises);
|
|
9545
|
-
};
|
|
9546
|
-
const insertStyles = (srcs) => {
|
|
9547
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9548
|
-
const promises = srcs.map((src) => insertStyle(src));
|
|
9549
|
-
return Promise.all(promises);
|
|
9550
|
-
};
|
|
9551
|
-
const insertIcons = (iconSvgStr) => {
|
|
9552
|
-
let iconSpriteWrap = document.getElementById(formeoSpriteId);
|
|
9553
|
-
if (!iconSpriteWrap) {
|
|
9554
|
-
iconSpriteWrap = dom.create({
|
|
9555
|
-
id: formeoSpriteId,
|
|
9556
|
-
children: iconSvgStr,
|
|
9557
|
-
attrs: {
|
|
9558
|
-
hidden: true,
|
|
9559
|
-
style: "display: none;"
|
|
9560
|
-
}
|
|
9561
|
-
});
|
|
9562
|
-
document.body.insertBefore(iconSpriteWrap, document.body.childNodes[0]);
|
|
9563
|
-
}
|
|
9564
|
-
return iconSpriteWrap;
|
|
9565
|
-
};
|
|
9566
|
-
const fetchIcons = async (iconSpriteUrl = SVG_SPRITE_URL) => {
|
|
9567
|
-
const formeoSprite = document.getElementById(formeoSpriteId);
|
|
9568
|
-
if (formeoSprite) {
|
|
9569
|
-
return;
|
|
9570
|
-
}
|
|
9571
|
-
const parseResp = async (resp) => insertIcons(await resp.text());
|
|
9572
|
-
return ajax(iconSpriteUrl, parseResp, () => ajax(FALLBACK_SVG_SPRITE_URL, parseResp));
|
|
9573
|
-
};
|
|
9574
|
-
const loadPolyfills = (polyfillConfig) => {
|
|
9575
|
-
const polyfills = Array.isArray(polyfillConfig) ? POLYFILLS.filter(({ name: name2 }) => polyfillConfig.indexOf(name2) !== -1) : POLYFILLS;
|
|
9576
|
-
return Promise.all(polyfills.map(({ src }) => insertScript(src)));
|
|
9577
|
-
};
|
|
9578
|
-
const LOADER_MAP = {
|
|
9579
|
-
js: insertScripts,
|
|
9580
|
-
css: insertStyles
|
|
9581
|
-
};
|
|
9582
|
-
const fetchDependencies = (dependencies) => {
|
|
9583
|
-
const promises = Object.entries(dependencies).map(([type, src]) => {
|
|
9584
|
-
return LOADER_MAP[type](src);
|
|
9585
|
-
});
|
|
9586
|
-
return Promise.all(promises);
|
|
9587
|
-
};
|
|
9588
|
-
const isCssLoaded = () => {
|
|
9589
|
-
const formeoSprite = document.getElementById(formeoSpriteId);
|
|
9590
|
-
const computedStyle = window.getComputedStyle(formeoSprite);
|
|
9591
|
-
return computedStyle.visibility === "hidden";
|
|
9592
|
-
};
|
|
9593
|
-
const fetchFormeoStyle = async (cssUrl) => {
|
|
9594
|
-
if (!isCssLoaded()) {
|
|
9595
|
-
await insertStyle(cssUrl);
|
|
9596
|
-
if (!isCssLoaded()) {
|
|
9597
|
-
return await insertStyle(FALLBACK_CSS_URL);
|
|
9598
|
-
}
|
|
9599
|
-
}
|
|
9600
|
-
};
|
|
9601
9630
|
class Control {
|
|
9602
9631
|
controlCache = /* @__PURE__ */ new Set();
|
|
9603
9632
|
/**
|
|
@@ -9666,9 +9695,9 @@ class Control {
|
|
|
9666
9695
|
* @return {String} the translated label
|
|
9667
9696
|
*/
|
|
9668
9697
|
i18n(lookup, args) {
|
|
9669
|
-
const
|
|
9698
|
+
const locale2 = mi18n.locale;
|
|
9670
9699
|
const controlTranslations = this.definition?.i18n;
|
|
9671
|
-
const localeTranslations = controlTranslations?.[
|
|
9700
|
+
const localeTranslations = controlTranslations?.[locale2] || {};
|
|
9672
9701
|
return (localeTranslations[lookup]?.() ?? localeTranslations[lookup]) || mi18n.get(lookup, args);
|
|
9673
9702
|
}
|
|
9674
9703
|
}
|
|
@@ -9919,12 +9948,12 @@ let Controls$1 = class Controls {
|
|
|
9919
9948
|
// @todo finish the addGroup method
|
|
9920
9949
|
addGroup: (group) => console.log(group)
|
|
9921
9950
|
};
|
|
9922
|
-
for (let
|
|
9923
|
-
const storeID = `formeo-controls-${groups[
|
|
9951
|
+
for (let i2 = groups.length - 1; i2 >= 0; i2--) {
|
|
9952
|
+
const storeID = `formeo-controls-${groups[i2]}`;
|
|
9924
9953
|
if (!this.options.sortable) {
|
|
9925
9954
|
window.localStorage.removeItem(storeID);
|
|
9926
9955
|
}
|
|
9927
|
-
Sortable.create(groups[
|
|
9956
|
+
Sortable.create(groups[i2], {
|
|
9928
9957
|
animation: 150,
|
|
9929
9958
|
forceFallback: true,
|
|
9930
9959
|
fallbackClass: "control-moving",
|
|
@@ -10396,12 +10425,18 @@ const defaults$1 = {
|
|
|
10396
10425
|
},
|
|
10397
10426
|
onAdd: () => {
|
|
10398
10427
|
},
|
|
10399
|
-
onChange: (
|
|
10428
|
+
onChange: (evt) => events.opts?.debug && console.log(evt),
|
|
10400
10429
|
onUpdate: (evt) => events.opts?.debug && console.log(evt),
|
|
10401
10430
|
onUpdateStage: (evt) => events.opts?.debug && console.log(evt),
|
|
10402
10431
|
onUpdateRow: (evt) => events.opts?.debug && console.log(evt),
|
|
10403
10432
|
onUpdateColumn: (evt) => events.opts?.debug && console.log(evt),
|
|
10404
10433
|
onUpdateField: (evt) => events.opts?.debug && console.log(evt),
|
|
10434
|
+
onAddRow: (evt) => events.opts?.debug && console.log(evt),
|
|
10435
|
+
onAddColumn: (evt) => events.opts?.debug && console.log(evt),
|
|
10436
|
+
onAddField: (evt) => events.opts?.debug && console.log(evt),
|
|
10437
|
+
onRemoveRow: (evt) => events.opts?.debug && console.log(evt),
|
|
10438
|
+
onRemoveColumn: (evt) => events.opts?.debug && console.log(evt),
|
|
10439
|
+
onRemoveField: (evt) => events.opts?.debug && console.log(evt),
|
|
10405
10440
|
onRender: (evt) => events.opts?.debug && console.log(evt),
|
|
10406
10441
|
onSave: (_evt) => {
|
|
10407
10442
|
},
|
|
@@ -10417,6 +10452,13 @@ const defaultCustomEvent = ({ src, ...evtData }, type = EVENT_FORMEO_UPDATED) =>
|
|
|
10417
10452
|
bubbles: events.opts?.debug || events.opts?.bubbles
|
|
10418
10453
|
});
|
|
10419
10454
|
evt.data = (src || document).dispatchEvent(evt);
|
|
10455
|
+
if (type === EVENT_FORMEO_UPDATED) {
|
|
10456
|
+
const changedEvt = new window.CustomEvent(EVENT_FORMEO_CHANGED, {
|
|
10457
|
+
detail: evtData,
|
|
10458
|
+
bubbles: events.opts?.debug || events.opts?.bubbles
|
|
10459
|
+
});
|
|
10460
|
+
(src || document).dispatchEvent(changedEvt);
|
|
10461
|
+
}
|
|
10420
10462
|
return evt;
|
|
10421
10463
|
};
|
|
10422
10464
|
const events = {
|
|
@@ -10425,50 +10467,82 @@ const events = {
|
|
|
10425
10467
|
return this;
|
|
10426
10468
|
},
|
|
10427
10469
|
formeoSaved: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_SAVED),
|
|
10428
|
-
formeoUpdated: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_UPDATED),
|
|
10470
|
+
formeoUpdated: (evt, eventType) => defaultCustomEvent(evt, eventType || EVENT_FORMEO_UPDATED),
|
|
10429
10471
|
formeoCleared: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_CLEARED),
|
|
10430
10472
|
formeoOnRender: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_ON_RENDER),
|
|
10431
|
-
formeoConditionUpdated: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_CONDITION_UPDATED)
|
|
10473
|
+
formeoConditionUpdated: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_CONDITION_UPDATED),
|
|
10474
|
+
formeoAddedRow: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_ADDED_ROW),
|
|
10475
|
+
formeoAddedColumn: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_ADDED_COLUMN),
|
|
10476
|
+
formeoAddedField: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_ADDED_FIELD),
|
|
10477
|
+
formeoRemovedRow: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_REMOVED_ROW),
|
|
10478
|
+
formeoRemovedColumn: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_REMOVED_COLUMN),
|
|
10479
|
+
formeoRemovedField: (evt) => defaultCustomEvent(evt, EVENT_FORMEO_REMOVED_FIELD)
|
|
10432
10480
|
};
|
|
10433
10481
|
const formeoUpdatedThrottled = throttle$1(() => {
|
|
10434
|
-
|
|
10482
|
+
const eventData = {
|
|
10435
10483
|
timeStamp: window.performance.now(),
|
|
10436
10484
|
type: EVENT_FORMEO_UPDATED,
|
|
10437
10485
|
detail: components.formData
|
|
10438
|
-
}
|
|
10486
|
+
};
|
|
10487
|
+
events.opts.onUpdate(eventData);
|
|
10488
|
+
if (events.opts.onChange !== events.opts.onUpdate) {
|
|
10489
|
+
events.opts.onChange(eventData);
|
|
10490
|
+
}
|
|
10439
10491
|
}, ANIMATION_SPEED_FAST);
|
|
10440
10492
|
document.addEventListener(EVENT_FORMEO_UPDATED, formeoUpdatedThrottled);
|
|
10441
10493
|
document.addEventListener(EVENT_FORMEO_UPDATED_STAGE, (evt) => {
|
|
10442
10494
|
const { timeStamp, type, detail } = evt;
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
detail
|
|
10447
|
-
});
|
|
10495
|
+
const eventData = { timeStamp, type, detail };
|
|
10496
|
+
events.opts.onUpdate(eventData);
|
|
10497
|
+
events.opts.onUpdateStage(eventData);
|
|
10448
10498
|
});
|
|
10449
10499
|
document.addEventListener(EVENT_FORMEO_UPDATED_ROW, (evt) => {
|
|
10450
10500
|
const { timeStamp, type, detail } = evt;
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
detail
|
|
10455
|
-
});
|
|
10501
|
+
const eventData = { timeStamp, type, detail };
|
|
10502
|
+
events.opts.onUpdate(eventData);
|
|
10503
|
+
events.opts.onUpdateRow(eventData);
|
|
10456
10504
|
});
|
|
10457
10505
|
document.addEventListener(EVENT_FORMEO_UPDATED_COLUMN, (evt) => {
|
|
10458
10506
|
const { timeStamp, type, detail } = evt;
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
detail
|
|
10463
|
-
});
|
|
10507
|
+
const eventData = { timeStamp, type, detail };
|
|
10508
|
+
events.opts.onUpdate(eventData);
|
|
10509
|
+
events.opts.onUpdateColumn(eventData);
|
|
10464
10510
|
});
|
|
10465
10511
|
document.addEventListener(EVENT_FORMEO_UPDATED_FIELD, (evt) => {
|
|
10466
10512
|
const { timeStamp, type, detail } = evt;
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10513
|
+
const eventData = { timeStamp, type, detail };
|
|
10514
|
+
events.opts.onUpdate(eventData);
|
|
10515
|
+
events.opts.onUpdateField(eventData);
|
|
10516
|
+
});
|
|
10517
|
+
document.addEventListener(EVENT_FORMEO_ADDED_ROW, (evt) => {
|
|
10518
|
+
const { timeStamp, type, detail } = evt;
|
|
10519
|
+
const eventData = { timeStamp, type, detail };
|
|
10520
|
+
events.opts.onAddRow(eventData);
|
|
10521
|
+
});
|
|
10522
|
+
document.addEventListener(EVENT_FORMEO_ADDED_COLUMN, (evt) => {
|
|
10523
|
+
const { timeStamp, type, detail } = evt;
|
|
10524
|
+
const eventData = { timeStamp, type, detail };
|
|
10525
|
+
events.opts.onAddColumn(eventData);
|
|
10526
|
+
});
|
|
10527
|
+
document.addEventListener(EVENT_FORMEO_ADDED_FIELD, (evt) => {
|
|
10528
|
+
const { timeStamp, type, detail } = evt;
|
|
10529
|
+
const eventData = { timeStamp, type, detail };
|
|
10530
|
+
events.opts.onAddField(eventData);
|
|
10531
|
+
});
|
|
10532
|
+
document.addEventListener(EVENT_FORMEO_REMOVED_ROW, (evt) => {
|
|
10533
|
+
const { timeStamp, type, detail } = evt;
|
|
10534
|
+
const eventData = { timeStamp, type, detail };
|
|
10535
|
+
events.opts.onRemoveRow(eventData);
|
|
10536
|
+
});
|
|
10537
|
+
document.addEventListener(EVENT_FORMEO_REMOVED_COLUMN, (evt) => {
|
|
10538
|
+
const { timeStamp, type, detail } = evt;
|
|
10539
|
+
const eventData = { timeStamp, type, detail };
|
|
10540
|
+
events.opts.onRemoveColumn(eventData);
|
|
10541
|
+
});
|
|
10542
|
+
document.addEventListener(EVENT_FORMEO_REMOVED_FIELD, (evt) => {
|
|
10543
|
+
const { timeStamp, type, detail } = evt;
|
|
10544
|
+
const eventData = { timeStamp, type, detail };
|
|
10545
|
+
events.opts.onRemoveField(eventData);
|
|
10472
10546
|
});
|
|
10473
10547
|
document.addEventListener(EVENT_FORMEO_ON_RENDER, (evt) => {
|
|
10474
10548
|
const { timeStamp, type, detail } = evt;
|
|
@@ -10600,8 +10674,10 @@ const actions = {
|
|
|
10600
10674
|
}
|
|
10601
10675
|
}
|
|
10602
10676
|
};
|
|
10603
|
-
const
|
|
10604
|
-
|
|
10677
|
+
const e = { "en-US": { "en-US": "English", dir: "ltr", "af-ZA": "Afrikaans (South Africa)", "ar-TN": "Arabic (Tunisia)", "cs-CZ": "Czech (Czechia)", "de-DE": "German (Germany)", "es-ES": "European Spanish", "fa-IR": "Persian (Iran)", "fi-FI": "Finnish (Finland)", "fr-FR": "French (France)", "hu-HU": "Hungarian (Hungary)", "it-IT": "Italian (Italy)", "ja-JP": "Japanese (Japan)", "nb-NO": "Norwegian Bokmål (Norway)", "pl-PL": "Polish (Poland)", "pt-BR": "Brazilian Portuguese", "pt-PT": "European Portuguese", "ro-RO": "Romanian (Romania)", "ru-RU": "Russian (Russia)", "th-TH": "Thai (Thailand)", "tr-TR": "Turkish (Türkiye)", "zh-CN": "Chinese (China)", "zh-HK": "Chinese (Hong Kong SAR China)", "action.add.attrs.attr": "What attribute would you like to add?", "action.add.attrs.value": "Default Value", addOption: "Add Option", allFieldsRemoved: "All fields were removed.", allowSelect: "Allow Select", and: "and", attribute: "Attribute", attributeNotPermitted: 'Attribute "{attribute}" is not permitted, please choose another.', attributes: "Attributes", "attrs.class": "Class", "attrs.className": "Class", "attrs.dir": "Direction", "attrs.id": "Id", "attrs.required": "Required", "attrs.style": "Style", "attrs.title": "Title", "attrs.type": "Type", "attrs.value": "Value", autocomplete: "Autocomplete", button: "Button", cannotBeEmpty: "This field cannot be empty", cannotClearFields: "There are no fields to clear", checkbox: "Checkbox", checkboxes: "Checkboxes", class: "Class", clear: "Clear", clearAllMessage: "Are you sure you want to clear all fields?", close: "Close", column: "Column", "condition.target.placeholder": "target", "condition.type.and": "And", "condition.type.if": "If", "condition.type.or": "Or", "condition.type.then": "Then", "condition.value.placeholder": "value", confirmClearAll: "Are you sure you want to remove all fields?", content: "Content", control: "Control", "controlGroups.nextGroup": "Next Group", "controlGroups.prevGroup": "Previous Group", "controls.filteringTerm": 'Filtering "{term}"', "controls.form.button": "Button", "controls.form.checkbox-group": "Checkbox Group", "controls.form.input.date": "Date", "controls.form.input.email": "Email", "controls.form.input.file": "File Upload", "controls.form.input.hidden": "Hidden Input", "controls.form.input.number": "Number", "controls.form.input.text": "Text Input", "controls.form.radio-group": "Radio Group", "controls.form.select": "Select", "controls.form.textarea": "TextArea", "controls.groups.form": "Form Fields", "controls.groups.html": "HTML Elements", "controls.groups.layout": "Layout", "controls.html.divider": "Divider", "controls.html.header": "Header", "controls.html.paragraph": "Paragraph", "controls.layout.column": "Column", "controls.layout.row": "Row", copy: "Copy To Clipboard", danger: "Danger", defineColumnLayout: "Define a column layout", defineColumnWidths: "Define column widths", description: "Help Text", descriptionField: "Description", "editing.row": "Editing Row", editorTitle: "Form Elements", field: "Field", "field.property.invalid": "not valid", "field.property.isChecked": "is checked", "field.property.isNotVisible": "is not visible", "field.property.isVisible": "is visible", "field.property.label": "label", "field.property.valid": "valid", "field.property.value": "value", fieldNonEditable: "This field cannot be edited.", fieldRemoveWarning: "Are you sure you want to remove this field?", fileUpload: "File Upload", formUpdated: "Form Updated", getStarted: "Drag a field from the right to get started.", group: "Group", grouped: "Grouped", hidden: "Hidden Input", hide: "Edit", htmlElements: "HTML Elements", if: "If", "if.condition.source.placeholder": "source", "if.condition.target.placeholder": "target / value", info: "Info", "input.date": "Date", "input.text": "Text", label: "Label", labelCount: "{label} {count}", labelEmpty: "Field Label cannot be empty", "lang.af": "Afrikaans", "lang.ar": "Arabic", "lang.cs": "Czech", "lang.de": "German", "lang.en": "English", "lang.es": "Spanish", "lang.fa": "Persian", "lang.fi": "Finnish", "lang.fr": "French", "lang.hu": "Hungarian", "lang.it": "Italian", "lang.ja": "Japanese", "lang.nb": "Norwegian Bokmål", "lang.pl": "Polish", "lang.pt": "Portuguese", "lang.ro": "Romanian", "lang.ru": "Russian", "lang.th": "Thai", "lang.tr": "Turkish", "lang.zh": "Chinese", layout: "Layout", limitRole: "Limit access to one or more of the following roles:", mandatory: "Mandatory", maxlength: "Max Length", "meta.group": "Group", "meta.icon": "Ico", "meta.label": "Label", minOptionMessage: "This field requires a minimum of 2 options", name: "Name", newOptionLabel: "New {type}", no: "No", number: "Number", off: "Off", on: "On", "operator.contains": "contains", "operator.equals": "equals", "operator.notContains": "not contains", "operator.notEquals": "not equal", "operator.notVisible": "not visible", "operator.visible": "visible", option: "Option", optional: "optional", optionEmpty: "Option value required", optionLabel: "Option {count}", options: "Options", or: "or", order: "Order", "panel.label.attrs": "Attributes", "panel.label.conditions": "Conditions", "panel.label.config": "Configuration", "panel.label.meta": "Meta", "panel.label.options": "Options", "panelEditButtons.attrs": "+ Attribute", "panelEditButtons.conditions": "+ Condition", "panelEditButtons.options": "+ Option", placeholder: "Placeholder", "placeholder.className": "space separated classes", "placeholder.email": "Enter you email", "placeholder.label": "Label", "placeholder.password": "Enter your password", "placeholder.placeholder": "Placeholder", "placeholder.text": "Enter some Text", "placeholder.textarea": "Enter a lot of text", "placeholder.value": "Value", preview: "Preview", primary: "Primary", remove: "Remove", removeMessage: "Remove Element", removeType: "Remove {type}", required: "Required", reset: "Reset", richText: "Rich Text Editor", roles: "Access", row: "Row", "row.makeInputGroup": "Make this row an input group.", "row.makeInputGroupDesc": "Input Groups enable users to add sets of inputs at a time.", "row.settings.fieldsetWrap": "Wrap row in a <fieldset> tag", "row.settings.fieldsetWrap.aria": "Wrap Row in Fieldset", save: "Save", secondary: "Secondary", select: "Select", selectColor: "Select Color", selectionsMessage: "Allow Multiple Selections", selectOptions: "Options", separator: "Separator", settings: "Settings", size: "Size", sizes: "Sizes", "sizes.lg": "Large", "sizes.m": "Default", "sizes.sm": "Small", "sizes.xs": "Extra Small", style: "Style", styles: "Styles", "styles.btn": "Button Style", "styles.btn.danger": "Danger", "styles.btn.default": "Default", "styles.btn.info": "Info", "styles.btn.primary": "Primary", "styles.btn.success": "Success", "styles.btn.warning": "Warning", subtype: "Type", success: "Success", text: "Text Field", then: "Then", "then.condition.target.placeholder": "target", toggle: "Toggle", ungrouped: "Un-Grouped", warning: "Warning", yes: "Yes" } }, i = e["en-US"];
|
|
10678
|
+
const locale = "en-US";
|
|
10679
|
+
mi18n.addLanguage(locale, i);
|
|
10680
|
+
mi18n.setCurrent(locale);
|
|
10605
10681
|
const defaults = {
|
|
10606
10682
|
get editor() {
|
|
10607
10683
|
return {
|
|
@@ -10612,8 +10688,8 @@ const defaults = {
|
|
|
10612
10688
|
sessionStorage: false,
|
|
10613
10689
|
editorContainer: null,
|
|
10614
10690
|
// element or selector to attach editor to
|
|
10615
|
-
svgSprite:
|
|
10616
|
-
//
|
|
10691
|
+
svgSprite: null,
|
|
10692
|
+
// null = use bundled sprite, or provide custom URL
|
|
10617
10693
|
style: CSS_URL,
|
|
10618
10694
|
// change to null
|
|
10619
10695
|
iconFont: null,
|
|
@@ -10623,8 +10699,6 @@ const defaults = {
|
|
|
10623
10699
|
events: {},
|
|
10624
10700
|
actions: {},
|
|
10625
10701
|
controls: {},
|
|
10626
|
-
polyfills: isIE(),
|
|
10627
|
-
// loads csspreloadrel
|
|
10628
10702
|
i18n: {
|
|
10629
10703
|
location: "https://draggable.github.io/formeo/assets/lang/"
|
|
10630
10704
|
},
|
|
@@ -10633,6 +10707,7 @@ const defaults = {
|
|
|
10633
10707
|
};
|
|
10634
10708
|
}
|
|
10635
10709
|
};
|
|
10710
|
+
new SmartTooltip();
|
|
10636
10711
|
let FormeoEditor$1 = class FormeoEditor {
|
|
10637
10712
|
/**
|
|
10638
10713
|
* @param {Object} options formeo options
|
|
@@ -10653,7 +10728,6 @@ let FormeoEditor$1 = class FormeoEditor {
|
|
|
10653
10728
|
this.dom = dom;
|
|
10654
10729
|
events.init({ debug, ...events$1 });
|
|
10655
10730
|
actions.init({ debug, sessionStorage: opts.sessionStorage, ...actions$1 });
|
|
10656
|
-
this.tooltip = new SmartTooltip();
|
|
10657
10731
|
if (document.readyState === "loading") {
|
|
10658
10732
|
document.addEventListener("DOMContentLoaded", this.loadResources.bind(this));
|
|
10659
10733
|
} else {
|
|
@@ -10667,6 +10741,9 @@ let FormeoEditor$1 = class FormeoEditor {
|
|
|
10667
10741
|
this.userFormData = cleanFormData(data);
|
|
10668
10742
|
this.load(this.userFormData, this.opts);
|
|
10669
10743
|
}
|
|
10744
|
+
loadData(data = {}) {
|
|
10745
|
+
this.formData = data;
|
|
10746
|
+
}
|
|
10670
10747
|
get json() {
|
|
10671
10748
|
return this.Components.json;
|
|
10672
10749
|
}
|
|
@@ -10686,17 +10763,15 @@ let FormeoEditor$1 = class FormeoEditor {
|
|
|
10686
10763
|
async loadResources() {
|
|
10687
10764
|
document.removeEventListener("DOMContentLoaded", this.loadResources);
|
|
10688
10765
|
const promises = [];
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
const resolvedPromises = await Promise.all(promises);
|
|
10766
|
+
promises.push(
|
|
10767
|
+
fetchIcons(this.opts.svgSprite),
|
|
10768
|
+
fetchFormeoStyle(this.opts.style),
|
|
10769
|
+
mi18n.init({ ...this.opts.i18n, locale: globalThis.sessionStorage?.getItem(SESSION_LOCALE_KEY) })
|
|
10770
|
+
);
|
|
10771
|
+
await Promise.all(promises);
|
|
10696
10772
|
if (this.opts.allowEdit) {
|
|
10697
10773
|
this.init();
|
|
10698
10774
|
}
|
|
10699
|
-
return resolvedPromises;
|
|
10700
10775
|
}
|
|
10701
10776
|
/**
|
|
10702
10777
|
* Formeo initializer
|
|
@@ -10756,7 +10831,7 @@ let FormeoEditor$1 = class FormeoEditor {
|
|
|
10756
10831
|
dom.empty(this.editorContainer);
|
|
10757
10832
|
this.editorContainer.appendChild(this.editor);
|
|
10758
10833
|
}
|
|
10759
|
-
events.formeoLoaded = new
|
|
10834
|
+
events.formeoLoaded = new globalThis.CustomEvent("formeoLoaded", {
|
|
10760
10835
|
detail: {
|
|
10761
10836
|
formeo: this
|
|
10762
10837
|
}
|
|
@@ -11012,8 +11087,8 @@ let FormeoRenderer$1 = class FormeoRenderer {
|
|
|
11012
11087
|
},
|
|
11013
11088
|
children: "Add +",
|
|
11014
11089
|
action: {
|
|
11015
|
-
click: (
|
|
11016
|
-
const fInputGroup =
|
|
11090
|
+
click: (e2) => {
|
|
11091
|
+
const fInputGroup = e2.target.parentElement;
|
|
11017
11092
|
const elem = dom.create(this.cloneComponentData(id));
|
|
11018
11093
|
fInputGroup.insertBefore(elem, fInputGroup.lastChild);
|
|
11019
11094
|
const removeButton = dom.create(createRemoveButton());
|
|
@@ -11246,15 +11321,15 @@ class ButtonControl extends Control {
|
|
|
11246
11321
|
super(mergedConfig);
|
|
11247
11322
|
}
|
|
11248
11323
|
}
|
|
11249
|
-
const generateOptionConfig = ({ type, isMultiple = false, count = 3 }) => Array.from({ length: count }, (_v, k) => k + 1).map((
|
|
11324
|
+
const generateOptionConfig = ({ type, isMultiple = false, count = 3 }) => Array.from({ length: count }, (_v, k) => k + 1).map((i2) => {
|
|
11250
11325
|
const selectedKey = type === "checkbox" || isMultiple ? "checked" : "selected";
|
|
11251
11326
|
return {
|
|
11252
11327
|
label: mi18n.get("labelCount", {
|
|
11253
11328
|
label: toTitleCase(type),
|
|
11254
|
-
count:
|
|
11329
|
+
count: i2
|
|
11255
11330
|
}),
|
|
11256
|
-
value: `${type}-${
|
|
11257
|
-
[selectedKey]: !
|
|
11331
|
+
value: `${type}-${i2}`,
|
|
11332
|
+
[selectedKey]: !i2
|
|
11258
11333
|
};
|
|
11259
11334
|
});
|
|
11260
11335
|
class CheckboxGroupControl extends Control {
|