@ldmjs/ui 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/index.css +1 -1
- package/dist/index.js +66 -43
- package/dist/lib/multiselect.js +1 -1
- package/package.json +1 -1
package/dist/css/index.css
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
.ld-ragiogroup .validate[data-v-bd740210]{overflow:hidden;height:20px}.ld-ragiogroup--row[data-v-bd740210] .ld-radiobutton:not(:first-child){margin-left:8px}
|
|
12
12
|
.ld-textarea[data-v-5e5438c4]{display:flex;min-width:100%;max-width:100%;width:100%}[data-v-5e5438c4] .none-resizable textarea{resize:none}
|
|
13
13
|
.ld-select[data-v-5d9c6c2a]{position:relative;min-width:100%}.ld-select[data-v-5d9c6c2a] .v-field__append-inner{display:none}.ld-select[data-v-5d9c6c2a] .v-select{position:relative}.ld-select[data-v-5d9c6c2a] .v-select:before{display:block;position:absolute;right:20px;top:calc(var(--input-height)/2);margin-top:-2px;color:var(--grey);border-style:solid;border-width:5px 5px 0;border-color:var(--grey) rgba(0,0,0,0) rgba(0,0,0,0);transition:transform .2s ease;content:"";z-index:1}.ld-select[data-v-5d9c6c2a] .v-select--active-menu:before{transform:rotate(180deg)}input[type=checkbox]+.v-icon[data-v-5d9c6c2a]{display:block;width:12px !important;height:12px !important;font-size:10px !important;background-color:var(--white);color:rgba(0,0,0,0);border:1px solid var(--grey-l-5)}input[type=checkbox]:checked+.v-icon[data-v-5d9c6c2a]{background-color:var(--primary-l-2);color:var(--white);font-size:10px;font-weight:bold}.v-list-item--density-compact.v-list-item--one-line[data-v-5d9c6c2a]{min-height:var(--input-height)}.v-list-item--density-compact.v-list-item--one-line[data-v-5d9c6c2a] .v-list-item__content{display:flex;flex-wrap:nowrap}.v-list-item--density-compact.v-list-item--one-line[data-v-5d9c6c2a] .v-list-item__content .v-list-item-title{font-size:var(--font-size)}
|
|
14
|
-
.ld-combobox[data-v-
|
|
14
|
+
.ld-combobox[data-v-af1428d4]{display:flex;min-width:100%;max-width:100%;width:100%}.ld-combobox .combobox-validate[data-v-af1428d4]{overflow:hidden;height:20px}.ld-combobox .combobox-loading[data-v-af1428d4]{position:absolute;left:0;bottom:0;width:calc(100% - var(--input-height));height:3px;overflow:hidden;background-color:var(--grey-l-5)}.ld-combobox .combobox-loading[data-v-af1428d4]:before{content:"";display:block;position:absolute;top:0;left:0;width:25%;height:100%;background-color:var(--primary);animation:loading-af1428d4 1.4s linear;animation-iteration-count:infinite}@keyframes loading-af1428d4{from{transform:translateX(-300%)}to{transform:translateX(500%)}}
|
|
15
15
|
.time-selector[data-v-15511ea0]{display:flex;flex-wrap:wrap;max-width:186px;padding:3px}.time-selector>span[data-v-15511ea0]{display:inline-block;width:100%;text-align:center;font-family:"Roboto";font-size:var(--font-size-2);font-weight:700}.time-selector .v-btn[data-v-15511ea0]{width:30px !important;height:30px !important;max-width:30px !important;max-height:30px !important;min-width:30px !important;min-height:30px !important;margin:3px}.ld-timepicker-validate[data-v-15511ea0]{overflow:hidden;height:20px}
|
|
16
16
|
.ld-text-viewer[data-v-3fa037a4]{min-width:100%;display:flex;flex-direction:column;white-space:break-spaces;font-size:var(--font-size)}.ld-text-viewer .column[data-v-3fa037a4]{flex-flow:column}
|
|
17
17
|
.ld-edit-masked-text[data-v-33aa4ec6]{min-width:100%;font-size:inherit !important;display:flex}.ld-edit-masked-text .column[data-v-33aa4ec6]{flex-flow:column}input[data-v-33aa4ec6]{border:1px solid var(--grey-l-5);border-radius:var(--border-radius);width:100%;padding:0 8px;font-size:var(--font-size);height:var(--input-height)}input[data-v-33aa4ec6]:focus,input[data-v-33aa4ec6]:active{outline:none;border:1px solid var(--grey-l-4)}.ld-edit-masked-text-validate[data-v-33aa4ec6]{overflow:hidden;height:20px}
|
package/dist/index.js
CHANGED
|
@@ -7453,7 +7453,7 @@ let DatepickerComponent = class DatepickerComponent extends (0,external_vue_clas
|
|
|
7453
7453
|
},
|
|
7454
7454
|
},
|
|
7455
7455
|
format: date => {
|
|
7456
|
-
return this.
|
|
7456
|
+
return this.formatDate(date);
|
|
7457
7457
|
},
|
|
7458
7458
|
parse: str => {
|
|
7459
7459
|
return this.parseDate(str);
|
|
@@ -7644,6 +7644,18 @@ let DatepickerComponent = class DatepickerComponent extends (0,external_vue_clas
|
|
|
7644
7644
|
});
|
|
7645
7645
|
return !this.validationMessage;
|
|
7646
7646
|
}
|
|
7647
|
+
formatDate(date) {
|
|
7648
|
+
if (!date) {
|
|
7649
|
+
return '';
|
|
7650
|
+
}
|
|
7651
|
+
if (this.localeRu) {
|
|
7652
|
+
return date.toLocaleDateString(this.locale);
|
|
7653
|
+
}
|
|
7654
|
+
if (this.localeEn) {
|
|
7655
|
+
const { d, m, y } = datetime.parseDate(date.toLocaleDateString(this.locale));
|
|
7656
|
+
return `${d}/${m}/${y}`;
|
|
7657
|
+
}
|
|
7658
|
+
}
|
|
7647
7659
|
parseDate(value) {
|
|
7648
7660
|
if (!value) {
|
|
7649
7661
|
return null;
|
|
@@ -13114,33 +13126,33 @@ function ld_select_reg(vue, options) {
|
|
|
13114
13126
|
}
|
|
13115
13127
|
/* harmony default export */ const src_ld_select = (ld_select_reg);
|
|
13116
13128
|
|
|
13117
|
-
;// ./node_modules/ts-loader/index.js??clonedRuleSet-1.use!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use!./src/ld-combobox/ld-combobox.vue?vue&type=template&id=
|
|
13129
|
+
;// ./node_modules/ts-loader/index.js??clonedRuleSet-1.use!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use!./src/ld-combobox/ld-combobox.vue?vue&type=template&id=af1428d4&scoped=true&ts=true
|
|
13118
13130
|
|
|
13119
|
-
const
|
|
13131
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_1 = {
|
|
13120
13132
|
class: "w-full overflow-hidden",
|
|
13121
13133
|
style: { "border-radius": "var(--border-radius)" }
|
|
13122
13134
|
};
|
|
13123
|
-
const
|
|
13124
|
-
const
|
|
13125
|
-
const
|
|
13135
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_2 = { class: "w-full d-flex position-relative" };
|
|
13136
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_3 = { class: "text-crop" };
|
|
13137
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_4 = {
|
|
13126
13138
|
key: 0,
|
|
13127
13139
|
class: "d-flex align-center"
|
|
13128
13140
|
};
|
|
13129
|
-
const
|
|
13130
|
-
const
|
|
13141
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_5 = { class: "d-flex flex-column justify-center" };
|
|
13142
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_6 = {
|
|
13131
13143
|
key: 0,
|
|
13132
13144
|
class: "grey--text",
|
|
13133
13145
|
style: { "font-size": "var(--font-size--1)" }
|
|
13134
13146
|
};
|
|
13135
|
-
const
|
|
13147
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_7 = {
|
|
13136
13148
|
key: 0,
|
|
13137
13149
|
class: "combobox-loading"
|
|
13138
13150
|
};
|
|
13139
|
-
const
|
|
13151
|
+
const ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_8 = {
|
|
13140
13152
|
key: 0,
|
|
13141
13153
|
class: "combobox-validate"
|
|
13142
13154
|
};
|
|
13143
|
-
function
|
|
13155
|
+
function ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
13144
13156
|
const _component_ld_label = (0,external_vue_.resolveComponent)("ld-label");
|
|
13145
13157
|
const _component_small_chip = (0,external_vue_.resolveComponent)("small-chip");
|
|
13146
13158
|
const _component_v_col = (0,external_vue_.resolveComponent)("v-col");
|
|
@@ -13165,8 +13177,8 @@ function ld_comboboxvue_type_template_id_5e97d7e3_scoped_true_ts_true_render(_ct
|
|
|
13165
13177
|
class: (0,external_vue_.normalizeClass)(_ctx.inputSizeClasses)
|
|
13166
13178
|
}, {
|
|
13167
13179
|
default: (0,external_vue_.withCtx)(() => [
|
|
13168
|
-
(0,external_vue_.createElementVNode)("div",
|
|
13169
|
-
(0,external_vue_.createElementVNode)("div",
|
|
13180
|
+
(0,external_vue_.createElementVNode)("div", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_1, [
|
|
13181
|
+
(0,external_vue_.createElementVNode)("div", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_2, [
|
|
13170
13182
|
(0,external_vue_.createVNode)(_component_multiselect, {
|
|
13171
13183
|
ref: "multiselect",
|
|
13172
13184
|
modelValue: _ctx.selected,
|
|
@@ -13176,6 +13188,7 @@ function ld_comboboxvue_type_template_id_5e97d7e3_scoped_true_ts_true_render(_ct
|
|
|
13176
13188
|
],
|
|
13177
13189
|
"track-by": "id",
|
|
13178
13190
|
class: "multiselect--arrow",
|
|
13191
|
+
uid: _ctx.uid,
|
|
13179
13192
|
multiple: _ctx.multiselect,
|
|
13180
13193
|
placeholder: _ctx.placeholder,
|
|
13181
13194
|
"select-label": '',
|
|
@@ -13208,7 +13221,7 @@ function ld_comboboxvue_type_template_id_5e97d7e3_scoped_true_ts_true_render(_ct
|
|
|
13208
13221
|
"onClick:close": ($event) => (_ctx.onRemoveItem(option))
|
|
13209
13222
|
}, {
|
|
13210
13223
|
default: (0,external_vue_.withCtx)(() => [
|
|
13211
|
-
(0,external_vue_.createElementVNode)("span",
|
|
13224
|
+
(0,external_vue_.createElementVNode)("span", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_3, (0,external_vue_.toDisplayString)(_ctx.$utils.deepValueGetter(option, this.itemTitle)), 1)
|
|
13212
13225
|
]),
|
|
13213
13226
|
_: 2
|
|
13214
13227
|
}, 1032, ["color", "closable", "onClick:close"]))
|
|
@@ -13236,7 +13249,7 @@ function ld_comboboxvue_type_template_id_5e97d7e3_scoped_true_ts_true_render(_ct
|
|
|
13236
13249
|
(0,external_vue_.createVNode)(_component_v_col, { class: "d-flex align-center py-1" }, {
|
|
13237
13250
|
default: (0,external_vue_.withCtx)(() => [
|
|
13238
13251
|
(_ctx.multiselect)
|
|
13239
|
-
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div",
|
|
13252
|
+
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_4, [
|
|
13240
13253
|
((0,external_vue_.openBlock)(), (0,external_vue_.createBlock)((0,external_vue_.resolveDynamicComponent)(_ctx.$ldmui.options.aliases['ld-checkbox']), {
|
|
13241
13254
|
key: JSON.stringify(option),
|
|
13242
13255
|
"model-value": _ctx.checkedItems,
|
|
@@ -13251,13 +13264,13 @@ function ld_comboboxvue_type_template_id_5e97d7e3_scoped_true_ts_true_render(_ct
|
|
|
13251
13264
|
}, [
|
|
13252
13265
|
(0,external_vue_.renderSlot)(_ctx.$slots, "option-icon", (0,external_vue_.normalizeProps)((0,external_vue_.guardReactiveProps)({ item: option, isSelected: _ctx.checkedItems.includes(_ctx.itemIdentity(option)) })), undefined, true),
|
|
13253
13266
|
_cache[2] || (_cache[2] = (0,external_vue_.createTextVNode)()),
|
|
13254
|
-
(0,external_vue_.createElementVNode)("div",
|
|
13267
|
+
(0,external_vue_.createElementVNode)("div", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_5, [
|
|
13255
13268
|
(0,external_vue_.renderSlot)(_ctx.$slots, "option", (0,external_vue_.normalizeProps)((0,external_vue_.guardReactiveProps)({ item: option, isSelected: _ctx.checkedItems.includes(_ctx.itemIdentity(option)) })), () => [
|
|
13256
13269
|
(0,external_vue_.createElementVNode)("div", null, (0,external_vue_.toDisplayString)(_ctx.$utils.deepValueGetter(option, _ctx.itemTitle)), 1)
|
|
13257
13270
|
], true),
|
|
13258
13271
|
_cache[1] || (_cache[1] = (0,external_vue_.createTextVNode)()),
|
|
13259
13272
|
(_ctx.optionHint)
|
|
13260
|
-
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div",
|
|
13273
|
+
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_6, [
|
|
13261
13274
|
(0,external_vue_.renderSlot)(_ctx.$slots, "option-hint", (0,external_vue_.normalizeProps)((0,external_vue_.guardReactiveProps)({ item: option })), undefined, true)
|
|
13262
13275
|
]))
|
|
13263
13276
|
: (0,external_vue_.createCommentVNode)("", true)
|
|
@@ -13274,16 +13287,16 @@ function ld_comboboxvue_type_template_id_5e97d7e3_scoped_true_ts_true_render(_ct
|
|
|
13274
13287
|
(0,external_vue_.createElementVNode)("span", null, (0,external_vue_.toDisplayString)(_ctx.message), 1)
|
|
13275
13288
|
]),
|
|
13276
13289
|
_: 3
|
|
13277
|
-
}, 8, ["modelValue", "multiple", "placeholder", "options", "searchable", "internal-search", "close-on-select", "disabled", "limit", "tabindex", "allowEmpty", "onClose", "onOpen", "onSearchChange", "onUpdate:modelValue"]),
|
|
13290
|
+
}, 8, ["modelValue", "uid", "multiple", "placeholder", "options", "searchable", "internal-search", "close-on-select", "disabled", "limit", "tabindex", "allowEmpty", "onClose", "onOpen", "onSearchChange", "onUpdate:modelValue"]),
|
|
13278
13291
|
_cache[7] || (_cache[7] = (0,external_vue_.createTextVNode)()),
|
|
13279
13292
|
(_ctx.loading)
|
|
13280
|
-
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div",
|
|
13293
|
+
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_7))
|
|
13281
13294
|
: (0,external_vue_.createCommentVNode)("", true)
|
|
13282
13295
|
])
|
|
13283
13296
|
]),
|
|
13284
13297
|
_cache[8] || (_cache[8] = (0,external_vue_.createTextVNode)()),
|
|
13285
13298
|
(!_ctx.hideDetails)
|
|
13286
|
-
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div",
|
|
13299
|
+
? ((0,external_vue_.openBlock)(), (0,external_vue_.createElementBlock)("div", ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_hoisted_8, [
|
|
13287
13300
|
(0,external_vue_.createVNode)(external_vue_.Transition, { name: "squash" }, {
|
|
13288
13301
|
default: (0,external_vue_.withCtx)(() => [
|
|
13289
13302
|
(_ctx.showHint)
|
|
@@ -13306,7 +13319,7 @@ function ld_comboboxvue_type_template_id_5e97d7e3_scoped_true_ts_true_render(_ct
|
|
|
13306
13319
|
}));
|
|
13307
13320
|
}
|
|
13308
13321
|
|
|
13309
|
-
;// ./src/ld-combobox/ld-combobox.vue?vue&type=template&id=
|
|
13322
|
+
;// ./src/ld-combobox/ld-combobox.vue?vue&type=template&id=af1428d4&scoped=true&ts=true
|
|
13310
13323
|
|
|
13311
13324
|
;// ./node_modules/ts-loader/index.js??clonedRuleSet-1.use!./src/ld-combobox/ld-combobox.ts?vue&type=script&lang=ts&external
|
|
13312
13325
|
var ld_comboboxvue_type_script_lang_ts_external_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -13777,7 +13790,7 @@ ld_comboboxvue_type_script_lang_ts_external_SelectListBoxComponent = ld_combobox
|
|
|
13777
13790
|
;
|
|
13778
13791
|
|
|
13779
13792
|
|
|
13780
|
-
const ld_combobox_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(ld_comboboxvue_type_script_lang_ts_external, [['render',
|
|
13793
|
+
const ld_combobox_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(ld_comboboxvue_type_script_lang_ts_external, [['render',ld_comboboxvue_type_template_id_af1428d4_scoped_true_ts_true_render],['__scopeId',"data-v-af1428d4"]])
|
|
13781
13794
|
|
|
13782
13795
|
/* harmony default export */ const ld_combobox = (ld_combobox_exports_);
|
|
13783
13796
|
;// ./src/ld-combobox/index.ts
|
|
@@ -15618,26 +15631,37 @@ var ld_switchvue_type_script_lang_js_external_metadata = (undefined && undefined
|
|
|
15618
15631
|
};
|
|
15619
15632
|
|
|
15620
15633
|
|
|
15621
|
-
|
|
15634
|
+
|
|
15635
|
+
class SwitchComponent extends (0,external_vue_property_decorator_.mixins)(InputMixin) {
|
|
15622
15636
|
constructor() {
|
|
15623
15637
|
super(...arguments);
|
|
15624
15638
|
this.value = false;
|
|
15625
15639
|
}
|
|
15640
|
+
emitValue(val) {
|
|
15641
|
+
return this.getValue(val);
|
|
15642
|
+
}
|
|
15626
15643
|
onModelChanged() {
|
|
15627
15644
|
this.value = this.modelValue;
|
|
15628
15645
|
}
|
|
15629
15646
|
onValueChanged(val) {
|
|
15630
|
-
this
|
|
15647
|
+
this.emitValue(val);
|
|
15631
15648
|
}
|
|
15632
|
-
|
|
15633
|
-
if (!this.$utils.isDefined(
|
|
15634
|
-
return;
|
|
15649
|
+
getValue(value) {
|
|
15650
|
+
if (!this.$utils.isDefined(value)) {
|
|
15651
|
+
return false;
|
|
15635
15652
|
}
|
|
15636
15653
|
if (this.$utils.isDefined(this.trueValue) && this.$utils.isDefined(this.falseValue)) {
|
|
15637
|
-
|
|
15654
|
+
if (value === this.trueValue) {
|
|
15655
|
+
return this.trueValue;
|
|
15656
|
+
}
|
|
15657
|
+
if (value === this.falseValue) {
|
|
15658
|
+
return this.falseValue;
|
|
15659
|
+
}
|
|
15660
|
+
return false;
|
|
15638
15661
|
}
|
|
15662
|
+
return value;
|
|
15639
15663
|
}
|
|
15640
|
-
}
|
|
15664
|
+
}
|
|
15641
15665
|
ld_switchvue_type_script_lang_js_external_decorate([
|
|
15642
15666
|
(0,external_vue_property_decorator_.Prop)(),
|
|
15643
15667
|
ld_switchvue_type_script_lang_js_external_metadata("design:type", Boolean)
|
|
@@ -15650,6 +15674,12 @@ ld_switchvue_type_script_lang_js_external_decorate([
|
|
|
15650
15674
|
(0,external_vue_property_decorator_.Prop)(),
|
|
15651
15675
|
ld_switchvue_type_script_lang_js_external_metadata("design:type", Object)
|
|
15652
15676
|
], SwitchComponent.prototype, "falseValue", void 0);
|
|
15677
|
+
ld_switchvue_type_script_lang_js_external_decorate([
|
|
15678
|
+
Emit('update:model-value'),
|
|
15679
|
+
ld_switchvue_type_script_lang_js_external_metadata("design:type", Function),
|
|
15680
|
+
ld_switchvue_type_script_lang_js_external_metadata("design:paramtypes", [Object]),
|
|
15681
|
+
ld_switchvue_type_script_lang_js_external_metadata("design:returntype", void 0)
|
|
15682
|
+
], SwitchComponent.prototype, "emitValue", null);
|
|
15653
15683
|
ld_switchvue_type_script_lang_js_external_decorate([
|
|
15654
15684
|
(0,external_vue_property_decorator_.Watch)('modelValue', { immediate: true }),
|
|
15655
15685
|
ld_switchvue_type_script_lang_js_external_metadata("design:type", Function),
|
|
@@ -15662,12 +15692,6 @@ ld_switchvue_type_script_lang_js_external_decorate([
|
|
|
15662
15692
|
ld_switchvue_type_script_lang_js_external_metadata("design:paramtypes", [Object]),
|
|
15663
15693
|
ld_switchvue_type_script_lang_js_external_metadata("design:returntype", void 0)
|
|
15664
15694
|
], SwitchComponent.prototype, "onValueChanged", null);
|
|
15665
|
-
SwitchComponent = ld_switchvue_type_script_lang_js_external_decorate([
|
|
15666
|
-
(0,external_vue_property_decorator_.Options)({
|
|
15667
|
-
emits: ['update:model-value']
|
|
15668
|
-
})
|
|
15669
|
-
], SwitchComponent);
|
|
15670
|
-
/* harmony default export */ const ld_switchvue_type_script_lang_js_external = (SwitchComponent);
|
|
15671
15695
|
|
|
15672
15696
|
;// ./src/ld-switch/ld-switch.ts?vue&type=script&lang=js&external
|
|
15673
15697
|
|
|
@@ -15679,7 +15703,7 @@ SwitchComponent = ld_switchvue_type_script_lang_js_external_decorate([
|
|
|
15679
15703
|
;
|
|
15680
15704
|
|
|
15681
15705
|
|
|
15682
|
-
const ld_switch_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(
|
|
15706
|
+
const ld_switch_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(SwitchComponent, [['render',ld_switchvue_type_template_id_102cfd42_scoped_true_render],['__scopeId',"data-v-102cfd42"]])
|
|
15683
15707
|
|
|
15684
15708
|
/* harmony default export */ const ld_switch = (ld_switch_exports_);
|
|
15685
15709
|
;// ./src/ld-switch/index.ts
|
|
@@ -16612,9 +16636,9 @@ const dialog_minimized_exports_ = /*#__PURE__*/(0,exportHelper/* default */.A)(d
|
|
|
16612
16636
|
/* harmony default export */ const dialog_minimized = (dialog_minimized_exports_);
|
|
16613
16637
|
;// ./src/ld-dialog/dialogs.ts
|
|
16614
16638
|
class Dialog {
|
|
16615
|
-
constructor(title, content
|
|
16639
|
+
constructor(title, content) {
|
|
16616
16640
|
this.title = title;
|
|
16617
|
-
this.content = content;
|
|
16641
|
+
this.content = content ?? '';
|
|
16618
16642
|
}
|
|
16619
16643
|
;
|
|
16620
16644
|
}
|
|
@@ -16647,7 +16671,6 @@ class ConfirmDialog extends Dialog {
|
|
|
16647
16671
|
class InfoDialog extends Dialog {
|
|
16648
16672
|
constructor(data) {
|
|
16649
16673
|
super(data.title);
|
|
16650
|
-
this.title = data.title;
|
|
16651
16674
|
this.component = data.component;
|
|
16652
16675
|
this.componentProps = data.componentProps;
|
|
16653
16676
|
this.width = data.width;
|
|
@@ -16661,9 +16684,9 @@ class InfoDialog extends Dialog {
|
|
|
16661
16684
|
this.hostObject = data.hostObject;
|
|
16662
16685
|
}
|
|
16663
16686
|
}
|
|
16664
|
-
class SelectDialog {
|
|
16687
|
+
class SelectDialog extends Dialog {
|
|
16665
16688
|
constructor(data) {
|
|
16666
|
-
|
|
16689
|
+
super(data.title);
|
|
16667
16690
|
this.component = data.component;
|
|
16668
16691
|
this.componentProps = data.componentProps;
|
|
16669
16692
|
this.loading = data.loading;
|
|
@@ -16676,10 +16699,10 @@ class SelectDialog {
|
|
|
16676
16699
|
this.hostObject = data.hostObject;
|
|
16677
16700
|
}
|
|
16678
16701
|
}
|
|
16679
|
-
class CreateEditDialog {
|
|
16702
|
+
class CreateEditDialog extends Dialog {
|
|
16680
16703
|
constructor(data) {
|
|
16704
|
+
super(data.title);
|
|
16681
16705
|
this._isChanged = null;
|
|
16682
|
-
this.title = data.title;
|
|
16683
16706
|
this.component = data.component;
|
|
16684
16707
|
this.componentProps = {
|
|
16685
16708
|
...data.componentProps,
|
package/dist/lib/multiselect.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define(["vue"],t):"object"===typeof exports?exports["ldmui"]=t(require("vue")):e["ldmui"]=t(e["vue"])})(self,(e=>(()=>{"use strict";var t={6262:(e,t)=>{t.A=(e,t)=>{const i=e.__vccOpts||e;for(const[e,s]of t)i[e]=s;return i}},2380:t=>{t.exports=e}},i={};function __webpack_require__(e){var s=i[e];if(void 0!==s)return s.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,__webpack_require__),l.exports}(()=>{__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})}})(),(()=>{__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var s={};__webpack_require__.r(s),__webpack_require__.d(s,{default:()=>N});var l=__webpack_require__(2380);const o=["tabindex","aria-owns"],n={ref:"tags",class:"multiselect__tags"},r={class:"multiselect__tags-wrap"},a=["textContent"],h=["onKeypress","onMousedown"],p={class:"multiselect__tag"},c=["textContent"],u={class:"multiselect__spinner"},d=["name","id","placeholder","value","disabled","tabindex","aria-controls"],m=["id"],g={key:0},f={class:"multiselect__option"},b=["id","role"],y=["onClick","onMouseenter","data-select","data-selected","data-deselect"],w=["data-select","data-deselect","onMouseenter","onMousedown"],V={class:"multiselect__option"},v={class:"multiselect__option"};function render(e,t,i,s,_,S){return(0,l.openBlock)(),(0,l.createElementBlock)("div",{tabindex:e.searchable?-1:i.tabindex,class:(0,l.normalizeClass)([{"multiselect--active":e.isOpen,"multiselect--disabled":i.disabled,"multiselect--above":S.isAbove,"multiselect--has-options-group":S.hasOptionGroup,"multiselect--list-empty":e.isOpen&&!S.showNoResultsSlot&&!S.showNoOptionsSlot&&0===e.filteredOptions.length},"multiselect"]),onFocus:t[12]||(t[12]=t=>e.activate()),onBlur:t[13]||(t[13]=t=>!e.searchable&&e.deactivate()),onKeydown:[t[14]||(t[14]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerForward()),["self","prevent"]),["down"])),t[15]||(t[15]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerBackward()),["self","prevent"]),["up"]))],onKeypress:t[16]||(t[16]=(0,l.withKeys)((0,l.withModifiers)((t=>e.addPointerElement(t)),["stop","self"]),["enter","tab"])),onKeyup:t[17]||(t[17]=(0,l.withKeys)((t=>e.deactivate()),["esc"])),role:"combobox","aria-owns":"listbox-"+e.id},[(0,l.renderSlot)(e.$slots,"caret",{toggle:e.toggle},(()=>[(0,l.createElementVNode)("div",{onMousedown:t[0]||(t[0]=(0,l.withModifiers)((t=>e.toggle()),["prevent","stop"])),class:"multiselect__select"},null,32)])),t[32]||(t[32]=(0,l.createTextVNode)()),(0,l.renderSlot)(e.$slots,"clear",{search:e.search}),t[33]||(t[33]=(0,l.createTextVNode)()),(0,l.createElementVNode)("div",n,[(0,l.renderSlot)(e.$slots,"selection",{search:e.search,remove:e.removeElement,values:S.visibleValues,isOpen:e.isOpen},(()=>[(0,l.withDirectives)((0,l.createElementVNode)("div",r,[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(S.visibleValues,((i,s)=>(0,l.renderSlot)(e.$slots,"tag",{option:i,search:e.search,remove:e.removeElement},(()=>[((0,l.openBlock)(),(0,l.createElementBlock)("span",{class:"multiselect__tag",key:s},[(0,l.createElementVNode)("span",{textContent:(0,l.toDisplayString)(e.getOptionLabel(i))},null,8,a),t[18]||(t[18]=(0,l.createTextVNode)()),(0,l.createElementVNode)("i",{tabindex:"1",onKeypress:(0,l.withKeys)((0,l.withModifiers)((t=>e.removeElement(i)),["prevent"]),["enter"]),onMousedown:(0,l.withModifiers)((t=>e.removeElement(i)),["prevent"]),class:"multiselect__tag-icon"},null,40,h)]))])))),256)),t[19]||(t[19]=(0,l.createTextVNode)()),e.internalValue&&e.internalValue.length>i.limit?(0,l.renderSlot)(e.$slots,"tag-overflow",{key:0,limit:i.limit,count:e.internalValue.length},(()=>[(0,l.createElementVNode)("span",p,[(0,l.createElementVNode)("strong",{class:"multiselect__strong",textContent:(0,l.toDisplayString)(i.limitText(e.internalValue.length-i.limit))},null,8,c)])])):(0,l.createCommentVNode)("",!0)],512),[[l.vShow,S.visibleValues.length>0]])])),t[20]||(t[20]=(0,l.createTextVNode)()),(0,l.createVNode)(l.Transition,{name:"multiselect__loading"},{default:(0,l.withCtx)((()=>[(0,l.renderSlot)(e.$slots,"loading",{},(()=>[(0,l.withDirectives)((0,l.createElementVNode)("div",u,null,512),[[l.vShow,i.loading]])]))])),_:3}),t[21]||(t[21]=(0,l.createTextVNode)()),e.searchable?((0,l.openBlock)(),(0,l.createElementBlock)("input",{key:0,ref:"search",name:i.name,id:e.id,type:"text",autocomplete:"off",spellcheck:"false",placeholder:e.placeholder,style:(0,l.normalizeStyle)(S.inputStyle),value:e.search,disabled:i.disabled,tabindex:i.tabindex,class:"multiselect__input","aria-controls":"listbox-"+e.id,onInput:t[1]||(t[1]=t=>e.updateSearch(t.target.value)),onFocus:t[2]||(t[2]=(0,l.withModifiers)((t=>e.activate()),["prevent"])),onKeyup:t[3]||(t[3]=(0,l.withKeys)((t=>e.deactivate()),["esc"])),onKeydown:[t[4]||(t[4]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerForward()),["prevent"]),["down"])),t[5]||(t[5]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerBackward()),["prevent"]),["up"])),t[7]||(t[7]=(0,l.withKeys)((0,l.withModifiers)((t=>e.removeLastElement()),["stop"]),["delete"]))],onKeypress:t[6]||(t[6]=(0,l.withKeys)((0,l.withModifiers)((t=>e.addPointerElement(t)),["prevent","stop","self"]),["enter"]))},null,44,d)):(0,l.createCommentVNode)("",!0),t[22]||(t[22]=(0,l.createTextVNode)()),S.isSingleLabelVisible?((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:1,class:"multiselect__single",onMousedown:t[8]||(t[8]=(0,l.withModifiers)(((...t)=>e.toggle&&e.toggle(...t)),["prevent"]))},[(0,l.renderSlot)(e.$slots,"singleLabel",{option:S.singleValue},(()=>[(0,l.createTextVNode)((0,l.toDisplayString)(e.currentOptionLabel),1)]))],32)):(0,l.createCommentVNode)("",!0),t[23]||(t[23]=(0,l.createTextVNode)()),S.isPlaceholderVisible?((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:2,class:"multiselect__placeholder",onMousedown:t[9]||(t[9]=(0,l.withModifiers)(((...t)=>e.toggle&&e.toggle(...t)),["prevent"]))},[(0,l.renderSlot)(e.$slots,"placeholder",{},(()=>[(0,l.createTextVNode)((0,l.toDisplayString)(e.placeholder),1)]))],32)):(0,l.createCommentVNode)("",!0)],512),t[34]||(t[34]=(0,l.createTextVNode)()),(0,l.createVNode)(l.Transition,{name:"multiselect"},{default:(0,l.withCtx)((()=>[(0,l.withDirectives)((0,l.createElementVNode)("div",{class:"multiselect__content-wrapper",onFocus:t[10]||(t[10]=(...t)=>e.activate&&e.activate(...t)),tabindex:"-1",onMousedown:t[11]||(t[11]=(0,l.withModifiers)((()=>{}),["prevent"])),style:(0,l.normalizeStyle)({maxHeight:e.optimizedHeight+"px"}),ref:"list"},[(0,l.createElementVNode)("ul",{class:"multiselect__content",style:(0,l.normalizeStyle)(S.contentStyle),role:"listbox",id:"listbox-"+e.id},[(0,l.renderSlot)(e.$slots,"beforeList"),t[27]||(t[27]=(0,l.createTextVNode)()),e.multiple&&e.max===e.internalValue.length?((0,l.openBlock)(),(0,l.createElementBlock)("li",g,[(0,l.createElementVNode)("span",f,[(0,l.renderSlot)(e.$slots,"maxElements",{},(()=>[(0,l.createTextVNode)("Maximum of "+(0,l.toDisplayString)(e.max)+" options selected. First remove a selected option to select another.",1)]))])])):(0,l.createCommentVNode)("",!0),t[28]||(t[28]=(0,l.createTextVNode)()),!e.max||e.internalValue.length<e.max?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:1},(0,l.renderList)(e.filteredOptions,((i,s)=>((0,l.openBlock)(),(0,l.createElementBlock)("li",{class:"multiselect__element",key:s,id:e.id+"-"+s,role:i&&(i.$isLabel||i.$isDisabled)?null:"option"},[i&&(i.$isLabel||i.$isDisabled)?(0,l.createCommentVNode)("",!0):((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:0,class:(0,l.normalizeClass)([e.optionHighlight(s,i),"multiselect__option"]),onClick:(0,l.withModifiers)((t=>e.select(i)),["stop"]),onMouseenter:(0,l.withModifiers)((t=>e.pointerSet(s)),["self"]),"data-select":i&&i.isTag?e.tagPlaceholder:S.selectLabelText,"data-selected":S.selectedLabelText,"data-deselect":S.deselectLabelText},[(0,l.renderSlot)(e.$slots,"option",{option:i,search:e.search,index:s},(()=>[(0,l.createElementVNode)("span",null,(0,l.toDisplayString)(e.getOptionLabel(i)),1)]))],42,y)),t[24]||(t[24]=(0,l.createTextVNode)()),i&&(i.$isLabel||i.$isDisabled)?((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:1,"data-select":e.groupSelect&&S.selectGroupLabelText,"data-deselect":e.groupSelect&&S.deselectGroupLabelText,class:(0,l.normalizeClass)([e.groupHighlight(s,i),"multiselect__option"]),onMouseenter:(0,l.withModifiers)((t=>e.groupSelect&&e.pointerSet(s)),["self"]),onMousedown:(0,l.withModifiers)((t=>e.selectGroup(i)),["prevent"])},[(0,l.renderSlot)(e.$slots,"option",{option:i,search:e.search,index:s},(()=>[(0,l.createElementVNode)("span",null,(0,l.toDisplayString)(e.getOptionLabel(i)),1)]))],42,w)):(0,l.createCommentVNode)("",!0)],8,b)))),128)):(0,l.createCommentVNode)("",!0),t[29]||(t[29]=(0,l.createTextVNode)()),(0,l.withDirectives)((0,l.createElementVNode)("li",null,[(0,l.createElementVNode)("span",V,[(0,l.renderSlot)(e.$slots,"noResult",{search:e.search},(()=>[t[25]||(t[25]=(0,l.createTextVNode)("No elements found. Consider changing the search query."))]))])],512),[[l.vShow,S.showNoResultsSlot]]),t[30]||(t[30]=(0,l.createTextVNode)()),(0,l.withDirectives)((0,l.createElementVNode)("li",null,[(0,l.createElementVNode)("span",v,[(0,l.renderSlot)(e.$slots,"noOptions",{},(()=>[t[26]||(t[26]=(0,l.createTextVNode)("List is empty."))]))])],512),[[l.vShow,S.showNoOptionsSlot]]),t[31]||(t[31]=(0,l.createTextVNode)()),(0,l.renderSlot)(e.$slots,"afterList")],12,m)],36),[[l.vShow,e.isOpen]])])),_:3})],42,o)}function isEmpty(e){return 0!==e&&(!(!Array.isArray(e)||0!==e.length)||!e)}function not(e){return(...t)=>!e(...t)}function includes(e,t){void 0===e&&(e="undefined"),null===e&&(e="null"),!1===e&&(e="false");const i=e.toString().toLowerCase();return-1!==i.indexOf(t.trim())}function filterOptions(e,t,i,s){return t?e.filter((e=>includes(s(e,i),t))).sort(((e,t)=>s(e,i).length-s(t,i).length)):e}function stripGroups(e){return e.filter((e=>!e.$isLabel))}function flattenOptions(e,t){return i=>i.reduce(((i,s)=>s[e]&&s[e].length?(i.push({$groupLabel:s[t],$isLabel:!0}),i.concat(s[e])):i),[])}function filterGroups(e,t,i,s,l){return o=>o.map((o=>{if(!o[i])return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."),[];const n=filterOptions(o[i],e,t,l);return n.length?{[s]:o[s],[i]:n}:[]}))}const flow=(...e)=>t=>e.reduce(((e,t)=>t(e)),t),_={data(){return{search:"",isOpen:!1,preferredOpenDirection:"below",optimizedHeight:this.maxHeight}},props:{internalSearch:{type:Boolean,default:!0},options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},trackBy:{type:String},label:{type:String},searchable:{type:Boolean,default:!0},clearOnSelect:{type:Boolean,default:!0},hideSelected:{type:Boolean,default:!1},placeholder:{type:String,default:"Select option"},allowEmpty:{type:Boolean,default:!0},resetAfter:{type:Boolean,default:!1},closeOnSelect:{type:Boolean,default:!0},customLabel:{type:Function,default(e,t){return isEmpty(e)?"":t?e[t]:e}},taggable:{type:Boolean,default:!1},tagPlaceholder:{type:String,default:"Press enter to create a tag"},tagPosition:{type:String,default:"top"},max:{type:[Number,Boolean],default:!1},id:{default:null},optionsLimit:{type:Number,default:1e3},groupValues:{type:String},groupLabel:{type:String},groupSelect:{type:Boolean,default:!1},blockKeys:{type:Array,default(){return[]}},preserveSearch:{type:Boolean,default:!1},preselectFirst:{type:Boolean,default:!1},preventAutofocus:{type:Boolean,default:!1}},mounted(){!this.multiple&&this.max&&console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."),this.preselectFirst&&!this.internalValue.length&&this.options.length&&this.select(this.filteredOptions[0])},computed:{internalValue(){return this.modelValue||0===this.modelValue?Array.isArray(this.modelValue)?this.modelValue:[this.modelValue]:[]},filteredOptions(){const e=this.search||"",t=e.toLowerCase().trim();let i=this.options.concat();return i=this.internalSearch?this.groupValues?this.filterAndFlat(i,t,this.label):filterOptions(i,t,this.label,this.customLabel):this.groupValues?flattenOptions(this.groupValues,this.groupLabel)(i):i,i=this.hideSelected?i.filter(not(this.isSelected)):i,this.taggable&&t.length&&!this.isExistingOption(t)&&("bottom"===this.tagPosition?i.push({isTag:!0,label:e}):i.unshift({isTag:!0,label:e})),i.slice(0,this.optionsLimit)},valueKeys(){return this.trackBy?this.internalValue.map((e=>e[this.trackBy])):this.internalValue},optionKeys(){const e=this.groupValues?this.flatAndStrip(this.options):this.options;return e.map((e=>this.customLabel(e,this.label).toString().toLowerCase()))},currentOptionLabel(){return this.multiple?this.searchable?"":this.placeholder:this.internalValue.length?this.getOptionLabel(this.internalValue[0]):this.searchable?"":this.placeholder}},watch:{internalValue:{handler(){this.resetAfter&&this.internalValue.length&&(this.search="",this.$emit("update:modelValue",this.multiple?[]:null))},deep:!0},search(){this.$emit("search-change",this.search)}},emits:["open","search-change","close","select","update:modelValue","remove","tag"],methods:{getValue(){return this.multiple?this.internalValue:0===this.internalValue.length?null:this.internalValue[0]},filterAndFlat(e,t,i){return flow(filterGroups(t,i,this.groupValues,this.groupLabel,this.customLabel),flattenOptions(this.groupValues,this.groupLabel))(e)},flatAndStrip(e){return flow(flattenOptions(this.groupValues,this.groupLabel),stripGroups)(e)},updateSearch(e){this.search=e},isExistingOption(e){return!!this.options&&this.optionKeys.indexOf(e)>-1},isSelected(e){const t=this.trackBy?e[this.trackBy]:e;return this.valueKeys.indexOf(t)>-1},isOptionDisabled(e){return!!e.$isDisabled},getOptionLabel(e){if(isEmpty(e))return"";if(e.isTag)return e.label;if(e.$isLabel)return e.$groupLabel;const t=this.customLabel(e,this.label);return isEmpty(t)?"":t},select(e,t){if(e.$isLabel&&this.groupSelect)this.selectGroup(e);else if(!(-1!==this.blockKeys.indexOf(t)||this.disabled||e.$isDisabled||e.$isLabel)&&(!this.max||!this.multiple||this.internalValue.length!==this.max)&&("Tab"!==t||this.pointerDirty)){if(e.isTag)this.$emit("tag",e.label,this.id),this.search="",this.closeOnSelect&&!this.multiple&&this.deactivate();else{const i=this.isSelected(e);if(i)return void("Tab"!==t&&this.removeElement(e));this.multiple?this.$emit("update:modelValue",this.internalValue.concat([e])):this.$emit("update:modelValue",e),this.$emit("select",e,this.id),this.clearOnSelect&&(this.search="")}this.closeOnSelect&&this.deactivate()}},selectGroup(e){const t=this.options.find((t=>t[this.groupLabel]===e.$groupLabel));if(t){if(this.wholeGroupSelected(t)){this.$emit("remove",t[this.groupValues],this.id);const e=this.internalValue.filter((e=>-1===t[this.groupValues].indexOf(e)));this.$emit("update:modelValue",e)}else{let e=t[this.groupValues].filter((e=>!(this.isOptionDisabled(e)||this.isSelected(e))));this.max&&e.splice(this.max-this.internalValue.length),this.$emit("select",e,this.id),this.$emit("update:modelValue",this.internalValue.concat(e))}this.closeOnSelect&&this.deactivate()}},wholeGroupSelected(e){return e[this.groupValues].every((e=>this.isSelected(e)||this.isOptionDisabled(e)))},wholeGroupDisabled(e){return e[this.groupValues].every(this.isOptionDisabled)},removeElement(e,t=!0){if(this.disabled)return;if(e.$isDisabled)return;if(!this.allowEmpty&&this.internalValue.length<=1)return void this.deactivate();const i="object"===typeof e?this.valueKeys.indexOf(e[this.trackBy]):this.valueKeys.indexOf(e);if(this.multiple){const e=this.internalValue.slice(0,i).concat(this.internalValue.slice(i+1));this.$emit("update:modelValue",e)}else this.$emit("update:modelValue",null);this.$emit("remove",e,this.id),this.closeOnSelect&&t&&this.deactivate()},removeLastElement(){-1===this.blockKeys.indexOf("Delete")&&0===this.search.length&&Array.isArray(this.internalValue)&&this.internalValue.length&&this.removeElement(this.internalValue[this.internalValue.length-1],!1)},activate(){if(this.isOpen||this.disabled)return;this.adjustPosition(),this.groupValues&&0===this.pointer&&this.filteredOptions.length&&(this.pointer=1),this.isOpen=!0,this.searchable?(this.preserveSearch||(this.search=""),this.preventAutofocus||this.$nextTick((()=>this.$refs.search&&this.$refs.search.focus()))):this.preventAutofocus||"undefined"!==typeof this.$el&&this.$el.focus(),this.$emit("open",this.id);const onMouseDown=e=>{if(e?.target){const t=e.target.closest(".multiselect");Boolean(t)||(this.deactivate(),document.removeEventListener("mousedown",onMouseDown))}};setTimeout((()=>{document.addEventListener("mousedown",onMouseDown)}),300)},deactivate(){this.isOpen&&(this.isOpen=!1,this.searchable?this.$refs.search&&this.$refs.search.blur():this.$el&&this.$el.blur(),this.preserveSearch||(this.search=""),this.$emit("close",this.getValue(),this.id))},toggle(){this.isOpen?this.deactivate():this.activate()},adjustPosition(){if("undefined"===typeof window)return;const e=this.$el.getBoundingClientRect().top,t=window.innerHeight-this.$el.getBoundingClientRect().bottom,i=t>this.maxHeight;i||t>e||"below"===this.openDirection||"bottom"===this.openDirection?(this.preferredOpenDirection="below",this.optimizedHeight=Math.min(t-40,this.maxHeight)):(this.preferredOpenDirection="above",this.optimizedHeight=Math.min(e-40,this.maxHeight))}}},S={data(){return{pointer:0,pointerDirty:!1}},props:{showPointer:{type:Boolean,default:!0},optionHeight:{type:Number,default:40}},computed:{pointerPosition(){return this.pointer*this.optionHeight},visibleElements(){return this.optimizedHeight/this.optionHeight}},watch:{filteredOptions(){this.pointerAdjust()},isOpen(){this.pointerDirty=!1},pointer(){this.$refs.search&&this.$refs.search.setAttribute("aria-activedescendant",this.id+"-"+this.pointer.toString())}},methods:{optionHighlight(e,t){return{"multiselect__option--highlight":e===this.pointer&&this.showPointer,"multiselect__option--selected":this.isSelected(t)}},groupHighlight(e,t){if(!this.groupSelect)return["multiselect__option--disabled",{"multiselect__option--group":t.$isLabel}];const i=this.options.find((e=>e[this.groupLabel]===t.$groupLabel));return i&&!this.wholeGroupDisabled(i)?["multiselect__option--group",{"multiselect__option--highlight":e===this.pointer&&this.showPointer},{"multiselect__option--group-selected":this.wholeGroupSelected(i)}]:"multiselect__option--disabled"},addPointerElement({key:e}="Enter"){this.filteredOptions.length>0&&this.select(this.filteredOptions[this.pointer],e),this.pointerReset()},pointerForward(){this.pointer<this.filteredOptions.length-1&&(this.pointer++,this.$refs.list.scrollTop<=this.pointerPosition-(this.visibleElements-1)*this.optionHeight&&(this.$refs.list.scrollTop=this.pointerPosition-(this.visibleElements-1)*this.optionHeight),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()),this.pointerDirty=!0},pointerBackward(){this.pointer>0?(this.pointer--,this.$refs.list.scrollTop>=this.pointerPosition&&(this.$refs.list.scrollTop=this.pointerPosition),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerBackward()):this.filteredOptions[this.pointer]&&this.filteredOptions[0].$isLabel&&!this.groupSelect&&this.pointerForward(),this.pointerDirty=!0},pointerReset(){this.closeOnSelect&&(this.pointer=0,this.$refs.list&&(this.$refs.list.scrollTop=0))},pointerAdjust(){this.pointer>=this.filteredOptions.length-1&&(this.pointer=this.filteredOptions.length?this.filteredOptions.length-1:0),this.filteredOptions.length>0&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()},pointerSet(e){this.pointer=e,this.pointerDirty=!0}}},x={name:"vue-multiselect",mixins:[_,S],compatConfig:{MODE:3,ATTR_ENUMERATED_COERCION:!1},props:{name:{type:String,default:""},modelValue:{type:null,default(){return[]}},selectLabel:{type:String,default:"Press enter to select"},selectGroupLabel:{type:String,default:"Press enter to select group"},selectedLabel:{type:String,default:"Selected"},deselectLabel:{type:String,default:"Press enter to remove"},deselectGroupLabel:{type:String,default:"Press enter to deselect group"},showLabels:{type:Boolean,default:!0},limit:{type:Number,default:99999},maxHeight:{type:Number,default:300},limitText:{type:Function,default:e=>`and ${e} more`},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},openDirection:{type:String,default:""},showNoOptions:{type:Boolean,default:!0},showNoResults:{type:Boolean,default:!0},tabindex:{type:Number,default:0}},computed:{hasOptionGroup(){return this.groupValues&&this.groupLabel&&this.groupSelect},isSingleLabelVisible(){return!1},isPlaceholderVisible(){return!this.internalValue.length&&(!this.searchable||!this.isOpen)},visibleValues(){return this.internalValue.slice(0,this.limit)},singleValue(){return this.internalValue[0]},deselectLabelText(){return this.showLabels?this.deselectLabel:""},deselectGroupLabelText(){return this.showLabels?this.deselectGroupLabel:""},selectLabelText(){return this.showLabels?this.selectLabel:""},selectGroupLabelText(){return this.showLabels?this.selectGroupLabel:""},selectedLabelText(){return this.showLabels?this.selectedLabel:""},inputStyle(){return this.searchable||this.multiple&&this.modelValue&&this.modelValue.length?this.isOpen?{width:"100%"}:{width:"0",position:"absolute",padding:"0"}:""},contentStyle(){return this.options.length?{display:"inline-block"}:{display:"block"}},isAbove(){return"above"===this.openDirection||"top"===this.openDirection||"below"!==this.openDirection&&"bottom"!==this.openDirection&&"above"===this.preferredOpenDirection},showSearchInput(){return this.searchable&&(!this.hasSingleSelectedSlot||!this.visibleSingleValue&&0!==this.visibleSingleValue||this.isOpen)},showNoResultsSlot(){return this.showNoResults&&0===this.filteredOptions.length&&this.search&&!this.loading},showNoOptionsSlot(){return this.showNoOptions&&(0===this.options.length||!0===this.hasOptionGroup&&0===this.filteredOptions.length)&&!this.search&&!this.loading}}};var O=__webpack_require__(6262);const L=(0,O.A)(x,[["render",render]]),$=L,N=$;return s})()));
|
|
1
|
+
(function webpackUniversalModuleDefinition(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define(["vue"],t):"object"===typeof exports?exports["ldmui"]=t(require("vue")):e["ldmui"]=t(e["vue"])})(self,(e=>(()=>{"use strict";var t={6262:(e,t)=>{t.A=(e,t)=>{const i=e.__vccOpts||e;for(const[e,s]of t)i[e]=s;return i}},2380:t=>{t.exports=e}},i={};function __webpack_require__(e){var s=i[e];if(void 0!==s)return s.exports;var l=i[e]={exports:{}};return t[e](l,l.exports,__webpack_require__),l.exports}(()=>{__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})}})(),(()=>{__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{__webpack_require__.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var s={};__webpack_require__.r(s),__webpack_require__.d(s,{default:()=>N});var l=__webpack_require__(2380);const o=["tabindex","aria-owns"],n={ref:"tags",class:"multiselect__tags"},r={class:"multiselect__tags-wrap"},a=["textContent"],h=["onKeypress","onMousedown"],p={class:"multiselect__tag"},c=["textContent"],u={class:"multiselect__spinner"},d=["name","id","placeholder","value","disabled","tabindex","aria-controls"],m=["id"],g={key:0},f={class:"multiselect__option"},b=["id","role"],y=["onClick","onMouseenter","data-select","data-selected","data-deselect"],w=["data-select","data-deselect","onMouseenter","onMousedown"],V={class:"multiselect__option"},v={class:"multiselect__option"};function render(e,t,i,s,_,S){return(0,l.openBlock)(),(0,l.createElementBlock)("div",{tabindex:e.searchable?-1:i.tabindex,class:(0,l.normalizeClass)([[e.uid?"multiselect"+e.uid:"",{"multiselect--active":e.isOpen,"multiselect--disabled":i.disabled,"multiselect--above":S.isAbove,"multiselect--has-options-group":S.hasOptionGroup,"multiselect--list-empty":e.isOpen&&!S.showNoResultsSlot&&!S.showNoOptionsSlot&&0===e.filteredOptions.length}],"multiselect"]),onFocus:t[12]||(t[12]=t=>e.activate()),onBlur:t[13]||(t[13]=t=>!e.searchable&&e.deactivate()),onKeydown:[t[14]||(t[14]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerForward()),["self","prevent"]),["down"])),t[15]||(t[15]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerBackward()),["self","prevent"]),["up"]))],onKeypress:t[16]||(t[16]=(0,l.withKeys)((0,l.withModifiers)((t=>e.addPointerElement(t)),["stop","self"]),["enter","tab"])),onKeyup:t[17]||(t[17]=(0,l.withKeys)((t=>e.deactivate()),["esc"])),role:"combobox","aria-owns":"listbox-"+e.id},[(0,l.renderSlot)(e.$slots,"caret",{toggle:e.toggle},(()=>[(0,l.createElementVNode)("div",{onMousedown:t[0]||(t[0]=(0,l.withModifiers)((t=>e.toggle()),["prevent","stop"])),class:"multiselect__select"},null,32)])),t[32]||(t[32]=(0,l.createTextVNode)()),(0,l.renderSlot)(e.$slots,"clear",{search:e.search}),t[33]||(t[33]=(0,l.createTextVNode)()),(0,l.createElementVNode)("div",n,[(0,l.renderSlot)(e.$slots,"selection",{search:e.search,remove:e.removeElement,values:S.visibleValues,isOpen:e.isOpen},(()=>[(0,l.withDirectives)((0,l.createElementVNode)("div",r,[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(S.visibleValues,((i,s)=>(0,l.renderSlot)(e.$slots,"tag",{option:i,search:e.search,remove:e.removeElement},(()=>[((0,l.openBlock)(),(0,l.createElementBlock)("span",{class:"multiselect__tag",key:s},[(0,l.createElementVNode)("span",{textContent:(0,l.toDisplayString)(e.getOptionLabel(i))},null,8,a),t[18]||(t[18]=(0,l.createTextVNode)()),(0,l.createElementVNode)("i",{tabindex:"1",onKeypress:(0,l.withKeys)((0,l.withModifiers)((t=>e.removeElement(i)),["prevent"]),["enter"]),onMousedown:(0,l.withModifiers)((t=>e.removeElement(i)),["prevent"]),class:"multiselect__tag-icon"},null,40,h)]))])))),256)),t[19]||(t[19]=(0,l.createTextVNode)()),e.internalValue&&e.internalValue.length>i.limit?(0,l.renderSlot)(e.$slots,"tag-overflow",{key:0,limit:i.limit,count:e.internalValue.length},(()=>[(0,l.createElementVNode)("span",p,[(0,l.createElementVNode)("strong",{class:"multiselect__strong",textContent:(0,l.toDisplayString)(i.limitText(e.internalValue.length-i.limit))},null,8,c)])])):(0,l.createCommentVNode)("",!0)],512),[[l.vShow,S.visibleValues.length>0]])])),t[20]||(t[20]=(0,l.createTextVNode)()),(0,l.createVNode)(l.Transition,{name:"multiselect__loading"},{default:(0,l.withCtx)((()=>[(0,l.renderSlot)(e.$slots,"loading",{},(()=>[(0,l.withDirectives)((0,l.createElementVNode)("div",u,null,512),[[l.vShow,i.loading]])]))])),_:3}),t[21]||(t[21]=(0,l.createTextVNode)()),e.searchable?((0,l.openBlock)(),(0,l.createElementBlock)("input",{key:0,ref:"search",name:i.name,id:e.id,type:"text",autocomplete:"off",spellcheck:"false",placeholder:e.placeholder,style:(0,l.normalizeStyle)(S.inputStyle),value:e.search,disabled:i.disabled,tabindex:i.tabindex,class:"multiselect__input","aria-controls":"listbox-"+e.id,onInput:t[1]||(t[1]=t=>e.updateSearch(t.target.value)),onFocus:t[2]||(t[2]=(0,l.withModifiers)((t=>e.activate()),["prevent"])),onKeyup:t[3]||(t[3]=(0,l.withKeys)((t=>e.deactivate()),["esc"])),onKeydown:[t[4]||(t[4]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerForward()),["prevent"]),["down"])),t[5]||(t[5]=(0,l.withKeys)((0,l.withModifiers)((t=>e.pointerBackward()),["prevent"]),["up"])),t[7]||(t[7]=(0,l.withKeys)((0,l.withModifiers)((t=>e.removeLastElement()),["stop"]),["delete"]))],onKeypress:t[6]||(t[6]=(0,l.withKeys)((0,l.withModifiers)((t=>e.addPointerElement(t)),["prevent","stop","self"]),["enter"]))},null,44,d)):(0,l.createCommentVNode)("",!0),t[22]||(t[22]=(0,l.createTextVNode)()),S.isSingleLabelVisible?((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:1,class:"multiselect__single",onMousedown:t[8]||(t[8]=(0,l.withModifiers)(((...t)=>e.toggle&&e.toggle(...t)),["prevent"]))},[(0,l.renderSlot)(e.$slots,"singleLabel",{option:S.singleValue},(()=>[(0,l.createTextVNode)((0,l.toDisplayString)(e.currentOptionLabel),1)]))],32)):(0,l.createCommentVNode)("",!0),t[23]||(t[23]=(0,l.createTextVNode)()),S.isPlaceholderVisible?((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:2,class:"multiselect__placeholder",onMousedown:t[9]||(t[9]=(0,l.withModifiers)(((...t)=>e.toggle&&e.toggle(...t)),["prevent"]))},[(0,l.renderSlot)(e.$slots,"placeholder",{},(()=>[(0,l.createTextVNode)((0,l.toDisplayString)(e.placeholder),1)]))],32)):(0,l.createCommentVNode)("",!0)],512),t[34]||(t[34]=(0,l.createTextVNode)()),(0,l.createVNode)(l.Transition,{name:"multiselect"},{default:(0,l.withCtx)((()=>[(0,l.withDirectives)((0,l.createElementVNode)("div",{class:"multiselect__content-wrapper",onFocus:t[10]||(t[10]=(...t)=>e.activate&&e.activate(...t)),tabindex:"-1",onMousedown:t[11]||(t[11]=(0,l.withModifiers)((()=>{}),["prevent"])),style:(0,l.normalizeStyle)({maxHeight:e.optimizedHeight+"px"}),ref:"list"},[(0,l.createElementVNode)("ul",{class:"multiselect__content",style:(0,l.normalizeStyle)(S.contentStyle),role:"listbox",id:"listbox-"+e.id},[(0,l.renderSlot)(e.$slots,"beforeList"),t[27]||(t[27]=(0,l.createTextVNode)()),e.multiple&&e.max===e.internalValue.length?((0,l.openBlock)(),(0,l.createElementBlock)("li",g,[(0,l.createElementVNode)("span",f,[(0,l.renderSlot)(e.$slots,"maxElements",{},(()=>[(0,l.createTextVNode)("Maximum of "+(0,l.toDisplayString)(e.max)+" options selected. First remove a selected option to select another.",1)]))])])):(0,l.createCommentVNode)("",!0),t[28]||(t[28]=(0,l.createTextVNode)()),!e.max||e.internalValue.length<e.max?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:1},(0,l.renderList)(e.filteredOptions,((i,s)=>((0,l.openBlock)(),(0,l.createElementBlock)("li",{class:"multiselect__element",key:s,id:e.id+"-"+s,role:i&&(i.$isLabel||i.$isDisabled)?null:"option"},[i&&(i.$isLabel||i.$isDisabled)?(0,l.createCommentVNode)("",!0):((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:0,class:(0,l.normalizeClass)([e.optionHighlight(s,i),"multiselect__option"]),onClick:(0,l.withModifiers)((t=>e.select(i)),["stop"]),onMouseenter:(0,l.withModifiers)((t=>e.pointerSet(s)),["self"]),"data-select":i&&i.isTag?e.tagPlaceholder:S.selectLabelText,"data-selected":S.selectedLabelText,"data-deselect":S.deselectLabelText},[(0,l.renderSlot)(e.$slots,"option",{option:i,search:e.search,index:s},(()=>[(0,l.createElementVNode)("span",null,(0,l.toDisplayString)(e.getOptionLabel(i)),1)]))],42,y)),t[24]||(t[24]=(0,l.createTextVNode)()),i&&(i.$isLabel||i.$isDisabled)?((0,l.openBlock)(),(0,l.createElementBlock)("span",{key:1,"data-select":e.groupSelect&&S.selectGroupLabelText,"data-deselect":e.groupSelect&&S.deselectGroupLabelText,class:(0,l.normalizeClass)([e.groupHighlight(s,i),"multiselect__option"]),onMouseenter:(0,l.withModifiers)((t=>e.groupSelect&&e.pointerSet(s)),["self"]),onMousedown:(0,l.withModifiers)((t=>e.selectGroup(i)),["prevent"])},[(0,l.renderSlot)(e.$slots,"option",{option:i,search:e.search,index:s},(()=>[(0,l.createElementVNode)("span",null,(0,l.toDisplayString)(e.getOptionLabel(i)),1)]))],42,w)):(0,l.createCommentVNode)("",!0)],8,b)))),128)):(0,l.createCommentVNode)("",!0),t[29]||(t[29]=(0,l.createTextVNode)()),(0,l.withDirectives)((0,l.createElementVNode)("li",null,[(0,l.createElementVNode)("span",V,[(0,l.renderSlot)(e.$slots,"noResult",{search:e.search},(()=>[t[25]||(t[25]=(0,l.createTextVNode)("No elements found. Consider changing the search query."))]))])],512),[[l.vShow,S.showNoResultsSlot]]),t[30]||(t[30]=(0,l.createTextVNode)()),(0,l.withDirectives)((0,l.createElementVNode)("li",null,[(0,l.createElementVNode)("span",v,[(0,l.renderSlot)(e.$slots,"noOptions",{},(()=>[t[26]||(t[26]=(0,l.createTextVNode)("List is empty."))]))])],512),[[l.vShow,S.showNoOptionsSlot]]),t[31]||(t[31]=(0,l.createTextVNode)()),(0,l.renderSlot)(e.$slots,"afterList")],12,m)],36),[[l.vShow,e.isOpen]])])),_:3})],42,o)}function isEmpty(e){return 0!==e&&(!(!Array.isArray(e)||0!==e.length)||!e)}function not(e){return(...t)=>!e(...t)}function includes(e,t){void 0===e&&(e="undefined"),null===e&&(e="null"),!1===e&&(e="false");const i=e.toString().toLowerCase();return-1!==i.indexOf(t.trim())}function filterOptions(e,t,i,s){return t?e.filter((e=>includes(s(e,i),t))).sort(((e,t)=>s(e,i).length-s(t,i).length)):e}function stripGroups(e){return e.filter((e=>!e.$isLabel))}function flattenOptions(e,t){return i=>i.reduce(((i,s)=>s[e]&&s[e].length?(i.push({$groupLabel:s[t],$isLabel:!0}),i.concat(s[e])):i),[])}function filterGroups(e,t,i,s,l){return o=>o.map((o=>{if(!o[i])return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."),[];const n=filterOptions(o[i],e,t,l);return n.length?{[s]:o[s],[i]:n}:[]}))}const flow=(...e)=>t=>e.reduce(((e,t)=>t(e)),t),_={data(){return{search:"",isOpen:!1,preferredOpenDirection:"below",optimizedHeight:this.maxHeight}},props:{uid:{type:String,default:""},internalSearch:{type:Boolean,default:!0},options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},trackBy:{type:String},label:{type:String},searchable:{type:Boolean,default:!0},clearOnSelect:{type:Boolean,default:!0},hideSelected:{type:Boolean,default:!1},placeholder:{type:String,default:"Select option"},allowEmpty:{type:Boolean,default:!0},resetAfter:{type:Boolean,default:!1},closeOnSelect:{type:Boolean,default:!0},customLabel:{type:Function,default(e,t){return isEmpty(e)?"":t?e[t]:e}},taggable:{type:Boolean,default:!1},tagPlaceholder:{type:String,default:"Press enter to create a tag"},tagPosition:{type:String,default:"top"},max:{type:[Number,Boolean],default:!1},id:{default:null},optionsLimit:{type:Number,default:1e3},groupValues:{type:String},groupLabel:{type:String},groupSelect:{type:Boolean,default:!1},blockKeys:{type:Array,default(){return[]}},preserveSearch:{type:Boolean,default:!1},preselectFirst:{type:Boolean,default:!1},preventAutofocus:{type:Boolean,default:!1}},mounted(){!this.multiple&&this.max&&console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."),this.preselectFirst&&!this.internalValue.length&&this.options.length&&this.select(this.filteredOptions[0])},computed:{internalValue(){return this.modelValue||0===this.modelValue?Array.isArray(this.modelValue)?this.modelValue:[this.modelValue]:[]},filteredOptions(){const e=this.search||"",t=e.toLowerCase().trim();let i=this.options.concat();return i=this.internalSearch?this.groupValues?this.filterAndFlat(i,t,this.label):filterOptions(i,t,this.label,this.customLabel):this.groupValues?flattenOptions(this.groupValues,this.groupLabel)(i):i,i=this.hideSelected?i.filter(not(this.isSelected)):i,this.taggable&&t.length&&!this.isExistingOption(t)&&("bottom"===this.tagPosition?i.push({isTag:!0,label:e}):i.unshift({isTag:!0,label:e})),i.slice(0,this.optionsLimit)},valueKeys(){return this.trackBy?this.internalValue.map((e=>e[this.trackBy])):this.internalValue},optionKeys(){const e=this.groupValues?this.flatAndStrip(this.options):this.options;return e.map((e=>this.customLabel(e,this.label).toString().toLowerCase()))},currentOptionLabel(){return this.multiple?this.searchable?"":this.placeholder:this.internalValue.length?this.getOptionLabel(this.internalValue[0]):this.searchable?"":this.placeholder}},watch:{internalValue:{handler(){this.resetAfter&&this.internalValue.length&&(this.search="",this.$emit("update:modelValue",this.multiple?[]:null))},deep:!0},search(){this.$emit("search-change",this.search)}},emits:["open","search-change","close","select","update:modelValue","remove","tag"],methods:{getValue(){return this.multiple?this.internalValue:0===this.internalValue.length?null:this.internalValue[0]},filterAndFlat(e,t,i){return flow(filterGroups(t,i,this.groupValues,this.groupLabel,this.customLabel),flattenOptions(this.groupValues,this.groupLabel))(e)},flatAndStrip(e){return flow(flattenOptions(this.groupValues,this.groupLabel),stripGroups)(e)},updateSearch(e){this.search=e},isExistingOption(e){return!!this.options&&this.optionKeys.indexOf(e)>-1},isSelected(e){const t=this.trackBy?e[this.trackBy]:e;return this.valueKeys.indexOf(t)>-1},isOptionDisabled(e){return!!e.$isDisabled},getOptionLabel(e){if(isEmpty(e))return"";if(e.isTag)return e.label;if(e.$isLabel)return e.$groupLabel;const t=this.customLabel(e,this.label);return isEmpty(t)?"":t},select(e,t){if(e.$isLabel&&this.groupSelect)this.selectGroup(e);else if(!(-1!==this.blockKeys.indexOf(t)||this.disabled||e.$isDisabled||e.$isLabel)&&(!this.max||!this.multiple||this.internalValue.length!==this.max)&&("Tab"!==t||this.pointerDirty)){if(e.isTag)this.$emit("tag",e.label,this.id),this.search="",this.closeOnSelect&&!this.multiple&&this.deactivate();else{const i=this.isSelected(e);if(i)return void("Tab"!==t&&this.removeElement(e));this.multiple?this.$emit("update:modelValue",this.internalValue.concat([e])):this.$emit("update:modelValue",e),this.$emit("select",e,this.id),this.clearOnSelect&&(this.search="")}this.closeOnSelect&&this.deactivate()}},selectGroup(e){const t=this.options.find((t=>t[this.groupLabel]===e.$groupLabel));if(t){if(this.wholeGroupSelected(t)){this.$emit("remove",t[this.groupValues],this.id);const e=this.internalValue.filter((e=>-1===t[this.groupValues].indexOf(e)));this.$emit("update:modelValue",e)}else{let e=t[this.groupValues].filter((e=>!(this.isOptionDisabled(e)||this.isSelected(e))));this.max&&e.splice(this.max-this.internalValue.length),this.$emit("select",e,this.id),this.$emit("update:modelValue",this.internalValue.concat(e))}this.closeOnSelect&&this.deactivate()}},wholeGroupSelected(e){return e[this.groupValues].every((e=>this.isSelected(e)||this.isOptionDisabled(e)))},wholeGroupDisabled(e){return e[this.groupValues].every(this.isOptionDisabled)},removeElement(e,t=!0){if(this.disabled)return;if(e.$isDisabled)return;if(!this.allowEmpty&&this.internalValue.length<=1)return void this.deactivate();const i="object"===typeof e?this.valueKeys.indexOf(e[this.trackBy]):this.valueKeys.indexOf(e);if(this.multiple){const e=this.internalValue.slice(0,i).concat(this.internalValue.slice(i+1));this.$emit("update:modelValue",e)}else this.$emit("update:modelValue",null);this.$emit("remove",e,this.id),this.closeOnSelect&&t&&this.deactivate()},removeLastElement(){-1===this.blockKeys.indexOf("Delete")&&0===this.search.length&&Array.isArray(this.internalValue)&&this.internalValue.length&&this.removeElement(this.internalValue[this.internalValue.length-1],!1)},activate(){if(this.isOpen||this.disabled)return;this.adjustPosition(),this.groupValues&&0===this.pointer&&this.filteredOptions.length&&(this.pointer=1),this.isOpen=!0,this.searchable?(this.preserveSearch||(this.search=""),this.preventAutofocus||this.$nextTick((()=>this.$refs.search&&this.$refs.search.focus()))):this.preventAutofocus||"undefined"!==typeof this.$el&&this.$el.focus(),this.$emit("open",this.id);const onMouseDown=e=>{if(e?.target){const t=this.uid?"multiselect"+this.uid:"multiselect",i=e.target.closest("."+t);Boolean(i)||(this.deactivate(),document.removeEventListener("mousedown",onMouseDown))}};setTimeout((()=>{document.addEventListener("mousedown",onMouseDown)}),300)},deactivate(){this.isOpen&&(this.isOpen=!1,this.searchable?this.$refs.search&&this.$refs.search.blur():this.$el&&this.$el.blur(),this.preserveSearch||(this.search=""),this.$emit("close",this.getValue(),this.id))},toggle(){this.isOpen?this.deactivate():this.activate()},adjustPosition(){if("undefined"===typeof window)return;const e=this.$el.getBoundingClientRect().top,t=window.innerHeight-this.$el.getBoundingClientRect().bottom,i=t>this.maxHeight;i||t>e||"below"===this.openDirection||"bottom"===this.openDirection?(this.preferredOpenDirection="below",this.optimizedHeight=Math.min(t-40,this.maxHeight)):(this.preferredOpenDirection="above",this.optimizedHeight=Math.min(e-40,this.maxHeight))}}},S={data(){return{pointer:0,pointerDirty:!1}},props:{showPointer:{type:Boolean,default:!0},optionHeight:{type:Number,default:40}},computed:{pointerPosition(){return this.pointer*this.optionHeight},visibleElements(){return this.optimizedHeight/this.optionHeight}},watch:{filteredOptions(){this.pointerAdjust()},isOpen(){this.pointerDirty=!1},pointer(){this.$refs.search&&this.$refs.search.setAttribute("aria-activedescendant",this.id+"-"+this.pointer.toString())}},methods:{optionHighlight(e,t){return{"multiselect__option--highlight":e===this.pointer&&this.showPointer,"multiselect__option--selected":this.isSelected(t)}},groupHighlight(e,t){if(!this.groupSelect)return["multiselect__option--disabled",{"multiselect__option--group":t.$isLabel}];const i=this.options.find((e=>e[this.groupLabel]===t.$groupLabel));return i&&!this.wholeGroupDisabled(i)?["multiselect__option--group",{"multiselect__option--highlight":e===this.pointer&&this.showPointer},{"multiselect__option--group-selected":this.wholeGroupSelected(i)}]:"multiselect__option--disabled"},addPointerElement({key:e}="Enter"){this.filteredOptions.length>0&&this.select(this.filteredOptions[this.pointer],e),this.pointerReset()},pointerForward(){this.pointer<this.filteredOptions.length-1&&(this.pointer++,this.$refs.list.scrollTop<=this.pointerPosition-(this.visibleElements-1)*this.optionHeight&&(this.$refs.list.scrollTop=this.pointerPosition-(this.visibleElements-1)*this.optionHeight),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()),this.pointerDirty=!0},pointerBackward(){this.pointer>0?(this.pointer--,this.$refs.list.scrollTop>=this.pointerPosition&&(this.$refs.list.scrollTop=this.pointerPosition),this.filteredOptions[this.pointer]&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerBackward()):this.filteredOptions[this.pointer]&&this.filteredOptions[0].$isLabel&&!this.groupSelect&&this.pointerForward(),this.pointerDirty=!0},pointerReset(){this.closeOnSelect&&(this.pointer=0,this.$refs.list&&(this.$refs.list.scrollTop=0))},pointerAdjust(){this.pointer>=this.filteredOptions.length-1&&(this.pointer=this.filteredOptions.length?this.filteredOptions.length-1:0),this.filteredOptions.length>0&&this.filteredOptions[this.pointer].$isLabel&&!this.groupSelect&&this.pointerForward()},pointerSet(e){this.pointer=e,this.pointerDirty=!0}}},x={name:"vue-multiselect",mixins:[_,S],compatConfig:{MODE:3,ATTR_ENUMERATED_COERCION:!1},props:{name:{type:String,default:""},modelValue:{type:null,default(){return[]}},selectLabel:{type:String,default:"Press enter to select"},selectGroupLabel:{type:String,default:"Press enter to select group"},selectedLabel:{type:String,default:"Selected"},deselectLabel:{type:String,default:"Press enter to remove"},deselectGroupLabel:{type:String,default:"Press enter to deselect group"},showLabels:{type:Boolean,default:!0},limit:{type:Number,default:99999},maxHeight:{type:Number,default:300},limitText:{type:Function,default:e=>`and ${e} more`},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},openDirection:{type:String,default:""},showNoOptions:{type:Boolean,default:!0},showNoResults:{type:Boolean,default:!0},tabindex:{type:Number,default:0}},computed:{hasOptionGroup(){return this.groupValues&&this.groupLabel&&this.groupSelect},isSingleLabelVisible(){return!1},isPlaceholderVisible(){return!this.internalValue.length&&(!this.searchable||!this.isOpen)},visibleValues(){return this.internalValue.slice(0,this.limit)},singleValue(){return this.internalValue[0]},deselectLabelText(){return this.showLabels?this.deselectLabel:""},deselectGroupLabelText(){return this.showLabels?this.deselectGroupLabel:""},selectLabelText(){return this.showLabels?this.selectLabel:""},selectGroupLabelText(){return this.showLabels?this.selectGroupLabel:""},selectedLabelText(){return this.showLabels?this.selectedLabel:""},inputStyle(){return this.searchable||this.multiple&&this.modelValue&&this.modelValue.length?this.isOpen?{width:"100%"}:{width:"0",position:"absolute",padding:"0"}:""},contentStyle(){return this.options.length?{display:"inline-block"}:{display:"block"}},isAbove(){return"above"===this.openDirection||"top"===this.openDirection||"below"!==this.openDirection&&"bottom"!==this.openDirection&&"above"===this.preferredOpenDirection},showSearchInput(){return this.searchable&&(!this.hasSingleSelectedSlot||!this.visibleSingleValue&&0!==this.visibleSingleValue||this.isOpen)},showNoResultsSlot(){return this.showNoResults&&0===this.filteredOptions.length&&this.search&&!this.loading},showNoOptionsSlot(){return this.showNoOptions&&(0===this.options.length||!0===this.hasOptionGroup&&0===this.filteredOptions.length)&&!this.search&&!this.loading}}};var O=__webpack_require__(6262);const L=(0,O.A)(x,[["render",render]]),$=L,N=$;return s})()));
|