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
package/dist/formeo.min.js
CHANGED
|
@@ -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
|
|
|
@@ -53,8 +53,8 @@ Author: Draggable https://draggable.io
|
|
|
53
53
|
this.config = { location: parsedLocation, ...restOptions };
|
|
54
54
|
const { override, preloaded = {} } = this.config;
|
|
55
55
|
const allLangs = Object.entries(this.langs).concat(Object.entries(override || preloaded));
|
|
56
|
-
this.langs = allLangs.reduce((acc, [
|
|
57
|
-
acc[
|
|
56
|
+
this.langs = allLangs.reduce((acc, [locale2, lang]) => {
|
|
57
|
+
acc[locale2] = this.applyLanguage(locale2, lang);
|
|
58
58
|
return acc;
|
|
59
59
|
}, {});
|
|
60
60
|
this.locale = this.config.locale || this.config.langs[0];
|
|
@@ -73,9 +73,9 @@ Author: Draggable https://draggable.io
|
|
|
73
73
|
* @param {String} locale
|
|
74
74
|
* @param {String|Object} lang
|
|
75
75
|
*/
|
|
76
|
-
addLanguage(
|
|
76
|
+
addLanguage(locale2, lang = {}) {
|
|
77
77
|
lang = typeof lang === "string" ? I18N.processFile(lang) : lang;
|
|
78
|
-
this.applyLanguage(
|
|
78
|
+
this.applyLanguage(locale2, lang);
|
|
79
79
|
this.config.langs.push("locale");
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
@@ -84,9 +84,9 @@ Author: Draggable https://draggable.io
|
|
|
84
84
|
* @param {String} locale - locale to check for value
|
|
85
85
|
* @return {String} language string or undefined
|
|
86
86
|
*/
|
|
87
|
-
getValue(key,
|
|
87
|
+
getValue(key, locale2 = this.locale) {
|
|
88
88
|
var _a;
|
|
89
|
-
const value = (_a = this.langs[
|
|
89
|
+
const value = (_a = this.langs[locale2]) == null ? void 0 : _a[key];
|
|
90
90
|
return value || this.getFallbackValue(key);
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
@@ -163,9 +163,9 @@ Author: Draggable https://draggable.io
|
|
|
163
163
|
static fromFile(rawText) {
|
|
164
164
|
const lines = rawText.split("\n");
|
|
165
165
|
const lang = {};
|
|
166
|
-
for (let matches2,
|
|
166
|
+
for (let matches2, i2 = 0; i2 < lines.length; i2++) {
|
|
167
167
|
const regex = /^(.+?) *?= *?([^\n]+)/;
|
|
168
|
-
matches2 = regex.exec(lines[
|
|
168
|
+
matches2 = regex.exec(lines[i2]);
|
|
169
169
|
if (matches2) {
|
|
170
170
|
lang[matches2[1]] = matches2[2].replace(/(^\s+|\s+$)/g, "");
|
|
171
171
|
}
|
|
@@ -178,22 +178,22 @@ Author: Draggable https://draggable.io
|
|
|
178
178
|
* @param {Boolean} useCache
|
|
179
179
|
* @return {Promise} resolves response
|
|
180
180
|
*/
|
|
181
|
-
loadLang(
|
|
181
|
+
loadLang(locale2, useCache = true) {
|
|
182
182
|
const _this = this;
|
|
183
183
|
return new Promise(function(resolve, reject) {
|
|
184
|
-
if (_this.loaded.indexOf(
|
|
185
|
-
_this.applyLanguage(_this.langs[
|
|
186
|
-
return resolve(_this.langs[
|
|
184
|
+
if (_this.loaded.indexOf(locale2) !== -1 && useCache) {
|
|
185
|
+
_this.applyLanguage(_this.langs[locale2]);
|
|
186
|
+
return resolve(_this.langs[locale2]);
|
|
187
187
|
} else {
|
|
188
|
-
const langFile = [_this.config.location,
|
|
188
|
+
const langFile = [_this.config.location, locale2, _this.config.extension].join("");
|
|
189
189
|
return fetchData(langFile).then((lang) => {
|
|
190
190
|
const processedFile = I18N.processFile(lang);
|
|
191
|
-
_this.applyLanguage(
|
|
192
|
-
_this.loaded.push(
|
|
193
|
-
return resolve(_this.langs[
|
|
191
|
+
_this.applyLanguage(locale2, processedFile);
|
|
192
|
+
_this.loaded.push(locale2);
|
|
193
|
+
return resolve(_this.langs[locale2]);
|
|
194
194
|
}).catch((err) => {
|
|
195
195
|
console.error(err);
|
|
196
|
-
const lang = _this.applyLanguage(
|
|
196
|
+
const lang = _this.applyLanguage(locale2);
|
|
197
197
|
resolve(lang);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
@@ -205,11 +205,11 @@ Author: Draggable https://draggable.io
|
|
|
205
205
|
* @param {Object} lang
|
|
206
206
|
* @return {Object} overriden language
|
|
207
207
|
*/
|
|
208
|
-
applyLanguage(
|
|
209
|
-
const override = this.config.override[
|
|
210
|
-
const existingLang = this.langs[
|
|
211
|
-
this.langs[
|
|
212
|
-
return this.langs[
|
|
208
|
+
applyLanguage(locale2, lang = {}) {
|
|
209
|
+
const override = this.config.override[locale2] || {};
|
|
210
|
+
const existingLang = this.langs[locale2] || {};
|
|
211
|
+
this.langs[locale2] = { ...existingLang, ...lang, ...override };
|
|
212
|
+
return this.langs[locale2];
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
215
|
* return currently available languages
|
|
@@ -223,10 +223,10 @@ Author: Draggable https://draggable.io
|
|
|
223
223
|
* @param {String} locale
|
|
224
224
|
* @return {Promise} language
|
|
225
225
|
*/
|
|
226
|
-
async setCurrent(
|
|
227
|
-
await this.loadLang(
|
|
228
|
-
this.locale =
|
|
229
|
-
this.current = this.langs[
|
|
226
|
+
async setCurrent(locale2 = "en-US") {
|
|
227
|
+
await this.loadLang(locale2);
|
|
228
|
+
this.locale = locale2;
|
|
229
|
+
this.current = this.langs[locale2];
|
|
230
230
|
return this.current;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -259,9 +259,9 @@ Author: Draggable https://draggable.io
|
|
|
259
259
|
__publicField(this, "tooltip");
|
|
260
260
|
__publicField(this, "activeTriggerType", null);
|
|
261
261
|
__publicField(this, "spacing", 12);
|
|
262
|
-
__publicField(this, "handleClick", (
|
|
262
|
+
__publicField(this, "handleClick", (e2) => {
|
|
263
263
|
const triggerName = this.triggerName;
|
|
264
|
-
const trigger =
|
|
264
|
+
const trigger = e2.target.closest(`[${triggerName}][${triggerName}-type="click"]`);
|
|
265
265
|
if (trigger) {
|
|
266
266
|
if (this.isVisible()) {
|
|
267
267
|
this.hide();
|
|
@@ -274,9 +274,9 @@ Author: Draggable https://draggable.io
|
|
|
274
274
|
this.hide();
|
|
275
275
|
}
|
|
276
276
|
});
|
|
277
|
-
__publicField(this, "handleMouseOver", (
|
|
277
|
+
__publicField(this, "handleMouseOver", (e2) => {
|
|
278
278
|
const triggerName = this.triggerName;
|
|
279
|
-
const trigger =
|
|
279
|
+
const trigger = e2.target.closest(`[${triggerName}]`);
|
|
280
280
|
if (this.activeTriggerType !== "click" && (trigger == null ? void 0 : trigger.getAttribute(`${triggerName}-type`)) !== "click") {
|
|
281
281
|
const content = trigger == null ? void 0 : trigger.getAttribute(`${triggerName}`);
|
|
282
282
|
if (content) {
|
|
@@ -285,9 +285,9 @@ Author: Draggable https://draggable.io
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
|
-
__publicField(this, "handleMouseOut", (
|
|
288
|
+
__publicField(this, "handleMouseOut", (e2) => {
|
|
289
289
|
const triggerName = this.triggerName;
|
|
290
|
-
const trigger =
|
|
290
|
+
const trigger = e2.target.closest(`[${triggerName}]`);
|
|
291
291
|
if (this.activeTriggerType !== "click" && (trigger == null ? void 0 : trigger.getAttribute(`${triggerName}-type`)) !== "click") {
|
|
292
292
|
this.hide();
|
|
293
293
|
}
|
|
@@ -435,7 +435,7 @@ Author: Draggable https://draggable.io
|
|
|
435
435
|
window.SmartTooltip = SmartTooltip;
|
|
436
436
|
}
|
|
437
437
|
const name$1 = "formeo";
|
|
438
|
-
const version$2 = "4.
|
|
438
|
+
const version$2 = "4.2.0";
|
|
439
439
|
const pkg = {
|
|
440
440
|
name: name$1,
|
|
441
441
|
version: version$2
|
|
@@ -669,7 +669,7 @@ Author: Draggable https://draggable.io
|
|
|
669
669
|
try {
|
|
670
670
|
value[symToStringTag] = void 0;
|
|
671
671
|
var unmasked = true;
|
|
672
|
-
} catch (
|
|
672
|
+
} catch (e2) {
|
|
673
673
|
}
|
|
674
674
|
var result = nativeObjectToString.call(value);
|
|
675
675
|
if (unmasked) {
|
|
@@ -780,11 +780,11 @@ Author: Draggable https://draggable.io
|
|
|
780
780
|
if (func != null) {
|
|
781
781
|
try {
|
|
782
782
|
return funcToString.call(func);
|
|
783
|
-
} catch (
|
|
783
|
+
} catch (e2) {
|
|
784
784
|
}
|
|
785
785
|
try {
|
|
786
786
|
return func + "";
|
|
787
|
-
} catch (
|
|
787
|
+
} catch (e2) {
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
return "";
|
|
@@ -1130,7 +1130,7 @@ Author: Draggable https://draggable.io
|
|
|
1130
1130
|
var func = getNative(Object, "defineProperty");
|
|
1131
1131
|
func({}, "", {});
|
|
1132
1132
|
return func;
|
|
1133
|
-
} catch (
|
|
1133
|
+
} catch (e2) {
|
|
1134
1134
|
}
|
|
1135
1135
|
})();
|
|
1136
1136
|
_defineProperty$1 = defineProperty;
|
|
@@ -1541,7 +1541,7 @@ Author: Draggable https://draggable.io
|
|
|
1541
1541
|
return types;
|
|
1542
1542
|
}
|
|
1543
1543
|
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
1544
|
-
} catch (
|
|
1544
|
+
} catch (e2) {
|
|
1545
1545
|
}
|
|
1546
1546
|
})();
|
|
1547
1547
|
module2.exports = nodeUtil;
|
|
@@ -2074,8 +2074,8 @@ Author: Draggable https://draggable.io
|
|
|
2074
2074
|
}
|
|
2075
2075
|
if (Array.isArray(obj)) {
|
|
2076
2076
|
copy = [];
|
|
2077
|
-
for (let
|
|
2078
|
-
copy[
|
|
2077
|
+
for (let i2 = 0, len = obj.length; i2 < len; i2++) {
|
|
2078
|
+
copy[i2] = clone$1(obj[i2]);
|
|
2079
2079
|
}
|
|
2080
2080
|
return copy;
|
|
2081
2081
|
}
|
|
@@ -2147,8 +2147,8 @@ Author: Draggable https://draggable.io
|
|
|
2147
2147
|
if (typeof data === "string") {
|
|
2148
2148
|
try {
|
|
2149
2149
|
return JSON.parse(data);
|
|
2150
|
-
} catch (
|
|
2151
|
-
console.error("Invalid JSON string provided:",
|
|
2150
|
+
} catch (e2) {
|
|
2151
|
+
console.error("Invalid JSON string provided:", e2);
|
|
2152
2152
|
return /* @__PURE__ */ Object.create(null);
|
|
2153
2153
|
}
|
|
2154
2154
|
}
|
|
@@ -2170,20 +2170,17 @@ Author: Draggable https://draggable.io
|
|
|
2170
2170
|
}
|
|
2171
2171
|
return result;
|
|
2172
2172
|
}
|
|
2173
|
+
let BUNDLED_SVG_SPRITE = null;
|
|
2174
|
+
try {
|
|
2175
|
+
BUNDLED_SVG_SPRITE = require("../../lib/icons/formeo-sprite.svg?raw");
|
|
2176
|
+
} catch (e2) {
|
|
2177
|
+
}
|
|
2173
2178
|
const name = pkg.name;
|
|
2174
2179
|
const version$1 = pkg.version;
|
|
2175
2180
|
const PACKAGE_NAME = name;
|
|
2176
2181
|
const formeoSpriteId = "formeo-sprite";
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2179
|
-
{ name: "mutationObserver", src: "//cdn.jsdelivr.net/npm/mutationobserver-shim/dist/mutationobserver.min.js" },
|
|
2180
|
-
{ name: "fetch", src: "https://unpkg.com/unfetch/polyfill" }
|
|
2181
|
-
];
|
|
2182
|
-
const relativeSpritePath = `../../lib/icons/${formeoSpriteId}.svg`;
|
|
2183
|
-
const localSpriteUrl = false ? (void 0)(relativeSpritePath) : relativeSpritePath;
|
|
2184
|
-
const isDev = typeof process !== "undefined" && process.env?.NODE_ENV === "development" || false;
|
|
2185
|
-
const SVG_SPRITE_URL = isDev ? localSpriteUrl : `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
2186
|
-
const FALLBACK_SVG_SPRITE_URL = `https://draggable.github.io/formeo/assets/img/${formeoSpriteId}.svg`;
|
|
2182
|
+
const SVG_SPRITE_URL = null;
|
|
2183
|
+
const FALLBACK_SVG_SPRITE_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/${formeoSpriteId}.svg`;
|
|
2187
2184
|
const CSS_URL = `https://cdn.jsdelivr.net/npm/formeo@${version$1}/dist/formeo.min.css`;
|
|
2188
2185
|
const FALLBACK_CSS_URL = "https://draggable.github.io/formeo/assets/css/formeo.min.css";
|
|
2189
2186
|
const PANEL_CLASSNAME = "f-panel";
|
|
@@ -3466,9 +3463,9 @@ Author: Draggable https://draggable.io
|
|
|
3466
3463
|
return keys;
|
|
3467
3464
|
}
|
|
3468
3465
|
function _objectSpread2(target) {
|
|
3469
|
-
for (var
|
|
3470
|
-
var source = arguments[
|
|
3471
|
-
if (
|
|
3466
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3467
|
+
var source = arguments[i2] != null ? arguments[i2] : {};
|
|
3468
|
+
if (i2 % 2) {
|
|
3472
3469
|
ownKeys(Object(source), true).forEach(function(key) {
|
|
3473
3470
|
_defineProperty(target, key, source[key]);
|
|
3474
3471
|
});
|
|
@@ -3510,8 +3507,8 @@ Author: Draggable https://draggable.io
|
|
|
3510
3507
|
}
|
|
3511
3508
|
function _extends() {
|
|
3512
3509
|
_extends = Object.assign || function(target) {
|
|
3513
|
-
for (var
|
|
3514
|
-
var source = arguments[
|
|
3510
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
3511
|
+
var source = arguments[i2];
|
|
3515
3512
|
for (var key in source) {
|
|
3516
3513
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3517
3514
|
target[key] = source[key];
|
|
@@ -3526,9 +3523,9 @@ Author: Draggable https://draggable.io
|
|
|
3526
3523
|
if (source == null) return {};
|
|
3527
3524
|
var target = {};
|
|
3528
3525
|
var sourceKeys = Object.keys(source);
|
|
3529
|
-
var key,
|
|
3530
|
-
for (
|
|
3531
|
-
key = sourceKeys[
|
|
3526
|
+
var key, i2;
|
|
3527
|
+
for (i2 = 0; i2 < sourceKeys.length; i2++) {
|
|
3528
|
+
key = sourceKeys[i2];
|
|
3532
3529
|
if (excluded.indexOf(key) >= 0) continue;
|
|
3533
3530
|
target[key] = source[key];
|
|
3534
3531
|
}
|
|
@@ -3537,11 +3534,11 @@ Author: Draggable https://draggable.io
|
|
|
3537
3534
|
function _objectWithoutProperties(source, excluded) {
|
|
3538
3535
|
if (source == null) return {};
|
|
3539
3536
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
3540
|
-
var key,
|
|
3537
|
+
var key, i2;
|
|
3541
3538
|
if (Object.getOwnPropertySymbols) {
|
|
3542
3539
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
3543
|
-
for (
|
|
3544
|
-
key = sourceSymbolKeys[
|
|
3540
|
+
for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
|
|
3541
|
+
key = sourceSymbolKeys[i2];
|
|
3545
3542
|
if (excluded.indexOf(key) >= 0) continue;
|
|
3546
3543
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
3547
3544
|
target[key] = source[key];
|
|
@@ -3650,10 +3647,10 @@ Author: Draggable https://draggable.io
|
|
|
3650
3647
|
}
|
|
3651
3648
|
function find(ctx, tagName, iterator) {
|
|
3652
3649
|
if (ctx) {
|
|
3653
|
-
var list = ctx.getElementsByTagName(tagName),
|
|
3650
|
+
var list = ctx.getElementsByTagName(tagName), i2 = 0, n = list.length;
|
|
3654
3651
|
if (iterator) {
|
|
3655
|
-
for (;
|
|
3656
|
-
iterator(list[
|
|
3652
|
+
for (; i2 < n; i2++) {
|
|
3653
|
+
iterator(list[i2], i2);
|
|
3657
3654
|
}
|
|
3658
3655
|
}
|
|
3659
3656
|
return list;
|
|
@@ -3736,15 +3733,15 @@ Author: Draggable https://draggable.io
|
|
|
3736
3733
|
return false;
|
|
3737
3734
|
}
|
|
3738
3735
|
function getChild(el, childNum, options, includeDragEl) {
|
|
3739
|
-
var currentChild = 0,
|
|
3740
|
-
while (
|
|
3741
|
-
if (children[
|
|
3736
|
+
var currentChild = 0, i2 = 0, children = el.children;
|
|
3737
|
+
while (i2 < children.length) {
|
|
3738
|
+
if (children[i2].style.display !== "none" && children[i2] !== Sortable.ghost && (includeDragEl || children[i2] !== Sortable.dragged) && closest(children[i2], options.draggable, el, false)) {
|
|
3742
3739
|
if (currentChild === childNum) {
|
|
3743
|
-
return children[
|
|
3740
|
+
return children[i2];
|
|
3744
3741
|
}
|
|
3745
3742
|
currentChild++;
|
|
3746
3743
|
}
|
|
3747
|
-
|
|
3744
|
+
i2++;
|
|
3748
3745
|
}
|
|
3749
3746
|
return null;
|
|
3750
3747
|
}
|
|
@@ -3779,10 +3776,10 @@ Author: Draggable https://draggable.io
|
|
|
3779
3776
|
return [offsetLeft, offsetTop];
|
|
3780
3777
|
}
|
|
3781
3778
|
function indexOfObject(arr, obj) {
|
|
3782
|
-
for (var
|
|
3783
|
-
if (!arr.hasOwnProperty(
|
|
3779
|
+
for (var i2 in arr) {
|
|
3780
|
+
if (!arr.hasOwnProperty(i2)) continue;
|
|
3784
3781
|
for (var key in obj) {
|
|
3785
|
-
if (obj.hasOwnProperty(key) && obj[key] === arr[
|
|
3782
|
+
if (obj.hasOwnProperty(key) && obj[key] === arr[i2][key]) return Number(i2);
|
|
3786
3783
|
}
|
|
3787
3784
|
}
|
|
3788
3785
|
return -1;
|
|
@@ -4235,9 +4232,9 @@ Author: Draggable https://draggable.io
|
|
|
4235
4232
|
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
|
|
4236
4233
|
if (nearest) {
|
|
4237
4234
|
var event = {};
|
|
4238
|
-
for (var
|
|
4239
|
-
if (evt.hasOwnProperty(
|
|
4240
|
-
event[
|
|
4235
|
+
for (var i2 in evt) {
|
|
4236
|
+
if (evt.hasOwnProperty(i2)) {
|
|
4237
|
+
event[i2] = evt[i2];
|
|
4241
4238
|
}
|
|
4242
4239
|
}
|
|
4243
4240
|
event.target = event.rootEl = nearest;
|
|
@@ -4486,8 +4483,8 @@ Author: Draggable https://draggable.io
|
|
|
4486
4483
|
}
|
|
4487
4484
|
}
|
|
4488
4485
|
},
|
|
4489
|
-
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
|
|
4490
|
-
var touch =
|
|
4486
|
+
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e2) {
|
|
4487
|
+
var touch = e2.touches ? e2.touches[0] : e2;
|
|
4491
4488
|
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))) {
|
|
4492
4489
|
this._disableDelayedDrag();
|
|
4493
4490
|
}
|
|
@@ -5088,9 +5085,9 @@ Author: Draggable https://draggable.io
|
|
|
5088
5085
|
* @returns {String[]}
|
|
5089
5086
|
*/
|
|
5090
5087
|
toArray: function toArray() {
|
|
5091
|
-
var order = [], el, children = this.el.children,
|
|
5092
|
-
for (;
|
|
5093
|
-
el = children[
|
|
5088
|
+
var order = [], el, children = this.el.children, i2 = 0, n = children.length, options = this.options;
|
|
5089
|
+
for (; i2 < n; i2++) {
|
|
5090
|
+
el = children[i2];
|
|
5094
5091
|
if (closest(el, options.draggable, this.el, false)) {
|
|
5095
5092
|
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
|
5096
5093
|
}
|
|
@@ -5103,8 +5100,8 @@ Author: Draggable https://draggable.io
|
|
|
5103
5100
|
*/
|
|
5104
5101
|
sort: function sort(order, useAnimation) {
|
|
5105
5102
|
var items = {}, rootEl2 = this.el;
|
|
5106
|
-
this.toArray().forEach(function(id,
|
|
5107
|
-
var el = rootEl2.children[
|
|
5103
|
+
this.toArray().forEach(function(id, i2) {
|
|
5104
|
+
var el = rootEl2.children[i2];
|
|
5108
5105
|
if (closest(el, this.options.draggable, rootEl2, false)) {
|
|
5109
5106
|
items[id] = el;
|
|
5110
5107
|
}
|
|
@@ -5297,9 +5294,9 @@ Author: Draggable https://draggable.io
|
|
|
5297
5294
|
}
|
|
5298
5295
|
}
|
|
5299
5296
|
function _generateId(el) {
|
|
5300
|
-
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
|
5301
|
-
while (
|
|
5302
|
-
sum += str.charCodeAt(
|
|
5297
|
+
var str = el.tagName + el.className + el.src + el.href + el.textContent, i2 = str.length, sum = 0;
|
|
5298
|
+
while (i2--) {
|
|
5299
|
+
sum += str.charCodeAt(i2);
|
|
5303
5300
|
}
|
|
5304
5301
|
return sum.toString(36);
|
|
5305
5302
|
}
|
|
@@ -5491,9 +5488,9 @@ Author: Draggable https://draggable.io
|
|
|
5491
5488
|
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
|
|
5492
5489
|
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
|
|
5493
5490
|
if (!autoScrolls[layersOut]) {
|
|
5494
|
-
for (var
|
|
5495
|
-
if (!autoScrolls[
|
|
5496
|
-
autoScrolls[
|
|
5491
|
+
for (var i2 = 0; i2 <= layersOut; i2++) {
|
|
5492
|
+
if (!autoScrolls[i2]) {
|
|
5493
|
+
autoScrolls[i2] = {};
|
|
5497
5494
|
}
|
|
5498
5495
|
}
|
|
5499
5496
|
}
|
|
@@ -5693,13 +5690,13 @@ Author: Draggable https://draggable.io
|
|
|
5693
5690
|
return unique(orderedElements);
|
|
5694
5691
|
};
|
|
5695
5692
|
const forEach = (arr, cb, scope) => {
|
|
5696
|
-
for (let
|
|
5697
|
-
cb.call(scope, arr[
|
|
5693
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
5694
|
+
cb.call(scope, arr[i2], i2);
|
|
5698
5695
|
}
|
|
5699
5696
|
};
|
|
5700
5697
|
const map = (arr, cb) => {
|
|
5701
5698
|
const newArray = [];
|
|
5702
|
-
forEach(arr, (elem,
|
|
5699
|
+
forEach(arr, (elem, i2) => newArray.push(cb(elem, i2)));
|
|
5703
5700
|
return newArray;
|
|
5704
5701
|
};
|
|
5705
5702
|
const sanitizedAttributeNames = {};
|
|
@@ -5718,7 +5715,6 @@ Author: Draggable https://draggable.io
|
|
|
5718
5715
|
const capitalize = (str) => str.replace(/\b\w/g, (m) => m.toUpperCase());
|
|
5719
5716
|
const copyObj = (obj) => window.JSON.parse(window.JSON.stringify(obj));
|
|
5720
5717
|
const subtract = (arr, from) => from.filter((a) => !~arr.indexOf(a));
|
|
5721
|
-
const isIE = () => window.navigator.userAgent.indexOf("MSIE ") !== -1;
|
|
5722
5718
|
const helpers = {
|
|
5723
5719
|
capitalize,
|
|
5724
5720
|
safeAttrName,
|
|
@@ -5730,8 +5726,119 @@ Author: Draggable https://draggable.io
|
|
|
5730
5726
|
indexOfNode,
|
|
5731
5727
|
isInt,
|
|
5732
5728
|
get,
|
|
5733
|
-
orderObjectsBy
|
|
5734
|
-
|
|
5729
|
+
orderObjectsBy
|
|
5730
|
+
};
|
|
5731
|
+
const loaded = {
|
|
5732
|
+
js: /* @__PURE__ */ new Set(),
|
|
5733
|
+
css: /* @__PURE__ */ new Set(),
|
|
5734
|
+
formeoSprite: null
|
|
5735
|
+
};
|
|
5736
|
+
const ajax = (fileUrl, callback, onError = noop) => {
|
|
5737
|
+
return new Promise((resolve) => {
|
|
5738
|
+
return fetch(fileUrl).then((data) => {
|
|
5739
|
+
if (!data.ok) {
|
|
5740
|
+
return resolve(onError(data));
|
|
5741
|
+
}
|
|
5742
|
+
resolve(callback ? callback(data) : data);
|
|
5743
|
+
}).catch((err) => onError(err));
|
|
5744
|
+
});
|
|
5745
|
+
};
|
|
5746
|
+
const onLoadStylesheet = (elem, cb) => {
|
|
5747
|
+
elem.removeEventListener("load", onLoadStylesheet);
|
|
5748
|
+
cb(elem.src);
|
|
5749
|
+
};
|
|
5750
|
+
const onLoadJavascript = (elem, cb) => {
|
|
5751
|
+
elem.removeEventListener("load", onLoadJavascript);
|
|
5752
|
+
cb(elem.src);
|
|
5753
|
+
};
|
|
5754
|
+
const insertScript = (src) => {
|
|
5755
|
+
return new Promise((resolve, reject) => {
|
|
5756
|
+
if (loaded.js.has(src)) {
|
|
5757
|
+
return resolve(src);
|
|
5758
|
+
}
|
|
5759
|
+
loaded.js.add(src);
|
|
5760
|
+
const script = dom.create({
|
|
5761
|
+
tag: "script",
|
|
5762
|
+
attrs: {
|
|
5763
|
+
type: "text/javascript",
|
|
5764
|
+
async: true,
|
|
5765
|
+
src
|
|
5766
|
+
},
|
|
5767
|
+
action: {
|
|
5768
|
+
load: () => onLoadJavascript(script, resolve),
|
|
5769
|
+
error: () => reject(new Error(`${src} failed to load.`))
|
|
5770
|
+
}
|
|
5771
|
+
});
|
|
5772
|
+
document.head.appendChild(script);
|
|
5773
|
+
});
|
|
5774
|
+
};
|
|
5775
|
+
const insertStyle = (srcs) => {
|
|
5776
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5777
|
+
const promises = srcs.map(
|
|
5778
|
+
(src) => new Promise((resolve, reject) => {
|
|
5779
|
+
if (loaded.css.has(src)) {
|
|
5780
|
+
return resolve(src);
|
|
5781
|
+
}
|
|
5782
|
+
loaded.css.add(src);
|
|
5783
|
+
const styleLink = dom.create({
|
|
5784
|
+
tag: "link",
|
|
5785
|
+
attrs: {
|
|
5786
|
+
rel: "stylesheet",
|
|
5787
|
+
href: src
|
|
5788
|
+
},
|
|
5789
|
+
action: {
|
|
5790
|
+
load: () => onLoadStylesheet(styleLink, resolve),
|
|
5791
|
+
error: () => reject(new Error(`${(void 0).src} failed to load.`))
|
|
5792
|
+
}
|
|
5793
|
+
});
|
|
5794
|
+
document.head.appendChild(styleLink);
|
|
5795
|
+
})
|
|
5796
|
+
);
|
|
5797
|
+
return Promise.all(promises);
|
|
5798
|
+
};
|
|
5799
|
+
const insertScripts = (srcs) => {
|
|
5800
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5801
|
+
const promises = srcs.map((src) => insertScript(src));
|
|
5802
|
+
return Promise.all(promises);
|
|
5803
|
+
};
|
|
5804
|
+
const insertStyles = (srcs) => {
|
|
5805
|
+
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
5806
|
+
const promises = srcs.map((src) => insertStyle(src));
|
|
5807
|
+
return Promise.all(promises);
|
|
5808
|
+
};
|
|
5809
|
+
const insertIcons = (iconSvgStr) => {
|
|
5810
|
+
const parser = new DOMParser();
|
|
5811
|
+
const svgDoc = parser.parseFromString(iconSvgStr, "image/svg+xml");
|
|
5812
|
+
loaded.formeoSprite = svgDoc.documentElement;
|
|
5813
|
+
return loaded.formeoSprite;
|
|
5814
|
+
};
|
|
5815
|
+
const fetchIcons = async (iconSpriteUrl = SVG_SPRITE_URL) => {
|
|
5816
|
+
if (loaded.formeoSprite) {
|
|
5817
|
+
return loaded.formeoSprite;
|
|
5818
|
+
}
|
|
5819
|
+
if (!iconSpriteUrl) {
|
|
5820
|
+
return insertIcons(BUNDLED_SVG_SPRITE);
|
|
5821
|
+
}
|
|
5822
|
+
const parseResp = async (resp) => insertIcons(await resp.text());
|
|
5823
|
+
return ajax(iconSpriteUrl, parseResp, () => ajax(FALLBACK_SVG_SPRITE_URL, parseResp));
|
|
5824
|
+
};
|
|
5825
|
+
const LOADER_MAP = {
|
|
5826
|
+
js: insertScripts,
|
|
5827
|
+
css: insertStyles
|
|
5828
|
+
};
|
|
5829
|
+
const fetchDependencies = (dependencies) => {
|
|
5830
|
+
const promises = Object.entries(dependencies).map(([type, src]) => {
|
|
5831
|
+
return LOADER_MAP[type](src);
|
|
5832
|
+
});
|
|
5833
|
+
return Promise.all(promises);
|
|
5834
|
+
};
|
|
5835
|
+
const fetchFormeoStyle = async (cssUrl) => {
|
|
5836
|
+
if (!loaded.css.has(cssUrl)) {
|
|
5837
|
+
await insertStyle(cssUrl);
|
|
5838
|
+
if (!loaded.css.has(FALLBACK_CSS_URL)) {
|
|
5839
|
+
return await insertStyle(FALLBACK_CSS_URL);
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5735
5842
|
};
|
|
5736
5843
|
const iconFontTemplates = {
|
|
5737
5844
|
glyphicons: (icon) => `<span class="glyphicon glyphicon-${icon}" aria-hidden="true"></span>`,
|
|
@@ -5826,7 +5933,7 @@ Author: Draggable https://draggable.io
|
|
|
5826
5933
|
processed.push("tag");
|
|
5827
5934
|
let childType;
|
|
5828
5935
|
const { tag } = elem;
|
|
5829
|
-
let
|
|
5936
|
+
let i2;
|
|
5830
5937
|
const wrap = {
|
|
5831
5938
|
attrs: {},
|
|
5832
5939
|
className: [helpers.get(elem, "config.inputWrap")],
|
|
@@ -5920,8 +6027,8 @@ Author: Draggable https://draggable.io
|
|
|
5920
6027
|
processed.push("action");
|
|
5921
6028
|
}
|
|
5922
6029
|
const remaining = helpers.subtract(processed, Object.keys(elem));
|
|
5923
|
-
for (
|
|
5924
|
-
element[remaining[
|
|
6030
|
+
for (i2 = remaining.length - 1; i2 >= 0; i2--) {
|
|
6031
|
+
element[remaining[i2]] = elem[remaining[i2]];
|
|
5925
6032
|
}
|
|
5926
6033
|
if (wrap.children.length) {
|
|
5927
6034
|
element = this.create(wrap);
|
|
@@ -5961,25 +6068,26 @@ Author: Draggable https://draggable.io
|
|
|
5961
6068
|
if (this.iconSymbols) {
|
|
5962
6069
|
return this.iconSymbols;
|
|
5963
6070
|
}
|
|
5964
|
-
const iconSymbolNodes =
|
|
5965
|
-
const createSvgIconConfig = (
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
}
|
|
5978
|
-
|
|
5979
|
-
|
|
6071
|
+
const iconSymbolNodes = loaded.formeoSprite.querySelectorAll("svg symbol");
|
|
6072
|
+
const createSvgIconConfig = (symbol) => {
|
|
6073
|
+
const viewBox = symbol.getAttribute("viewBox") || "0 0 24 24";
|
|
6074
|
+
const children = Array.from(symbol.children).map((child) => {
|
|
6075
|
+
const clonedNode = child.cloneNode(true);
|
|
6076
|
+
return clonedNode.outerHTML;
|
|
6077
|
+
}).join("");
|
|
6078
|
+
return {
|
|
6079
|
+
tag: "svg",
|
|
6080
|
+
attrs: {
|
|
6081
|
+
className: ["svg-icon", symbol.id],
|
|
6082
|
+
viewBox,
|
|
6083
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
6084
|
+
},
|
|
6085
|
+
children
|
|
6086
|
+
};
|
|
6087
|
+
};
|
|
5980
6088
|
this.iconSymbols = Array.from(iconSymbolNodes).reduce((acc, symbol) => {
|
|
5981
6089
|
const name2 = symbol.id.replace(iconPrefix, "");
|
|
5982
|
-
acc[name2] = createSvgIconConfig(symbol
|
|
6090
|
+
acc[name2] = createSvgIconConfig(symbol);
|
|
5983
6091
|
return acc;
|
|
5984
6092
|
}, {});
|
|
5985
6093
|
this.cachedIcons = {};
|
|
@@ -6087,19 +6195,19 @@ Author: Draggable https://draggable.io
|
|
|
6087
6195
|
});
|
|
6088
6196
|
return elementsContainingText;
|
|
6089
6197
|
};
|
|
6090
|
-
generateOption = ({ type = "option", label, value, i = 0, selected }) => {
|
|
6198
|
+
generateOption = ({ type = "option", label, value, i: i2 = 0, selected }) => {
|
|
6091
6199
|
const isOption = type === "option";
|
|
6092
6200
|
return {
|
|
6093
6201
|
tag: isOption ? "option" : "input",
|
|
6094
6202
|
attrs: {
|
|
6095
6203
|
type,
|
|
6096
|
-
value: value || `${type}-${
|
|
6097
|
-
[type === "option" ? "selected" : "checked"]: selected || !
|
|
6204
|
+
value: value || `${type}-${i2}`,
|
|
6205
|
+
[type === "option" ? "selected" : "checked"]: selected || !i2
|
|
6098
6206
|
},
|
|
6099
6207
|
config: {
|
|
6100
6208
|
label: label || mi18n.get("labelCount", {
|
|
6101
6209
|
label: mi18n.get("option"),
|
|
6102
|
-
count:
|
|
6210
|
+
count: i2
|
|
6103
6211
|
})
|
|
6104
6212
|
}
|
|
6105
6213
|
};
|
|
@@ -6115,7 +6223,7 @@ Author: Draggable https://draggable.io
|
|
|
6115
6223
|
const { action, attrs = {} } = elem;
|
|
6116
6224
|
const fieldType = attrs.type || elem.tag;
|
|
6117
6225
|
const id = attrs.id || elem.id;
|
|
6118
|
-
const optionMap = (option,
|
|
6226
|
+
const optionMap = (option, i2) => {
|
|
6119
6227
|
const { label, value, ...rest } = option;
|
|
6120
6228
|
const defaultInput = () => {
|
|
6121
6229
|
const input = {
|
|
@@ -6124,7 +6232,7 @@ Author: Draggable https://draggable.io
|
|
|
6124
6232
|
name: id,
|
|
6125
6233
|
type: fieldType,
|
|
6126
6234
|
value: value || "",
|
|
6127
|
-
id: `${id}-${
|
|
6235
|
+
id: `${id}-${i2}`,
|
|
6128
6236
|
...rest
|
|
6129
6237
|
},
|
|
6130
6238
|
action
|
|
@@ -6132,7 +6240,7 @@ Author: Draggable https://draggable.io
|
|
|
6132
6240
|
const optionLabel = {
|
|
6133
6241
|
tag: "label",
|
|
6134
6242
|
attrs: {
|
|
6135
|
-
for: `${id}-${
|
|
6243
|
+
for: `${id}-${i2}`
|
|
6136
6244
|
},
|
|
6137
6245
|
children: label
|
|
6138
6246
|
};
|
|
@@ -6665,7 +6773,7 @@ Author: Draggable https://draggable.io
|
|
|
6665
6773
|
* @return {Object} DOM Element to be injected into the form.
|
|
6666
6774
|
*/
|
|
6667
6775
|
build() {
|
|
6668
|
-
const keyboardNav = (
|
|
6776
|
+
const keyboardNav = (e2) => {
|
|
6669
6777
|
const list = this.list;
|
|
6670
6778
|
const activeOption = this.getActiveOption();
|
|
6671
6779
|
const keyCodeMap = /* @__PURE__ */ new Map([
|
|
@@ -6702,7 +6810,7 @@ Author: Draggable https://draggable.io
|
|
|
6702
6810
|
this.hideList();
|
|
6703
6811
|
}
|
|
6704
6812
|
}
|
|
6705
|
-
|
|
6813
|
+
e2.preventDefault();
|
|
6706
6814
|
}
|
|
6707
6815
|
],
|
|
6708
6816
|
[
|
|
@@ -6713,7 +6821,7 @@ Author: Draggable https://draggable.io
|
|
|
6713
6821
|
}
|
|
6714
6822
|
]
|
|
6715
6823
|
]);
|
|
6716
|
-
let direction = keyCodeMap.get(
|
|
6824
|
+
let direction = keyCodeMap.get(e2.keyCode);
|
|
6717
6825
|
if (!direction) {
|
|
6718
6826
|
direction = () => false;
|
|
6719
6827
|
}
|
|
@@ -7902,7 +8010,7 @@ Author: Draggable https://draggable.io
|
|
|
7902
8010
|
placement: "top"
|
|
7903
8011
|
},
|
|
7904
8012
|
action: {
|
|
7905
|
-
click: (
|
|
8013
|
+
click: (e2) => this.nav.nextGroup(e2)
|
|
7906
8014
|
},
|
|
7907
8015
|
content: dom.icon("triangle-right")
|
|
7908
8016
|
};
|
|
@@ -7918,7 +8026,7 @@ Author: Draggable https://draggable.io
|
|
|
7918
8026
|
placement: "top"
|
|
7919
8027
|
},
|
|
7920
8028
|
action: {
|
|
7921
|
-
click: (
|
|
8029
|
+
click: (e2) => this.nav.prevGroup(e2)
|
|
7922
8030
|
},
|
|
7923
8031
|
content: dom.icon("triangle-left")
|
|
7924
8032
|
};
|
|
@@ -8255,12 +8363,7 @@ Author: Draggable https://draggable.io
|
|
|
8255
8363
|
return dom.create({
|
|
8256
8364
|
tag: "span",
|
|
8257
8365
|
className: ["component-tag", `${this.name}-tag`],
|
|
8258
|
-
children: [
|
|
8259
|
-
(this.isColumn || this.isField) && dom.icon("component-corner", { className: "bottom-left" }),
|
|
8260
|
-
dom.icon(`handle-${this.name}`),
|
|
8261
|
-
toTitleCase(this.name),
|
|
8262
|
-
(this.isColumn || this.isRow) && dom.icon("component-corner", { className: "bottom-right" })
|
|
8263
|
-
].filter(Boolean)
|
|
8366
|
+
children: [dom.icon(`handle-${this.name}`), toTitleCase(this.name)].filter(Boolean)
|
|
8264
8367
|
});
|
|
8265
8368
|
};
|
|
8266
8369
|
/**
|
|
@@ -9324,8 +9427,8 @@ Author: Draggable https://draggable.io
|
|
|
9324
9427
|
if (typeof widths === "string") {
|
|
9325
9428
|
widths = widths.split(",");
|
|
9326
9429
|
}
|
|
9327
|
-
this.children.forEach((column,
|
|
9328
|
-
column.setWidth(`${widths[
|
|
9430
|
+
this.children.forEach((column, i2) => {
|
|
9431
|
+
column.setWidth(`${widths[i2]}%`);
|
|
9329
9432
|
column.refreshFieldPanels();
|
|
9330
9433
|
});
|
|
9331
9434
|
};
|
|
@@ -9526,133 +9629,6 @@ Author: Draggable https://draggable.io
|
|
|
9526
9629
|
}
|
|
9527
9630
|
};
|
|
9528
9631
|
const stages = new Stages$1();
|
|
9529
|
-
const loaded = {
|
|
9530
|
-
js: /* @__PURE__ */ new Set(),
|
|
9531
|
-
css: /* @__PURE__ */ new Set()
|
|
9532
|
-
};
|
|
9533
|
-
const ajax = (fileUrl, callback, onError = noop) => {
|
|
9534
|
-
return new Promise((resolve) => {
|
|
9535
|
-
return fetch(fileUrl).then((data) => {
|
|
9536
|
-
if (!data.ok) {
|
|
9537
|
-
return resolve(onError(data));
|
|
9538
|
-
}
|
|
9539
|
-
resolve(callback ? callback(data) : data);
|
|
9540
|
-
}).catch((err) => onError(err));
|
|
9541
|
-
});
|
|
9542
|
-
};
|
|
9543
|
-
const onLoadStylesheet = (elem, cb) => {
|
|
9544
|
-
elem.removeEventListener("load", onLoadStylesheet);
|
|
9545
|
-
cb(elem.src);
|
|
9546
|
-
};
|
|
9547
|
-
const onLoadJavascript = (elem, cb) => {
|
|
9548
|
-
elem.removeEventListener("load", onLoadJavascript);
|
|
9549
|
-
cb(elem.src);
|
|
9550
|
-
};
|
|
9551
|
-
const insertScript = (src) => {
|
|
9552
|
-
return new Promise((resolve, reject) => {
|
|
9553
|
-
if (loaded.js.has(src)) {
|
|
9554
|
-
return resolve(src);
|
|
9555
|
-
}
|
|
9556
|
-
loaded.js.add(src);
|
|
9557
|
-
const script = dom.create({
|
|
9558
|
-
tag: "script",
|
|
9559
|
-
attrs: {
|
|
9560
|
-
type: "text/javascript",
|
|
9561
|
-
async: true,
|
|
9562
|
-
src
|
|
9563
|
-
},
|
|
9564
|
-
action: {
|
|
9565
|
-
load: () => onLoadJavascript(script, resolve),
|
|
9566
|
-
error: () => reject(new Error(`${src} failed to load.`))
|
|
9567
|
-
}
|
|
9568
|
-
});
|
|
9569
|
-
document.head.appendChild(script);
|
|
9570
|
-
});
|
|
9571
|
-
};
|
|
9572
|
-
const insertStyle = (srcs) => {
|
|
9573
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9574
|
-
const promises = srcs.map(
|
|
9575
|
-
(src) => new Promise((resolve, reject) => {
|
|
9576
|
-
if (loaded.css.has(src)) {
|
|
9577
|
-
return resolve(src);
|
|
9578
|
-
}
|
|
9579
|
-
loaded.css.add(src);
|
|
9580
|
-
const styleLink = dom.create({
|
|
9581
|
-
tag: "link",
|
|
9582
|
-
attrs: {
|
|
9583
|
-
rel: "stylesheet",
|
|
9584
|
-
href: src
|
|
9585
|
-
},
|
|
9586
|
-
action: {
|
|
9587
|
-
load: () => onLoadStylesheet(styleLink, resolve),
|
|
9588
|
-
error: () => reject(new Error(`${(void 0).src} failed to load.`))
|
|
9589
|
-
}
|
|
9590
|
-
});
|
|
9591
|
-
document.head.appendChild(styleLink);
|
|
9592
|
-
})
|
|
9593
|
-
);
|
|
9594
|
-
return Promise.all(promises);
|
|
9595
|
-
};
|
|
9596
|
-
const insertScripts = (srcs) => {
|
|
9597
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9598
|
-
const promises = srcs.map((src) => insertScript(src));
|
|
9599
|
-
return Promise.all(promises);
|
|
9600
|
-
};
|
|
9601
|
-
const insertStyles = (srcs) => {
|
|
9602
|
-
srcs = Array.isArray(srcs) ? srcs : [srcs];
|
|
9603
|
-
const promises = srcs.map((src) => insertStyle(src));
|
|
9604
|
-
return Promise.all(promises);
|
|
9605
|
-
};
|
|
9606
|
-
const insertIcons = (iconSvgStr) => {
|
|
9607
|
-
let iconSpriteWrap = document.getElementById(formeoSpriteId);
|
|
9608
|
-
if (!iconSpriteWrap) {
|
|
9609
|
-
iconSpriteWrap = dom.create({
|
|
9610
|
-
id: formeoSpriteId,
|
|
9611
|
-
children: iconSvgStr,
|
|
9612
|
-
attrs: {
|
|
9613
|
-
hidden: true,
|
|
9614
|
-
style: "display: none;"
|
|
9615
|
-
}
|
|
9616
|
-
});
|
|
9617
|
-
document.body.insertBefore(iconSpriteWrap, document.body.childNodes[0]);
|
|
9618
|
-
}
|
|
9619
|
-
return iconSpriteWrap;
|
|
9620
|
-
};
|
|
9621
|
-
const fetchIcons = async (iconSpriteUrl = SVG_SPRITE_URL) => {
|
|
9622
|
-
const formeoSprite = document.getElementById(formeoSpriteId);
|
|
9623
|
-
if (formeoSprite) {
|
|
9624
|
-
return;
|
|
9625
|
-
}
|
|
9626
|
-
const parseResp = async (resp) => insertIcons(await resp.text());
|
|
9627
|
-
return ajax(iconSpriteUrl, parseResp, () => ajax(FALLBACK_SVG_SPRITE_URL, parseResp));
|
|
9628
|
-
};
|
|
9629
|
-
const loadPolyfills = (polyfillConfig) => {
|
|
9630
|
-
const polyfills = Array.isArray(polyfillConfig) ? POLYFILLS.filter(({ name: name2 }) => polyfillConfig.indexOf(name2) !== -1) : POLYFILLS;
|
|
9631
|
-
return Promise.all(polyfills.map(({ src }) => insertScript(src)));
|
|
9632
|
-
};
|
|
9633
|
-
const LOADER_MAP = {
|
|
9634
|
-
js: insertScripts,
|
|
9635
|
-
css: insertStyles
|
|
9636
|
-
};
|
|
9637
|
-
const fetchDependencies = (dependencies) => {
|
|
9638
|
-
const promises = Object.entries(dependencies).map(([type, src]) => {
|
|
9639
|
-
return LOADER_MAP[type](src);
|
|
9640
|
-
});
|
|
9641
|
-
return Promise.all(promises);
|
|
9642
|
-
};
|
|
9643
|
-
const isCssLoaded = () => {
|
|
9644
|
-
const formeoSprite = document.getElementById(formeoSpriteId);
|
|
9645
|
-
const computedStyle = window.getComputedStyle(formeoSprite);
|
|
9646
|
-
return computedStyle.visibility === "hidden";
|
|
9647
|
-
};
|
|
9648
|
-
const fetchFormeoStyle = async (cssUrl) => {
|
|
9649
|
-
if (!isCssLoaded()) {
|
|
9650
|
-
await insertStyle(cssUrl);
|
|
9651
|
-
if (!isCssLoaded()) {
|
|
9652
|
-
return await insertStyle(FALLBACK_CSS_URL);
|
|
9653
|
-
}
|
|
9654
|
-
}
|
|
9655
|
-
};
|
|
9656
9632
|
class Control {
|
|
9657
9633
|
controlCache = /* @__PURE__ */ new Set();
|
|
9658
9634
|
/**
|
|
@@ -9721,9 +9697,9 @@ Author: Draggable https://draggable.io
|
|
|
9721
9697
|
* @return {String} the translated label
|
|
9722
9698
|
*/
|
|
9723
9699
|
i18n(lookup, args) {
|
|
9724
|
-
const
|
|
9700
|
+
const locale2 = mi18n.locale;
|
|
9725
9701
|
const controlTranslations = this.definition?.i18n;
|
|
9726
|
-
const localeTranslations = controlTranslations?.[
|
|
9702
|
+
const localeTranslations = controlTranslations?.[locale2] || {};
|
|
9727
9703
|
return (localeTranslations[lookup]?.() ?? localeTranslations[lookup]) || mi18n.get(lookup, args);
|
|
9728
9704
|
}
|
|
9729
9705
|
}
|
|
@@ -9974,12 +9950,12 @@ Author: Draggable https://draggable.io
|
|
|
9974
9950
|
// @todo finish the addGroup method
|
|
9975
9951
|
addGroup: (group) => console.log(group)
|
|
9976
9952
|
};
|
|
9977
|
-
for (let
|
|
9978
|
-
const storeID = `formeo-controls-${groups[
|
|
9953
|
+
for (let i2 = groups.length - 1; i2 >= 0; i2--) {
|
|
9954
|
+
const storeID = `formeo-controls-${groups[i2]}`;
|
|
9979
9955
|
if (!this.options.sortable) {
|
|
9980
9956
|
window.localStorage.removeItem(storeID);
|
|
9981
9957
|
}
|
|
9982
|
-
Sortable.create(groups[
|
|
9958
|
+
Sortable.create(groups[i2], {
|
|
9983
9959
|
animation: 150,
|
|
9984
9960
|
forceFallback: true,
|
|
9985
9961
|
fallbackClass: "control-moving",
|
|
@@ -10700,8 +10676,10 @@ Author: Draggable https://draggable.io
|
|
|
10700
10676
|
}
|
|
10701
10677
|
}
|
|
10702
10678
|
};
|
|
10703
|
-
const
|
|
10704
|
-
|
|
10679
|
+
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"];
|
|
10680
|
+
const locale = "en-US";
|
|
10681
|
+
mi18n.addLanguage(locale, i);
|
|
10682
|
+
mi18n.setCurrent(locale);
|
|
10705
10683
|
const defaults = {
|
|
10706
10684
|
get editor() {
|
|
10707
10685
|
return {
|
|
@@ -10712,8 +10690,8 @@ Author: Draggable https://draggable.io
|
|
|
10712
10690
|
sessionStorage: false,
|
|
10713
10691
|
editorContainer: null,
|
|
10714
10692
|
// element or selector to attach editor to
|
|
10715
|
-
svgSprite:
|
|
10716
|
-
//
|
|
10693
|
+
svgSprite: null,
|
|
10694
|
+
// null = use bundled sprite, or provide custom URL
|
|
10717
10695
|
style: CSS_URL,
|
|
10718
10696
|
// change to null
|
|
10719
10697
|
iconFont: null,
|
|
@@ -10723,8 +10701,6 @@ Author: Draggable https://draggable.io
|
|
|
10723
10701
|
events: {},
|
|
10724
10702
|
actions: {},
|
|
10725
10703
|
controls: {},
|
|
10726
|
-
polyfills: isIE(),
|
|
10727
|
-
// loads csspreloadrel
|
|
10728
10704
|
i18n: {
|
|
10729
10705
|
location: "https://draggable.github.io/formeo/assets/lang/"
|
|
10730
10706
|
},
|
|
@@ -10733,6 +10709,7 @@ Author: Draggable https://draggable.io
|
|
|
10733
10709
|
};
|
|
10734
10710
|
}
|
|
10735
10711
|
};
|
|
10712
|
+
new SmartTooltip();
|
|
10736
10713
|
let FormeoEditor$1 = class FormeoEditor {
|
|
10737
10714
|
/**
|
|
10738
10715
|
* @param {Object} options formeo options
|
|
@@ -10753,7 +10730,6 @@ Author: Draggable https://draggable.io
|
|
|
10753
10730
|
this.dom = dom;
|
|
10754
10731
|
events.init({ debug, ...events$1 });
|
|
10755
10732
|
actions.init({ debug, sessionStorage: opts.sessionStorage, ...actions$1 });
|
|
10756
|
-
this.tooltip = new SmartTooltip();
|
|
10757
10733
|
if (document.readyState === "loading") {
|
|
10758
10734
|
document.addEventListener("DOMContentLoaded", this.loadResources.bind(this));
|
|
10759
10735
|
} else {
|
|
@@ -10789,17 +10765,15 @@ Author: Draggable https://draggable.io
|
|
|
10789
10765
|
async loadResources() {
|
|
10790
10766
|
document.removeEventListener("DOMContentLoaded", this.loadResources);
|
|
10791
10767
|
const promises = [];
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
const resolvedPromises = await Promise.all(promises);
|
|
10768
|
+
promises.push(
|
|
10769
|
+
fetchIcons(this.opts.svgSprite),
|
|
10770
|
+
fetchFormeoStyle(this.opts.style),
|
|
10771
|
+
mi18n.init({ ...this.opts.i18n, locale: globalThis.sessionStorage?.getItem(SESSION_LOCALE_KEY) })
|
|
10772
|
+
);
|
|
10773
|
+
await Promise.all(promises);
|
|
10799
10774
|
if (this.opts.allowEdit) {
|
|
10800
10775
|
this.init();
|
|
10801
10776
|
}
|
|
10802
|
-
return resolvedPromises;
|
|
10803
10777
|
}
|
|
10804
10778
|
/**
|
|
10805
10779
|
* Formeo initializer
|
|
@@ -10859,7 +10833,7 @@ Author: Draggable https://draggable.io
|
|
|
10859
10833
|
dom.empty(this.editorContainer);
|
|
10860
10834
|
this.editorContainer.appendChild(this.editor);
|
|
10861
10835
|
}
|
|
10862
|
-
events.formeoLoaded = new
|
|
10836
|
+
events.formeoLoaded = new globalThis.CustomEvent("formeoLoaded", {
|
|
10863
10837
|
detail: {
|
|
10864
10838
|
formeo: this
|
|
10865
10839
|
}
|
|
@@ -11115,8 +11089,8 @@ Author: Draggable https://draggable.io
|
|
|
11115
11089
|
},
|
|
11116
11090
|
children: "Add +",
|
|
11117
11091
|
action: {
|
|
11118
|
-
click: (
|
|
11119
|
-
const fInputGroup =
|
|
11092
|
+
click: (e2) => {
|
|
11093
|
+
const fInputGroup = e2.target.parentElement;
|
|
11120
11094
|
const elem = dom.create(this.cloneComponentData(id));
|
|
11121
11095
|
fInputGroup.insertBefore(elem, fInputGroup.lastChild);
|
|
11122
11096
|
const removeButton = dom.create(createRemoveButton());
|
|
@@ -11349,15 +11323,15 @@ Author: Draggable https://draggable.io
|
|
|
11349
11323
|
super(mergedConfig);
|
|
11350
11324
|
}
|
|
11351
11325
|
}
|
|
11352
|
-
const generateOptionConfig = ({ type, isMultiple = false, count = 3 }) => Array.from({ length: count }, (_v, k) => k + 1).map((
|
|
11326
|
+
const generateOptionConfig = ({ type, isMultiple = false, count = 3 }) => Array.from({ length: count }, (_v, k) => k + 1).map((i2) => {
|
|
11353
11327
|
const selectedKey = type === "checkbox" || isMultiple ? "checked" : "selected";
|
|
11354
11328
|
return {
|
|
11355
11329
|
label: mi18n.get("labelCount", {
|
|
11356
11330
|
label: toTitleCase(type),
|
|
11357
|
-
count:
|
|
11331
|
+
count: i2
|
|
11358
11332
|
}),
|
|
11359
|
-
value: `${type}-${
|
|
11360
|
-
[selectedKey]: !
|
|
11333
|
+
value: `${type}-${i2}`,
|
|
11334
|
+
[selectedKey]: !i2
|
|
11361
11335
|
};
|
|
11362
11336
|
});
|
|
11363
11337
|
class CheckboxGroupControl extends Control {
|