@94ai/nf-popup-lazy-select 3.2.81 → 3.2.82

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.
@@ -1,9 +1,37 @@
1
- import { defineComponent, ref, computed, nextTick } from "vue-demi";
1
+ import { defineComponent, ref, computed } from "vue-demi";
2
2
  import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
3
+ import Vue from "vue";
4
+ import ResizeObserver from "resize-observer-polyfill";
5
+ import { closest } from "@94ai/common-utils";
6
+ function _mergeNamespaces(n, m) {
7
+ for (var i = 0; i < m.length; i++) {
8
+ const e = m[i];
9
+ if (typeof e !== "string" && !Array.isArray(e)) {
10
+ for (const k in e) {
11
+ if (k !== "default" && !(k in n)) {
12
+ const d = Object.getOwnPropertyDescriptor(e, k);
13
+ if (d) {
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: () => e[k]
17
+ });
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
24
+ }
3
25
  const __sfc_main = defineComponent({
4
26
  name: "nf-popup-lazy-select"
5
27
  });
6
28
  __sfc_main.props = {
29
+ tag: {
30
+ key: "tag",
31
+ required: false,
32
+ type: String,
33
+ default: "custom-select-dropdown"
34
+ },
7
35
  popdownOnSelect: {
8
36
  key: "popdownOnSelect",
9
37
  required: false,
@@ -16,6 +44,24 @@ __sfc_main.props = {
16
44
  type: Boolean,
17
45
  default: true
18
46
  },
47
+ emitSelectedItemOnClick: {
48
+ key: "emitSelectedItemOnClick",
49
+ required: false,
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ visibleChangeKeywordCached: {
54
+ key: "visibleChangeKeywordCached",
55
+ required: false,
56
+ type: Boolean,
57
+ default: true
58
+ },
59
+ visibleChangeSelectListCached: {
60
+ key: "visibleChangeSelectListCached",
61
+ required: false,
62
+ type: Boolean,
63
+ default: true
64
+ },
19
65
  keywordAlias: {
20
66
  key: "keywordAlias",
21
67
  required: false,
@@ -92,7 +138,7 @@ __sfc_main.props = {
92
138
  key: "reserveKeyword",
93
139
  required: false,
94
140
  type: Boolean,
95
- default: false
141
+ default: true
96
142
  },
97
143
  popperClass: {
98
144
  key: "popperClass",
@@ -401,122 +447,87 @@ __sfc_main.props = {
401
447
  __sfc_main.setup = (__props, __ctx) => {
402
448
  const props = __props;
403
449
  const emit = __ctx.emit;
404
- const refreshLazySelect = ref(Date.now());
405
- const resetPlaceholder = ref(false);
406
- const placeholderComputed = computed(() => {
407
- var _a;
408
- return resetPlaceholder.value ? "" : !props.multiple && !props.assignmentOnSelect && ((_a = popLazySelectRef.value) == null ? void 0 : _a.keyword) ? popLazySelectRef.value.keyword : props.placeholder;
409
- });
450
+ const getSelectedData = (e) => {
451
+ emit("get-selected-data", e);
452
+ };
453
+ const visibleChange = async (e) => {
454
+ emit("visible-change", e);
455
+ };
410
456
  const changeHide = () => {
411
- emit("popup-hide", false);
412
- popLazySelectRef.value.visibleIntersect = false;
413
- popLazySelectRef.value.nfLazySelect.reset();
414
- popLazySelectRef.value.nfLazySelect.init();
457
+ var _a, _b, _c, _d;
458
+ const visible = (_d = (_c = (_b = (_a = popLazySelectRef.value) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfLazySelect) == null ? void 0 : _c.nfVirtualSelect) == null ? void 0 : _d.visible;
459
+ if (!popup.value && typeof visible === "boolean" && visible) {
460
+ popLazySelectRef.value.$refs.nfLazySelect.nfVirtualSelect.toggleMenu();
461
+ }
462
+ emit("popup-hide", popup.value);
415
463
  };
416
464
  const changeShow = () => {
417
- var _a, _b, _c, _d, _e;
418
- const visible = (_e = (_d = (_c = (_b = (_a = popLazySelectRef.value) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfLazySelect) == null ? void 0 : _c.$refs) == null ? void 0 : _d.nfVirtualSelect) == null ? void 0 : _e.visible;
465
+ var _a, _b, _c, _d;
466
+ const visible = (_d = (_c = (_b = (_a = popLazySelectRef.value) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfLazySelect) == null ? void 0 : _c.nfVirtualSelect) == null ? void 0 : _d.visible;
419
467
  if (popup.value && typeof visible === "boolean" && !visible) {
420
- popLazySelectRef.value.$refs.nfLazySelect.$refs.nfVirtualSelect.toggleMenu();
468
+ popLazySelectRef.value.$refs.nfLazySelect.nfVirtualSelect.toggleMenu();
421
469
  }
422
470
  emit("popup-show", popup.value);
423
471
  };
424
- const visibleChange = async (e) => {
425
- if (!e) {
426
- return "break";
427
- } else if (!props.popdownOnSelect && !props.multiple && props.assignmentOnSelect) {
428
- return "discard-cache";
429
- }
430
- };
431
472
  const popLazySelectRef = ref();
432
473
  const popup = ref(false);
433
474
  const dataList = ref([]);
434
- const dataMap = ref({});
475
+ const allCachedDataList = ref([]);
435
476
  const fetchDataHandler = (e) => {
436
- var _a;
437
- (_a = e.originData) == null ? void 0 : _a.forEach((data) => {
438
- if (!dataMap.value[data[props.valueAlias]]) {
439
- dataMap.value[data[props.valueAlias]] = true;
440
- dataList.value.push(data);
477
+ dataList.value = e.data;
478
+ allCachedDataList.value = e.allCachedDataList;
479
+ emit("fetch-data", e);
480
+ };
481
+ const selectItem = (val) => {
482
+ if (!props.assignmentOnSelect) {
483
+ if (props.emitSelectedItemOnClick) {
484
+ const getValItem = () => {
485
+ if (props.multiple) {
486
+ return val == null ? void 0 : val.map((it) => allCachedDataList.value.find((item) => item[props.valueAlias] === it));
487
+ } else {
488
+ return val ? allCachedDataList.value.find((item) => item[props.valueAlias] === val) : val;
489
+ }
490
+ };
491
+ emit("get-selected-data", getValItem());
492
+ } else {
493
+ emit("get-selected-data", val);
441
494
  }
442
- });
443
- emit("fetch-data", {
444
- allCachedList: dataList.value,
445
- currentList: e.originData,
446
- event: e
447
- });
495
+ }
448
496
  };
449
497
  const currentVal = computed({
450
498
  get() {
451
499
  return props.value;
452
500
  },
453
501
  set(val) {
454
- var _a, _b, _c, _d;
455
- const changeVal = (value) => {
456
- emit("input", value);
457
- emit("update:value", value);
458
- emit("change", value);
459
- };
460
- const getValItem = () => {
461
- if (props.multiple) {
462
- return val == null ? void 0 : val.map((it) => dataList.value.find((item) => item[props.valueAlias] === it));
463
- } else {
464
- return val ? dataList.value.find((item) => item[props.valueAlias] === val) : val;
465
- }
466
- };
467
- if (!props.multiple && !props.assignmentOnSelect) {
468
- const elSelectRef = (_d = (_c = (_b = (_a = popLazySelectRef.value) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfLazySelect) == null ? void 0 : _c.$refs) == null ? void 0 : _d.nfVirtualSelect;
469
- if (elSelectRef) {
470
- nextTick(() => {
471
- resetPlaceholder.value = true;
472
- let timer = setTimeout(() => {
473
- clearTimeout(timer);
474
- timer = void 0;
475
- resetPlaceholder.value = false;
476
- elSelectRef.selectedLabel = popLazySelectRef.value.keyword;
477
- }, 30);
478
- });
479
- }
480
- }
481
- if (!props.multiple) {
482
- if (props.popdownOnSelect) {
483
- changeVal(void 0);
484
- if (val) {
485
- popup.value = false;
486
- }
487
- } else {
488
- if (!props.assignmentOnSelect) {
489
- changeVal(void 0);
490
- } else {
491
- changeVal(val);
492
- }
493
- }
494
- } else {
495
- changeVal(val);
502
+ if (!props.multiple && props.popdownOnSelect && val) {
503
+ popup.value = false;
496
504
  }
497
- emit("select-item", getValItem());
505
+ emit("input", val);
506
+ emit("update:value", val);
507
+ emit("change", val);
498
508
  }
499
509
  });
500
510
  return Object.assign({
501
- refreshLazySelect,
502
- placeholderComputed,
511
+ getSelectedData,
512
+ visibleChange,
503
513
  changeHide,
504
514
  changeShow,
505
- visibleChange,
506
515
  popLazySelectRef,
507
516
  popup,
508
517
  dataList,
509
518
  fetchDataHandler,
519
+ selectItem,
510
520
  currentVal
511
521
  }, {
512
522
  currentVal,
513
- dataMap,
514
- dataList,
523
+ // 当前选中值
515
524
  popup,
525
+ // 手动关闭浮层
516
526
  popLazySelectRef
527
+ // nf-lazy-select
517
528
  });
518
529
  };
519
- var _sfc_render = function render() {
530
+ var _sfc_render$2 = function render() {
520
531
  var _vm = this, _c = _vm._self._c;
521
532
  _vm._self._setupProxy;
522
533
  return _c("el-popover", {
@@ -552,11 +563,12 @@ var _sfc_render = function render() {
552
563
  }, [_vm._t("default", null, {
553
564
  "slot": "reference"
554
565
  }), _c("nf-lazy-select", _vm._b({
555
- key: _vm.refreshLazySelect,
556
566
  ref: "popLazySelectRef",
557
567
  attrs: {
558
- "visible-change-keyword-cached": "",
559
- "visible-change-select-list-cached": "",
568
+ "visible-change-keyword-cached": _vm.visibleChangeKeywordCached,
569
+ "visible-change-select-list-cached": _vm.visibleChangeSelectListCached,
570
+ "emit-selected-item-on-click": _vm.emitSelectedItemOnClick,
571
+ "tag": _vm.tag,
560
572
  "request": _vm.request,
561
573
  "page-size": _vm.pageSize,
562
574
  "page-no-alias": _vm.pageNoAlias,
@@ -565,7 +577,7 @@ var _sfc_render = function render() {
565
577
  "keyword-alias": _vm.keywordAlias,
566
578
  "loading-desc": _vm.loadingDesc,
567
579
  "no-data-text": _vm.noDataText,
568
- "placeholder": _vm.placeholderComputed,
580
+ "placeholder": _vm.placeholder,
569
581
  "multiple-limit": _vm.multipleLimit,
570
582
  "collapse-tags": _vm.collapseTags,
571
583
  "disabled": _vm.disabled,
@@ -607,6 +619,8 @@ var _sfc_render = function render() {
607
619
  "height": _vm.dataList.length ? _vm.height : "0"
608
620
  },
609
621
  on: {
622
+ "get-selected-data": _vm.getSelectedData,
623
+ "select-item": _vm.selectItem,
610
624
  "scroll": (e) => _vm.$emit("scroll", e),
611
625
  "totop": (e) => _vm.$emit("totop", e),
612
626
  "tobottom": (e) => _vm.$emit("tobottom", e),
@@ -641,11 +655,2549 @@ var _sfc_render = function render() {
641
655
  "slot": "loading"
642
656
  })], 2)], 2);
643
657
  };
658
+ var _sfc_staticRenderFns$2 = [];
659
+ var __component__$2 = /* @__PURE__ */ normalizeComponent(__sfc_main, _sfc_render$2, _sfc_staticRenderFns$2, false, null, null, null, null);
660
+ const NfPopupLazySelect = __component__$2.exports;
661
+ function broadcast(componentName, eventName, params) {
662
+ this.$children.forEach((child) => {
663
+ var name = child.$options.componentName;
664
+ if (name === componentName) {
665
+ child.$emit.apply(child, [eventName].concat(params));
666
+ } else {
667
+ broadcast.apply(child, [componentName, eventName].concat([params]));
668
+ }
669
+ });
670
+ }
671
+ const Emitter = {
672
+ methods: {
673
+ dispatch(componentName, eventName, params) {
674
+ var parent = this.$parent || this.$root;
675
+ var name = parent.$options.componentName;
676
+ while (parent && (!name || name !== componentName)) {
677
+ parent = parent.$parent;
678
+ if (parent) {
679
+ name = parent.$options.componentName;
680
+ }
681
+ }
682
+ if (parent) {
683
+ parent.$emit.apply(parent, [eventName].concat(params));
684
+ }
685
+ },
686
+ broadcast(componentName, eventName, params) {
687
+ broadcast.call(this, componentName, eventName, params);
688
+ }
689
+ }
690
+ };
691
+ function Focus(ref2) {
692
+ return {
693
+ methods: {
694
+ focus() {
695
+ this.$refs[ref2].focus();
696
+ }
697
+ }
698
+ };
699
+ }
700
+ const defaultLang = {
701
+ el: {
702
+ colorpicker: {
703
+ confirm: "确定",
704
+ clear: "清空"
705
+ },
706
+ datepicker: {
707
+ now: "此刻",
708
+ today: "今天",
709
+ cancel: "取消",
710
+ clear: "清空",
711
+ confirm: "确定",
712
+ selectDate: "选择日期",
713
+ selectTime: "选择时间",
714
+ startDate: "开始日期",
715
+ startTime: "开始时间",
716
+ endDate: "结束日期",
717
+ endTime: "结束时间",
718
+ prevYear: "前一年",
719
+ nextYear: "后一年",
720
+ prevMonth: "上个月",
721
+ nextMonth: "下个月",
722
+ year: "年",
723
+ month1: "1 月",
724
+ month2: "2 月",
725
+ month3: "3 月",
726
+ month4: "4 月",
727
+ month5: "5 月",
728
+ month6: "6 月",
729
+ month7: "7 月",
730
+ month8: "8 月",
731
+ month9: "9 月",
732
+ month10: "10 月",
733
+ month11: "11 月",
734
+ month12: "12 月",
735
+ // week: '周次',
736
+ weeks: {
737
+ sun: "日",
738
+ mon: "一",
739
+ tue: "二",
740
+ wed: "三",
741
+ thu: "四",
742
+ fri: "五",
743
+ sat: "六"
744
+ },
745
+ months: {
746
+ jan: "一月",
747
+ feb: "二月",
748
+ mar: "三月",
749
+ apr: "四月",
750
+ may: "五月",
751
+ jun: "六月",
752
+ jul: "七月",
753
+ aug: "八月",
754
+ sep: "九月",
755
+ oct: "十月",
756
+ nov: "十一月",
757
+ dec: "十二月"
758
+ }
759
+ },
760
+ select: {
761
+ loading: "加载中",
762
+ noMatch: "无匹配数据",
763
+ noData: "无数据",
764
+ placeholder: "请选择"
765
+ },
766
+ cascader: {
767
+ noMatch: "无匹配数据",
768
+ loading: "加载中",
769
+ placeholder: "请选择",
770
+ noData: "暂无数据"
771
+ },
772
+ pagination: {
773
+ goto: "前往",
774
+ pagesize: "条/页",
775
+ total: "共 {total} 条",
776
+ pageClassifier: "页"
777
+ },
778
+ messagebox: {
779
+ title: "提示",
780
+ confirm: "确定",
781
+ cancel: "取消",
782
+ error: "输入的数据不合法!"
783
+ },
784
+ upload: {
785
+ deleteTip: "按 delete 键可删除",
786
+ delete: "删除",
787
+ preview: "查看图片",
788
+ continue: "继续上传"
789
+ },
790
+ table: {
791
+ emptyText: "暂无数据",
792
+ confirmFilter: "筛选",
793
+ resetFilter: "重置",
794
+ clearFilter: "全部",
795
+ sumText: "合计"
796
+ },
797
+ tree: {
798
+ emptyText: "暂无数据"
799
+ },
800
+ transfer: {
801
+ noMatch: "无匹配数据",
802
+ noData: "无数据",
803
+ titles: ["列表 1", "列表 2"],
804
+ filterPlaceholder: "请输入搜索内容",
805
+ noCheckedFormat: "共 {total} 项",
806
+ hasCheckedFormat: "已选 {checked}/{total} 项"
807
+ },
808
+ image: {
809
+ error: "加载失败"
810
+ },
811
+ pageHeader: {
812
+ title: "返回"
813
+ },
814
+ popconfirm: {
815
+ confirmButtonText: "确定",
816
+ cancelButtonText: "取消"
817
+ }
818
+ }
819
+ };
820
+ var isMergeableObject = function isMergeableObject2(value) {
821
+ return isNonNullObject(value) && !isSpecial(value);
822
+ };
823
+ function isNonNullObject(value) {
824
+ return !!value && typeof value === "object";
825
+ }
826
+ function isSpecial(value) {
827
+ var stringValue = Object.prototype.toString.call(value);
828
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
829
+ }
830
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
831
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
832
+ function isReactElement(value) {
833
+ return value.$$typeof === REACT_ELEMENT_TYPE;
834
+ }
835
+ function emptyTarget(val) {
836
+ return Array.isArray(val) ? [] : {};
837
+ }
838
+ function cloneIfNecessary(value, optionsArgument) {
839
+ var clone = optionsArgument && optionsArgument.clone === true;
840
+ return clone && isMergeableObject(value) ? deepmerge(emptyTarget(value), value, optionsArgument) : value;
841
+ }
842
+ function defaultArrayMerge(target, source, optionsArgument) {
843
+ var destination = target.slice();
844
+ source.forEach(function(e, i) {
845
+ if (typeof destination[i] === "undefined") {
846
+ destination[i] = cloneIfNecessary(e, optionsArgument);
847
+ } else if (isMergeableObject(e)) {
848
+ destination[i] = deepmerge(target[i], e, optionsArgument);
849
+ } else if (target.indexOf(e) === -1) {
850
+ destination.push(cloneIfNecessary(e, optionsArgument));
851
+ }
852
+ });
853
+ return destination;
854
+ }
855
+ function mergeObject(target, source, optionsArgument) {
856
+ var destination = {};
857
+ if (isMergeableObject(target)) {
858
+ Object.keys(target).forEach(function(key) {
859
+ destination[key] = cloneIfNecessary(target[key], optionsArgument);
860
+ });
861
+ }
862
+ Object.keys(source).forEach(function(key) {
863
+ if (!isMergeableObject(source[key]) || !target[key]) {
864
+ destination[key] = cloneIfNecessary(source[key], optionsArgument);
865
+ } else {
866
+ destination[key] = deepmerge(target[key], source[key], optionsArgument);
867
+ }
868
+ });
869
+ return destination;
870
+ }
871
+ function deepmerge(target, source, optionsArgument) {
872
+ var sourceIsArray = Array.isArray(source);
873
+ var targetIsArray = Array.isArray(target);
874
+ var options = optionsArgument || {
875
+ arrayMerge: defaultArrayMerge
876
+ };
877
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
878
+ if (!sourceAndTargetTypesMatch) {
879
+ return cloneIfNecessary(source, optionsArgument);
880
+ } else if (sourceIsArray) {
881
+ var arrayMerge = options.arrayMerge || defaultArrayMerge;
882
+ return arrayMerge(target, source, optionsArgument);
883
+ } else {
884
+ return mergeObject(target, source, optionsArgument);
885
+ }
886
+ }
887
+ deepmerge.all = function deepmergeAll(array, optionsArgument) {
888
+ if (!Array.isArray(array) || array.length < 2) {
889
+ throw new Error("first argument should be an array with at least two elements");
890
+ }
891
+ return array.reduce(function(prev, next) {
892
+ return deepmerge(prev, next, optionsArgument);
893
+ });
894
+ };
895
+ var deepmerge_1 = deepmerge;
896
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
897
+ function hasOwn(obj, key) {
898
+ return hasOwnProperty.call(obj, key);
899
+ }
900
+ const getValueByPath = function(object, prop) {
901
+ prop = prop || "";
902
+ const paths = prop.split(".");
903
+ let current = object;
904
+ let result = null;
905
+ for (let i = 0, j = paths.length; i < j; i++) {
906
+ const path = paths[i];
907
+ if (!current)
908
+ break;
909
+ if (i === j - 1) {
910
+ result = current[path];
911
+ break;
912
+ }
913
+ current = current[path];
914
+ }
915
+ return result;
916
+ };
917
+ const valueEquals = (a, b) => {
918
+ if (a === b)
919
+ return true;
920
+ if (!(a instanceof Array))
921
+ return false;
922
+ if (!(b instanceof Array))
923
+ return false;
924
+ if (a.length !== b.length)
925
+ return false;
926
+ for (let i = 0; i !== a.length; ++i) {
927
+ if (a[i] !== b[i])
928
+ return false;
929
+ }
930
+ return true;
931
+ };
932
+ const isIE = function() {
933
+ return !Vue.prototype.$isServer && !isNaN(Number(document.documentMode));
934
+ };
935
+ const isEdge = function() {
936
+ return !Vue.prototype.$isServer && navigator.userAgent.indexOf("Edge") > -1;
937
+ };
938
+ const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
939
+ function Format(Vue2) {
940
+ function template(string, ...args) {
941
+ if (args.length === 1 && typeof args[0] === "object") {
942
+ args = args[0];
943
+ }
944
+ if (!args || !args.hasOwnProperty) {
945
+ args = {};
946
+ }
947
+ return string.replace(RE_NARGS, (match, prefix, i, index) => {
948
+ let result;
949
+ if (string[index - 1] === "{" && string[index + match.length] === "}") {
950
+ return i;
951
+ } else {
952
+ result = hasOwn(args, i) ? args[i] : null;
953
+ if (result === null || result === void 0) {
954
+ return "";
955
+ }
956
+ return result;
957
+ }
958
+ });
959
+ }
960
+ return template;
961
+ }
962
+ const format = Format();
963
+ let lang = defaultLang;
964
+ let merged = false;
965
+ let i18nHandler = function() {
966
+ const vuei18n = Object.getPrototypeOf(this || Vue).$t;
967
+ if (typeof vuei18n === "function" && !!Vue.locale) {
968
+ if (!merged) {
969
+ merged = true;
970
+ Vue.locale(Vue.config.lang, deepmerge_1(lang, Vue.locale(Vue.config.lang) || {}, {
971
+ clone: true
972
+ }));
973
+ }
974
+ return vuei18n.apply(this, arguments);
975
+ }
976
+ };
977
+ const t = function(path, options) {
978
+ let value = i18nHandler.apply(this, arguments);
979
+ if (value !== null && value !== void 0)
980
+ return value;
981
+ const array = path.split(".");
982
+ let current = lang;
983
+ for (let i = 0, j = array.length; i < j; i++) {
984
+ const property = array[i];
985
+ value = current[property];
986
+ if (i === j - 1)
987
+ return format(value, options);
988
+ if (!value)
989
+ return "";
990
+ current = value;
991
+ }
992
+ return "";
993
+ };
994
+ const Locale = {
995
+ methods: {
996
+ t(...args) {
997
+ return t.apply(this, args);
998
+ }
999
+ }
1000
+ };
1001
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
1002
+ function getDefaultExportFromCjs(x) {
1003
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
1004
+ }
1005
+ var throttle$1 = function(delay, noTrailing, callback, debounceMode) {
1006
+ var timeoutID;
1007
+ var lastExec = 0;
1008
+ if (typeof noTrailing !== "boolean") {
1009
+ debounceMode = callback;
1010
+ callback = noTrailing;
1011
+ noTrailing = void 0;
1012
+ }
1013
+ function wrapper() {
1014
+ var self2 = this;
1015
+ var elapsed = Number(/* @__PURE__ */ new Date()) - lastExec;
1016
+ var args = arguments;
1017
+ function exec() {
1018
+ lastExec = Number(/* @__PURE__ */ new Date());
1019
+ callback.apply(self2, args);
1020
+ }
1021
+ function clear() {
1022
+ timeoutID = void 0;
1023
+ }
1024
+ if (debounceMode && !timeoutID) {
1025
+ exec();
1026
+ }
1027
+ if (timeoutID) {
1028
+ clearTimeout(timeoutID);
1029
+ }
1030
+ if (debounceMode === void 0 && elapsed > delay) {
1031
+ exec();
1032
+ } else if (noTrailing !== true) {
1033
+ timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay);
1034
+ }
1035
+ }
1036
+ return wrapper;
1037
+ };
1038
+ var throttle = throttle$1;
1039
+ var debounce = function(delay, atBegin, callback) {
1040
+ return callback === void 0 ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
1041
+ };
1042
+ const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounce);
1043
+ const isServer = typeof window === "undefined";
1044
+ const resizeHandler = function(entries) {
1045
+ for (let entry of entries) {
1046
+ const listeners = entry.target.__resizeListeners__ || [];
1047
+ if (listeners.length) {
1048
+ listeners.forEach((fn) => {
1049
+ fn();
1050
+ });
1051
+ }
1052
+ }
1053
+ };
1054
+ const addResizeListener = function(element, fn) {
1055
+ if (isServer)
1056
+ return;
1057
+ if (!element.__resizeListeners__) {
1058
+ element.__resizeListeners__ = [];
1059
+ element.__ro__ = new ResizeObserver(resizeHandler);
1060
+ element.__ro__.observe(element);
1061
+ }
1062
+ element.__resizeListeners__.push(fn);
1063
+ };
1064
+ const removeResizeListener = function(element, fn) {
1065
+ if (!element || !element.__resizeListeners__)
1066
+ return;
1067
+ element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
1068
+ if (!element.__resizeListeners__.length) {
1069
+ element.__ro__.disconnect();
1070
+ }
1071
+ };
1072
+ function scrollIntoView(container, selected) {
1073
+ if (Vue.prototype.$isServer)
1074
+ return;
1075
+ if (!selected) {
1076
+ container.scrollTop = 0;
1077
+ return;
1078
+ }
1079
+ const offsetParents = [];
1080
+ let pointer = selected.offsetParent;
1081
+ while (pointer && container !== pointer && container.contains(pointer)) {
1082
+ offsetParents.push(pointer);
1083
+ pointer = pointer.offsetParent;
1084
+ }
1085
+ const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
1086
+ const bottom = top + selected.offsetHeight;
1087
+ const viewRectTop = container.scrollTop;
1088
+ const viewRectBottom = viewRectTop + container.clientHeight;
1089
+ if (top < viewRectTop) {
1090
+ container.scrollTop = top;
1091
+ } else if (bottom > viewRectBottom) {
1092
+ container.scrollTop = bottom - container.clientHeight;
1093
+ }
1094
+ }
1095
+ function isKorean(text) {
1096
+ const reg = /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi;
1097
+ return reg.test(text);
1098
+ }
1099
+ const NavigationMixin = {
1100
+ data() {
1101
+ return {
1102
+ hoverOption: -1
1103
+ };
1104
+ },
1105
+ computed: {
1106
+ optionsAllDisabled() {
1107
+ return this.options.filter((option) => option.visible).every((option) => option.disabled);
1108
+ }
1109
+ },
1110
+ watch: {
1111
+ hoverIndex(val) {
1112
+ if (typeof val === "number" && val > -1) {
1113
+ this.hoverOption = this.options[val] || {};
1114
+ }
1115
+ this.options.forEach((option) => {
1116
+ option.hover = this.hoverOption === option;
1117
+ });
1118
+ }
1119
+ },
1120
+ methods: {
1121
+ navigateOptions(direction) {
1122
+ if (!this.visible) {
1123
+ this.visible = true;
1124
+ return;
1125
+ }
1126
+ if (this.options.length === 0 || this.filteredOptionsCount === 0)
1127
+ return;
1128
+ if (!this.optionsAllDisabled) {
1129
+ if (direction === "next") {
1130
+ this.hoverIndex++;
1131
+ if (this.hoverIndex === this.options.length) {
1132
+ this.hoverIndex = 0;
1133
+ }
1134
+ } else if (direction === "prev") {
1135
+ this.hoverIndex--;
1136
+ if (this.hoverIndex < 0) {
1137
+ this.hoverIndex = this.options.length - 1;
1138
+ }
1139
+ }
1140
+ const option = this.options[this.hoverIndex];
1141
+ if (option.disabled === true || option.groupDisabled === true || !option.visible) {
1142
+ this.navigateOptions(direction);
1143
+ }
1144
+ this.$nextTick(() => this.scrollToOption(this.hoverOption));
1145
+ }
1146
+ }
1147
+ }
1148
+ };
1149
+ Vue.prototype.$isServer;
1150
+ const trim = function(string) {
1151
+ return (string || "").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
1152
+ };
1153
+ function hasClass(el, cls) {
1154
+ if (!el || !cls)
1155
+ return false;
1156
+ if (cls.indexOf(" ") !== -1)
1157
+ throw new Error("className should not contain space.");
1158
+ if (el.classList) {
1159
+ return el.classList.contains(cls);
1160
+ } else {
1161
+ return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
1162
+ }
1163
+ }
1164
+ function addClass(el, cls) {
1165
+ if (!el)
1166
+ return;
1167
+ var curClass = el.className;
1168
+ var classes = (cls || "").split(" ");
1169
+ for (var i = 0, j = classes.length; i < j; i++) {
1170
+ var clsName = classes[i];
1171
+ if (!clsName)
1172
+ continue;
1173
+ if (el.classList) {
1174
+ el.classList.add(clsName);
1175
+ } else if (!hasClass(el, clsName)) {
1176
+ curClass += " " + clsName;
1177
+ }
1178
+ }
1179
+ if (!el.classList) {
1180
+ el.className = curClass;
1181
+ }
1182
+ }
1183
+ function removeClass(el, cls) {
1184
+ if (!el || !cls)
1185
+ return;
1186
+ var classes = cls.split(" ");
1187
+ var curClass = " " + el.className + " ";
1188
+ for (var i = 0, j = classes.length; i < j; i++) {
1189
+ var clsName = classes[i];
1190
+ if (!clsName)
1191
+ continue;
1192
+ if (el.classList) {
1193
+ el.classList.remove(clsName);
1194
+ } else if (hasClass(el, clsName)) {
1195
+ curClass = curClass.replace(" " + clsName + " ", " ");
1196
+ }
1197
+ }
1198
+ if (!el.classList) {
1199
+ el.className = trim(curClass);
1200
+ }
1201
+ }
1202
+ let hasModal = false;
1203
+ let hasInitZIndex = false;
1204
+ let zIndex;
1205
+ const getModal = function() {
1206
+ if (Vue.prototype.$isServer)
1207
+ return;
1208
+ let modalDom = PopupManager.modalDom;
1209
+ if (modalDom) {
1210
+ hasModal = true;
1211
+ } else {
1212
+ hasModal = false;
1213
+ modalDom = document.createElement("div");
1214
+ PopupManager.modalDom = modalDom;
1215
+ modalDom.addEventListener("touchmove", function(event) {
1216
+ event.preventDefault();
1217
+ event.stopPropagation();
1218
+ });
1219
+ modalDom.addEventListener("click", function() {
1220
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
1221
+ });
1222
+ }
1223
+ return modalDom;
1224
+ };
1225
+ const instances = {};
1226
+ const PopupManager = {
1227
+ modalFade: true,
1228
+ getInstance: function(id) {
1229
+ return instances[id];
1230
+ },
1231
+ register: function(id, instance) {
1232
+ if (id && instance) {
1233
+ instances[id] = instance;
1234
+ }
1235
+ },
1236
+ deregister: function(id) {
1237
+ if (id) {
1238
+ instances[id] = null;
1239
+ delete instances[id];
1240
+ }
1241
+ },
1242
+ nextZIndex: function() {
1243
+ return PopupManager.zIndex++;
1244
+ },
1245
+ modalStack: [],
1246
+ doOnModalClick: function() {
1247
+ const topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
1248
+ if (!topItem)
1249
+ return;
1250
+ const instance = PopupManager.getInstance(topItem.id);
1251
+ if (instance && instance.closeOnClickModal) {
1252
+ instance.close();
1253
+ }
1254
+ },
1255
+ openModal: function(id, zIndex2, dom, modalClass, modalFade) {
1256
+ if (Vue.prototype.$isServer)
1257
+ return;
1258
+ if (!id || zIndex2 === void 0)
1259
+ return;
1260
+ this.modalFade = modalFade;
1261
+ const modalStack = this.modalStack;
1262
+ for (let i = 0, j = modalStack.length; i < j; i++) {
1263
+ const item = modalStack[i];
1264
+ if (item.id === id) {
1265
+ return;
1266
+ }
1267
+ }
1268
+ const modalDom = getModal();
1269
+ addClass(modalDom, "v-modal");
1270
+ if (this.modalFade && !hasModal) {
1271
+ addClass(modalDom, "v-modal-enter");
1272
+ }
1273
+ if (modalClass) {
1274
+ let classArr = modalClass.trim().split(/\s+/);
1275
+ classArr.forEach((item) => addClass(modalDom, item));
1276
+ }
1277
+ setTimeout(() => {
1278
+ removeClass(modalDom, "v-modal-enter");
1279
+ }, 200);
1280
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
1281
+ dom.parentNode.appendChild(modalDom);
1282
+ } else {
1283
+ document.body.appendChild(modalDom);
1284
+ }
1285
+ if (zIndex2) {
1286
+ modalDom.style.zIndex = zIndex2;
1287
+ }
1288
+ modalDom.tabIndex = 0;
1289
+ modalDom.style.display = "";
1290
+ this.modalStack.push({
1291
+ id,
1292
+ zIndex: zIndex2,
1293
+ modalClass
1294
+ });
1295
+ },
1296
+ closeModal: function(id) {
1297
+ const modalStack = this.modalStack;
1298
+ const modalDom = getModal();
1299
+ if (modalStack.length > 0) {
1300
+ const topItem = modalStack[modalStack.length - 1];
1301
+ if (topItem.id === id) {
1302
+ if (topItem.modalClass) {
1303
+ let classArr = topItem.modalClass.trim().split(/\s+/);
1304
+ classArr.forEach((item) => removeClass(modalDom, item));
1305
+ }
1306
+ modalStack.pop();
1307
+ if (modalStack.length > 0) {
1308
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
1309
+ }
1310
+ } else {
1311
+ for (let i = modalStack.length - 1; i >= 0; i--) {
1312
+ if (modalStack[i].id === id) {
1313
+ modalStack.splice(i, 1);
1314
+ break;
1315
+ }
1316
+ }
1317
+ }
1318
+ }
1319
+ if (modalStack.length === 0) {
1320
+ if (this.modalFade) {
1321
+ addClass(modalDom, "v-modal-leave");
1322
+ }
1323
+ setTimeout(() => {
1324
+ if (modalStack.length === 0) {
1325
+ if (modalDom.parentNode)
1326
+ modalDom.parentNode.removeChild(modalDom);
1327
+ modalDom.style.display = "none";
1328
+ PopupManager.modalDom = void 0;
1329
+ }
1330
+ removeClass(modalDom, "v-modal-leave");
1331
+ }, 200);
1332
+ }
1333
+ }
1334
+ };
1335
+ Object.defineProperty(PopupManager, "zIndex", {
1336
+ configurable: true,
1337
+ get() {
1338
+ if (!hasInitZIndex) {
1339
+ zIndex = zIndex || (Vue.prototype.$ELEMENT || {}).zIndex || 2e3;
1340
+ hasInitZIndex = true;
1341
+ }
1342
+ return zIndex;
1343
+ },
1344
+ set(value) {
1345
+ zIndex = value;
1346
+ }
1347
+ });
1348
+ const getTopPopup = function() {
1349
+ if (Vue.prototype.$isServer)
1350
+ return;
1351
+ if (PopupManager.modalStack.length > 0) {
1352
+ const topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
1353
+ if (!topPopup)
1354
+ return;
1355
+ const instance = PopupManager.getInstance(topPopup.id);
1356
+ return instance;
1357
+ }
1358
+ };
1359
+ if (!Vue.prototype.$isServer) {
1360
+ window.addEventListener("keydown", function(event) {
1361
+ if (event.keyCode === 27) {
1362
+ const topPopup = getTopPopup();
1363
+ if (topPopup && topPopup.closeOnPressEscape) {
1364
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction("cancel") : topPopup.close();
1365
+ }
1366
+ }
1367
+ });
1368
+ }
1369
+ var popper$1 = { exports: {} };
1370
+ /**
1371
+ * @fileOverview Kickass library to create and place poppers near their reference elements.
1372
+ * @version {{version}}
1373
+ * @license
1374
+ * Copyright (c) 2016 Federico Zivolo and contributors
1375
+ *
1376
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
1377
+ * of this software and associated documentation files (the "Software"), to deal
1378
+ * in the Software without restriction, including without limitation the rights
1379
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1380
+ * copies of the Software, and to permit persons to whom the Software is
1381
+ * furnished to do so, subject to the following conditions:
1382
+ *
1383
+ * The above copyright notice and this permission notice shall be included in all
1384
+ * copies or substantial portions of the Software.
1385
+ *
1386
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1387
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1388
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1389
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1390
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1391
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1392
+ * SOFTWARE.
1393
+ */
1394
+ (function(module) {
1395
+ (function(root, factory) {
1396
+ if (module.exports) {
1397
+ module.exports = factory();
1398
+ } else {
1399
+ root.Popper = factory();
1400
+ }
1401
+ })(commonjsGlobal, function() {
1402
+ var root = window;
1403
+ var DEFAULTS = {
1404
+ // placement of the popper
1405
+ placement: "bottom",
1406
+ gpuAcceleration: true,
1407
+ // shift popper from its origin by the given amount of pixels (can be negative)
1408
+ offset: 0,
1409
+ // the element which will act as boundary of the popper
1410
+ boundariesElement: "viewport",
1411
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
1412
+ boundariesPadding: 5,
1413
+ // popper will try to prevent overflow following this order,
1414
+ // by default, then, it could overflow on the left and on top of the boundariesElement
1415
+ preventOverflowOrder: ["left", "right", "top", "bottom"],
1416
+ // the behavior used by flip to change the placement of the popper
1417
+ flipBehavior: "flip",
1418
+ arrowElement: "[x-arrow]",
1419
+ arrowOffset: 0,
1420
+ // list of functions used to modify the offsets before they are applied to the popper
1421
+ modifiers: ["shift", "offset", "preventOverflow", "keepTogether", "arrow", "flip", "applyStyle"],
1422
+ modifiersIgnored: [],
1423
+ forceAbsolute: false
1424
+ };
1425
+ function Popper2(reference, popper2, options) {
1426
+ this._reference = reference.jquery ? reference[0] : reference;
1427
+ this.state = {};
1428
+ var isNotDefined = typeof popper2 === "undefined" || popper2 === null;
1429
+ var isConfig = popper2 && Object.prototype.toString.call(popper2) === "[object Object]";
1430
+ if (isNotDefined || isConfig) {
1431
+ this._popper = this.parse(isConfig ? popper2 : {});
1432
+ } else {
1433
+ this._popper = popper2.jquery ? popper2[0] : popper2;
1434
+ }
1435
+ this._options = Object.assign({}, DEFAULTS, options);
1436
+ this._options.modifiers = this._options.modifiers.map((function(modifier) {
1437
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1)
1438
+ return;
1439
+ if (modifier === "applyStyle") {
1440
+ this._popper.setAttribute("x-placement", this._options.placement);
1441
+ }
1442
+ return this.modifiers[modifier] || modifier;
1443
+ }).bind(this));
1444
+ this.state.position = this._getPosition(this._popper, this._reference);
1445
+ setStyle(this._popper, {
1446
+ position: this.state.position,
1447
+ top: 0
1448
+ });
1449
+ this.update();
1450
+ this._setupEventListeners();
1451
+ return this;
1452
+ }
1453
+ Popper2.prototype.destroy = function() {
1454
+ this._popper.removeAttribute("x-placement");
1455
+ this._popper.style.left = "";
1456
+ this._popper.style.position = "";
1457
+ this._popper.style.top = "";
1458
+ this._popper.style[getSupportedPropertyName("transform")] = "";
1459
+ this._removeEventListeners();
1460
+ if (this._options.removeOnDestroy) {
1461
+ this._popper.remove();
1462
+ }
1463
+ return this;
1464
+ };
1465
+ Popper2.prototype.update = function() {
1466
+ var data = {
1467
+ instance: this,
1468
+ styles: {}
1469
+ };
1470
+ data.placement = this._options.placement;
1471
+ data._originalPlacement = this._options.placement;
1472
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
1473
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
1474
+ data = this.runModifiers(data, this._options.modifiers);
1475
+ if (typeof this.state.updateCallback === "function") {
1476
+ this.state.updateCallback(data);
1477
+ }
1478
+ };
1479
+ Popper2.prototype.onCreate = function(callback) {
1480
+ callback(this);
1481
+ return this;
1482
+ };
1483
+ Popper2.prototype.onUpdate = function(callback) {
1484
+ this.state.updateCallback = callback;
1485
+ return this;
1486
+ };
1487
+ Popper2.prototype.parse = function(config) {
1488
+ var defaultConfig = {
1489
+ tagName: "div",
1490
+ classNames: ["popper"],
1491
+ attributes: [],
1492
+ parent: root.document.body,
1493
+ content: "",
1494
+ contentType: "text",
1495
+ arrowTagName: "div",
1496
+ arrowClassNames: ["popper__arrow"],
1497
+ arrowAttributes: ["x-arrow"]
1498
+ };
1499
+ config = Object.assign({}, defaultConfig, config);
1500
+ var d = root.document;
1501
+ var popper2 = d.createElement(config.tagName);
1502
+ addClassNames(popper2, config.classNames);
1503
+ addAttributes(popper2, config.attributes);
1504
+ if (config.contentType === "node") {
1505
+ popper2.appendChild(config.content.jquery ? config.content[0] : config.content);
1506
+ } else if (config.contentType === "html") {
1507
+ popper2.innerHTML = config.content;
1508
+ } else {
1509
+ popper2.textContent = config.content;
1510
+ }
1511
+ if (config.arrowTagName) {
1512
+ var arrow = d.createElement(config.arrowTagName);
1513
+ addClassNames(arrow, config.arrowClassNames);
1514
+ addAttributes(arrow, config.arrowAttributes);
1515
+ popper2.appendChild(arrow);
1516
+ }
1517
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
1518
+ if (typeof parent === "string") {
1519
+ parent = d.querySelectorAll(config.parent);
1520
+ if (parent.length > 1) {
1521
+ console.warn("WARNING: the given `parent` query(" + config.parent + ") matched more than one element, the first one will be used");
1522
+ }
1523
+ if (parent.length === 0) {
1524
+ throw "ERROR: the given `parent` doesn't exists!";
1525
+ }
1526
+ parent = parent[0];
1527
+ }
1528
+ if (parent.length > 1 && parent instanceof Element === false) {
1529
+ console.warn("WARNING: you have passed as parent a list of elements, the first one will be used");
1530
+ parent = parent[0];
1531
+ }
1532
+ parent.appendChild(popper2);
1533
+ return popper2;
1534
+ function addClassNames(element, classNames) {
1535
+ classNames.forEach(function(className) {
1536
+ element.classList.add(className);
1537
+ });
1538
+ }
1539
+ function addAttributes(element, attributes) {
1540
+ attributes.forEach(function(attribute) {
1541
+ element.setAttribute(attribute.split(":")[0], attribute.split(":")[1] || "");
1542
+ });
1543
+ }
1544
+ };
1545
+ Popper2.prototype._getPosition = function(popper2, reference) {
1546
+ getOffsetParent(reference);
1547
+ if (this._options.forceAbsolute) {
1548
+ return "absolute";
1549
+ }
1550
+ var isParentFixed = isFixed(reference);
1551
+ return isParentFixed ? "fixed" : "absolute";
1552
+ };
1553
+ Popper2.prototype._getOffsets = function(popper2, reference, placement) {
1554
+ placement = placement.split("-")[0];
1555
+ var popperOffsets = {};
1556
+ popperOffsets.position = this.state.position;
1557
+ var isParentFixed = popperOffsets.position === "fixed";
1558
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper2), isParentFixed);
1559
+ var popperRect = getOuterSizes(popper2);
1560
+ if (["right", "left"].indexOf(placement) !== -1) {
1561
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
1562
+ if (placement === "left") {
1563
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
1564
+ } else {
1565
+ popperOffsets.left = referenceOffsets.right;
1566
+ }
1567
+ } else {
1568
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
1569
+ if (placement === "top") {
1570
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
1571
+ } else {
1572
+ popperOffsets.top = referenceOffsets.bottom;
1573
+ }
1574
+ }
1575
+ popperOffsets.width = popperRect.width;
1576
+ popperOffsets.height = popperRect.height;
1577
+ return {
1578
+ popper: popperOffsets,
1579
+ reference: referenceOffsets
1580
+ };
1581
+ };
1582
+ Popper2.prototype._setupEventListeners = function() {
1583
+ this.state.updateBound = this.update.bind(this);
1584
+ root.addEventListener("resize", this.state.updateBound);
1585
+ if (this._options.boundariesElement !== "window") {
1586
+ var target = getScrollParent(this._reference);
1587
+ if (target === root.document.body || target === root.document.documentElement) {
1588
+ target = root;
1589
+ }
1590
+ target.addEventListener("scroll", this.state.updateBound);
1591
+ this.state.scrollTarget = target;
1592
+ }
1593
+ };
1594
+ Popper2.prototype._removeEventListeners = function() {
1595
+ root.removeEventListener("resize", this.state.updateBound);
1596
+ if (this._options.boundariesElement !== "window" && this.state.scrollTarget) {
1597
+ this.state.scrollTarget.removeEventListener("scroll", this.state.updateBound);
1598
+ this.state.scrollTarget = null;
1599
+ }
1600
+ this.state.updateBound = null;
1601
+ };
1602
+ Popper2.prototype._getBoundaries = function(data, padding, boundariesElement) {
1603
+ var boundaries = {};
1604
+ var width, height;
1605
+ if (boundariesElement === "window") {
1606
+ var body = root.document.body, html = root.document.documentElement;
1607
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
1608
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
1609
+ boundaries = {
1610
+ top: 0,
1611
+ right: width,
1612
+ bottom: height,
1613
+ left: 0
1614
+ };
1615
+ } else if (boundariesElement === "viewport") {
1616
+ var offsetParent = getOffsetParent(this._popper);
1617
+ var scrollParent = getScrollParent(this._popper);
1618
+ var offsetParentRect = getOffsetRect(offsetParent);
1619
+ var getScrollTopValue = function(element) {
1620
+ return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
1621
+ };
1622
+ var getScrollLeftValue = function(element) {
1623
+ return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
1624
+ };
1625
+ var scrollTop = data.offsets.popper.position === "fixed" ? 0 : getScrollTopValue(scrollParent);
1626
+ var scrollLeft = data.offsets.popper.position === "fixed" ? 0 : getScrollLeftValue(scrollParent);
1627
+ boundaries = {
1628
+ top: 0 - (offsetParentRect.top - scrollTop),
1629
+ right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
1630
+ bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
1631
+ left: 0 - (offsetParentRect.left - scrollLeft)
1632
+ };
1633
+ } else {
1634
+ if (getOffsetParent(this._popper) === boundariesElement) {
1635
+ boundaries = {
1636
+ top: 0,
1637
+ left: 0,
1638
+ right: boundariesElement.clientWidth,
1639
+ bottom: boundariesElement.clientHeight
1640
+ };
1641
+ } else {
1642
+ boundaries = getOffsetRect(boundariesElement);
1643
+ }
1644
+ }
1645
+ boundaries.left += padding;
1646
+ boundaries.right -= padding;
1647
+ boundaries.top = boundaries.top + padding;
1648
+ boundaries.bottom = boundaries.bottom - padding;
1649
+ return boundaries;
1650
+ };
1651
+ Popper2.prototype.runModifiers = function(data, modifiers, ends) {
1652
+ var modifiersToRun = modifiers.slice();
1653
+ if (ends !== void 0) {
1654
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
1655
+ }
1656
+ modifiersToRun.forEach((function(modifier) {
1657
+ if (isFunction(modifier)) {
1658
+ data = modifier.call(this, data);
1659
+ }
1660
+ }).bind(this));
1661
+ return data;
1662
+ };
1663
+ Popper2.prototype.isModifierRequired = function(requesting, requested) {
1664
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
1665
+ return !!this._options.modifiers.slice(0, index).filter(function(modifier) {
1666
+ return modifier === requested;
1667
+ }).length;
1668
+ };
1669
+ Popper2.prototype.modifiers = {};
1670
+ Popper2.prototype.modifiers.applyStyle = function(data) {
1671
+ var styles = {
1672
+ position: data.offsets.popper.position
1673
+ };
1674
+ var left = Math.round(data.offsets.popper.left);
1675
+ var top = Math.round(data.offsets.popper.top);
1676
+ var prefixedProperty;
1677
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName("transform"))) {
1678
+ styles[prefixedProperty] = "translate3d(" + left + "px, " + top + "px, 0)";
1679
+ styles.top = 0;
1680
+ styles.left = 0;
1681
+ } else {
1682
+ styles.left = left;
1683
+ styles.top = top;
1684
+ }
1685
+ Object.assign(styles, data.styles);
1686
+ setStyle(this._popper, styles);
1687
+ this._popper.setAttribute("x-placement", data.placement);
1688
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
1689
+ setStyle(data.arrowElement, data.offsets.arrow);
1690
+ }
1691
+ return data;
1692
+ };
1693
+ Popper2.prototype.modifiers.shift = function(data) {
1694
+ var placement = data.placement;
1695
+ var basePlacement = placement.split("-")[0];
1696
+ var shiftVariation = placement.split("-")[1];
1697
+ if (shiftVariation) {
1698
+ var reference = data.offsets.reference;
1699
+ var popper2 = getPopperClientRect(data.offsets.popper);
1700
+ var shiftOffsets = {
1701
+ y: {
1702
+ start: {
1703
+ top: reference.top
1704
+ },
1705
+ end: {
1706
+ top: reference.top + reference.height - popper2.height
1707
+ }
1708
+ },
1709
+ x: {
1710
+ start: {
1711
+ left: reference.left
1712
+ },
1713
+ end: {
1714
+ left: reference.left + reference.width - popper2.width
1715
+ }
1716
+ }
1717
+ };
1718
+ var axis = ["bottom", "top"].indexOf(basePlacement) !== -1 ? "x" : "y";
1719
+ data.offsets.popper = Object.assign(popper2, shiftOffsets[axis][shiftVariation]);
1720
+ }
1721
+ return data;
1722
+ };
1723
+ Popper2.prototype.modifiers.preventOverflow = function(data) {
1724
+ var order = this._options.preventOverflowOrder;
1725
+ var popper2 = getPopperClientRect(data.offsets.popper);
1726
+ var check = {
1727
+ left: function() {
1728
+ var left = popper2.left;
1729
+ if (popper2.left < data.boundaries.left) {
1730
+ left = Math.max(popper2.left, data.boundaries.left);
1731
+ }
1732
+ return {
1733
+ left
1734
+ };
1735
+ },
1736
+ right: function() {
1737
+ var left = popper2.left;
1738
+ if (popper2.right > data.boundaries.right) {
1739
+ left = Math.min(popper2.left, data.boundaries.right - popper2.width);
1740
+ }
1741
+ return {
1742
+ left
1743
+ };
1744
+ },
1745
+ top: function() {
1746
+ var top = popper2.top;
1747
+ if (popper2.top < data.boundaries.top) {
1748
+ top = Math.max(popper2.top, data.boundaries.top);
1749
+ }
1750
+ return {
1751
+ top
1752
+ };
1753
+ },
1754
+ bottom: function() {
1755
+ var top = popper2.top;
1756
+ if (popper2.bottom > data.boundaries.bottom) {
1757
+ top = Math.min(popper2.top, data.boundaries.bottom - popper2.height);
1758
+ }
1759
+ return {
1760
+ top
1761
+ };
1762
+ }
1763
+ };
1764
+ order.forEach(function(direction) {
1765
+ data.offsets.popper = Object.assign(popper2, check[direction]());
1766
+ });
1767
+ return data;
1768
+ };
1769
+ Popper2.prototype.modifiers.keepTogether = function(data) {
1770
+ var popper2 = getPopperClientRect(data.offsets.popper);
1771
+ var reference = data.offsets.reference;
1772
+ var f = Math.floor;
1773
+ if (popper2.right < f(reference.left)) {
1774
+ data.offsets.popper.left = f(reference.left) - popper2.width;
1775
+ }
1776
+ if (popper2.left > f(reference.right)) {
1777
+ data.offsets.popper.left = f(reference.right);
1778
+ }
1779
+ if (popper2.bottom < f(reference.top)) {
1780
+ data.offsets.popper.top = f(reference.top) - popper2.height;
1781
+ }
1782
+ if (popper2.top > f(reference.bottom)) {
1783
+ data.offsets.popper.top = f(reference.bottom);
1784
+ }
1785
+ return data;
1786
+ };
1787
+ Popper2.prototype.modifiers.flip = function(data) {
1788
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
1789
+ console.warn("WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!");
1790
+ return data;
1791
+ }
1792
+ if (data.flipped && data.placement === data._originalPlacement) {
1793
+ return data;
1794
+ }
1795
+ var placement = data.placement.split("-")[0];
1796
+ var placementOpposite = getOppositePlacement(placement);
1797
+ var variation = data.placement.split("-")[1] || "";
1798
+ var flipOrder = [];
1799
+ if (this._options.flipBehavior === "flip") {
1800
+ flipOrder = [placement, placementOpposite];
1801
+ } else {
1802
+ flipOrder = this._options.flipBehavior;
1803
+ }
1804
+ flipOrder.forEach((function(step, index) {
1805
+ if (placement !== step || flipOrder.length === index + 1) {
1806
+ return;
1807
+ }
1808
+ placement = data.placement.split("-")[0];
1809
+ placementOpposite = getOppositePlacement(placement);
1810
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
1811
+ var a = ["right", "bottom"].indexOf(placement) !== -1;
1812
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
1813
+ data.flipped = true;
1814
+ data.placement = flipOrder[index + 1];
1815
+ if (variation) {
1816
+ data.placement += "-" + variation;
1817
+ }
1818
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
1819
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
1820
+ }
1821
+ }).bind(this));
1822
+ return data;
1823
+ };
1824
+ Popper2.prototype.modifiers.offset = function(data) {
1825
+ var offset = this._options.offset;
1826
+ var popper2 = data.offsets.popper;
1827
+ if (data.placement.indexOf("left") !== -1) {
1828
+ popper2.top -= offset;
1829
+ } else if (data.placement.indexOf("right") !== -1) {
1830
+ popper2.top += offset;
1831
+ } else if (data.placement.indexOf("top") !== -1) {
1832
+ popper2.left -= offset;
1833
+ } else if (data.placement.indexOf("bottom") !== -1) {
1834
+ popper2.left += offset;
1835
+ }
1836
+ return data;
1837
+ };
1838
+ Popper2.prototype.modifiers.arrow = function(data) {
1839
+ var arrow = this._options.arrowElement;
1840
+ var arrowOffset = this._options.arrowOffset;
1841
+ if (typeof arrow === "string") {
1842
+ arrow = this._popper.querySelector(arrow);
1843
+ }
1844
+ if (!arrow) {
1845
+ return data;
1846
+ }
1847
+ if (!this._popper.contains(arrow)) {
1848
+ console.warn("WARNING: `arrowElement` must be child of its popper element!");
1849
+ return data;
1850
+ }
1851
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
1852
+ console.warn("WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!");
1853
+ return data;
1854
+ }
1855
+ var arrowStyle = {};
1856
+ var placement = data.placement.split("-")[0];
1857
+ var popper2 = getPopperClientRect(data.offsets.popper);
1858
+ var reference = data.offsets.reference;
1859
+ var isVertical = ["left", "right"].indexOf(placement) !== -1;
1860
+ var len = isVertical ? "height" : "width";
1861
+ var side = isVertical ? "top" : "left";
1862
+ var altSide = isVertical ? "left" : "top";
1863
+ var opSide = isVertical ? "bottom" : "right";
1864
+ var arrowSize = getOuterSizes(arrow)[len];
1865
+ if (reference[opSide] - arrowSize < popper2[side]) {
1866
+ data.offsets.popper[side] -= popper2[side] - (reference[opSide] - arrowSize);
1867
+ }
1868
+ if (reference[side] + arrowSize > popper2[opSide]) {
1869
+ data.offsets.popper[side] += reference[side] + arrowSize - popper2[opSide];
1870
+ }
1871
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
1872
+ var sideValue = center - popper2[side];
1873
+ sideValue = Math.max(Math.min(popper2[len] - arrowSize - 8, sideValue), 8);
1874
+ arrowStyle[side] = sideValue;
1875
+ arrowStyle[altSide] = "";
1876
+ data.offsets.arrow = arrowStyle;
1877
+ data.arrowElement = arrow;
1878
+ return data;
1879
+ };
1880
+ function getOuterSizes(element) {
1881
+ var _display = element.style.display, _visibility = element.style.visibility;
1882
+ element.style.display = "block";
1883
+ element.style.visibility = "hidden";
1884
+ element.offsetWidth;
1885
+ var styles = root.getComputedStyle(element);
1886
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
1887
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
1888
+ var result = {
1889
+ width: element.offsetWidth + y,
1890
+ height: element.offsetHeight + x
1891
+ };
1892
+ element.style.display = _display;
1893
+ element.style.visibility = _visibility;
1894
+ return result;
1895
+ }
1896
+ function getOppositePlacement(placement) {
1897
+ var hash = {
1898
+ left: "right",
1899
+ right: "left",
1900
+ bottom: "top",
1901
+ top: "bottom"
1902
+ };
1903
+ return placement.replace(/left|right|bottom|top/g, function(matched) {
1904
+ return hash[matched];
1905
+ });
1906
+ }
1907
+ function getPopperClientRect(popperOffsets) {
1908
+ var offsets = Object.assign({}, popperOffsets);
1909
+ offsets.right = offsets.left + offsets.width;
1910
+ offsets.bottom = offsets.top + offsets.height;
1911
+ return offsets;
1912
+ }
1913
+ function getArrayKeyIndex(arr, keyToFind) {
1914
+ var i = 0, key;
1915
+ for (key in arr) {
1916
+ if (arr[key] === keyToFind) {
1917
+ return i;
1918
+ }
1919
+ i++;
1920
+ }
1921
+ return null;
1922
+ }
1923
+ function getStyleComputedProperty(element, property) {
1924
+ var css = root.getComputedStyle(element, null);
1925
+ return css[property];
1926
+ }
1927
+ function getOffsetParent(element) {
1928
+ var offsetParent = element.offsetParent;
1929
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
1930
+ }
1931
+ function getScrollParent(element) {
1932
+ var parent = element.parentNode;
1933
+ if (!parent) {
1934
+ return element;
1935
+ }
1936
+ if (parent === root.document) {
1937
+ if (root.document.body.scrollTop || root.document.body.scrollLeft) {
1938
+ return root.document.body;
1939
+ } else {
1940
+ return root.document.documentElement;
1941
+ }
1942
+ }
1943
+ if (["scroll", "auto"].indexOf(getStyleComputedProperty(parent, "overflow")) !== -1 || ["scroll", "auto"].indexOf(getStyleComputedProperty(parent, "overflow-x")) !== -1 || ["scroll", "auto"].indexOf(getStyleComputedProperty(parent, "overflow-y")) !== -1) {
1944
+ return parent;
1945
+ }
1946
+ return getScrollParent(element.parentNode);
1947
+ }
1948
+ function isFixed(element) {
1949
+ if (element === root.document.body) {
1950
+ return false;
1951
+ }
1952
+ if (getStyleComputedProperty(element, "position") === "fixed") {
1953
+ return true;
1954
+ }
1955
+ return element.parentNode ? isFixed(element.parentNode) : element;
1956
+ }
1957
+ function setStyle(element, styles) {
1958
+ function is_numeric(n) {
1959
+ return n !== "" && !isNaN(parseFloat(n)) && isFinite(n);
1960
+ }
1961
+ Object.keys(styles).forEach(function(prop) {
1962
+ var unit = "";
1963
+ if (["width", "height", "top", "right", "bottom", "left"].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
1964
+ unit = "px";
1965
+ }
1966
+ element.style[prop] = styles[prop] + unit;
1967
+ });
1968
+ }
1969
+ function isFunction(functionToCheck) {
1970
+ var getType = {};
1971
+ return functionToCheck && getType.toString.call(functionToCheck) === "[object Function]";
1972
+ }
1973
+ function getOffsetRect(element) {
1974
+ var elementRect = {
1975
+ width: element.offsetWidth,
1976
+ height: element.offsetHeight,
1977
+ left: element.offsetLeft,
1978
+ top: element.offsetTop
1979
+ };
1980
+ elementRect.right = elementRect.left + elementRect.width;
1981
+ elementRect.bottom = elementRect.top + elementRect.height;
1982
+ return elementRect;
1983
+ }
1984
+ function getBoundingClientRect(element) {
1985
+ var rect = element.getBoundingClientRect();
1986
+ var isIE2 = navigator.userAgent.indexOf("MSIE") != -1;
1987
+ var rectTop = isIE2 && element.tagName === "HTML" ? -element.scrollTop : rect.top;
1988
+ return {
1989
+ left: rect.left,
1990
+ top: rectTop,
1991
+ right: rect.right,
1992
+ bottom: rect.bottom,
1993
+ width: rect.right - rect.left,
1994
+ height: rect.bottom - rectTop
1995
+ };
1996
+ }
1997
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
1998
+ var elementRect = getBoundingClientRect(element);
1999
+ var parentRect = getBoundingClientRect(parent);
2000
+ if (fixed) {
2001
+ var scrollParent = getScrollParent(parent);
2002
+ parentRect.top += scrollParent.scrollTop;
2003
+ parentRect.bottom += scrollParent.scrollTop;
2004
+ parentRect.left += scrollParent.scrollLeft;
2005
+ parentRect.right += scrollParent.scrollLeft;
2006
+ }
2007
+ var rect = {
2008
+ top: elementRect.top - parentRect.top,
2009
+ left: elementRect.left - parentRect.left,
2010
+ bottom: elementRect.top - parentRect.top + elementRect.height,
2011
+ right: elementRect.left - parentRect.left + elementRect.width,
2012
+ width: elementRect.width,
2013
+ height: elementRect.height
2014
+ };
2015
+ return rect;
2016
+ }
2017
+ function getSupportedPropertyName(property) {
2018
+ var prefixes = ["", "ms", "webkit", "moz", "o"];
2019
+ for (var i = 0; i < prefixes.length; i++) {
2020
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
2021
+ if (typeof root.document.body.style[toCheck] !== "undefined") {
2022
+ return toCheck;
2023
+ }
2024
+ }
2025
+ return null;
2026
+ }
2027
+ if (!Object.assign) {
2028
+ Object.defineProperty(Object, "assign", {
2029
+ enumerable: false,
2030
+ configurable: true,
2031
+ writable: true,
2032
+ value: function(target) {
2033
+ if (target === void 0 || target === null) {
2034
+ throw new TypeError("Cannot convert first argument to object");
2035
+ }
2036
+ var to = Object(target);
2037
+ for (var i = 1; i < arguments.length; i++) {
2038
+ var nextSource = arguments[i];
2039
+ if (nextSource === void 0 || nextSource === null) {
2040
+ continue;
2041
+ }
2042
+ nextSource = Object(nextSource);
2043
+ var keysArray = Object.keys(nextSource);
2044
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
2045
+ var nextKey = keysArray[nextIndex];
2046
+ var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
2047
+ if (desc !== void 0 && desc.enumerable) {
2048
+ to[nextKey] = nextSource[nextKey];
2049
+ }
2050
+ }
2051
+ }
2052
+ return to;
2053
+ }
2054
+ });
2055
+ }
2056
+ return Popper2;
2057
+ });
2058
+ })(popper$1);
2059
+ var popperExports = popper$1.exports;
2060
+ const popper = /* @__PURE__ */ getDefaultExportFromCjs(popperExports);
2061
+ const _vite_plugin_require_transform_popper_0 = /* @__PURE__ */ _mergeNamespaces({
2062
+ __proto__: null,
2063
+ default: popper
2064
+ }, [popperExports]);
2065
+ const PopperJS = Vue.prototype.$isServer ? function() {
2066
+ } : popper || _vite_plugin_require_transform_popper_0;
2067
+ const stop = (e) => e.stopPropagation();
2068
+ const Popper = {
2069
+ props: {
2070
+ transformOrigin: {
2071
+ type: [Boolean, String],
2072
+ default: true
2073
+ },
2074
+ placement: {
2075
+ type: String,
2076
+ default: "bottom"
2077
+ },
2078
+ boundariesPadding: {
2079
+ type: Number,
2080
+ default: 5
2081
+ },
2082
+ reference: {},
2083
+ popper: {},
2084
+ offset: {
2085
+ default: 0
2086
+ },
2087
+ value: Boolean,
2088
+ visibleArrow: Boolean,
2089
+ arrowOffset: {
2090
+ type: Number,
2091
+ default: 35
2092
+ },
2093
+ appendToBody: {
2094
+ type: Boolean,
2095
+ default: true
2096
+ },
2097
+ popperOptions: {
2098
+ type: Object,
2099
+ default() {
2100
+ return {
2101
+ gpuAcceleration: false
2102
+ };
2103
+ }
2104
+ }
2105
+ },
2106
+ data() {
2107
+ return {
2108
+ showPopper: false,
2109
+ currentPlacement: ""
2110
+ };
2111
+ },
2112
+ watch: {
2113
+ value: {
2114
+ immediate: true,
2115
+ handler(val) {
2116
+ this.showPopper = val;
2117
+ this.$emit("input", val);
2118
+ }
2119
+ },
2120
+ showPopper(val) {
2121
+ if (this.disabled)
2122
+ return;
2123
+ val ? this.updatePopper() : this.destroyPopper();
2124
+ this.$emit("input", val);
2125
+ }
2126
+ },
2127
+ methods: {
2128
+ createPopper() {
2129
+ if (this.$isServer)
2130
+ return;
2131
+ this.currentPlacement = this.currentPlacement || this.placement;
2132
+ if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
2133
+ return;
2134
+ }
2135
+ const options = this.popperOptions;
2136
+ const popper2 = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
2137
+ let reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
2138
+ if (!reference && this.$slots.reference && this.$slots.reference[0]) {
2139
+ reference = this.referenceElm = this.$slots.reference[0].elm;
2140
+ }
2141
+ if (!popper2 || !reference)
2142
+ return;
2143
+ if (this.visibleArrow)
2144
+ this.appendArrow(popper2);
2145
+ if (this.appendToBody)
2146
+ document.body.appendChild(this.popperElm);
2147
+ if (this.popperJS && this.popperJS.destroy) {
2148
+ this.popperJS.destroy();
2149
+ }
2150
+ options.placement = this.currentPlacement;
2151
+ options.offset = this.offset;
2152
+ options.arrowOffset = this.arrowOffset;
2153
+ this.popperJS = new PopperJS(reference, popper2, options);
2154
+ this.popperJS.onCreate((_) => {
2155
+ this.$emit("created", this);
2156
+ this.resetTransformOrigin();
2157
+ this.$nextTick(this.updatePopper);
2158
+ });
2159
+ if (typeof options.onUpdate === "function") {
2160
+ this.popperJS.onUpdate(options.onUpdate);
2161
+ }
2162
+ this.popperJS._popper.style.zIndex = PopupManager.nextZIndex();
2163
+ this.popperElm.addEventListener("click", stop);
2164
+ },
2165
+ updatePopper() {
2166
+ const popperJS = this.popperJS;
2167
+ if (popperJS) {
2168
+ popperJS.update();
2169
+ if (popperJS._popper) {
2170
+ popperJS._popper.style.zIndex = PopupManager.nextZIndex();
2171
+ }
2172
+ } else {
2173
+ this.createPopper();
2174
+ }
2175
+ },
2176
+ doDestroy(forceDestroy) {
2177
+ if (!this.popperJS || this.showPopper && !forceDestroy)
2178
+ return;
2179
+ this.popperJS.destroy();
2180
+ this.popperJS = null;
2181
+ },
2182
+ destroyPopper() {
2183
+ if (this.popperJS) {
2184
+ this.resetTransformOrigin();
2185
+ }
2186
+ },
2187
+ resetTransformOrigin() {
2188
+ if (!this.transformOrigin)
2189
+ return;
2190
+ let placementMap = {
2191
+ top: "bottom",
2192
+ bottom: "top",
2193
+ left: "right",
2194
+ right: "left"
2195
+ };
2196
+ let placement = this.popperJS._popper.getAttribute("x-placement").split("-")[0];
2197
+ let origin = placementMap[placement];
2198
+ this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === "string" ? this.transformOrigin : ["top", "bottom"].indexOf(placement) > -1 ? `center ${origin}` : `${origin} center`;
2199
+ },
2200
+ appendArrow(element) {
2201
+ let hash;
2202
+ if (this.appended) {
2203
+ return;
2204
+ }
2205
+ this.appended = true;
2206
+ for (let item in element.attributes) {
2207
+ if (/^_v-/.test(element.attributes[item].name)) {
2208
+ hash = element.attributes[item].name;
2209
+ break;
2210
+ }
2211
+ }
2212
+ const arrow = document.createElement("div");
2213
+ if (hash) {
2214
+ arrow.setAttribute(hash, "");
2215
+ }
2216
+ arrow.setAttribute("x-arrow", "");
2217
+ arrow.className = "popper__arrow";
2218
+ element.appendChild(arrow);
2219
+ }
2220
+ },
2221
+ beforeDestroy() {
2222
+ this.doDestroy(true);
2223
+ if (this.popperElm && this.popperElm.parentNode === document.body) {
2224
+ this.popperElm.removeEventListener("click", stop);
2225
+ document.body.removeChild(this.popperElm);
2226
+ }
2227
+ },
2228
+ // call destroy in keep-alive mode
2229
+ deactivated() {
2230
+ this.$options.beforeDestroy[0].call(this);
2231
+ }
2232
+ };
2233
+ const _sfc_main$1 = {
2234
+ name: "ElSelectDropdown",
2235
+ componentName: "ElSelectDropdown",
2236
+ mixins: [Popper],
2237
+ props: {
2238
+ placement: {
2239
+ default: "bottom-start"
2240
+ },
2241
+ boundariesPadding: {
2242
+ default: 0
2243
+ },
2244
+ popperOptions: {
2245
+ default() {
2246
+ return {
2247
+ gpuAcceleration: false
2248
+ };
2249
+ }
2250
+ },
2251
+ visibleArrow: {
2252
+ default: true
2253
+ },
2254
+ appendToBody: {
2255
+ type: Boolean,
2256
+ default: true
2257
+ }
2258
+ },
2259
+ data() {
2260
+ return {
2261
+ minWidth: ""
2262
+ };
2263
+ },
2264
+ computed: {
2265
+ popperClass() {
2266
+ return this.$parent.popperClass;
2267
+ }
2268
+ },
2269
+ watch: {
2270
+ "$parent.inputWidth"() {
2271
+ this.minWidth = this.$parent.$el.getBoundingClientRect().width + "px";
2272
+ }
2273
+ },
2274
+ mounted() {
2275
+ this.referenceElm = this.$parent.$refs.reference.$el;
2276
+ this.$parent.popperElm = this.popperElm = this.$el;
2277
+ this.$on("updatePopper", () => {
2278
+ if (this.$parent.visible)
2279
+ this.updatePopper();
2280
+ });
2281
+ this.$on("destroyPopper", this.destroyPopper);
2282
+ }
2283
+ };
2284
+ var _sfc_render$1 = function render2() {
2285
+ var _vm = this, _c = _vm._self._c;
2286
+ return _c("div", {
2287
+ staticClass: "el-select-dropdown el-popper",
2288
+ class: [{
2289
+ "is-multiple": _vm.$parent.multiple
2290
+ }, _vm.popperClass],
2291
+ style: {
2292
+ minWidth: _vm.minWidth
2293
+ }
2294
+ }, [_vm._t("default")], 2);
2295
+ };
2296
+ var _sfc_staticRenderFns$1 = [];
2297
+ var __component__$1 = /* @__PURE__ */ normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
2298
+ const SelectMenu = __component__$1.exports;
2299
+ const _sfc_main = {
2300
+ mixins: [Emitter, Locale, Focus("reference"), NavigationMixin],
2301
+ name: "ElSelect",
2302
+ componentName: "ElSelect",
2303
+ inject: {
2304
+ elForm: {
2305
+ default: ""
2306
+ },
2307
+ elFormItem: {
2308
+ default: ""
2309
+ }
2310
+ },
2311
+ provide() {
2312
+ return {
2313
+ "select": this
2314
+ };
2315
+ },
2316
+ computed: {
2317
+ _elFormItemSize() {
2318
+ return (this.elFormItem || {}).elFormItemSize;
2319
+ },
2320
+ readonly() {
2321
+ return !this.filterable || this.multiple || !isIE() && !isEdge() && !this.visible;
2322
+ },
2323
+ showClose() {
2324
+ let hasValue = this.multiple ? Array.isArray(this.value) && this.value.length > 0 : this.value !== void 0 && this.value !== null && this.value !== "";
2325
+ let criteria = this.clearable && !this.selectDisabled && this.inputHovering && hasValue;
2326
+ return criteria;
2327
+ },
2328
+ showClear() {
2329
+ const nfPopupLazySelect = closest(this, "nf-popup-lazy-select");
2330
+ const keywords = this.selectedLabel || this.query;
2331
+ if (nfPopupLazySelect && !nfPopupLazySelect.assignmentOnSelect && keywords) {
2332
+ return true;
2333
+ }
2334
+ return false;
2335
+ },
2336
+ debounce() {
2337
+ return this.remote ? 300 : 0;
2338
+ },
2339
+ emptyText() {
2340
+ if (this.loading) {
2341
+ return this.loadingText || this.t("el.select.loading");
2342
+ } else {
2343
+ if (this.remote && this.query === "" && this.options.length === 0)
2344
+ return false;
2345
+ if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
2346
+ return this.noMatchText || this.t("el.select.noMatch");
2347
+ }
2348
+ if (this.options.length === 0) {
2349
+ return this.noDataText || this.t("el.select.noData");
2350
+ }
2351
+ }
2352
+ return null;
2353
+ },
2354
+ showNewOption() {
2355
+ let hasExistingOption = this.options.filter((option) => !option.created).some((option) => option.currentLabel === this.query);
2356
+ return this.filterable && this.allowCreate && this.query !== "" && !hasExistingOption;
2357
+ },
2358
+ selectSize() {
2359
+ return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
2360
+ },
2361
+ selectDisabled() {
2362
+ return this.disabled || (this.elForm || {}).disabled;
2363
+ },
2364
+ collapseTagSize() {
2365
+ return ["small", "mini"].indexOf(this.selectSize) > -1 ? "mini" : "small";
2366
+ }
2367
+ },
2368
+ components: {
2369
+ SelectMenu
2370
+ },
2371
+ props: {
2372
+ name: String,
2373
+ id: String,
2374
+ value: {
2375
+ required: true
2376
+ },
2377
+ autocomplete: {
2378
+ type: String,
2379
+ default: "off"
2380
+ },
2381
+ /** @Deprecated in next major version */
2382
+ autoComplete: {
2383
+ type: String,
2384
+ validator(val) {
2385
+ process.env.NODE_ENV !== "production" && console.warn("[Element Warn][Select]'auto-complete' property will be deprecated in next major version. please use 'autocomplete' instead.");
2386
+ return true;
2387
+ }
2388
+ },
2389
+ automaticDropdown: Boolean,
2390
+ size: String,
2391
+ disabled: Boolean,
2392
+ clearable: Boolean,
2393
+ filterable: Boolean,
2394
+ allowCreate: Boolean,
2395
+ loading: Boolean,
2396
+ popperClass: String,
2397
+ remote: Boolean,
2398
+ loadingText: String,
2399
+ noMatchText: String,
2400
+ noDataText: String,
2401
+ remoteMethod: Function,
2402
+ filterMethod: Function,
2403
+ multiple: Boolean,
2404
+ multipleLimit: {
2405
+ type: Number,
2406
+ default: 0
2407
+ },
2408
+ placeholder: {
2409
+ type: String,
2410
+ default() {
2411
+ return t("el.select.placeholder");
2412
+ }
2413
+ },
2414
+ defaultFirstOption: Boolean,
2415
+ reserveKeyword: Boolean,
2416
+ valueKey: {
2417
+ type: String,
2418
+ default: "value"
2419
+ },
2420
+ collapseTags: Boolean,
2421
+ popperAppendToBody: {
2422
+ type: Boolean,
2423
+ default: true
2424
+ }
2425
+ },
2426
+ data() {
2427
+ return {
2428
+ options: [],
2429
+ cachedOptions: [],
2430
+ createdLabel: null,
2431
+ createdSelected: false,
2432
+ selected: this.multiple ? [] : {},
2433
+ inputLength: 20,
2434
+ inputWidth: 0,
2435
+ initialInputHeight: 0,
2436
+ cachedPlaceHolder: "",
2437
+ optionsCount: 0,
2438
+ filteredOptionsCount: 0,
2439
+ visible: false,
2440
+ softFocus: false,
2441
+ selectedLabel: "",
2442
+ hoverIndex: -1,
2443
+ query: "",
2444
+ previousQuery: null,
2445
+ inputHovering: false,
2446
+ currentPlaceholder: "",
2447
+ isOnComposition: false,
2448
+ isSilentBlur: false
2449
+ };
2450
+ },
2451
+ watch: {
2452
+ selectDisabled() {
2453
+ this.$nextTick(() => {
2454
+ this.resetInputHeight();
2455
+ });
2456
+ },
2457
+ placeholder(val) {
2458
+ this.cachedPlaceHolder = this.currentPlaceholder = val;
2459
+ },
2460
+ value(val, oldVal) {
2461
+ if (this.multiple) {
2462
+ this.resetInputHeight();
2463
+ if (val && val.length > 0 || this.$refs.input && this.query !== "") {
2464
+ this.currentPlaceholder = "";
2465
+ } else {
2466
+ this.currentPlaceholder = this.cachedPlaceHolder;
2467
+ }
2468
+ if (this.filterable && !this.reserveKeyword) {
2469
+ this.query = "";
2470
+ this.handleQueryChange(this.query);
2471
+ }
2472
+ }
2473
+ this.setSelected();
2474
+ if (this.filterable && !this.multiple) {
2475
+ this.inputLength = 20;
2476
+ }
2477
+ if (!valueEquals(val, oldVal)) {
2478
+ this.dispatch("ElFormItem", "el.form.change", val);
2479
+ }
2480
+ },
2481
+ visible(val) {
2482
+ if (!val) {
2483
+ this.broadcast("ElSelectDropdown", "destroyPopper");
2484
+ if (this.$refs.input) {
2485
+ this.$refs.input.blur();
2486
+ }
2487
+ this.query = "";
2488
+ this.previousQuery = null;
2489
+ this.selectedLabel = "";
2490
+ this.inputLength = 20;
2491
+ this.resetHoverIndex();
2492
+ this.$nextTick(() => {
2493
+ if (this.$refs.input && this.$refs.input.value === "" && this.selected.length === 0) {
2494
+ this.currentPlaceholder = this.cachedPlaceHolder;
2495
+ }
2496
+ });
2497
+ if (!this.multiple) {
2498
+ if (this.selected) {
2499
+ if (this.filterable && this.allowCreate && this.createdSelected && this.createdLabel) {
2500
+ this.selectedLabel = this.createdLabel;
2501
+ } else {
2502
+ this.selectedLabel = this.selected.currentLabel;
2503
+ }
2504
+ if (this.filterable)
2505
+ this.query = this.selectedLabel;
2506
+ }
2507
+ if (this.filterable) {
2508
+ this.currentPlaceholder = this.cachedPlaceHolder;
2509
+ }
2510
+ }
2511
+ } else {
2512
+ this.broadcast("ElSelectDropdown", "updatePopper");
2513
+ if (this.filterable) {
2514
+ this.query = this.remote ? "" : this.selectedLabel;
2515
+ this.handleQueryChange(this.query);
2516
+ if (this.multiple) {
2517
+ this.$refs.input.focus();
2518
+ } else {
2519
+ if (!this.remote) {
2520
+ this.broadcast("ElOption", "queryChange", "");
2521
+ this.broadcast("ElOptionGroup", "queryChange");
2522
+ }
2523
+ if (this.selectedLabel) {
2524
+ this.currentPlaceholder = this.selectedLabel;
2525
+ this.selectedLabel = "";
2526
+ }
2527
+ }
2528
+ }
2529
+ }
2530
+ this.$emit("visible-change", val);
2531
+ },
2532
+ options() {
2533
+ if (this.$isServer)
2534
+ return;
2535
+ this.$nextTick(() => {
2536
+ this.broadcast("ElSelectDropdown", "updatePopper");
2537
+ });
2538
+ if (this.multiple) {
2539
+ this.resetInputHeight();
2540
+ }
2541
+ let inputs = this.$el.querySelectorAll("input");
2542
+ if ([].indexOf.call(inputs, document.activeElement) === -1) {
2543
+ if (!this.multiple) {
2544
+ const nfPopupLazySelect = closest(this, "nf-popup-lazy-select");
2545
+ if (nfPopupLazySelect) {
2546
+ return;
2547
+ }
2548
+ }
2549
+ this.setSelected();
2550
+ }
2551
+ if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
2552
+ this.checkDefaultFirstOption();
2553
+ }
2554
+ }
2555
+ },
2556
+ methods: {
2557
+ handleComposition(event) {
2558
+ const text = event.target.value;
2559
+ if (event.type === "compositionend") {
2560
+ this.isOnComposition = false;
2561
+ this.$nextTick((_) => this.handleQueryChange(text));
2562
+ } else {
2563
+ const lastCharacter = text[text.length - 1] || "";
2564
+ this.isOnComposition = !isKorean(lastCharacter);
2565
+ }
2566
+ },
2567
+ handleQueryChange(val) {
2568
+ if (this.previousQuery === val || this.isOnComposition)
2569
+ return;
2570
+ if (this.previousQuery === null && (typeof this.filterMethod === "function" || typeof this.remoteMethod === "function")) {
2571
+ this.previousQuery = val;
2572
+ return;
2573
+ }
2574
+ this.previousQuery = val;
2575
+ this.$nextTick(() => {
2576
+ if (this.visible)
2577
+ this.broadcast("ElSelectDropdown", "updatePopper");
2578
+ });
2579
+ this.hoverIndex = -1;
2580
+ if (this.multiple && this.filterable) {
2581
+ this.$nextTick(() => {
2582
+ const length = this.$refs.input.value.length * 15 + 20;
2583
+ this.inputLength = this.collapseTags ? Math.min(50, length) : length;
2584
+ this.managePlaceholder();
2585
+ this.resetInputHeight();
2586
+ });
2587
+ }
2588
+ if (this.remote && typeof this.remoteMethod === "function") {
2589
+ this.hoverIndex = -1;
2590
+ this.remoteMethod(val);
2591
+ } else if (typeof this.filterMethod === "function") {
2592
+ this.filterMethod(val);
2593
+ this.broadcast("ElOptionGroup", "queryChange");
2594
+ } else {
2595
+ this.filteredOptionsCount = this.optionsCount;
2596
+ this.broadcast("ElOption", "queryChange", val);
2597
+ this.broadcast("ElOptionGroup", "queryChange");
2598
+ }
2599
+ if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
2600
+ this.checkDefaultFirstOption();
2601
+ }
2602
+ },
2603
+ scrollToOption(option) {
2604
+ const target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
2605
+ if (this.$refs.popper && target) {
2606
+ const menu = this.$refs.popper.$el.querySelector(".el-select-dropdown__wrap");
2607
+ scrollIntoView(menu, target);
2608
+ }
2609
+ this.$refs.scrollbar && this.$refs.scrollbar.handleScroll();
2610
+ },
2611
+ handleMenuEnter() {
2612
+ this.$nextTick(() => this.scrollToOption(this.selected));
2613
+ },
2614
+ emitChange(val) {
2615
+ if (!valueEquals(this.value, val)) {
2616
+ this.$emit("change", val);
2617
+ }
2618
+ },
2619
+ getOption(value) {
2620
+ let option;
2621
+ const isObject = Object.prototype.toString.call(value).toLowerCase() === "[object object]";
2622
+ const isNull = Object.prototype.toString.call(value).toLowerCase() === "[object null]";
2623
+ const isUndefined = Object.prototype.toString.call(value).toLowerCase() === "[object undefined]";
2624
+ for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
2625
+ const cachedOption = this.cachedOptions[i];
2626
+ const isEqual = isObject ? getValueByPath(cachedOption.value, this.valueKey) === getValueByPath(value, this.valueKey) : cachedOption.value === value;
2627
+ if (isEqual) {
2628
+ option = cachedOption;
2629
+ break;
2630
+ }
2631
+ }
2632
+ if (option)
2633
+ return option;
2634
+ const label = !isObject && !isNull && !isUndefined ? value : "";
2635
+ let newOption = {
2636
+ value,
2637
+ currentLabel: label
2638
+ };
2639
+ if (this.multiple) {
2640
+ newOption.hitState = false;
2641
+ }
2642
+ return newOption;
2643
+ },
2644
+ setSelected() {
2645
+ if (!this.multiple) {
2646
+ let option = this.getOption(this.value);
2647
+ if (option.created) {
2648
+ this.createdLabel = option.currentLabel;
2649
+ this.createdSelected = true;
2650
+ } else {
2651
+ this.createdSelected = false;
2652
+ }
2653
+ this.selectedLabel = option.currentLabel;
2654
+ this.selected = option;
2655
+ if (this.filterable)
2656
+ this.query = this.selectedLabel;
2657
+ return;
2658
+ }
2659
+ let result = [];
2660
+ if (Array.isArray(this.value)) {
2661
+ this.value.forEach((value) => {
2662
+ result.push(this.getOption(value));
2663
+ });
2664
+ }
2665
+ this.selected = result;
2666
+ this.$nextTick(() => {
2667
+ this.resetInputHeight();
2668
+ });
2669
+ },
2670
+ handleFocus(event) {
2671
+ if (!this.softFocus) {
2672
+ this.$emit("focus", event);
2673
+ } else {
2674
+ this.softFocus = false;
2675
+ }
2676
+ },
2677
+ blur() {
2678
+ this.$refs.reference.blur();
2679
+ },
2680
+ handleBlur(event) {
2681
+ setTimeout(() => {
2682
+ if (this.isSilentBlur) {
2683
+ this.isSilentBlur = false;
2684
+ } else {
2685
+ this.$emit("blur", event);
2686
+ }
2687
+ }, 50);
2688
+ this.softFocus = false;
2689
+ },
2690
+ handleClearClick(event) {
2691
+ this.deleteSelected(event);
2692
+ this.currentPlaceholder = this.cachedPlaceHolder = this.placeholder;
2693
+ },
2694
+ handleClearKeywordClick(event) {
2695
+ event.stopPropagation();
2696
+ this.selectedLabel = "";
2697
+ this.query = "";
2698
+ this.previousQuery = "";
2699
+ if (typeof this.filterMethod === "function") {
2700
+ this.filterMethod("");
2701
+ this.broadcast("ElOptionGroup", "queryChange");
2702
+ }
2703
+ },
2704
+ doDestroy() {
2705
+ this.$refs.popper && this.$refs.popper.doDestroy();
2706
+ },
2707
+ toggleLastOptionHitState(hit) {
2708
+ if (!Array.isArray(this.selected))
2709
+ return;
2710
+ const option = this.selected[this.selected.length - 1];
2711
+ if (!option)
2712
+ return;
2713
+ if (hit === true || hit === false) {
2714
+ option.hitState = hit;
2715
+ return hit;
2716
+ }
2717
+ option.hitState = !option.hitState;
2718
+ return option.hitState;
2719
+ },
2720
+ deletePrevTag(e) {
2721
+ if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
2722
+ const value = this.value.slice();
2723
+ value.pop();
2724
+ this.$emit("input", value);
2725
+ this.emitChange(value);
2726
+ }
2727
+ },
2728
+ managePlaceholder() {
2729
+ if (this.currentPlaceholder !== "") {
2730
+ this.currentPlaceholder = this.$refs.input.value ? "" : this.cachedPlaceHolder;
2731
+ }
2732
+ },
2733
+ resetInputState(e) {
2734
+ if (e.keyCode !== 8)
2735
+ this.toggleLastOptionHitState(false);
2736
+ this.inputLength = this.$refs.input.value.length * 15 + 20;
2737
+ this.resetInputHeight();
2738
+ },
2739
+ resetInputHeight() {
2740
+ if (this.collapseTags && !this.filterable)
2741
+ return;
2742
+ this.$nextTick(() => {
2743
+ if (!this.$refs.reference)
2744
+ return;
2745
+ let inputChildNodes = this.$refs.reference.$el.childNodes;
2746
+ let input = [].filter.call(inputChildNodes, (item) => item.tagName === "INPUT")[0];
2747
+ const tags = this.$refs.tags;
2748
+ const sizeInMap = this.initialInputHeight || 40;
2749
+ input.style.height = this.selected.length === 0 ? sizeInMap + "px" : Math.max(tags ? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap) + "px";
2750
+ if (this.visible && this.emptyText !== false) {
2751
+ this.broadcast("ElSelectDropdown", "updatePopper");
2752
+ }
2753
+ });
2754
+ },
2755
+ resetHoverIndex() {
2756
+ setTimeout(() => {
2757
+ if (!this.multiple) {
2758
+ this.hoverIndex = this.options.indexOf(this.selected);
2759
+ } else {
2760
+ if (this.selected.length > 0) {
2761
+ this.hoverIndex = Math.min.apply(null, this.selected.map((item) => this.options.indexOf(item)));
2762
+ } else {
2763
+ this.hoverIndex = -1;
2764
+ }
2765
+ }
2766
+ }, 300);
2767
+ },
2768
+ handleOptionSelect(option, byClick) {
2769
+ const nfPopupLazySelect = closest(this, "nf-popup-lazy-select");
2770
+ if (this.multiple) {
2771
+ const value = (this.value || []).slice();
2772
+ const optionIndex = this.getValueIndex(value, option.value);
2773
+ if (optionIndex > -1) {
2774
+ value.splice(optionIndex, 1);
2775
+ } else if (this.multipleLimit <= 0 || value.length < this.multipleLimit) {
2776
+ value.push(option.value);
2777
+ }
2778
+ this.$emit("input", value);
2779
+ this.emitChange(value);
2780
+ if (option.created) {
2781
+ this.query = "";
2782
+ this.handleQueryChange("");
2783
+ this.inputLength = 20;
2784
+ }
2785
+ if (this.filterable)
2786
+ this.$refs.input.focus();
2787
+ } else {
2788
+ if (nfPopupLazySelect == null ? void 0 : nfPopupLazySelect.assignmentOnSelect) {
2789
+ this.$emit("input", option.value);
2790
+ this.emitChange(option.value);
2791
+ }
2792
+ this.$emit("select-item", option.value);
2793
+ }
2794
+ this.isSilentBlur = byClick;
2795
+ this.setSoftFocus();
2796
+ if (this.visible)
2797
+ return;
2798
+ this.$nextTick(() => {
2799
+ this.scrollToOption(option);
2800
+ });
2801
+ },
2802
+ setSoftFocus() {
2803
+ this.softFocus = true;
2804
+ const input = this.$refs.input || this.$refs.reference;
2805
+ if (input) {
2806
+ input.focus();
2807
+ }
2808
+ },
2809
+ getValueIndex(arr = [], value) {
2810
+ const isObject = Object.prototype.toString.call(value).toLowerCase() === "[object object]";
2811
+ if (!isObject) {
2812
+ return arr.indexOf(value);
2813
+ } else {
2814
+ const valueKey = this.valueKey;
2815
+ let index = -1;
2816
+ arr.some((item, i) => {
2817
+ if (getValueByPath(item, valueKey) === getValueByPath(value, valueKey)) {
2818
+ index = i;
2819
+ return true;
2820
+ }
2821
+ return false;
2822
+ });
2823
+ return index;
2824
+ }
2825
+ },
2826
+ toggleMenu() {
2827
+ var _a;
2828
+ if (!this.selectDisabled) {
2829
+ this.visible = !this.visible;
2830
+ if (this.visible) {
2831
+ (_a = this.$refs.input || this.$refs.reference) == null ? void 0 : _a.focus();
2832
+ }
2833
+ }
2834
+ },
2835
+ selectOption() {
2836
+ if (this.options[this.hoverIndex]) {
2837
+ this.handleOptionSelect(this.options[this.hoverIndex]);
2838
+ }
2839
+ },
2840
+ deleteSelected(event) {
2841
+ event.stopPropagation();
2842
+ const value = this.multiple ? [] : "";
2843
+ this.$emit("input", value);
2844
+ this.emitChange(value);
2845
+ this.$emit("clear");
2846
+ },
2847
+ deleteTag(event, tag) {
2848
+ let index = this.selected.indexOf(tag);
2849
+ if (index > -1 && !this.selectDisabled) {
2850
+ const value = this.value.slice();
2851
+ value.splice(index, 1);
2852
+ this.$emit("input", value);
2853
+ this.emitChange(value);
2854
+ this.$emit("remove-tag", tag.value);
2855
+ }
2856
+ event.stopPropagation();
2857
+ },
2858
+ onInputChange() {
2859
+ if (this.filterable && this.query !== this.selectedLabel) {
2860
+ this.query = this.selectedLabel;
2861
+ this.handleQueryChange(this.query);
2862
+ }
2863
+ },
2864
+ onOptionDestroy(index) {
2865
+ if (index > -1) {
2866
+ this.optionsCount--;
2867
+ this.filteredOptionsCount--;
2868
+ this.options.splice(index, 1);
2869
+ }
2870
+ },
2871
+ resetInputWidth() {
2872
+ this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
2873
+ },
2874
+ handleResize() {
2875
+ this.resetInputWidth();
2876
+ if (this.multiple)
2877
+ this.resetInputHeight();
2878
+ },
2879
+ checkDefaultFirstOption() {
2880
+ this.hoverIndex = -1;
2881
+ let hasCreated = false;
2882
+ for (let i = this.options.length - 1; i >= 0; i--) {
2883
+ if (this.options[i].created) {
2884
+ hasCreated = true;
2885
+ this.hoverIndex = i;
2886
+ break;
2887
+ }
2888
+ }
2889
+ if (hasCreated)
2890
+ return;
2891
+ for (let i = 0; i !== this.options.length; ++i) {
2892
+ const option = this.options[i];
2893
+ if (this.query) {
2894
+ if (!option.disabled && !option.groupDisabled && option.visible) {
2895
+ this.hoverIndex = i;
2896
+ break;
2897
+ }
2898
+ } else {
2899
+ if (option.itemSelected) {
2900
+ this.hoverIndex = i;
2901
+ break;
2902
+ }
2903
+ }
2904
+ }
2905
+ },
2906
+ getValueKey(item) {
2907
+ if (Object.prototype.toString.call(item.value).toLowerCase() !== "[object object]") {
2908
+ return item.value;
2909
+ } else {
2910
+ return getValueByPath(item.value, this.valueKey);
2911
+ }
2912
+ }
2913
+ },
2914
+ created() {
2915
+ this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder;
2916
+ if (this.multiple && !Array.isArray(this.value)) {
2917
+ this.$emit("input", []);
2918
+ }
2919
+ if (!this.multiple && Array.isArray(this.value)) {
2920
+ this.$emit("input", "");
2921
+ }
2922
+ this.debouncedOnInputChange = debounce$1(this.debounce, () => {
2923
+ this.onInputChange();
2924
+ });
2925
+ this.debouncedQueryChange = debounce$1(this.debounce, (e) => {
2926
+ this.handleQueryChange(e.target.value);
2927
+ });
2928
+ this.$on("handleOptionClick", this.handleOptionSelect);
2929
+ this.$on("setSelected", this.setSelected);
2930
+ },
2931
+ mounted() {
2932
+ if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
2933
+ this.currentPlaceholder = "";
2934
+ }
2935
+ addResizeListener(this.$el, this.handleResize);
2936
+ const reference = this.$refs.reference;
2937
+ if (reference && reference.$el) {
2938
+ const sizeMap = {
2939
+ medium: 36,
2940
+ small: 32,
2941
+ mini: 28
2942
+ };
2943
+ const input = reference.$el.querySelector("input");
2944
+ this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
2945
+ }
2946
+ if (this.remote && this.multiple) {
2947
+ this.resetInputHeight();
2948
+ }
2949
+ this.$nextTick(() => {
2950
+ if (reference && reference.$el) {
2951
+ this.inputWidth = reference.$el.getBoundingClientRect().width;
2952
+ }
2953
+ });
2954
+ this.setSelected();
2955
+ },
2956
+ beforeDestroy() {
2957
+ if (this.$el && this.handleResize)
2958
+ removeResizeListener(this.$el, this.handleResize);
2959
+ }
2960
+ };
2961
+ var _sfc_render = function render3() {
2962
+ var _vm = this, _c = _vm._self._c;
2963
+ return _c("div", {
2964
+ staticClass: "el-select",
2965
+ class: [_vm.selectSize ? "el-select--" + _vm.selectSize : ""]
2966
+ }, [_vm.multiple ? _c("div", {
2967
+ ref: "tags",
2968
+ staticClass: "el-select__tags",
2969
+ style: {
2970
+ "max-width": _vm.inputWidth - 32 + "px",
2971
+ width: "100%"
2972
+ }
2973
+ }, [_vm.collapseTags && _vm.selected.length ? _c("span", [_c("el-tag", {
2974
+ attrs: {
2975
+ "closable": !_vm.selectDisabled,
2976
+ "size": _vm.collapseTagSize,
2977
+ "hit": _vm.selected[0].hitState,
2978
+ "type": "info",
2979
+ "disable-transitions": ""
2980
+ },
2981
+ on: {
2982
+ "close": function($event) {
2983
+ return _vm.deleteTag($event, _vm.selected[0]);
2984
+ }
2985
+ }
2986
+ }, [_c("span", {
2987
+ staticClass: "el-select__tags-text"
2988
+ }, [_vm._v(_vm._s(_vm.selected[0].currentLabel))])]), _vm.selected.length > 1 ? _c("el-tag", {
2989
+ attrs: {
2990
+ "closable": false,
2991
+ "size": _vm.collapseTagSize,
2992
+ "type": "info",
2993
+ "disable-transitions": ""
2994
+ }
2995
+ }, [_c("span", {
2996
+ staticClass: "el-select__tags-text"
2997
+ }, [_vm._v("+ " + _vm._s(_vm.selected.length - 1))])]) : _vm._e()], 1) : _vm._e(), !_vm.collapseTags ? _c("transition-group", {
2998
+ on: {
2999
+ "after-leave": _vm.resetInputHeight
3000
+ }
3001
+ }, _vm._l(_vm.selected, function(item) {
3002
+ return _c("el-tag", {
3003
+ key: _vm.getValueKey(item),
3004
+ attrs: {
3005
+ "closable": !_vm.selectDisabled,
3006
+ "size": _vm.collapseTagSize,
3007
+ "hit": item.hitState,
3008
+ "type": "info",
3009
+ "disable-transitions": ""
3010
+ },
3011
+ on: {
3012
+ "close": function($event) {
3013
+ return _vm.deleteTag($event, item);
3014
+ }
3015
+ }
3016
+ }, [_c("span", {
3017
+ staticClass: "el-select__tags-text"
3018
+ }, [_vm._v(_vm._s(item.currentLabel))])]);
3019
+ }), 1) : _vm._e(), _vm.filterable ? _c("input", {
3020
+ directives: [{
3021
+ name: "model",
3022
+ rawName: "v-model",
3023
+ value: _vm.query,
3024
+ expression: "query"
3025
+ }],
3026
+ ref: "input",
3027
+ staticClass: "el-select__input",
3028
+ class: [_vm.selectSize ? `is-${_vm.selectSize}` : ""],
3029
+ style: {
3030
+ "flex-grow": "1",
3031
+ width: _vm.inputLength / (_vm.inputWidth - 32) + "%",
3032
+ "max-width": _vm.inputWidth - 42 + "px"
3033
+ },
3034
+ attrs: {
3035
+ "type": "text",
3036
+ "disabled": _vm.selectDisabled,
3037
+ "autocomplete": _vm.autoComplete || _vm.autocomplete
3038
+ },
3039
+ domProps: {
3040
+ "value": _vm.query
3041
+ },
3042
+ on: {
3043
+ "focus": _vm.handleFocus,
3044
+ "blur": function($event) {
3045
+ _vm.softFocus = false;
3046
+ },
3047
+ "keyup": _vm.managePlaceholder,
3048
+ "keydown": [_vm.resetInputState, function($event) {
3049
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "down", 40, $event.key, ["Down", "ArrowDown"]))
3050
+ return null;
3051
+ $event.preventDefault();
3052
+ return _vm.navigateOptions("next");
3053
+ }, function($event) {
3054
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"]))
3055
+ return null;
3056
+ $event.preventDefault();
3057
+ return _vm.navigateOptions("prev");
3058
+ }, function($event) {
3059
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter"))
3060
+ return null;
3061
+ $event.preventDefault();
3062
+ return _vm.selectOption.apply(null, arguments);
3063
+ }, function($event) {
3064
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "delete", [8, 46], $event.key, ["Backspace", "Delete", "Del"]))
3065
+ return null;
3066
+ return _vm.deletePrevTag.apply(null, arguments);
3067
+ }],
3068
+ "compositionstart": _vm.handleComposition,
3069
+ "compositionupdate": _vm.handleComposition,
3070
+ "compositionend": _vm.handleComposition,
3071
+ "input": [function($event) {
3072
+ if ($event.target.composing)
3073
+ return;
3074
+ _vm.query = $event.target.value;
3075
+ }, _vm.debouncedQueryChange]
3076
+ }
3077
+ }) : _vm._e()], 1) : _vm._e(), _c("el-input", {
3078
+ ref: "reference",
3079
+ class: {
3080
+ "is-focus": _vm.visible
3081
+ },
3082
+ attrs: {
3083
+ "type": "text",
3084
+ "placeholder": _vm.currentPlaceholder,
3085
+ "name": _vm.name,
3086
+ "id": _vm.id,
3087
+ "autocomplete": _vm.autoComplete || _vm.autocomplete,
3088
+ "size": _vm.selectSize,
3089
+ "disabled": _vm.selectDisabled,
3090
+ "readonly": _vm.readonly,
3091
+ "validate-event": false,
3092
+ "tabindex": _vm.multiple && _vm.filterable ? "-1" : null
3093
+ },
3094
+ on: {
3095
+ "focus": _vm.handleFocus,
3096
+ "blur": _vm.handleBlur
3097
+ },
3098
+ nativeOn: {
3099
+ "keyup": function($event) {
3100
+ return _vm.debouncedOnInputChange.apply(null, arguments);
3101
+ },
3102
+ "keydown": [function($event) {
3103
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "down", 40, $event.key, ["Down", "ArrowDown"]))
3104
+ return null;
3105
+ $event.stopPropagation();
3106
+ $event.preventDefault();
3107
+ return _vm.navigateOptions("next");
3108
+ }, function($event) {
3109
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"]))
3110
+ return null;
3111
+ $event.stopPropagation();
3112
+ $event.preventDefault();
3113
+ return _vm.navigateOptions("prev");
3114
+ }, function($event) {
3115
+ if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter"))
3116
+ return null;
3117
+ $event.preventDefault();
3118
+ return _vm.selectOption.apply(null, arguments);
3119
+ }],
3120
+ "paste": function($event) {
3121
+ return _vm.debouncedOnInputChange.apply(null, arguments);
3122
+ },
3123
+ "mouseenter": function($event) {
3124
+ _vm.inputHovering = true;
3125
+ },
3126
+ "mouseleave": function($event) {
3127
+ _vm.inputHovering = false;
3128
+ }
3129
+ },
3130
+ model: {
3131
+ value: _vm.selectedLabel,
3132
+ callback: function($$v) {
3133
+ _vm.selectedLabel = $$v;
3134
+ },
3135
+ expression: "selectedLabel"
3136
+ }
3137
+ }, [_vm.$slots.prefix ? _c("template", {
3138
+ slot: "prefix"
3139
+ }, [_vm._t("prefix")], 2) : _vm._e(), _c("template", {
3140
+ slot: "suffix"
3141
+ }, [_vm.showClose ? _c("i", {
3142
+ staticClass: "el-select__caret el-input__icon el-icon-circle-close",
3143
+ on: {
3144
+ "click": _vm.handleClearClick
3145
+ }
3146
+ }) : _vm._e(), _vm.showClear ? _c("i", {
3147
+ staticClass: "el-select__caret el-input__icon el-icon-circle-close",
3148
+ on: {
3149
+ "click": _vm.handleClearKeywordClick
3150
+ }
3151
+ }) : _vm._e()])], 2), _c("transition", {
3152
+ attrs: {
3153
+ "name": "el-zoom-in-top"
3154
+ },
3155
+ on: {
3156
+ "before-enter": _vm.handleMenuEnter,
3157
+ "after-leave": _vm.doDestroy
3158
+ }
3159
+ }, [_c("select-menu", {
3160
+ directives: [{
3161
+ name: "show",
3162
+ rawName: "v-show",
3163
+ value: _vm.emptyText !== false,
3164
+ expression: "emptyText !== false"
3165
+ }],
3166
+ ref: "popper",
3167
+ attrs: {
3168
+ "append-to-body": _vm.popperAppendToBody
3169
+ }
3170
+ }, [_c("el-scrollbar", {
3171
+ directives: [{
3172
+ name: "show",
3173
+ rawName: "v-show",
3174
+ value: _vm.options.length > 0 && !_vm.loading,
3175
+ expression: "options.length > 0 && !loading"
3176
+ }],
3177
+ ref: "scrollbar",
3178
+ class: {
3179
+ "is-empty": !_vm.allowCreate && _vm.query && _vm.filteredOptionsCount === 0
3180
+ },
3181
+ attrs: {
3182
+ "tag": "ul",
3183
+ "wrap-class": "el-select-dropdown__wrap",
3184
+ "view-class": "el-select-dropdown__list"
3185
+ }
3186
+ }, [_vm.showNewOption ? _c("el-option", {
3187
+ attrs: {
3188
+ "value": _vm.query,
3189
+ "created": ""
3190
+ }
3191
+ }) : _vm._e(), _vm._t("default")], 2), _vm.emptyText && (!_vm.allowCreate || _vm.loading || _vm.allowCreate && _vm.options.length === 0) ? [_vm.$slots.empty ? _vm._t("empty") : _c("p", {
3192
+ staticClass: "el-select-dropdown__empty"
3193
+ }, [_vm._v(" " + _vm._s(_vm.emptyText) + " ")])] : _vm._e()], 2)], 1)], 1);
3194
+ };
644
3195
  var _sfc_staticRenderFns = [];
645
- var __component__ = /* @__PURE__ */ normalizeComponent(__sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
646
- const NfPopupLazySelect = __component__.exports;
3196
+ var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
3197
+ const CustomSelectDropdown = __component__.exports;
647
3198
  NfPopupLazySelect.install = (app) => {
648
3199
  app.component("nf-popup-lazy-select", NfPopupLazySelect);
3200
+ app.component("custom-select-dropdown", CustomSelectDropdown);
649
3201
  };
650
3202
  export {
651
3203
  NfPopupLazySelect as default