formeo 4.2.0 → 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 +50 -50
- package/dist/demo/assets/js/demo.min.js.gz +0 -0
- package/dist/demo/assets/js/formeo.cjs.js +265 -291
- package/dist/demo/assets/js/formeo.es.js +265 -291
- 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 +265 -291
- package/dist/demo/assets/js/formeo.min.umd.js +2 -2
- package/dist/demo/assets/js/formeo.umd.js +265 -291
- 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 +265 -291
- package/dist/formeo.css +1 -36
- package/dist/formeo.es.js +265 -291
- 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 +265 -291
- package/dist/formeo.min.umd.js +2 -2
- package/dist/formeo.umd.js +265 -291
- package/package.json +6 -6
|
@@ -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
|
|
|
@@ -49,8 +49,8 @@ class I18N {
|
|
|
49
49
|
this.config = { location: parsedLocation, ...restOptions };
|
|
50
50
|
const { override, preloaded = {} } = this.config;
|
|
51
51
|
const allLangs = Object.entries(this.langs).concat(Object.entries(override || preloaded));
|
|
52
|
-
this.langs = allLangs.reduce((acc, [
|
|
53
|
-
acc[
|
|
52
|
+
this.langs = allLangs.reduce((acc, [locale2, lang]) => {
|
|
53
|
+
acc[locale2] = this.applyLanguage(locale2, lang);
|
|
54
54
|
return acc;
|
|
55
55
|
}, {});
|
|
56
56
|
this.locale = this.config.locale || this.config.langs[0];
|
|
@@ -69,9 +69,9 @@ class I18N {
|
|
|
69
69
|
* @param {String} locale
|
|
70
70
|
* @param {String|Object} lang
|
|
71
71
|
*/
|
|
72
|
-
addLanguage(
|
|
72
|
+
addLanguage(locale2, lang = {}) {
|
|
73
73
|
lang = typeof lang === "string" ? I18N.processFile(lang) : lang;
|
|
74
|
-
this.applyLanguage(
|
|
74
|
+
this.applyLanguage(locale2, lang);
|
|
75
75
|
this.config.langs.push("locale");
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
@@ -80,9 +80,9 @@ class I18N {
|
|
|
80
80
|
* @param {String} locale - locale to check for value
|
|
81
81
|
* @return {String} language string or undefined
|
|
82
82
|
*/
|
|
83
|
-
getValue(key,
|
|
83
|
+
getValue(key, locale2 = this.locale) {
|
|
84
84
|
var _a;
|
|
85
|
-
const value = (_a = this.langs[
|
|
85
|
+
const value = (_a = this.langs[locale2]) == null ? void 0 : _a[key];
|
|
86
86
|
return value || this.getFallbackValue(key);
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
@@ -159,9 +159,9 @@ class I18N {
|
|
|
159
159
|
static fromFile(rawText) {
|
|
160
160
|
const lines = rawText.split("\n");
|
|
161
161
|
const lang = {};
|
|
162
|
-
for (let matches2,
|
|
162
|
+
for (let matches2, i2 = 0; i2 < lines.length; i2++) {
|
|
163
163
|
const regex = /^(.+?) *?= *?([^\n]+)/;
|
|
164
|
-
matches2 = regex.exec(lines[
|
|
164
|
+
matches2 = regex.exec(lines[i2]);
|
|
165
165
|
if (matches2) {
|
|
166
166
|
lang[matches2[1]] = matches2[2].replace(/(^\s+|\s+$)/g, "");
|
|
167
167
|
}
|
|
@@ -174,22 +174,22 @@ class I18N {
|
|
|
174
174
|
* @param {Boolean} useCache
|
|
175
175
|
* @return {Promise} resolves response
|
|
176
176
|
*/
|
|
177
|
-
loadLang(
|
|
177
|
+
loadLang(locale2, useCache = true) {
|
|
178
178
|
const _this = this;
|
|
179
179
|
return new Promise(function(resolve, reject) {
|
|
180
|
-
if (_this.loaded.indexOf(
|
|
181
|
-
_this.applyLanguage(_this.langs[
|
|
182
|
-
return resolve(_this.langs[
|
|
180
|
+
if (_this.loaded.indexOf(locale2) !== -1 && useCache) {
|
|
181
|
+
_this.applyLanguage(_this.langs[locale2]);
|
|
182
|
+
return resolve(_this.langs[locale2]);
|
|
183
183
|
} else {
|
|
184
|
-
const langFile = [_this.config.location,
|
|
184
|
+
const langFile = [_this.config.location, locale2, _this.config.extension].join("");
|
|
185
185
|
return fetchData(langFile).then((lang) => {
|
|
186
186
|
const processedFile = I18N.processFile(lang);
|
|
187
|
-
_this.applyLanguage(
|
|
188
|
-
_this.loaded.push(
|
|
189
|
-
return resolve(_this.langs[
|
|
187
|
+
_this.applyLanguage(locale2, processedFile);
|
|
188
|
+
_this.loaded.push(locale2);
|
|
189
|
+
return resolve(_this.langs[locale2]);
|
|
190
190
|
}).catch((err) => {
|
|
191
191
|
console.error(err);
|
|
192
|
-
const lang = _this.applyLanguage(
|
|
192
|
+
const lang = _this.applyLanguage(locale2);
|
|
193
193
|
resolve(lang);
|
|
194
194
|
});
|
|
195
195
|
}
|
|
@@ -201,11 +201,11 @@ class I18N {
|
|
|
201
201
|
* @param {Object} lang
|
|
202
202
|
* @return {Object} overriden language
|
|
203
203
|
*/
|
|
204
|
-
applyLanguage(
|
|
205
|
-
const override = this.config.override[
|
|
206
|
-
const existingLang = this.langs[
|
|
207
|
-
this.langs[
|
|
208
|
-
return this.langs[
|
|
204
|
+
applyLanguage(locale2, lang = {}) {
|
|
205
|
+
const override = this.config.override[locale2] || {};
|
|
206
|
+
const existingLang = this.langs[locale2] || {};
|
|
207
|
+
this.langs[locale2] = { ...existingLang, ...lang, ...override };
|
|
208
|
+
return this.langs[locale2];
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* return currently available languages
|
|
@@ -219,10 +219,10 @@ class I18N {
|
|
|
219
219
|
* @param {String} locale
|
|
220
220
|
* @return {Promise} language
|
|
221
221
|
*/
|
|
222
|
-
async setCurrent(
|
|
223
|
-
await this.loadLang(
|
|
224
|
-
this.locale =
|
|
225
|
-
this.current = this.langs[
|
|
222
|
+
async setCurrent(locale2 = "en-US") {
|
|
223
|
+
await this.loadLang(locale2);
|
|
224
|
+
this.locale = locale2;
|
|
225
|
+
this.current = this.langs[locale2];
|
|
226
226
|
return this.current;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -255,9 +255,9 @@ class SmartTooltip {
|
|
|
255
255
|
__publicField(this, "tooltip");
|
|
256
256
|
__publicField(this, "activeTriggerType", null);
|
|
257
257
|
__publicField(this, "spacing", 12);
|
|
258
|
-
__publicField(this, "handleClick", (
|
|
258
|
+
__publicField(this, "handleClick", (e2) => {
|
|
259
259
|
const triggerName = this.triggerName;
|
|
260
|
-
const trigger =
|
|
260
|
+
const trigger = e2.target.closest(`[${triggerName}][${triggerName}-type="click"]`);
|
|
261
261
|
if (trigger) {
|
|
262
262
|
if (this.isVisible()) {
|
|
263
263
|
this.hide();
|
|
@@ -270,9 +270,9 @@ class SmartTooltip {
|
|
|
270
270
|
this.hide();
|
|
271
271
|
}
|
|
272
272
|
});
|
|
273
|
-
__publicField(this, "handleMouseOver", (
|
|
273
|
+
__publicField(this, "handleMouseOver", (e2) => {
|
|
274
274
|
const triggerName = this.triggerName;
|
|
275
|
-
const trigger =
|
|
275
|
+
const trigger = e2.target.closest(`[${triggerName}]`);
|
|
276
276
|
if (this.activeTriggerType !== "click" && (trigger == null ? void 0 : trigger.getAttribute(`${triggerName}-type`)) !== "click") {
|
|
277
277
|
const content = trigger == null ? void 0 : trigger.getAttribute(`${triggerName}`);
|
|
278
278
|
if (content) {
|
|
@@ -281,9 +281,9 @@ class SmartTooltip {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
});
|
|
284
|
-
__publicField(this, "handleMouseOut", (
|
|
284
|
+
__publicField(this, "handleMouseOut", (e2) => {
|
|
285
285
|
const triggerName = this.triggerName;
|
|
286
|
-
const trigger =
|
|
286
|
+
const trigger = e2.target.closest(`[${triggerName}]`);
|
|
287
287
|
if (this.activeTriggerType !== "click" && (trigger == null ? void 0 : trigger.getAttribute(`${triggerName}-type`)) !== "click") {
|
|
288
288
|
this.hide();
|
|
289
289
|
}
|
|
@@ -431,7 +431,7 @@ if (window !== void 0) {
|
|
|
431
431
|
window.SmartTooltip = SmartTooltip;
|
|
432
432
|
}
|
|
433
433
|
const name$1 = "formeo";
|
|
434
|
-
const version$2 = "4.
|
|
434
|
+
const version$2 = "4.2.0";
|
|
435
435
|
const pkg = {
|
|
436
436
|
name: name$1,
|
|
437
437
|
version: version$2
|
|
@@ -665,7 +665,7 @@ function require_getRawTag() {
|
|
|
665
665
|
try {
|
|
666
666
|
value[symToStringTag] = void 0;
|
|
667
667
|
var unmasked = true;
|
|
668
|
-
} catch (
|
|
668
|
+
} catch (e2) {
|
|
669
669
|
}
|
|
670
670
|
var result = nativeObjectToString.call(value);
|
|
671
671
|
if (unmasked) {
|
|
@@ -776,11 +776,11 @@ function require_toSource() {
|
|
|
776
776
|
if (func != null) {
|
|
777
777
|
try {
|
|
778
778
|
return funcToString.call(func);
|
|
779
|
-
} catch (
|
|
779
|
+
} catch (e2) {
|
|
780
780
|
}
|
|
781
781
|
try {
|
|
782
782
|
return func + "";
|
|
783
|
-
} catch (
|
|
783
|
+
} catch (e2) {
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
return "";
|
|
@@ -1126,7 +1126,7 @@ function require_defineProperty() {
|
|
|
1126
1126
|
var func = getNative(Object, "defineProperty");
|
|
1127
1127
|
func({}, "", {});
|
|
1128
1128
|
return func;
|
|
1129
|
-
} catch (
|
|
1129
|
+
} catch (e2) {
|
|
1130
1130
|
}
|
|
1131
1131
|
})();
|
|
1132
1132
|
_defineProperty$1 = defineProperty;
|
|
@@ -1537,7 +1537,7 @@ function require_nodeUtil() {
|
|
|
1537
1537
|
return types;
|
|
1538
1538
|
}
|
|
1539
1539
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1540
|
-
} catch (
|
|
1540
|
+
} catch (e2) {
|
|
1541
1541
|
}
|
|
1542
1542
|
})();
|
|
1543
1543
|
module.exports = nodeUtil;
|
|
@@ -2070,8 +2070,8 @@ const clone$1 = (obj) => {
|
|
|
2070
2070
|
}
|
|
2071
2071
|
if (Array.isArray(obj)) {
|
|
2072
2072
|
copy = [];
|
|
2073
|
-
for (let
|
|
2074
|
-
copy[
|
|
2073
|
+
for (let i2 = 0, len = obj.length; i2 < len; i2++) {
|
|
2074
|
+
copy[i2] = clone$1(obj[i2]);
|
|
2075
2075
|
}
|
|
2076
2076
|
return copy;
|
|
2077
2077
|
}
|
|
@@ -2143,8 +2143,8 @@ function parseData(data = /* @__PURE__ */ Object.create(null)) {
|
|
|
2143
2143
|
if (typeof data === "string") {
|
|
2144
2144
|
try {
|
|
2145
2145
|
return JSON.parse(data);
|
|
2146
|
-
} catch (
|
|
2147
|
-
console.error("Invalid JSON string provided:",
|
|
2146
|
+
} catch (e2) {
|
|
2147
|
+
console.error("Invalid JSON string provided:", e2);
|
|
2148
2148
|
return /* @__PURE__ */ Object.create(null);
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
@@ -2166,20 +2166,17 @@ function buildFlatDataStructure(data, componentId, componentType2, result = {})
|
|
|
2166
2166
|
}
|
|
2167
2167
|
return result;
|
|
2168
2168
|
}
|
|
2169
|
+
let BUNDLED_SVG_SPRITE = null;
|
|
2170
|
+
try {
|
|
2171
|
+
BUNDLED_SVG_SPRITE = require("../../lib/icons/formeo-sprite.svg?raw");
|
|
2172
|
+
} catch (e2) {
|
|
2173
|
+
}
|
|
2169
2174
|
const name = pkg.name;
|
|
2170
2175
|
const version$1 = pkg.version;
|
|
2171
2176
|
const PACKAGE_NAME = name;
|
|
2172
2177
|
const formeoSpriteId = "formeo-sprite";
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2175
|
-
{ name: "mutationObserver", src: "//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js" },
|
|
2176
|
-
{ name: "fetch", src: "https://unpkg.com/unfetch/polyfill" }
|
|
2177
|
-
];
|
|
2178
|
-
const relativeSpritePath = `../../lib/icons/${formeoSpriteId}.svg`;
|
|
2179
|
-
const localSpriteUrl = typeof import.meta.resolve === "function" ? import.meta.resolve(relativeSpritePath) : relativeSpritePath;
|
|
2180
|
-
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development" || false;
|
|
2181
|
-
const SVG_SPRITE_URL = isDev ? localSpriteUrl : `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
2182
|
-
const FALLBACK_SVG_SPRITE_URL = `https://draggable.github.io/formeo/assets/img/${formeoSpriteId}.svg`;
|
|
2178
|
+
const SVG_SPRITE_URL = null;
|
|
2179
|
+
const FALLBACK_SVG_SPRITE_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
2183
2180
|
const CSS_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/formeo.min.css`;
|
|
2184
2181
|
const FALLBACK_CSS_URL = "https://draggable.github.io/formeo/assets/css/formeo.min.css";
|
|
2185
2182
|
const PANEL_CLASSNAME = "f-panel";
|
|
@@ -3462,9 +3459,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
3462
3459
|
return keys;
|
|
3463
3460
|
}
|
|
3464
3461
|
function _objectSpread2(target) {
|
|
3465
|
-
for (var
|
|
3466
|
-
var source = arguments[
|
|
3467
|
-
if (
|
|
3462
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3463
|
+
var source = arguments[i2] != null ? arguments[i2] : {};
|
|
3464
|
+
if (i2 % 2) {
|
|
3468
3465
|
ownKeys(Object(source), true).forEach(function(key) {
|
|
3469
3466
|
_defineProperty(target, key, source[key]);
|
|
3470
3467
|
});
|
|
@@ -3506,8 +3503,8 @@ function _defineProperty(obj, key, value) {
|
|
|
3506
3503
|
}
|
|
3507
3504
|
function _extends() {
|
|
3508
3505
|
_extends = Object.assign || function(target) {
|
|
3509
|
-
for (var
|
|
3510
|
-
var source = arguments[
|
|
3506
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3507
|
+
var source = arguments[i2];
|
|
3511
3508
|
for (var key in source) {
|
|
3512
3509
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3513
3510
|
target[key] = source[key];
|
|
@@ -3522,9 +3519,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
3522
3519
|
if (source == null) return {};
|
|
3523
3520
|
var target = {};
|
|
3524
3521
|
var sourceKeys = Object.keys(source);
|
|
3525
|
-
var key,
|
|
3526
|
-
for (
|
|
3527
|
-
key = sourceKeys[
|
|
3522
|
+
var key, i2;
|
|
3523
|
+
for (i2 = 0; i2 < sourceKeys.length; i2++) {
|
|
3524
|
+
key = sourceKeys[i2];
|
|
3528
3525
|
if (excluded.indexOf(key) >= 0) continue;
|
|
3529
3526
|
target[key] = source[key];
|
|
3530
3527
|
}
|
|
@@ -3533,11 +3530,11 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
3533
3530
|
function _objectWithoutProperties(source, excluded) {
|
|
3534
3531
|
if (source == null) return {};
|
|
3535
3532
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
3536
|
-
var key,
|
|
3533
|
+
var key, i2;
|
|
3537
3534
|
if (Object.getOwnPropertySymbols) {
|
|
3538
3535
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
3539
|
-
for (
|
|
3540
|
-
key = sourceSymbolKeys[
|
|
3536
|
+
for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
|
|
3537
|
+
key = sourceSymbolKeys[i2];
|
|
3541
3538
|
if (excluded.indexOf(key) >= 0) continue;
|
|
3542
3539
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
3543
3540
|
target[key] = source[key];
|
|
@@ -3646,10 +3643,10 @@ function matrix(el, selfOnly) {
|
|
|
3646
3643
|
}
|
|
3647
3644
|
function find(ctx, tagName, iterator) {
|
|
3648
3645
|
if (ctx) {
|
|
3649
|
-
var list = ctx.getElementsByTagName(tagName),
|
|
3646
|
+
var list = ctx.getElementsByTagName(tagName), i2 = 0, n = list.length;
|
|
3650
3647
|
if (iterator) {
|
|
3651
|
-
for (;
|
|
3652
|
-
iterator(list[
|
|
3648
|
+
for (; i2 < n; i2++) {
|
|
3649
|
+
iterator(list[i2], i2);
|
|
3653
3650
|
}
|
|
3654
3651
|
}
|
|
3655
3652
|
return list;
|
|
@@ -3732,15 +3729,15 @@ function isScrolledPast(el, elSide, parentSide) {
|
|
|
3732
3729
|
return false;
|
|
3733
3730
|
}
|
|
3734
3731
|
function getChild(el, childNum, options, includeDragEl) {
|
|
3735
|
-
var currentChild = 0,
|
|
3736
|
-
while (
|
|
3737
|
-
if (children[
|
|
3732
|
+
var currentChild = 0, i2 = 0, children = el.children;
|
|
3733
|
+
while (i2 < children.length) {
|
|
3734
|
+
if (children[i2].style.display !== "none" && children[i2] !== Sortable.ghost && (includeDragEl || children[i2] !== Sortable.dragged) && closest(children[i2], options.draggable, el, false)) {
|
|
3738
3735
|
if (currentChild === childNum) {
|
|
3739
|
-
return children[
|
|
3736
|
+
return children[i2];
|
|
3740
3737
|
}
|
|
3741
3738
|
currentChild++;
|
|
3742
3739
|
}
|
|
3743
|
-
|
|
3740
|
+
i2++;
|
|
3744
3741
|
}
|
|
3745
3742
|
return null;
|
|
3746
3743
|
}
|
|
@@ -3775,10 +3772,10 @@ function getRelativeScrollOffset(el) {
|
|
|
3775
3772
|
return [offsetLeft, offsetTop];
|
|
3776
3773
|
}
|
|
3777
3774
|
function indexOfObject(arr, obj) {
|
|
3778
|
-
for (var
|
|
3779
|
-
if (!arr.hasOwnProperty(
|
|
3775
|
+
for (var i2 in arr) {
|
|
3776
|
+
if (!arr.hasOwnProperty(i2)) continue;
|
|
3780
3777
|
for (var key in obj) {
|
|
3781
|
-
if (obj.hasOwnProperty(key) && obj[key] === arr[
|
|
3778
|
+
if (obj.hasOwnProperty(key) && obj[key] === arr[i2][key]) return Number(i2);
|
|
3782
3779
|
}
|
|
3783
3780
|
}
|
|
3784
3781
|
return -1;
|
|
@@ -4231,9 +4228,9 @@ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt)
|
|
|
4231
4228
|
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
|
|
4232
4229
|
if (nearest) {
|
|
4233
4230
|
var event = {};
|
|
4234
|
-
for (var
|
|
4235
|
-
if (evt.hasOwnProperty(
|
|
4236
|
-
event[
|
|
4231
|
+
for (var i2 in evt) {
|
|
4232
|
+
if (evt.hasOwnProperty(i2)) {
|
|
4233
|
+
event[i2] = evt[i2];
|
|
4237
4234
|
}
|
|
4238
4235
|
}
|
|
4239
4236
|
event.target = event.rootEl = nearest;
|
|
@@ -4482,8 +4479,8 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
4482
4479
|
}
|
|
4483
4480
|
}
|
|
4484
4481
|
},
|
|
4485
|
-
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
|
|
4486
|
-
var touch =
|
|
4482
|
+
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e2) {
|
|
4483
|
+
var touch = e2.touches ? e2.touches[0] : e2;
|
|
4487
4484
|
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))) {
|
|
4488
4485
|
this._disableDelayedDrag();
|
|
4489
4486
|
}
|
|
@@ -5084,9 +5081,9 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
5084
5081
|
* @returns {String[]}
|
|
5085
5082
|
*/
|
|
5086
5083
|
toArray: function toArray() {
|
|
5087
|
-
var order = [], el, children = this.el.children,
|
|
5088
|
-
for (;
|
|
5089
|
-
el = children[
|
|
5084
|
+
var order = [], el, children = this.el.children, i2 = 0, n = children.length, options = this.options;
|
|
5085
|
+
for (; i2 < n; i2++) {
|
|
5086
|
+
el = children[i2];
|
|
5090
5087
|
if (closest(el, options.draggable, this.el, false)) {
|
|
5091
5088
|
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
|
5092
5089
|
}
|
|
@@ -5099,8 +5096,8 @@ Sortable.prototype = /** @lends Sortable.prototype */
|
|
|
5099
5096
|
*/
|
|
5100
5097
|
sort: function sort(order, useAnimation) {
|
|
5101
5098
|
var items = {}, rootEl2 = this.el;
|
|
5102
|
-
this.toArray().forEach(function(id,
|
|
5103
|
-
var el = rootEl2.children[
|
|
5099
|
+
this.toArray().forEach(function(id, i2) {
|
|
5100
|
+
var el = rootEl2.children[i2];
|
|
5104
5101
|
if (closest(el, this.options.draggable, rootEl2, false)) {
|
|
5105
5102
|
items[id] = el;
|
|
5106
5103
|
}
|
|
@@ -5293,9 +5290,9 @@ function _getInsertDirection(target) {
|
|
|
5293
5290
|
}
|
|
5294
5291
|
}
|
|
5295
5292
|
function _generateId(el) {
|
|
5296
|
-
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
|
5297
|
-
while (
|
|
5298
|
-
sum += str.charCodeAt(
|
|
5293
|
+
var str = el.tagName + el.className + el.src + el.href + el.textContent, i2 = str.length, sum = 0;
|
|
5294
|
+
while (i2--) {
|
|
5295
|
+
sum += str.charCodeAt(i2);
|
|
5299
5296
|
}
|
|
5300
5297
|
return sum.toString(36);
|
|
5301
5298
|
}
|
|
@@ -5487,9 +5484,9 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
|
|
|
5487
5484
|
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
|
|
5488
5485
|
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
|
|
5489
5486
|
if (!autoScrolls[layersOut]) {
|
|
5490
|
-
for (var
|
|
5491
|
-
if (!autoScrolls[
|
|
5492
|
-
autoScrolls[
|
|
5487
|
+
for (var i2 = 0; i2 <= layersOut; i2++) {
|
|
5488
|
+
if (!autoScrolls[i2]) {
|
|
5489
|
+
autoScrolls[i2] = {};
|
|
5493
5490
|
}
|
|
5494
5491
|
}
|
|
5495
5492
|
}
|
|
@@ -5689,13 +5686,13 @@ const orderObjectsBy = (elements, order, path) => {
|
|
|
5689
5686
|
return unique(orderedElements);
|
|
5690
5687
|
};
|
|
5691
5688
|
const forEach = (arr, cb, scope) => {
|
|
5692
|
-
for (let
|
|
5693
|
-
cb.call(scope, arr[
|
|
5689
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
5690
|
+
cb.call(scope, arr[i2], i2);
|
|
5694
5691
|
}
|
|
5695
5692
|
};
|
|
5696
5693
|
const map = (arr, cb) => {
|
|
5697
5694
|
const newArray = [];
|
|
5698
|
-
forEach(arr, (elem,
|
|
5695
|
+
forEach(arr, (elem, i2) => newArray.push(cb(elem, i2)));
|
|
5699
5696
|
return newArray;
|
|
5700
5697
|
};
|
|
5701
5698
|
const sanitizedAttributeNames = {};
|
|
@@ -5714,7 +5711,6 @@ const safeAttrName = (name2) => {
|
|
|
5714
5711
|
const capitalize = (str) => str.replace(/\b\w/g, (m) => m.toUpperCase());
|
|
5715
5712
|
const copyObj = (obj) => window.JSON.parse(window.JSON.stringify(obj));
|
|
5716
5713
|
const subtract = (arr, from) => from.filter((a) => !~arr.indexOf(a));
|
|
5717
|
-
const isIE = () => window.navigator.userAgent.indexOf("MSIE ") !== -1;
|
|
5718
5714
|
const helpers = {
|
|
5719
5715
|
capitalize,
|
|
5720
5716
|
safeAttrName,
|
|
@@ -5726,8 +5722,119 @@ const helpers = {
|
|
|
5726
5722
|
indexOfNode,
|
|
5727
5723
|
isInt,
|
|
5728
5724
|
get,
|
|
5729
|
-
orderObjectsBy
|
|
5730
|
-
|
|
5725
|
+
orderObjectsBy
|
|
5726
|
+
};
|
|
5727
|
+
const loaded = {
|
|
5728
|
+
js: /* @__PURE__ */ new Set(),
|
|
5729
|
+
css: /* @__PURE__ */ new Set(),
|
|
5730
|
+
formeoSprite: null
|
|
5731
|
+
};
|
|
5732
|
+
const ajax = (fileUrl, callback, onError = noop) => {
|
|
5733
|
+
return new Promise((resolve) => {
|
|
5734
|
+
return fetch(fileUrl).then((data) => {
|
|
5735
|
+
if (!data.ok) {
|
|
5736
|
+
return resolve(onError(data));
|
|
5737
|
+
}
|
|
5738
|
+
resolve(callback ? callback(data) : data);
|
|
5739
|
+
}).catch((err) => onError(err));
|
|
5740
|
+
});
|
|
5741
|
+
};
|
|
5742
|
+
const onLoadStylesheet = (elem, cb) => {
|
|
5743
|
+
elem.removeEventListener("load", onLoadStylesheet);
|
|
5744
|
+
cb(elem.src);
|
|
5745
|
+
};
|
|
5746
|
+
const onLoadJavascript = (elem, cb) => {
|
|
5747
|
+
elem.removeEventListener("load", onLoadJavascript);
|
|
5748
|
+
cb(elem.src);
|
|
5749
|
+
};
|
|
5750
|
+
const insertScript = (src) => {
|
|
5751
|
+
return new Promise((resolve, reject) => {
|
|
5752
|
+
if (loaded.js.has(src)) {
|
|
5753
|
+
return resolve(src);
|
|
5754
|
+
}
|
|
5755
|
+
loaded.js.add(src);
|
|
5756
|
+
const script = dom.create({
|
|
5757
|
+
tag: "script",
|
|
5758
|
+
attrs: {
|
|
5759
|
+
type: "text/javascript",
|
|
5760
|
+
async: true,
|
|
5761
|
+
src
|
|
5762
|
+
},
|
|
5763
|
+
action: {
|
|
5764
|
+
load: () => onLoadJavascript(script, resolve),
|
|
5765
|
+
error: () => reject(new Error(`${src} failed to load.`))
|
|
5766
|
+
}
|
|
5767
|
+
});
|
|
5768
|
+
document.head.appendChild(script);
|
|
5769
|
+
});
|
|
5770
|
+
};
|
|
5771
|
+
const insertStyle = (srcs) => {
|
|
5772
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5773
|
+
const promises = srcs.map(
|
|
5774
|
+
(src) => new Promise((resolve, reject) => {
|
|
5775
|
+
if (loaded.css.has(src)) {
|
|
5776
|
+
return resolve(src);
|
|
5777
|
+
}
|
|
5778
|
+
loaded.css.add(src);
|
|
5779
|
+
const styleLink = dom.create({
|
|
5780
|
+
tag: "link",
|
|
5781
|
+
attrs: {
|
|
5782
|
+
rel: "stylesheet",
|
|
5783
|
+
href: src
|
|
5784
|
+
},
|
|
5785
|
+
action: {
|
|
5786
|
+
load: () => onLoadStylesheet(styleLink, resolve),
|
|
5787
|
+
error: () => reject(new Error(`${(void 0).src} failed to load.`))
|
|
5788
|
+
}
|
|
5789
|
+
});
|
|
5790
|
+
document.head.appendChild(styleLink);
|
|
5791
|
+
})
|
|
5792
|
+
);
|
|
5793
|
+
return Promise.all(promises);
|
|
5794
|
+
};
|
|
5795
|
+
const insertScripts = (srcs) => {
|
|
5796
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5797
|
+
const promises = srcs.map((src) => insertScript(src));
|
|
5798
|
+
return Promise.all(promises);
|
|
5799
|
+
};
|
|
5800
|
+
const insertStyles = (srcs) => {
|
|
5801
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5802
|
+
const promises = srcs.map((src) => insertStyle(src));
|
|
5803
|
+
return Promise.all(promises);
|
|
5804
|
+
};
|
|
5805
|
+
const insertIcons = (iconSvgStr) => {
|
|
5806
|
+
const parser = new DOMParser();
|
|
5807
|
+
const svgDoc = parser.parseFromString(iconSvgStr, "image/svg+xml");
|
|
5808
|
+
loaded.formeoSprite = svgDoc.documentElement;
|
|
5809
|
+
return loaded.formeoSprite;
|
|
5810
|
+
};
|
|
5811
|
+
const fetchIcons = async (iconSpriteUrl = SVG_SPRITE_URL) => {
|
|
5812
|
+
if (loaded.formeoSprite) {
|
|
5813
|
+
return loaded.formeoSprite;
|
|
5814
|
+
}
|
|
5815
|
+
if (!iconSpriteUrl) {
|
|
5816
|
+
return insertIcons(BUNDLED_SVG_SPRITE);
|
|
5817
|
+
}
|
|
5818
|
+
const parseResp = async (resp) => insertIcons(await resp.text());
|
|
5819
|
+
return ajax(iconSpriteUrl, parseResp, () => ajax(FALLBACK_SVG_SPRITE_URL, parseResp));
|
|
5820
|
+
};
|
|
5821
|
+
const LOADER_MAP = {
|
|
5822
|
+
js: insertScripts,
|
|
5823
|
+
css: insertStyles
|
|
5824
|
+
};
|
|
5825
|
+
const fetchDependencies = (dependencies) => {
|
|
5826
|
+
const promises = Object.entries(dependencies).map(([type, src]) => {
|
|
5827
|
+
return LOADER_MAP[type](src);
|
|
5828
|
+
});
|
|
5829
|
+
return Promise.all(promises);
|
|
5830
|
+
};
|
|
5831
|
+
const fetchFormeoStyle = async (cssUrl) => {
|
|
5832
|
+
if (!loaded.css.has(cssUrl)) {
|
|
5833
|
+
await insertStyle(cssUrl);
|
|
5834
|
+
if (!loaded.css.has(FALLBACK_CSS_URL)) {
|
|
5835
|
+
return await insertStyle(FALLBACK_CSS_URL);
|
|
5836
|
+
}
|
|
5837
|
+
}
|
|
5731
5838
|
};
|
|
5732
5839
|
const iconFontTemplates = {
|
|
5733
5840
|
glyphicons: (icon) => `<span class="glyphicon glyphicon-${icon}" aria-hidden="true"></span>`,
|
|
@@ -5822,7 +5929,7 @@ class DOM {
|
|
|
5822
5929
|
processed.push("tag");
|
|
5823
5930
|
let childType;
|
|
5824
5931
|
const { tag } = elem;
|
|
5825
|
-
let
|
|
5932
|
+
let i2;
|
|
5826
5933
|
const wrap = {
|
|
5827
5934
|
attrs: {},
|
|
5828
5935
|
className: [helpers.get(elem, "config.inputWrap")],
|
|
@@ -5916,8 +6023,8 @@ class DOM {
|
|
|
5916
6023
|
processed.push("action");
|
|
5917
6024
|
}
|
|
5918
6025
|
const remaining = helpers.subtract(processed, Object.keys(elem));
|
|
5919
|
-
for (
|
|
5920
|
-
element[remaining[
|
|
6026
|
+
for (i2 = remaining.length - 1; i2 >= 0; i2--) {
|
|
6027
|
+
element[remaining[i2]] = elem[remaining[i2]];
|
|
5921
6028
|
}
|
|
5922
6029
|
if (wrap.children.length) {
|
|
5923
6030
|
element = this.create(wrap);
|
|
@@ -5957,25 +6064,26 @@ class DOM {
|
|
|
5957
6064
|
if (this.iconSymbols) {
|
|
5958
6065
|
return this.iconSymbols;
|
|
5959
6066
|
}
|
|
5960
|
-
const iconSymbolNodes =
|
|
5961
|
-
const createSvgIconConfig = (
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
}
|
|
5974
|
-
|
|
5975
|
-
|
|
6067
|
+
const iconSymbolNodes = loaded.formeoSprite.querySelectorAll("svg symbol");
|
|
6068
|
+
const createSvgIconConfig = (symbol) => {
|
|
6069
|
+
const viewBox = symbol.getAttribute("viewBox") || "0 0 24 24";
|
|
6070
|
+
const children = Array.from(symbol.children).map((child) => {
|
|
6071
|
+
const clonedNode = child.cloneNode(true);
|
|
6072
|
+
return clonedNode.outerHTML;
|
|
6073
|
+
}).join("");
|
|
6074
|
+
return {
|
|
6075
|
+
tag: "svg",
|
|
6076
|
+
attrs: {
|
|
6077
|
+
className: ["svg-icon", symbol.id],
|
|
6078
|
+
viewBox,
|
|
6079
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
6080
|
+
},
|
|
6081
|
+
children
|
|
6082
|
+
};
|
|
6083
|
+
};
|
|
5976
6084
|
this.iconSymbols = Array.from(iconSymbolNodes).reduce((acc, symbol) => {
|
|
5977
6085
|
const name2 = symbol.id.replace(iconPrefix, "");
|
|
5978
|
-
acc[name2] = createSvgIconConfig(symbol
|
|
6086
|
+
acc[name2] = createSvgIconConfig(symbol);
|
|
5979
6087
|
return acc;
|
|
5980
6088
|
}, {});
|
|
5981
6089
|
this.cachedIcons = {};
|
|
@@ -6083,19 +6191,19 @@ class DOM {
|
|
|
6083
6191
|
});
|
|
6084
6192
|
return elementsContainingText;
|
|
6085
6193
|
};
|
|
6086
|
-
generateOption = ({ type = "option", label, value, i = 0, selected }) => {
|
|
6194
|
+
generateOption = ({ type = "option", label, value, i: i2 = 0, selected }) => {
|
|
6087
6195
|
const isOption = type === "option";
|
|
6088
6196
|
return {
|
|
6089
6197
|
tag: isOption ? "option" : "input",
|
|
6090
6198
|
attrs: {
|
|
6091
6199
|
type,
|
|
6092
|
-
value: value || `${type}-${
|
|
6093
|
-
[type === "option" ? "selected" : "checked"]: selected || !
|
|
6200
|
+
value: value || `${type}-${i2}`,
|
|
6201
|
+
[type === "option" ? "selected" : "checked"]: selected || !i2
|
|
6094
6202
|
},
|
|
6095
6203
|
config: {
|
|
6096
6204
|
label: label || mi18n.get("labelCount", {
|
|
6097
6205
|
label: mi18n.get("option"),
|
|
6098
|
-
count:
|
|
6206
|
+
count: i2
|
|
6099
6207
|
})
|
|
6100
6208
|
}
|
|
6101
6209
|
};
|
|
@@ -6111,7 +6219,7 @@ class DOM {
|
|
|
6111
6219
|
const { action, attrs = {} } = elem;
|
|
6112
6220
|
const fieldType = attrs.type || elem.tag;
|
|
6113
6221
|
const id = attrs.id || elem.id;
|
|
6114
|
-
const optionMap = (option2,
|
|
6222
|
+
const optionMap = (option2, i2) => {
|
|
6115
6223
|
const { label, value, ...rest } = option2;
|
|
6116
6224
|
const defaultInput = () => {
|
|
6117
6225
|
const input = {
|
|
@@ -6120,7 +6228,7 @@ class DOM {
|
|
|
6120
6228
|
name: id,
|
|
6121
6229
|
type: fieldType,
|
|
6122
6230
|
value: value || "",
|
|
6123
|
-
id: `${id}-${
|
|
6231
|
+
id: `${id}-${i2}`,
|
|
6124
6232
|
...rest
|
|
6125
6233
|
},
|
|
6126
6234
|
action
|
|
@@ -6128,7 +6236,7 @@ class DOM {
|
|
|
6128
6236
|
const optionLabel = {
|
|
6129
6237
|
tag: "label",
|
|
6130
6238
|
attrs: {
|
|
6131
|
-
for: `${id}-${
|
|
6239
|
+
for: `${id}-${i2}`
|
|
6132
6240
|
},
|
|
6133
6241
|
children: label
|
|
6134
6242
|
};
|
|
@@ -6661,7 +6769,7 @@ class Autocomplete {
|
|
|
6661
6769
|
* @return {Object} DOM Element to be injected into the form.
|
|
6662
6770
|
*/
|
|
6663
6771
|
build() {
|
|
6664
|
-
const keyboardNav = (
|
|
6772
|
+
const keyboardNav = (e2) => {
|
|
6665
6773
|
const list = this.list;
|
|
6666
6774
|
const activeOption = this.getActiveOption();
|
|
6667
6775
|
const keyCodeMap = /* @__PURE__ */ new Map([
|
|
@@ -6698,7 +6806,7 @@ class Autocomplete {
|
|
|
6698
6806
|
this.hideList();
|
|
6699
6807
|
}
|
|
6700
6808
|
}
|
|
6701
|
-
|
|
6809
|
+
e2.preventDefault();
|
|
6702
6810
|
}
|
|
6703
6811
|
],
|
|
6704
6812
|
[
|
|
@@ -6709,7 +6817,7 @@ class Autocomplete {
|
|
|
6709
6817
|
}
|
|
6710
6818
|
]
|
|
6711
6819
|
]);
|
|
6712
|
-
let direction = keyCodeMap.get(
|
|
6820
|
+
let direction = keyCodeMap.get(e2.keyCode);
|
|
6713
6821
|
if (!direction) {
|
|
6714
6822
|
direction = () => false;
|
|
6715
6823
|
}
|
|
@@ -7898,7 +8006,7 @@ class Panels {
|
|
|
7898
8006
|
placement: "top"
|
|
7899
8007
|
},
|
|
7900
8008
|
action: {
|
|
7901
|
-
click: (
|
|
8009
|
+
click: (e2) => this.nav.nextGroup(e2)
|
|
7902
8010
|
},
|
|
7903
8011
|
content: dom.icon("triangle-right")
|
|
7904
8012
|
};
|
|
@@ -7914,7 +8022,7 @@ class Panels {
|
|
|
7914
8022
|
placement: "top"
|
|
7915
8023
|
},
|
|
7916
8024
|
action: {
|
|
7917
|
-
click: (
|
|
8025
|
+
click: (e2) => this.nav.prevGroup(e2)
|
|
7918
8026
|
},
|
|
7919
8027
|
content: dom.icon("triangle-left")
|
|
7920
8028
|
};
|
|
@@ -8251,12 +8359,7 @@ class Component extends Data {
|
|
|
8251
8359
|
return dom.create({
|
|
8252
8360
|
tag: "span",
|
|
8253
8361
|
className: ["component-tag", `${this.name}-tag`],
|
|
8254
|
-
children: [
|
|
8255
|
-
(this.isColumn || this.isField) && dom.icon("component-corner", { className: "bottom-left" }),
|
|
8256
|
-
dom.icon(`handle-${this.name}`),
|
|
8257
|
-
toTitleCase(this.name),
|
|
8258
|
-
(this.isColumn || this.isRow) && dom.icon("component-corner", { className: "bottom-right" })
|
|
8259
|
-
].filter(Boolean)
|
|
8362
|
+
children: [dom.icon(`handle-${this.name}`), toTitleCase(this.name)].filter(Boolean)
|
|
8260
8363
|
});
|
|
8261
8364
|
};
|
|
8262
8365
|
/**
|
|
@@ -9320,8 +9423,8 @@ class Row extends Component {
|
|
|
9320
9423
|
if (typeof widths === "string") {
|
|
9321
9424
|
widths = widths.split(",");
|
|
9322
9425
|
}
|
|
9323
|
-
this.children.forEach((column,
|
|
9324
|
-
column.setWidth(`${widths[
|
|
9426
|
+
this.children.forEach((column, i2) => {
|
|
9427
|
+
column.setWidth(`${widths[i2]}%`);
|
|
9325
9428
|
column.refreshFieldPanels();
|
|
9326
9429
|
});
|
|
9327
9430
|
};
|
|
@@ -9522,133 +9625,6 @@ let Stages$1 = class Stages extends ComponentData {
|
|
|
9522
9625
|
}
|
|
9523
9626
|
};
|
|
9524
9627
|
const stages = new Stages$1();
|
|
9525
|
-
const loaded = {
|
|
9526
|
-
js: /* @__PURE__ */ new Set(),
|
|
9527
|
-
css: /* @__PURE__ */ new Set()
|
|
9528
|
-
};
|
|
9529
|
-
const ajax = (fileUrl, callback, onError = noop) => {
|
|
9530
|
-
return new Promise((resolve) => {
|
|
9531
|
-
return fetch(fileUrl).then((data) => {
|
|
9532
|
-
if (!data.ok) {
|
|
9533
|
-
return resolve(onError(data));
|
|
9534
|
-
}
|
|
9535
|
-
resolve(callback ? callback(data) : data);
|
|
9536
|
-
}).catch((err) => onError(err));
|
|
9537
|
-
});
|
|
9538
|
-
};
|
|
9539
|
-
const onLoadStylesheet = (elem, cb) => {
|
|
9540
|
-
elem.removeEventListener("load", onLoadStylesheet);
|
|
9541
|
-
cb(elem.src);
|
|
9542
|
-
};
|
|
9543
|
-
const onLoadJavascript = (elem, cb) => {
|
|
9544
|
-
elem.removeEventListener("load", onLoadJavascript);
|
|
9545
|
-
cb(elem.src);
|
|
9546
|
-
};
|
|
9547
|
-
const insertScript = (src) => {
|
|
9548
|
-
return new Promise((resolve, reject) => {
|
|
9549
|
-
if (loaded.js.has(src)) {
|
|
9550
|
-
return resolve(src);
|
|
9551
|
-
}
|
|
9552
|
-
loaded.js.add(src);
|
|
9553
|
-
const script = dom.create({
|
|
9554
|
-
tag: "script",
|
|
9555
|
-
attrs: {
|
|
9556
|
-
type: "text/javascript",
|
|
9557
|
-
async: true,
|
|
9558
|
-
src
|
|
9559
|
-
},
|
|
9560
|
-
action: {
|
|
9561
|
-
load: () => onLoadJavascript(script, resolve),
|
|
9562
|
-
error: () => reject(new Error(`${src} failed to load.`))
|
|
9563
|
-
}
|
|
9564
|
-
});
|
|
9565
|
-
document.head.appendChild(script);
|
|
9566
|
-
});
|
|
9567
|
-
};
|
|
9568
|
-
const insertStyle = (srcs) => {
|
|
9569
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9570
|
-
const promises = srcs.map(
|
|
9571
|
-
(src) => new Promise((resolve, reject) => {
|
|
9572
|
-
if (loaded.css.has(src)) {
|
|
9573
|
-
return resolve(src);
|
|
9574
|
-
}
|
|
9575
|
-
loaded.css.add(src);
|
|
9576
|
-
const styleLink = dom.create({
|
|
9577
|
-
tag: "link",
|
|
9578
|
-
attrs: {
|
|
9579
|
-
rel: "stylesheet",
|
|
9580
|
-
href: src
|
|
9581
|
-
},
|
|
9582
|
-
action: {
|
|
9583
|
-
load: () => onLoadStylesheet(styleLink, resolve),
|
|
9584
|
-
error: () => reject(new Error(`${(void 0).src} failed to load.`))
|
|
9585
|
-
}
|
|
9586
|
-
});
|
|
9587
|
-
document.head.appendChild(styleLink);
|
|
9588
|
-
})
|
|
9589
|
-
);
|
|
9590
|
-
return Promise.all(promises);
|
|
9591
|
-
};
|
|
9592
|
-
const insertScripts = (srcs) => {
|
|
9593
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9594
|
-
const promises = srcs.map((src) => insertScript(src));
|
|
9595
|
-
return Promise.all(promises);
|
|
9596
|
-
};
|
|
9597
|
-
const insertStyles = (srcs) => {
|
|
9598
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9599
|
-
const promises = srcs.map((src) => insertStyle(src));
|
|
9600
|
-
return Promise.all(promises);
|
|
9601
|
-
};
|
|
9602
|
-
const insertIcons = (iconSvgStr) => {
|
|
9603
|
-
let iconSpriteWrap = document.getElementById(formeoSpriteId);
|
|
9604
|
-
if (!iconSpriteWrap) {
|
|
9605
|
-
iconSpriteWrap = dom.create({
|
|
9606
|
-
id: formeoSpriteId,
|
|
9607
|
-
children: iconSvgStr,
|
|
9608
|
-
attrs: {
|
|
9609
|
-
hidden: true,
|
|
9610
|
-
style: "display: none;"
|
|
9611
|
-
}
|
|
9612
|
-
});
|
|
9613
|
-
document.body.insertBefore(iconSpriteWrap, document.body.childNodes[0]);
|
|
9614
|
-
}
|
|
9615
|
-
return iconSpriteWrap;
|
|
9616
|
-
};
|
|
9617
|
-
const fetchIcons = async (iconSpriteUrl = SVG_SPRITE_URL) => {
|
|
9618
|
-
const formeoSprite = document.getElementById(formeoSpriteId);
|
|
9619
|
-
if (formeoSprite) {
|
|
9620
|
-
return;
|
|
9621
|
-
}
|
|
9622
|
-
const parseResp = async (resp) => insertIcons(await resp.text());
|
|
9623
|
-
return ajax(iconSpriteUrl, parseResp, () => ajax(FALLBACK_SVG_SPRITE_URL, parseResp));
|
|
9624
|
-
};
|
|
9625
|
-
const loadPolyfills = (polyfillConfig) => {
|
|
9626
|
-
const polyfills = Array.isArray(polyfillConfig) ? POLYFILLS.filter(({ name: name2 }) => polyfillConfig.indexOf(name2) !== -1) : POLYFILLS;
|
|
9627
|
-
return Promise.all(polyfills.map(({ src }) => insertScript(src)));
|
|
9628
|
-
};
|
|
9629
|
-
const LOADER_MAP = {
|
|
9630
|
-
js: insertScripts,
|
|
9631
|
-
css: insertStyles
|
|
9632
|
-
};
|
|
9633
|
-
const fetchDependencies = (dependencies) => {
|
|
9634
|
-
const promises = Object.entries(dependencies).map(([type, src]) => {
|
|
9635
|
-
return LOADER_MAP[type](src);
|
|
9636
|
-
});
|
|
9637
|
-
return Promise.all(promises);
|
|
9638
|
-
};
|
|
9639
|
-
const isCssLoaded = () => {
|
|
9640
|
-
const formeoSprite = document.getElementById(formeoSpriteId);
|
|
9641
|
-
const computedStyle = window.getComputedStyle(formeoSprite);
|
|
9642
|
-
return computedStyle.visibility === "hidden";
|
|
9643
|
-
};
|
|
9644
|
-
const fetchFormeoStyle = async (cssUrl) => {
|
|
9645
|
-
if (!isCssLoaded()) {
|
|
9646
|
-
await insertStyle(cssUrl);
|
|
9647
|
-
if (!isCssLoaded()) {
|
|
9648
|
-
return await insertStyle(FALLBACK_CSS_URL);
|
|
9649
|
-
}
|
|
9650
|
-
}
|
|
9651
|
-
};
|
|
9652
9628
|
class Control {
|
|
9653
9629
|
controlCache = /* @__PURE__ */ new Set();
|
|
9654
9630
|
/**
|
|
@@ -9717,9 +9693,9 @@ class Control {
|
|
|
9717
9693
|
* @return {String} the translated label
|
|
9718
9694
|
*/
|
|
9719
9695
|
i18n(lookup, args) {
|
|
9720
|
-
const
|
|
9696
|
+
const locale2 = mi18n.locale;
|
|
9721
9697
|
const controlTranslations = this.definition?.i18n;
|
|
9722
|
-
const localeTranslations = controlTranslations?.[
|
|
9698
|
+
const localeTranslations = controlTranslations?.[locale2] || {};
|
|
9723
9699
|
return (localeTranslations[lookup]?.() ?? localeTranslations[lookup]) || mi18n.get(lookup, args);
|
|
9724
9700
|
}
|
|
9725
9701
|
}
|
|
@@ -9970,12 +9946,12 @@ let Controls$1 = class Controls {
|
|
|
9970
9946
|
// @todo finish the addGroup method
|
|
9971
9947
|
addGroup: (group) => console.log(group)
|
|
9972
9948
|
};
|
|
9973
|
-
for (let
|
|
9974
|
-
const storeID = `formeo-controls-${groups[
|
|
9949
|
+
for (let i2 = groups.length - 1; i2 >= 0; i2--) {
|
|
9950
|
+
const storeID = `formeo-controls-${groups[i2]}`;
|
|
9975
9951
|
if (!this.options.sortable) {
|
|
9976
9952
|
window.localStorage.removeItem(storeID);
|
|
9977
9953
|
}
|
|
9978
|
-
Sortable.create(groups[
|
|
9954
|
+
Sortable.create(groups[i2], {
|
|
9979
9955
|
animation: 150,
|
|
9980
9956
|
forceFallback: true,
|
|
9981
9957
|
fallbackClass: "control-moving",
|
|
@@ -10696,8 +10672,10 @@ const actions = {
|
|
|
10696
10672
|
}
|
|
10697
10673
|
}
|
|
10698
10674
|
};
|
|
10699
|
-
const
|
|
10700
|
-
|
|
10675
|
+
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"];
|
|
10676
|
+
const locale = "en-US";
|
|
10677
|
+
mi18n.addLanguage(locale, i);
|
|
10678
|
+
mi18n.setCurrent(locale);
|
|
10701
10679
|
const defaults = {
|
|
10702
10680
|
get editor() {
|
|
10703
10681
|
return {
|
|
@@ -10708,8 +10686,8 @@ const defaults = {
|
|
|
10708
10686
|
sessionStorage: false,
|
|
10709
10687
|
editorContainer: null,
|
|
10710
10688
|
// element or selector to attach editor to
|
|
10711
|
-
svgSprite:
|
|
10712
|
-
//
|
|
10689
|
+
svgSprite: null,
|
|
10690
|
+
// null = use bundled sprite, or provide custom URL
|
|
10713
10691
|
style: CSS_URL,
|
|
10714
10692
|
// change to null
|
|
10715
10693
|
iconFont: null,
|
|
@@ -10719,8 +10697,6 @@ const defaults = {
|
|
|
10719
10697
|
events: {},
|
|
10720
10698
|
actions: {},
|
|
10721
10699
|
controls: {},
|
|
10722
|
-
polyfills: isIE(),
|
|
10723
|
-
// loads csspreloadrel
|
|
10724
10700
|
i18n: {
|
|
10725
10701
|
location: "https://draggable.github.io/formeo/assets/lang/"
|
|
10726
10702
|
},
|
|
@@ -10729,6 +10705,7 @@ const defaults = {
|
|
|
10729
10705
|
};
|
|
10730
10706
|
}
|
|
10731
10707
|
};
|
|
10708
|
+
new SmartTooltip();
|
|
10732
10709
|
let FormeoEditor$1 = class FormeoEditor {
|
|
10733
10710
|
/**
|
|
10734
10711
|
* @param {Object} options formeo options
|
|
@@ -10749,7 +10726,6 @@ let FormeoEditor$1 = class FormeoEditor {
|
|
|
10749
10726
|
this.dom = dom;
|
|
10750
10727
|
events.init({ debug, ...events$1 });
|
|
10751
10728
|
actions.init({ debug, sessionStorage: opts.sessionStorage, ...actions$1 });
|
|
10752
|
-
this.tooltip = new SmartTooltip();
|
|
10753
10729
|
if (document.readyState === "loading") {
|
|
10754
10730
|
document.addEventListener("DOMContentLoaded", this.loadResources.bind(this));
|
|
10755
10731
|
} else {
|
|
@@ -10785,17 +10761,15 @@ let FormeoEditor$1 = class FormeoEditor {
|
|
|
10785
10761
|
async loadResources() {
|
|
10786
10762
|
document.removeEventListener("DOMContentLoaded", this.loadResources);
|
|
10787
10763
|
const promises = [];
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
const resolvedPromises = await Promise.all(promises);
|
|
10764
|
+
promises.push(
|
|
10765
|
+
fetchIcons(this.opts.svgSprite),
|
|
10766
|
+
fetchFormeoStyle(this.opts.style),
|
|
10767
|
+
mi18n.init({ ...this.opts.i18n, locale: globalThis.sessionStorage?.getItem(SESSION_LOCALE_KEY) })
|
|
10768
|
+
);
|
|
10769
|
+
await Promise.all(promises);
|
|
10795
10770
|
if (this.opts.allowEdit) {
|
|
10796
10771
|
this.init();
|
|
10797
10772
|
}
|
|
10798
|
-
return resolvedPromises;
|
|
10799
10773
|
}
|
|
10800
10774
|
/**
|
|
10801
10775
|
* Formeo initializer
|
|
@@ -10855,7 +10829,7 @@ let FormeoEditor$1 = class FormeoEditor {
|
|
|
10855
10829
|
dom.empty(this.editorContainer);
|
|
10856
10830
|
this.editorContainer.appendChild(this.editor);
|
|
10857
10831
|
}
|
|
10858
|
-
events.formeoLoaded = new
|
|
10832
|
+
events.formeoLoaded = new globalThis.CustomEvent("formeoLoaded", {
|
|
10859
10833
|
detail: {
|
|
10860
10834
|
formeo: this
|
|
10861
10835
|
}
|
|
@@ -11111,8 +11085,8 @@ let FormeoRenderer$1 = class FormeoRenderer {
|
|
|
11111
11085
|
},
|
|
11112
11086
|
children: "Add +",
|
|
11113
11087
|
action: {
|
|
11114
|
-
click: (
|
|
11115
|
-
const fInputGroup =
|
|
11088
|
+
click: (e2) => {
|
|
11089
|
+
const fInputGroup = e2.target.parentElement;
|
|
11116
11090
|
const elem = dom.create(this.cloneComponentData(id));
|
|
11117
11091
|
fInputGroup.insertBefore(elem, fInputGroup.lastChild);
|
|
11118
11092
|
const removeButton = dom.create(createRemoveButton());
|
|
@@ -11345,15 +11319,15 @@ class ButtonControl extends Control {
|
|
|
11345
11319
|
super(mergedConfig);
|
|
11346
11320
|
}
|
|
11347
11321
|
}
|
|
11348
|
-
const generateOptionConfig = ({ type, isMultiple = false, count = 3 }) => Array.from({ length: count }, (_v, k) => k + 1).map((
|
|
11322
|
+
const generateOptionConfig = ({ type, isMultiple = false, count = 3 }) => Array.from({ length: count }, (_v, k) => k + 1).map((i2) => {
|
|
11349
11323
|
const selectedKey = type === "checkbox" || isMultiple ? "checked" : "selected";
|
|
11350
11324
|
return {
|
|
11351
11325
|
label: mi18n.get("labelCount", {
|
|
11352
11326
|
label: toTitleCase(type),
|
|
11353
|
-
count:
|
|
11327
|
+
count: i2
|
|
11354
11328
|
}),
|
|
11355
|
-
value: `${type}-${
|
|
11356
|
-
[selectedKey]: !
|
|
11329
|
+
value: `${type}-${i2}`,
|
|
11330
|
+
[selectedKey]: !i2
|
|
11357
11331
|
};
|
|
11358
11332
|
});
|
|
11359
11333
|
class CheckboxGroupControl extends Control {
|