vue-devui 1.0.0-pre.0 → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/README.md +126 -187
  2. package/alert/index.es.js +28 -30
  3. package/alert/index.umd.js +1 -1
  4. package/auto-complete/index.es.js +67 -82
  5. package/auto-complete/index.umd.js +3 -1
  6. package/auto-complete/style.css +1 -1
  7. package/badge/index.es.js +1 -1
  8. package/badge/index.umd.js +1 -1
  9. package/badge/style.css +1 -1
  10. package/button/index.es.js +39 -40
  11. package/button/index.umd.js +1 -1
  12. package/countdown/index.es.js +2 -1
  13. package/editable-select/index.es.js +122 -163
  14. package/editable-select/index.umd.js +1 -1
  15. package/fullscreen/index.es.js +13 -16
  16. package/fullscreen/index.umd.js +1 -1
  17. package/icon/index.es.js +39 -57
  18. package/icon/index.umd.js +1 -1
  19. package/image-preview/index.es.js +2 -1
  20. package/modal/index.es.js +81 -76
  21. package/modal/index.umd.js +1 -1
  22. package/modal/style.css +1 -1
  23. package/notification/index.es.js +38 -40
  24. package/notification/index.umd.js +1 -1
  25. package/nuxt/components/PanelBody.js +3 -0
  26. package/nuxt/components/PanelFooter.js +3 -0
  27. package/nuxt/components/PanelHeader.js +3 -0
  28. package/nuxt/components/Timeline.js +3 -0
  29. package/nuxt/components/TimelineItem.js +3 -0
  30. package/nuxt/components/alertProps.js +3 -0
  31. package/nuxt/components/fullscreenProps.js +3 -0
  32. package/nuxt/components/iconProps.js +2 -0
  33. package/nuxt/components/paginationProps.js +3 -0
  34. package/nuxt/components/panelProps.js +3 -0
  35. package/nuxt/components/searchProps.js +3 -0
  36. package/nuxt/components/tagProps.js +3 -0
  37. package/overlay/index.es.js +44 -37
  38. package/overlay/index.umd.js +1 -1
  39. package/overlay/style.css +1 -1
  40. package/package.json +8 -43
  41. package/pagination/index.es.js +10 -12
  42. package/pagination/index.umd.js +1 -1
  43. package/panel/index.es.js +45 -32
  44. package/panel/index.umd.js +1 -1
  45. package/popover/index.es.js +46 -39
  46. package/popover/index.umd.js +6 -6
  47. package/popover/style.css +1 -1
  48. package/progress/index.es.js +1 -1
  49. package/progress/index.umd.js +1 -1
  50. package/progress/style.css +1 -1
  51. package/radio/index.es.js +11 -11
  52. package/radio/index.umd.js +1 -1
  53. package/radio/style.css +1 -1
  54. package/read-tip/index.es.js +6 -3
  55. package/result/index.es.js +38 -53
  56. package/result/index.umd.js +1 -1
  57. package/ripple/index.es.js +47 -42
  58. package/ripple/index.umd.js +1 -1
  59. package/search/index.es.js +2 -5
  60. package/search/index.umd.js +4 -4
  61. package/skeleton/index.es.js +17 -17
  62. package/skeleton/index.umd.js +1 -1
  63. package/slider/index.es.js +60 -59
  64. package/slider/index.umd.js +1 -1
  65. package/splitter/index.es.js +215 -160
  66. package/splitter/index.umd.js +11 -11
  67. package/splitter/style.css +1 -1
  68. package/status/index.es.js +1 -4
  69. package/status/index.umd.js +1 -1
  70. package/status/style.css +1 -1
  71. package/style.css +1 -1
  72. package/tag/index.es.js +15 -18
  73. package/tag/index.umd.js +1 -1
  74. package/tag/style.css +1 -1
  75. package/tag-input/index.es.js +4 -2
  76. package/{accordion → timeline}/index.d.ts +0 -0
  77. package/{time-axis → timeline}/index.es.js +65 -78
  78. package/timeline/index.umd.js +1 -0
  79. package/{anchor → timeline}/package.json +1 -1
  80. package/timeline/style.css +1 -0
  81. package/upload/index.es.js +38 -40
  82. package/upload/index.umd.js +1 -1
  83. package/vue-devui.es.js +1478 -1196
  84. package/vue-devui.umd.js +19 -17
  85. package/accordion/index.es.js +0 -720
  86. package/accordion/index.umd.js +0 -1
  87. package/accordion/package.json +0 -7
  88. package/accordion/style.css +0 -1
  89. package/anchor/index.d.ts +0 -7
  90. package/anchor/index.es.js +0 -263
  91. package/anchor/index.umd.js +0 -1
  92. package/anchor/style.css +0 -1
  93. package/back-top/index.d.ts +0 -7
  94. package/back-top/index.es.js +0 -128
  95. package/back-top/index.umd.js +0 -1
  96. package/back-top/package.json +0 -7
  97. package/back-top/style.css +0 -1
  98. package/breadcrumb/index.d.ts +0 -7
  99. package/breadcrumb/index.es.js +0 -127
  100. package/breadcrumb/index.umd.js +0 -1
  101. package/breadcrumb/package.json +0 -7
  102. package/breadcrumb/style.css +0 -1
  103. package/carousel/index.d.ts +0 -7
  104. package/carousel/index.es.js +0 -329
  105. package/carousel/index.umd.js +0 -1
  106. package/carousel/package.json +0 -7
  107. package/carousel/style.css +0 -1
  108. package/cascader/index.d.ts +0 -7
  109. package/cascader/index.es.js +0 -5963
  110. package/cascader/index.umd.js +0 -27
  111. package/cascader/package.json +0 -7
  112. package/cascader/style.css +0 -1
  113. package/color-picker/index.d.ts +0 -7
  114. package/color-picker/index.es.js +0 -8187
  115. package/color-picker/index.umd.js +0 -27
  116. package/color-picker/package.json +0 -7
  117. package/color-picker/style.css +0 -1
  118. package/date-picker/index.d.ts +0 -7
  119. package/date-picker/index.es.js +0 -1171
  120. package/date-picker/index.umd.js +0 -1
  121. package/date-picker/package.json +0 -7
  122. package/date-picker/style.css +0 -1
  123. package/dragdrop/index.d.ts +0 -7
  124. package/dragdrop/index.es.js +0 -157
  125. package/dragdrop/index.umd.js +0 -1
  126. package/dragdrop/package.json +0 -7
  127. package/drawer/index.d.ts +0 -7
  128. package/drawer/index.es.js +0 -234
  129. package/drawer/index.umd.js +0 -1
  130. package/drawer/package.json +0 -7
  131. package/drawer/style.css +0 -1
  132. package/dropdown/index.d.ts +0 -7
  133. package/dropdown/index.es.js +0 -638
  134. package/dropdown/index.umd.js +0 -1
  135. package/dropdown/package.json +0 -7
  136. package/dropdown/style.css +0 -1
  137. package/form/index.d.ts +0 -7
  138. package/form/index.es.js +0 -7865
  139. package/form/index.umd.js +0 -27
  140. package/form/package.json +0 -7
  141. package/form/style.css +0 -1
  142. package/gantt/index.d.ts +0 -7
  143. package/gantt/index.es.js +0 -523
  144. package/gantt/index.umd.js +0 -1
  145. package/gantt/package.json +0 -7
  146. package/gantt/style.css +0 -1
  147. package/input-icon/index.d.ts +0 -7
  148. package/input-icon/index.es.js +0 -331
  149. package/input-icon/index.umd.js +0 -1
  150. package/input-icon/package.json +0 -7
  151. package/input-icon/style.css +0 -1
  152. package/input-number/index.d.ts +0 -7
  153. package/input-number/index.es.js +0 -240
  154. package/input-number/index.umd.js +0 -1
  155. package/input-number/package.json +0 -7
  156. package/input-number/style.css +0 -1
  157. package/list/index.d.ts +0 -7
  158. package/list/index.es.js +0 -39
  159. package/list/index.umd.js +0 -1
  160. package/list/package.json +0 -7
  161. package/list/style.css +0 -1
  162. package/nav-sprite/index.d.ts +0 -7
  163. package/nav-sprite/index.es.js +0 -68
  164. package/nav-sprite/index.umd.js +0 -1
  165. package/nav-sprite/package.json +0 -7
  166. package/nuxt/components/Accordion.js +0 -3
  167. package/nuxt/components/Anchor.js +0 -3
  168. package/nuxt/components/BackTop.js +0 -3
  169. package/nuxt/components/Breadcrumb.js +0 -3
  170. package/nuxt/components/Carousel.js +0 -3
  171. package/nuxt/components/CarouselItem.js +0 -3
  172. package/nuxt/components/Cascader.js +0 -3
  173. package/nuxt/components/ColorPicker.js +0 -3
  174. package/nuxt/components/Column.js +0 -3
  175. package/nuxt/components/DatePicker.js +0 -3
  176. package/nuxt/components/Drawer.js +0 -3
  177. package/nuxt/components/DrawerService.js +0 -3
  178. package/nuxt/components/Dropdown.js +0 -3
  179. package/nuxt/components/DropdownMenu.js +0 -3
  180. package/nuxt/components/Form.js +0 -3
  181. package/nuxt/components/FormControl.js +0 -3
  182. package/nuxt/components/FormItem.js +0 -3
  183. package/nuxt/components/FormLabel.js +0 -3
  184. package/nuxt/components/FormOperation.js +0 -3
  185. package/nuxt/components/Gantt.js +0 -3
  186. package/nuxt/components/InputIcon.js +0 -3
  187. package/nuxt/components/InputNumber.js +0 -3
  188. package/nuxt/components/List.js +0 -3
  189. package/nuxt/components/ListItem.js +0 -3
  190. package/nuxt/components/NavSprite.js +0 -2
  191. package/nuxt/components/QuadrantDiagram.js +0 -3
  192. package/nuxt/components/Select.js +0 -3
  193. package/nuxt/components/StepsGuide.js +0 -3
  194. package/nuxt/components/StickSlider.js +0 -3
  195. package/nuxt/components/Sticky.js +0 -2
  196. package/nuxt/components/Table.js +0 -3
  197. package/nuxt/components/Tabs.js +0 -3
  198. package/nuxt/components/TimeAxis.js +0 -3
  199. package/nuxt/components/TimeAxisItem.js +0 -3
  200. package/nuxt/components/TimePicker.js +0 -3
  201. package/nuxt/components/Tooltip.js +0 -3
  202. package/nuxt/components/Transfer.js +0 -3
  203. package/nuxt/components/Tree.js +0 -3
  204. package/nuxt/components/TreeSelect.js +0 -3
  205. package/nuxt/components/dropdownMenuProps.js +0 -3
  206. package/nuxt/components/tooltipProps.js +0 -3
  207. package/quadrant-diagram/index.d.ts +0 -7
  208. package/quadrant-diagram/index.es.js +0 -5728
  209. package/quadrant-diagram/index.umd.js +0 -27
  210. package/quadrant-diagram/package.json +0 -7
  211. package/quadrant-diagram/style.css +0 -1
  212. package/select/index.d.ts +0 -7
  213. package/select/index.es.js +0 -706
  214. package/select/index.umd.js +0 -1
  215. package/select/package.json +0 -7
  216. package/select/style.css +0 -1
  217. package/steps-guide/index.d.ts +0 -7
  218. package/steps-guide/index.es.js +0 -239
  219. package/steps-guide/index.umd.js +0 -1
  220. package/steps-guide/package.json +0 -7
  221. package/steps-guide/style.css +0 -1
  222. package/sticky/index.d.ts +0 -7
  223. package/sticky/index.es.js +0 -197
  224. package/sticky/index.umd.js +0 -1
  225. package/sticky/package.json +0 -7
  226. package/table/index.d.ts +0 -7
  227. package/table/index.es.js +0 -1969
  228. package/table/index.umd.js +0 -1
  229. package/table/package.json +0 -7
  230. package/table/style.css +0 -1
  231. package/tabs/index.d.ts +0 -7
  232. package/tabs/index.es.js +0 -194
  233. package/tabs/index.umd.js +0 -1
  234. package/tabs/package.json +0 -7
  235. package/tabs/style.css +0 -1
  236. package/time-axis/index.d.ts +0 -7
  237. package/time-axis/index.umd.js +0 -1
  238. package/time-axis/package.json +0 -7
  239. package/time-axis/style.css +0 -1
  240. package/time-picker/index.d.ts +0 -7
  241. package/time-picker/index.es.js +0 -1237
  242. package/time-picker/index.umd.js +0 -1
  243. package/time-picker/package.json +0 -7
  244. package/time-picker/style.css +0 -1
  245. package/tooltip/index.d.ts +0 -7
  246. package/tooltip/index.es.js +0 -5828
  247. package/tooltip/index.umd.js +0 -27
  248. package/tooltip/package.json +0 -7
  249. package/tooltip/style.css +0 -1
  250. package/transfer/index.d.ts +0 -7
  251. package/transfer/index.es.js +0 -7608
  252. package/transfer/index.umd.js +0 -27
  253. package/transfer/package.json +0 -7
  254. package/transfer/style.css +0 -1
  255. package/tree/index.d.ts +0 -7
  256. package/tree/index.es.js +0 -6490
  257. package/tree/index.umd.js +0 -27
  258. package/tree/package.json +0 -7
  259. package/tree/style.css +0 -1
  260. package/tree-select/index.d.ts +0 -7
  261. package/tree-select/index.es.js +0 -623
  262. package/tree-select/index.umd.js +0 -1
  263. package/tree-select/package.json +0 -7
  264. package/tree-select/style.css +0 -1
@@ -1,706 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, createVNode, inject, computed, mergeProps, toRef, provide, onMounted, onBeforeUnmount, ref, Transition, withDirectives, vShow } from "vue";
21
- const selectProps = {
22
- modelValue: {
23
- type: [String, Number, Array],
24
- default: ""
25
- },
26
- "onUpdate:modelValue": {
27
- type: Function,
28
- default: void 0
29
- },
30
- options: {
31
- type: Array,
32
- default: () => []
33
- },
34
- size: {
35
- type: String,
36
- default: "md"
37
- },
38
- overview: {
39
- type: String,
40
- default: "border"
41
- },
42
- placeholder: {
43
- type: String,
44
- default: "\u8BF7\u9009\u62E9"
45
- },
46
- multiple: {
47
- type: Boolean,
48
- default: false
49
- },
50
- disabled: {
51
- type: Boolean,
52
- default: false
53
- },
54
- allowClear: {
55
- type: Boolean,
56
- default: false
57
- },
58
- optionDisabledKey: {
59
- type: String,
60
- default: ""
61
- },
62
- onToggleChange: {
63
- type: Function,
64
- default: void 0
65
- },
66
- onValueChange: {
67
- type: Function,
68
- default: void 0
69
- }
70
- };
71
- var Icon = defineComponent({
72
- name: "DIcon",
73
- props: {
74
- name: {
75
- type: String,
76
- required: true
77
- },
78
- size: {
79
- type: String,
80
- default: "inherit"
81
- },
82
- color: {
83
- type: String,
84
- default: "inherit"
85
- },
86
- classPrefix: {
87
- type: String,
88
- default: "icon"
89
- }
90
- },
91
- setup(props) {
92
- return __spreadValues({}, props);
93
- },
94
- render() {
95
- const {
96
- name,
97
- size,
98
- color,
99
- classPrefix
100
- } = this;
101
- return /^((https?):)?\/\//.test(name) ? createVNode("img", {
102
- "src": name,
103
- "alt": name.split("/")[name.split("/").length - 1],
104
- "style": {
105
- width: size,
106
- verticalAlign: "text-bottom"
107
- }
108
- }, null) : createVNode("i", {
109
- "class": `${classPrefix} ${classPrefix}-${name}`,
110
- "style": {
111
- fontSize: size,
112
- color
113
- }
114
- }, null);
115
- }
116
- });
117
- Icon.install = function(app) {
118
- app.component(Icon.name, Icon);
119
- };
120
- var checkbox = "";
121
- const commonProps = {
122
- name: {
123
- type: String,
124
- default: void 0
125
- },
126
- halfchecked: {
127
- type: Boolean,
128
- default: false
129
- },
130
- isShowTitle: {
131
- type: Boolean,
132
- default: true
133
- },
134
- title: {
135
- type: String
136
- },
137
- color: {
138
- type: String,
139
- default: void 0
140
- },
141
- showAnimation: {
142
- type: Boolean,
143
- default: true
144
- },
145
- disabled: {
146
- type: Boolean,
147
- default: false
148
- },
149
- beforeChange: {
150
- type: Function,
151
- default: void 0
152
- }
153
- };
154
- const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
155
- halfchecked: {
156
- type: Boolean,
157
- default: false
158
- },
159
- checked: {
160
- type: Boolean,
161
- default: false
162
- },
163
- value: {
164
- type: String
165
- },
166
- label: {
167
- type: String,
168
- default: void 0
169
- },
170
- title: {
171
- type: String,
172
- default: void 0
173
- },
174
- "onUpdate:checked": {
175
- type: Function,
176
- default: void 0
177
- },
178
- onChange: {
179
- type: Function,
180
- default: void 0
181
- },
182
- modelValue: {
183
- type: Boolean
184
- },
185
- "onUpdate:modelValue": {
186
- type: Function
187
- }
188
- });
189
- const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
190
- modelValue: {
191
- type: Array,
192
- required: true
193
- },
194
- direction: {
195
- type: String,
196
- default: "column"
197
- },
198
- itemWidth: {
199
- type: Number,
200
- default: void 0
201
- },
202
- options: {
203
- type: Array,
204
- default: () => []
205
- },
206
- onChange: {
207
- type: Function,
208
- default: void 0
209
- },
210
- "onUpdate:modelValue": {
211
- type: Function,
212
- default: void 0
213
- }
214
- });
215
- const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
216
- var Checkbox = defineComponent({
217
- name: "DCheckbox",
218
- props: checkboxProps,
219
- emits: ["change", "update:checked", "update:modelValue"],
220
- setup(props, ctx) {
221
- const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
222
- const isChecked = computed(() => props.checked || props.modelValue);
223
- const mergedDisabled = computed(() => {
224
- return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
225
- });
226
- const mergedChecked = computed(() => {
227
- var _a, _b;
228
- return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
229
- });
230
- const mergedIsShowTitle = computed(() => {
231
- var _a;
232
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
233
- });
234
- const mergedShowAnimation = computed(() => {
235
- var _a;
236
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
237
- });
238
- const mergedColor = computed(() => {
239
- var _a;
240
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
241
- });
242
- const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
243
- const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
244
- const canChange = (isChecked2, val) => {
245
- var _a;
246
- if (mergedDisabled.value) {
247
- return Promise.resolve(false);
248
- }
249
- const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
250
- if (beforeChange) {
251
- const res = beforeChange(isChecked2, val);
252
- if (typeof res === "boolean") {
253
- return Promise.resolve(res);
254
- }
255
- return res;
256
- }
257
- return Promise.resolve(true);
258
- };
259
- const toggle = () => {
260
- const current = !isChecked.value;
261
- checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
262
- ctx.emit("update:checked", current);
263
- ctx.emit("update:modelValue", current);
264
- ctx.emit("change", current);
265
- };
266
- const handleClick = () => {
267
- canChange(!isChecked.value, props.label).then((res) => res && toggle());
268
- };
269
- return {
270
- itemWidth,
271
- direction,
272
- mergedColor,
273
- mergedDisabled,
274
- mergedIsShowTitle,
275
- mergedChecked,
276
- mergedShowAnimation,
277
- handleClick
278
- };
279
- },
280
- render() {
281
- var _a;
282
- const {
283
- itemWidth,
284
- direction,
285
- mergedChecked,
286
- mergedDisabled,
287
- mergedIsShowTitle,
288
- mergedShowAnimation,
289
- halfchecked,
290
- title,
291
- label,
292
- handleClick,
293
- name,
294
- value,
295
- mergedColor,
296
- $slots
297
- } = this;
298
- const wrapperCls = {
299
- "devui-checkbox-column-margin": direction === "column",
300
- "devui-checkbox-wrap": typeof itemWidth !== "undefined"
301
- };
302
- const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
303
- const checkboxCls = {
304
- "devui-checkbox": true,
305
- active: mergedChecked,
306
- halfchecked,
307
- disabled: mergedDisabled,
308
- unchecked: !mergedChecked
309
- };
310
- const labelTitle = mergedIsShowTitle ? title || label : "";
311
- const bgImgStyle = mergedColor && halfchecked || mergedColor ? `linear-gradient(${mergedColor}, ${mergedColor})` : "";
312
- const spanStyle = [`border-color:${(mergedChecked || halfchecked) && mergedColor ? mergedColor : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor && halfchecked ? mergedColor : ""}`];
313
- const spanCls = {
314
- "devui-checkbox-material": true,
315
- "custom-color": mergedColor,
316
- "devui-checkbox-no-label": !label && !$slots.default,
317
- "devui-no-animation": !mergedShowAnimation,
318
- "devui-checkbox-default-background": !halfchecked
319
- };
320
- const polygonCls = {
321
- "devui-tick": true,
322
- "devui-no-animation": !mergedShowAnimation
323
- };
324
- const stopPropagation = ($event) => $event.stopPropagation();
325
- const inputProps = {
326
- indeterminate: halfchecked
327
- };
328
- return createVNode("div", {
329
- "class": wrapperCls,
330
- "style": wrapperStyle
331
- }, [createVNode("div", {
332
- "class": checkboxCls
333
- }, [createVNode("label", {
334
- "title": labelTitle,
335
- "onClick": handleClick
336
- }, [createVNode("input", mergeProps({
337
- "name": name || value,
338
- "class": "devui-checkbox-input",
339
- "type": "checkbox"
340
- }, inputProps, {
341
- "checked": mergedChecked,
342
- "disabled": mergedDisabled,
343
- "onClick": stopPropagation,
344
- "onChange": stopPropagation
345
- }), null), createVNode("span", {
346
- "style": spanStyle,
347
- "class": spanCls
348
- }, [createVNode("span", {
349
- "class": "devui-checkbox-halfchecked-bg"
350
- }, null), createVNode("svg", {
351
- "viewBox": "0 0 16 16",
352
- "version": "1.1",
353
- "xmlns": "http://www.w3.org/2000/svg",
354
- "class": "devui-checkbox-tick"
355
- }, [createVNode("g", {
356
- "stroke": "none",
357
- "stroke-width": "1",
358
- "fill": "none",
359
- "fill-rule": "evenodd"
360
- }, [createVNode("polygon", {
361
- "fill-rule": "nonzero",
362
- "points": "5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",
363
- "class": polygonCls
364
- }, null)])])]), label || ((_a = $slots.default) == null ? void 0 : _a.call($slots))])])]);
365
- }
366
- });
367
- var checkboxGroup = "";
368
- var CheckboxGroup = defineComponent({
369
- name: "DCheckboxGroup",
370
- props: checkboxGroupProps,
371
- emits: ["change", "update:modelValue"],
372
- setup(props, ctx) {
373
- const valList = toRef(props, "modelValue");
374
- const defaultOpt = {
375
- checked: false,
376
- isShowTitle: true,
377
- halfchecked: false,
378
- showAnimation: true,
379
- disabled: false
380
- };
381
- const toggleGroupVal = (val) => {
382
- let index2 = -1;
383
- if (typeof valList.value[0] === "string") {
384
- index2 = valList.value.findIndex((item) => item === val);
385
- } else if (typeof valList.value[0] === "object") {
386
- index2 = valList.value.findIndex((item) => item.value === val);
387
- }
388
- if (index2 === -1) {
389
- if (typeof props.options[0] === "object") {
390
- const newOne = props.options.find((item) => item.value === val);
391
- const res2 = [...valList.value, newOne];
392
- ctx.emit("update:modelValue", res2);
393
- ctx.emit("change", res2);
394
- return;
395
- }
396
- const res = [...valList.value, val];
397
- ctx.emit("update:modelValue", res);
398
- ctx.emit("change", res);
399
- return;
400
- }
401
- valList.value.splice(index2, 1);
402
- ctx.emit("update:modelValue", valList.value);
403
- ctx.emit("change", valList.value);
404
- };
405
- const isItemChecked = (itemVal) => {
406
- if (typeof valList.value[0] === "string") {
407
- return valList.value.includes(itemVal);
408
- } else if (typeof valList.value[0] === "object") {
409
- return valList.value.some((item) => item.value === itemVal);
410
- }
411
- };
412
- provide(checkboxGroupInjectionKey, {
413
- disabled: toRef(props, "disabled"),
414
- isShowTitle: toRef(props, "isShowTitle"),
415
- color: toRef(props, "color"),
416
- showAnimation: toRef(props, "showAnimation"),
417
- beforeChange: props.beforeChange,
418
- isItemChecked,
419
- toggleGroupVal,
420
- itemWidth: toRef(props, "itemWidth"),
421
- direction: toRef(props, "direction")
422
- });
423
- return {
424
- defaultOpt
425
- };
426
- },
427
- render() {
428
- var _a;
429
- const {
430
- direction,
431
- $slots,
432
- defaultOpt,
433
- options
434
- } = this;
435
- let children = (_a = $slots.default) == null ? void 0 : _a.call($slots);
436
- if ((options == null ? void 0 : options.length) > 0) {
437
- children = options.map((opt) => {
438
- let mergedOpt = null;
439
- if (typeof opt === "string") {
440
- mergedOpt = Object.assign({}, defaultOpt, {
441
- label: opt,
442
- value: opt
443
- });
444
- } else if (typeof opt === "object") {
445
- mergedOpt = Object.assign({}, defaultOpt, __spreadProps(__spreadValues({}, opt), {
446
- label: opt.name
447
- }));
448
- }
449
- return createVNode(Checkbox, mergedOpt, null);
450
- });
451
- }
452
- return createVNode("div", {
453
- "class": "devui-checkbox-group"
454
- }, [createVNode("div", {
455
- "class": {
456
- "devui-checkbox-list-inline": direction === "row"
457
- }
458
- }, [children])]);
459
- }
460
- });
461
- Checkbox.install = function(app) {
462
- app.component(Checkbox.name, Checkbox);
463
- };
464
- CheckboxGroup.install = function(app) {
465
- app.component(CheckboxGroup.name, CheckboxGroup);
466
- };
467
- function className(classStr, classOpt) {
468
- let classname = classStr;
469
- if (typeof classOpt === "object") {
470
- Object.keys(classOpt).forEach((key) => {
471
- classOpt[key] && (classname += ` ${key}`);
472
- });
473
- }
474
- return classname;
475
- }
476
- function useCacheOptions(mergeOptions) {
477
- const cacheOptions = computed(() => {
478
- const map = /* @__PURE__ */ new Map();
479
- mergeOptions.value.forEach((item) => {
480
- map.set(item.value, item);
481
- });
482
- return map;
483
- });
484
- const getValuesOption = (values) => values.map((value) => cacheOptions.value.get(value));
485
- return getValuesOption;
486
- }
487
- function useSelectOutsideClick(refs, isOpen, toggleChange) {
488
- function onGlobalMouseDown(e) {
489
- var _a, _b;
490
- let target = e.target;
491
- if (target.shadowRoot && e.composed) {
492
- target = e.composedPath()[0] || target;
493
- }
494
- const element = [(_a = refs[0]) == null ? void 0 : _a.value, (_b = refs[1]) == null ? void 0 : _b.value];
495
- if (isOpen.value && element.every((el) => el && !el.contains(target) && el !== target)) {
496
- toggleChange(false);
497
- }
498
- }
499
- onMounted(() => {
500
- document.body.addEventListener("mousedown", onGlobalMouseDown, false);
501
- });
502
- onBeforeUnmount(() => {
503
- document.body.addEventListener("mousedown", onGlobalMouseDown, false);
504
- });
505
- }
506
- var select = "";
507
- var Select = defineComponent({
508
- name: "DSelect",
509
- props: selectProps,
510
- emits: ["toggleChange", "valueChange", "update:modelValue"],
511
- setup(props, ctx) {
512
- const containerRef = ref(null);
513
- const dropdownRef = ref(null);
514
- const isOpen = ref(false);
515
- function toggleChange(bool) {
516
- if (props.disabled)
517
- return;
518
- isOpen.value = bool;
519
- ctx.emit("toggleChange", bool);
520
- }
521
- useSelectOutsideClick([containerRef, dropdownRef], isOpen, toggleChange);
522
- const mergeOptions = computed(() => {
523
- const {
524
- multiple,
525
- modelValue
526
- } = props;
527
- return props.options.map((item) => {
528
- let option;
529
- if (typeof item === "object") {
530
- option = __spreadValues({
531
- name: item.name ? item.name : item.value + "",
532
- value: item.value,
533
- _checked: false
534
- }, item);
535
- } else {
536
- option = {
537
- name: item + "",
538
- value: item,
539
- _checked: false
540
- };
541
- }
542
- if (multiple) {
543
- if (Array.isArray(modelValue)) {
544
- option._checked = modelValue.includes(option.value);
545
- } else {
546
- option._checked = false;
547
- }
548
- }
549
- return option;
550
- });
551
- });
552
- const getValuesOption = useCacheOptions(mergeOptions);
553
- const inputValue = computed(() => {
554
- var _a;
555
- if (props.multiple && Array.isArray(props.modelValue)) {
556
- const selectedOptions = getValuesOption(props.modelValue);
557
- return selectedOptions.map((item) => item.name).join(",");
558
- } else if (!Array.isArray(props.modelValue)) {
559
- return ((_a = getValuesOption([props.modelValue])[0]) == null ? void 0 : _a.name) || "";
560
- }
561
- return "";
562
- });
563
- const mergeClearable = computed(() => {
564
- return !props.disabled && props.allowClear && inputValue.value.length > 0;
565
- });
566
- function valueChange(item, index2) {
567
- const {
568
- multiple,
569
- optionDisabledKey: disabledKey
570
- } = props;
571
- let {
572
- modelValue
573
- } = props;
574
- if (disabledKey && !!item[disabledKey])
575
- return;
576
- if (multiple) {
577
- item._checked = !item._checked;
578
- modelValue = mergeOptions.value.filter((item2) => item2._checked).map((item2) => item2.value);
579
- ctx.emit("update:modelValue", modelValue);
580
- } else {
581
- ctx.emit("update:modelValue", item.value);
582
- toggleChange(false);
583
- }
584
- ctx.emit("valueChange", item, index2);
585
- }
586
- function getItemClassName(item) {
587
- const {
588
- optionDisabledKey: disabledKey
589
- } = props;
590
- return className("devui-select-item", {
591
- active: item.value === props.modelValue,
592
- disabled: disabledKey ? !!item[disabledKey] : false
593
- });
594
- }
595
- function handleClear(e) {
596
- e.preventDefault();
597
- e.stopPropagation();
598
- if (props.multiple) {
599
- ctx.emit("update:modelValue", []);
600
- } else {
601
- ctx.emit("update:modelValue", "");
602
- }
603
- }
604
- return {
605
- isOpen,
606
- containerRef,
607
- dropdownRef,
608
- inputValue,
609
- mergeOptions,
610
- mergeClearable,
611
- valueChange,
612
- toggleChange,
613
- getItemClassName,
614
- handleClear
615
- };
616
- },
617
- render() {
618
- const {
619
- mergeOptions,
620
- isOpen,
621
- inputValue,
622
- size,
623
- multiple,
624
- disabled,
625
- optionDisabledKey: disabledKey,
626
- placeholder,
627
- overview,
628
- valueChange,
629
- toggleChange,
630
- getItemClassName,
631
- mergeClearable,
632
- handleClear
633
- } = this;
634
- const selectCls = className("devui-select", {
635
- "devui-select-open": isOpen,
636
- "devui-dropdown-menu-multiple": multiple,
637
- "devui-select-lg": size === "lg",
638
- "devui-select-sm": size === "sm",
639
- "devui-select-underlined": overview === "underlined",
640
- "devui-select-disabled": disabled
641
- });
642
- const inputCls = className("devui-select-input", {
643
- "devui-select-input-lg": size === "lg",
644
- "devui-select-input-sm": size === "sm"
645
- });
646
- const selectionCls = className("devui-select-selection", {
647
- "devui-select-clearable": mergeClearable
648
- });
649
- return createVNode("div", {
650
- "class": selectCls,
651
- "ref": "containerRef"
652
- }, [createVNode("div", {
653
- "class": selectionCls,
654
- "onClick": () => toggleChange(!isOpen)
655
- }, [createVNode("input", {
656
- "value": inputValue,
657
- "type": "text",
658
- "class": inputCls,
659
- "placeholder": placeholder,
660
- "readonly": true,
661
- "disabled": disabled
662
- }, null), createVNode("span", {
663
- "onClick": handleClear,
664
- "class": "devui-select-clear"
665
- }, [createVNode(Icon, {
666
- "name": "close"
667
- }, null)]), createVNode("span", {
668
- "class": "devui-select-arrow"
669
- }, [createVNode(Icon, {
670
- "name": "select-arrow"
671
- }, null)])]), createVNode(Transition, {
672
- "name": "fade",
673
- "ref": "dropdownRef"
674
- }, {
675
- default: () => [withDirectives(createVNode("div", {
676
- "class": "devui-select-dropdown"
677
- }, [createVNode("ul", {
678
- "class": "devui-select-dropdown-list devui-scrollbar"
679
- }, [mergeOptions.map((item, i) => createVNode("li", {
680
- "onClick": (e) => {
681
- e.preventDefault();
682
- e.stopPropagation();
683
- valueChange(item, i);
684
- },
685
- "class": getItemClassName(item),
686
- "key": i
687
- }, [multiple ? createVNode(Checkbox, {
688
- "modelValue": item._checked,
689
- "label": item.name,
690
- "disabled": disabledKey ? !!item[disabledKey] : false
691
- }, null) : item.name]))])]), [[vShow, isOpen]])]
692
- })]);
693
- }
694
- });
695
- Select.install = function(app) {
696
- app.component(Select.name, Select);
697
- };
698
- var index = {
699
- title: "Select \u4E0B\u62C9\u6846",
700
- category: "\u6570\u636E\u5F55\u5165",
701
- status: "10%",
702
- install(app) {
703
- app.use(Select);
704
- }
705
- };
706
- export { Select, index as default };