bkui-vue 1.0.3-beta.9 → 2.0.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +71 -73
- package/dist/index.esm.js +21328 -19060
- package/dist/index.umd.js +71 -73
- package/dist/locale/en.esm.js +1 -1
- package/dist/locale/en.esm.js.map +1 -1
- package/dist/locale/en.umd.js +1 -1
- package/dist/locale/en.umd.js.map +1 -1
- package/dist/locale/zh-cn.esm.js +1 -1
- package/dist/locale/zh-cn.esm.js.map +1 -1
- package/dist/locale/zh-cn.umd.js +1 -1
- package/dist/locale/zh-cn.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/affix/affix.variable.css +3 -0
- package/lib/alert/alert.variable.css +3 -0
- package/lib/backtop/backtop.variable.css +3 -0
- package/lib/badge/badge.variable.css +3 -0
- package/lib/breadcrumb/breadcrumb.variable.css +3 -0
- package/lib/button/button.variable.css +3 -0
- package/lib/card/card.variable.css +3 -0
- package/lib/cascader/cascader.variable.css +3 -0
- package/lib/checkbox/checkbox.variable.css +3 -0
- package/lib/checkbox/index.js +4 -4
- package/lib/code-diff/code-diff.variable.css +3 -0
- package/lib/collapse/collapse.css +11 -0
- package/lib/collapse/collapse.d.ts +11 -0
- package/lib/collapse/collapse.less +15 -1
- package/lib/collapse/collapse.variable.css +14 -0
- package/lib/collapse/index.d.ts +23 -0
- package/lib/collapse/index.js +9 -1
- package/lib/collapse/props.d.ts +8 -0
- package/lib/collapse-transition/collapse-transition.variable.css +3 -0
- package/lib/color-picker/color-picker.variable.css +3 -0
- package/lib/components.d.ts +2 -0
- package/lib/components.js +3 -1
- package/lib/config-provider/config-provider.d.ts +3 -0
- package/lib/config-provider/config-provider.variable.css +3 -0
- package/lib/config-provider/index.d.ts +4 -0
- package/lib/config-provider/token.d.ts +1 -0
- package/lib/container/container.variable.css +3 -0
- package/lib/date-picker/base/month-table.d.ts +2 -2
- package/lib/date-picker/date-picker.d.ts +1 -0
- package/lib/date-picker/date-picker.variable.css +3 -0
- package/lib/date-picker/index.d.ts +3 -0
- package/lib/date-picker/index.js +70 -32
- package/lib/date-picker/interface.d.ts +1 -1
- package/lib/date-picker/time-picker.d.ts +1 -0
- package/lib/date-picker/utils.d.ts +4 -0
- package/lib/dialog/dialog.css +176 -150
- package/lib/dialog/dialog.d.ts +40 -109
- package/lib/dialog/dialog.less +51 -124
- package/lib/dialog/dialog.variable.css +179 -150
- package/lib/dialog/index.d.ts +99 -263
- package/lib/dialog/index.js +244 -246
- package/lib/dialog/props.d.ts +10 -35
- package/lib/directives/index.js +0 -1
- package/lib/divider/divider.variable.css +3 -0
- package/lib/dropdown/dropdown.css +3 -1
- package/lib/dropdown/dropdown.variable.css +6 -1
- package/lib/exception/exception.variable.css +3 -0
- package/lib/fixed-navbar/fixed-navbar.variable.css +3 -0
- package/lib/form/form.variable.css +3 -0
- package/lib/form/index.js +3 -1
- package/lib/icon/image-fill.js +82 -167
- package/lib/icon/img-error.js +82 -167
- package/lib/icon/img-placehoulder.js +82 -167
- package/lib/icon/index.d.ts +1 -0
- package/lib/icon/index.js +87 -2427
- package/lib/icon/info-line.js +82 -167
- package/lib/icon/info.js +82 -167
- package/lib/icon/left-shape.js +82 -167
- package/lib/icon/left-turn-line.js +82 -167
- package/lib/icon/loading.js +82 -167
- package/lib/icon/narrow-line.js +82 -167
- package/lib/icon/original.js +82 -167
- package/lib/icon/pdf-fill.js +82 -167
- package/lib/icon/play-shape.js +82 -167
- package/lib/icon/plus.js +82 -167
- package/lib/icon/ppt-fill.js +82 -167
- package/lib/icon/qq.js +82 -167
- package/lib/icon/right-shape.js +82 -167
- package/lib/icon/right-turn-line.js +82 -167
- package/lib/icon/search.js +82 -167
- package/lib/icon/share.js +82 -167
- package/lib/icon/spinner.js +82 -167
- package/lib/icon/success.js +82 -167
- package/lib/icon/switcher-loading.js +82 -167
- package/lib/icon/text-all.d.ts +4 -0
- package/lib/icon/text-all.js +191 -0
- package/lib/icon/text-file.js +82 -167
- package/lib/icon/text-fill.js +82 -167
- package/lib/icon/transfer.js +82 -167
- package/lib/icon/tree-application-shape.js +82 -167
- package/lib/icon/unfull-screen.js +82 -167
- package/lib/icon/unvisible.js +82 -167
- package/lib/icon/up-shape.js +82 -167
- package/lib/icon/upload.js +82 -167
- package/lib/icon/video-fill.js +82 -167
- package/lib/icon/warn.js +82 -167
- package/lib/icon/weixin-pro.js +82 -167
- package/lib/icon/weixin.js +82 -167
- package/lib/image/image-viewer.variable.css +3 -0
- package/lib/image/image.variable.css +3 -0
- package/lib/image/index.js +5 -2
- package/lib/info-box/index.d.ts +2 -2
- package/lib/info-box/index.js +257 -516
- package/lib/info-box/info-box.css +58 -28
- package/lib/info-box/info-box.d.ts +18 -16
- package/lib/info-box/info-box.less +82 -51
- package/lib/info-box/info-box.variable.css +61 -28
- package/lib/info-box/render-component.d.ts +4 -0
- package/lib/input/index.js +7 -1
- package/lib/input/input.variable.css +3 -0
- package/lib/link/link.variable.css +3 -0
- package/lib/loading/loading.variable.css +3 -0
- package/lib/locale/index.js +4 -2
- package/lib/locale/lang/en.d.ts +1 -0
- package/lib/menu/menu.variable.css +3 -0
- package/lib/menu/submenu.variable.css +3 -0
- package/lib/message/message.variable.css +3 -0
- package/lib/modal/hooks.d.ts +6 -0
- package/lib/modal/index.d.ts +41 -309
- package/lib/modal/index.js +285 -671
- package/lib/modal/mask.d.ts +6 -0
- package/lib/modal/modal.css +155 -76
- package/lib/modal/modal.d.ts +18 -116
- package/lib/modal/modal.less +107 -55
- package/lib/modal/modal.variable.css +158 -76
- package/lib/modal/props.mixin.d.ts +5 -41
- package/lib/navigation/navigation.variable.css +3 -0
- package/lib/notify/notify.variable.css +3 -0
- package/lib/overflow-title/index.js +46 -52
- package/lib/pagination/index.js +2 -1
- package/lib/pagination/pagination.variable.css +3 -0
- package/lib/plugin-popover/index.d.ts +1 -1
- package/lib/plugin-popover/index.js +45 -26
- package/lib/pop-confirm/index.js +8 -5
- package/lib/pop-confirm/pop-confirm.variable.css +3 -0
- package/lib/popover/content.d.ts +1 -1
- package/lib/popover/index.js +45 -26
- package/lib/popover/plugin-popover.d.ts +4 -1
- package/lib/popover/popover.css +3 -1
- package/lib/popover/popover.less +4 -1
- package/lib/popover/popover.variable.css +6 -1
- package/lib/preset.d.ts +2 -0
- package/lib/process/process.variable.css +3 -0
- package/lib/progress/progress.variable.css +3 -0
- package/lib/radio/index.d.ts +29 -0
- package/lib/radio/index.js +39 -21
- package/lib/radio/radio-button.d.ts +10 -0
- package/lib/radio/radio-group.d.ts +10 -0
- package/lib/radio/radio.d.ts +10 -0
- package/lib/radio/radio.variable.css +3 -0
- package/lib/rate/rate.variable.css +3 -0
- package/lib/rate/star.variable.css +3 -0
- package/lib/resize-layout/index.js +1 -1
- package/lib/resize-layout/resize-layout.variable.css +3 -0
- package/lib/scrollbar/index.d.ts +15 -0
- package/lib/scrollbar/index.js +18763 -0
- package/lib/scrollbar/scrollbar-core/can-use-dom.d.ts +2 -0
- package/lib/scrollbar/scrollbar-core/helpers.d.ts +5 -0
- package/lib/scrollbar/scrollbar-core/index.d.ts +241 -0
- package/lib/scrollbar/scrollbar-core/mouse-wheel.d.ts +5 -0
- package/lib/scrollbar/scrollbar-core/scrollbar-width.d.ts +1 -0
- package/lib/scrollbar/scrollbar.css +75 -0
- package/lib/scrollbar/scrollbar.less +94 -0
- package/lib/scrollbar/scrollbar.variable.css +204 -0
- package/lib/search-select/index.d.ts +375 -16
- package/lib/search-select/index.js +701 -366
- package/lib/search-select/input.d.ts +14 -5
- package/lib/search-select/search-select.css +20 -6
- package/lib/search-select/search-select.d.ts +129 -7
- package/lib/search-select/search-select.less +16 -12
- package/lib/search-select/search-select.variable.css +23 -6
- package/lib/search-select/selected.d.ts +116 -6
- package/lib/search-select/utils.d.ts +19 -6
- package/lib/select/index.d.ts +124 -6
- package/lib/select/index.js +1336 -72
- package/lib/select/option.d.ts +3 -1
- package/lib/select/pinyin/core.d.ts +14 -0
- package/lib/select/pinyin/dict.d.ts +34 -0
- package/lib/select/pinyin/index.d.ts +2 -0
- package/lib/select/select.css +55 -12
- package/lib/select/select.d.ts +50 -2
- package/lib/select/select.less +69 -19
- package/lib/select/select.variable.css +58 -12
- package/lib/select/selectTagInput.d.ts +7 -0
- package/lib/select/type.d.ts +2 -3
- package/lib/shared/index.d.ts +0 -1
- package/lib/shared/index.js +70 -50
- package/lib/shared/utils.d.ts +12 -0
- package/lib/shared/vue-types.d.ts +5 -0
- package/lib/sideslider/index.d.ts +55 -185
- package/lib/sideslider/index.js +81 -55
- package/lib/sideslider/sideslider.css +26 -90
- package/lib/sideslider/sideslider.d.ts +25 -87
- package/lib/sideslider/sideslider.less +56 -132
- package/lib/sideslider/sideslider.variable.css +29 -90
- package/lib/slider/index.d.ts +19 -0
- package/lib/slider/index.js +45 -5
- package/lib/slider/slider.css +14 -0
- package/lib/slider/slider.d.ts +9 -0
- package/lib/slider/slider.less +15 -0
- package/lib/slider/slider.variable.css +17 -0
- package/lib/steps/steps.variable.css +3 -0
- package/lib/styles/mixins/animate.variable.css +3 -0
- package/lib/styles/mixins/popper.variable.css +3 -0
- package/lib/styles/mixins/scroll.variable.css +3 -0
- package/lib/styles/reset.css +1 -3
- package/lib/styles/reset.less +3 -6
- package/lib/styles/reset.variable.css +4 -3
- package/lib/styles/themes/themes.less +5 -0
- package/lib/swiper/swiper.variable.css +3 -0
- package/lib/switcher/switcher.variable.css +3 -0
- package/lib/tab/tab.variable.css +3 -0
- package/lib/table/cache.d.ts +11 -3
- package/lib/table/components/table-cell.d.ts +3 -2
- package/lib/table/components/table-column.d.ts +7 -17
- package/lib/table/const.d.ts +4 -4
- package/lib/table/index.d.ts +29 -64
- package/lib/table/index.js +18068 -613
- package/lib/table/plugins/head-filter.css +8 -4
- package/lib/table/plugins/head-filter.less +6 -3
- package/lib/table/plugins/head-filter.variable.css +11 -4
- package/lib/table/plugins/head-sort.variable.css +3 -0
- package/lib/table/plugins/settings.variable.css +3 -0
- package/lib/table/plugins/use-active-columns.d.ts +2 -2
- package/lib/table/plugins/use-column-template.d.ts +7 -0
- package/lib/table/plugins/use-draggable.d.ts +2 -2
- package/lib/table/plugins/use-fixed-column.d.ts +1 -1
- package/lib/table/plugins/use-observer-resize.d.ts +5 -0
- package/lib/table/plugins/use-pagination.d.ts +3 -1
- package/lib/table/plugins/use-shift-key.d.ts +11 -0
- package/lib/table/props.d.ts +17 -7
- package/lib/table/table.css +112 -58
- package/lib/table/table.d.ts +11 -0
- package/lib/table/table.less +46 -58
- package/lib/table/table.variable.css +115 -58
- package/lib/table/use-attributes.d.ts +6 -43
- package/lib/table/use-column.d.ts +9 -10
- package/lib/table/use-common.d.ts +1 -1
- package/lib/table/use-render.d.ts +1 -1
- package/lib/table/utils.d.ts +1 -1
- package/lib/table-column/index.d.ts +92 -266
- package/lib/table-column/index.js +24 -98
- package/lib/tag/tag.variable.css +3 -0
- package/lib/tag-input/index.d.ts +4 -4
- package/lib/tag-input/tag-input.d.ts +2 -2
- package/lib/tag-input/tag-input.variable.css +3 -0
- package/lib/tag-input/tag-props.d.ts +1 -1
- package/lib/tag-input/tag-render.d.ts +1 -1
- package/lib/time-picker/index.d.ts +38 -35
- package/lib/time-picker/time-picker.variable.css +3 -0
- package/lib/timeline/index.d.ts +80 -44
- package/lib/timeline/index.js +54 -65
- package/lib/timeline/timeline.d.ts +46 -29
- package/lib/timeline/timeline.variable.css +3 -0
- package/lib/transfer/transfer.variable.css +3 -0
- package/lib/tree/constant.d.ts +3 -1
- package/lib/tree/index.d.ts +44 -0
- package/lib/tree/index.js +17548 -25
- package/lib/tree/props.d.ts +18 -0
- package/lib/tree/tree.css +76 -2
- package/lib/tree/tree.d.ts +28 -2
- package/lib/tree/tree.variable.css +79 -2
- package/lib/tree/use-intersection-observer.d.ts +27 -0
- package/lib/tree/use-node-attribute.d.ts +9 -0
- package/lib/upload/index.d.ts +12 -0
- package/lib/upload/index.js +21 -30
- package/lib/upload/props.d.ts +3 -0
- package/lib/upload/upload-trigger.d.ts +6 -0
- package/lib/upload/upload.d.ts +6 -0
- package/lib/upload/upload.variable.css +3 -0
- package/lib/virtual-render/index.d.ts +36 -9
- package/lib/virtual-render/index.js +295 -80
- package/lib/virtual-render/props.d.ts +16 -0
- package/lib/virtual-render/use-fix-top.d.ts +2 -7
- package/lib/virtual-render/use-scrollbar.d.ts +24 -0
- package/lib/virtual-render/v-virtual-render.d.ts +2 -1
- package/lib/virtual-render/virtual-render.css +76 -2
- package/lib/virtual-render/virtual-render.d.ts +16 -3
- package/lib/virtual-render/virtual-render.less +3 -3
- package/lib/virtual-render/virtual-render.variable.css +79 -2
- package/package.json +1 -1
- package/lib/shared/mask.d.ts +0 -11
@@ -480,7 +480,7 @@ function _defineProperty(obj, key, value) {
|
|
480
480
|
;// CONCATENATED MODULE: external "vue"
|
481
481
|
var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
482
482
|
var external_vue_y = x => () => x
|
483
|
-
const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createTextVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["inject"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.inject, ["
|
483
|
+
const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createTextVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["inject"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.inject, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["provide"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.provide, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["resolveDirective"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective, ["shallowRef"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.shallowRef, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
|
484
484
|
;// CONCATENATED MODULE: ../../node_modules/resize-detector/esm/index.js
|
485
485
|
var raf = null;
|
486
486
|
function requestAnimationFrame (callback) {
|
@@ -809,6 +809,66 @@ const directives_namespaceObject = directives_x({ ["clickoutside"]: () => __WEBP
|
|
809
809
|
var icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
810
810
|
var icon_y = x => () => x
|
811
811
|
const icon_namespaceObject = icon_x({ ["Close"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Close, ["Error"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Error, ["ExclamationCircleShape"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.ExclamationCircleShape, ["Search"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3__.Search });
|
812
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
813
|
+
function _arrayWithHoles(arr) {
|
814
|
+
if (Array.isArray(arr)) return arr;
|
815
|
+
}
|
816
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
817
|
+
function _iterableToArrayLimit(r, l) {
|
818
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
819
|
+
if (null != t) {
|
820
|
+
var e,
|
821
|
+
n,
|
822
|
+
i,
|
823
|
+
u,
|
824
|
+
a = [],
|
825
|
+
f = !0,
|
826
|
+
o = !1;
|
827
|
+
try {
|
828
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
829
|
+
if (Object(t) !== t) return;
|
830
|
+
f = !1;
|
831
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
832
|
+
} catch (r) {
|
833
|
+
o = !0, n = r;
|
834
|
+
} finally {
|
835
|
+
try {
|
836
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
837
|
+
} finally {
|
838
|
+
if (o) throw n;
|
839
|
+
}
|
840
|
+
}
|
841
|
+
return a;
|
842
|
+
}
|
843
|
+
}
|
844
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
845
|
+
function _arrayLikeToArray(arr, len) {
|
846
|
+
if (len == null || len > arr.length) len = arr.length;
|
847
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
848
|
+
return arr2;
|
849
|
+
}
|
850
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
|
851
|
+
|
852
|
+
function _unsupportedIterableToArray(o, minLen) {
|
853
|
+
if (!o) return;
|
854
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
855
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
856
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
857
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
858
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
859
|
+
}
|
860
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
|
861
|
+
function _nonIterableRest() {
|
862
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
863
|
+
}
|
864
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js
|
865
|
+
|
866
|
+
|
867
|
+
|
868
|
+
|
869
|
+
function _slicedToArray(arr, i) {
|
870
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
871
|
+
}
|
812
872
|
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
|
813
873
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
814
874
|
try {
|
@@ -867,6 +927,27 @@ const radio_namespaceObject = radio_x({ ["default"]: () => __WEBPACK_EXTERNAL_MO
|
|
867
927
|
var radio_less_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
868
928
|
var radio_less_y = x => () => x
|
869
929
|
const radio_less_namespaceObject = radio_less_x({ });
|
930
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
|
931
|
+
|
932
|
+
function _arrayWithoutHoles(arr) {
|
933
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
934
|
+
}
|
935
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
|
936
|
+
function _iterableToArray(iter) {
|
937
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
938
|
+
}
|
939
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
|
940
|
+
function _nonIterableSpread() {
|
941
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
942
|
+
}
|
943
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
|
944
|
+
|
945
|
+
|
946
|
+
|
947
|
+
|
948
|
+
function _toConsumableArray(arr) {
|
949
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
950
|
+
}
|
870
951
|
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
871
952
|
function _classCallCheck(instance, Constructor) {
|
872
953
|
if (!(instance instanceof Constructor)) {
|
@@ -896,6 +977,7 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
896
977
|
|
897
978
|
|
898
979
|
|
980
|
+
|
899
981
|
/*
|
900
982
|
* Tencent is pleased to support the open source community by making
|
901
983
|
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
@@ -922,6 +1004,7 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
922
1004
|
* IN THE SOFTWARE.
|
923
1005
|
*/
|
924
1006
|
|
1007
|
+
|
925
1008
|
/**
|
926
1009
|
* @description: 获取menu list方法
|
927
1010
|
* @param {ISearchItem} item 已选择的key字段 为空则代表当前并未选择key字段
|
@@ -933,6 +1016,11 @@ var ValueBehavior;
|
|
933
1016
|
ValueBehavior["ALL"] = "all";
|
934
1017
|
ValueBehavior["NEEDKEY"] = "need-key";
|
935
1018
|
})(ValueBehavior || (ValueBehavior = {}));
|
1019
|
+
var DeleteBehavior;
|
1020
|
+
(function (DeleteBehavior) {
|
1021
|
+
DeleteBehavior["CHAR"] = "delete-char";
|
1022
|
+
DeleteBehavior["VALUE"] = "delete-value";
|
1023
|
+
})(DeleteBehavior || (DeleteBehavior = {}));
|
936
1024
|
var SEARCH_SLECT_PROVIDER_KEY = Symbol('SEARCH_SLECT_PROVIDER_KEY');
|
937
1025
|
var useSearchSelectProvider = function useSearchSelectProvider(data) {
|
938
1026
|
(0,external_vue_namespaceObject.provide)(SEARCH_SLECT_PROVIDER_KEY, data);
|
@@ -945,6 +1033,8 @@ var SearchInputMode;
|
|
945
1033
|
SearchInputMode["DEFAULT"] = "default";
|
946
1034
|
SearchInputMode["EDIT"] = "edit";
|
947
1035
|
})(SearchInputMode || (SearchInputMode = {}));
|
1036
|
+
var ValueSplitRegex = /(\||,|、|\/|\r\n|\n)/gm;
|
1037
|
+
var ValueSplitTestRegex = /^(\||,|、|\/|\r\n|\n)$/;
|
948
1038
|
var SearchLogical;
|
949
1039
|
(function (SearchLogical) {
|
950
1040
|
SearchLogical["AND"] = "&";
|
@@ -955,11 +1045,13 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
955
1045
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
956
1046
|
_classCallCheck(this, SelectedItem);
|
957
1047
|
_defineProperty(this, "values", []);
|
1048
|
+
_defineProperty(this, "nameRenderkey", (0,shared_namespaceObject.random)(4));
|
958
1049
|
this.searchItem = searchItem;
|
959
1050
|
this.type = type;
|
960
1051
|
this.id = searchItem.id;
|
961
1052
|
this.name = searchItem.name;
|
962
1053
|
this.logical = searchItem.logical || SearchLogical.OR;
|
1054
|
+
this.type = type;
|
963
1055
|
}
|
964
1056
|
_createClass(SelectedItem, [{
|
965
1057
|
key: "multiple",
|
@@ -1016,6 +1108,11 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1016
1108
|
get: function get() {
|
1017
1109
|
return !!this.searchItem.showLogicalPanel;
|
1018
1110
|
}
|
1111
|
+
}, {
|
1112
|
+
key: "isCustomMenu",
|
1113
|
+
get: function get() {
|
1114
|
+
return this.searchItem.isCustomMenu;
|
1115
|
+
}
|
1019
1116
|
}, {
|
1020
1117
|
key: "isSpecialType",
|
1021
1118
|
value: function isSpecialType() {
|
@@ -1024,6 +1121,7 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1024
1121
|
}, {
|
1025
1122
|
key: "addValue",
|
1026
1123
|
value: function addValue(item) {
|
1124
|
+
this.nameRenderkey = (0,shared_namespaceObject.random)(4);
|
1027
1125
|
if (this.multiple) {
|
1028
1126
|
var index = this.values.findIndex(function (val) {
|
1029
1127
|
return val.id === item.id;
|
@@ -1037,6 +1135,69 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1037
1135
|
}
|
1038
1136
|
this.values = [item];
|
1039
1137
|
}
|
1138
|
+
}, {
|
1139
|
+
key: "str2Values",
|
1140
|
+
value: function str2Values(str) {
|
1141
|
+
var _this = this;
|
1142
|
+
var list = str === null || str === void 0 ? void 0 : str.split(this.logical).map(function (v) {
|
1143
|
+
return v.trim();
|
1144
|
+
}).filter(function (v) {
|
1145
|
+
return v;
|
1146
|
+
});
|
1147
|
+
if (!(list !== null && list !== void 0 && list.length)) return [];
|
1148
|
+
var findChildByName = function findChildByName(name) {
|
1149
|
+
return _this.children.find(function (item) {
|
1150
|
+
return item.name === name;
|
1151
|
+
});
|
1152
|
+
};
|
1153
|
+
if (!this.multiple) {
|
1154
|
+
var val = list.join(" ".concat(this.logical, " ")).trim();
|
1155
|
+
var item = findChildByName(val);
|
1156
|
+
return [{
|
1157
|
+
id: item ? item.id : val,
|
1158
|
+
name: item ? item.name : val,
|
1159
|
+
disabled: !!(item !== null && item !== void 0 && item.disabled)
|
1160
|
+
}];
|
1161
|
+
}
|
1162
|
+
// 对于多选情况,处理整个列表
|
1163
|
+
return list.map(function (val) {
|
1164
|
+
var existing = _this.values.find(function (item) {
|
1165
|
+
return item.name === val;
|
1166
|
+
});
|
1167
|
+
if (existing) return existing;
|
1168
|
+
var item = findChildByName(val);
|
1169
|
+
return {
|
1170
|
+
id: item ? item.id : val,
|
1171
|
+
name: item ? item.name : val,
|
1172
|
+
disabled: !!(item !== null && item !== void 0 && item.disabled)
|
1173
|
+
};
|
1174
|
+
});
|
1175
|
+
}
|
1176
|
+
}, {
|
1177
|
+
key: "addValues",
|
1178
|
+
value: function addValues(str) {
|
1179
|
+
var mergeValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
1180
|
+
var valuesFromStr = str.split(ValueSplitRegex).filter(function (v) {
|
1181
|
+
return v.trim() && !ValueSplitTestRegex.test(v);
|
1182
|
+
});
|
1183
|
+
var currentValues = mergeValues ? this.values.map(function (item) {
|
1184
|
+
return item.name;
|
1185
|
+
}) : [];
|
1186
|
+
var combinedValues = [].concat(_toConsumableArray(valuesFromStr), _toConsumableArray(currentValues));
|
1187
|
+
var logicalString = combinedValues.filter(function (v) {
|
1188
|
+
return v.trim();
|
1189
|
+
}).join(this.logical);
|
1190
|
+
this.values = this.str2Values(logicalString);
|
1191
|
+
}
|
1192
|
+
}, {
|
1193
|
+
key: "getValue",
|
1194
|
+
value: function getValue(str) {
|
1195
|
+
return this.values.find(function (item) {
|
1196
|
+
return item.id === str;
|
1197
|
+
}) || this.values.find(function (item) {
|
1198
|
+
return item.name === str;
|
1199
|
+
});
|
1200
|
+
}
|
1040
1201
|
}, {
|
1041
1202
|
key: "toValue",
|
1042
1203
|
value: function toValue() {
|
@@ -1255,13 +1416,7 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1255
1416
|
"onClick": function onClick() {
|
1256
1417
|
return !item.disabled && _this.handleClick(item);
|
1257
1418
|
}
|
1258
|
-
}, [_this
|
1259
|
-
item: item,
|
1260
|
-
list: _this.list,
|
1261
|
-
multiple: !!_this.multiple,
|
1262
|
-
hoverId: _this.hoverId,
|
1263
|
-
getSearchNode: _this.getSearchNode
|
1264
|
-
}) : (0,external_vue_namespaceObject.createVNode)(external_vue_namespaceObject.Fragment, null, [_this.multiple && (0,external_vue_namespaceObject.createVNode)("span", {
|
1419
|
+
}, [(0,external_vue_namespaceObject.createVNode)(external_vue_namespaceObject.Fragment, null, [_this.multiple && (0,external_vue_namespaceObject.createVNode)("span", {
|
1265
1420
|
"onClick": function onClick(e) {
|
1266
1421
|
return _this.handleSelectedChange(e, item);
|
1267
1422
|
}
|
@@ -1315,9 +1470,10 @@ var SelectedItem = /*#__PURE__*/function () {
|
|
1315
1470
|
|
1316
1471
|
|
1317
1472
|
|
1473
|
+
|
1474
|
+
|
1318
1475
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
1319
1476
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
1320
|
-
|
1321
1477
|
/*
|
1322
1478
|
* Tencent is pleased to support the open source community by making
|
1323
1479
|
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
@@ -1380,7 +1536,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1380
1536
|
validateValues: Function,
|
1381
1537
|
valueBehavior: String
|
1382
1538
|
},
|
1383
|
-
emits: ['focus', 'add', 'delete'],
|
1539
|
+
emits: ['focus', 'add', 'delete', 'selectKey'],
|
1540
|
+
slots: Object,
|
1384
1541
|
setup: function setup(props, _ref) {
|
1385
1542
|
var emit = _ref.emit,
|
1386
1543
|
expose = _ref.expose;
|
@@ -1403,7 +1560,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1403
1560
|
var menuList = (0,external_vue_namespaceObject.ref)([]);
|
1404
1561
|
var _useSearchSelectInjec = useSearchSelectInject(),
|
1405
1562
|
editKey = _useSearchSelectInjec.editKey,
|
1406
|
-
onValidate = _useSearchSelectInjec.onValidate
|
1563
|
+
onValidate = _useSearchSelectInjec.onValidate,
|
1564
|
+
searchData = _useSearchSelectInjec.searchData;
|
1407
1565
|
var valueLoagic = (0,external_vue_namespaceObject.computed)(function () {
|
1408
1566
|
var _usingItem$value;
|
1409
1567
|
return ((_usingItem$value = usingItem.value) === null || _usingItem$value === void 0 ? void 0 : _usingItem$value.logical) || SearchLogical.OR;
|
@@ -1414,26 +1572,25 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1414
1572
|
}
|
1415
1573
|
});
|
1416
1574
|
// effects
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
}
|
1422
|
-
|
1423
|
-
}
|
1575
|
+
// watchEffect(
|
1576
|
+
// () => {
|
1577
|
+
// if (!keyword.value) {
|
1578
|
+
// setInputText();
|
1579
|
+
// }
|
1580
|
+
// },
|
1581
|
+
// { flush: 'pre' },
|
1582
|
+
// );
|
1424
1583
|
(0,external_vue_namespaceObject.watch)([menuList, showPopover], function () {
|
1425
1584
|
var _menuList$value;
|
1426
|
-
|
1585
|
+
var shouldBindEvent = showPopover.value && ((_menuList$value = menuList.value) === null || _menuList$value === void 0 ? void 0 : _menuList$value.some(function (item) {
|
1427
1586
|
return !item.disabled;
|
1428
|
-
})
|
1587
|
+
}));
|
1588
|
+
if (shouldBindEvent) {
|
1429
1589
|
if (!isBindEvent) {
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
} else {
|
1435
|
-
menuHoverId.value = '';
|
1436
|
-
}
|
1590
|
+
var _menuList$value$find;
|
1591
|
+
menuHoverId.value = props.valueBehavior === ValueBehavior.NEEDKEY ? ((_menuList$value$find = menuList.value.find(function (item) {
|
1592
|
+
return !item.disabled;
|
1593
|
+
})) === null || _menuList$value$find === void 0 ? void 0 : _menuList$value$find.id) || '' : '';
|
1437
1594
|
isBindEvent = true;
|
1438
1595
|
document.addEventListener('keydown', handleDocumentKeydown);
|
1439
1596
|
}
|
@@ -1463,85 +1620,101 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1463
1620
|
e.preventDefault();
|
1464
1621
|
(_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 || _inputRef$value.blur();
|
1465
1622
|
var len = menuList.value.length;
|
1466
|
-
var i = len;
|
1467
1623
|
var index = menuList.value.findIndex(function (set) {
|
1468
1624
|
return set.id === menuHoverId.value;
|
1469
1625
|
});
|
1470
|
-
|
1471
|
-
index = e.code === 'ArrowDown' ?
|
1472
|
-
// eslint-disable-next-line no-nested-ternary
|
1473
|
-
index = index > len - 1 ? 0 : index < 0 ? len - 1 : index;
|
1626
|
+
for (var tries = 0; tries < len; tries++) {
|
1627
|
+
index = (index + (e.code === 'ArrowDown' ? 1 : -1) + len) % len;
|
1474
1628
|
var item = menuList.value[index];
|
1475
1629
|
if (item && !item.disabled) {
|
1476
|
-
i = -1;
|
1477
1630
|
var dom = document.getElementById(item.id);
|
1478
1631
|
dom === null || dom === void 0 || dom.focus();
|
1479
1632
|
menuHoverId.value = item.id;
|
1480
|
-
|
1633
|
+
break;
|
1481
1634
|
}
|
1482
|
-
i -= 1;
|
1483
1635
|
}
|
1484
1636
|
}
|
1485
1637
|
function documentEnterEvent(e) {
|
1486
|
-
if (isBindEvent)
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
}
|
1638
|
+
if (!isBindEvent) return;
|
1639
|
+
e.preventDefault();
|
1640
|
+
var item = menuList.value.find(function (item) {
|
1641
|
+
return item.id === menuHoverId.value;
|
1642
|
+
});
|
1643
|
+
item && handleSelectItem(item);
|
1493
1644
|
}
|
1494
1645
|
function handleClickOutside(e) {
|
1495
|
-
var _popoverRef$value, _props$clickOutside;
|
1496
|
-
if (
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1646
|
+
var _popoverRef$value, _props$clickOutside, _usingItem$value2;
|
1647
|
+
if ((_popoverRef$value = popoverRef.value) !== null && _popoverRef$value !== void 0 && _popoverRef$value.contains(e.target) || !((_props$clickOutside = props.clickOutside) !== null && _props$clickOutside !== void 0 && _props$clickOutside.call(props, e.target, popoverRef.value))) {
|
1648
|
+
return;
|
1649
|
+
}
|
1650
|
+
if ((_usingItem$value2 = usingItem.value) !== null && _usingItem$value2 !== void 0 && _usingItem$value2.isCustomMenu) {
|
1651
|
+
if (props.mode === SearchInputMode.EDIT) {
|
1652
|
+
handleKeyEnter().then(function (v) {
|
1653
|
+
return v && clearInput();
|
1654
|
+
});
|
1655
|
+
showPopover.value = false;
|
1502
1656
|
}
|
1503
|
-
|
1504
|
-
isFocus.value = false;
|
1505
|
-
emit('focus', isFocus.value);
|
1657
|
+
return;
|
1506
1658
|
}
|
1659
|
+
if (props.mode === SearchInputMode.EDIT || usingItem.value) {
|
1660
|
+
usingItem.value && handleKeyEnter().then(function (v) {
|
1661
|
+
return v && clearInput();
|
1662
|
+
});
|
1663
|
+
if (!usingItem.value) {
|
1664
|
+
emit('focus', false);
|
1665
|
+
}
|
1666
|
+
return;
|
1667
|
+
}
|
1668
|
+
isFocus.value = false;
|
1669
|
+
showPopover.value = false;
|
1670
|
+
emit('focus', isFocus.value);
|
1507
1671
|
}
|
1508
|
-
function handleInputFocus(
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1672
|
+
function handleInputFocus() {
|
1673
|
+
showNoSelectValueError.value = false;
|
1674
|
+
if (props.mode === SearchInputMode.EDIT && usingItem.value && !isFocus.value) {
|
1675
|
+
var nodeList = Array.from(inputRef.value.querySelectorAll("[data-type=\"".concat(usingItem.value.values.length ? 'value' : usingItem.value.type, "\"]")));
|
1676
|
+
if (!nodeList.length) return;
|
1677
|
+
var range = document.createRange();
|
1678
|
+
var selection = window.getSelection();
|
1679
|
+
range.selectNodeContents(nodeList.at(-1));
|
1680
|
+
selection === null || selection === void 0 || selection.removeAllRanges();
|
1681
|
+
selection.addRange(range); // 注意这里会触发focu事件
|
1682
|
+
setInputFocus(true, false);
|
1683
|
+
return;
|
1684
|
+
}
|
1685
|
+
setMenuList();
|
1686
|
+
setInputFocus(false, !isFocus.value);
|
1687
|
+
}
|
1688
|
+
function handleInputPaste(event) {
|
1689
|
+
event.preventDefault();
|
1690
|
+
var formattedText = event.clipboardData.getData('text').trim();
|
1691
|
+
if (!usingItem.value) {
|
1692
|
+
var formateItem = str2SeletedItem(formattedText);
|
1693
|
+
if (formateItem) {
|
1694
|
+
usingItem.value = formateItem;
|
1695
|
+
setInputFocus(true, true);
|
1532
1696
|
return;
|
1533
1697
|
}
|
1534
|
-
|
1535
|
-
|
1536
|
-
}
|
1537
|
-
|
1538
|
-
debounceSetMenuList();
|
1539
|
-
} else if (!((_usingItem$value8 = usingItem.value) !== null && _usingItem$value8 !== void 0 && (_usingItem$value8 = _usingItem$value8.values) !== null && _usingItem$value8 !== void 0 && _usingItem$value8.length)) {
|
1540
|
-
var _usingItem$value9;
|
1541
|
-
keyword.value = text.replace("\xA0", " ").replace(((_usingItem$value9 = usingItem.value) === null || _usingItem$value9 === void 0 ? void 0 : _usingItem$value9.keyInnerText.replace("\xA0", " ")) || '', '').trim();
|
1698
|
+
keyword.value = formattedText.split(ValueSplitRegex).filter(function (v) {
|
1699
|
+
return v.trim() && !ValueSplitTestRegex.test(v);
|
1700
|
+
}).join(" ".concat(valueLoagic.value, " "));
|
1701
|
+
inputRef.value.innerText = keyword.value;
|
1542
1702
|
setInputFocus();
|
1543
1703
|
debounceSetMenuList();
|
1704
|
+
return;
|
1705
|
+
}
|
1706
|
+
usingItem.value.addValues(formattedText);
|
1707
|
+
debounceSetMenuList();
|
1708
|
+
}
|
1709
|
+
function handleInputChange(event) {
|
1710
|
+
var text = event.target.innerText.trim();
|
1711
|
+
if (!usingItem.value) {
|
1712
|
+
keyword.value = text;
|
1713
|
+
debounceSetMenuList();
|
1714
|
+
return;
|
1544
1715
|
}
|
1716
|
+
keyword.value = usingItem.value.isSpecialType() ? text : text.replace(usingItem.value.name, '').replace(':', '').trim();
|
1717
|
+
debounceSetMenuList();
|
1545
1718
|
}
|
1546
1719
|
function handleInputKeyup(event) {
|
1547
1720
|
switch (event.code) {
|
@@ -1550,10 +1723,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1550
1723
|
if (props.valueBehavior === ValueBehavior.NEEDKEY && menuList.value.some(function (item) {
|
1551
1724
|
return item.id === menuHoverId.value;
|
1552
1725
|
})) return;
|
1553
|
-
handleKeyEnter(event)
|
1726
|
+
handleKeyEnter(event).then(function (v) {
|
1727
|
+
return v && clearInput();
|
1728
|
+
});
|
1554
1729
|
break;
|
1555
1730
|
case 'Backspace':
|
1556
|
-
handleKeyBackspace();
|
1731
|
+
handleKeyBackspace(event);
|
1557
1732
|
default:
|
1558
1733
|
showNoSelectValueError.value = false;
|
1559
1734
|
break;
|
@@ -1564,19 +1739,20 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1564
1739
|
}
|
1565
1740
|
function _handleKeyEnter() {
|
1566
1741
|
_handleKeyEnter = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee(event) {
|
1567
|
-
var
|
1742
|
+
var _usingItem$value6, _usingItem$value7, _usingItem$value8;
|
1743
|
+
var isValid;
|
1568
1744
|
return regenerator_default().wrap(function _callee$(_context) {
|
1569
1745
|
while (1) switch (_context.prev = _context.next) {
|
1570
1746
|
case 0:
|
1571
1747
|
event === null || event === void 0 || event.preventDefault();
|
1572
|
-
//
|
1748
|
+
// 异步延迟解决确保响应时机问题
|
1573
1749
|
_context.next = 3;
|
1574
|
-
return new Promise(function (
|
1575
|
-
return setTimeout(
|
1750
|
+
return new Promise(function (resolve) {
|
1751
|
+
return setTimeout(resolve, 0);
|
1576
1752
|
});
|
1577
1753
|
case 3:
|
1578
1754
|
if (usingItem.value) {
|
1579
|
-
_context.next =
|
1755
|
+
_context.next = 9;
|
1580
1756
|
break;
|
1581
1757
|
}
|
1582
1758
|
if (!(!keyword.value || props.valueBehavior === ValueBehavior.NEEDKEY)) {
|
@@ -1585,123 +1761,43 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1585
1761
|
}
|
1586
1762
|
return _context.abrupt("return");
|
1587
1763
|
case 6:
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
_context.next = 9;
|
1593
|
-
return validateUsingItemValues(value);
|
1764
|
+
_context.next = 8;
|
1765
|
+
return enterNewItemSelected();
|
1766
|
+
case 8:
|
1767
|
+
return _context.abrupt("return", _context.sent);
|
1594
1768
|
case 9:
|
1595
|
-
_res = _context.sent;
|
1596
|
-
if (_res) {
|
1597
|
-
_context.next = 12;
|
1598
|
-
break;
|
1599
|
-
}
|
1600
|
-
return _context.abrupt("return");
|
1601
|
-
case 12:
|
1602
|
-
emit('add', new SelectedItem(value, 'text'));
|
1603
|
-
keyword.value = '';
|
1604
|
-
setMenuList();
|
1605
|
-
return _context.abrupt("return");
|
1606
|
-
case 16:
|
1607
|
-
values = usingItem.value.values;
|
1608
|
-
if (values !== null && values !== void 0 && values.length) {
|
1609
|
-
_context.next = 43;
|
1610
|
-
break;
|
1611
|
-
}
|
1612
|
-
if (!((_keyword$value = keyword.value) !== null && _keyword$value !== void 0 && _keyword$value.length)) {
|
1613
|
-
_context.next = 41;
|
1614
|
-
break;
|
1615
|
-
}
|
1616
|
-
if (!keyword.value.includes(valueLoagic.value)) {
|
1617
|
-
_context.next = 29;
|
1618
|
-
break;
|
1619
|
-
}
|
1620
|
-
valueList = keyword.value.split(valueLoagic.value);
|
1621
|
-
_context.next = 23;
|
1622
|
-
return validateUsingItemValues({
|
1623
|
-
id: keyword.value,
|
1624
|
-
name: keyword.value
|
1625
|
-
});
|
1626
|
-
case 23:
|
1627
|
-
_res2 = _context.sent;
|
1628
|
-
if (_res2) {
|
1629
|
-
_context.next = 26;
|
1630
|
-
break;
|
1631
|
-
}
|
1632
|
-
return _context.abrupt("return");
|
1633
|
-
case 26:
|
1634
|
-
valueList.forEach(function (v) {
|
1635
|
-
return usingItem.value.addValue({
|
1636
|
-
id: v,
|
1637
|
-
name: v
|
1638
|
-
});
|
1639
|
-
});
|
1640
|
-
_context.next = 36;
|
1641
|
-
break;
|
1642
|
-
case 29:
|
1643
|
-
_value = {
|
1644
|
-
id: keyword.value,
|
1645
|
-
name: keyword.value
|
1646
|
-
};
|
1647
|
-
_context.next = 32;
|
1648
|
-
return validateUsingItemValues(_value);
|
1649
|
-
case 32:
|
1650
|
-
_res3 = _context.sent;
|
1651
|
-
if (_res3) {
|
1652
|
-
_context.next = 35;
|
1653
|
-
break;
|
1654
|
-
}
|
1655
|
-
return _context.abrupt("return");
|
1656
|
-
case 35:
|
1657
|
-
usingItem.value.addValue(_value);
|
1658
|
-
case 36:
|
1659
|
-
emit('add', usingItem.value);
|
1660
|
-
keyword.value = '';
|
1661
|
-
usingItem.value = null;
|
1662
|
-
setInputFocus(true);
|
1663
|
-
return _context.abrupt("return");
|
1664
|
-
case 41:
|
1665
|
-
showNoSelectValueError.value = true;
|
1666
|
-
return _context.abrupt("return");
|
1667
|
-
case 43:
|
1668
1769
|
if (!keyword.value) {
|
1669
|
-
_context.next =
|
1770
|
+
_context.next = 13;
|
1670
1771
|
break;
|
1671
1772
|
}
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
_res4 = _context.sent;
|
1680
|
-
if (_res4) {
|
1681
|
-
_context.next = 50;
|
1773
|
+
_context.next = 12;
|
1774
|
+
return enterExistingItemSelected();
|
1775
|
+
case 12:
|
1776
|
+
return _context.abrupt("return", _context.sent);
|
1777
|
+
case 13:
|
1778
|
+
if (!(!((_usingItem$value6 = usingItem.value) !== null && _usingItem$value6 !== void 0 && _usingItem$value6.isSpecialType()) && ((_usingItem$value7 = usingItem.value) === null || _usingItem$value7 === void 0 ? void 0 : _usingItem$value7.values.length) < 1)) {
|
1779
|
+
_context.next = 16;
|
1682
1780
|
break;
|
1683
1781
|
}
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
keyword.value = '';
|
1689
|
-
usingItem.value = null;
|
1690
|
-
setInputFocus(true);
|
1691
|
-
return _context.abrupt("return");
|
1692
|
-
case 56:
|
1693
|
-
_context.next = 58;
|
1782
|
+
showNoSelectValueError.value = !showNoSelectValueError.value;
|
1783
|
+
return _context.abrupt("return", false);
|
1784
|
+
case 16:
|
1785
|
+
_context.next = 18;
|
1694
1786
|
return validateUsingItemValues();
|
1695
|
-
case
|
1696
|
-
|
1697
|
-
if (
|
1698
|
-
_context.next =
|
1787
|
+
case 18:
|
1788
|
+
isValid = _context.sent;
|
1789
|
+
if (isValid) {
|
1790
|
+
_context.next = 21;
|
1699
1791
|
break;
|
1700
1792
|
}
|
1701
|
-
return _context.abrupt("return");
|
1702
|
-
case
|
1793
|
+
return _context.abrupt("return", false);
|
1794
|
+
case 21:
|
1795
|
+
if ((_usingItem$value8 = usingItem.value) !== null && _usingItem$value8 !== void 0 && _usingItem$value8.isCustomMenu) {
|
1796
|
+
showPopover.value = false;
|
1797
|
+
}
|
1703
1798
|
setSelectedItem();
|
1704
|
-
|
1799
|
+
return _context.abrupt("return", false);
|
1800
|
+
case 24:
|
1705
1801
|
case "end":
|
1706
1802
|
return _context.stop();
|
1707
1803
|
}
|
@@ -1709,22 +1805,31 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1709
1805
|
}));
|
1710
1806
|
return _handleKeyEnter.apply(this, arguments);
|
1711
1807
|
}
|
1712
|
-
function handleKeyBackspace() {
|
1713
|
-
var _usingItem$
|
1808
|
+
function handleKeyBackspace(event) {
|
1809
|
+
var _usingItem$value3;
|
1714
1810
|
// 删除已选择项
|
1715
1811
|
if (!usingItem.value && !keyword.value) {
|
1716
1812
|
emit('delete');
|
1717
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
1718
1813
|
setTimeout(setMenuList, 16);
|
1719
1814
|
return;
|
1720
1815
|
}
|
1721
|
-
if ((_usingItem$
|
1722
|
-
var _usingItem$
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1816
|
+
if ((_usingItem$value3 = usingItem.value) !== null && _usingItem$value3 !== void 0 && _usingItem$value3.values.length) {
|
1817
|
+
var _usingItem$value$chil;
|
1818
|
+
if (usingItem.value.type === 'text' || !((_usingItem$value$chil = usingItem.value.children) !== null && _usingItem$value$chil !== void 0 && _usingItem$value$chil.length)) return;
|
1819
|
+
event.preventDefault();
|
1820
|
+
var selection = window.getSelection();
|
1821
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.rangeCount) > 0) {
|
1822
|
+
var _node;
|
1823
|
+
var range = selection.getRangeAt(0);
|
1824
|
+
var startPos = range.startContainer;
|
1825
|
+
var node = startPos;
|
1826
|
+
while (node && node.parentNode !== inputRef.value) {
|
1827
|
+
node = node.parentNode;
|
1828
|
+
}
|
1829
|
+
var editIndex = ((_node = node) === null || _node === void 0 || (_node = _node.dataset) === null || _node === void 0 ? void 0 : _node.index) || -1;
|
1830
|
+
usingItem.value.values.splice(+editIndex, 1);
|
1726
1831
|
keyword.value = '';
|
1727
|
-
setInputFocus();
|
1832
|
+
setInputFocus(false, false);
|
1728
1833
|
return;
|
1729
1834
|
}
|
1730
1835
|
} else if (!keyword.value) {
|
@@ -1739,86 +1844,85 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1739
1844
|
}
|
1740
1845
|
function _handleSelectItem() {
|
1741
1846
|
_handleSelectItem = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee2(item, type) {
|
1742
|
-
var _item$value,
|
1743
|
-
var _item$
|
1847
|
+
var _item$value, _usingItem$value9, _usingItem$value12;
|
1848
|
+
var _item$realId, selectedItem, _usingItem$value10, _usingItem$value11, isCondition;
|
1744
1849
|
return regenerator_default().wrap(function _callee2$(_context2) {
|
1745
1850
|
while (1) switch (_context2.prev = _context2.next) {
|
1746
1851
|
case 0:
|
1747
1852
|
if (!((_item$value = item.value) !== null && _item$value !== void 0 && _item$value.id)) {
|
1748
|
-
_context2.next =
|
1749
|
-
break;
|
1750
|
-
}
|
1751
|
-
if (!(props.valueBehavior === ValueBehavior.NEEDKEY && item.value || !props.validateValues)) {
|
1752
|
-
_context2.next = 8;
|
1853
|
+
_context2.next = 18;
|
1753
1854
|
break;
|
1754
1855
|
}
|
1755
|
-
|
1856
|
+
selectedItem = new SelectedItem(_objectSpread(_objectSpread({}, item), {}, {
|
1756
1857
|
id: (_item$realId = item.realId) !== null && _item$realId !== void 0 ? _item$realId : item.id
|
1757
1858
|
}), type);
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1859
|
+
selectedItem.addValues(item.value.name, false);
|
1860
|
+
if (!(props.valueBehavior === ValueBehavior.NEEDKEY && menuHoverId.value)) {
|
1861
|
+
_context2.next = 8;
|
1862
|
+
break;
|
1762
1863
|
}
|
1864
|
+
setSelectedItem(selectedItem);
|
1865
|
+
setInputFocus(true);
|
1763
1866
|
menuHoverId.value = '';
|
1764
1867
|
return _context2.abrupt("return");
|
1765
1868
|
case 8:
|
1766
|
-
usingItem.value =
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
_context2.
|
1771
|
-
|
1772
|
-
case 12:
|
1773
|
-
_res5 = _context2.sent;
|
1774
|
-
if (_res5) {
|
1775
|
-
_context2.next = 16;
|
1869
|
+
usingItem.value = selectedItem;
|
1870
|
+
_context2.next = 11;
|
1871
|
+
return validateUsingItemValues(usingItem.value.values);
|
1872
|
+
case 11:
|
1873
|
+
if (_context2.sent) {
|
1874
|
+
_context2.next = 14;
|
1776
1875
|
break;
|
1777
1876
|
}
|
1778
1877
|
usingItem.value = null;
|
1779
1878
|
return _context2.abrupt("return");
|
1780
|
-
case
|
1879
|
+
case 14:
|
1781
1880
|
setSelectedItem(usingItem.value);
|
1782
|
-
menuHoverId.value = '';
|
1783
1881
|
setInputFocus(true);
|
1882
|
+
menuHoverId.value = '';
|
1784
1883
|
return _context2.abrupt("return");
|
1785
|
-
case
|
1786
|
-
if (!(!usingItem.value ||
|
1787
|
-
_context2.next =
|
1884
|
+
case 18:
|
1885
|
+
if (!(!usingItem.value || ((_usingItem$value9 = usingItem.value) === null || _usingItem$value9 === void 0 ? void 0 : _usingItem$value9.type) === 'condition')) {
|
1886
|
+
_context2.next = 27;
|
1788
1887
|
break;
|
1789
1888
|
}
|
1790
|
-
usingItem.value = new SelectedItem(item, type);
|
1889
|
+
usingItem.value = new SelectedItem(item, type !== null && type !== void 0 ? type : (_usingItem$value10 = usingItem.value) === null || _usingItem$value10 === void 0 ? void 0 : _usingItem$value10.type);
|
1791
1890
|
keyword.value = '';
|
1792
|
-
isCondition = type === 'condition';
|
1793
|
-
|
1891
|
+
isCondition = ((_usingItem$value11 = usingItem.value) === null || _usingItem$value11 === void 0 ? void 0 : _usingItem$value11.type) === 'condition';
|
1892
|
+
if (!isCondition) {
|
1893
|
+
emit('selectKey', {
|
1894
|
+
id: item.id,
|
1895
|
+
name: item.name,
|
1896
|
+
values: []
|
1897
|
+
});
|
1898
|
+
}
|
1899
|
+
if (isCondition) {
|
1900
|
+
setSelectedItem();
|
1901
|
+
}
|
1794
1902
|
showPopover.value = isCondition || !!usingItem.value.children.length;
|
1795
1903
|
setInputFocus(props.valueBehavior === ValueBehavior.NEEDKEY && !!menuHoverId.value);
|
1796
1904
|
return _context2.abrupt("return");
|
1797
|
-
case
|
1798
|
-
if (
|
1905
|
+
case 27:
|
1906
|
+
if (usingItem.value) {
|
1907
|
+
usingItem.value.addValue(item);
|
1908
|
+
(0,external_vue_namespaceObject.nextTick)(deleteInputTextNode);
|
1909
|
+
}
|
1910
|
+
_context2.next = 30;
|
1911
|
+
return validateUsingItemValues(usingItem.value.values);
|
1912
|
+
case 30:
|
1913
|
+
if (_context2.sent) {
|
1799
1914
|
_context2.next = 32;
|
1800
1915
|
break;
|
1801
1916
|
}
|
1802
|
-
usingItem.value = new SelectedItem(item, type);
|
1803
|
-
setSelectedItem();
|
1804
1917
|
return _context2.abrupt("return");
|
1805
1918
|
case 32:
|
1806
|
-
usingItem.value.
|
1807
|
-
|
1808
|
-
return validateUsingItemValues(item);
|
1809
|
-
case 35:
|
1810
|
-
res = _context2.sent;
|
1811
|
-
if (res) {
|
1812
|
-
_context2.next = 38;
|
1813
|
-
break;
|
1919
|
+
if (!usingItem.value.multiple) {
|
1920
|
+
setSelectedItem();
|
1814
1921
|
}
|
1815
|
-
|
1816
|
-
case 38:
|
1817
|
-
if (!usingItem.value.multiple) setSelectedItem();
|
1818
|
-
if (props.valueBehavior === ValueBehavior.NEEDKEY && (_usingItem$value15 = usingItem.value) !== null && _usingItem$value15 !== void 0 && _usingItem$value15.multiple) {
|
1922
|
+
if (props.valueBehavior === ValueBehavior.NEEDKEY && (_usingItem$value12 = usingItem.value) !== null && _usingItem$value12 !== void 0 && _usingItem$value12.multiple) {
|
1819
1923
|
setInputFocus();
|
1820
1924
|
}
|
1821
|
-
case
|
1925
|
+
case 34:
|
1822
1926
|
case "end":
|
1823
1927
|
return _context2.stop();
|
1824
1928
|
}
|
@@ -1830,10 +1934,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1830
1934
|
handleSelectItem(item, 'condition');
|
1831
1935
|
}
|
1832
1936
|
function handleMenuFooterClick(item) {
|
1833
|
-
var _usingItem$
|
1937
|
+
var _usingItem$value4;
|
1834
1938
|
switch (item.id) {
|
1835
1939
|
case 'confirm':
|
1836
|
-
if (!((_usingItem$
|
1940
|
+
if (!((_usingItem$value4 = usingItem.value) !== null && _usingItem$value4 !== void 0 && _usingItem$value4.values.length)) return;
|
1837
1941
|
keyword.value = '';
|
1838
1942
|
handleKeyEnter();
|
1839
1943
|
break;
|
@@ -1843,119 +1947,110 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
1843
1947
|
break;
|
1844
1948
|
}
|
1845
1949
|
}
|
1950
|
+
function handleLogicalChange(logical) {
|
1951
|
+
if (!usingItem.value) return;
|
1952
|
+
usingItem.value.logical = logical;
|
1953
|
+
}
|
1846
1954
|
// functions
|
1847
|
-
function
|
1848
|
-
return
|
1955
|
+
function validateValues(_x4, _x5) {
|
1956
|
+
return _validateValues.apply(this, arguments);
|
1849
1957
|
}
|
1850
|
-
function
|
1851
|
-
|
1852
|
-
var
|
1958
|
+
function _validateValues() {
|
1959
|
+
_validateValues = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee3(searchItem, value) {
|
1960
|
+
var validateStr;
|
1853
1961
|
return regenerator_default().wrap(function _callee3$(_context3) {
|
1854
1962
|
while (1) switch (_context3.prev = _context3.next) {
|
1855
1963
|
case 0:
|
1856
|
-
if (
|
1857
|
-
_context3.next =
|
1964
|
+
if (!(typeof props.validateValues === 'function')) {
|
1965
|
+
_context3.next = 14;
|
1858
1966
|
break;
|
1859
1967
|
}
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
return
|
1864
|
-
case
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1968
|
+
validateStr = '';
|
1969
|
+
_context3.prev = 2;
|
1970
|
+
_context3.next = 5;
|
1971
|
+
return props.validateValues(searchItem !== null && searchItem !== void 0 ? searchItem : null, value);
|
1972
|
+
case 5:
|
1973
|
+
validateStr = _context3.sent;
|
1974
|
+
_context3.next = 11;
|
1975
|
+
break;
|
1976
|
+
case 8:
|
1977
|
+
_context3.prev = 8;
|
1978
|
+
_context3.t0 = _context3["catch"](2);
|
1979
|
+
validateStr = false;
|
1980
|
+
case 11:
|
1981
|
+
if (!(typeof validateStr === 'string' || validateStr === false)) {
|
1982
|
+
_context3.next = 14;
|
1868
1983
|
break;
|
1869
1984
|
}
|
1870
|
-
|
1871
|
-
return
|
1872
|
-
case
|
1873
|
-
return _context3.abrupt("return", _context3.sent);
|
1874
|
-
case 9:
|
1985
|
+
onValidate(validateStr || '校验错误');
|
1986
|
+
return _context3.abrupt("return", false);
|
1987
|
+
case 14:
|
1875
1988
|
onValidate('');
|
1876
1989
|
return _context3.abrupt("return", true);
|
1877
|
-
case
|
1990
|
+
case 16:
|
1878
1991
|
case "end":
|
1879
1992
|
return _context3.stop();
|
1880
1993
|
}
|
1881
|
-
}, _callee3);
|
1994
|
+
}, _callee3, null, [[2, 8]]);
|
1882
1995
|
}));
|
1883
|
-
return _validateUsingItemValues.apply(this, arguments);
|
1884
|
-
}
|
1885
|
-
function validateValues(_x5, _x6) {
|
1886
1996
|
return _validateValues.apply(this, arguments);
|
1887
1997
|
}
|
1888
|
-
function
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1998
|
+
function validateUsingItemValues(_x6) {
|
1999
|
+
return _validateUsingItemValues.apply(this, arguments);
|
2000
|
+
}
|
2001
|
+
function _validateUsingItemValues() {
|
2002
|
+
_validateUsingItemValues = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee4(preValues) {
|
2003
|
+
var _usingItem$value13, searchItem, validate, values;
|
1892
2004
|
return regenerator_default().wrap(function _callee4$(_context4) {
|
1893
2005
|
while (1) switch (_context4.prev = _context4.next) {
|
1894
2006
|
case 0:
|
1895
|
-
|
1896
|
-
|
1897
|
-
return false;
|
1898
|
-
});
|
1899
|
-
case 2:
|
1900
|
-
validateStr = _context4.sent;
|
1901
|
-
if (!(typeof validateStr === 'string' || validateStr === false)) {
|
1902
|
-
_context4.next = 6;
|
2007
|
+
if (usingItem.value) {
|
2008
|
+
_context4.next = 4;
|
1903
2009
|
break;
|
1904
2010
|
}
|
1905
|
-
|
1906
|
-
return
|
1907
|
-
case
|
2011
|
+
_context4.next = 3;
|
2012
|
+
return validateValues(null, preValues);
|
2013
|
+
case 3:
|
2014
|
+
return _context4.abrupt("return", _context4.sent);
|
2015
|
+
case 4:
|
2016
|
+
_usingItem$value13 = usingItem.value, searchItem = _usingItem$value13.searchItem, validate = _usingItem$value13.validate, values = _usingItem$value13.values;
|
2017
|
+
if (!(validate && typeof props.validateValues === 'function')) {
|
2018
|
+
_context4.next = 9;
|
2019
|
+
break;
|
2020
|
+
}
|
2021
|
+
_context4.next = 8;
|
2022
|
+
return validateValues(searchItem, preValues !== null && preValues !== void 0 ? preValues : values);
|
2023
|
+
case 8:
|
2024
|
+
return _context4.abrupt("return", _context4.sent);
|
2025
|
+
case 9:
|
1908
2026
|
onValidate('');
|
1909
2027
|
return _context4.abrupt("return", true);
|
1910
|
-
case
|
2028
|
+
case 11:
|
1911
2029
|
case "end":
|
1912
2030
|
return _context4.stop();
|
1913
2031
|
}
|
1914
2032
|
}, _callee4);
|
1915
2033
|
}));
|
1916
|
-
return
|
1917
|
-
}
|
1918
|
-
function setInputFocus() {
|
1919
|
-
var refleshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1920
|
-
if (refleshMenuList) {
|
1921
|
-
setTimeout(function () {
|
1922
|
-
setMenuList();
|
1923
|
-
}, 16);
|
1924
|
-
}
|
1925
|
-
isFocus.value = true;
|
1926
|
-
showPopover.value = true;
|
1927
|
-
showNoSelectValueError.value = false;
|
1928
|
-
var timer = setTimeout(function () {
|
1929
|
-
if (inputRef.value) {
|
1930
|
-
inputRef.value.focus(); // 光标移至最后
|
1931
|
-
var selection = window.getSelection();
|
1932
|
-
if (selection.focusOffset === 0) {
|
1933
|
-
selection.selectAllChildren(inputRef.value);
|
1934
|
-
selection.collapseToEnd();
|
1935
|
-
}
|
1936
|
-
}
|
1937
|
-
window.clearTimeout(timer);
|
1938
|
-
}, 0);
|
1939
|
-
emit('focus', isFocus.value);
|
2034
|
+
return _validateUsingItemValues.apply(this, arguments);
|
1940
2035
|
}
|
1941
2036
|
function setMenuList() {
|
1942
2037
|
return _setMenuList.apply(this, arguments);
|
1943
2038
|
}
|
1944
2039
|
function _setMenuList() {
|
1945
2040
|
_setMenuList = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee5() {
|
1946
|
-
var _usingItem$
|
1947
|
-
var list, _usingItem$
|
2041
|
+
var _props$data, _usingItem$value$sear, _usingItem$value$valu;
|
2042
|
+
var list, _usingItem$value14, _keyword$value2, hoverItem;
|
1948
2043
|
return regenerator_default().wrap(function _callee5$(_context5) {
|
1949
2044
|
while (1) switch (_context5.prev = _context5.next) {
|
1950
2045
|
case 0:
|
1951
2046
|
list = [];
|
1952
|
-
if (!(typeof props.getMenuList === 'function' && (
|
2047
|
+
if (!(typeof props.getMenuList === 'function' && (!((_props$data = props.data) !== null && _props$data !== void 0 && _props$data.length) && !usingItem.value || usingItem.value && usingItem.value.type !== 'condition' && (((_usingItem$value$sear = usingItem.value.searchItem) === null || _usingItem$value$sear === void 0 ? void 0 : _usingItem$value$sear.async) === undefined || usingItem.value.searchItem.async === true)))) {
|
1953
2048
|
_context5.next = 9;
|
1954
2049
|
break;
|
1955
2050
|
}
|
1956
2051
|
loading.value = true;
|
1957
2052
|
_context5.next = 5;
|
1958
|
-
return props.getMenuList((_usingItem$
|
2053
|
+
return props.getMenuList((_usingItem$value14 = usingItem.value) === null || _usingItem$value14 === void 0 ? void 0 : _usingItem$value14.searchItem, keyword.value)["catch"](function () {
|
1959
2054
|
return [];
|
1960
2055
|
});
|
1961
2056
|
case 5:
|
@@ -2016,7 +2111,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2016
2111
|
});
|
2017
2112
|
} else if (usingItem.value.type === 'condition') {
|
2018
2113
|
list = props.conditions;
|
2019
|
-
} else if (!((_usingItem$value$
|
2114
|
+
} else if (!((_usingItem$value$valu = usingItem.value.values) !== null && _usingItem$value$valu !== void 0 && _usingItem$value$valu.length) || usingItem.value.multiple || props.mode === SearchInputMode.EDIT) {
|
2020
2115
|
list = usingItem.value.children.filter(function (item) {
|
2021
2116
|
return item.name.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase());
|
2022
2117
|
});
|
@@ -2041,35 +2136,206 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2041
2136
|
}));
|
2042
2137
|
return _setMenuList.apply(this, arguments);
|
2043
2138
|
}
|
2139
|
+
function enterNewItemSelected() {
|
2140
|
+
return _enterNewItemSelected.apply(this, arguments);
|
2141
|
+
}
|
2142
|
+
function _enterNewItemSelected() {
|
2143
|
+
_enterNewItemSelected = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee6() {
|
2144
|
+
var formatItem, valueList, res;
|
2145
|
+
return regenerator_default().wrap(function _callee6$(_context6) {
|
2146
|
+
while (1) switch (_context6.prev = _context6.next) {
|
2147
|
+
case 0:
|
2148
|
+
formatItem = str2SeletedItem(keyword.value);
|
2149
|
+
valueList = (formatItem === null || formatItem === void 0 ? void 0 : formatItem.values) || [{
|
2150
|
+
id: keyword.value,
|
2151
|
+
name: keyword.value
|
2152
|
+
}];
|
2153
|
+
_context6.next = 4;
|
2154
|
+
return validateUsingItemValues(valueList);
|
2155
|
+
case 4:
|
2156
|
+
res = _context6.sent;
|
2157
|
+
if (res) {
|
2158
|
+
_context6.next = 7;
|
2159
|
+
break;
|
2160
|
+
}
|
2161
|
+
return _context6.abrupt("return");
|
2162
|
+
case 7:
|
2163
|
+
emit('add', formatItem || new SelectedItem(_objectSpread({}, valueList[0]), 'text'));
|
2164
|
+
keyword.value = '';
|
2165
|
+
setMenuList();
|
2166
|
+
return _context6.abrupt("return", true);
|
2167
|
+
case 11:
|
2168
|
+
case "end":
|
2169
|
+
return _context6.stop();
|
2170
|
+
}
|
2171
|
+
}, _callee6);
|
2172
|
+
}));
|
2173
|
+
return _enterNewItemSelected.apply(this, arguments);
|
2174
|
+
}
|
2175
|
+
function enterExistingItemSelected() {
|
2176
|
+
return _enterExistingItemSelected.apply(this, arguments);
|
2177
|
+
}
|
2178
|
+
function _enterExistingItemSelected() {
|
2179
|
+
_enterExistingItemSelected = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee7() {
|
2180
|
+
var valueList, formatItem, isValid;
|
2181
|
+
return regenerator_default().wrap(function _callee7$(_context7) {
|
2182
|
+
while (1) switch (_context7.prev = _context7.next) {
|
2183
|
+
case 0:
|
2184
|
+
valueList = [];
|
2185
|
+
if (usingItem.value.isSpecialType()) {
|
2186
|
+
formatItem = str2SeletedItem(keyword.value);
|
2187
|
+
if (formatItem) {
|
2188
|
+
usingItem.value = formatItem;
|
2189
|
+
valueList = formatItem.values;
|
2190
|
+
}
|
2191
|
+
}
|
2192
|
+
valueList = valueList.length ? valueList : usingItem.value.str2Values(keyword.value);
|
2193
|
+
_context7.next = 5;
|
2194
|
+
return validateUsingItemValues(valueList);
|
2195
|
+
case 5:
|
2196
|
+
isValid = _context7.sent;
|
2197
|
+
if (isValid) {
|
2198
|
+
_context7.next = 8;
|
2199
|
+
break;
|
2200
|
+
}
|
2201
|
+
return _context7.abrupt("return");
|
2202
|
+
case 8:
|
2203
|
+
if (usingItem.value.type === 'text') {
|
2204
|
+
usingItem.value.name = keyword.value;
|
2205
|
+
usingItem.value.id = keyword.value;
|
2206
|
+
} else {
|
2207
|
+
usingItem.value.values = valueList;
|
2208
|
+
}
|
2209
|
+
emit('add', usingItem.value);
|
2210
|
+
keyword.value = '';
|
2211
|
+
usingItem.value = null;
|
2212
|
+
setInputFocus(true);
|
2213
|
+
return _context7.abrupt("return", true);
|
2214
|
+
case 14:
|
2215
|
+
case "end":
|
2216
|
+
return _context7.stop();
|
2217
|
+
}
|
2218
|
+
}, _callee7);
|
2219
|
+
}));
|
2220
|
+
return _enterExistingItemSelected.apply(this, arguments);
|
2221
|
+
}
|
2222
|
+
function setCursorToEnd() {
|
2223
|
+
if (!inputRef.value) return;
|
2224
|
+
var range = document.createRange();
|
2225
|
+
var selection = window.getSelection();
|
2226
|
+
range.selectNodeContents(inputRef.value);
|
2227
|
+
range.collapse(false);
|
2228
|
+
selection.removeAllRanges();
|
2229
|
+
selection.addRange(range);
|
2230
|
+
}
|
2231
|
+
function setInputFocus() {
|
2232
|
+
var refleshMenuList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
2233
|
+
var needCursorToEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
2234
|
+
if (refleshMenuList) {
|
2235
|
+
setTimeout(setMenuList, 16);
|
2236
|
+
}
|
2237
|
+
isFocus.value = true;
|
2238
|
+
showPopover.value = true;
|
2239
|
+
showNoSelectValueError.value = false;
|
2240
|
+
needCursorToEnd && (0,external_vue_namespaceObject.nextTick)(setCursorToEnd);
|
2241
|
+
emit('focus', isFocus.value);
|
2242
|
+
}
|
2044
2243
|
function setSelectedItem(item) {
|
2244
|
+
var _usingItem$value5;
|
2045
2245
|
emit('add', item !== null && item !== void 0 ? item : usingItem.value);
|
2246
|
+
var needCursorToEnd = !((_usingItem$value5 = usingItem.value) !== null && _usingItem$value5 !== void 0 && _usingItem$value5.isCustomMenu);
|
2046
2247
|
usingItem.value = null;
|
2047
2248
|
keyword.value = '';
|
2048
|
-
|
2249
|
+
if (needCursorToEnd) {
|
2250
|
+
setInputFocus(true, needCursorToEnd);
|
2251
|
+
(0,external_vue_namespaceObject.nextTick)(clearInput);
|
2252
|
+
}
|
2049
2253
|
}
|
2050
2254
|
function clearInput() {
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
}
|
2056
|
-
|
2057
|
-
|
2255
|
+
if (!inputRef.value) return;
|
2256
|
+
keyword.value = '';
|
2257
|
+
(0,external_vue_namespaceObject.nextTick)(function () {
|
2258
|
+
return inputRef.value.innerText = '';
|
2259
|
+
});
|
2260
|
+
}
|
2261
|
+
function str2SeletedItem(str) {
|
2262
|
+
var _str$split = str.split(':'),
|
2263
|
+
_str$split2 = _slicedToArray(_str$split, 2),
|
2264
|
+
key = _str$split2[0],
|
2265
|
+
value = _str$split2[1];
|
2266
|
+
if (key !== null && key !== void 0 && key.trim()) {
|
2267
|
+
var selectedItem = searchData.value.find(function (item) {
|
2268
|
+
return item.name === key.trim();
|
2269
|
+
});
|
2270
|
+
if (selectedItem) {
|
2271
|
+
var item = new SelectedItem(_objectSpread({}, selectedItem), 'default');
|
2272
|
+
item.addValues(value);
|
2273
|
+
return item;
|
2274
|
+
}
|
2058
2275
|
}
|
2276
|
+
return undefined;
|
2059
2277
|
}
|
2060
|
-
function
|
2061
|
-
var
|
2062
|
-
if (
|
2063
|
-
|
2064
|
-
|
2278
|
+
function deleteInputTextNode() {
|
2279
|
+
var _keyword$value;
|
2280
|
+
if ((_keyword$value = keyword.value) !== null && _keyword$value !== void 0 && _keyword$value.length) {
|
2281
|
+
keyword.value = '';
|
2282
|
+
var nodes = Array.from(inputRef.value.childNodes);
|
2283
|
+
nodes.forEach(function (node) {
|
2284
|
+
var _node$textContent;
|
2285
|
+
if (node.nodeType === Node.TEXT_NODE && (_node$textContent = node.textContent) !== null && _node$textContent !== void 0 && _node$textContent.trim()) {
|
2286
|
+
inputRef.value.removeChild(node);
|
2287
|
+
}
|
2288
|
+
});
|
2065
2289
|
}
|
2066
2290
|
}
|
2067
|
-
function
|
2068
|
-
|
2069
|
-
|
2291
|
+
function inputFocusForWrapper() {
|
2292
|
+
var _inputRef$value2;
|
2293
|
+
(_inputRef$value2 = inputRef.value) === null || _inputRef$value2 === void 0 || _inputRef$value2.focus();
|
2294
|
+
}
|
2295
|
+
function inputEnterForWrapper() {
|
2296
|
+
return _inputEnterForWrapper.apply(this, arguments);
|
2297
|
+
}
|
2298
|
+
function _inputEnterForWrapper() {
|
2299
|
+
_inputEnterForWrapper = _asyncToGenerator( /*#__PURE__*/regenerator_default().mark(function _callee8() {
|
2300
|
+
return regenerator_default().wrap(function _callee8$(_context8) {
|
2301
|
+
while (1) switch (_context8.prev = _context8.next) {
|
2302
|
+
case 0:
|
2303
|
+
_context8.next = 2;
|
2304
|
+
return handleKeyEnter().then(function (v) {
|
2305
|
+
return v && clearInput();
|
2306
|
+
});
|
2307
|
+
case 2:
|
2308
|
+
showPopover.value = false;
|
2309
|
+
inputRef.value.blur();
|
2310
|
+
case 4:
|
2311
|
+
case "end":
|
2312
|
+
return _context8.stop();
|
2313
|
+
}
|
2314
|
+
}, _callee8);
|
2315
|
+
}));
|
2316
|
+
return _inputEnterForWrapper.apply(this, arguments);
|
2317
|
+
}
|
2318
|
+
function inputClearForWrapper() {
|
2319
|
+
keyword.value = '';
|
2320
|
+
showNoSelectValueError.value = false;
|
2321
|
+
showPopover.value = false;
|
2322
|
+
usingItem.value = null;
|
2323
|
+
(0,external_vue_namespaceObject.nextTick)(clearInput);
|
2324
|
+
}
|
2325
|
+
function customPanelSubmit(value) {
|
2326
|
+
usingItem.value.values = [{
|
2327
|
+
id: value,
|
2328
|
+
name: value
|
2329
|
+
}];
|
2330
|
+
handleKeyEnter().then(function (v) {
|
2331
|
+
return v && clearInput();
|
2332
|
+
});
|
2070
2333
|
}
|
2071
2334
|
// expose
|
2072
2335
|
expose({
|
2336
|
+
inputFocusForWrapper: inputFocusForWrapper,
|
2337
|
+
inputEnterForWrapper: inputEnterForWrapper,
|
2338
|
+
inputClearForWrapper: inputClearForWrapper,
|
2073
2339
|
handleInputFocus: handleInputFocus,
|
2074
2340
|
isFocus: isFocus
|
2075
2341
|
});
|
@@ -2090,12 +2356,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2090
2356
|
handleClickOutside: handleClickOutside,
|
2091
2357
|
handleInputFocus: handleInputFocus,
|
2092
2358
|
handleInputChange: handleInputChange,
|
2359
|
+
handleInputPaste: handleInputPaste,
|
2093
2360
|
handleLogicalChange: handleLogicalChange,
|
2094
2361
|
handleInputKeyup: handleInputKeyup,
|
2095
2362
|
handleSelectItem: handleSelectItem,
|
2096
2363
|
handleSelectCondtionItem: handleSelectCondtionItem,
|
2097
2364
|
handleMenuFooterClick: handleMenuFooterClick,
|
2098
2365
|
resolveClassName: resolveClassName,
|
2366
|
+
inputFocusForWrapper: inputFocusForWrapper,
|
2367
|
+
inputEnterForWrapper: inputEnterForWrapper,
|
2368
|
+
inputClearForWrapper: inputClearForWrapper,
|
2369
|
+
deleteInputTextNode: deleteInputTextNode,
|
2370
|
+
customPanelSubmit: customPanelSubmit,
|
2099
2371
|
t: t
|
2100
2372
|
};
|
2101
2373
|
},
|
@@ -2107,18 +2379,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2107
2379
|
multiple = _ref2.multiple,
|
2108
2380
|
values = _ref2.values,
|
2109
2381
|
placeholder = _ref2.placeholder,
|
2110
|
-
inputInnerHtml = _ref2.inputInnerHtml
|
2382
|
+
inputInnerHtml = _ref2.inputInnerHtml,
|
2383
|
+
isCustomMenu = _ref2.isCustomMenu;
|
2111
2384
|
var showInputAfter = !((_this$keyword = this.keyword) !== null && _this$keyword !== void 0 && _this$keyword.length) && !(values !== null && values !== void 0 && values.length) && placeholder;
|
2112
|
-
var showPopover = this.loading || this.showNoSelectValueError || this.showPopover && !!((_this$menuList = this.menuList) !== null && _this$menuList !== void 0 && _this$menuList.length);
|
2385
|
+
var showPopover = this.loading || this.showNoSelectValueError || this.showPopover && (!!isCustomMenu || !!((_this$menuList = this.menuList) !== null && _this$menuList !== void 0 && _this$menuList.length));
|
2113
2386
|
var showCondition = !this.usingItem && this.showCondition;
|
2114
|
-
var menuSlots = Object.assign({}, this.$slots.menu ? {
|
2115
|
-
"default": function _default(data) {
|
2116
|
-
var _this$$slots$menu, _this$$slots;
|
2117
|
-
return (_this$$slots$menu = (_this$$slots = _this.$slots).menu) === null || _this$$slots$menu === void 0 ? void 0 : _this$$slots$menu.call(_this$$slots, data);
|
2118
|
-
}
|
2119
|
-
} : {});
|
2120
2387
|
var inputContent = function inputContent() {
|
2121
|
-
var _this$keyword2;
|
2388
|
+
var _this$keyword2, _this$usingItem, _this$usingItem2;
|
2122
2389
|
return (0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)("div", {
|
2123
2390
|
"ref": "inputRef",
|
2124
2391
|
"class": {
|
@@ -2130,19 +2397,55 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2130
2397
|
"data-placeholder": !inputInnerHtml && !_this.keyword ? _this.placeholder : '',
|
2131
2398
|
"data-tips": placeholder || '',
|
2132
2399
|
"spellcheck": "false",
|
2400
|
+
"onPaste": _this.handleInputPaste,
|
2133
2401
|
"onFocus": _this.handleInputFocus,
|
2134
2402
|
"onInput": _this.handleInputChange,
|
2135
2403
|
"onKeydown": _this.handleInputKeyup
|
2136
|
-
}, null)
|
2404
|
+
}, [((_this$usingItem = _this.usingItem) === null || _this$usingItem === void 0 ? void 0 : _this$usingItem.name) && (!_this.usingItem.isSpecialType() ? (0,external_vue_namespaceObject.createVNode)("span", {
|
2405
|
+
"data-key": _this.usingItem.name,
|
2406
|
+
"data-type": _this.usingItem.type,
|
2407
|
+
"key": _this.usingItem.nameRenderkey,
|
2408
|
+
"onMousedown": function onMousedown(e) {
|
2409
|
+
return e.preventDefault();
|
2410
|
+
},
|
2411
|
+
"contenteditable": false,
|
2412
|
+
"style": {
|
2413
|
+
color: '#979BA5'
|
2414
|
+
}
|
2415
|
+
}, [_this.usingItem.name, (0,external_vue_namespaceObject.createTextVNode)(":\xA0")]) : (0,external_vue_namespaceObject.createVNode)("span", {
|
2416
|
+
"data-key": _this.usingItem.name,
|
2417
|
+
"data-type": _this.usingItem.type,
|
2418
|
+
"key": _this.usingItem.nameRenderkey
|
2419
|
+
}, [_this.usingItem.name])), (_this$usingItem2 = _this.usingItem) === null || _this$usingItem2 === void 0 || (_this$usingItem2 = _this$usingItem2.values) === null || _this$usingItem2 === void 0 ? void 0 : _this$usingItem2.map(function (item, index) {
|
2420
|
+
return (0,external_vue_namespaceObject.createVNode)("span", {
|
2421
|
+
"key": index,
|
2422
|
+
"data-key": item.name,
|
2423
|
+
"data-type": "value",
|
2424
|
+
"data-id": item.id,
|
2425
|
+
"data-index": index
|
2426
|
+
}, [item.name, index < _this.usingItem.values.length - 1 ? " ".concat(_this.usingItem.logical, " ") : '']);
|
2427
|
+
})]), [[(0,external_vue_namespaceObject.resolveDirective)("clickoutside"), _this.handleClickOutside]]);
|
2137
2428
|
};
|
2138
2429
|
var popoverContent = function popoverContent() {
|
2139
|
-
var _this$menuList2, _this$
|
2430
|
+
var _this$usingItem3, _this$menuList2, _this$usingItem4, _this$usingItem5;
|
2140
2431
|
if (_this.loading) {
|
2141
2432
|
return (0,external_vue_namespaceObject.createVNode)("div", null, [_this.t.loading]);
|
2142
2433
|
}
|
2143
2434
|
if (_this.showNoSelectValueError) {
|
2144
2435
|
return (0,external_vue_namespaceObject.createVNode)("div", null, [_this.t.filterQueryMustHasValue]);
|
2145
2436
|
}
|
2437
|
+
if ((_this$usingItem3 = _this.usingItem) !== null && _this$usingItem3 !== void 0 && _this$usingItem3.isCustomMenu && _this.$slots.menu) {
|
2438
|
+
var _this$usingItem$value;
|
2439
|
+
return (0,external_vue_namespaceObject.createVNode)("div", {
|
2440
|
+
"ref": "popoverRef",
|
2441
|
+
"class": _this.resolveClassName('search-select-popover')
|
2442
|
+
}, [_this.$slots.menu({
|
2443
|
+
value: (_this$usingItem$value = _this.usingItem.values) === null || _this$usingItem$value === void 0 ? void 0 : _this$usingItem$value[0],
|
2444
|
+
id: _this.usingItem.id,
|
2445
|
+
name: _this.usingItem.name,
|
2446
|
+
onSubmit: _this.customPanelSubmit
|
2447
|
+
})]);
|
2448
|
+
}
|
2146
2449
|
return (_this$menuList2 = _this.menuList) !== null && _this$menuList2 !== void 0 && _this$menuList2.length ? (0,external_vue_namespaceObject.createVNode)("div", {
|
2147
2450
|
"ref": "popoverRef",
|
2148
2451
|
"class": _this.resolveClassName('search-select-popover')
|
@@ -2155,13 +2458,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2155
2458
|
return item.id;
|
2156
2459
|
})) || [],
|
2157
2460
|
"conditions": showCondition ? _this.conditions : [],
|
2158
|
-
"logical": (_this$
|
2159
|
-
"showLogical": (_this$
|
2461
|
+
"logical": (_this$usingItem4 = _this.usingItem) === null || _this$usingItem4 === void 0 ? void 0 : _this$usingItem4.logical,
|
2462
|
+
"showLogical": (_this$usingItem5 = _this.usingItem) === null || _this$usingItem5 === void 0 ? void 0 : _this$usingItem5.showLogical,
|
2160
2463
|
"onUpdate:logical": _this.handleLogicalChange,
|
2161
2464
|
"onSelectItem": _this.handleSelectItem,
|
2162
2465
|
"onSelectCondition": _this.handleSelectCondtionItem,
|
2163
2466
|
"onFooterClick": _this.handleMenuFooterClick
|
2164
|
-
},
|
2467
|
+
}, null)]) : undefined;
|
2165
2468
|
};
|
2166
2469
|
return (0,external_vue_namespaceObject.createVNode)(popover_namespaceObject["default"], {
|
2167
2470
|
"trigger": "manual",
|
@@ -2178,6 +2481,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2178
2481
|
}));
|
2179
2482
|
;// CONCATENATED MODULE: ../../packages/search-select/src/selected.tsx
|
2180
2483
|
|
2484
|
+
|
2485
|
+
function selected_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
2486
|
+
function selected_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? selected_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : selected_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
2181
2487
|
/*
|
2182
2488
|
* Tencent is pleased to support the open source community by making
|
2183
2489
|
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
@@ -2232,10 +2538,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2232
2538
|
validateValues: Function,
|
2233
2539
|
valueBehavior: String
|
2234
2540
|
},
|
2235
|
-
emits: ['delete'],
|
2541
|
+
emits: ['delete', 'selectKey'],
|
2236
2542
|
setup: function setup(_props, _ref) {
|
2237
2543
|
var emit = _ref.emit;
|
2238
2544
|
var inputRef = (0,external_vue_namespaceObject.ref)(null);
|
2545
|
+
var selectedInputRef = (0,external_vue_namespaceObject.ref)(null);
|
2239
2546
|
var _useSearchSelectInjec = useSearchSelectInject(),
|
2240
2547
|
onEditClick = _useSearchSelectInjec.onEditClick,
|
2241
2548
|
onEditEnter = _useSearchSelectInjec.onEditEnter,
|
@@ -2248,6 +2555,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2248
2555
|
e.preventDefault();
|
2249
2556
|
e.stopPropagation();
|
2250
2557
|
onEditClick(item, index);
|
2558
|
+
emit('selectKey', {
|
2559
|
+
id: item.id,
|
2560
|
+
name: item.name,
|
2561
|
+
values: item.values.slice()
|
2562
|
+
});
|
2251
2563
|
// magic code
|
2252
2564
|
setTimeout(function () {
|
2253
2565
|
return inputRef.value.handleInputFocus();
|
@@ -2260,8 +2572,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2260
2572
|
if (isFocus) return;
|
2261
2573
|
onEditBlur();
|
2262
2574
|
}
|
2263
|
-
function handleInputOutside() {
|
2264
|
-
|
2575
|
+
function handleInputOutside(target) {
|
2576
|
+
var _selectedInputRef$val;
|
2577
|
+
return !((_selectedInputRef$val = selectedInputRef.value) !== null && _selectedInputRef$val !== void 0 && _selectedInputRef$val.contains(target));
|
2265
2578
|
}
|
2266
2579
|
function copySeletedItem(item) {
|
2267
2580
|
var newItem = new SelectedItem(item.searchItem, item.type);
|
@@ -2271,6 +2584,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2271
2584
|
}
|
2272
2585
|
return {
|
2273
2586
|
inputRef: inputRef,
|
2587
|
+
selectedInputRef: selectedInputRef,
|
2274
2588
|
editKey: editKey,
|
2275
2589
|
copySeletedItem: copySeletedItem,
|
2276
2590
|
handleDeleteSelected: handleDeleteSelected,
|
@@ -2285,7 +2599,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2285
2599
|
var contentComponent = function contentComponent(item, index) {
|
2286
2600
|
return _this.editKey === "".concat(item.id, "_").concat(index) ? (0,external_vue_namespaceObject.createVNode)("div", {
|
2287
2601
|
"class": "selected-input",
|
2288
|
-
"key": _this.editKey.toString()
|
2602
|
+
"key": _this.editKey.toString(),
|
2603
|
+
"ref": "selectedInputRef"
|
2289
2604
|
}, [(0,external_vue_namespaceObject.createVNode)(input, {
|
2290
2605
|
"ref": "inputRef",
|
2291
2606
|
"key": _this.editKey.toString(),
|
@@ -2302,7 +2617,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
2302
2617
|
return _this.handleAddSelected(v, index);
|
2303
2618
|
},
|
2304
2619
|
"onFocus": _this.handleInputFocus
|
2305
|
-
},
|
2620
|
+
}, selected_objectSpread({}, _this.$slots))]) : (0,external_vue_namespaceObject.createVNode)("li", {
|
2306
2621
|
"class": "search-container-selected ".concat(!(_this.overflowIndex >= 0 ? index < _this.overflowIndex : index >= 0) ? 'hidden-selected' : ''),
|
2307
2622
|
"key": "".concat(item.id, "_").concat(index)
|
2308
2623
|
}, [(0,external_vue_namespaceObject.createVNode)("span", {
|
@@ -2414,6 +2729,13 @@ var SearchSelectProps = {
|
|
2414
2729
|
return [ValueBehavior.ALL, ValueBehavior.NEEDKEY].includes(v);
|
2415
2730
|
}
|
2416
2731
|
}
|
2732
|
+
// deleteBehavior: {
|
2733
|
+
// type: String as PropType<`${DeleteBehavior}`>,
|
2734
|
+
// default: DeleteBehavior.CHAR,
|
2735
|
+
// validator(v: DeleteBehavior) {
|
2736
|
+
// return [DeleteBehavior.CHAR, DeleteBehavior.VALUE].includes(v);
|
2737
|
+
// },
|
2738
|
+
// },
|
2417
2739
|
};
|
2418
2740
|
/* harmony default export */ const search_select = ((0,external_vue_namespaceObject.defineComponent)({
|
2419
2741
|
name: 'SearchSelect',
|
@@ -2421,7 +2743,8 @@ var SearchSelectProps = {
|
|
2421
2743
|
clickoutside: directives_namespaceObject.clickoutside
|
2422
2744
|
},
|
2423
2745
|
props: SearchSelectProps,
|
2424
|
-
emits: ['update:modelValue', 'search'],
|
2746
|
+
emits: ['update:modelValue', 'search', 'selectKey'],
|
2747
|
+
slots: Object,
|
2425
2748
|
setup: function setup(props, _ref) {
|
2426
2749
|
var emit = _ref.emit;
|
2427
2750
|
var t = (0,config_provider_namespaceObject.useLocale)('searchSelect');
|
@@ -2529,7 +2852,11 @@ var SearchSelectProps = {
|
|
2529
2852
|
onEditEnter: onEditEnter,
|
2530
2853
|
onEditBlur: onEditBlur,
|
2531
2854
|
onValidate: onValidate,
|
2532
|
-
editKey: editKey
|
2855
|
+
editKey: editKey,
|
2856
|
+
searchData: (0,external_vue_namespaceObject.computed)(function () {
|
2857
|
+
return props.data;
|
2858
|
+
}),
|
2859
|
+
isClickOutside: handleInputOutside
|
2533
2860
|
});
|
2534
2861
|
function onEditClick(item, index) {
|
2535
2862
|
editKey.value = "".concat(item.id, "_").concat(index);
|
@@ -2581,12 +2908,13 @@ var SearchSelectProps = {
|
|
2581
2908
|
}
|
2582
2909
|
function handleWrapClick() {
|
2583
2910
|
if (!editKey.value) {
|
2584
|
-
inputRef.value.
|
2911
|
+
inputRef.value.inputFocusForWrapper();
|
2585
2912
|
}
|
2586
2913
|
}
|
2587
2914
|
function handleClearAll() {
|
2588
2915
|
selectedList.value = [];
|
2589
2916
|
overflowIndex.value = -1;
|
2917
|
+
inputRef.value.inputClearForWrapper();
|
2590
2918
|
emit('update:modelValue', []);
|
2591
2919
|
}
|
2592
2920
|
function handleInputOutside(target) {
|
@@ -2618,8 +2946,12 @@ var SearchSelectProps = {
|
|
2618
2946
|
isFocus.value = v;
|
2619
2947
|
}
|
2620
2948
|
function handleClickSearch(e) {
|
2949
|
+
inputRef.value.inputEnterForWrapper();
|
2621
2950
|
emit('search', e);
|
2622
2951
|
}
|
2952
|
+
function handleSelectedKey(a) {
|
2953
|
+
emit('selectKey', a);
|
2954
|
+
}
|
2623
2955
|
return {
|
2624
2956
|
inputRef: inputRef,
|
2625
2957
|
wrapRef: wrapRef,
|
@@ -2640,6 +2972,7 @@ var SearchSelectProps = {
|
|
2640
2972
|
handleClickSearch: handleClickSearch,
|
2641
2973
|
localConditions: localConditions,
|
2642
2974
|
resolveClassName: resolveClassName,
|
2975
|
+
handleSelectedKey: handleSelectedKey,
|
2643
2976
|
t: t
|
2644
2977
|
};
|
2645
2978
|
},
|
@@ -2677,7 +3010,8 @@ var SearchSelectProps = {
|
|
2677
3010
|
"getMenuList": this.getMenuList,
|
2678
3011
|
"validateValues": this.validateValues,
|
2679
3012
|
"valueBehavior": this.valueBehavior,
|
2680
|
-
"onDelete": this.handleDeleteSelected
|
3013
|
+
"onDelete": this.handleDeleteSelected,
|
3014
|
+
"onSelectKey": this.handleSelectedKey
|
2681
3015
|
}, search_select_objectSpread({}, menuSlots)), (0,external_vue_namespaceObject.createVNode)("div", {
|
2682
3016
|
"class": "search-container-input"
|
2683
3017
|
}, [(0,external_vue_namespaceObject.createVNode)(input, {
|
@@ -2693,7 +3027,8 @@ var SearchSelectProps = {
|
|
2693
3027
|
"valueBehavior": this.valueBehavior,
|
2694
3028
|
"onAdd": this.handleAddSelected,
|
2695
3029
|
"onDelete": this.handleDeleteSelected,
|
2696
|
-
"onFocus": this.handleInputFocus
|
3030
|
+
"onFocus": this.handleInputFocus,
|
3031
|
+
"onSelectKey": this.handleSelectedKey
|
2697
3032
|
}, search_select_objectSpread({}, menuSlots))])]), (0,external_vue_namespaceObject.createVNode)("div", {
|
2698
3033
|
"class": "search-nextfix"
|
2699
3034
|
}, [this.clearable && !!this.selectedList.length && (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.Close, {
|