@windwalker-io/unicorn-next 0.1.9 → 0.1.11

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.
@@ -325,7 +325,7 @@ class ModalListSelectElement extends HTMLElement {
325
325
  return document.querySelector(this.options.modalSelector);
326
326
  }
327
327
  get items() {
328
- return Array.from(this.listContainer.children);
328
+ return Array.from(this.listContainer.querySelectorAll("[data-value]"));
329
329
  }
330
330
  connectedCallback() {
331
331
  this.options = JSON.parse(this.getAttribute("options") || "{}");
@@ -344,9 +344,7 @@ class ModalListSelectElement extends HTMLElement {
344
344
  this.open(e);
345
345
  });
346
346
  this.querySelector("[data-role=clear]")?.addEventListener("click", () => {
347
- this.items.forEach((item) => {
348
- item.querySelector("[data-role=remove]")?.click();
349
- });
347
+ this.removeAll();
350
348
  });
351
349
  selectButton.style.pointerEvents = "";
352
350
  this.render();
@@ -359,12 +357,9 @@ class ModalListSelectElement extends HTMLElement {
359
357
  }
360
358
  appendItem(item, highlights = false) {
361
359
  const itemHtml = html(this.itemTemplate({ item }));
362
- itemHtml.dataset.value = item.value;
360
+ itemHtml.dataset.value = String(item.value);
363
361
  itemHtml.querySelector("[data-role=remove]")?.addEventListener("click", () => {
364
- slideUp(itemHtml).then(() => {
365
- itemHtml.remove();
366
- this.toggleRequired();
367
- });
362
+ this.removeItem(item);
368
363
  });
369
364
  this.listContainer.appendChild(itemHtml);
370
365
  this.toggleRequired();
@@ -372,6 +367,46 @@ class ModalListSelectElement extends HTMLElement {
372
367
  highlight(itemHtml);
373
368
  }
374
369
  }
370
+ appendIfNotExists(item, highlights = false) {
371
+ if (!this.isExists(item)) {
372
+ this.appendItem(item, highlights);
373
+ }
374
+ }
375
+ isExists(item) {
376
+ if (typeof item === "object") {
377
+ item = item.value;
378
+ }
379
+ return this.listContainer.querySelector(`[data-value="${item}"]`) !== null;
380
+ }
381
+ getItemElement(item) {
382
+ if (typeof item === "object") {
383
+ item = item.value;
384
+ }
385
+ return this.listContainer.querySelector(`[data-value="${item}"]`);
386
+ }
387
+ getValues() {
388
+ return this.items.map((item) => item.dataset.value);
389
+ }
390
+ removeItem(item) {
391
+ if (typeof item === "object") {
392
+ item = item.value;
393
+ }
394
+ const element = this.listContainer.querySelector(`[data-value="${item}"]`);
395
+ if (element) {
396
+ slideUp(element).then(() => {
397
+ element.remove();
398
+ this.toggleRequired();
399
+ });
400
+ }
401
+ }
402
+ async removeAll() {
403
+ const promises = [];
404
+ for (const item of this.items) {
405
+ promises.push(slideUp(item).then(() => item.remove()));
406
+ }
407
+ await Promise.all(promises);
408
+ this.toggleRequired();
409
+ }
375
410
  toggleRequired() {
376
411
  const placeholder = this.querySelector("[data-role=validation-placeholder]");
377
412
  if (placeholder) {
@@ -399,9 +434,19 @@ class ModalListSelectElement extends HTMLElement {
399
434
  async function init() {
400
435
  customElements.define(ModalListSelectElement.is, ModalListSelectElement);
401
436
  }
437
+ function listenMessages(options) {
438
+ const callback = createCallback(options.type, options.selector, options.modalSelector);
439
+ window.addEventListener("message", (e) => {
440
+ if (e.origin === options.origin && Array.isArray(e.data) && e.data[0] === options.instanceId) {
441
+ callback(e.data[1]);
442
+ }
443
+ });
444
+ window[options.instanceId] = callback;
445
+ }
402
446
  const ready = /* @__PURE__ */ init();
403
447
  export {
404
448
  createCallback,
449
+ listenMessages,
405
450
  ready
406
451
  };
407
452
  //# sourceMappingURL=field-modal-select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-modal-select.js","sources":["../../../../../../node_modules/lodash-es/isSymbol.js","../../../../../../node_modules/lodash-es/_arrayMap.js","../../../../../../node_modules/lodash-es/_baseToString.js","../../../../../../node_modules/lodash-es/_copyObject.js","../../../../../../node_modules/lodash-es/_isIterateeCall.js","../../../../../../node_modules/lodash-es/_createAssigner.js","../../../../../../node_modules/lodash-es/_nativeKeysIn.js","../../../../../../node_modules/lodash-es/_baseKeysIn.js","../../../../../../node_modules/lodash-es/keysIn.js","../../../../../../node_modules/lodash-es/assignInWith.js","../../../../../../node_modules/lodash-es/toString.js","../../../../../../node_modules/lodash-es/isPlainObject.js","../../../../../../node_modules/lodash-es/isError.js","../../../../../../node_modules/lodash-es/attempt.js","../../../../../../node_modules/lodash-es/_basePropertyOf.js","../../../../../../node_modules/lodash-es/_escapeHtmlChar.js","../../../../../../node_modules/lodash-es/escape.js","../../../../../../node_modules/lodash-es/_baseValues.js","../../../../../../node_modules/lodash-es/_customDefaultsAssignIn.js","../../../../../../node_modules/lodash-es/_escapeStringChar.js","../../../../../../node_modules/lodash-es/_reInterpolate.js","../../../../../../node_modules/lodash-es/_reEscape.js","../../../../../../node_modules/lodash-es/_reEvaluate.js","../../../../../../node_modules/lodash-es/templateSettings.js","../../../../../../node_modules/lodash-es/template.js","../../src/module/field-modal-select.ts"],"sourcesContent":["import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","import Symbol from './_Symbol.js';\nimport arrayMap from './_arrayMap.js';\nimport isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default baseToString;\n","import assignValue from './_assignValue.js';\nimport baseAssignValue from './_baseAssignValue.js';\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nexport default copyObject;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","import baseRest from './_baseRest.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nexport default createAssigner;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default nativeKeysIn;\n","import isObject from './isObject.js';\nimport isPrototype from './_isPrototype.js';\nimport nativeKeysIn from './_nativeKeysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeysIn;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeysIn from './_baseKeysIn.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nexport default keysIn;\n","import copyObject from './_copyObject.js';\nimport createAssigner from './_createAssigner.js';\nimport keysIn from './keysIn.js';\n\n/**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n});\n\nexport default assignInWith;\n","import baseToString from './_baseToString.js';\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nexport default toString;\n","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\nimport isPlainObject from './isPlainObject.js';\n\n/** `Object#toString` result references. */\nvar domExcTag = '[object DOMException]',\n errorTag = '[object Error]';\n\n/**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\nfunction isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n}\n\nexport default isError;\n","import apply from './_apply.js';\nimport baseRest from './_baseRest.js';\nimport isError from './isError.js';\n\n/**\n * Attempts to invoke `func`, returning either the result or the caught error\n * object. Any additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Function} func The function to attempt.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {*} Returns the `func` result or error object.\n * @example\n *\n * // Avoid throwing errors for invalid selectors.\n * var elements = _.attempt(function(selector) {\n * return document.querySelectorAll(selector);\n * }, '>_>');\n *\n * if (_.isError(elements)) {\n * elements = [];\n * }\n */\nvar attempt = baseRest(function(func, args) {\n try {\n return apply(func, undefined, args);\n } catch (e) {\n return isError(e) ? e : new Error(e);\n }\n});\n\nexport default attempt;\n","/**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n}\n\nexport default basePropertyOf;\n","import basePropertyOf from './_basePropertyOf.js';\n\n/** Used to map characters to HTML entities. */\nvar htmlEscapes = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;'\n};\n\n/**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nvar escapeHtmlChar = basePropertyOf(htmlEscapes);\n\nexport default escapeHtmlChar;\n","import escapeHtmlChar from './_escapeHtmlChar.js';\nimport toString from './toString.js';\n\n/** Used to match HTML entities and HTML characters. */\nvar reUnescapedHtml = /[&<>\"']/g,\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n/**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value. See\n * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * When working with HTML you should always\n * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n * XSS vectors.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, &amp; pebbles'\n */\nfunction escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n}\n\nexport default escape;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import eq from './eq.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\nfunction customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n}\n\nexport default customDefaultsAssignIn;\n","/** Used to escape characters for inclusion in compiled string literals. */\nvar stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\n/**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nfunction escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n}\n\nexport default escapeStringChar;\n","/** Used to match template delimiters. */\nvar reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\nexport default reInterpolate;\n","/** Used to match template delimiters. */\nvar reEscape = /<%-([\\s\\S]+?)%>/g;\n\nexport default reEscape;\n","/** Used to match template delimiters. */\nvar reEvaluate = /<%([\\s\\S]+?)%>/g;\n\nexport default reEvaluate;\n","import escape from './escape.js';\nimport reEscape from './_reEscape.js';\nimport reEvaluate from './_reEvaluate.js';\nimport reInterpolate from './_reInterpolate.js';\n\n/**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB) as well as ES2015 template strings. Change the\n * following template settings to use alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type {Object}\n */\nvar templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type {string}\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type {Object}\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type {Function}\n */\n '_': { 'escape': escape }\n }\n};\n\nexport default templateSettings;\n","import assignInWith from './assignInWith.js';\nimport attempt from './attempt.js';\nimport baseValues from './_baseValues.js';\nimport customDefaultsAssignIn from './_customDefaultsAssignIn.js';\nimport escapeStringChar from './_escapeStringChar.js';\nimport isError from './isError.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport keys from './keys.js';\nimport reInterpolate from './_reInterpolate.js';\nimport templateSettings from './templateSettings.js';\nimport toString from './toString.js';\n\n/** Error message constants. */\nvar INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';\n\n/** Used to match empty string literals in compiled template source. */\nvar reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n/**\n * Used to validate the `validate` option in `_.template` variable.\n *\n * Forbids characters which could potentially change the meaning of the function argument definition:\n * - \"(),\" (modification of function parameters)\n * - \"=\" (default value)\n * - \"[]{}\" (destructuring of function parameters)\n * - \"/\" (beginning of a comment)\n * - whitespace\n */\nvar reForbiddenIdentifierChars = /[()=,{}\\[\\]\\/\\s]/;\n\n/**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\nvar reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n/** Used to ensure capturing order of template delimiters. */\nvar reNoMatch = /($^)/;\n\n/** Used to match unescaped characters in compiled string literals. */\nvar reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<b><%- value %></b>');\n * compiled({ 'value': '<script>' });\n * // => '<b>&lt;script&gt;</b>'\n *\n * // Use the \"evaluate\" delimiter to execute JavaScript and generate HTML.\n * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the internal `print` function in \"evaluate\" delimiters.\n * var compiled = _.template('<% print(\"hello \" + user); %>!');\n * compiled({ 'user': 'barney' });\n * // => 'hello barney!'\n *\n * // Use the ES template literal delimiter as an \"interpolate\" delimiter.\n * // Disable support by replacing the \"interpolate\" delimiter.\n * var compiled = _.template('hello ${ user }!');\n * compiled({ 'user': 'pebbles' });\n * // => 'hello pebbles!'\n *\n * // Use backslashes to treat delimiters as plain text.\n * var compiled = _.template('<%= \"\\\\<%- value %\\\\>\" %>');\n * compiled({ 'value': 'ignored' });\n * // => '<%- value %>'\n *\n * // Use the `imports` option to import `jQuery` as `jq`.\n * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\n * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the `sourceURL` option to specify a custom sourceURL for the template.\n * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\n * compiled(data);\n * // => Find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector.\n *\n * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.\n * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\n * compiled.source;\n * // => function(data) {\n * // var __t, __p = '';\n * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\n * // return __p;\n * // }\n *\n * // Use custom template delimiters.\n * _.templateSettings.interpolate = /{{([\\s\\S]+?)}}/g;\n * var compiled = _.template('hello {{ user }}!');\n * compiled({ 'user': 'mustache' });\n * // => 'hello mustache!'\n *\n * // Use the `source` property to inline compiled templates for meaningful\n * // line numbers in error messages and stack traces.\n * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\\\n * var JST = {\\\n * \"main\": ' + _.template(mainText).source + '\\\n * };\\\n * ');\n */\nfunction template(string, options, guard) {\n // Based on John Resig's `tmpl` implementation\n // (http://ejohn.org/blog/javascript-micro-templating/)\n // and Laura Doktorova's doT.js (https://github.com/olado/doT).\n var settings = templateSettings.imports._.templateSettings || templateSettings;\n\n if (guard && isIterateeCall(string, options, guard)) {\n options = undefined;\n }\n string = toString(string);\n options = assignInWith({}, options, settings, customDefaultsAssignIn);\n\n var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),\n importsKeys = keys(imports),\n importsValues = baseValues(imports, importsKeys);\n\n var isEscaping,\n isEvaluating,\n index = 0,\n interpolate = options.interpolate || reNoMatch,\n source = \"__p += '\";\n\n // Compile the regexp to match each delimiter.\n var reDelimiters = RegExp(\n (options.escape || reNoMatch).source + '|' +\n interpolate.source + '|' +\n (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +\n (options.evaluate || reNoMatch).source + '|$'\n , 'g');\n\n // Use a sourceURL for easier debugging.\n // The sourceURL gets injected into the source that's eval-ed, so be careful\n // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in\n // and escape the comment, thus injecting code that gets evaled.\n var sourceURL = hasOwnProperty.call(options, 'sourceURL')\n ? ('//# sourceURL=' +\n (options.sourceURL + '').replace(/\\s/g, ' ') +\n '\\n')\n : '';\n\n string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {\n interpolateValue || (interpolateValue = esTemplateValue);\n\n // Escape characters that can't be included in string literals.\n source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);\n\n // Replace delimiters with snippets.\n if (escapeValue) {\n isEscaping = true;\n source += \"' +\\n__e(\" + escapeValue + \") +\\n'\";\n }\n if (evaluateValue) {\n isEvaluating = true;\n source += \"';\\n\" + evaluateValue + \";\\n__p += '\";\n }\n if (interpolateValue) {\n source += \"' +\\n((__t = (\" + interpolateValue + \")) == null ? '' : __t) +\\n'\";\n }\n index = offset + match.length;\n\n // The JS engine embedded in Adobe products needs `match` returned in\n // order to produce the correct `offset` value.\n return match;\n });\n\n source += \"';\\n\";\n\n // If `variable` is not specified wrap a with-statement around the generated\n // code to add the data object to the top of the scope chain.\n var variable = hasOwnProperty.call(options, 'variable') && options.variable;\n if (!variable) {\n source = 'with (obj) {\\n' + source + '\\n}\\n';\n }\n // Throw an error if a forbidden character was found in `variable`, to prevent\n // potential command injection attacks.\n else if (reForbiddenIdentifierChars.test(variable)) {\n throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);\n }\n\n // Cleanup code by stripping empty strings.\n source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)\n .replace(reEmptyStringMiddle, '$1')\n .replace(reEmptyStringTrailing, '$1;');\n\n // Frame code as the function body.\n source = 'function(' + (variable || 'obj') + ') {\\n' +\n (variable\n ? ''\n : 'obj || (obj = {});\\n'\n ) +\n \"var __t, __p = ''\" +\n (isEscaping\n ? ', __e = _.escape'\n : ''\n ) +\n (isEvaluating\n ? ', __j = Array.prototype.join;\\n' +\n \"function print() { __p += __j.call(arguments, '') }\\n\"\n : ';\\n'\n ) +\n source +\n 'return __p\\n}';\n\n var result = attempt(function() {\n return Function(importsKeys, sourceURL + 'return ' + source)\n .apply(undefined, importsValues);\n });\n\n // Provide the compiled function's source by its `toString` method or\n // the `source` property as a convenience for inlining compiled templates.\n result.source = source;\n if (isError(result)) {\n throw result;\n }\n return result;\n}\n\nexport default template;\n","import type { IFrameModalElement } from './iframe-modal';\nimport { data } from '../data';\nimport { __, highlight, html, selectOne, slideUp } from '../service';\nimport { template } from 'lodash-es';\n\nexport type ModalSelectCallback = (item: any) => void;\n\nexport function createCallback(type: 'list' | 'single', selector: string, modalSelector: string): ModalSelectCallback {\n switch (type) {\n // case 'tag':\n // return () => {\n //\n // };\n case 'list':\n return (item: any) => {\n const modalList = document.querySelector(selector) as any as ModalListSelectElement;\n\n if (!modalList.querySelector(`[data-value=\"${item.value}\"]`)) {\n modalList.appendItem(item, true);\n\n selectOne<IFrameModalElement>(modalSelector)?.close();\n } else {\n alert(__('unicorn.field.modal.already.selected'));\n }\n };\n\n case 'single':\n default:\n return (item) => {\n const element = document.querySelector<HTMLDivElement>(selector)!;\n\n const image = element.querySelector<HTMLDivElement>('[data-role=image]')!;\n const title = element.querySelector<HTMLInputElement>('[data-role=title]')!;\n const store = element.querySelector<HTMLInputElement>('[data-role=value]')!;\n\n if (image && item.image) {\n image.style.backgroundImage = `url(${item.image});`;\n }\n\n title.value = item.title || '';\n store.value = item.value || '';\n\n store.dispatchEvent(new CustomEvent('change'));\n\n selectOne<IFrameModalElement>(modalSelector)?.close();\n\n highlight(title);\n };\n }\n}\n\ninterface ModalListOptions {\n modalSelector: string;\n itemTemplate: string;\n sortable: boolean;\n dataKey: string;\n max: number;\n}\n\nclass ModalListSelectElement extends HTMLElement {\n static is = 'uni-modal-list';\n\n itemTemplate!: ReturnType<typeof template>;\n options!: ModalListOptions;\n\n get listContainer() {\n return this.querySelector<HTMLDivElement>('[data-role=list-container]')!;\n }\n\n get modal() {\n return document.querySelector<IFrameModalElement>(this.options.modalSelector);\n }\n\n get items(): Element[] {\n return Array.from(this.listContainer.children);\n }\n\n connectedCallback() {\n this.options = JSON.parse(this.getAttribute('options') || '{}');\n this.itemTemplate = template(document.querySelector(this.options.itemTemplate)!.innerHTML);\n\n const emptyInput = this.querySelector<HTMLInputElement>('[data-role=empty]');\n\n if (emptyInput) {\n emptyInput.name = emptyInput.dataset.name || '';\n }\n\n if (this.options.sortable) {\n import('sortablejs').then(({ default: Sortable }) => {\n new Sortable(this.listContainer, { handle: '.h-drag-handle', animation: 150 });\n });\n }\n\n const selectButton = this.querySelector<HTMLButtonElement>('[data-role=select]')!;\n selectButton.addEventListener('click', (e) => {\n this.open(e);\n });\n\n this.querySelector('[data-role=clear]')?.addEventListener('click', () => {\n this.items.forEach((item) => {\n item.querySelector<HTMLButtonElement>('[data-role=remove]')?.click();\n });\n });\n\n selectButton.style.pointerEvents = '';\n\n this.render();\n }\n\n render() {\n const items: Record<string, any>[] = data('unicorn.modal-field')[this.options.dataKey] || [];\n\n items.forEach((item) => {\n this.appendItem(item);\n });\n }\n\n appendItem(item: Record<string, any>, highlights = false) {\n const itemHtml = html(this.itemTemplate({ item }));\n\n itemHtml.dataset.value = item.value;\n itemHtml.querySelector<HTMLButtonElement>('[data-role=remove]')?.addEventListener('click', () => {\n slideUp(itemHtml).then(() => {\n itemHtml.remove();\n this.toggleRequired();\n });\n });\n\n this.listContainer.appendChild(itemHtml);\n this.toggleRequired();\n\n if (highlights) {\n highlight(itemHtml);\n }\n }\n\n toggleRequired() {\n const placeholder = this.querySelector<HTMLInputElement>('[data-role=validation-placeholder]');\n\n if (placeholder) {\n placeholder.disabled = this.listContainer.children.length !== 0;\n }\n }\n\n open(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n\n const max = this.options.max;\n\n const target = event.target as HTMLAnchorElement;\n\n if (!max) {\n this.modal?.open(target.href, { size: 'modal-xl' });\n return;\n }\n\n if (this.listContainer.children.length >= max) {\n alert(\n __('unicorn.field.modal.max.selected', max)\n );\n\n return;\n }\n\n this.modal?.open(target.href, { size: 'modal-xl' });\n }\n}\n\nasync function init() {\n customElements.define(ModalListSelectElement.is, ModalListSelectElement);\n}\n\nexport const ready = init();\n\nexport interface ModalSelectModule {\n createCallback: typeof createCallback;\n ready: typeof ready;\n}\n"],"names":["Symbol","objectProto","hasOwnProperty"],"mappings":";;;;AAIA,IAAI,YAAY;AAmBhB,SAAS,SAAS,OAAO;AACvB,SAAO,OAAO,SAAS,YACpB,aAAa,KAAK,KAAK,WAAW,KAAK,KAAK;AACjD;ACjBA,SAAS,SAAS,OAA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K,cAAc,SAAS,WAAW;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,KAAK,OAAc;AACjB,UAAM,eAAA;AACN,UAAM,gBAAA;AAEN,UAAM,MAAM,KAAK,QAAQ;AAEzB,UAAM,SAAS,MAAM;AAErB,QAAI,CAAC,KAAK;AACR,WAAK,OAAO,KAAK,OAAO,MAAM,EAAE,MAAM,YAAY;AAClD;AAAA,IACF;AAEA,QAAI,KAAK,cAAc,SAAS,UAAU,KAAK;AAC7C;AAAA,QACE,GAAG,oCAAoC,GAAG;AAAA,MAAA;AAG5C;AAAA,IACF;AAEA,SAAK,OAAO,KAAK,OAAO,MAAM,EAAE,MAAM,YAAY;AAAA,EACpD;AACF;AAEA,eAAe,OAAO;AACpB,iBAAe,OAAO,uBAAuB,IAAI,sBAAsB;AACzE;AAEO,MAAM,QAAQ,qBAAA;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]}
1
+ {"version":3,"file":"field-modal-select.js","sources":["../../../../../../node_modules/lodash-es/isSymbol.js","../../../../../../node_modules/lodash-es/_arrayMap.js","../../../../../../node_modules/lodash-es/_baseToString.js","../../../../../../node_modules/lodash-es/_copyObject.js","../../../../../../node_modules/lodash-es/_isIterateeCall.js","../../../../../../node_modules/lodash-es/_createAssigner.js","../../../../../../node_modules/lodash-es/_nativeKeysIn.js","../../../../../../node_modules/lodash-es/_baseKeysIn.js","../../../../../../node_modules/lodash-es/keysIn.js","../../../../../../node_modules/lodash-es/assignInWith.js","../../../../../../node_modules/lodash-es/toString.js","../../../../../../node_modules/lodash-es/isPlainObject.js","../../../../../../node_modules/lodash-es/isError.js","../../../../../../node_modules/lodash-es/attempt.js","../../../../../../node_modules/lodash-es/_basePropertyOf.js","../../../../../../node_modules/lodash-es/_escapeHtmlChar.js","../../../../../../node_modules/lodash-es/escape.js","../../../../../../node_modules/lodash-es/_baseValues.js","../../../../../../node_modules/lodash-es/_customDefaultsAssignIn.js","../../../../../../node_modules/lodash-es/_escapeStringChar.js","../../../../../../node_modules/lodash-es/_reInterpolate.js","../../../../../../node_modules/lodash-es/_reEscape.js","../../../../../../node_modules/lodash-es/_reEvaluate.js","../../../../../../node_modules/lodash-es/templateSettings.js","../../../../../../node_modules/lodash-es/template.js","../../src/module/field-modal-select.ts"],"sourcesContent":["import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nexport default isSymbol;\n","/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\nexport default arrayMap;\n","import Symbol from './_Symbol.js';\nimport arrayMap from './_arrayMap.js';\nimport isArray from './isArray.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isArray(value)) {\n // Recursively convert values (susceptible to call stack limits).\n return arrayMap(value, baseToString) + '';\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\nexport default baseToString;\n","import assignValue from './_assignValue.js';\nimport baseAssignValue from './_baseAssignValue.js';\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nexport default copyObject;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nexport default isIterateeCall;\n","import baseRest from './_baseRest.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nexport default createAssigner;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default nativeKeysIn;\n","import isObject from './isObject.js';\nimport isPrototype from './_isPrototype.js';\nimport nativeKeysIn from './_nativeKeysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeysIn;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeysIn from './_baseKeysIn.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nexport default keysIn;\n","import copyObject from './_copyObject.js';\nimport createAssigner from './_createAssigner.js';\nimport keysIn from './keysIn.js';\n\n/**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n});\n\nexport default assignInWith;\n","import baseToString from './_baseToString.js';\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\nexport default toString;\n","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\nimport isPlainObject from './isPlainObject.js';\n\n/** `Object#toString` result references. */\nvar domExcTag = '[object DOMException]',\n errorTag = '[object Error]';\n\n/**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\nfunction isError(value) {\n if (!isObjectLike(value)) {\n return false;\n }\n var tag = baseGetTag(value);\n return tag == errorTag || tag == domExcTag ||\n (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));\n}\n\nexport default isError;\n","import apply from './_apply.js';\nimport baseRest from './_baseRest.js';\nimport isError from './isError.js';\n\n/**\n * Attempts to invoke `func`, returning either the result or the caught error\n * object. Any additional arguments are provided to `func` when it's invoked.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Util\n * @param {Function} func The function to attempt.\n * @param {...*} [args] The arguments to invoke `func` with.\n * @returns {*} Returns the `func` result or error object.\n * @example\n *\n * // Avoid throwing errors for invalid selectors.\n * var elements = _.attempt(function(selector) {\n * return document.querySelectorAll(selector);\n * }, '>_>');\n *\n * if (_.isError(elements)) {\n * elements = [];\n * }\n */\nvar attempt = baseRest(function(func, args) {\n try {\n return apply(func, undefined, args);\n } catch (e) {\n return isError(e) ? e : new Error(e);\n }\n});\n\nexport default attempt;\n","/**\n * The base implementation of `_.propertyOf` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Function} Returns the new accessor function.\n */\nfunction basePropertyOf(object) {\n return function(key) {\n return object == null ? undefined : object[key];\n };\n}\n\nexport default basePropertyOf;\n","import basePropertyOf from './_basePropertyOf.js';\n\n/** Used to map characters to HTML entities. */\nvar htmlEscapes = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;'\n};\n\n/**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nvar escapeHtmlChar = basePropertyOf(htmlEscapes);\n\nexport default escapeHtmlChar;\n","import escapeHtmlChar from './_escapeHtmlChar.js';\nimport toString from './toString.js';\n\n/** Used to match HTML entities and HTML characters. */\nvar reUnescapedHtml = /[&<>\"']/g,\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n/**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional\n * characters use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value. See\n * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * When working with HTML you should always\n * [quote attribute values](http://wonko.com/post/html-escaping) to reduce\n * XSS vectors.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, &amp; pebbles'\n */\nfunction escape(string) {\n string = toString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n}\n\nexport default escape;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n return arrayMap(props, function(key) {\n return object[key];\n });\n}\n\nexport default baseValues;\n","import eq from './eq.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used by `_.defaults` to customize its `_.assignIn` use to assign properties\n * of source objects to the destination object for all destination properties\n * that resolve to `undefined`.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\nfunction customDefaultsAssignIn(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n}\n\nexport default customDefaultsAssignIn;\n","/** Used to escape characters for inclusion in compiled string literals. */\nvar stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\n/**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\nfunction escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n}\n\nexport default escapeStringChar;\n","/** Used to match template delimiters. */\nvar reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\nexport default reInterpolate;\n","/** Used to match template delimiters. */\nvar reEscape = /<%-([\\s\\S]+?)%>/g;\n\nexport default reEscape;\n","/** Used to match template delimiters. */\nvar reEvaluate = /<%([\\s\\S]+?)%>/g;\n\nexport default reEvaluate;\n","import escape from './escape.js';\nimport reEscape from './_reEscape.js';\nimport reEvaluate from './_reEvaluate.js';\nimport reInterpolate from './_reInterpolate.js';\n\n/**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB) as well as ES2015 template strings. Change the\n * following template settings to use alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type {Object}\n */\nvar templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type {RegExp}\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type {string}\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type {Object}\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type {Function}\n */\n '_': { 'escape': escape }\n }\n};\n\nexport default templateSettings;\n","import assignInWith from './assignInWith.js';\nimport attempt from './attempt.js';\nimport baseValues from './_baseValues.js';\nimport customDefaultsAssignIn from './_customDefaultsAssignIn.js';\nimport escapeStringChar from './_escapeStringChar.js';\nimport isError from './isError.js';\nimport isIterateeCall from './_isIterateeCall.js';\nimport keys from './keys.js';\nimport reInterpolate from './_reInterpolate.js';\nimport templateSettings from './templateSettings.js';\nimport toString from './toString.js';\n\n/** Error message constants. */\nvar INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';\n\n/** Used to match empty string literals in compiled template source. */\nvar reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n/**\n * Used to validate the `validate` option in `_.template` variable.\n *\n * Forbids characters which could potentially change the meaning of the function argument definition:\n * - \"(),\" (modification of function parameters)\n * - \"=\" (default value)\n * - \"[]{}\" (destructuring of function parameters)\n * - \"/\" (beginning of a comment)\n * - whitespace\n */\nvar reForbiddenIdentifierChars = /[()=,{}\\[\\]\\/\\s]/;\n\n/**\n * Used to match\n * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).\n */\nvar reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n/** Used to ensure capturing order of template delimiters. */\nvar reNoMatch = /($^)/;\n\n/** Used to match unescaped characters in compiled string literals. */\nvar reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is given, it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options={}] The options object.\n * @param {RegExp} [options.escape=_.templateSettings.escape]\n * The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]\n * The \"evaluate\" delimiter.\n * @param {Object} [options.imports=_.templateSettings.imports]\n * An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]\n * The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL='templateSources[n]']\n * The sourceURL of the compiled template.\n * @param {string} [options.variable='obj']\n * The data object variable name.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // Use the \"interpolate\" delimiter to create a compiled template.\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // Use the HTML \"escape\" delimiter to escape data property values.\n * var compiled = _.template('<b><%- value %></b>');\n * compiled({ 'value': '<script>' });\n * // => '<b>&lt;script&gt;</b>'\n *\n * // Use the \"evaluate\" delimiter to execute JavaScript and generate HTML.\n * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the internal `print` function in \"evaluate\" delimiters.\n * var compiled = _.template('<% print(\"hello \" + user); %>!');\n * compiled({ 'user': 'barney' });\n * // => 'hello barney!'\n *\n * // Use the ES template literal delimiter as an \"interpolate\" delimiter.\n * // Disable support by replacing the \"interpolate\" delimiter.\n * var compiled = _.template('hello ${ user }!');\n * compiled({ 'user': 'pebbles' });\n * // => 'hello pebbles!'\n *\n * // Use backslashes to treat delimiters as plain text.\n * var compiled = _.template('<%= \"\\\\<%- value %\\\\>\" %>');\n * compiled({ 'value': 'ignored' });\n * // => '<%- value %>'\n *\n * // Use the `imports` option to import `jQuery` as `jq`.\n * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';\n * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });\n * compiled({ 'users': ['fred', 'barney'] });\n * // => '<li>fred</li><li>barney</li>'\n *\n * // Use the `sourceURL` option to specify a custom sourceURL for the template.\n * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });\n * compiled(data);\n * // => Find the source of \"greeting.jst\" under the Sources tab or Resources panel of the web inspector.\n *\n * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.\n * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });\n * compiled.source;\n * // => function(data) {\n * // var __t, __p = '';\n * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';\n * // return __p;\n * // }\n *\n * // Use custom template delimiters.\n * _.templateSettings.interpolate = /{{([\\s\\S]+?)}}/g;\n * var compiled = _.template('hello {{ user }}!');\n * compiled({ 'user': 'mustache' });\n * // => 'hello mustache!'\n *\n * // Use the `source` property to inline compiled templates for meaningful\n * // line numbers in error messages and stack traces.\n * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\\\n * var JST = {\\\n * \"main\": ' + _.template(mainText).source + '\\\n * };\\\n * ');\n */\nfunction template(string, options, guard) {\n // Based on John Resig's `tmpl` implementation\n // (http://ejohn.org/blog/javascript-micro-templating/)\n // and Laura Doktorova's doT.js (https://github.com/olado/doT).\n var settings = templateSettings.imports._.templateSettings || templateSettings;\n\n if (guard && isIterateeCall(string, options, guard)) {\n options = undefined;\n }\n string = toString(string);\n options = assignInWith({}, options, settings, customDefaultsAssignIn);\n\n var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),\n importsKeys = keys(imports),\n importsValues = baseValues(imports, importsKeys);\n\n var isEscaping,\n isEvaluating,\n index = 0,\n interpolate = options.interpolate || reNoMatch,\n source = \"__p += '\";\n\n // Compile the regexp to match each delimiter.\n var reDelimiters = RegExp(\n (options.escape || reNoMatch).source + '|' +\n interpolate.source + '|' +\n (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +\n (options.evaluate || reNoMatch).source + '|$'\n , 'g');\n\n // Use a sourceURL for easier debugging.\n // The sourceURL gets injected into the source that's eval-ed, so be careful\n // to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in\n // and escape the comment, thus injecting code that gets evaled.\n var sourceURL = hasOwnProperty.call(options, 'sourceURL')\n ? ('//# sourceURL=' +\n (options.sourceURL + '').replace(/\\s/g, ' ') +\n '\\n')\n : '';\n\n string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {\n interpolateValue || (interpolateValue = esTemplateValue);\n\n // Escape characters that can't be included in string literals.\n source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);\n\n // Replace delimiters with snippets.\n if (escapeValue) {\n isEscaping = true;\n source += \"' +\\n__e(\" + escapeValue + \") +\\n'\";\n }\n if (evaluateValue) {\n isEvaluating = true;\n source += \"';\\n\" + evaluateValue + \";\\n__p += '\";\n }\n if (interpolateValue) {\n source += \"' +\\n((__t = (\" + interpolateValue + \")) == null ? '' : __t) +\\n'\";\n }\n index = offset + match.length;\n\n // The JS engine embedded in Adobe products needs `match` returned in\n // order to produce the correct `offset` value.\n return match;\n });\n\n source += \"';\\n\";\n\n // If `variable` is not specified wrap a with-statement around the generated\n // code to add the data object to the top of the scope chain.\n var variable = hasOwnProperty.call(options, 'variable') && options.variable;\n if (!variable) {\n source = 'with (obj) {\\n' + source + '\\n}\\n';\n }\n // Throw an error if a forbidden character was found in `variable`, to prevent\n // potential command injection attacks.\n else if (reForbiddenIdentifierChars.test(variable)) {\n throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);\n }\n\n // Cleanup code by stripping empty strings.\n source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)\n .replace(reEmptyStringMiddle, '$1')\n .replace(reEmptyStringTrailing, '$1;');\n\n // Frame code as the function body.\n source = 'function(' + (variable || 'obj') + ') {\\n' +\n (variable\n ? ''\n : 'obj || (obj = {});\\n'\n ) +\n \"var __t, __p = ''\" +\n (isEscaping\n ? ', __e = _.escape'\n : ''\n ) +\n (isEvaluating\n ? ', __j = Array.prototype.join;\\n' +\n \"function print() { __p += __j.call(arguments, '') }\\n\"\n : ';\\n'\n ) +\n source +\n 'return __p\\n}';\n\n var result = attempt(function() {\n return Function(importsKeys, sourceURL + 'return ' + source)\n .apply(undefined, importsValues);\n });\n\n // Provide the compiled function's source by its `toString` method or\n // the `source` property as a convenience for inlining compiled templates.\n result.source = source;\n if (isError(result)) {\n throw result;\n }\n return result;\n}\n\nexport default template;\n","import type { IFrameModalElement } from './iframe-modal';\nimport { data } from '../data';\nimport { __, highlight, html, selectOne, slideUp } from '../service';\nimport { template } from 'lodash-es';\n\nexport type ModalSelectCallback = (item: any) => void;\n\nexport function createCallback(type: 'list' | 'single', selector: string, modalSelector: string): ModalSelectCallback {\n switch (type) {\n // case 'tag':\n // return () => {\n //\n // };\n case 'list':\n return (item: any) => {\n const modalList = document.querySelector(selector) as any as ModalListSelectElement;\n\n if (!modalList.querySelector(`[data-value=\"${item.value}\"]`)) {\n modalList.appendItem(item, true);\n\n selectOne<IFrameModalElement>(modalSelector)?.close();\n } else {\n alert(__('unicorn.field.modal.already.selected'));\n }\n };\n\n case 'single':\n default:\n return (item) => {\n const element = document.querySelector<HTMLDivElement>(selector)!;\n\n const image = element.querySelector<HTMLDivElement>('[data-role=image]')!;\n const title = element.querySelector<HTMLInputElement>('[data-role=title]')!;\n const store = element.querySelector<HTMLInputElement>('[data-role=value]')!;\n\n if (image && item.image) {\n image.style.backgroundImage = `url(${item.image});`;\n }\n\n title.value = item.title || '';\n store.value = item.value || '';\n\n store.dispatchEvent(new CustomEvent('change'));\n\n selectOne<IFrameModalElement>(modalSelector)?.close();\n\n highlight(title);\n };\n }\n}\n\ninterface ModalListOptions {\n modalSelector: string;\n itemTemplate: string;\n sortable: boolean;\n dataKey: string;\n max: number;\n}\n\nexport interface ReceivedItem {\n value: string | number;\n title?: string;\n image?: string;\n [key: string]: any;\n}\n\nclass ModalListSelectElement extends HTMLElement {\n static is = 'uni-modal-list';\n\n itemTemplate!: ReturnType<typeof template>;\n options!: ModalListOptions;\n\n get listContainer() {\n return this.querySelector<HTMLDivElement>('[data-role=list-container]')!;\n }\n\n get modal() {\n return document.querySelector<IFrameModalElement>(this.options.modalSelector);\n }\n\n get items(): HTMLElement[] {\n return Array.from(this.listContainer.querySelectorAll<HTMLElement>('[data-value]'));\n }\n\n connectedCallback() {\n this.options = JSON.parse(this.getAttribute('options') || '{}');\n this.itemTemplate = template(document.querySelector(this.options.itemTemplate)!.innerHTML);\n\n const emptyInput = this.querySelector<HTMLInputElement>('[data-role=empty]');\n\n if (emptyInput) {\n emptyInput.name = emptyInput.dataset.name || '';\n }\n\n if (this.options.sortable) {\n import('sortablejs').then(({ default: Sortable }) => {\n new Sortable(this.listContainer, { handle: '.h-drag-handle', animation: 150 });\n });\n }\n\n const selectButton = this.querySelector<HTMLButtonElement>('[data-role=select]')!;\n selectButton.addEventListener('click', (e) => {\n this.open(e);\n });\n\n this.querySelector('[data-role=clear]')?.addEventListener('click', () => {\n this.removeAll();\n });\n\n selectButton.style.pointerEvents = '';\n\n this.render();\n }\n\n render() {\n const items: ReceivedItem[] = data('unicorn.modal-field')[this.options.dataKey] || [];\n\n items.forEach((item) => {\n this.appendItem(item);\n });\n }\n\n appendItem(item: ReceivedItem, highlights = false) {\n const itemHtml = html(this.itemTemplate({ item }));\n\n itemHtml.dataset.value = String(item.value);\n itemHtml.querySelector<HTMLButtonElement>('[data-role=remove]')?.addEventListener('click', () => {\n this.removeItem(item);\n });\n\n this.listContainer.appendChild(itemHtml);\n this.toggleRequired();\n\n if (highlights) {\n highlight(itemHtml);\n }\n }\n\n appendIfNotExists(item: ReceivedItem, highlights = false) {\n if (!this.isExists(item)) {\n this.appendItem(item, highlights);\n }\n }\n\n isExists(item: ReceivedItem | string | number): boolean {\n if (typeof item === 'object') {\n item = item.value;\n }\n\n return this.listContainer.querySelector(`[data-value=\"${item}\"]`) !== null;\n }\n\n getItemElement(item: ReceivedItem | string | number): HTMLElement | null {\n if (typeof item === 'object') {\n item = item.value;\n }\n\n return this.listContainer.querySelector<HTMLElement>(`[data-value=\"${item}\"]`);\n }\n\n getValues() {\n return this.items.map((item) => item.dataset.value);\n }\n\n removeItem(item: ReceivedItem | string | number) {\n if (typeof item === 'object') {\n item = item.value;\n }\n\n const element = this.listContainer.querySelector<HTMLElement>(`[data-value=\"${item}\"]`);\n\n if (element) {\n slideUp(element).then(() => {\n element.remove();\n this.toggleRequired();\n });\n }\n }\n\n async removeAll() {\n const promises: Promise<any>[] = [];\n\n for (const item of this.items) {\n promises.push(slideUp(item).then(() => item.remove()));\n }\n\n await Promise.all(promises);\n\n this.toggleRequired();\n }\n\n toggleRequired() {\n const placeholder = this.querySelector<HTMLInputElement>('[data-role=validation-placeholder]');\n\n if (placeholder) {\n placeholder.disabled = this.listContainer.children.length !== 0;\n }\n }\n\n open(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n\n const max = this.options.max;\n\n const target = event.target as HTMLAnchorElement;\n\n if (!max) {\n this.modal?.open(target.href, { size: 'modal-xl' });\n return;\n }\n\n if (this.listContainer.children.length >= max) {\n alert(\n __('unicorn.field.modal.max.selected', max)\n );\n\n return;\n }\n\n this.modal?.open(target.href, { size: 'modal-xl' });\n }\n}\n\nasync function init() {\n customElements.define(ModalListSelectElement.is, ModalListSelectElement);\n}\n\nexport interface ModalListenMessagesOptions {\n origin: string;\n instanceId: string;\n type: 'list' | 'single';\n selector: string;\n modalSelector: string;\n}\n\nexport function listenMessages(options: ModalListenMessagesOptions) {\n const callback = createCallback(options.type, options.selector, options.modalSelector);\n\n window.addEventListener('message', (e) => {\n if (e.origin === options.origin && Array.isArray(e.data) && e.data[0] === options.instanceId) {\n callback(e.data[1]);\n }\n });\n\n // Todo: Should remove this after 4.3 or 5.0\n // @ts-ignore\n window[options.instanceId] = callback;\n}\n\nexport const ready = init();\n\nexport interface ModalSelectModule {\n createCallback: typeof createCallback;\n listenMessages: typeof listenMessages;\n ready: typeof ready;\n}\n"],"names":["Symbol","objectProto","hasOwnProperty"],"mappings":";;;;AAIA,IAAI,YAAY;AAmBhB,SAAS,SAAS,OAAO;AACvB,SAAO,OAAO,SAAS,YACpB,aAAa,KAAK,KAAK,WAAW,KAAK,KAAK;AACjD;ACjBA,SAAS,SAAS,OAAO,UAAU;AACjC,MAAI,QAAQ,IACR,SAAS,SAAS,OAAO,IAAI,MAAM,QACnC,SAAS,MAAM,MAAM;AAEzB,SAAO,EAAE,QAAQ,QAAQ;AACvB,WAAO,KAAK,IAAI,SAAS,MAAM,KAAK,GAAG,OAAO,KAAK;AAAA,EACrD;AACA,SAAO;AACT;ACTA,IAAI,cAAcA,WAAM,uBAAGA,SAAO,WAAA,IAAY,QAC1C,iBAAiB,cAAW,uBAAG,YAAY,UAAA,IAAW;AAU1D,SAAS,aAAa,OAAO;AAE3B,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK,GAAG;AAElB,WAAO,SAAS,OAAO,YAAY,IAAI;AAAA,EACzC;AACA,MAAI,SAAS,KAAK,GAAG;AACnB,WAAO,iBAAiB,eAAe,KAAK,KAAK,IAAI;AAA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qBAAA;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]}
@@ -1,4 +1,5 @@
1
1
  import { i as isDebug, u as useHttpClient, _ as __, r as route, a as useUniDirective, b as animateTo, c as renderMessage, d as clearMessages, s as simpleNotify, e as clearNotifies, l as loadAlpine, f as initAlpineComponent, p as prepareAlpine, g as useFormValidation, h as addGlobalValidator, j as useFieldValidationInstance, k as useFormValidationInstance, m as useStack, n as useQueue, o as useSystemUri, q as useAssetUri, t as domready, v as selectOne, w as selectAll, x as getBoundedInstance, y as getBoundedInstanceList, z as module$1, A as h, B as html, C as delegate, D as debounce, E as throttle, F as simpleConfirm, G as simpleAlert, H as sprintfExports, I as base64UrlEncode, J as base64UrlDecode, K as uid, L as tid, M as serial, N as mark, O as useTomSelect, P as slideUp, Q as slideDown, R as slideToggle, S as fadeOut, T as fadeIn, U as highlight, V as useColorPicker, W as useDisableOnSubmit, X as useDisableIfStackNotEmpty, Y as useCheckboxesMultiSelect, Z as useKeepAlive, $ as useBs5KeepTab, a0 as useBs5ButtonRadio, a1 as useBs5Tooltip, a2 as useFormAsync, a3 as useGridAsync, a4 as useForm, a5 as useGrid } from "./unicorn.js";
2
+ import { Modal } from "bootstrap";
2
3
  function numberFormat(number, decimals = 0, decPoint = ".", thousandsSep = ",") {
3
4
  number = Number(number);
4
5
  const str = number.toFixed(decimals ? decimals : 0).toString().split(".");
@@ -197,7 +198,10 @@ function handleUI(app) {
197
198
  app.$ui.bootstrap = {
198
199
  tooltip: useBs5Tooltip,
199
200
  buttonRadio: useBs5ButtonRadio,
200
- keepTab: useBs5KeepTab
201
+ keepTab: useBs5KeepTab,
202
+ modal: (selector, config) => {
203
+ return module$1(selector, "bs.modal", (el) => Modal.getOrCreateInstance(el, config));
204
+ }
201
205
  };
202
206
  }
203
207
  async function handleFormGrid(app) {
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.js","sources":["../../../../../../node_modules/@lyrasoft/ts-toolkit/src/generic/number.ts","../../src/legacy/loader.ts","../../src/legacy/legacy.ts"],"sourcesContent":["export function numberFormat(number: string | number, decimals = 0, decPoint = '.', thousandsSep = ',') {\n number = Number(number);\n\n const str = number.toFixed(decimals ? decimals : 0).toString().split('.');\n const parts = [];\n\n for (var i = str[0].length; i > 0; i -= 3) {\n parts.unshift(str[0].substring(Math.max(0, i - 3), i));\n }\n\n str[0] = parts.join(thousandsSep ? thousandsSep : ',');\n\n return str.join(decPoint ? decPoint : '.');\n}\n","import { isDebug } from '../service';\n\nconst imports: Record<string, { promise: Promise<any>; resolve?: Function; }> = {};\n\nexport class LegacyLoader {\n static install(app: any) {\n const loader = app.$loader = new this(app);\n\n app.import = loader.import.bind(loader);\n app.importSync = loader.importSync.bind(loader);\n app.importCSS = loader.importCSS.bind(loader);\n app.minFileName = loader.minFileName.bind(loader);\n app.afterImported = loader.afterImported.bind(loader);\n }\n\n constructor(protected app: any) {\n //\n }\n\n doImport(src: string): Promise<any> {\n return S.import(src);\n }\n\n /**\n * Import modules or scripts.\n */\n import(...src: any[]): Promise<any|any[]> {\n if (src.length === 1) {\n return this.doImport(src[0]);\n }\n\n const promises: Promise<any>[] = [];\n\n src.forEach((link) => {\n promises.push(\n link instanceof Promise ? link : this.doImport(link)\n );\n });\n\n return Promise.all(promises);\n }\n\n /**\n * Import sync.\n */\n importSync(...src: any): Promise<any|any[]> {\n let promise: Promise<any> = Promise.resolve();\n let url: string[];\n const modules: any[] = [];\n\n while (url = src.shift()) {\n if (!Array.isArray(url)) {\n url = [ url ];\n }\n\n const target = url;\n promise = promise.then(\n () => this.import(...target).then((m) => {\n modules.push(m);\n return modules;\n })\n );\n }\n\n return promise;\n }\n\n /**\n * Import CSS files.\n */\n async importCSS(...src: any): Promise<any|any[]> {\n let modules: any = await this.import(...src);\n\n if (!Array.isArray(modules)) {\n modules = [modules];\n }\n\n const styles: CSSStyleSheet[] = (modules as any[]).map(module => module.default);\n\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...styles];\n }\n\n minFileName(fileName: string): string {\n const segments = fileName.split('.');\n const ext = segments.pop();\n\n if (isDebug()) {\n return segments.join('.') + '.min.' + ext;\n }\n\n return fileName;\n }\n\n asImported(name: string) {\n if (!imports[name]) {\n imports[name] = {\n promise: Promise.resolve(),\n resolve: undefined\n };\n } else {\n imports[name]?.resolve?.();\n }\n }\n\n /**\n * Add after import hook for some url or id.\n */\n afterImported(name: string, callback: (resolve: Function, reject?: Function) => void): Promise<any> {\n if (!imports[name]) {\n let r;\n imports[name] = {\n promise: new Promise((resolve) => {\n r = resolve;\n }),\n };\n\n imports[name].resolve = r;\n }\n\n imports[name].promise.then(callback);\n\n return imports[name].promise;\n }\n}\n\n","import { numberFormat } from '@lyrasoft/ts-toolkit/generic';\nimport { sprintf, vsprintf } from 'sprintf-js';\nimport {\n addGlobalValidator,\n useBs5ButtonRadio,\n useBs5KeepTab,\n useBs5Tooltip,\n useCheckboxesMultiSelect,\n useFieldValidationInstance,\n useForm,\n useFormAsync,\n useFormValidation,\n useFormValidationInstance,\n useGrid,\n useGridAsync,\n useHttpClient,\n useQueue,\n useStack,\n useTomSelect,\n useUniDirective\n} from '../composable';\nimport {\n __,\n animateTo,\n base64UrlDecode,\n base64UrlEncode,\n clearMessages,\n clearNotifies,\n debounce,\n delegate,\n domready,\n fadeIn,\n fadeOut,\n getBoundedInstance,\n getBoundedInstanceList,\n h,\n highlight,\n html,\n initAlpineComponent,\n isDebug,\n loadAlpine,\n mark,\n module,\n prepareAlpine,\n renderMessage,\n route,\n selectAll,\n selectOne,\n serial,\n simpleAlert,\n simpleConfirm,\n simpleNotify,\n slideDown,\n slideToggle,\n slideUp,\n throttle,\n tid,\n uid,\n useAssetUri,\n useColorPicker,\n useDisableIfStackNotEmpty,\n useDisableOnSubmit,\n useKeepAlive,\n useSystemUri\n} from '../service';\nimport { LegacyLoader } from './loader';\n\nexport async function useLegacyMethods(app: any) {\n const http = await useHttpClient();\n\n app.use(LegacyLoader);\n\n handleUri(app);\n handlerHelper(app);\n handleCrypto(app);\n\n app.__ = __;\n app.trans = __;\n app.route = route;\n app.$http = http;\n app.directive = useUniDirective;\n\n app.animate = animateTo;\n app.$animation = { to: animateTo };\n\n app.addMessage = renderMessage;\n app.clearMessages = clearMessages;\n app.notify = simpleNotify;\n app.clearNotifies = clearNotifies;\n\n app.loadAlpine = loadAlpine;\n app.initAlpine = initAlpineComponent;\n app.beforeAlpineInit = prepareAlpine;\n app.prepareAlpine = prepareAlpine;\n\n handleUI(app);\n\n await handleFormGrid(app);\n\n app.formValidation = useFormValidation;\n app.$validation = {\n get: useFormValidationInstance,\n getField: useFieldValidationInstance,\n addGlobalValidator: addGlobalValidator,\n import: () => useFormValidation()\n };\n\n app.stack = useStack;\n app.queue = useQueue;\n}\n\nfunction handleCrypto(app: any) {\n app.base64Encode = base64UrlEncode;\n app.base64Decode = base64UrlDecode;\n // app.uuid4 = uuid4;\n app.uid = uid;\n app.tid = tid;\n // app.md5 = md5;\n app.serial = serial;\n}\n\nfunction handleUri(app: any) {\n app.uri = useSystemUri;\n app.asset = useAssetUri;\n}\n\nfunction handlerHelper(app: any) {\n app.domready = domready;\n app.selectOne = selectOne;\n app.selectAll = selectAll;\n app.each = selectAll;\n app.getBoundedInstance = getBoundedInstance;\n app.getBoundedInstanceList = getBoundedInstanceList;\n app.module = module;\n app.h = h;\n app.html = html;\n // app.$get = get;\n // app.$set = set;\n app.delegate = delegate;\n app.debounce = debounce;\n app.throttle = throttle;\n app.isDebug = isDebug;\n app.confirm = simpleConfirm;\n app.alert = simpleAlert;\n app.numberFormat = numberFormat;\n app.sprintf = sprintf;\n app.vsprintf = vsprintf;\n // app.genRandomString = genRandomString;\n // app.defaultsDeep = defaultsDeep;\n}\n\nfunction handleUI(app: any) {\n app.$ui ??= {};\n app.$ui.addMessage = renderMessage;\n app.$ui.clearMessages = clearMessages;\n app.$ui.notify = simpleNotify;\n app.$ui.clearNotifies = clearNotifies;\n\n app.$ui.loadAlpine = loadAlpine;\n app.$ui.initAlpine = initAlpineComponent;\n app.$ui.beforeAlpineInit = prepareAlpine;\n app.$ui.prepareAlpine = prepareAlpine;\n\n app.$ui.mark = mark;\n app.$ui.tomSelect = useTomSelect;\n app.$ui.slideUp = slideUp;\n app.$ui.slideDown = slideDown;\n app.$ui.slideToggle = slideToggle;\n app.$ui.fadeOut = fadeOut;\n app.$ui.fadeIn = fadeIn;\n app.$ui.highlight = highlight;\n app.$ui.colorPicker = useColorPicker;\n app.$ui.disableOnSubmit = useDisableOnSubmit;\n app.$ui.disableIfStackNotEmpty = useDisableIfStackNotEmpty;\n app.$ui.checkboxesMultiSelect = useCheckboxesMultiSelect;\n app.$ui.keepAlive = useKeepAlive;\n app.$ui.bootstrap = {\n tooltip: useBs5Tooltip,\n buttonRadio: useBs5ButtonRadio,\n keepTab: useBs5KeepTab,\n };\n}\n\nasync function handleFormGrid(app: any) {\n await useFormAsync();\n await useGridAsync();\n\n app.form = useForm;\n app.grid = useGrid;\n}\n"],"names":["module","sprintf","vsprintf"],"mappings":";AAAO,SAAS,aAAa,QAAyB,WAAW,GAAG,WAAW,KAAK,eAAe,KAAK;AACtG,WAAS,OAAO,MAAM;AAEtB,QAAM,MAAM,OAAO,QAAQ,WAAW,WAAW,CAAC,EAAE,SAAA,EAAW,MAAM,GAAG;AACxE,QAAM,QAAQ,CAAA;AAEd,WAAS,IAAI,IAAI,CAAC,EAAE,QAAQ,IAAI,GAAG,KAAK,GAAG;AACzC,UAAM,QAAQ,IAAI,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,EACvD;AAEA,MAAI,CAAC,IAAI,MAAM,KAAK,eAAe,eAAe,GAAG;AAErD,SAAO,IAAI,KAAK,WAAW,WAAW,GAAG;AAC3C;ACXA,MAAM,UAA0E,CAAA;AAEzE,MAAM,aAAa;AAAA,EAWxB,YAAsB,KAAU;AAAV,SAAA,MAAA;AAAA,EAEtB;AAAA,EAZA,OAAO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,MAAI,IAAI,UAAU;AAClB,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,cAAc;AACtB,MAAI,IAAI,UAAU;AAClB,MAAI,IAAI,SAAS;AACjB,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,cAAc;AACtB,MAAI,IAAI,kBAAkB;AAC1B,MAAI,IAAI,yBAAyB;AACjC,MAAI,IAAI,wBAAwB;AAChC,MAAI,IAAI,YAAY;AACpB,MAAI,IAAI,YAAY;AAAA,IAClB,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,EAAA;AAEb;AAEA,eAAe,eAAe,KAAU;AACtC,QAAM,aAAA;AACN,QAAM,aAAA;AAEN,MAAI,OAAO;AACX,MAAI,OAAO;AACb;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"legacy.js","sources":["../../../../../../node_modules/@lyrasoft/ts-toolkit/src/generic/number.ts","../../src/legacy/loader.ts","../../src/legacy/legacy.ts"],"sourcesContent":["export function numberFormat(number: string | number, decimals = 0, decPoint = '.', thousandsSep = ',') {\n number = Number(number);\n\n const str = number.toFixed(decimals ? decimals : 0).toString().split('.');\n const parts = [];\n\n for (var i = str[0].length; i > 0; i -= 3) {\n parts.unshift(str[0].substring(Math.max(0, i - 3), i));\n }\n\n str[0] = parts.join(thousandsSep ? thousandsSep : ',');\n\n return str.join(decPoint ? decPoint : '.');\n}\n","import { isDebug } from '../service';\n\nconst imports: Record<string, { promise: Promise<any>; resolve?: Function; }> = {};\n\nexport class LegacyLoader {\n static install(app: any) {\n const loader = app.$loader = new this(app);\n\n app.import = loader.import.bind(loader);\n app.importSync = loader.importSync.bind(loader);\n app.importCSS = loader.importCSS.bind(loader);\n app.minFileName = loader.minFileName.bind(loader);\n app.afterImported = loader.afterImported.bind(loader);\n }\n\n constructor(protected app: any) {\n //\n }\n\n doImport(src: string): Promise<any> {\n return S.import(src);\n }\n\n /**\n * Import modules or scripts.\n */\n import(...src: any[]): Promise<any|any[]> {\n if (src.length === 1) {\n return this.doImport(src[0]);\n }\n\n const promises: Promise<any>[] = [];\n\n src.forEach((link) => {\n promises.push(\n link instanceof Promise ? link : this.doImport(link)\n );\n });\n\n return Promise.all(promises);\n }\n\n /**\n * Import sync.\n */\n importSync(...src: any): Promise<any|any[]> {\n let promise: Promise<any> = Promise.resolve();\n let url: string[];\n const modules: any[] = [];\n\n while (url = src.shift()) {\n if (!Array.isArray(url)) {\n url = [ url ];\n }\n\n const target = url;\n promise = promise.then(\n () => this.import(...target).then((m) => {\n modules.push(m);\n return modules;\n })\n );\n }\n\n return promise;\n }\n\n /**\n * Import CSS files.\n */\n async importCSS(...src: any): Promise<any|any[]> {\n let modules: any = await this.import(...src);\n\n if (!Array.isArray(modules)) {\n modules = [modules];\n }\n\n const styles: CSSStyleSheet[] = (modules as any[]).map(module => module.default);\n\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...styles];\n }\n\n minFileName(fileName: string): string {\n const segments = fileName.split('.');\n const ext = segments.pop();\n\n if (isDebug()) {\n return segments.join('.') + '.min.' + ext;\n }\n\n return fileName;\n }\n\n asImported(name: string) {\n if (!imports[name]) {\n imports[name] = {\n promise: Promise.resolve(),\n resolve: undefined\n };\n } else {\n imports[name]?.resolve?.();\n }\n }\n\n /**\n * Add after import hook for some url or id.\n */\n afterImported(name: string, callback: (resolve: Function, reject?: Function) => void): Promise<any> {\n if (!imports[name]) {\n let r;\n imports[name] = {\n promise: new Promise((resolve) => {\n r = resolve;\n }),\n };\n\n imports[name].resolve = r;\n }\n\n imports[name].promise.then(callback);\n\n return imports[name].promise;\n }\n}\n\n","import { numberFormat } from '@lyrasoft/ts-toolkit/generic';\nimport { Modal } from 'bootstrap';\nimport { sprintf, vsprintf } from 'sprintf-js';\nimport {\n addGlobalValidator,\n useBs5ButtonRadio,\n useBs5KeepTab,\n useBs5Tooltip,\n useCheckboxesMultiSelect,\n useFieldValidationInstance,\n useForm,\n useFormAsync,\n useFormValidation,\n useFormValidationInstance,\n useGrid,\n useGridAsync,\n useHttpClient,\n useQueue,\n useStack,\n useTomSelect,\n useUniDirective\n} from '../composable';\nimport {\n __,\n animateTo,\n base64UrlDecode,\n base64UrlEncode,\n clearMessages,\n clearNotifies,\n debounce,\n delegate,\n domready,\n fadeIn,\n fadeOut,\n getBoundedInstance,\n getBoundedInstanceList,\n h,\n highlight,\n html,\n initAlpineComponent,\n isDebug,\n loadAlpine,\n mark,\n module,\n prepareAlpine,\n renderMessage,\n route,\n selectAll,\n selectOne,\n serial,\n simpleAlert,\n simpleConfirm,\n simpleNotify,\n slideDown,\n slideToggle,\n slideUp,\n throttle,\n tid,\n uid,\n useAssetUri,\n useColorPicker,\n useDisableIfStackNotEmpty,\n useDisableOnSubmit,\n useKeepAlive,\n useSystemUri\n} from '../service';\nimport { LegacyLoader } from './loader';\n\nexport async function useLegacyMethods(app: any) {\n const http = await useHttpClient();\n\n app.use(LegacyLoader);\n\n handleUri(app);\n handlerHelper(app);\n handleCrypto(app);\n\n app.__ = __;\n app.trans = __;\n app.route = route;\n app.$http = http;\n app.directive = useUniDirective;\n\n app.animate = animateTo;\n app.$animation = { to: animateTo };\n\n app.addMessage = renderMessage;\n app.clearMessages = clearMessages;\n app.notify = simpleNotify;\n app.clearNotifies = clearNotifies;\n\n app.loadAlpine = loadAlpine;\n app.initAlpine = initAlpineComponent;\n app.beforeAlpineInit = prepareAlpine;\n app.prepareAlpine = prepareAlpine;\n\n handleUI(app);\n\n await handleFormGrid(app);\n\n app.formValidation = useFormValidation;\n app.$validation = {\n get: useFormValidationInstance,\n getField: useFieldValidationInstance,\n addGlobalValidator: addGlobalValidator,\n import: () => useFormValidation()\n };\n\n app.stack = useStack;\n app.queue = useQueue;\n}\n\nfunction handleCrypto(app: any) {\n app.base64Encode = base64UrlEncode;\n app.base64Decode = base64UrlDecode;\n // app.uuid4 = uuid4;\n app.uid = uid;\n app.tid = tid;\n // app.md5 = md5;\n app.serial = serial;\n}\n\nfunction handleUri(app: any) {\n app.uri = useSystemUri;\n app.asset = useAssetUri;\n}\n\nfunction handlerHelper(app: any) {\n app.domready = domready;\n app.selectOne = selectOne;\n app.selectAll = selectAll;\n app.each = selectAll;\n app.getBoundedInstance = getBoundedInstance;\n app.getBoundedInstanceList = getBoundedInstanceList;\n app.module = module;\n app.h = h;\n app.html = html;\n // app.$get = get;\n // app.$set = set;\n app.delegate = delegate;\n app.debounce = debounce;\n app.throttle = throttle;\n app.isDebug = isDebug;\n app.confirm = simpleConfirm;\n app.alert = simpleAlert;\n app.numberFormat = numberFormat;\n app.sprintf = sprintf;\n app.vsprintf = vsprintf;\n // app.genRandomString = genRandomString;\n // app.defaultsDeep = defaultsDeep;\n}\n\nfunction handleUI(app: any) {\n app.$ui ??= {};\n app.$ui.addMessage = renderMessage;\n app.$ui.clearMessages = clearMessages;\n app.$ui.notify = simpleNotify;\n app.$ui.clearNotifies = clearNotifies;\n\n app.$ui.loadAlpine = loadAlpine;\n app.$ui.initAlpine = initAlpineComponent;\n app.$ui.beforeAlpineInit = prepareAlpine;\n app.$ui.prepareAlpine = prepareAlpine;\n\n app.$ui.mark = mark;\n app.$ui.tomSelect = useTomSelect;\n app.$ui.slideUp = slideUp;\n app.$ui.slideDown = slideDown;\n app.$ui.slideToggle = slideToggle;\n app.$ui.fadeOut = fadeOut;\n app.$ui.fadeIn = fadeIn;\n app.$ui.highlight = highlight;\n app.$ui.colorPicker = useColorPicker;\n app.$ui.disableOnSubmit = useDisableOnSubmit;\n app.$ui.disableIfStackNotEmpty = useDisableIfStackNotEmpty;\n app.$ui.checkboxesMultiSelect = useCheckboxesMultiSelect;\n app.$ui.keepAlive = useKeepAlive;\n app.$ui.bootstrap = {\n tooltip: useBs5Tooltip,\n buttonRadio: useBs5ButtonRadio,\n keepTab: useBs5KeepTab,\n modal: (selector: any, config: any) => {\n return module(selector, 'bs.modal', (el) => Modal.getOrCreateInstance(el, config));\n }\n };\n}\n\nasync function handleFormGrid(app: any) {\n await useFormAsync();\n await useGridAsync();\n\n app.form = useForm;\n app.grid = use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
package/dist/index.d.ts CHANGED
@@ -470,6 +470,8 @@ declare interface ListDependentOptions {
470
470
  };
471
471
  }
472
472
 
473
+ declare function listenMessages(options: ModalListenMessagesOptions): void;
474
+
473
475
  declare type ListItems = Record<string, any>[];
474
476
 
475
477
  export declare function loadAlpine(callback?: Nullable<AlpinePrepareCallback>): Promise<Alpine_2>;
@@ -480,10 +482,19 @@ declare type MaybeGroupedListItems = Record<string, ListItems> | ListItems;
480
482
 
481
483
  declare type MaybePromise<T> = T | Promise<T>;
482
484
 
485
+ declare interface ModalListenMessagesOptions {
486
+ origin: string;
487
+ instanceId: string;
488
+ type: 'list' | 'single';
489
+ selector: string;
490
+ modalSelector: string;
491
+ }
492
+
483
493
  declare type ModalSelectCallback = (item: any) => void;
484
494
 
485
495
  declare interface ModalSelectModule {
486
496
  createCallback: typeof createCallback;
497
+ listenMessages: typeof listenMessages;
487
498
  ready: typeof ready_2;
488
499
  }
489
500
 
@@ -1502,6 +1513,11 @@ declare module 'axios' {
1502
1513
  }
1503
1514
  }
1504
1515
 
1516
+
1517
+ declare global {
1518
+ var tinymce: TinyMCE;
1519
+ }
1520
+
1505
1521
  declare global {
1506
1522
  var S: any;
1507
1523
  }
@@ -1512,8 +1528,3 @@ declare global {
1512
1528
  bootstrap: typeof bootstrap;
1513
1529
  }
1514
1530
  }
1515
-
1516
-
1517
- declare global {
1518
- var tinymce: TinyMCE;
1519
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windwalker-io/unicorn-next",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Unicorn framework js library",
5
5
  "type": "module",
6
6
  "typings": "dist/index.d.ts",
@@ -11,7 +11,8 @@
11
11
  "preview": "vite preview",
12
12
  "dev:assets": "vite build --watch --mode development --config vite.assets.config.ts",
13
13
  "build:assets": "vite build --config vite.assets.config.ts",
14
- "build:prod": "yarn build && yarn build:assets"
14
+ "build:prod": "yarn build && yarn build:assets",
15
+ "upgrade": "yarn up '**' -R"
15
16
  },
16
17
  "sideEffects": false,
17
18
  "repository": {
@@ -1,4 +1,5 @@
1
1
  import { numberFormat } from '@lyrasoft/ts-toolkit/generic';
2
+ import { Modal } from 'bootstrap';
2
3
  import { sprintf, vsprintf } from 'sprintf-js';
3
4
  import {
4
5
  addGlobalValidator,
@@ -178,6 +179,9 @@ function handleUI(app: any) {
178
179
  tooltip: useBs5Tooltip,
179
180
  buttonRadio: useBs5ButtonRadio,
180
181
  keepTab: useBs5KeepTab,
182
+ modal: (selector: any, config: any) => {
183
+ return module(selector, 'bs.modal', (el) => Modal.getOrCreateInstance(el, config));
184
+ }
181
185
  };
182
186
  }
183
187
 
@@ -57,6 +57,13 @@ interface ModalListOptions {
57
57
  max: number;
58
58
  }
59
59
 
60
+ export interface ReceivedItem {
61
+ value: string | number;
62
+ title?: string;
63
+ image?: string;
64
+ [key: string]: any;
65
+ }
66
+
60
67
  class ModalListSelectElement extends HTMLElement {
61
68
  static is = 'uni-modal-list';
62
69
 
@@ -71,8 +78,8 @@ class ModalListSelectElement extends HTMLElement {
71
78
  return document.querySelector<IFrameModalElement>(this.options.modalSelector);
72
79
  }
73
80
 
74
- get items(): Element[] {
75
- return Array.from(this.listContainer.children);
81
+ get items(): HTMLElement[] {
82
+ return Array.from(this.listContainer.querySelectorAll<HTMLElement>('[data-value]'));
76
83
  }
77
84
 
78
85
  connectedCallback() {
@@ -97,9 +104,7 @@ class ModalListSelectElement extends HTMLElement {
97
104
  });
98
105
 
99
106
  this.querySelector('[data-role=clear]')?.addEventListener('click', () => {
100
- this.items.forEach((item) => {
101
- item.querySelector<HTMLButtonElement>('[data-role=remove]')?.click();
102
- });
107
+ this.removeAll();
103
108
  });
104
109
 
105
110
  selectButton.style.pointerEvents = '';
@@ -108,22 +113,19 @@ class ModalListSelectElement extends HTMLElement {
108
113
  }
109
114
 
110
115
  render() {
111
- const items: Record<string, any>[] = data('unicorn.modal-field')[this.options.dataKey] || [];
116
+ const items: ReceivedItem[] = data('unicorn.modal-field')[this.options.dataKey] || [];
112
117
 
113
118
  items.forEach((item) => {
114
119
  this.appendItem(item);
115
120
  });
116
121
  }
117
122
 
118
- appendItem(item: Record<string, any>, highlights = false) {
123
+ appendItem(item: ReceivedItem, highlights = false) {
119
124
  const itemHtml = html(this.itemTemplate({ item }));
120
125
 
121
- itemHtml.dataset.value = item.value;
126
+ itemHtml.dataset.value = String(item.value);
122
127
  itemHtml.querySelector<HTMLButtonElement>('[data-role=remove]')?.addEventListener('click', () => {
123
- slideUp(itemHtml).then(() => {
124
- itemHtml.remove();
125
- this.toggleRequired();
126
- });
128
+ this.removeItem(item);
127
129
  });
128
130
 
129
131
  this.listContainer.appendChild(itemHtml);
@@ -134,6 +136,59 @@ class ModalListSelectElement extends HTMLElement {
134
136
  }
135
137
  }
136
138
 
139
+ appendIfNotExists(item: ReceivedItem, highlights = false) {
140
+ if (!this.isExists(item)) {
141
+ this.appendItem(item, highlights);
142
+ }
143
+ }
144
+
145
+ isExists(item: ReceivedItem | string | number): boolean {
146
+ if (typeof item === 'object') {
147
+ item = item.value;
148
+ }
149
+
150
+ return this.listContainer.querySelector(`[data-value="${item}"]`) !== null;
151
+ }
152
+
153
+ getItemElement(item: ReceivedItem | string | number): HTMLElement | null {
154
+ if (typeof item === 'object') {
155
+ item = item.value;
156
+ }
157
+
158
+ return this.listContainer.querySelector<HTMLElement>(`[data-value="${item}"]`);
159
+ }
160
+
161
+ getValues() {
162
+ return this.items.map((item) => item.dataset.value);
163
+ }
164
+
165
+ removeItem(item: ReceivedItem | string | number) {
166
+ if (typeof item === 'object') {
167
+ item = item.value;
168
+ }
169
+
170
+ const element = this.listContainer.querySelector<HTMLElement>(`[data-value="${item}"]`);
171
+
172
+ if (element) {
173
+ slideUp(element).then(() => {
174
+ element.remove();
175
+ this.toggleRequired();
176
+ });
177
+ }
178
+ }
179
+
180
+ async removeAll() {
181
+ const promises: Promise<any>[] = [];
182
+
183
+ for (const item of this.items) {
184
+ promises.push(slideUp(item).then(() => item.remove()));
185
+ }
186
+
187
+ await Promise.all(promises);
188
+
189
+ this.toggleRequired();
190
+ }
191
+
137
192
  toggleRequired() {
138
193
  const placeholder = this.querySelector<HTMLInputElement>('[data-role=validation-placeholder]');
139
194
 
@@ -171,9 +226,32 @@ async function init() {
171
226
  customElements.define(ModalListSelectElement.is, ModalListSelectElement);
172
227
  }
173
228
 
229
+ export interface ModalListenMessagesOptions {
230
+ origin: string;
231
+ instanceId: string;
232
+ type: 'list' | 'single';
233
+ selector: string;
234
+ modalSelector: string;
235
+ }
236
+
237
+ export function listenMessages(options: ModalListenMessagesOptions) {
238
+ const callback = createCallback(options.type, options.selector, options.modalSelector);
239
+
240
+ window.addEventListener('message', (e) => {
241
+ if (e.origin === options.origin && Array.isArray(e.data) && e.data[0] === options.instanceId) {
242
+ callback(e.data[1]);
243
+ }
244
+ });
245
+
246
+ // Todo: Should remove this after 4.3 or 5.0
247
+ // @ts-ignore
248
+ window[options.instanceId] = callback;
249
+ }
250
+
174
251
  export const ready = init();
175
252
 
176
253
  export interface ModalSelectModule {
177
254
  createCallback: typeof createCallback;
255
+ listenMessages: typeof listenMessages;
178
256
  ready: typeof ready;
179
257
  }