vue-devui 1.0.0-pre.0 → 1.0.0-rc.10
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/README.md +149 -187
- package/alert/index.es.js +74 -45
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8182 -296
- package/auto-complete/index.umd.js +29 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +153 -146
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +30 -5
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5741 -127
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +59 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8060 -255
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{accordion → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +379 -0
- package/collapse/index.umd.js +1 -0
- package/{anchor → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +5 -7
- package/countdown/index.umd.js +1 -1
- package/date-picker/index.es.js +8159 -288
- package/date-picker/index.umd.js +27 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +31 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +297 -181
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +525 -154
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +1039 -1175
- package/form/index.umd.js +15 -15
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +42 -21
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +101 -86
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +197 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +55 -31
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8066 -144
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +269 -183
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +40 -25
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +74 -35
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +412 -204
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +307 -57
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/overlay/index.es.js +127 -149
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +10 -44
- package/pagination/index.es.js +158 -148
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +317 -246
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +110 -56
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7964 -157
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +77 -55
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +184 -57
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +47 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +3644 -1122
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9144 -597
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +63 -41
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +109 -75
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +469 -349
- package/splitter/index.umd.js +15 -15
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +7 -18
- package/statistic/index.umd.js +1 -1
- package/status/index.es.js +27 -6
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +7794 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10119 -1206
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +342 -141
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +49 -24
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7913 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/{anchor → timeline}/index.d.ts +0 -0
- package/timeline/index.es.js +425 -0
- package/timeline/index.umd.js +1 -0
- package/{back-top → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +308 -236
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +4189 -1851
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +380 -123
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +18121 -23161
- package/vue-devui.umd.js +25 -15
- package/accordion/index.es.js +0 -720
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/back-top/index.d.ts +0 -7
- package/back-top/index.es.js +0 -128
- package/back-top/index.umd.js +0 -1
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/package.json +0 -7
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -329
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5963
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.es.js +0 -8187
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -86
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -331
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/TagInput.js +0 -3
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -258
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -239
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/tag-input/index.d.ts +0 -7
- package/tag-input/index.es.js +0 -329
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/time-axis/index.d.ts +0 -7
- package/time-axis/index.es.js +0 -299
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1237
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7608
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -623
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
|
@@ -14,11 +14,13 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
var __publicField = (obj, key, value) => {
|
|
18
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
import { defineComponent, ref, createVNode, h, render, computed, nextTick, unref, watch, onUnmounted, mergeProps, withDirectives, withModifiers, resolveComponent, vShow, resolveDirective } from "vue";
|
|
22
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
18
23
|
const editableSelectProps = {
|
|
19
|
-
appendToBody: {
|
|
20
|
-
type: Boolean
|
|
21
|
-
},
|
|
22
24
|
options: {
|
|
23
25
|
type: Array,
|
|
24
26
|
default: () => []
|
|
@@ -38,7 +40,8 @@ const editableSelectProps = {
|
|
|
38
40
|
default: "Search"
|
|
39
41
|
},
|
|
40
42
|
modelValue: {
|
|
41
|
-
type: String
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
42
45
|
},
|
|
43
46
|
width: {
|
|
44
47
|
type: Number
|
|
@@ -48,9 +51,6 @@ const editableSelectProps = {
|
|
|
48
51
|
},
|
|
49
52
|
filterOption: {
|
|
50
53
|
type: [Function, Boolean]
|
|
51
|
-
},
|
|
52
|
-
loadMore: {
|
|
53
|
-
type: Function
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
const inBrowser = typeof window !== "undefined";
|
|
@@ -108,6 +108,234 @@ const clickoutsideDirective = {
|
|
|
108
108
|
delete el[ctx];
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
+
class View {
|
|
112
|
+
constructor() {
|
|
113
|
+
__publicField(this, "top", "50%");
|
|
114
|
+
__publicField(this, "left", "50%");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const loadingProps = {
|
|
118
|
+
message: String,
|
|
119
|
+
backdrop: Boolean,
|
|
120
|
+
view: {
|
|
121
|
+
type: Object,
|
|
122
|
+
default: () => new View()
|
|
123
|
+
},
|
|
124
|
+
zIndex: Number,
|
|
125
|
+
isFull: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: false
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
class LoadingOptions {
|
|
131
|
+
constructor() {
|
|
132
|
+
__publicField(this, "target");
|
|
133
|
+
__publicField(this, "message");
|
|
134
|
+
__publicField(this, "loadingTemplateRef");
|
|
135
|
+
__publicField(this, "backdrop", true);
|
|
136
|
+
__publicField(this, "positionType", "relative");
|
|
137
|
+
__publicField(this, "view", new View());
|
|
138
|
+
__publicField(this, "zIndex");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function createBem(namespace, element, modifier) {
|
|
142
|
+
let cls = namespace;
|
|
143
|
+
if (element) {
|
|
144
|
+
cls += `__${element}`;
|
|
145
|
+
}
|
|
146
|
+
if (modifier) {
|
|
147
|
+
cls += `--${modifier}`;
|
|
148
|
+
}
|
|
149
|
+
return cls;
|
|
150
|
+
}
|
|
151
|
+
function useNamespace(block, needDot = false) {
|
|
152
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
153
|
+
const b = () => createBem(namespace);
|
|
154
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
155
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
156
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
157
|
+
return {
|
|
158
|
+
b,
|
|
159
|
+
e,
|
|
160
|
+
m,
|
|
161
|
+
em
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
var loading = "";
|
|
165
|
+
var Loading = defineComponent({
|
|
166
|
+
name: "DLoading",
|
|
167
|
+
inheritAttrs: false,
|
|
168
|
+
props: loadingProps,
|
|
169
|
+
setup(props) {
|
|
170
|
+
const style = {
|
|
171
|
+
top: props.view.top,
|
|
172
|
+
left: props.view.left,
|
|
173
|
+
zIndex: props.zIndex
|
|
174
|
+
};
|
|
175
|
+
if (!props.message) {
|
|
176
|
+
style.background = "none";
|
|
177
|
+
}
|
|
178
|
+
const isShow = ref(false);
|
|
179
|
+
const open = () => {
|
|
180
|
+
isShow.value = true;
|
|
181
|
+
};
|
|
182
|
+
const close = () => {
|
|
183
|
+
isShow.value = false;
|
|
184
|
+
};
|
|
185
|
+
return {
|
|
186
|
+
style,
|
|
187
|
+
isShow,
|
|
188
|
+
open,
|
|
189
|
+
close
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
render() {
|
|
193
|
+
var _a;
|
|
194
|
+
const {
|
|
195
|
+
isShow,
|
|
196
|
+
isFull,
|
|
197
|
+
backdrop,
|
|
198
|
+
style,
|
|
199
|
+
message,
|
|
200
|
+
$slots
|
|
201
|
+
} = this;
|
|
202
|
+
const ns = useNamespace("loading");
|
|
203
|
+
return isShow && createVNode("div", {
|
|
204
|
+
"class": [ns.b(), isFull ? ns.m("full") : ""]
|
|
205
|
+
}, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
|
|
206
|
+
"class": ns.e("wrapper")
|
|
207
|
+
}, [backdrop ? createVNode("div", {
|
|
208
|
+
"class": ns.e("mask")
|
|
209
|
+
}, null) : null, createVNode("div", {
|
|
210
|
+
"style": style,
|
|
211
|
+
"class": ns.e("area")
|
|
212
|
+
}, [createVNode("div", {
|
|
213
|
+
"class": ns.e("busy-default-spinner")
|
|
214
|
+
}, [createVNode("div", {
|
|
215
|
+
"class": ns.e("bar1")
|
|
216
|
+
}, null), createVNode("div", {
|
|
217
|
+
"class": ns.e("bar2")
|
|
218
|
+
}, null), createVNode("div", {
|
|
219
|
+
"class": ns.e("bar3")
|
|
220
|
+
}, null), createVNode("div", {
|
|
221
|
+
"class": ns.e("bar4")
|
|
222
|
+
}, null)]), message ? createVNode("span", {
|
|
223
|
+
"class": ns.e("text")
|
|
224
|
+
}, [message]) : null])])]);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
|
|
228
|
+
function createComponent(component, props, children = null) {
|
|
229
|
+
const vnode = h(component, __spreadValues({}, props), children);
|
|
230
|
+
const container = document.createElement("div");
|
|
231
|
+
vnode[COMPONENT_CONTAINER_SYMBOL] = container;
|
|
232
|
+
render(vnode, container);
|
|
233
|
+
return vnode.component;
|
|
234
|
+
}
|
|
235
|
+
function unmountComponent(ComponnetInstance) {
|
|
236
|
+
render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
|
|
237
|
+
}
|
|
238
|
+
const loadingConstructor = defineComponent(Loading);
|
|
239
|
+
const cacheInstance = /* @__PURE__ */ new WeakSet();
|
|
240
|
+
const isEmpty = (val) => {
|
|
241
|
+
if (!val) {
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
if (Array.isArray(val)) {
|
|
245
|
+
return val.length === 0;
|
|
246
|
+
}
|
|
247
|
+
if (val instanceof Set || val instanceof Map) {
|
|
248
|
+
return val.size === 0;
|
|
249
|
+
}
|
|
250
|
+
if (val instanceof Promise) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
if (typeof val === "object") {
|
|
254
|
+
try {
|
|
255
|
+
return Object.keys(val).length === 0;
|
|
256
|
+
} catch (e) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return false;
|
|
261
|
+
};
|
|
262
|
+
const getType = (vari) => {
|
|
263
|
+
return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
|
|
264
|
+
};
|
|
265
|
+
const isPromise = (value) => {
|
|
266
|
+
const type = getType(value);
|
|
267
|
+
switch (type) {
|
|
268
|
+
case "promise":
|
|
269
|
+
return [value];
|
|
270
|
+
case "array":
|
|
271
|
+
if (value.some((val) => getType(val) !== "promise")) {
|
|
272
|
+
console.error(new TypeError("Binding values should all be of type Promise"));
|
|
273
|
+
return "error";
|
|
274
|
+
}
|
|
275
|
+
return value;
|
|
276
|
+
default:
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
const unmount = (el) => {
|
|
281
|
+
cacheInstance.delete(el);
|
|
282
|
+
el.instance.proxy.close();
|
|
283
|
+
unmountComponent(el.instance);
|
|
284
|
+
};
|
|
285
|
+
const toggleLoading = (el, binding) => {
|
|
286
|
+
var _a, _b, _c;
|
|
287
|
+
if (binding.value) {
|
|
288
|
+
const vals = isPromise(binding.value);
|
|
289
|
+
if (vals === "error") {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
(_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
|
|
293
|
+
el.appendChild(el.mask);
|
|
294
|
+
cacheInstance.add(el);
|
|
295
|
+
if (vals) {
|
|
296
|
+
Promise.all(vals).catch((err) => {
|
|
297
|
+
console.error(new Error("Promise handling errors"), err);
|
|
298
|
+
}).finally(() => {
|
|
299
|
+
unmount(el);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
unmount(el);
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
const removeAttribute = (el) => {
|
|
307
|
+
el.removeAttribute("zindex");
|
|
308
|
+
el.removeAttribute("positiontype");
|
|
309
|
+
el.removeAttribute("backdrop");
|
|
310
|
+
el.removeAttribute("message");
|
|
311
|
+
el.removeAttribute("view");
|
|
312
|
+
el.removeAttribute("loadingtemplateref");
|
|
313
|
+
};
|
|
314
|
+
const handleProps = (el, vprops) => {
|
|
315
|
+
var _a;
|
|
316
|
+
const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
|
|
317
|
+
const loadingTemplateRef = props.loadingTemplateRef;
|
|
318
|
+
const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
|
|
319
|
+
el.style.position = props.positionType;
|
|
320
|
+
el.options = props;
|
|
321
|
+
el.instance = loadingInstance;
|
|
322
|
+
el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
|
|
323
|
+
};
|
|
324
|
+
const loadingDirective = {
|
|
325
|
+
mounted: function(el, binding, vnode) {
|
|
326
|
+
handleProps(el, vnode.props);
|
|
327
|
+
removeAttribute(el);
|
|
328
|
+
!isEmpty(binding.value) && toggleLoading(el, binding);
|
|
329
|
+
},
|
|
330
|
+
updated: function(el, binding, vnode) {
|
|
331
|
+
if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
!cacheInstance.has(el) && handleProps(el, vnode.props);
|
|
335
|
+
removeAttribute(el);
|
|
336
|
+
toggleLoading(el, binding);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
111
339
|
function className(classStr, classOpt) {
|
|
112
340
|
let classname = classStr;
|
|
113
341
|
if (typeof classOpt === "object") {
|
|
@@ -139,23 +367,28 @@ const useInput = (inputValue, ctx2) => {
|
|
|
139
367
|
const handleInput = (event) => {
|
|
140
368
|
const value = event.target.value;
|
|
141
369
|
inputValue.value = value;
|
|
370
|
+
ctx2.emit("update:modelValue", value);
|
|
142
371
|
onInputChange(value);
|
|
143
372
|
};
|
|
144
373
|
return {
|
|
145
374
|
handleInput
|
|
146
375
|
};
|
|
147
376
|
};
|
|
148
|
-
const useLazyLoad = (dropdownRef, inputValue, filterOtion,
|
|
377
|
+
const useLazyLoad = (dropdownRef, inputValue, filterOtion, ctx2) => {
|
|
149
378
|
const loadMore = () => {
|
|
150
|
-
|
|
379
|
+
const dropdownVal = dropdownRef.value;
|
|
380
|
+
if (filterOtion !== false) {
|
|
151
381
|
return;
|
|
152
|
-
|
|
153
|
-
|
|
382
|
+
}
|
|
383
|
+
if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight) {
|
|
384
|
+
ctx2.emit("loadMore", inputValue.value);
|
|
154
385
|
}
|
|
155
386
|
};
|
|
156
387
|
return { loadMore };
|
|
157
388
|
};
|
|
158
|
-
const useKeyboardSelect = (dropdownRef,
|
|
389
|
+
const useKeyboardSelect = (dropdownRef, visible, inputValue, filteredOptions, optionDisabledKey, filterOption, loading2, handleClick, closeMenu, toggleMenu) => {
|
|
390
|
+
const hoverIndex = ref(0);
|
|
391
|
+
const selectedIndex = ref(0);
|
|
159
392
|
const updateHoveringIndex = (index2) => {
|
|
160
393
|
hoverIndex.value = index2;
|
|
161
394
|
};
|
|
@@ -174,168 +407,255 @@ const useKeyboardSelect = (dropdownRef, disabled, visible, hoverIndex, selectedI
|
|
|
174
407
|
}
|
|
175
408
|
});
|
|
176
409
|
};
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
179
|
-
|
|
410
|
+
const handleEscape = () => {
|
|
411
|
+
if (inputValue.value) {
|
|
412
|
+
inputValue.value = "";
|
|
413
|
+
} else {
|
|
414
|
+
closeMenu();
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
const handleEnter = () => {
|
|
418
|
+
const len = filteredOptions.value.length;
|
|
419
|
+
if (!visible.value || !len) {
|
|
420
|
+
return toggleMenu();
|
|
421
|
+
}
|
|
422
|
+
len && len === 1 ? handleClick(filteredOptions.value[0]) : handleClick(filteredOptions.value[hoverIndex.value]);
|
|
423
|
+
return closeMenu();
|
|
424
|
+
};
|
|
425
|
+
const handleKeyboardNavigation = (direction) => {
|
|
426
|
+
const len = filteredOptions.value.length;
|
|
427
|
+
if (!len || len === 1) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (!["ArrowDown", "ArrowUp"].includes(direction)) {
|
|
431
|
+
return;
|
|
180
432
|
}
|
|
181
|
-
if (
|
|
433
|
+
if (filterOption === false && loading2.value) {
|
|
182
434
|
return;
|
|
435
|
+
}
|
|
436
|
+
let newIndex = 0;
|
|
437
|
+
newIndex = hoverIndex.value;
|
|
183
438
|
if (direction === "ArrowUp") {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
updateHoveringIndex(newIndex);
|
|
188
|
-
return;
|
|
439
|
+
newIndex -= 1;
|
|
440
|
+
if (newIndex === -1) {
|
|
441
|
+
newIndex = len - 1;
|
|
189
442
|
}
|
|
190
|
-
newIndex = newIndex - 1;
|
|
191
443
|
} else if (direction === "ArrowDown") {
|
|
192
|
-
|
|
444
|
+
newIndex += 1;
|
|
445
|
+
if (newIndex === len) {
|
|
193
446
|
newIndex = 0;
|
|
194
|
-
scrollToItem(newIndex);
|
|
195
|
-
updateHoveringIndex(newIndex);
|
|
196
|
-
return;
|
|
197
447
|
}
|
|
198
|
-
newIndex = newIndex + 1;
|
|
199
448
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
449
|
+
hoverIndex.value = newIndex;
|
|
450
|
+
const option = filteredOptions.value[newIndex];
|
|
451
|
+
if (option[optionDisabledKey]) {
|
|
452
|
+
return handleKeyboardNavigation(direction);
|
|
203
453
|
}
|
|
204
|
-
scrollToItem(newIndex);
|
|
205
454
|
updateHoveringIndex(newIndex);
|
|
455
|
+
scrollToItem(newIndex);
|
|
206
456
|
};
|
|
207
457
|
const handleKeydown = (event) => {
|
|
208
458
|
const keyCode = event.key || event.code;
|
|
209
|
-
if (options.value.length === 0)
|
|
210
|
-
return;
|
|
211
|
-
if (!visible.value) {
|
|
212
|
-
return toggleMenu();
|
|
213
|
-
}
|
|
214
|
-
const onKeydownEnter = () => {
|
|
215
|
-
handleClick(options.value[hoverIndex.value]);
|
|
216
|
-
closeMenu();
|
|
217
|
-
};
|
|
218
|
-
const onKeydownEsc = () => {
|
|
219
|
-
closeMenu();
|
|
220
|
-
};
|
|
221
459
|
switch (keyCode) {
|
|
222
|
-
case "Enter":
|
|
223
|
-
onKeydownEnter();
|
|
224
|
-
break;
|
|
225
460
|
case "Escape":
|
|
226
|
-
|
|
461
|
+
handleEscape();
|
|
462
|
+
break;
|
|
463
|
+
case "Enter":
|
|
464
|
+
handleEnter();
|
|
227
465
|
break;
|
|
228
466
|
default:
|
|
229
|
-
|
|
467
|
+
handleKeyboardNavigation(keyCode);
|
|
230
468
|
}
|
|
231
469
|
};
|
|
232
|
-
return {
|
|
233
|
-
|
|
234
|
-
|
|
470
|
+
return { handleKeydown, hoverIndex, selectedIndex };
|
|
471
|
+
};
|
|
472
|
+
const flexibleOverlayProps = {
|
|
473
|
+
modelValue: {
|
|
474
|
+
type: Boolean,
|
|
475
|
+
default: false
|
|
476
|
+
},
|
|
477
|
+
origin: {
|
|
478
|
+
type: Object,
|
|
479
|
+
require: true
|
|
480
|
+
},
|
|
481
|
+
position: {
|
|
482
|
+
type: Array,
|
|
483
|
+
default: ["bottom"]
|
|
484
|
+
},
|
|
485
|
+
offset: {
|
|
486
|
+
type: [Number, Object],
|
|
487
|
+
default: 8
|
|
488
|
+
},
|
|
489
|
+
shiftOffset: {
|
|
490
|
+
type: Number
|
|
491
|
+
},
|
|
492
|
+
align: {
|
|
493
|
+
type: String,
|
|
494
|
+
default: null
|
|
495
|
+
},
|
|
496
|
+
showArrow: {
|
|
497
|
+
type: Boolean,
|
|
498
|
+
default: false
|
|
499
|
+
},
|
|
500
|
+
isArrowCenter: {
|
|
501
|
+
type: Boolean,
|
|
502
|
+
default: true
|
|
503
|
+
}
|
|
235
504
|
};
|
|
505
|
+
function getScrollParent(element) {
|
|
506
|
+
const overflowRegex = /(auto|scroll|hidden)/;
|
|
507
|
+
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
508
|
+
const style = window.getComputedStyle(parent);
|
|
509
|
+
if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
|
|
510
|
+
return parent;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return window;
|
|
514
|
+
}
|
|
515
|
+
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
516
|
+
let { x, y } = point;
|
|
517
|
+
if (!isArrowCenter) {
|
|
518
|
+
const { width, height } = originRect;
|
|
519
|
+
if (x && placement.includes("start")) {
|
|
520
|
+
x = 12;
|
|
521
|
+
}
|
|
522
|
+
if (x && placement.includes("end")) {
|
|
523
|
+
x = Math.round(width - 24);
|
|
524
|
+
}
|
|
525
|
+
if (y && placement.includes("start")) {
|
|
526
|
+
y = 10;
|
|
527
|
+
}
|
|
528
|
+
if (y && placement.includes("end")) {
|
|
529
|
+
y = height - 14;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return { x, y };
|
|
533
|
+
}
|
|
534
|
+
function useOverlay(props, emit) {
|
|
535
|
+
const overlayRef = ref();
|
|
536
|
+
const arrowRef = ref();
|
|
537
|
+
let originParent = null;
|
|
538
|
+
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
539
|
+
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
540
|
+
const staticSide = {
|
|
541
|
+
top: "bottom",
|
|
542
|
+
right: "left",
|
|
543
|
+
bottom: "top",
|
|
544
|
+
left: "right"
|
|
545
|
+
}[placement.split("-")[0]];
|
|
546
|
+
Object.assign(arrowEl.style, {
|
|
547
|
+
left: x ? `${x}px` : "",
|
|
548
|
+
top: y ? `${y}px` : "",
|
|
549
|
+
right: "",
|
|
550
|
+
bottom: "",
|
|
551
|
+
[staticSide]: "-4px"
|
|
552
|
+
});
|
|
553
|
+
};
|
|
554
|
+
const updatePosition = async () => {
|
|
555
|
+
const hostEl = props.origin;
|
|
556
|
+
const overlayEl = unref(overlayRef.value);
|
|
557
|
+
const arrowEl = unref(arrowRef.value);
|
|
558
|
+
const middleware = [
|
|
559
|
+
offset(props.offset),
|
|
560
|
+
autoPlacement({
|
|
561
|
+
alignment: props.align,
|
|
562
|
+
allowedPlacements: props.position
|
|
563
|
+
})
|
|
564
|
+
];
|
|
565
|
+
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
566
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
567
|
+
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
568
|
+
strategy: "fixed",
|
|
569
|
+
middleware
|
|
570
|
+
});
|
|
571
|
+
let applyX = x;
|
|
572
|
+
let applyY = y;
|
|
573
|
+
if (props.shiftOffset !== void 0) {
|
|
574
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
575
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
576
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
577
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
578
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
579
|
+
}
|
|
580
|
+
emit("positionChange", placement);
|
|
581
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
582
|
+
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
583
|
+
};
|
|
584
|
+
watch(() => props.modelValue, () => {
|
|
585
|
+
if (props.modelValue && props.origin) {
|
|
586
|
+
originParent = getScrollParent(props.origin);
|
|
587
|
+
nextTick(updatePosition);
|
|
588
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
589
|
+
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
590
|
+
window.addEventListener("resize", updatePosition);
|
|
591
|
+
} else {
|
|
592
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
593
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
594
|
+
window.removeEventListener("resize", updatePosition);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
onUnmounted(() => {
|
|
598
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
599
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
600
|
+
window.removeEventListener("resize", updatePosition);
|
|
601
|
+
});
|
|
602
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
603
|
+
}
|
|
604
|
+
var flexibleOverlay = "";
|
|
605
|
+
const FlexibleOverlay = defineComponent({
|
|
606
|
+
name: "DFlexibleOverlay",
|
|
607
|
+
inheritAttrs: false,
|
|
608
|
+
props: flexibleOverlayProps,
|
|
609
|
+
emits: ["update:modelValue", "positionChange"],
|
|
610
|
+
setup(props, {
|
|
611
|
+
slots,
|
|
612
|
+
attrs,
|
|
613
|
+
emit,
|
|
614
|
+
expose
|
|
615
|
+
}) {
|
|
616
|
+
const ns = useNamespace("flexible-overlay");
|
|
617
|
+
const {
|
|
618
|
+
arrowRef,
|
|
619
|
+
overlayRef,
|
|
620
|
+
updatePosition
|
|
621
|
+
} = useOverlay(props, emit);
|
|
622
|
+
expose({
|
|
623
|
+
updatePosition
|
|
624
|
+
});
|
|
625
|
+
return () => {
|
|
626
|
+
var _a;
|
|
627
|
+
return props.modelValue && createVNode("div", mergeProps({
|
|
628
|
+
"ref": overlayRef,
|
|
629
|
+
"class": ns.b()
|
|
630
|
+
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
631
|
+
"ref": arrowRef,
|
|
632
|
+
"class": ns.e("arrow")
|
|
633
|
+
}, null)]);
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
});
|
|
236
637
|
var EditableSelect = defineComponent({
|
|
237
638
|
name: "DEditableSelect",
|
|
238
639
|
directives: {
|
|
239
|
-
clickOutside: clickoutsideDirective
|
|
640
|
+
clickOutside: clickoutsideDirective,
|
|
641
|
+
dLoading: loadingDirective
|
|
240
642
|
},
|
|
241
643
|
props: editableSelectProps,
|
|
242
644
|
emits: ["update:modelValue", "search", "loadMore"],
|
|
243
645
|
setup(props, ctx2) {
|
|
244
|
-
const
|
|
245
|
-
const {
|
|
246
|
-
optionDisabledKey: disabledKey
|
|
247
|
-
} = props;
|
|
248
|
-
return className("devui-dropdown-item", {
|
|
249
|
-
disabled: disabledKey ? !!option[disabledKey] : false,
|
|
250
|
-
selected: index2 === selectIndex.value,
|
|
251
|
-
"devui-dropdown-bg": index2 === hoverIndex.value
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
const renderDropdown = () => {
|
|
255
|
-
if (props.appendToBody) {
|
|
256
|
-
return createVNode(resolveComponent("d-flexible-overlay"), {
|
|
257
|
-
"origin": origin,
|
|
258
|
-
"visible": visible.value,
|
|
259
|
-
"onUpdate:visible": ($event) => visible.value = $event,
|
|
260
|
-
"position": position,
|
|
261
|
-
"hasBackdrop": false
|
|
262
|
-
}, {
|
|
263
|
-
default: () => [createVNode("div", {
|
|
264
|
-
"class": "devui-editable-select-dropdown",
|
|
265
|
-
"style": {
|
|
266
|
-
width: props.width + "px"
|
|
267
|
-
}
|
|
268
|
-
}, [withDirectives(createVNode("div", {
|
|
269
|
-
"class": "devui-dropdown-menu"
|
|
270
|
-
}, [createVNode("ul", {
|
|
271
|
-
"ref": dopdownRef,
|
|
272
|
-
"class": "devui-list-unstyled scroll-height",
|
|
273
|
-
"style": {
|
|
274
|
-
maxHeight: props.maxHeight + "px"
|
|
275
|
-
},
|
|
276
|
-
"onScroll": loadMore
|
|
277
|
-
}, [filteredOptions.value.map((option, index2) => {
|
|
278
|
-
return createVNode("li", {
|
|
279
|
-
"class": getItemCls(option, index2),
|
|
280
|
-
"onClick": (e) => {
|
|
281
|
-
e.stopPropagation();
|
|
282
|
-
handleClick(option);
|
|
283
|
-
}
|
|
284
|
-
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
|
|
285
|
-
}), withDirectives(createVNode("li", {
|
|
286
|
-
"class": "devui-no-result-template"
|
|
287
|
-
}, [createVNode("div", {
|
|
288
|
-
"class": "devui-no-data-tip"
|
|
289
|
-
}, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
|
|
290
|
-
});
|
|
291
|
-
} else {
|
|
292
|
-
return createVNode(Transition, {
|
|
293
|
-
"name": "fade"
|
|
294
|
-
}, {
|
|
295
|
-
default: () => [withDirectives(createVNode("div", {
|
|
296
|
-
"class": "devui-dropdown-menu"
|
|
297
|
-
}, [createVNode("ul", {
|
|
298
|
-
"ref": dopdownRef,
|
|
299
|
-
"class": "devui-list-unstyled scroll-height",
|
|
300
|
-
"style": {
|
|
301
|
-
maxHeight: props.maxHeight + "px"
|
|
302
|
-
},
|
|
303
|
-
"onScroll": loadMore
|
|
304
|
-
}, [filteredOptions.value.map((option, index2) => {
|
|
305
|
-
return createVNode("li", {
|
|
306
|
-
"class": getItemCls(option, index2),
|
|
307
|
-
"onClick": (e) => {
|
|
308
|
-
e.stopPropagation();
|
|
309
|
-
handleClick(option);
|
|
310
|
-
}
|
|
311
|
-
}, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(option) : option.label]);
|
|
312
|
-
}), withDirectives(createVNode("li", {
|
|
313
|
-
"class": "devui-no-result-template"
|
|
314
|
-
}, [createVNode("div", {
|
|
315
|
-
"class": "devui-no-data-tip"
|
|
316
|
-
}, [emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[vShow, visible.value]])]
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
const dopdownRef = ref();
|
|
646
|
+
const dropdownRef = ref();
|
|
321
647
|
const origin = ref();
|
|
322
|
-
const position =
|
|
323
|
-
originX: "left",
|
|
324
|
-
originY: "bottom",
|
|
325
|
-
overlayX: "left",
|
|
326
|
-
overlayY: "top"
|
|
327
|
-
});
|
|
648
|
+
const position = ref(["bottom"]);
|
|
328
649
|
const visible = ref(false);
|
|
329
650
|
const inputValue = ref(props.modelValue);
|
|
330
|
-
const
|
|
331
|
-
const selectIndex = ref(0);
|
|
651
|
+
const loading2 = ref(props.loading);
|
|
332
652
|
const normalizeOptions = computed(() => {
|
|
333
653
|
return props.options.map((option) => {
|
|
334
654
|
if (typeof option === "object") {
|
|
335
|
-
return
|
|
655
|
+
return Object.assign({}, option, {
|
|
336
656
|
label: option.label ? option.label : option.value,
|
|
337
657
|
value: option.value
|
|
338
|
-
}
|
|
658
|
+
});
|
|
339
659
|
}
|
|
340
660
|
return {
|
|
341
661
|
label: option + "",
|
|
@@ -345,13 +665,16 @@ var EditableSelect = defineComponent({
|
|
|
345
665
|
});
|
|
346
666
|
const filteredOptions = userFilterOptions(normalizeOptions, inputValue, props.filterOption);
|
|
347
667
|
const emptyText = computed(() => {
|
|
348
|
-
let text;
|
|
668
|
+
let text = "";
|
|
349
669
|
if (props.filterOption !== false && !filteredOptions.value.length) {
|
|
350
670
|
text = "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55";
|
|
351
671
|
} else if (props.filterOption === false && !filteredOptions.value.length) {
|
|
352
672
|
text = "\u6CA1\u6709\u6570\u636E";
|
|
353
673
|
}
|
|
354
|
-
return
|
|
674
|
+
return text;
|
|
675
|
+
});
|
|
676
|
+
watch(() => props.loading, (newVal) => {
|
|
677
|
+
loading2.value = newVal;
|
|
355
678
|
});
|
|
356
679
|
const toggleMenu = () => {
|
|
357
680
|
visible.value = !visible.value;
|
|
@@ -361,7 +684,7 @@ var EditableSelect = defineComponent({
|
|
|
361
684
|
};
|
|
362
685
|
const {
|
|
363
686
|
loadMore
|
|
364
|
-
} = useLazyLoad(
|
|
687
|
+
} = useLazyLoad(dropdownRef, inputValue, props.filterOption, ctx2);
|
|
365
688
|
const {
|
|
366
689
|
handleInput
|
|
367
690
|
} = useInput(inputValue, ctx2);
|
|
@@ -369,21 +692,39 @@ var EditableSelect = defineComponent({
|
|
|
369
692
|
const {
|
|
370
693
|
optionDisabledKey: disabledKey
|
|
371
694
|
} = props;
|
|
372
|
-
if (disabledKey && !!option[disabledKey])
|
|
695
|
+
if (disabledKey && !!option[disabledKey]) {
|
|
373
696
|
return;
|
|
697
|
+
}
|
|
374
698
|
ctx2.emit("update:modelValue", option.label);
|
|
375
699
|
closeMenu();
|
|
376
700
|
};
|
|
377
701
|
const {
|
|
378
|
-
handleKeydown
|
|
379
|
-
|
|
702
|
+
handleKeydown,
|
|
703
|
+
hoverIndex,
|
|
704
|
+
selectedIndex
|
|
705
|
+
} = useKeyboardSelect(dropdownRef, visible, inputValue, filteredOptions, props.optionDisabledKey, props.filterOption, loading2, handleClick, closeMenu, toggleMenu);
|
|
380
706
|
watch(() => props.modelValue, (newVal) => {
|
|
381
|
-
|
|
707
|
+
if (newVal) {
|
|
708
|
+
inputValue.value = newVal;
|
|
709
|
+
}
|
|
382
710
|
});
|
|
711
|
+
const getItemCls = (option, index2) => {
|
|
712
|
+
const {
|
|
713
|
+
optionDisabledKey: disabledKey
|
|
714
|
+
} = props;
|
|
715
|
+
return className("devui-dropdown-item", {
|
|
716
|
+
disabled: disabledKey ? !!option[disabledKey] : false,
|
|
717
|
+
selected: index2 === selectedIndex.value,
|
|
718
|
+
"devui-dropdown-bg": index2 === hoverIndex.value
|
|
719
|
+
});
|
|
720
|
+
};
|
|
383
721
|
return () => {
|
|
384
722
|
const selectCls = className("devui-editable-select devui-form-group devui-has-feedback", {
|
|
385
723
|
"devui-select-open": visible.value === true
|
|
386
724
|
});
|
|
725
|
+
const inputCls = className("devui-form-control devui-dropdown-origin", {
|
|
726
|
+
"devui-dropdown-origin-open": visible.value === true
|
|
727
|
+
});
|
|
387
728
|
return withDirectives(createVNode("div", {
|
|
388
729
|
"class": selectCls,
|
|
389
730
|
"ref": origin,
|
|
@@ -391,7 +732,7 @@ var EditableSelect = defineComponent({
|
|
|
391
732
|
width: props.width + "px"
|
|
392
733
|
}
|
|
393
734
|
}, [createVNode("input", {
|
|
394
|
-
"class":
|
|
735
|
+
"class": inputCls,
|
|
395
736
|
"onClick": withModifiers(toggleMenu, ["self"]),
|
|
396
737
|
"onInput": handleInput,
|
|
397
738
|
"onKeydown": handleKeydown,
|
|
@@ -405,19 +746,49 @@ var EditableSelect = defineComponent({
|
|
|
405
746
|
"class": "devui-select-chevron-icon"
|
|
406
747
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
407
748
|
"name": "select-arrow"
|
|
408
|
-
}, null)])]),
|
|
749
|
+
}, null)])]), createVNode(FlexibleOverlay, {
|
|
750
|
+
"origin": origin.value,
|
|
751
|
+
"modelValue": visible.value,
|
|
752
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
753
|
+
"position": position.value,
|
|
754
|
+
"hasBackdrop": false
|
|
755
|
+
}, {
|
|
756
|
+
default: () => [createVNode("div", {
|
|
757
|
+
"style": {
|
|
758
|
+
width: props.width + "px"
|
|
759
|
+
}
|
|
760
|
+
}, [withDirectives(createVNode("div", {
|
|
761
|
+
"class": "devui-dropdown-menu "
|
|
762
|
+
}, [createVNode("ul", {
|
|
763
|
+
"ref": dropdownRef,
|
|
764
|
+
"class": "devui-list-unstyled scroll-height",
|
|
765
|
+
"style": {
|
|
766
|
+
maxHeight: props.maxHeight + "px"
|
|
767
|
+
},
|
|
768
|
+
"onScroll": loadMore
|
|
769
|
+
}, [filteredOptions.value.map((option, index2) => {
|
|
770
|
+
return createVNode("li", {
|
|
771
|
+
"class": getItemCls(option, index2),
|
|
772
|
+
"onClick": (e) => {
|
|
773
|
+
e.stopPropagation();
|
|
774
|
+
handleClick(option);
|
|
775
|
+
}
|
|
776
|
+
}, [ctx2.slots.item ? ctx2.slots.item(option) : option.label]);
|
|
777
|
+
}), withDirectives(createVNode("li", {
|
|
778
|
+
"class": "devui-no-result-template"
|
|
779
|
+
}, [createVNode("div", {
|
|
780
|
+
"class": "devui-no-data-tip"
|
|
781
|
+
}, [ctx2.slots.noResultItem ? ctx2.slots.noResultItem() : emptyText.value])]), [[vShow, !filteredOptions.value.length]])])]), [[resolveDirective("dLoading"), props.loading], [vShow, visible.value]])])]
|
|
782
|
+
})]), [[resolveDirective("click-outside"), closeMenu]]);
|
|
409
783
|
};
|
|
410
784
|
}
|
|
411
785
|
});
|
|
412
|
-
EditableSelect.install = function(app) {
|
|
413
|
-
app.component(EditableSelect.name, EditableSelect);
|
|
414
|
-
};
|
|
415
786
|
var index = {
|
|
416
787
|
title: "EditableSelect \u53EF\u8F93\u5165\u4E0B\u62C9\u9009\u62E9\u6846",
|
|
417
788
|
category: "\u6570\u636E\u5F55\u5165",
|
|
418
789
|
status: "100%",
|
|
419
790
|
install(app) {
|
|
420
|
-
app.
|
|
791
|
+
app.component(EditableSelect.name, EditableSelect);
|
|
421
792
|
}
|
|
422
793
|
};
|
|
423
|
-
export { EditableSelect, index as default };
|
|
794
|
+
export { EditableSelect, index as default, editableSelectProps };
|