vue-devui 1.0.0-rc.1 → 1.0.0-rc.4

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 (293) hide show
  1. package/README.md +132 -200
  2. package/auto-complete/index.es.js +150 -110
  3. package/auto-complete/index.umd.js +5 -1
  4. package/auto-complete/style.css +1 -1
  5. package/avatar/index.es.js +77 -81
  6. package/avatar/index.umd.js +1 -1
  7. package/button/index.es.js +23 -15
  8. package/button/index.umd.js +1 -1
  9. package/button/style.css +1 -1
  10. package/card/index.es.js +3 -6
  11. package/card/index.umd.js +1 -1
  12. package/checkbox/index.es.js +5 -11
  13. package/checkbox/index.umd.js +1 -1
  14. package/comment/index.es.js +4 -6
  15. package/comment/index.umd.js +1 -1
  16. package/countdown/index.es.js +3 -6
  17. package/countdown/index.umd.js +1 -1
  18. package/editable-select/index.es.js +120 -167
  19. package/editable-select/index.umd.js +1 -1
  20. package/grid/index.es.js +30 -36
  21. package/grid/index.umd.js +1 -1
  22. package/image-preview/index.es.js +19 -19
  23. package/image-preview/index.umd.js +1 -1
  24. package/input/index.es.js +2 -5
  25. package/input/index.umd.js +1 -1
  26. package/layout/index.es.js +9 -22
  27. package/layout/index.umd.js +1 -1
  28. package/loading/index.es.js +40 -25
  29. package/loading/index.umd.js +1 -1
  30. package/modal/index.es.js +55 -47
  31. package/modal/index.umd.js +1 -1
  32. package/notification/index.es.js +100 -10
  33. package/notification/index.umd.js +1 -1
  34. package/notification/style.css +1 -1
  35. package/nuxt/components/DropdownPropsKey.js +3 -0
  36. package/nuxt/components/LoadingOptions.js +3 -0
  37. package/nuxt/components/autoCompleteProps.js +3 -0
  38. package/nuxt/components/avatarProps.js +3 -0
  39. package/nuxt/components/cardProps.js +3 -0
  40. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  41. package/nuxt/components/checkboxGroupProps.js +3 -0
  42. package/nuxt/components/checkboxProps.js +3 -0
  43. package/nuxt/components/colProps.js +3 -0
  44. package/nuxt/components/colPropsBaseClass.js +3 -0
  45. package/nuxt/components/colPropsBaseStyle.js +3 -0
  46. package/nuxt/components/commentProps.js +3 -0
  47. package/nuxt/components/countdownProps.js +3 -0
  48. package/nuxt/components/editableSelectProps.js +3 -0
  49. package/nuxt/components/imagePreviewProps.js +3 -0
  50. package/nuxt/components/inputProps.js +3 -0
  51. package/nuxt/components/loadingProps.js +3 -0
  52. package/nuxt/components/modalProps.js +3 -0
  53. package/nuxt/components/progressProps.js +3 -0
  54. package/nuxt/components/rateProps.js +3 -0
  55. package/nuxt/components/readTipProps.js +3 -0
  56. package/nuxt/components/resultProps.js +3 -0
  57. package/nuxt/components/rowProps.js +3 -0
  58. package/nuxt/components/screenSizes.js +3 -0
  59. package/nuxt/components/skeletonProps.js +3 -0
  60. package/nuxt/components/sliderProps.js +3 -0
  61. package/nuxt/components/splitterProps.js +3 -0
  62. package/nuxt/components/statisticProps.js +3 -0
  63. package/nuxt/components/switchProps.js +3 -0
  64. package/nuxt/components/tagInputProps.js +3 -0
  65. package/nuxt/components/tagProps.js +3 -0
  66. package/nuxt/components/textareaProps.js +3 -0
  67. package/nuxt/components/timeAxisProps.js +3 -0
  68. package/overlay/index.es.js +5 -5
  69. package/overlay/index.umd.js +1 -1
  70. package/package.json +1 -1
  71. package/pagination/index.es.js +14 -13
  72. package/pagination/index.umd.js +1 -1
  73. package/popover/index.es.js +7 -7
  74. package/popover/index.umd.js +12 -12
  75. package/progress/index.es.js +34 -36
  76. package/progress/index.umd.js +3 -3
  77. package/progress/style.css +1 -1
  78. package/radio/index.es.js +8 -2
  79. package/radio/index.umd.js +1 -1
  80. package/radio/style.css +1 -1
  81. package/rate/index.es.js +4 -7
  82. package/rate/index.umd.js +1 -1
  83. package/read-tip/index.es.js +34 -34
  84. package/read-tip/index.umd.js +1 -1
  85. package/read-tip/style.css +1 -1
  86. package/result/index.es.js +2 -5
  87. package/result/index.umd.js +1 -1
  88. package/ripple/index.es.js +43 -42
  89. package/ripple/index.umd.js +1 -1
  90. package/search/index.es.js +11 -11
  91. package/search/index.umd.js +8 -8
  92. package/skeleton/index.es.js +9 -12
  93. package/skeleton/index.umd.js +1 -1
  94. package/slider/index.es.js +59 -62
  95. package/slider/index.umd.js +1 -1
  96. package/splitter/index.es.js +176 -136
  97. package/splitter/index.umd.js +13 -13
  98. package/statistic/index.es.js +7 -18
  99. package/statistic/index.umd.js +1 -1
  100. package/style.css +1 -1
  101. package/switch/index.es.js +4 -7
  102. package/switch/index.umd.js +1 -1
  103. package/switch/style.css +1 -1
  104. package/tag/index.es.js +13 -17
  105. package/tag/index.umd.js +1 -1
  106. package/tag/style.css +1 -1
  107. package/tag-input/index.es.js +3 -6
  108. package/tag-input/index.umd.js +1 -1
  109. package/textarea/index.es.js +2 -5
  110. package/textarea/index.umd.js +1 -1
  111. package/timeline/index.es.js +10 -16
  112. package/timeline/index.umd.js +1 -1
  113. package/upload/index.es.js +160 -67
  114. package/upload/index.umd.js +1 -1
  115. package/upload/style.css +1 -1
  116. package/vue-devui.es.js +12182 -24718
  117. package/vue-devui.umd.js +24 -20
  118. package/accordion/index.d.ts +0 -7
  119. package/accordion/index.es.js +0 -723
  120. package/accordion/index.umd.js +0 -1
  121. package/accordion/package.json +0 -7
  122. package/accordion/style.css +0 -1
  123. package/anchor/index.d.ts +0 -7
  124. package/anchor/index.es.js +0 -263
  125. package/anchor/index.umd.js +0 -1
  126. package/anchor/package.json +0 -7
  127. package/anchor/style.css +0 -1
  128. package/back-top/index.d.ts +0 -7
  129. package/back-top/index.es.js +0 -130
  130. package/back-top/index.umd.js +0 -1
  131. package/back-top/package.json +0 -7
  132. package/back-top/style.css +0 -1
  133. package/breadcrumb/index.d.ts +0 -7
  134. package/breadcrumb/index.es.js +0 -128
  135. package/breadcrumb/index.umd.js +0 -1
  136. package/breadcrumb/package.json +0 -7
  137. package/breadcrumb/style.css +0 -1
  138. package/carousel/index.d.ts +0 -7
  139. package/carousel/index.es.js +0 -314
  140. package/carousel/index.umd.js +0 -1
  141. package/carousel/package.json +0 -7
  142. package/carousel/style.css +0 -1
  143. package/cascader/index.d.ts +0 -7
  144. package/cascader/index.es.js +0 -5971
  145. package/cascader/index.umd.js +0 -27
  146. package/cascader/package.json +0 -7
  147. package/cascader/style.css +0 -1
  148. package/color-picker/index.d.ts +0 -7
  149. package/color-picker/index.es.js +0 -8196
  150. package/color-picker/index.umd.js +0 -27
  151. package/color-picker/package.json +0 -7
  152. package/color-picker/style.css +0 -1
  153. package/date-picker/index.d.ts +0 -7
  154. package/date-picker/index.es.js +0 -1154
  155. package/date-picker/index.umd.js +0 -1
  156. package/date-picker/package.json +0 -7
  157. package/date-picker/style.css +0 -1
  158. package/dragdrop/index.d.ts +0 -7
  159. package/dragdrop/index.es.js +0 -157
  160. package/dragdrop/index.umd.js +0 -1
  161. package/dragdrop/package.json +0 -7
  162. package/drawer/index.d.ts +0 -7
  163. package/drawer/index.es.js +0 -234
  164. package/drawer/index.umd.js +0 -1
  165. package/drawer/package.json +0 -7
  166. package/drawer/style.css +0 -1
  167. package/dropdown/index.d.ts +0 -7
  168. package/dropdown/index.es.js +0 -693
  169. package/dropdown/index.umd.js +0 -1
  170. package/dropdown/package.json +0 -7
  171. package/dropdown/style.css +0 -1
  172. package/form/index.d.ts +0 -7
  173. package/form/index.es.js +0 -7876
  174. package/form/index.umd.js +0 -27
  175. package/form/package.json +0 -7
  176. package/form/style.css +0 -1
  177. package/gantt/index.d.ts +0 -7
  178. package/gantt/index.es.js +0 -523
  179. package/gantt/index.umd.js +0 -1
  180. package/gantt/package.json +0 -7
  181. package/gantt/style.css +0 -1
  182. package/input-icon/index.d.ts +0 -7
  183. package/input-icon/index.es.js +0 -332
  184. package/input-icon/index.umd.js +0 -1
  185. package/input-icon/package.json +0 -7
  186. package/input-icon/style.css +0 -1
  187. package/input-number/index.d.ts +0 -7
  188. package/input-number/index.es.js +0 -229
  189. package/input-number/index.umd.js +0 -1
  190. package/input-number/package.json +0 -7
  191. package/input-number/style.css +0 -1
  192. package/list/index.d.ts +0 -7
  193. package/list/index.es.js +0 -39
  194. package/list/index.umd.js +0 -1
  195. package/list/package.json +0 -7
  196. package/list/style.css +0 -1
  197. package/nav-sprite/index.d.ts +0 -7
  198. package/nav-sprite/index.es.js +0 -68
  199. package/nav-sprite/index.umd.js +0 -1
  200. package/nav-sprite/package.json +0 -7
  201. package/nuxt/components/Accordion.js +0 -3
  202. package/nuxt/components/Anchor.js +0 -3
  203. package/nuxt/components/BackTop.js +0 -3
  204. package/nuxt/components/Breadcrumb.js +0 -3
  205. package/nuxt/components/Carousel.js +0 -3
  206. package/nuxt/components/CarouselItem.js +0 -3
  207. package/nuxt/components/Cascader.js +0 -3
  208. package/nuxt/components/ColorPicker.js +0 -3
  209. package/nuxt/components/Column.js +0 -3
  210. package/nuxt/components/DatePicker.js +0 -3
  211. package/nuxt/components/Drawer.js +0 -3
  212. package/nuxt/components/DrawerService.js +0 -3
  213. package/nuxt/components/Dropdown.js +0 -3
  214. package/nuxt/components/DropdownMenu.js +0 -3
  215. package/nuxt/components/Form.js +0 -3
  216. package/nuxt/components/FormControl.js +0 -3
  217. package/nuxt/components/FormItem.js +0 -3
  218. package/nuxt/components/FormLabel.js +0 -3
  219. package/nuxt/components/FormOperation.js +0 -3
  220. package/nuxt/components/Gantt.js +0 -3
  221. package/nuxt/components/InputIcon.js +0 -3
  222. package/nuxt/components/InputNumber.js +0 -3
  223. package/nuxt/components/List.js +0 -3
  224. package/nuxt/components/ListItem.js +0 -3
  225. package/nuxt/components/NavSprite.js +0 -2
  226. package/nuxt/components/QuadrantDiagram.js +0 -3
  227. package/nuxt/components/Select.js +0 -3
  228. package/nuxt/components/StepsGuide.js +0 -3
  229. package/nuxt/components/StickSlider.js +0 -3
  230. package/nuxt/components/Sticky.js +0 -2
  231. package/nuxt/components/Table.js +0 -3
  232. package/nuxt/components/Tabs.js +0 -3
  233. package/nuxt/components/TimePicker.js +0 -3
  234. package/nuxt/components/Tooltip.js +0 -3
  235. package/nuxt/components/Transfer.js +0 -3
  236. package/nuxt/components/Tree.js +0 -3
  237. package/nuxt/components/TreeSelect.js +0 -3
  238. package/nuxt/components/dropdownMenuProps.js +0 -3
  239. package/nuxt/components/tooltipProps.js +0 -3
  240. package/quadrant-diagram/index.d.ts +0 -7
  241. package/quadrant-diagram/index.es.js +0 -5728
  242. package/quadrant-diagram/index.umd.js +0 -27
  243. package/quadrant-diagram/package.json +0 -7
  244. package/quadrant-diagram/style.css +0 -1
  245. package/select/index.d.ts +0 -7
  246. package/select/index.es.js +0 -706
  247. package/select/index.umd.js +0 -1
  248. package/select/package.json +0 -7
  249. package/select/style.css +0 -1
  250. package/steps-guide/index.d.ts +0 -7
  251. package/steps-guide/index.es.js +0 -242
  252. package/steps-guide/index.umd.js +0 -1
  253. package/steps-guide/package.json +0 -7
  254. package/steps-guide/style.css +0 -1
  255. package/sticky/index.d.ts +0 -7
  256. package/sticky/index.es.js +0 -197
  257. package/sticky/index.umd.js +0 -1
  258. package/sticky/package.json +0 -7
  259. package/table/index.d.ts +0 -7
  260. package/table/index.es.js +0 -2024
  261. package/table/index.umd.js +0 -1
  262. package/table/package.json +0 -7
  263. package/table/style.css +0 -1
  264. package/tabs/index.d.ts +0 -7
  265. package/tabs/index.es.js +0 -194
  266. package/tabs/index.umd.js +0 -1
  267. package/tabs/package.json +0 -7
  268. package/tabs/style.css +0 -1
  269. package/time-picker/index.d.ts +0 -7
  270. package/time-picker/index.es.js +0 -1238
  271. package/time-picker/index.umd.js +0 -1
  272. package/time-picker/package.json +0 -7
  273. package/time-picker/style.css +0 -1
  274. package/tooltip/index.d.ts +0 -7
  275. package/tooltip/index.es.js +0 -5835
  276. package/tooltip/index.umd.js +0 -27
  277. package/tooltip/package.json +0 -7
  278. package/tooltip/style.css +0 -1
  279. package/transfer/index.d.ts +0 -7
  280. package/transfer/index.es.js +0 -7615
  281. package/transfer/index.umd.js +0 -27
  282. package/transfer/package.json +0 -7
  283. package/transfer/style.css +0 -1
  284. package/tree/index.d.ts +0 -7
  285. package/tree/index.es.js +0 -6495
  286. package/tree/index.umd.js +0 -27
  287. package/tree/package.json +0 -7
  288. package/tree/style.css +0 -1
  289. package/tree-select/index.d.ts +0 -7
  290. package/tree-select/index.es.js +0 -627
  291. package/tree-select/index.umd.js +0 -1
  292. package/tree-select/package.json +0 -7
  293. 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, toRefs, 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
- const iconProps = {
72
- name: {
73
- type: String,
74
- default: "",
75
- required: true
76
- },
77
- size: {
78
- type: String,
79
- default: "inherit"
80
- },
81
- color: {
82
- type: String,
83
- default: "inherit"
84
- },
85
- classPrefix: {
86
- type: String,
87
- default: "icon"
88
- }
89
- };
90
- var Icon = defineComponent({
91
- name: "DIcon",
92
- props: iconProps,
93
- setup(props) {
94
- const {
95
- name,
96
- size,
97
- color,
98
- classPrefix
99
- } = toRefs(props);
100
- return () => {
101
- return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
102
- "src": name.value,
103
- "alt": name.value.split("/")[name.value.split("/").length - 1],
104
- "style": {
105
- width: size.value,
106
- verticalAlign: "text-bottom"
107
- }
108
- }, null) : createVNode("i", {
109
- "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
110
- "style": {
111
- fontSize: size.value,
112
- color: color.value
113
- }
114
- }, null);
115
- };
116
- }
117
- });
118
- var checkbox = "";
119
- const commonProps = {
120
- name: {
121
- type: String,
122
- default: void 0
123
- },
124
- halfchecked: {
125
- type: Boolean,
126
- default: false
127
- },
128
- isShowTitle: {
129
- type: Boolean,
130
- default: true
131
- },
132
- title: {
133
- type: String
134
- },
135
- color: {
136
- type: String,
137
- default: void 0
138
- },
139
- showAnimation: {
140
- type: Boolean,
141
- default: true
142
- },
143
- disabled: {
144
- type: Boolean,
145
- default: false
146
- },
147
- beforeChange: {
148
- type: Function,
149
- default: void 0
150
- }
151
- };
152
- const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
153
- halfchecked: {
154
- type: Boolean,
155
- default: false
156
- },
157
- checked: {
158
- type: Boolean,
159
- default: false
160
- },
161
- value: {
162
- type: String
163
- },
164
- label: {
165
- type: String,
166
- default: void 0
167
- },
168
- title: {
169
- type: String,
170
- default: void 0
171
- },
172
- "onUpdate:checked": {
173
- type: Function,
174
- default: void 0
175
- },
176
- onChange: {
177
- type: Function,
178
- default: void 0
179
- },
180
- modelValue: {
181
- type: Boolean
182
- },
183
- "onUpdate:modelValue": {
184
- type: Function
185
- }
186
- });
187
- const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
188
- modelValue: {
189
- type: Array,
190
- required: true
191
- },
192
- direction: {
193
- type: String,
194
- default: "column"
195
- },
196
- itemWidth: {
197
- type: Number,
198
- default: void 0
199
- },
200
- options: {
201
- type: Array,
202
- default: () => []
203
- },
204
- onChange: {
205
- type: Function,
206
- default: void 0
207
- },
208
- "onUpdate:modelValue": {
209
- type: Function,
210
- default: void 0
211
- }
212
- });
213
- const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
214
- var Checkbox = defineComponent({
215
- name: "DCheckbox",
216
- props: checkboxProps,
217
- emits: ["change", "update:checked", "update:modelValue"],
218
- setup(props, ctx) {
219
- const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
220
- const isChecked = computed(() => props.checked || props.modelValue);
221
- const mergedDisabled = computed(() => {
222
- return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
223
- });
224
- const mergedChecked = computed(() => {
225
- var _a, _b;
226
- return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
227
- });
228
- const mergedIsShowTitle = computed(() => {
229
- var _a;
230
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
231
- });
232
- const mergedShowAnimation = computed(() => {
233
- var _a;
234
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
235
- });
236
- const mergedColor = computed(() => {
237
- var _a;
238
- return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
239
- });
240
- const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
241
- const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
242
- const canChange = (isChecked2, val) => {
243
- var _a;
244
- if (mergedDisabled.value) {
245
- return Promise.resolve(false);
246
- }
247
- const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
248
- if (beforeChange) {
249
- const res = beforeChange(isChecked2, val);
250
- if (typeof res === "boolean") {
251
- return Promise.resolve(res);
252
- }
253
- return res;
254
- }
255
- return Promise.resolve(true);
256
- };
257
- const toggle = () => {
258
- const current = !isChecked.value;
259
- checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
260
- ctx.emit("update:checked", current);
261
- ctx.emit("update:modelValue", current);
262
- ctx.emit("change", current);
263
- };
264
- const handleClick = () => {
265
- canChange(!isChecked.value, props.label).then((res) => res && toggle());
266
- };
267
- return {
268
- itemWidth,
269
- direction,
270
- mergedColor,
271
- mergedDisabled,
272
- mergedIsShowTitle,
273
- mergedChecked,
274
- mergedShowAnimation,
275
- handleClick
276
- };
277
- },
278
- render() {
279
- var _a;
280
- const {
281
- itemWidth,
282
- direction,
283
- mergedChecked,
284
- mergedDisabled,
285
- mergedIsShowTitle,
286
- mergedShowAnimation,
287
- halfchecked,
288
- title,
289
- label,
290
- handleClick,
291
- name,
292
- value,
293
- mergedColor,
294
- $slots
295
- } = this;
296
- const wrapperCls = {
297
- "devui-checkbox-column-margin": direction === "column",
298
- "devui-checkbox-wrap": typeof itemWidth !== "undefined"
299
- };
300
- const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
301
- const checkboxCls = {
302
- "devui-checkbox": true,
303
- active: mergedChecked,
304
- halfchecked,
305
- disabled: mergedDisabled,
306
- unchecked: !mergedChecked
307
- };
308
- const labelTitle = mergedIsShowTitle ? title || label : "";
309
- const bgImgStyle = mergedColor && halfchecked || mergedColor ? `linear-gradient(${mergedColor}, ${mergedColor})` : "";
310
- const spanStyle = [`border-color:${(mergedChecked || halfchecked) && mergedColor ? mergedColor : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor && halfchecked ? mergedColor : ""}`];
311
- const spanCls = {
312
- "devui-checkbox-material": true,
313
- "custom-color": mergedColor,
314
- "devui-checkbox-no-label": !label && !$slots.default,
315
- "devui-no-animation": !mergedShowAnimation,
316
- "devui-checkbox-default-background": !halfchecked
317
- };
318
- const polygonCls = {
319
- "devui-tick": true,
320
- "devui-no-animation": !mergedShowAnimation
321
- };
322
- const stopPropagation = ($event) => $event.stopPropagation();
323
- const inputProps = {
324
- indeterminate: halfchecked
325
- };
326
- return createVNode("div", {
327
- "class": wrapperCls,
328
- "style": wrapperStyle
329
- }, [createVNode("div", {
330
- "class": checkboxCls
331
- }, [createVNode("label", {
332
- "title": labelTitle,
333
- "onClick": handleClick
334
- }, [createVNode("input", mergeProps({
335
- "name": name || value,
336
- "class": "devui-checkbox-input",
337
- "type": "checkbox"
338
- }, inputProps, {
339
- "checked": mergedChecked,
340
- "disabled": mergedDisabled,
341
- "onClick": stopPropagation,
342
- "onChange": stopPropagation
343
- }), null), createVNode("span", {
344
- "style": spanStyle,
345
- "class": spanCls
346
- }, [createVNode("span", {
347
- "class": "devui-checkbox-halfchecked-bg"
348
- }, null), createVNode("svg", {
349
- "viewBox": "0 0 16 16",
350
- "version": "1.1",
351
- "xmlns": "http://www.w3.org/2000/svg",
352
- "class": "devui-checkbox-tick"
353
- }, [createVNode("g", {
354
- "stroke": "none",
355
- "stroke-width": "1",
356
- "fill": "none",
357
- "fill-rule": "evenodd"
358
- }, [createVNode("polygon", {
359
- "fill-rule": "nonzero",
360
- "points": "5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",
361
- "class": polygonCls
362
- }, null)])])]), label || ((_a = $slots.default) == null ? void 0 : _a.call($slots))])])]);
363
- }
364
- });
365
- var checkboxGroup = "";
366
- var CheckboxGroup = defineComponent({
367
- name: "DCheckboxGroup",
368
- props: checkboxGroupProps,
369
- emits: ["change", "update:modelValue"],
370
- setup(props, ctx) {
371
- const valList = toRef(props, "modelValue");
372
- const defaultOpt = {
373
- checked: false,
374
- isShowTitle: true,
375
- halfchecked: false,
376
- showAnimation: true,
377
- disabled: false
378
- };
379
- const toggleGroupVal = (val) => {
380
- let index2 = -1;
381
- if (typeof valList.value[0] === "string") {
382
- index2 = valList.value.findIndex((item) => item === val);
383
- } else if (typeof valList.value[0] === "object") {
384
- index2 = valList.value.findIndex((item) => item.value === val);
385
- }
386
- if (index2 === -1) {
387
- if (typeof props.options[0] === "object") {
388
- const newOne = props.options.find((item) => item.value === val);
389
- const res2 = [...valList.value, newOne];
390
- ctx.emit("update:modelValue", res2);
391
- ctx.emit("change", res2);
392
- return;
393
- }
394
- const res = [...valList.value, val];
395
- ctx.emit("update:modelValue", res);
396
- ctx.emit("change", res);
397
- return;
398
- }
399
- valList.value.splice(index2, 1);
400
- ctx.emit("update:modelValue", valList.value);
401
- ctx.emit("change", valList.value);
402
- };
403
- const isItemChecked = (itemVal) => {
404
- if (typeof valList.value[0] === "string") {
405
- return valList.value.includes(itemVal);
406
- } else if (typeof valList.value[0] === "object") {
407
- return valList.value.some((item) => item.value === itemVal);
408
- }
409
- };
410
- provide(checkboxGroupInjectionKey, {
411
- disabled: toRef(props, "disabled"),
412
- isShowTitle: toRef(props, "isShowTitle"),
413
- color: toRef(props, "color"),
414
- showAnimation: toRef(props, "showAnimation"),
415
- beforeChange: props.beforeChange,
416
- isItemChecked,
417
- toggleGroupVal,
418
- itemWidth: toRef(props, "itemWidth"),
419
- direction: toRef(props, "direction")
420
- });
421
- return {
422
- defaultOpt
423
- };
424
- },
425
- render() {
426
- var _a;
427
- const {
428
- direction,
429
- $slots,
430
- defaultOpt,
431
- options
432
- } = this;
433
- let children = (_a = $slots.default) == null ? void 0 : _a.call($slots);
434
- if ((options == null ? void 0 : options.length) > 0) {
435
- children = options.map((opt) => {
436
- let mergedOpt = null;
437
- if (typeof opt === "string") {
438
- mergedOpt = Object.assign({}, defaultOpt, {
439
- label: opt,
440
- value: opt
441
- });
442
- } else if (typeof opt === "object") {
443
- mergedOpt = Object.assign({}, defaultOpt, __spreadProps(__spreadValues({}, opt), {
444
- label: opt.name
445
- }));
446
- }
447
- return createVNode(Checkbox, mergedOpt, null);
448
- });
449
- }
450
- return createVNode("div", {
451
- "class": "devui-checkbox-group"
452
- }, [createVNode("div", {
453
- "class": {
454
- "devui-checkbox-list-inline": direction === "row"
455
- }
456
- }, [children])]);
457
- }
458
- });
459
- Checkbox.install = function(app) {
460
- app.component(Checkbox.name, Checkbox);
461
- };
462
- CheckboxGroup.install = function(app) {
463
- app.component(CheckboxGroup.name, CheckboxGroup);
464
- };
465
- function className(classStr, classOpt) {
466
- let classname = classStr;
467
- if (typeof classOpt === "object") {
468
- Object.keys(classOpt).forEach((key) => {
469
- classOpt[key] && (classname += ` ${key}`);
470
- });
471
- }
472
- return classname;
473
- }
474
- function useCacheOptions(mergeOptions) {
475
- const cacheOptions = computed(() => {
476
- const map = /* @__PURE__ */ new Map();
477
- mergeOptions.value.forEach((item) => {
478
- map.set(item.value, item);
479
- });
480
- return map;
481
- });
482
- const getValuesOption = (values) => values.map((value) => cacheOptions.value.get(value));
483
- return getValuesOption;
484
- }
485
- function useSelectOutsideClick(refs, isOpen, toggleChange) {
486
- function onGlobalMouseDown(e) {
487
- var _a, _b;
488
- let target = e.target;
489
- if (target.shadowRoot && e.composed) {
490
- target = e.composedPath()[0] || target;
491
- }
492
- const element = [(_a = refs[0]) == null ? void 0 : _a.value, (_b = refs[1]) == null ? void 0 : _b.value];
493
- if (isOpen.value && element.every((el) => el && !el.contains(target) && el !== target)) {
494
- toggleChange(false);
495
- }
496
- }
497
- onMounted(() => {
498
- document.body.addEventListener("mousedown", onGlobalMouseDown, false);
499
- });
500
- onBeforeUnmount(() => {
501
- document.body.addEventListener("mousedown", onGlobalMouseDown, false);
502
- });
503
- }
504
- var select = "";
505
- var Select = defineComponent({
506
- name: "DSelect",
507
- props: selectProps,
508
- emits: ["toggleChange", "valueChange", "update:modelValue"],
509
- setup(props, ctx) {
510
- const containerRef = ref(null);
511
- const dropdownRef = ref(null);
512
- const isOpen = ref(false);
513
- function toggleChange(bool) {
514
- if (props.disabled) {
515
- return;
516
- }
517
- isOpen.value = bool;
518
- ctx.emit("toggleChange", bool);
519
- }
520
- useSelectOutsideClick([containerRef, dropdownRef], isOpen, toggleChange);
521
- const mergeOptions = computed(() => {
522
- const {
523
- multiple,
524
- modelValue
525
- } = props;
526
- return props.options.map((item) => {
527
- let option;
528
- if (typeof item === "object") {
529
- option = __spreadValues({
530
- name: item.name ? item.name : item.value + "",
531
- value: item.value,
532
- _checked: false
533
- }, item);
534
- } else {
535
- option = {
536
- name: item + "",
537
- value: item,
538
- _checked: false
539
- };
540
- }
541
- if (multiple) {
542
- if (Array.isArray(modelValue)) {
543
- option._checked = modelValue.includes(option.value);
544
- } else {
545
- option._checked = false;
546
- }
547
- }
548
- return option;
549
- });
550
- });
551
- const getValuesOption = useCacheOptions(mergeOptions);
552
- const inputValue = computed(() => {
553
- var _a;
554
- if (props.multiple && Array.isArray(props.modelValue)) {
555
- const selectedOptions = getValuesOption(props.modelValue);
556
- return selectedOptions.map((item) => item.name).join(",");
557
- } else if (!Array.isArray(props.modelValue)) {
558
- return ((_a = getValuesOption([props.modelValue])[0]) == null ? void 0 : _a.name) || "";
559
- }
560
- return "";
561
- });
562
- const mergeClearable = computed(() => {
563
- return !props.disabled && props.allowClear && inputValue.value.length > 0;
564
- });
565
- function valueChange(item, index2) {
566
- const {
567
- multiple,
568
- optionDisabledKey: disabledKey
569
- } = props;
570
- let {
571
- modelValue
572
- } = props;
573
- if (disabledKey && !!item[disabledKey]) {
574
- return;
575
- }
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 };