vue-devui 1.4.0 → 1.5.0
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/collapse/style.css +1 -1
- package/editable-select/index.es.js +6491 -588
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/modal/index.es.js +10 -5
- package/modal/index.umd.js +1 -1
- package/nuxt/components/SELECT_KEY.js +3 -0
- package/package.json +1 -1
- package/search/index.es.js +1 -0
- package/search/index.umd.js +1 -1
- package/style.css +1 -1
- package/tabs/index.es.js +7 -5
- package/tabs/index.umd.js +1 -1
- package/types/editable-select/__tests__/{editable-select.spec.d.ts → basic-editable-select.spec.d.ts} +0 -0
- package/types/editable-select/__tests__/clearable-editable-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/custom-template-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/disabled-editable-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/event-editable-select.spec.d.ts +1 -0
- package/types/editable-select/__tests__/search-filter-select.spec.d.ts +1 -0
- package/types/editable-select/src/components/dropdown/dropdown-types.d.ts +15 -0
- package/types/editable-select/src/components/dropdown/dropdown.d.ts +2 -0
- package/types/editable-select/src/components/option/option-types.d.ts +18 -0
- package/types/editable-select/src/components/option/option.d.ts +37 -0
- package/types/editable-select/src/composables/use-input-event.d.ts +14 -0
- package/types/editable-select/src/composables/use-input-render.d.ts +12 -0
- package/types/editable-select/src/composables/use-keyboard-select.d.ts +6 -6
- package/types/editable-select/src/composables/use-lazy-load.d.ts +3 -2
- package/types/editable-select/src/composables/use-option.d.ts +7 -0
- package/types/editable-select/src/composables/use-select.d.ts +24 -4
- package/types/editable-select/src/editable-select-types.d.ts +53 -18
- package/types/editable-select/src/editable-select.d.ts +130 -1
- package/types/form/__tests__/form-item-input.spec.d.ts +1 -0
- package/types/select/src/select.d.ts +1 -1
- package/vue-devui.es.js +605 -304
- package/vue-devui.umd.js +14 -14
- package/types/editable-select/src/composables/use-cache-filtered-options.d.ts +0 -7
- package/types/editable-select/src/composables/use-filter-options.d.ts +0 -7
- package/types/editable-select/src/composables/use-input.d.ts +0 -6
- package/types/editable-select/src/utils/index.d.ts +0 -9
- package/types/form/__tests__/form-item.spec.d.ts +0 -0
package/vue-devui.es.js
CHANGED
|
@@ -420,7 +420,7 @@ var DAccordionItemHreflink = defineComponent({
|
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
422
|
});
|
|
423
|
-
function _isSlot$
|
|
423
|
+
function _isSlot$c(s) {
|
|
424
424
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
425
425
|
}
|
|
426
426
|
var DAccordionItemRouterlink = defineComponent({
|
|
@@ -507,7 +507,7 @@ var DAccordionItemRouterlink = defineComponent({
|
|
|
507
507
|
parent: parentValue,
|
|
508
508
|
event: e
|
|
509
509
|
})
|
|
510
|
-
}, _isSlot$
|
|
510
|
+
}, _isSlot$c(_slot = renderContent()) ? _slot : {
|
|
511
511
|
default: () => [_slot]
|
|
512
512
|
}), !isUsedVueRouter.value && createVNode("a", {
|
|
513
513
|
"href": link.value,
|
|
@@ -10156,7 +10156,7 @@ var IconInstall = {
|
|
|
10156
10156
|
app.component(IconGroup.name, IconGroup);
|
|
10157
10157
|
}
|
|
10158
10158
|
};
|
|
10159
|
-
function _isSlot$
|
|
10159
|
+
function _isSlot$b(s) {
|
|
10160
10160
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
10161
10161
|
}
|
|
10162
10162
|
var AutoComplete = defineComponent({
|
|
@@ -10273,7 +10273,7 @@ var AutoComplete = defineComponent({
|
|
|
10273
10273
|
${width.value + "px"}
|
|
10274
10274
|
`
|
|
10275
10275
|
}
|
|
10276
|
-
}, [createVNode(DAutoCompleteDropdown, null, _isSlot$
|
|
10276
|
+
}, [createVNode(DAutoCompleteDropdown, null, _isSlot$b(_slot = customRenderSolts()) ? _slot : {
|
|
10277
10277
|
default: () => [_slot]
|
|
10278
10278
|
})])]
|
|
10279
10279
|
})]
|
|
@@ -10284,7 +10284,7 @@ var AutoComplete = defineComponent({
|
|
|
10284
10284
|
let _slot2;
|
|
10285
10285
|
return createVNode(Teleport, {
|
|
10286
10286
|
"to": "body"
|
|
10287
|
-
}, _isSlot$
|
|
10287
|
+
}, _isSlot$b(_slot2 = renderBasicDropdown()) ? _slot2 : {
|
|
10288
10288
|
default: () => [_slot2]
|
|
10289
10289
|
});
|
|
10290
10290
|
} else {
|
|
@@ -10866,7 +10866,7 @@ const breadcrumbItemProps = {
|
|
|
10866
10866
|
}
|
|
10867
10867
|
};
|
|
10868
10868
|
var breadcrumbItem = "";
|
|
10869
|
-
const dropdownProps = {
|
|
10869
|
+
const dropdownProps$1 = {
|
|
10870
10870
|
visible: {
|
|
10871
10871
|
type: Boolean,
|
|
10872
10872
|
default: false
|
|
@@ -11066,10 +11066,10 @@ function useOverlayProps(props, currentPosition, isOpen) {
|
|
|
11066
11066
|
}
|
|
11067
11067
|
var dropdown = "";
|
|
11068
11068
|
let dropdownId = 1;
|
|
11069
|
-
var Dropdown = defineComponent({
|
|
11069
|
+
var Dropdown$1 = defineComponent({
|
|
11070
11070
|
name: "DDropdown",
|
|
11071
11071
|
inheritAttrs: false,
|
|
11072
|
-
props: dropdownProps,
|
|
11072
|
+
props: dropdownProps$1,
|
|
11073
11073
|
emits: ["toggle"],
|
|
11074
11074
|
setup(props, {
|
|
11075
11075
|
slots,
|
|
@@ -11160,7 +11160,7 @@ var Dropdown = defineComponent({
|
|
|
11160
11160
|
var BreadcrumbItem = defineComponent({
|
|
11161
11161
|
name: "DBreadcrumbItem",
|
|
11162
11162
|
components: {
|
|
11163
|
-
DDropdown: Dropdown
|
|
11163
|
+
DDropdown: Dropdown$1
|
|
11164
11164
|
},
|
|
11165
11165
|
props: breadcrumbItemProps,
|
|
11166
11166
|
setup(props, {
|
|
@@ -13037,7 +13037,7 @@ const inputProps = {
|
|
|
13037
13037
|
default: ""
|
|
13038
13038
|
}
|
|
13039
13039
|
};
|
|
13040
|
-
function useInputRender(props, ctx2) {
|
|
13040
|
+
function useInputRender$1(props, ctx2) {
|
|
13041
13041
|
const formContext = inject(FORM_TOKEN, void 0);
|
|
13042
13042
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
13043
13043
|
const isValidateError = computed(() => (formItemContext == null ? void 0 : formItemContext.validateState) === "error");
|
|
@@ -13069,7 +13069,7 @@ function useInputRender(props, ctx2) {
|
|
|
13069
13069
|
]);
|
|
13070
13070
|
return { inputDisabled, inputSize, isFocus, wrapClasses, inputClasses, customStyle, otherAttrs };
|
|
13071
13071
|
}
|
|
13072
|
-
function useInputEvent(isFocus, props, ctx2, focus) {
|
|
13072
|
+
function useInputEvent$1(isFocus, props, ctx2, focus) {
|
|
13073
13073
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
13074
13074
|
const onFocus = (e) => {
|
|
13075
13075
|
isFocus.value = true;
|
|
@@ -13109,11 +13109,11 @@ function useInputFunction(input2) {
|
|
|
13109
13109
|
var _a;
|
|
13110
13110
|
(_a = refInput.value) == null ? void 0 : _a.focus();
|
|
13111
13111
|
};
|
|
13112
|
-
const
|
|
13112
|
+
const blur2 = () => {
|
|
13113
13113
|
var _a;
|
|
13114
13114
|
(_a = refInput.value) == null ? void 0 : _a.blur();
|
|
13115
13115
|
};
|
|
13116
|
-
return { select: select2, focus, blur };
|
|
13116
|
+
return { select: select2, focus, blur: blur2 };
|
|
13117
13117
|
}
|
|
13118
13118
|
var input = "";
|
|
13119
13119
|
var DInput = defineComponent({
|
|
@@ -13138,12 +13138,12 @@ var DInput = defineComponent({
|
|
|
13138
13138
|
inputClasses,
|
|
13139
13139
|
customStyle,
|
|
13140
13140
|
otherAttrs
|
|
13141
|
-
} = useInputRender(props, ctx2);
|
|
13141
|
+
} = useInputRender$1(props, ctx2);
|
|
13142
13142
|
const input2 = shallowRef();
|
|
13143
13143
|
const {
|
|
13144
13144
|
select: select2,
|
|
13145
13145
|
focus,
|
|
13146
|
-
blur
|
|
13146
|
+
blur: blur2
|
|
13147
13147
|
} = useInputFunction(input2);
|
|
13148
13148
|
const {
|
|
13149
13149
|
onFocus,
|
|
@@ -13152,11 +13152,11 @@ var DInput = defineComponent({
|
|
|
13152
13152
|
onChange,
|
|
13153
13153
|
onKeydown,
|
|
13154
13154
|
onClear
|
|
13155
|
-
} = useInputEvent(isFocus, props, ctx2, focus);
|
|
13155
|
+
} = useInputEvent$1(isFocus, props, ctx2, focus);
|
|
13156
13156
|
const passwordVisible = ref(false);
|
|
13157
13157
|
const clickPasswordIcon = () => {
|
|
13158
13158
|
passwordVisible.value = !passwordVisible.value;
|
|
13159
|
-
|
|
13159
|
+
blur2();
|
|
13160
13160
|
};
|
|
13161
13161
|
const prefixVisible = ctx2.slots.prefix || props.prefix;
|
|
13162
13162
|
const suffixVisible = ctx2.slots.suffix || props.suffix || props.showPassword || props.clearable;
|
|
@@ -13173,7 +13173,7 @@ var DInput = defineComponent({
|
|
|
13173
13173
|
ctx2.expose({
|
|
13174
13174
|
select: select2,
|
|
13175
13175
|
focus,
|
|
13176
|
-
blur
|
|
13176
|
+
blur: blur2
|
|
13177
13177
|
});
|
|
13178
13178
|
return () => {
|
|
13179
13179
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -13800,10 +13800,12 @@ var TabNav = defineComponent({
|
|
|
13800
13800
|
}
|
|
13801
13801
|
});
|
|
13802
13802
|
watch(() => props.modelValue, () => {
|
|
13803
|
-
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13803
|
+
nextTick(() => {
|
|
13804
|
+
const tab2 = tabsList.value.find((item) => item.props.id === props.modelValue);
|
|
13805
|
+
if (tab2) {
|
|
13806
|
+
activeClick(tab2);
|
|
13807
|
+
}
|
|
13808
|
+
});
|
|
13807
13809
|
});
|
|
13808
13810
|
return () => {
|
|
13809
13811
|
const closeIconEl = (item) => {
|
|
@@ -18068,7 +18070,7 @@ var ScrollBar = defineComponent({
|
|
|
18068
18070
|
};
|
|
18069
18071
|
}
|
|
18070
18072
|
});
|
|
18071
|
-
function _isSlot$
|
|
18073
|
+
function _isSlot$a(s) {
|
|
18072
18074
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
18073
18075
|
}
|
|
18074
18076
|
const Item = ({
|
|
@@ -18100,7 +18102,7 @@ function renderChildren(list2, startIndex, endIndex, setNodeRef, {
|
|
|
18100
18102
|
return createVNode(Item, {
|
|
18101
18103
|
"key": key,
|
|
18102
18104
|
"setRef": (ele) => setNodeRef(item, ele)
|
|
18103
|
-
}, _isSlot$
|
|
18105
|
+
}, _isSlot$a(node) ? node : {
|
|
18104
18106
|
default: () => [node]
|
|
18105
18107
|
});
|
|
18106
18108
|
});
|
|
@@ -19654,7 +19656,7 @@ function useDatePicker(props, ctx2) {
|
|
|
19654
19656
|
onChangeRangeFocusType
|
|
19655
19657
|
};
|
|
19656
19658
|
}
|
|
19657
|
-
function _isSlot$
|
|
19659
|
+
function _isSlot$9(s) {
|
|
19658
19660
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
19659
19661
|
}
|
|
19660
19662
|
var DatePickerProPanel = defineComponent({
|
|
@@ -19706,7 +19708,7 @@ var DatePickerProPanel = defineComponent({
|
|
|
19706
19708
|
}, [createVNode(DButton, {
|
|
19707
19709
|
"variant": "solid",
|
|
19708
19710
|
"onClick": handlerConfirm
|
|
19709
|
-
}, _isSlot$
|
|
19711
|
+
}, _isSlot$9(_slot = t("ok")) ? _slot : {
|
|
19710
19712
|
default: () => [_slot]
|
|
19711
19713
|
})])])]);
|
|
19712
19714
|
};
|
|
@@ -20451,7 +20453,7 @@ var Drawer = defineComponent({
|
|
|
20451
20453
|
});
|
|
20452
20454
|
}
|
|
20453
20455
|
});
|
|
20454
|
-
function _isSlot$
|
|
20456
|
+
function _isSlot$8(s) {
|
|
20455
20457
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
20456
20458
|
}
|
|
20457
20459
|
const defaultOptions$2 = {
|
|
@@ -20478,7 +20480,7 @@ function initInstance$2(state) {
|
|
|
20478
20480
|
});
|
|
20479
20481
|
return () => createVNode(Drawer, mergeProps(state, {
|
|
20480
20482
|
"onUpdate:modelValue": handleVisibleChange
|
|
20481
|
-
}), _isSlot$
|
|
20483
|
+
}), _isSlot$8(content2) ? content2 : {
|
|
20482
20484
|
default: () => [content2]
|
|
20483
20485
|
});
|
|
20484
20486
|
}
|
|
@@ -20612,127 +20614,277 @@ var DropdownInstall = {
|
|
|
20612
20614
|
category: "\u5BFC\u822A",
|
|
20613
20615
|
status: "50%",
|
|
20614
20616
|
install(app) {
|
|
20615
|
-
app.component(Dropdown.name, Dropdown);
|
|
20617
|
+
app.component(Dropdown$1.name, Dropdown$1);
|
|
20616
20618
|
app.component(DropdownMenu.name, DropdownMenu);
|
|
20617
20619
|
}
|
|
20618
20620
|
};
|
|
20619
20621
|
const editableSelectProps = {
|
|
20620
20622
|
modelValue: {
|
|
20621
|
-
type: String,
|
|
20622
|
-
|
|
20623
|
+
type: [String, Number]
|
|
20624
|
+
},
|
|
20625
|
+
appendToBody: {
|
|
20626
|
+
type: Boolean,
|
|
20627
|
+
default: false
|
|
20628
|
+
},
|
|
20629
|
+
position: {
|
|
20630
|
+
type: Array,
|
|
20631
|
+
default: ["bottom"]
|
|
20623
20632
|
},
|
|
20624
20633
|
options: {
|
|
20625
20634
|
type: Array,
|
|
20626
20635
|
default: () => []
|
|
20627
20636
|
},
|
|
20637
|
+
width: {
|
|
20638
|
+
type: Number
|
|
20639
|
+
},
|
|
20640
|
+
maxHeight: {
|
|
20641
|
+
type: Number
|
|
20642
|
+
},
|
|
20643
|
+
size: {
|
|
20644
|
+
type: String
|
|
20645
|
+
},
|
|
20646
|
+
placeholder: {
|
|
20647
|
+
type: String,
|
|
20648
|
+
default: "Select"
|
|
20649
|
+
},
|
|
20650
|
+
loading: {
|
|
20651
|
+
type: Boolean,
|
|
20652
|
+
default: false
|
|
20653
|
+
},
|
|
20628
20654
|
allowClear: {
|
|
20629
20655
|
type: Boolean,
|
|
20630
20656
|
default: false
|
|
20631
20657
|
},
|
|
20632
20658
|
disabled: {
|
|
20633
|
-
type: Boolean
|
|
20659
|
+
type: Boolean,
|
|
20660
|
+
default: false
|
|
20634
20661
|
},
|
|
20635
20662
|
disabledKey: {
|
|
20636
20663
|
type: String,
|
|
20637
20664
|
default: ""
|
|
20638
20665
|
},
|
|
20639
|
-
|
|
20640
|
-
type:
|
|
20641
|
-
default:
|
|
20666
|
+
remote: {
|
|
20667
|
+
type: Boolean,
|
|
20668
|
+
default: false
|
|
20669
|
+
},
|
|
20670
|
+
filterMethod: {
|
|
20671
|
+
type: Function
|
|
20672
|
+
},
|
|
20673
|
+
remoteMethod: {
|
|
20674
|
+
type: Function
|
|
20675
|
+
},
|
|
20676
|
+
enableLazyLoad: {
|
|
20677
|
+
type: Boolean,
|
|
20678
|
+
default: false
|
|
20679
|
+
}
|
|
20680
|
+
};
|
|
20681
|
+
const SELECT_KEY = Symbol("EditableSelect");
|
|
20682
|
+
const dropdownProps = {
|
|
20683
|
+
options: {
|
|
20684
|
+
type: Array,
|
|
20685
|
+
default: () => []
|
|
20642
20686
|
},
|
|
20643
20687
|
width: {
|
|
20644
20688
|
type: Number
|
|
20645
20689
|
},
|
|
20646
20690
|
maxHeight: {
|
|
20647
20691
|
type: Number
|
|
20692
|
+
}
|
|
20693
|
+
};
|
|
20694
|
+
const editableSelectOptionProps = {
|
|
20695
|
+
label: {
|
|
20696
|
+
type: String
|
|
20648
20697
|
},
|
|
20649
|
-
|
|
20650
|
-
type:
|
|
20698
|
+
value: {
|
|
20699
|
+
type: [String, Number]
|
|
20651
20700
|
},
|
|
20652
|
-
|
|
20701
|
+
disabled: {
|
|
20653
20702
|
type: Boolean,
|
|
20654
20703
|
default: false
|
|
20655
20704
|
},
|
|
20656
|
-
|
|
20657
|
-
type:
|
|
20705
|
+
hovering: {
|
|
20706
|
+
type: Boolean,
|
|
20707
|
+
default: false
|
|
20658
20708
|
}
|
|
20659
20709
|
};
|
|
20660
|
-
function
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
|
|
20664
|
-
|
|
20665
|
-
|
|
20666
|
-
|
|
20667
|
-
|
|
20710
|
+
function useOption$1(props) {
|
|
20711
|
+
const ns2 = useNamespace("editable-select");
|
|
20712
|
+
const select2 = inject(SELECT_KEY);
|
|
20713
|
+
const { disabled, hovering } = toRefs(props);
|
|
20714
|
+
const isSelected = computed(() => {
|
|
20715
|
+
var _a;
|
|
20716
|
+
return ((_a = select2 == null ? void 0 : select2.modelValue) == null ? void 0 : _a.value) === props.value;
|
|
20717
|
+
});
|
|
20718
|
+
const optionClasses = computed(() => ({
|
|
20719
|
+
[ns2.e("item")]: true,
|
|
20720
|
+
[ns2.em("item", "selected")]: isSelected.value,
|
|
20721
|
+
[ns2.em("item", "disabled")]: disabled.value,
|
|
20722
|
+
[ns2.em("item", "hover")]: hovering.value,
|
|
20723
|
+
[ns2.em("item", "no-data-tip")]: !(props.label || props.value)
|
|
20724
|
+
}));
|
|
20725
|
+
return { optionClasses };
|
|
20668
20726
|
}
|
|
20669
|
-
var
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
|
|
20677
|
-
|
|
20678
|
-
|
|
20679
|
-
|
|
20680
|
-
|
|
20681
|
-
label: String(option2),
|
|
20682
|
-
value: option2
|
|
20683
|
-
};
|
|
20727
|
+
var Option$1 = defineComponent({
|
|
20728
|
+
name: "DEditableSelectOption",
|
|
20729
|
+
props: editableSelectOptionProps,
|
|
20730
|
+
emits: ["select"],
|
|
20731
|
+
setup(props, ctx2) {
|
|
20732
|
+
const {
|
|
20733
|
+
optionClasses
|
|
20734
|
+
} = useOption$1(props);
|
|
20735
|
+
const currentLabel = computed(() => props.label || props.value);
|
|
20736
|
+
const handleClick = () => {
|
|
20737
|
+
if (!props.disabled) {
|
|
20738
|
+
ctx2.emit("select");
|
|
20684
20739
|
}
|
|
20685
|
-
|
|
20686
|
-
|
|
20740
|
+
};
|
|
20741
|
+
return () => {
|
|
20742
|
+
return createVNode("li", {
|
|
20743
|
+
"class": optionClasses.value,
|
|
20744
|
+
"onClick": handleClick
|
|
20745
|
+
}, [ctx2.slots.default ? ctx2.slots.default() : currentLabel.value]);
|
|
20746
|
+
};
|
|
20747
|
+
}
|
|
20748
|
+
});
|
|
20749
|
+
var Dropdown = defineComponent({
|
|
20750
|
+
name: "DEditableSelectDropdown",
|
|
20751
|
+
directives: {
|
|
20752
|
+
Loading: LoadingDirective
|
|
20753
|
+
},
|
|
20754
|
+
props: dropdownProps,
|
|
20755
|
+
setup(props, {
|
|
20756
|
+
slots
|
|
20757
|
+
}) {
|
|
20758
|
+
const ns2 = useNamespace("editable-select");
|
|
20759
|
+
const {
|
|
20760
|
+
width,
|
|
20761
|
+
maxHeight
|
|
20762
|
+
} = toRefs(props);
|
|
20763
|
+
const select2 = inject(SELECT_KEY);
|
|
20764
|
+
const {
|
|
20765
|
+
dropdownRef,
|
|
20766
|
+
hoveringIndex,
|
|
20767
|
+
handleOptionSelect,
|
|
20768
|
+
loadMore,
|
|
20769
|
+
emptyText
|
|
20770
|
+
} = select2;
|
|
20771
|
+
const isHovering = (index2) => {
|
|
20772
|
+
return hoveringIndex.value === index2;
|
|
20773
|
+
};
|
|
20774
|
+
const isDisabled = (option2) => {
|
|
20775
|
+
return select2.disabledKey ? !!option2[select2.disabledKey] : false;
|
|
20776
|
+
};
|
|
20777
|
+
const debounceLoadMore = lodash.exports.debounce(loadMore, 300);
|
|
20778
|
+
const onScroll2 = () => {
|
|
20779
|
+
debounceLoadMore();
|
|
20780
|
+
};
|
|
20781
|
+
const renderOption = () => {
|
|
20782
|
+
if (props.options.length === 0) {
|
|
20783
|
+
return createVNode("li", {
|
|
20784
|
+
"class": ns2.em("item", "no-data-tip")
|
|
20785
|
+
}, [slots.noResultItem ? slots.noResultItem() : emptyText.value]);
|
|
20786
|
+
}
|
|
20787
|
+
return props.options.map((option2, index2) => {
|
|
20788
|
+
return createVNode(Option$1, {
|
|
20789
|
+
"label": option2.label,
|
|
20790
|
+
"value": option2.value,
|
|
20791
|
+
"hovering": isHovering(index2),
|
|
20792
|
+
"disabled": isDisabled(option2),
|
|
20793
|
+
"onSelect": () => {
|
|
20794
|
+
handleOptionSelect(option2, true);
|
|
20795
|
+
}
|
|
20796
|
+
}, slots.item ? {
|
|
20797
|
+
default: () => renderSlot(useSlots(), "item", {
|
|
20798
|
+
option: option2,
|
|
20799
|
+
index: index2
|
|
20800
|
+
})
|
|
20801
|
+
} : {});
|
|
20802
|
+
});
|
|
20803
|
+
};
|
|
20804
|
+
return () => {
|
|
20805
|
+
return withDirectives(createVNode("div", {
|
|
20806
|
+
"class": ns2.e("dropdown"),
|
|
20807
|
+
"style": {
|
|
20808
|
+
width: `${width == null ? void 0 : width.value}px`
|
|
20809
|
+
}
|
|
20810
|
+
}, [createVNode("div", {
|
|
20811
|
+
"ref": dropdownRef,
|
|
20812
|
+
"class": ns2.e("inner"),
|
|
20813
|
+
"style": {
|
|
20814
|
+
maxHeight: `${maxHeight == null ? void 0 : maxHeight.value}px`
|
|
20815
|
+
},
|
|
20816
|
+
"onScroll": onScroll2
|
|
20817
|
+
}, [renderOption()])]), [[resolveDirective("loading"), select2.loading.value]]);
|
|
20818
|
+
};
|
|
20819
|
+
}
|
|
20820
|
+
});
|
|
20821
|
+
function useSelectStates() {
|
|
20822
|
+
return reactive({
|
|
20823
|
+
hoveringIndex: -1,
|
|
20824
|
+
selectedIndex: -1,
|
|
20825
|
+
query: "",
|
|
20826
|
+
inputValue: "",
|
|
20827
|
+
selectedLabel: "",
|
|
20828
|
+
isFocus: false,
|
|
20829
|
+
visible: false,
|
|
20830
|
+
softFocus: false,
|
|
20831
|
+
isSilentBlur: false,
|
|
20832
|
+
inputHovering: false
|
|
20687
20833
|
});
|
|
20688
|
-
return { normalizeOptions: normalizeOptions2 };
|
|
20689
20834
|
}
|
|
20690
|
-
function
|
|
20835
|
+
function useSelect$3(dropdownRef, props, states, setSoftFocus, ctx2) {
|
|
20836
|
+
const app = getCurrentInstance();
|
|
20837
|
+
const t = createI18nTranslate("DEditableSelect", app);
|
|
20838
|
+
const cachedOptions = ref(props.options);
|
|
20691
20839
|
const filteredOptions = computed(() => {
|
|
20692
|
-
|
|
20693
|
-
return
|
|
20694
|
-
}
|
|
20695
|
-
return normalizeOptions2.value.filter((option2) => {
|
|
20696
|
-
return searchFn(option2, inputValue.value);
|
|
20840
|
+
return cachedOptions.value.filter((option2) => {
|
|
20841
|
+
return option2.label.toLocaleLowerCase().includes(states.query.toLocaleLowerCase().trim());
|
|
20697
20842
|
});
|
|
20698
20843
|
});
|
|
20699
|
-
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
|
|
20703
|
-
|
|
20704
|
-
|
|
20705
|
-
|
|
20706
|
-
|
|
20707
|
-
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
handleInput
|
|
20712
|
-
};
|
|
20713
|
-
}
|
|
20714
|
-
function useLazyLoad$2(dropdownRef, enableLazyLoad, ctx2) {
|
|
20715
|
-
const loadMore = () => {
|
|
20716
|
-
const dropdownVal = dropdownRef.value;
|
|
20717
|
-
if (!enableLazyLoad) {
|
|
20718
|
-
return;
|
|
20719
|
-
}
|
|
20720
|
-
if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight - 12) {
|
|
20721
|
-
ctx2.emit("loadMore");
|
|
20844
|
+
const emptyText = computed(() => {
|
|
20845
|
+
let text = "";
|
|
20846
|
+
props.remote ? text = t("noData") : text = t("noRelatedRecords");
|
|
20847
|
+
return text;
|
|
20848
|
+
});
|
|
20849
|
+
const showClearable = computed(() => {
|
|
20850
|
+
const hasModelValue = !lodash.exports.isNil(props.modelValue) && props.modelValue !== "";
|
|
20851
|
+
return props.allowClear && !props.disabled && states.inputHovering && hasModelValue;
|
|
20852
|
+
});
|
|
20853
|
+
const toggleMenu = () => {
|
|
20854
|
+
if (!props.disabled) {
|
|
20855
|
+
states.visible = !states.visible;
|
|
20722
20856
|
}
|
|
20723
20857
|
};
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
|
|
20727
|
-
|
|
20728
|
-
|
|
20858
|
+
const updateIndex = (index2) => {
|
|
20859
|
+
states.hoveringIndex = index2;
|
|
20860
|
+
states.selectedIndex = index2;
|
|
20861
|
+
};
|
|
20862
|
+
const setSelected = () => {
|
|
20863
|
+
const options = cachedOptions.value;
|
|
20864
|
+
if (!lodash.exports.isNil(props.modelValue)) {
|
|
20865
|
+
const index2 = options.findIndex((option2) => option2.value === props.modelValue);
|
|
20866
|
+
if (index2 !== -1) {
|
|
20867
|
+
states.inputValue = options[index2].label;
|
|
20868
|
+
states.selectedLabel = options[index2].label;
|
|
20869
|
+
updateIndex(index2);
|
|
20870
|
+
} else {
|
|
20871
|
+
states.inputValue = `${props.modelValue}`;
|
|
20872
|
+
states.selectedLabel = `${props.modelValue}`;
|
|
20873
|
+
}
|
|
20874
|
+
} else {
|
|
20875
|
+
states.inputValue = "";
|
|
20876
|
+
}
|
|
20729
20877
|
};
|
|
20730
|
-
const
|
|
20731
|
-
|
|
20878
|
+
const handleOptionSelect = (option2, byClick) => {
|
|
20879
|
+
ctx2.emit("update:modelValue", option2.value);
|
|
20880
|
+
ctx2.emit("change", option2.value);
|
|
20881
|
+
states.isSilentBlur = byClick;
|
|
20882
|
+
setSoftFocus();
|
|
20883
|
+
states.visible = false;
|
|
20732
20884
|
};
|
|
20733
|
-
const scrollToItem = (
|
|
20885
|
+
const scrollToItem = (idx) => {
|
|
20734
20886
|
const ul = dropdownRef.value;
|
|
20735
|
-
const li = ul.children[
|
|
20887
|
+
const li = ul.children[idx];
|
|
20736
20888
|
nextTick(() => {
|
|
20737
20889
|
if (li.scrollIntoViewIfNeeded) {
|
|
20738
20890
|
li.scrollIntoViewIfNeeded(false);
|
|
@@ -20745,232 +20897,375 @@ function useKeyboardSelect(dropdownRef, hoverIndex, filteredOptions, disabledKey
|
|
|
20745
20897
|
}
|
|
20746
20898
|
});
|
|
20747
20899
|
};
|
|
20748
|
-
|
|
20749
|
-
|
|
20900
|
+
watch(() => states.visible, (visible) => {
|
|
20901
|
+
if (visible) {
|
|
20902
|
+
states.selectedIndex !== -1 && nextTick(() => {
|
|
20903
|
+
scrollToItem(states.selectedIndex);
|
|
20904
|
+
});
|
|
20905
|
+
} else {
|
|
20906
|
+
states.query = "";
|
|
20907
|
+
states.inputValue = states.selectedLabel;
|
|
20908
|
+
}
|
|
20909
|
+
ctx2.emit("visibleChange", visible);
|
|
20910
|
+
});
|
|
20911
|
+
watch(() => props.modelValue, () => {
|
|
20912
|
+
setSelected();
|
|
20913
|
+
});
|
|
20914
|
+
watch(() => props.options, (newOptions) => {
|
|
20915
|
+
if (newOptions.length !== 0) {
|
|
20916
|
+
cachedOptions.value = newOptions;
|
|
20917
|
+
}
|
|
20918
|
+
});
|
|
20919
|
+
onMounted(() => {
|
|
20920
|
+
setSelected();
|
|
20921
|
+
});
|
|
20922
|
+
return {
|
|
20923
|
+
cachedOptions,
|
|
20924
|
+
filteredOptions,
|
|
20925
|
+
emptyText,
|
|
20926
|
+
showClearable,
|
|
20927
|
+
toggleMenu,
|
|
20928
|
+
handleOptionSelect,
|
|
20929
|
+
scrollToItem
|
|
20930
|
+
};
|
|
20931
|
+
}
|
|
20932
|
+
const EVENT_CODE = {
|
|
20933
|
+
tab: "Tab",
|
|
20934
|
+
enter: "Enter",
|
|
20935
|
+
up: "ArrowUp",
|
|
20936
|
+
down: "ArrowDown",
|
|
20937
|
+
esc: "Escape"
|
|
20938
|
+
};
|
|
20939
|
+
function useKeyboardSelect(props, states, filteredOptions, scrollToItem, handleOptionSelect) {
|
|
20940
|
+
const updateHoveringIndex = (index2) => {
|
|
20941
|
+
states.hoveringIndex = index2;
|
|
20750
20942
|
};
|
|
20751
|
-
const
|
|
20752
|
-
|
|
20753
|
-
|
|
20943
|
+
const onKeyboardNavigate = (direction, hoverIndex = states.hoveringIndex) => {
|
|
20944
|
+
if (!states.visible) {
|
|
20945
|
+
states.visible = true;
|
|
20754
20946
|
return;
|
|
20755
20947
|
}
|
|
20756
|
-
if (
|
|
20948
|
+
if (filteredOptions.value.length === 0 || props.loading) {
|
|
20757
20949
|
return;
|
|
20758
20950
|
}
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20951
|
+
let newIndex = 0;
|
|
20952
|
+
if (direction === "ArrowDown") {
|
|
20953
|
+
newIndex = hoverIndex + 1;
|
|
20954
|
+
if (newIndex > filteredOptions.value.length - 1) {
|
|
20955
|
+
newIndex = 0;
|
|
20763
20956
|
}
|
|
20764
|
-
} else if (direction === "
|
|
20765
|
-
|
|
20766
|
-
if (
|
|
20767
|
-
|
|
20957
|
+
} else if (direction === "ArrowUp") {
|
|
20958
|
+
newIndex = hoverIndex - 1;
|
|
20959
|
+
if (newIndex < 0) {
|
|
20960
|
+
newIndex = filteredOptions.value.length - 1;
|
|
20768
20961
|
}
|
|
20769
20962
|
}
|
|
20770
|
-
const option2 = filteredOptions.value[
|
|
20771
|
-
if (option2[disabledKey]) {
|
|
20772
|
-
return
|
|
20963
|
+
const option2 = filteredOptions.value[newIndex];
|
|
20964
|
+
if (option2[props.disabledKey]) {
|
|
20965
|
+
return onKeyboardNavigate(direction, newIndex);
|
|
20966
|
+
} else {
|
|
20967
|
+
updateHoveringIndex(newIndex);
|
|
20968
|
+
scrollToItem(newIndex);
|
|
20773
20969
|
}
|
|
20774
|
-
updateIndex(index2);
|
|
20775
|
-
scrollToItem(index2);
|
|
20776
20970
|
};
|
|
20777
|
-
const
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20971
|
+
const onEscOrTab = () => {
|
|
20972
|
+
states.visible = false;
|
|
20973
|
+
};
|
|
20974
|
+
const onKeyboardSelect = () => {
|
|
20975
|
+
if (!states.visible) {
|
|
20976
|
+
return states.visible = true;
|
|
20977
|
+
}
|
|
20978
|
+
const option2 = filteredOptions.value[states.hoveringIndex];
|
|
20979
|
+
if (option2) {
|
|
20980
|
+
handleOptionSelect(option2, false);
|
|
20781
20981
|
}
|
|
20782
|
-
|
|
20783
|
-
|
|
20982
|
+
};
|
|
20983
|
+
const onKeydown = (e) => {
|
|
20984
|
+
const keyCode = e.key || e.code;
|
|
20985
|
+
const { tab: tab2, esc, down, up, enter } = EVENT_CODE;
|
|
20986
|
+
if (keyCode === up || keyCode === down) {
|
|
20987
|
+
e.preventDefault();
|
|
20784
20988
|
}
|
|
20785
20989
|
switch (keyCode) {
|
|
20786
|
-
case
|
|
20787
|
-
|
|
20990
|
+
case up:
|
|
20991
|
+
onKeyboardNavigate("ArrowUp");
|
|
20788
20992
|
break;
|
|
20789
|
-
case
|
|
20790
|
-
|
|
20993
|
+
case down:
|
|
20994
|
+
onKeyboardNavigate("ArrowDown");
|
|
20995
|
+
break;
|
|
20996
|
+
case esc:
|
|
20997
|
+
case tab2:
|
|
20998
|
+
onEscOrTab();
|
|
20999
|
+
break;
|
|
21000
|
+
case enter:
|
|
21001
|
+
onKeyboardSelect();
|
|
20791
21002
|
break;
|
|
20792
|
-
default:
|
|
20793
|
-
handleKeyboardNavigation(keyCode);
|
|
20794
21003
|
}
|
|
20795
21004
|
};
|
|
20796
21005
|
return {
|
|
20797
|
-
|
|
21006
|
+
onKeydown
|
|
20798
21007
|
};
|
|
20799
21008
|
}
|
|
20800
|
-
function
|
|
20801
|
-
const
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
});
|
|
20808
|
-
const
|
|
21009
|
+
function useInputRender(props, states) {
|
|
21010
|
+
const ns2 = useNamespace("editable-select-input");
|
|
21011
|
+
const inputClasses = computed(() => ({
|
|
21012
|
+
[ns2.b()]: true,
|
|
21013
|
+
[ns2.m("sm")]: props.size === "sm",
|
|
21014
|
+
[ns2.m("lg")]: props.size === "lg",
|
|
21015
|
+
[ns2.m("open")]: states.visible
|
|
21016
|
+
}));
|
|
21017
|
+
const inputWrapperClasses = computed(() => ({
|
|
21018
|
+
[ns2.e("wrapper")]: true,
|
|
21019
|
+
[ns2.em("wrapper", "focus")]: states.isFocus,
|
|
21020
|
+
[ns2.em("wrapper", "disabled")]: props.disabled
|
|
21021
|
+
}));
|
|
21022
|
+
const inputInnerClasses = computed(() => ({
|
|
21023
|
+
[ns2.e("inner")]: true
|
|
21024
|
+
}));
|
|
21025
|
+
const inputPlaceholderClasses = computed(() => ({
|
|
21026
|
+
[ns2.e("placeholder")]: true
|
|
21027
|
+
}));
|
|
21028
|
+
const inputSuffixClasses = computed(() => ({
|
|
21029
|
+
[ns2.e("suffix")]: true
|
|
21030
|
+
}));
|
|
21031
|
+
return {
|
|
21032
|
+
inputClasses,
|
|
21033
|
+
inputWrapperClasses,
|
|
21034
|
+
inputInnerClasses,
|
|
21035
|
+
inputPlaceholderClasses,
|
|
21036
|
+
inputSuffixClasses
|
|
21037
|
+
};
|
|
21038
|
+
}
|
|
21039
|
+
function useInputEvent(inputRef, props, states, ctx2) {
|
|
21040
|
+
const delay = computed(() => props.remote ? 300 : 0);
|
|
21041
|
+
const setSoftFocus = () => {
|
|
21042
|
+
var _a;
|
|
21043
|
+
const _input = inputRef.value;
|
|
21044
|
+
if (_input) {
|
|
21045
|
+
(_a = _input.focus) == null ? void 0 : _a.call(_input);
|
|
21046
|
+
}
|
|
21047
|
+
};
|
|
21048
|
+
const handleFocus = (e) => {
|
|
21049
|
+
if (!states.softFocus) {
|
|
21050
|
+
ctx2.emit("focus", e);
|
|
21051
|
+
states.isFocus = true;
|
|
21052
|
+
} else {
|
|
21053
|
+
states.softFocus = false;
|
|
21054
|
+
}
|
|
21055
|
+
};
|
|
21056
|
+
const handleBlur = async (e) => {
|
|
21057
|
+
if (states.isSilentBlur) {
|
|
21058
|
+
states.isSilentBlur = false;
|
|
21059
|
+
} else {
|
|
21060
|
+
ctx2.emit("blur", e);
|
|
21061
|
+
states.isFocus = true;
|
|
21062
|
+
}
|
|
21063
|
+
states.softFocus = false;
|
|
21064
|
+
};
|
|
21065
|
+
const updateInputValue = (value) => {
|
|
21066
|
+
states.inputValue = value;
|
|
21067
|
+
};
|
|
21068
|
+
const handleQueryChange = (value) => {
|
|
21069
|
+
if (props.remote && lodash.exports.isFunction(props.remoteMethod)) {
|
|
21070
|
+
props.remoteMethod(value);
|
|
21071
|
+
} else if (lodash.exports.isFunction(props.filterMethod)) {
|
|
21072
|
+
props.filterMethod(value);
|
|
21073
|
+
}
|
|
21074
|
+
};
|
|
21075
|
+
const handleInputChange = () => {
|
|
21076
|
+
states.query = states.inputValue;
|
|
21077
|
+
handleQueryChange(states.query);
|
|
21078
|
+
};
|
|
21079
|
+
const debouncedOnInputChange = lodash.exports.debounce(handleInputChange, delay.value);
|
|
21080
|
+
const onInput = (e) => {
|
|
21081
|
+
const value = e.target.value;
|
|
21082
|
+
updateInputValue(value);
|
|
21083
|
+
if (states.inputValue.length > 0 && !states.visible) {
|
|
21084
|
+
states.visible = true;
|
|
21085
|
+
}
|
|
21086
|
+
if (props.remote) {
|
|
21087
|
+
debouncedOnInputChange();
|
|
21088
|
+
} else {
|
|
21089
|
+
handleInputChange();
|
|
21090
|
+
}
|
|
21091
|
+
};
|
|
21092
|
+
const onMouseenter = () => {
|
|
21093
|
+
states.inputHovering = true;
|
|
21094
|
+
};
|
|
21095
|
+
const onMouseleave = () => {
|
|
21096
|
+
states.inputHovering = false;
|
|
21097
|
+
};
|
|
21098
|
+
const handleClear = () => {
|
|
21099
|
+
ctx2.emit("update:modelValue", "");
|
|
21100
|
+
ctx2.emit("change", "");
|
|
21101
|
+
ctx2.emit("clear");
|
|
21102
|
+
states.hoveringIndex = -1;
|
|
21103
|
+
states.visible = false;
|
|
21104
|
+
};
|
|
20809
21105
|
return {
|
|
20810
|
-
|
|
21106
|
+
blur,
|
|
21107
|
+
setSoftFocus,
|
|
21108
|
+
handleFocus,
|
|
21109
|
+
handleBlur,
|
|
21110
|
+
handleClear,
|
|
21111
|
+
onInput,
|
|
21112
|
+
onMouseenter,
|
|
21113
|
+
onMouseleave
|
|
20811
21114
|
};
|
|
20812
21115
|
}
|
|
21116
|
+
function useLazyLoad$2(dropdownRef, props, ctx2) {
|
|
21117
|
+
const { enableLazyLoad } = toRefs(props);
|
|
21118
|
+
const loadMore = () => {
|
|
21119
|
+
if (!dropdownRef.value || !enableLazyLoad.value) {
|
|
21120
|
+
return;
|
|
21121
|
+
}
|
|
21122
|
+
if ((dropdownRef == null ? void 0 : dropdownRef.value.clientHeight) + dropdownRef.value.scrollTop >= dropdownRef.value.scrollHeight - 12) {
|
|
21123
|
+
ctx2.emit("loadMore");
|
|
21124
|
+
}
|
|
21125
|
+
};
|
|
21126
|
+
return { loadMore };
|
|
21127
|
+
}
|
|
21128
|
+
var editableSelect = "";
|
|
21129
|
+
function _isSlot$7(s) {
|
|
21130
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
21131
|
+
}
|
|
20813
21132
|
var EditableSelect = defineComponent({
|
|
20814
21133
|
name: "DEditableSelect",
|
|
20815
|
-
directives: {
|
|
20816
|
-
ClickOutside: clickoutsideDirective,
|
|
20817
|
-
Loading: LoadingDirective
|
|
20818
|
-
},
|
|
20819
21134
|
props: editableSelectProps,
|
|
20820
|
-
emits: ["update:modelValue", "
|
|
21135
|
+
emits: ["update:modelValue", "focus", "blur", "clear", "change", "visibleChange", "loadMore"],
|
|
20821
21136
|
setup(props, ctx2) {
|
|
20822
|
-
const app = getCurrentInstance();
|
|
20823
|
-
const t = createI18nTranslate("DEditableSelect", app);
|
|
20824
21137
|
const ns2 = useNamespace("editable-select");
|
|
21138
|
+
const inputRef = ref();
|
|
21139
|
+
const originRef = ref();
|
|
20825
21140
|
const dropdownRef = ref();
|
|
20826
|
-
const
|
|
20827
|
-
const
|
|
20828
|
-
const selectedIndex = ref(0);
|
|
20829
|
-
const position = ref(["bottom"]);
|
|
20830
|
-
const visible = ref(false);
|
|
20831
|
-
const inputValue = ref(props.modelValue);
|
|
20832
|
-
const loading2 = ref(props.loading);
|
|
21141
|
+
const overlayRef = ref();
|
|
21142
|
+
const states = useSelectStates();
|
|
20833
21143
|
const {
|
|
20834
|
-
|
|
20835
|
-
|
|
20836
|
-
|
|
21144
|
+
appendToBody,
|
|
21145
|
+
disabled,
|
|
21146
|
+
modelValue,
|
|
21147
|
+
position,
|
|
21148
|
+
placeholder
|
|
21149
|
+
} = toRefs(props);
|
|
20837
21150
|
const {
|
|
20838
|
-
|
|
20839
|
-
|
|
21151
|
+
onInput,
|
|
21152
|
+
onMouseenter,
|
|
21153
|
+
onMouseleave,
|
|
21154
|
+
setSoftFocus,
|
|
21155
|
+
handleBlur,
|
|
21156
|
+
handleFocus,
|
|
21157
|
+
handleClear
|
|
21158
|
+
} = useInputEvent(inputRef, props, states, ctx2);
|
|
20840
21159
|
const {
|
|
20841
|
-
|
|
20842
|
-
|
|
20843
|
-
|
|
20844
|
-
|
|
20845
|
-
|
|
20846
|
-
|
|
20847
|
-
|
|
20848
|
-
text = t("noRelatedRecords");
|
|
20849
|
-
}
|
|
20850
|
-
return text;
|
|
20851
|
-
});
|
|
20852
|
-
watch(() => props.loading, (newVal) => {
|
|
20853
|
-
loading2.value = newVal;
|
|
20854
|
-
});
|
|
20855
|
-
const toggleMenu = () => {
|
|
20856
|
-
visible.value = !visible.value;
|
|
20857
|
-
};
|
|
20858
|
-
const closeMenu = () => {
|
|
20859
|
-
visible.value = false;
|
|
20860
|
-
};
|
|
21160
|
+
filteredOptions,
|
|
21161
|
+
emptyText,
|
|
21162
|
+
showClearable,
|
|
21163
|
+
toggleMenu,
|
|
21164
|
+
handleOptionSelect,
|
|
21165
|
+
scrollToItem
|
|
21166
|
+
} = useSelect$3(dropdownRef, props, states, setSoftFocus, ctx2);
|
|
20861
21167
|
const {
|
|
20862
|
-
|
|
20863
|
-
} =
|
|
21168
|
+
onKeydown
|
|
21169
|
+
} = useKeyboardSelect(props, states, filteredOptions, scrollToItem, handleOptionSelect);
|
|
20864
21170
|
const {
|
|
20865
|
-
|
|
20866
|
-
} =
|
|
20867
|
-
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
|
|
20871
|
-
|
|
20872
|
-
|
|
20873
|
-
|
|
20874
|
-
|
|
20875
|
-
|
|
20876
|
-
|
|
20877
|
-
|
|
20878
|
-
|
|
20879
|
-
|
|
20880
|
-
|
|
21171
|
+
loadMore
|
|
21172
|
+
} = useLazyLoad$2(dropdownRef, props, ctx2);
|
|
21173
|
+
provide(SELECT_KEY, {
|
|
21174
|
+
dropdownRef,
|
|
21175
|
+
disabledKey: props.disabledKey,
|
|
21176
|
+
modelValue,
|
|
21177
|
+
inputValue: toRef(states, "inputValue"),
|
|
21178
|
+
query: toRef(states, "query"),
|
|
21179
|
+
hoveringIndex: toRef(states, "hoveringIndex"),
|
|
21180
|
+
loading: toRef(props, "loading"),
|
|
21181
|
+
emptyText,
|
|
21182
|
+
loadMore,
|
|
21183
|
+
handleOptionSelect,
|
|
21184
|
+
setSoftFocus
|
|
21185
|
+
});
|
|
21186
|
+
onClickOutside(originRef, () => {
|
|
21187
|
+
states.visible = false;
|
|
21188
|
+
states.isFocus = false;
|
|
21189
|
+
}, {
|
|
21190
|
+
ignore: [overlayRef]
|
|
21191
|
+
});
|
|
20881
21192
|
const {
|
|
20882
|
-
|
|
20883
|
-
|
|
20884
|
-
|
|
20885
|
-
|
|
20886
|
-
|
|
20887
|
-
|
|
20888
|
-
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
|
|
20895
|
-
|
|
21193
|
+
inputClasses,
|
|
21194
|
+
inputWrapperClasses,
|
|
21195
|
+
inputInnerClasses,
|
|
21196
|
+
inputSuffixClasses
|
|
21197
|
+
} = useInputRender(props, states);
|
|
21198
|
+
const renderBasicDropdown = () => {
|
|
21199
|
+
return createVNode(Transition, {
|
|
21200
|
+
"name": "fade"
|
|
21201
|
+
}, {
|
|
21202
|
+
default: () => [createVNode(FlexibleOverlay, {
|
|
21203
|
+
"ref": overlayRef,
|
|
21204
|
+
"modelValue": states.visible,
|
|
21205
|
+
"onUpdate:modelValue": ($event) => states.visible = $event,
|
|
21206
|
+
"origin": originRef.value,
|
|
21207
|
+
"position": position.value,
|
|
21208
|
+
"style": {
|
|
21209
|
+
zIndex: "var(--devui-z-index-dropdown, 1052)"
|
|
21210
|
+
}
|
|
21211
|
+
}, {
|
|
21212
|
+
default: () => [createVNode(Dropdown, {
|
|
21213
|
+
"options": filteredOptions.value,
|
|
21214
|
+
"width": props.width,
|
|
21215
|
+
"maxHeight": props.maxHeight
|
|
21216
|
+
}, ctx2.slots)]
|
|
21217
|
+
})]
|
|
20896
21218
|
});
|
|
20897
21219
|
};
|
|
21220
|
+
const renderDropdown = () => {
|
|
21221
|
+
if (appendToBody.value) {
|
|
21222
|
+
let _slot;
|
|
21223
|
+
return createVNode(Teleport, {
|
|
21224
|
+
"to": "body"
|
|
21225
|
+
}, _isSlot$7(_slot = renderBasicDropdown()) ? _slot : {
|
|
21226
|
+
default: () => [_slot]
|
|
21227
|
+
});
|
|
21228
|
+
} else {
|
|
21229
|
+
return renderBasicDropdown();
|
|
21230
|
+
}
|
|
21231
|
+
};
|
|
20898
21232
|
return () => {
|
|
20899
|
-
|
|
20900
|
-
|
|
20901
|
-
|
|
20902
|
-
const inputCls = className$2(`devui-form-control devui-dropdown-origin`, {
|
|
20903
|
-
"devui-dropdown-origin-open": visible.value === true
|
|
20904
|
-
});
|
|
20905
|
-
return withDirectives(createVNode("div", {
|
|
20906
|
-
"class": selectCls,
|
|
20907
|
-
"ref": origin,
|
|
21233
|
+
return createVNode("div", {
|
|
21234
|
+
"ref": originRef,
|
|
21235
|
+
"class": ns2.b(),
|
|
20908
21236
|
"style": {
|
|
20909
21237
|
width: props.width + "px"
|
|
20910
|
-
}
|
|
21238
|
+
},
|
|
21239
|
+
"onClick": toggleMenu
|
|
21240
|
+
}, [createVNode("div", {
|
|
21241
|
+
"class": inputClasses.value,
|
|
21242
|
+
"onMouseenter": onMouseenter,
|
|
21243
|
+
"onMouseleave": onMouseleave
|
|
21244
|
+
}, [createVNode("div", {
|
|
21245
|
+
"class": inputWrapperClasses.value
|
|
20911
21246
|
}, [createVNode("input", {
|
|
20912
|
-
"
|
|
20913
|
-
"
|
|
20914
|
-
"
|
|
20915
|
-
"
|
|
20916
|
-
"value": inputValue
|
|
20917
|
-
"
|
|
20918
|
-
"
|
|
20919
|
-
"
|
|
21247
|
+
"ref": inputRef,
|
|
21248
|
+
"class": inputInnerClasses.value,
|
|
21249
|
+
"disabled": disabled.value,
|
|
21250
|
+
"placeholder": placeholder.value,
|
|
21251
|
+
"value": states.inputValue,
|
|
21252
|
+
"type": "text",
|
|
21253
|
+
"onInput": onInput,
|
|
21254
|
+
"onFocus": handleFocus,
|
|
21255
|
+
"onBlur": handleBlur,
|
|
21256
|
+
"onKeydown": onKeydown
|
|
20920
21257
|
}, null), createVNode("span", {
|
|
20921
|
-
"class":
|
|
20922
|
-
}, [createVNode("span", {
|
|
20923
|
-
"class": "
|
|
20924
|
-
"onClick": handleClear
|
|
20925
|
-
}, [createVNode(
|
|
21258
|
+
"class": inputSuffixClasses.value
|
|
21259
|
+
}, [withDirectives(createVNode("span", {
|
|
21260
|
+
"class": ns2.e("clear-icon"),
|
|
21261
|
+
"onClick": withModifiers(handleClear, ["stop"])
|
|
21262
|
+
}, [createVNode(DIcon, {
|
|
20926
21263
|
"name": "icon-remove"
|
|
20927
|
-
}, null)]), createVNode("span", {
|
|
20928
|
-
"class": "
|
|
20929
|
-
}, [createVNode(
|
|
21264
|
+
}, null)]), [[vShow, showClearable.value]]), withDirectives(createVNode("span", {
|
|
21265
|
+
"class": ns2.e("arrow-icon")
|
|
21266
|
+
}, [createVNode(DIcon, {
|
|
20930
21267
|
"name": "select-arrow"
|
|
20931
|
-
}, null)])]),
|
|
20932
|
-
"to": "body"
|
|
20933
|
-
}, {
|
|
20934
|
-
default: () => [createVNode(Transition, {
|
|
20935
|
-
"name": "fade"
|
|
20936
|
-
}, {
|
|
20937
|
-
default: () => [createVNode(FlexibleOverlay, {
|
|
20938
|
-
"origin": origin.value,
|
|
20939
|
-
"modelValue": visible.value,
|
|
20940
|
-
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
20941
|
-
"position": position.value,
|
|
20942
|
-
"style": {
|
|
20943
|
-
zIndex: "var(--devui-z-index-dropdown, 1052)"
|
|
20944
|
-
}
|
|
20945
|
-
}, {
|
|
20946
|
-
default: () => [createVNode("div", {
|
|
20947
|
-
"style": {
|
|
20948
|
-
width: props.width + "px"
|
|
20949
|
-
},
|
|
20950
|
-
"class": `${ns2.e("menu")}`
|
|
20951
|
-
}, [withDirectives(createVNode("div", {
|
|
20952
|
-
"class": `devui-dropdown-menu`
|
|
20953
|
-
}, [createVNode("ul", {
|
|
20954
|
-
"ref": dropdownRef,
|
|
20955
|
-
"class": `${ns2.em("list", "unstyled")} devui-scrollbar scroll-height`,
|
|
20956
|
-
"style": {
|
|
20957
|
-
maxHeight: props.maxHeight + "px"
|
|
20958
|
-
},
|
|
20959
|
-
"onScroll": loadMore
|
|
20960
|
-
}, [filteredOptions.value.map((option2, index2) => {
|
|
20961
|
-
return createVNode("li", {
|
|
20962
|
-
"class": getItemCls(option2, index2),
|
|
20963
|
-
"onClick": (e) => {
|
|
20964
|
-
e.stopPropagation();
|
|
20965
|
-
handleClick(option2, index2);
|
|
20966
|
-
}
|
|
20967
|
-
}, [ctx2.slots.item ? ctx2.slots.item(option2) : option2.label]);
|
|
20968
|
-
}), withDirectives(createVNode("div", {
|
|
20969
|
-
"class": "devui-no-data-tip"
|
|
20970
|
-
}, [ctx2.slots.noResultItem ? ctx2.slots.noResultItem(inputValue.value) : emptyText.value]), [[vShow, !filteredOptions.value.length]])])]), [[vShow, visible.value], [resolveDirective("loading"), props.loading]])])]
|
|
20971
|
-
})]
|
|
20972
|
-
})]
|
|
20973
|
-
})]), [[resolveDirective("click-outside"), closeMenu]]);
|
|
21268
|
+
}, null)]), [[vShow, !showClearable.value]])])])]), renderDropdown()]);
|
|
20974
21269
|
};
|
|
20975
21270
|
}
|
|
20976
21271
|
});
|
|
@@ -22547,13 +22842,13 @@ function useExpose(ctx2) {
|
|
|
22547
22842
|
const focus = () => {
|
|
22548
22843
|
inputRef.value.focus();
|
|
22549
22844
|
};
|
|
22550
|
-
const
|
|
22845
|
+
const blur2 = () => {
|
|
22551
22846
|
inputRef.value.blur();
|
|
22552
22847
|
};
|
|
22553
22848
|
const select2 = () => {
|
|
22554
22849
|
inputRef.value.select();
|
|
22555
22850
|
};
|
|
22556
|
-
ctx2.expose({ focus, blur, select: select2 });
|
|
22851
|
+
ctx2.expose({ focus, blur: blur2, select: select2 });
|
|
22557
22852
|
return { inputRef };
|
|
22558
22853
|
}
|
|
22559
22854
|
function getPrecision(pre) {
|
|
@@ -24769,19 +25064,23 @@ var Modal = defineComponent({
|
|
|
24769
25064
|
const typeList = [{
|
|
24770
25065
|
type: "success",
|
|
24771
25066
|
text: "\u6210\u529F",
|
|
24772
|
-
icon: "right-o"
|
|
25067
|
+
icon: "right-o",
|
|
25068
|
+
color: "var(--devui-success)"
|
|
24773
25069
|
}, {
|
|
24774
25070
|
type: "failed",
|
|
24775
25071
|
text: "\u9519\u8BEF",
|
|
24776
|
-
icon: "error-o"
|
|
25072
|
+
icon: "error-o",
|
|
25073
|
+
color: "var(--devui-danger)"
|
|
24777
25074
|
}, {
|
|
24778
25075
|
type: "warning",
|
|
24779
25076
|
text: "\u8B66\u544A",
|
|
24780
|
-
icon: "warning-o"
|
|
25077
|
+
icon: "warning-o",
|
|
25078
|
+
color: "var(--devui-warning)"
|
|
24781
25079
|
}, {
|
|
24782
25080
|
type: "info",
|
|
24783
25081
|
text: "\u4FE1\u606F",
|
|
24784
|
-
icon: "info-o"
|
|
25082
|
+
icon: "info-o",
|
|
25083
|
+
color: "var(--devui-info)"
|
|
24785
25084
|
}];
|
|
24786
25085
|
const item = typeList.find((i) => i.type === props.type);
|
|
24787
25086
|
return createVNode("div", {
|
|
@@ -24795,7 +25094,8 @@ var Modal = defineComponent({
|
|
|
24795
25094
|
}, [createVNode("div", {
|
|
24796
25095
|
"class": "type-content-icon"
|
|
24797
25096
|
}, [createVNode(DIcon, {
|
|
24798
|
-
"name": item == null ? void 0 : item.icon
|
|
25097
|
+
"name": item == null ? void 0 : item.icon,
|
|
25098
|
+
"color": item == null ? void 0 : item.color
|
|
24799
25099
|
}, null)]), createVNode("div", {
|
|
24800
25100
|
"class": "type-content-text"
|
|
24801
25101
|
}, [item == null ? void 0 : item.text])])]
|
|
@@ -25354,7 +25654,7 @@ function className$1(classStr, classOpt) {
|
|
|
25354
25654
|
}
|
|
25355
25655
|
return classname;
|
|
25356
25656
|
}
|
|
25357
|
-
function useSelect$2(props, selectRef, ctx2, focus,
|
|
25657
|
+
function useSelect$2(props, selectRef, ctx2, focus, blur2, isSelectFocus, t) {
|
|
25358
25658
|
const formContext = inject(FORM_TOKEN, void 0);
|
|
25359
25659
|
const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
|
|
25360
25660
|
const ns2 = useNamespace("select");
|
|
@@ -25533,7 +25833,7 @@ function useSelect$2(props, selectRef, ctx2, focus, blur, isSelectFocus, t) {
|
|
|
25533
25833
|
ctx2.emit("clear");
|
|
25534
25834
|
if (isOpen.value) {
|
|
25535
25835
|
handleClose();
|
|
25536
|
-
|
|
25836
|
+
blur2();
|
|
25537
25837
|
}
|
|
25538
25838
|
};
|
|
25539
25839
|
const tagDelete = (data) => {
|
|
@@ -26214,14 +26514,14 @@ function useSelectFunction(props, selectRef) {
|
|
|
26214
26514
|
}
|
|
26215
26515
|
(_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.focus();
|
|
26216
26516
|
};
|
|
26217
|
-
const
|
|
26517
|
+
const blur2 = () => {
|
|
26218
26518
|
var _a;
|
|
26219
26519
|
if (!props.disabled) {
|
|
26220
26520
|
isSelectFocus.value = false;
|
|
26221
26521
|
}
|
|
26222
26522
|
(_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.blur();
|
|
26223
26523
|
};
|
|
26224
|
-
return { isSelectFocus, focus, blur };
|
|
26524
|
+
return { isSelectFocus, focus, blur: blur2 };
|
|
26225
26525
|
}
|
|
26226
26526
|
var select = "";
|
|
26227
26527
|
var Select = defineComponent({
|
|
@@ -26235,7 +26535,7 @@ var Select = defineComponent({
|
|
|
26235
26535
|
const {
|
|
26236
26536
|
isSelectFocus,
|
|
26237
26537
|
focus,
|
|
26238
|
-
blur
|
|
26538
|
+
blur: blur2
|
|
26239
26539
|
} = useSelectFunction(props, selectRef);
|
|
26240
26540
|
const {
|
|
26241
26541
|
selectDisabled,
|
|
@@ -26260,7 +26560,7 @@ var Select = defineComponent({
|
|
|
26260
26560
|
isDisabled,
|
|
26261
26561
|
toggleChange,
|
|
26262
26562
|
isShowCreateOption
|
|
26263
|
-
} = useSelect$2(props, selectRef, ctx2, focus,
|
|
26563
|
+
} = useSelect$2(props, selectRef, ctx2, focus, blur2, isSelectFocus, t);
|
|
26264
26564
|
const scrollbarNs = useNamespace("scrollbar");
|
|
26265
26565
|
const ns2 = useNamespace("select");
|
|
26266
26566
|
const dropdownCls = ns2.e("dropdown");
|
|
@@ -26271,7 +26571,7 @@ var Select = defineComponent({
|
|
|
26271
26571
|
const dropdownEmptyCls = ns2.em("dropdown", "empty");
|
|
26272
26572
|
ctx2.expose({
|
|
26273
26573
|
focus,
|
|
26274
|
-
blur,
|
|
26574
|
+
blur: blur2,
|
|
26275
26575
|
toggleChange
|
|
26276
26576
|
});
|
|
26277
26577
|
const isRender = ref(false);
|
|
@@ -26876,7 +27176,7 @@ var PageSize = defineComponent({
|
|
|
26876
27176
|
const onDropdownToggle = (e) => {
|
|
26877
27177
|
iconRotate.value = e ? 180 : 0;
|
|
26878
27178
|
};
|
|
26879
|
-
return () => createVNode(Fragment, null, [createVNode(Dropdown, {
|
|
27179
|
+
return () => createVNode(Fragment, null, [createVNode(Dropdown$1, {
|
|
26880
27180
|
"position": ["bottom", "top"],
|
|
26881
27181
|
"class": ns2.e("size-list"),
|
|
26882
27182
|
"onToggle": onDropdownToggle
|
|
@@ -28932,6 +29232,7 @@ var DSearch = defineComponent({
|
|
|
28932
29232
|
size: searchSize.value,
|
|
28933
29233
|
disabled: props.disabled,
|
|
28934
29234
|
autoFocus: props.autoFocus,
|
|
29235
|
+
maxlength: props.maxLength,
|
|
28935
29236
|
modelValue: keywords.value,
|
|
28936
29237
|
placeholder: props.placeholder || t("placeholder"),
|
|
28937
29238
|
onKeydown: onInputKeydown,
|
|
@@ -32015,7 +32316,7 @@ var Filter = defineComponent({
|
|
|
32015
32316
|
handleConfirm,
|
|
32016
32317
|
handleSelect
|
|
32017
32318
|
} = useFilterRender(ctx2);
|
|
32018
|
-
return () => createVNode(Dropdown, {
|
|
32319
|
+
return () => createVNode(Dropdown$1, {
|
|
32019
32320
|
"visible": showMenu.value,
|
|
32020
32321
|
"trigger": "manually",
|
|
32021
32322
|
"close-scope": "none",
|
|
@@ -38733,9 +39034,9 @@ const installs = [
|
|
|
38733
39034
|
VirtualListInstall
|
|
38734
39035
|
];
|
|
38735
39036
|
var vueDevui = {
|
|
38736
|
-
version: "1.
|
|
39037
|
+
version: "1.5.0",
|
|
38737
39038
|
install(app) {
|
|
38738
39039
|
installs.forEach((p) => app.use(p));
|
|
38739
39040
|
}
|
|
38740
39041
|
};
|
|
38741
|
-
export { Accordion, Alert, Anchor, Aside, AutoComplete, Avatar, BackTop, Badge, Breadcrumb, DButton as Button, ButtonGroup, Card, Carousel, CarouselItem, Cascader, Checkbox, CheckboxButton, DCheckboxGroup as CheckboxGroup, Col, Collapse, CollapseItem, ColorPicker, Column, Comment, Content, Countdown, DRangeDatePickerPro, DatePicker, DatePickerPro, DraggableDirective, Drawer, DrawerService, Dropdown, DropdownMenu, DroppableDirective, EditableSelect, FixedOverlay, FlexibleOverlay, Footer$1 as Footer, Form, FormItem, FormOperation, Fullscreen, Gantt, Header$1 as Header, DIcon as Icon, IconGroup, ImagePreviewDirective, ImagePreviewService, DInput as Input, InputIcon, InputNumber, Layout, List, ListItem, LoadingDirective, loading as LoadingService, Mention, Menu, MenuItem, Message, Modal, MultiAutoComplete, NavSprite, Notification, NotificationService, Option, OptionGroup, Pagination, Panel, PanelBody, PanelFooter, PanelHeader, Popover, Progress, QuadrantDiagram, Radio, RadioButton, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, SortableDirective, Splitter, Statistic, Status, Step, Steps, StepsGuide, StepsGuideDirective, StickSlider, Sticky, SubMenu, Switch, Tab, Table, Tabs, Tag, TagInput, Textarea, TimePicker, TimeSelect, Timeline, TimelineItem, Tooltip, Transfer, Tree, TreeSelect, Upload, VirtualList, vueDevui as default };
|
|
39042
|
+
export { Accordion, Alert, Anchor, Aside, AutoComplete, Avatar, BackTop, Badge, Breadcrumb, DButton as Button, ButtonGroup, Card, Carousel, CarouselItem, Cascader, Checkbox, CheckboxButton, DCheckboxGroup as CheckboxGroup, Col, Collapse, CollapseItem, ColorPicker, Column, Comment, Content, Countdown, DRangeDatePickerPro, DatePicker, DatePickerPro, DraggableDirective, Drawer, DrawerService, Dropdown$1 as Dropdown, DropdownMenu, DroppableDirective, EditableSelect, FixedOverlay, FlexibleOverlay, Footer$1 as Footer, Form, FormItem, FormOperation, Fullscreen, Gantt, Header$1 as Header, DIcon as Icon, IconGroup, ImagePreviewDirective, ImagePreviewService, DInput as Input, InputIcon, InputNumber, Layout, List, ListItem, LoadingDirective, loading as LoadingService, Mention, Menu, MenuItem, Message, Modal, MultiAutoComplete, NavSprite, Notification, NotificationService, Option, OptionGroup, Pagination, Panel, PanelBody, PanelFooter, PanelHeader, Popover, Progress, QuadrantDiagram, Radio, RadioButton, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, SortableDirective, Splitter, Statistic, Status, Step, Steps, StepsGuide, StepsGuideDirective, StickSlider, Sticky, SubMenu, Switch, Tab, Table, Tabs, Tag, TagInput, Textarea, TimePicker, TimeSelect, Timeline, TimelineItem, Tooltip, Transfer, Tree, TreeSelect, Upload, VirtualList, vueDevui as default };
|