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,1154 +0,0 @@
1
- import { defineComponent, inject, computed, ref, watch, createVNode, withDirectives, mergeProps, resolveDirective, resolveComponent, toRefs, createTextVNode, reactive, onMounted, onUnmounted } from "vue";
2
- const getDateTime = (d) => {
3
- const year = d.getFullYear();
4
- const month = d.getMonth() + 1;
5
- const date = d.getDate();
6
- const day = d.getDay();
7
- const hour = d.getHours();
8
- const minute = d.getMinutes();
9
- const second = d.getSeconds();
10
- const ms = d.getMilliseconds();
11
- return [year, month, date, day, hour, minute, second, ms];
12
- };
13
- const fixStart = (n, m, max = 2, ch = "0") => {
14
- return (n + "").padStart(Math.min(m.length, max), ch);
15
- };
16
- const formatDate = (fmt, d) => {
17
- const usage = getDateTime(d);
18
- let res = fmt;
19
- res = res.replace(/y+/g, (m) => {
20
- const year = usage[0] + "";
21
- if (m.length === 2) {
22
- return year.substring(2);
23
- }
24
- return year;
25
- });
26
- res = res.replace(/M+/g, (m) => fixStart(usage[1], m));
27
- res = res.replace(/d+/g, (m) => fixStart(usage[2], m));
28
- res = res.replace(/h+/g, (m) => fixStart(usage[4], m));
29
- res = res.replace(/m+/g, (m) => fixStart(usage[5], m));
30
- res = res.replace(/s+/g, (m) => fixStart(usage[6], m));
31
- return res;
32
- };
33
- const formatRange$1 = (fmt, a, b, conn = "-") => {
34
- const ab = [a, b];
35
- if (a.getTime() > b.getTime()) {
36
- ab.reverse();
37
- }
38
- return `${formatDate(fmt, ab[0])} ${conn} ${formatDate(fmt, ab[1])}`;
39
- };
40
- const isIn = (a, b) => {
41
- if (!b) {
42
- return false;
43
- }
44
- while (a) {
45
- if (a === b) {
46
- return true;
47
- }
48
- a = a.parentNode;
49
- }
50
- return false;
51
- };
52
- const invokeFunction = (fn, ...args) => {
53
- if (typeof fn === "function") {
54
- fn(...args);
55
- }
56
- };
57
- const getHumanDate = (d) => {
58
- const year = d.getFullYear();
59
- const month = d.getMonth() + 1;
60
- const date = d.getDate();
61
- const day = d.getDay();
62
- const hour = d.getHours();
63
- const minute = d.getMinutes();
64
- const second = d.getSeconds();
65
- const ms = d.getMilliseconds();
66
- return {
67
- year,
68
- y: year,
69
- month,
70
- M: month,
71
- date,
72
- d: date,
73
- day,
74
- hour,
75
- H: hour,
76
- h: hour,
77
- minute,
78
- m: minute,
79
- second,
80
- s: second,
81
- ms
82
- };
83
- };
84
- const getMonthDays = (year, month) => {
85
- const first = new Date(year, month - 1, 1);
86
- const last = new Date(year, month, 0);
87
- const dates = [];
88
- let day = first.getDay();
89
- while (day > 0) {
90
- day -= 1;
91
- dates.push({ date: new Date(year, month - 1, -day), current: -1 });
92
- }
93
- day = last.getDate() - first.getDate();
94
- for (let i = 0; i <= day; i++) {
95
- const date = new Date(first);
96
- date.setDate(i + 1);
97
- dates.push({ date, current: 0 });
98
- }
99
- day = last.getDay();
100
- let tail = last;
101
- for (let i = day; i < 6; i++) {
102
- tail = new Date(year, month, i - day + 1);
103
- dates.push({ date: tail, current: 1 });
104
- }
105
- if (dates.length < 42) {
106
- day = tail.getDate();
107
- for (let i = 1; i <= 7; i++) {
108
- tail = new Date(year, month, day + i);
109
- dates.push({ date: tail, current: 1 });
110
- }
111
- }
112
- return dates;
113
- };
114
- const getMonthWeeklyDays = (date = new Date()) => {
115
- if (!(date instanceof Date)) {
116
- date = new Date();
117
- }
118
- const { year, month } = getHumanDate(date);
119
- const days = getMonthDays(year, month);
120
- const dayRows = [];
121
- while (days.length > 0) {
122
- dayRows.push(days.splice(0, 7));
123
- }
124
- return dayRows;
125
- };
126
- const WEEK_DAYS = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
127
- const invokeCallback = (cb, ...args) => {
128
- typeof cb === "function" && cb(...args);
129
- };
130
- const subDateMonth = (a, b) => {
131
- const am = a.getFullYear() * 12 + a.getMonth();
132
- const bm = b.getFullYear() * 12 + b.getMonth();
133
- return am - bm;
134
- };
135
- const ONE_DAY = 1e3 * 60 * 60 * 24;
136
- const subDateDay = (a, b) => {
137
- const ad = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime();
138
- const bd = new Date(b.getFullYear(), b.getMonth(), b.getDate()).getTime();
139
- return (ad - bd) / ONE_DAY;
140
- };
141
- const compareDate = (small, big, mode, min) => {
142
- if (!small || !big) {
143
- return true;
144
- }
145
- if (mode === "year") {
146
- return big.getFullYear() - small.getFullYear() > min;
147
- } else {
148
- return subDateMonth(big, small) > min;
149
- }
150
- };
151
- const parseDate = (str) => {
152
- if (!str || typeof str !== "string") {
153
- return null;
154
- }
155
- const [dateStr = "", timeStr = ""] = str.split(/([ ]|T)+/);
156
- if (!dateStr) {
157
- return null;
158
- }
159
- const [y, m, d] = dateStr.split(/[^\d]+/);
160
- const year = _parseInt(y), month = _parseInt(m), date = _parseInt(d) || 1;
161
- if (!year || !month) {
162
- return null;
163
- }
164
- const time = parseTime(timeStr);
165
- return new Date(year, month - 1, date, ...time);
166
- };
167
- const _parseInt = (str, dftVal) => {
168
- if (!str || typeof str !== "string") {
169
- return dftVal;
170
- }
171
- const n = parseInt(str);
172
- if (isNaN(n)) {
173
- return dftVal;
174
- }
175
- return n;
176
- };
177
- const parseTime = (str) => {
178
- const [h, m, s, ms] = str.split(/[\:\.]+/);
179
- return [_parseInt(h, 0), _parseInt(m, 0), _parseInt(s, 0), _parseInt(ms, 0)];
180
- };
181
- const compareDateSort = (d1, d2, type = "d") => {
182
- const t1 = dateCounter(d1, type), t2 = dateCounter(d2, type);
183
- return t1 < t2 ? -1 : t1 > t2 ? 1 : 0;
184
- };
185
- const dateCounter = (date, type) => {
186
- switch (type) {
187
- case "y":
188
- return date.getFullYear();
189
- case "m":
190
- return date.getFullYear() * 12 + date.getMonth();
191
- }
192
- return date.getTime() / ONE_DAY >> 0;
193
- };
194
- const betweenDate = (date, left, right) => {
195
- if (left instanceof Date && compareDateSort(left, date, "d") > 0) {
196
- return false;
197
- }
198
- if (right instanceof Date && compareDateSort(date, right, "d") > 0) {
199
- return false;
200
- }
201
- return true;
202
- };
203
- const inputProps = {
204
- placeholder: {
205
- type: String,
206
- default: void 0
207
- },
208
- disabled: {
209
- type: Boolean,
210
- default: false
211
- },
212
- autoFocus: {
213
- type: Boolean,
214
- default: false
215
- },
216
- maxLength: {
217
- type: Number,
218
- default: Number.MAX_SAFE_INTEGER
219
- },
220
- cssClass: {
221
- type: String,
222
- default: ""
223
- },
224
- error: {
225
- type: Boolean,
226
- default: false
227
- },
228
- size: {
229
- type: String,
230
- default: ""
231
- },
232
- showPassword: {
233
- type: Boolean,
234
- default: false
235
- },
236
- modelValue: {
237
- type: String,
238
- default: ""
239
- },
240
- "update:modelValue": {
241
- type: Function,
242
- default: void 0
243
- },
244
- onChange: {
245
- type: Function,
246
- default: void 0
247
- },
248
- onKeydown: {
249
- type: Function,
250
- default: void 0
251
- },
252
- onFocus: {
253
- type: Function,
254
- default: void 0
255
- },
256
- onBlur: {
257
- type: Function,
258
- default: void 0
259
- }
260
- };
261
- var input = "";
262
- const formItemInjectionKey = Symbol("dFormItem");
263
- const dFormItemEvents = {
264
- blur: "d.form.blur",
265
- change: "d.form.change",
266
- input: "d.form.input"
267
- };
268
- var Input = defineComponent({
269
- name: "DInput",
270
- directives: {
271
- focus: {
272
- mounted: function(el, binding) {
273
- if (binding.value) {
274
- el.focus();
275
- }
276
- }
277
- }
278
- },
279
- props: inputProps,
280
- emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
281
- setup(props, ctx) {
282
- const formItem = inject(formItemInjectionKey, {});
283
- const hasFormItem = Object.keys(formItem).length > 0;
284
- const sizeCls = computed(() => `devui-input-${props.size}`);
285
- const showPwdIcon = ref(false);
286
- const inputType = ref("text");
287
- const inputCls = computed(() => {
288
- return {
289
- error: props.error,
290
- [props.cssClass]: true,
291
- "devui-input-restore": showPwdIcon.value,
292
- [sizeCls.value]: props.size !== ""
293
- };
294
- });
295
- const showPreviewIcon = computed(() => inputType.value === "password");
296
- watch(() => props.showPassword, (flg) => {
297
- inputType.value = flg ? "password" : "text";
298
- showPwdIcon.value = props.showPassword;
299
- }, {
300
- immediate: true
301
- });
302
- const onInput = ($event) => {
303
- ctx.emit("update:modelValue", $event.target.value);
304
- hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
305
- }, onFocus = () => {
306
- ctx.emit("focus");
307
- }, onBlur = () => {
308
- ctx.emit("blur");
309
- hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
310
- }, onChange = ($event) => {
311
- ctx.emit("change", $event.target.value);
312
- hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
313
- }, onKeydown = ($event) => {
314
- ctx.emit("keydown", $event);
315
- }, onChangeInputType = () => {
316
- inputType.value = inputType.value === "password" ? "text" : "password";
317
- };
318
- return {
319
- inputCls,
320
- inputType,
321
- showPreviewIcon,
322
- showPwdIcon,
323
- onInput,
324
- onFocus,
325
- onBlur,
326
- onChange,
327
- onKeydown,
328
- onChangeInputType
329
- };
330
- },
331
- render() {
332
- const {
333
- modelValue,
334
- showPreviewIcon,
335
- showPwdIcon,
336
- inputCls,
337
- inputType,
338
- maxLength,
339
- autoFocus,
340
- placeholder,
341
- disabled,
342
- onInput,
343
- onFocus,
344
- onBlur,
345
- onChange,
346
- onKeydown,
347
- onChangeInputType
348
- } = this;
349
- return createVNode("div", {
350
- "class": "devui-input__wrap"
351
- }, [withDirectives(createVNode("input", mergeProps({
352
- dinput: true
353
- }, {
354
- "value": modelValue,
355
- "disabled": disabled,
356
- "type": inputType,
357
- "maxlength": maxLength,
358
- "placeholder": placeholder,
359
- "class": inputCls,
360
- "onInput": onInput,
361
- "onFocus": onFocus,
362
- "onBlur": onBlur,
363
- "onChange": onChange,
364
- "onKeydown": onKeydown
365
- }), null), [[resolveDirective("focus"), autoFocus]]), showPwdIcon && createVNode("div", {
366
- "class": "devui-input__preview",
367
- "onClick": onChangeInputType
368
- }, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
369
- "name": "preview-forbidden",
370
- "size": "12px",
371
- "key": 1
372
- }, null) : createVNode(resolveComponent("d-icon"), {
373
- "name": "preview",
374
- "size": "12px",
375
- "key": 2
376
- }, null)])]);
377
- }
378
- });
379
- Input.install = function(app) {
380
- app.component(Input.name, Input);
381
- };
382
- const iconProps = {
383
- name: {
384
- type: String,
385
- default: "",
386
- required: true
387
- },
388
- size: {
389
- type: String,
390
- default: "inherit"
391
- },
392
- color: {
393
- type: String,
394
- default: "inherit"
395
- },
396
- classPrefix: {
397
- type: String,
398
- default: "icon"
399
- }
400
- };
401
- var Icon = defineComponent({
402
- name: "DIcon",
403
- props: iconProps,
404
- setup(props) {
405
- const {
406
- name,
407
- size,
408
- color,
409
- classPrefix
410
- } = toRefs(props);
411
- return () => {
412
- return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
413
- "src": name.value,
414
- "alt": name.value.split("/")[name.value.split("/").length - 1],
415
- "style": {
416
- width: size.value,
417
- verticalAlign: "text-bottom"
418
- }
419
- }, null) : createVNode("i", {
420
- "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
421
- "style": {
422
- fontSize: size.value,
423
- color: color.value
424
- }
425
- }, null);
426
- };
427
- }
428
- });
429
- const handleCalendarSwitchState = (state, index2, pos, date) => {
430
- switch (index2) {
431
- case 0:
432
- const preYear = new Date(date);
433
- preYear.setFullYear(preYear.getFullYear() - 1);
434
- pos === 0 ? state.current = preYear : state.next = preYear;
435
- break;
436
- case 1:
437
- const preMonth = new Date(date);
438
- preMonth.setMonth(preMonth.getMonth() - 1);
439
- pos === 0 ? state.current = preMonth : state.next = preMonth;
440
- break;
441
- case 2:
442
- const nextMonth = new Date(date);
443
- nextMonth.setMonth(nextMonth.getMonth() + 1);
444
- pos === 0 ? state.current = nextMonth : state.next = nextMonth;
445
- break;
446
- case 3:
447
- const nextYear = new Date(date);
448
- nextYear.setFullYear(nextYear.getFullYear() + 1);
449
- pos === 0 ? state.current = nextYear : state.next = nextYear;
450
- break;
451
- }
452
- };
453
- const formatValue = (state, props) => {
454
- const { format = "y/MM/dd", range, rangeSpliter = "-" } = props || {};
455
- if (range) {
456
- if (!state.start) {
457
- return "";
458
- } else if (!state.end) {
459
- return formatDate(format, state.start);
460
- }
461
- if (state.end < state.start) {
462
- const end = state.end;
463
- state.end = state.start;
464
- state.start = end;
465
- }
466
- return formatRange$1(format, state.start, state.end, rangeSpliter);
467
- } else {
468
- if (!state.start) {
469
- return "";
470
- }
471
- return formatDate(format, state.start);
472
- }
473
- };
474
- const formatPlaceholder = (props) => {
475
- if (!props) {
476
- return "";
477
- }
478
- const format = props.format || `y/MM/dd`;
479
- const sp = props.rangeSpliter || "-";
480
- return props.range ? `${format} ${sp} ${format}` : format;
481
- };
482
- const getDateKey = (date) => {
483
- return date.toDateString();
484
- };
485
- const cellClassName = (props, day, base = "cell") => {
486
- if (!betweenDate(day.date, props.dateMin, props.dateMax)) {
487
- return `${base} disabled`;
488
- } else if (day.current !== 0) {
489
- return `${base} not-current`;
490
- }
491
- const key = getDateKey(day.date);
492
- if (props.type === "range") {
493
- if (props.dateStart) {
494
- if (getDateKey(props.dateStart) === key) {
495
- return `${base} selected`;
496
- }
497
- if (props.dateEnd && getDateKey(props.dateEnd) === key) {
498
- return `${base} selected`;
499
- }
500
- const innerEnd = props.dateEnd || props.dateHover;
501
- if (innerEnd) {
502
- const range = innerEnd > props.dateStart ? [props.dateStart, innerEnd] : [innerEnd, props.dateStart];
503
- if (day.date > range[0] && day.date < range[1]) {
504
- return `${base} innerday`;
505
- }
506
- }
507
- }
508
- return base;
509
- } else {
510
- return props.dateStart && getDateKey(props.dateStart) === key ? `${base} selected` : base;
511
- }
512
- };
513
- const trigEvent = (props, day) => {
514
- if (!betweenDate(day.date, props.dateMin, props.dateMax)) {
515
- return;
516
- }
517
- if (props.type === "range") {
518
- if (!props.dateStart) {
519
- invokeCallback(props.onSelectStart, day.date);
520
- } else if (!props.dateEnd) {
521
- if (subDateDay(props.dateStart, day.date) !== 0) {
522
- invokeCallback(props.onSelectEnd, day.date);
523
- typeof props.onChange === "function" && props.onChange(props.type, props);
524
- }
525
- } else {
526
- invokeCallback(props.onReset, day.date);
527
- }
528
- } else {
529
- invokeCallback(props.onSelected, day.date);
530
- typeof props.onChange === "function" && props.onChange(props.type, props);
531
- }
532
- };
533
- const handleDateEnter = (props, day) => {
534
- if (day.current !== 0) {
535
- return;
536
- }
537
- const { dateMin, dateMax } = props;
538
- if (dateMin && subDateDay(day.date, dateMin) < 0) {
539
- return;
540
- }
541
- if (dateMax && subDateDay(dateMax, day.date) < 0) {
542
- return;
543
- }
544
- if (props.type === "range") {
545
- const key = getDateKey(day.date);
546
- if (!props.dateStart || getDateKey(props.dateStart) === key || props.dateEnd) {
547
- return;
548
- }
549
- invokeCallback(props.onSelecting, day.date);
550
- }
551
- };
552
- const Year = (props) => {
553
- const {
554
- color = "#585d6b",
555
- rotate = 0
556
- } = props;
557
- return createVNode("svg", {
558
- "style": {
559
- transform: `rotate(${rotate}deg)`
560
- },
561
- "width": "10px",
562
- "height": "10px",
563
- "viewBox": "0 0 10 10",
564
- "version": "1.1",
565
- "xmlns": "http://www.w3.org/2000/svg"
566
- }, [createVNode("g", {
567
- "fill": color,
568
- "transform": "translate(-1.000000, -1.000000)"
569
- }, [createVNode("path", {
570
- "d": "M11,1.83333333 L11,10.1666667 L7,7.38833333 L7,10.1666667 L1,6 L7,1.83333333 L7,4.61033333 L11,1.83333333 Z"
571
- }, null)])]);
572
- };
573
- const Month = (props) => {
574
- const {
575
- color = "#585d6b",
576
- rotate = 0
577
- } = props;
578
- return createVNode("svg", {
579
- "style": {
580
- transform: `rotate(${rotate}deg)`
581
- },
582
- "width": "6px",
583
- "height": "10px",
584
- "viewBox": "0 0 6 10",
585
- "version": "1.1",
586
- "xmlns": "http://www.w3.org/2000/svg"
587
- }, [createVNode("g", {
588
- "fill": color,
589
- "transform": "translate(-3.000000, -1.000000)"
590
- }, [createVNode("polygon", {
591
- "points": "6 3 10.1666667 9 1.83333333 9"
592
- }, null)])]);
593
- };
594
- var index$6 = "";
595
- const Item = (props) => {
596
- const {
597
- button: Btn,
598
- disabled = false,
599
- rotate = 0,
600
- date,
601
- pos
602
- } = props;
603
- const color = disabled ? "#cfd0d3" : "#585d6b";
604
- const className = `${disabled ? "disabled" : ""}`;
605
- const handleClick = disabled ? void 0 : () => invokeCallback(props.cb, date, pos);
606
- return createVNode("a", {
607
- "class": className,
608
- "onClick": handleClick
609
- }, [createVNode(Btn, {
610
- "color": color,
611
- "rotate": rotate
612
- }, null)]);
613
- };
614
- const Title = (props) => {
615
- const {
616
- date
617
- } = props;
618
- return createVNode("a", {
619
- "class": "title"
620
- }, [`${date.getFullYear()}\u5E74${(date.getMonth() + 1 + "").padStart(2, "0")}\u6708`]);
621
- };
622
- const CalendarToolbar = (props) => {
623
- const {
624
- type,
625
- current,
626
- compare,
627
- pos,
628
- dateMax,
629
- dateMin,
630
- onPreviousYear,
631
- onPreviousMonth,
632
- onNextMonth,
633
- onNextYear
634
- } = props;
635
- const dis = [false, false, false, false];
636
- if (type === "range") {
637
- if (pos === 1) {
638
- dis[0] = !compareDate(compare, current, "year", 1);
639
- dis[1] = !compareDate(compare, current, "month", 1);
640
- dis[2] = !compareDate(current, dateMax, "month", 0);
641
- dis[3] = !compareDate(current, dateMax, "year", 0);
642
- } else {
643
- dis[0] = !compareDate(dateMin, current, "year", 0);
644
- dis[1] = !compareDate(dateMin, current, "month", 0);
645
- dis[2] = !compareDate(current, compare, "month", 1);
646
- dis[3] = !compareDate(current, compare, "year", 1);
647
- }
648
- } else {
649
- dis[0] = !compareDate(dateMin, current, "year", 0);
650
- dis[1] = !compareDate(dateMin, current, "month", 0);
651
- dis[2] = !compareDate(current, dateMax, "month", 0);
652
- dis[3] = !compareDate(current, dateMax, "year", 0);
653
- }
654
- return createVNode("div", {
655
- "class": "devui-calendar-toolbar"
656
- }, [createVNode(Item, {
657
- "disabled": dis[0],
658
- "date": current,
659
- "pos": pos,
660
- "button": Year,
661
- "cb": onPreviousYear
662
- }, null), createVNode(Item, {
663
- "disabled": dis[1],
664
- "date": current,
665
- "pos": pos,
666
- "button": Month,
667
- "rotate": -90,
668
- "cb": onPreviousMonth
669
- }, null), createVNode(Title, {
670
- "date": current
671
- }, null), createVNode(Item, {
672
- "disabled": dis[2],
673
- "date": current,
674
- "pos": pos,
675
- "button": Month,
676
- "rotate": 90,
677
- "cb": onNextMonth
678
- }, null), createVNode(Item, {
679
- "disabled": dis[3],
680
- "date": current,
681
- "pos": pos,
682
- "button": Year,
683
- "rotate": 180,
684
- "cb": onNextYear
685
- }, null)]);
686
- };
687
- const TodayDefault = (props) => {
688
- const {
689
- onSelected = () => 0,
690
- disabled = false
691
- } = props;
692
- return createVNode("div", {
693
- "class": `today-container ${disabled ? "disabled" : ""}`
694
- }, [createVNode("button", {
695
- "class": "today-button",
696
- "disabled": disabled,
697
- "onClick": disabled ? void 0 : () => onSelected(new Date())
698
- }, [createTextVNode("\u4ECA\u5929")])]);
699
- };
700
- var index$5 = "";
701
- const CalendarDatePanel = (props) => {
702
- const today = new Date();
703
- return createVNode("div", {
704
- "class": "devui-calendar-panel"
705
- }, [createVNode(CalendarToolbar, {
706
- "current": props.current,
707
- "compare": props.compare,
708
- "pos": props.pos,
709
- "type": props.type,
710
- "showTime": props.showTime,
711
- "onPreviousYear": props.onPreviousYear,
712
- "onPreviousMonth": props.onPreviousMonth,
713
- "onNextMonth": props.onNextMonth,
714
- "onNextYear": props.onNextYear,
715
- "dateMax": props.dateMax,
716
- "dateMin": props.dateMin
717
- }, null), createVNode("ol", {
718
- "class": "head row"
719
- }, [WEEK_DAYS.map((day) => createVNode("li", {
720
- "class": "cell"
721
- }, [day]))]), createVNode("ul", {
722
- "class": "body"
723
- }, [getMonthWeeklyDays(props.current).map((row) => createVNode("li", {
724
- "class": "row"
725
- }, [row.map((day) => {
726
- return createVNode("span", {
727
- "class": cellClassName(props, day),
728
- "onClick": () => trigEvent(props, day),
729
- "onMouseenter": () => handleDateEnter(props, day)
730
- }, [day.date.getDate()]);
731
- })]))]), props.type !== "range" ? createVNode(TodayDefault, {
732
- "disabled": !betweenDate(today, props.dateMin, props.dateMax),
733
- "onSelected": (today2) => {
734
- typeof props.onToday === "function" && props.onToday(today2, 0);
735
- }
736
- }, null) : null]);
737
- };
738
- var index$4 = "";
739
- const VerticalSlider = defineComponent({
740
- props: {
741
- size: {
742
- type: Number,
743
- default: 26
744
- },
745
- items: {
746
- type: Array
747
- },
748
- selectedIndex: {
749
- type: Number
750
- },
751
- className: {
752
- type: String
753
- },
754
- itemClassNormal: {
755
- type: String
756
- },
757
- itemClassSelected: {
758
- type: String
759
- },
760
- onChange: {
761
- type: Function
762
- }
763
- },
764
- setup(props) {
765
- const {
766
- items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
767
- selectedIndex = 0,
768
- size = 26,
769
- className = "",
770
- itemClassNormal = "",
771
- itemClassSelected = "selected",
772
- onChange
773
- } = props || {};
774
- let max_y = 0, min_y = 0;
775
- const container = ref();
776
- const movbar = ref();
777
- let pos_start = null;
778
- let pos_cache = null;
779
- const state = reactive({
780
- selectedIndex,
781
- barOpacity: 0,
782
- x: 0,
783
- y: 0,
784
- transition: "none"
785
- });
786
- const handleMouseDown = (e) => {
787
- e.stopPropagation();
788
- e.preventDefault();
789
- pos_start = [e.clientX, e.clientY];
790
- state.transition = "none";
791
- };
792
- const handleMouseMove = (e) => {
793
- e.stopPropagation();
794
- e.preventDefault();
795
- if (!pos_start || !pos_cache) {
796
- return;
797
- }
798
- state.x = pos_cache[0] + e.clientX - pos_start[0];
799
- state.y = Math.min(max_y, Math.max(min_y, pos_cache[1] + e.clientY - pos_start[1]));
800
- state.selectedIndex = (max_y - state.y + size / 2) / size >> 0;
801
- };
802
- const handleMouseUp = (e) => {
803
- e.stopPropagation();
804
- e.preventDefault();
805
- pos_start = null;
806
- state.y = max_y - state.selectedIndex * size;
807
- state.transition = "transform 0.1s";
808
- pos_cache[0] = state.x;
809
- pos_cache[1] = state.y;
810
- if (typeof onChange === "function") {
811
- const idx = state.selectedIndex;
812
- const val = items[idx];
813
- onChange(val, idx);
814
- }
815
- };
816
- onMounted(() => {
817
- const {
818
- height: ch
819
- } = container.value.getBoundingClientRect();
820
- const {
821
- height: mh
822
- } = movbar.value.getBoundingClientRect();
823
- max_y = (ch - size) / 2;
824
- min_y = (ch + size) / 2 - mh;
825
- pos_cache = [0, max_y - state.selectedIndex * size];
826
- state.x = pos_cache[0];
827
- state.y = pos_cache[1];
828
- state.barOpacity = 1;
829
- state.transition = "transform 0.1s";
830
- });
831
- return () => {
832
- return createVNode("div", {
833
- "ref": container,
834
- "class": `devui-vertical-slider ${className}`
835
- }, [createVNode("div", {
836
- "ref": movbar,
837
- "class": "movable-bar",
838
- "style": {
839
- opacity: state.barOpacity,
840
- transform: `translateY(${state.y}px)`,
841
- transition: state.transition
842
- }
843
- }, [items.map((c, i) => {
844
- const className2 = i === state.selectedIndex ? itemClassSelected : itemClassNormal;
845
- return createVNode("span", {
846
- "class": `slider-item ${className2}`,
847
- "style": {
848
- height: `${size}px`,
849
- lineHeight: `${size}px`
850
- }
851
- }, [c]);
852
- })]), createVNode("div", {
853
- "class": "slider-mask",
854
- "onMousedown": handleMouseDown,
855
- "onMousemove": handleMouseMove,
856
- "onMouseup": handleMouseUp,
857
- "onMouseout": handleMouseUp
858
- }, null)]);
859
- };
860
- }
861
- });
862
- var index$3 = "";
863
- const TimePicker = defineComponent({
864
- props: {
865
- time: {
866
- type: Date
867
- }
868
- },
869
- setup(props) {
870
- const {
871
- time = new Date()
872
- } = props || {};
873
- const state = reactive({
874
- hour: time.getHours(),
875
- minute: time.getMinutes(),
876
- second: time.getSeconds()
877
- });
878
- const hours = Array(24).fill(0).map((_, i) => `${i}`.padStart(2, "0"));
879
- const minutes = Array(60).fill(0).map((_, i) => `${i}`.padStart(2, "0"));
880
- return () => {
881
- return createVNode("div", {
882
- "class": "devui-calendar-timepicker"
883
- }, [createVNode("div", {
884
- "class": "head"
885
- }, [createVNode("div", {
886
- "class": "chars"
887
- }, [createVNode("span", null, [state.hour.toString().padStart(2, "0"), createTextVNode(":"), state.minute.toString().padStart(2, "0"), createTextVNode(":"), state.second.toString().padStart(2, "0")])])]), createVNode("div", {
888
- "class": "select"
889
- }, [createVNode(VerticalSlider, {
890
- "items": hours,
891
- "selectedIndex": state.hour,
892
- "onChange": (_, idx) => state.hour = idx
893
- }, null), createVNode(VerticalSlider, {
894
- "items": minutes,
895
- "selectedIndex": state.minute,
896
- "onChange": (_, idx) => state.minute = idx
897
- }, null), createVNode(VerticalSlider, {
898
- "items": minutes,
899
- "selectedIndex": state.second,
900
- "onChange": (_, idx) => state.second = idx
901
- }, null)])]);
902
- };
903
- }
904
- });
905
- var index$2 = "";
906
- const Calendar = (props) => {
907
- const {
908
- showTime = false
909
- } = props;
910
- let {
911
- current
912
- } = props;
913
- if (!(current instanceof Date)) {
914
- current = new Date();
915
- }
916
- if (props.type === "range") {
917
- let {
918
- next
919
- } = props;
920
- if (!(next instanceof Date)) {
921
- next = new Date(current.getFullYear(), current.getMonth() + 1, 1);
922
- }
923
- return createVNode("div", {
924
- "class": "devui-calendar-container"
925
- }, [createVNode(CalendarDatePanel, mergeProps(props, {
926
- "pos": 0,
927
- "current": current,
928
- "compare": next
929
- }), null), showTime ? createVNode(TimePicker, {
930
- "time": current
931
- }, null) : null, createVNode(CalendarDatePanel, mergeProps(props, {
932
- "pos": 1,
933
- "current": next,
934
- "compare": current
935
- }), null), showTime ? createVNode(TimePicker, {
936
- "time": next
937
- }, null) : null]);
938
- } else {
939
- return createVNode("div", {
940
- "class": "devui-calendar-container"
941
- }, [createVNode(CalendarDatePanel, mergeProps(props, {
942
- "pos": 0,
943
- "current": current
944
- }), null), showTime ? createVNode(TimePicker, {
945
- "time": current
946
- }, null) : null]);
947
- }
948
- };
949
- var datePicker = "";
950
- const formatRange = (state) => {
951
- const [start, end] = [state.start, state.end].sort((a, b) => a.getTime() - b.getTime());
952
- state.start = start;
953
- state.end = end;
954
- if (compareDateSort(start, end, "m") !== 0) {
955
- state.current = start;
956
- state.next = end;
957
- } else {
958
- if (compareDateSort(start, state.current) < 0) {
959
- state.current = start;
960
- }
961
- if (compareDateSort(state.next, end) < 0) {
962
- state.next = end;
963
- }
964
- }
965
- };
966
- var DatePicker = defineComponent({
967
- name: "DDatepicker",
968
- props: {
969
- selectedDateChange: {
970
- type: Function
971
- },
972
- autoClose: {
973
- type: Boolean,
974
- default: false
975
- },
976
- range: {
977
- type: Boolean,
978
- default: false
979
- },
980
- showTime: {
981
- type: Boolean,
982
- default: false
983
- },
984
- format: {
985
- type: String,
986
- default: "y/MM/dd"
987
- },
988
- rangeSpliter: {
989
- type: String,
990
- default: "-"
991
- },
992
- attachInputDom: {
993
- type: String
994
- },
995
- dateMin: {
996
- type: String
997
- },
998
- dateMax: {
999
- type: String
1000
- }
1001
- },
1002
- setup(props) {
1003
- const panel = ref(null);
1004
- const input2 = ref(null);
1005
- const current = parseDate(props.dateMin) || new Date();
1006
- const next = new Date(current.getFullYear(), current.getMonth() + 1, 1);
1007
- const state = reactive({
1008
- show: false,
1009
- value: "",
1010
- placeholder: formatPlaceholder(props),
1011
- current,
1012
- next
1013
- });
1014
- state.value = formatValue(state, props);
1015
- state.placeholder = formatPlaceholder(props);
1016
- const documentClick = (e) => {
1017
- e.stopPropagation();
1018
- if (isIn(e.target, panel.value) || isIn(e.target, input2.value)) {
1019
- return;
1020
- }
1021
- state.show = false;
1022
- };
1023
- onMounted(() => {
1024
- document.addEventListener("click", documentClick);
1025
- });
1026
- onUnmounted(() => {
1027
- document.removeEventListener("click", documentClick);
1028
- });
1029
- return () => {
1030
- return createVNode("div", {
1031
- "class": "devui-datepicker-container"
1032
- }, [createVNode("div", {
1033
- "class": "input-container",
1034
- "ref": input2
1035
- }, [createVNode(Input, {
1036
- "ref": input2,
1037
- "class": "datepicker-input",
1038
- "modelValue": state.value,
1039
- "placeholder": state.placeholder,
1040
- "onFocus": () => state.show = true
1041
- }, null), createVNode(Icon, {
1042
- "size": "small",
1043
- "name": "calendar",
1044
- "class": "datepicker-input-icon"
1045
- }, null)]), createVNode("div", {
1046
- "class": "devui-datepicker-panel",
1047
- "ref": panel
1048
- }, [state.show ? createVNode(Calendar, {
1049
- "type": props.range ? "range" : "select",
1050
- "showTime": props.showTime,
1051
- "current": state.current,
1052
- "next": state.next,
1053
- "dateMin": parseDate(props.dateMin),
1054
- "dateMax": parseDate(props.dateMax),
1055
- "dateStart": state.start,
1056
- "dateEnd": state.end,
1057
- "dateHover": state.hover,
1058
- "onReset": (date) => {
1059
- state.end = state.hover = void 0;
1060
- state.start = date;
1061
- },
1062
- "onChange": () => {
1063
- state.value = formatValue(state, props);
1064
- state.placeholder = formatPlaceholder(props);
1065
- invokeFunction(props.selectedDateChange, state.value);
1066
- if (props.autoClose) {
1067
- state.show = false;
1068
- }
1069
- },
1070
- "onToday": (date) => {
1071
- state.current = date;
1072
- state.start = date;
1073
- state.value = formatValue(state, props);
1074
- state.placeholder = formatPlaceholder(props);
1075
- invokeFunction(props.selectedDateChange, state.value);
1076
- if (props.autoClose) {
1077
- state.show = false;
1078
- }
1079
- },
1080
- "onSelected": (date) => {
1081
- state.start = date;
1082
- if (compareDateSort(state.current, date) !== 0) {
1083
- state.current = date;
1084
- }
1085
- },
1086
- "onSelectStart": (date) => state.start = date,
1087
- "onSelectEnd": (date) => {
1088
- state.end = date;
1089
- formatRange(state);
1090
- },
1091
- "onSelecting": (date) => state.hover = date,
1092
- "onPreviousYear": (date, pos) => handleCalendarSwitchState(state, 0, pos, date),
1093
- "onPreviousMonth": (date, pos) => handleCalendarSwitchState(state, 1, pos, date),
1094
- "onNextMonth": (date, pos) => handleCalendarSwitchState(state, 2, pos, date),
1095
- "onNextYear": (date, pos) => handleCalendarSwitchState(state, 3, pos, date)
1096
- }, null) : null])]);
1097
- };
1098
- }
1099
- });
1100
- var index$1 = "";
1101
- const StickSlider = defineComponent({
1102
- name: "DStickSlider",
1103
- props: {},
1104
- setup() {
1105
- const state = reactive({
1106
- showButtons: false,
1107
- selectedIndex: 0
1108
- });
1109
- const reset = () => {
1110
- state.showButtons = false;
1111
- };
1112
- const handleMainButtonMouseDown = (e) => {
1113
- e.stopPropagation();
1114
- state.showButtons = true;
1115
- };
1116
- const handleMainButtonMouseUp = (e) => {
1117
- e.stopPropagation();
1118
- reset();
1119
- };
1120
- return () => {
1121
- return createVNode("div", {
1122
- "class": "devui-stick-slider",
1123
- "onMousedown": handleMainButtonMouseDown,
1124
- "onMouseup": handleMainButtonMouseUp,
1125
- "onMouseleave": handleMainButtonMouseUp
1126
- }, [createVNode("div", {
1127
- "class": "sub-buttons",
1128
- "style": {
1129
- display: state.showButtons ? "" : "none"
1130
- }
1131
- }, [Array(16).fill(null).map((_, i) => {
1132
- return createVNode("div", {
1133
- "class": `button ${i === state.selectedIndex ? "selected" : ""}`,
1134
- "onMouseenter": () => state.selectedIndex = i
1135
- }, [i]);
1136
- })]), createVNode("div", {
1137
- "class": "main-button"
1138
- }, null)]);
1139
- };
1140
- }
1141
- });
1142
- DatePicker.install = function(app) {
1143
- app.component(DatePicker.name, DatePicker);
1144
- app.component(StickSlider.name, StickSlider);
1145
- };
1146
- var index = {
1147
- title: "DatePicker \u65E5\u671F\u9009\u62E9\u5668",
1148
- category: "\u6570\u636E\u5F55\u5165",
1149
- status: "50%",
1150
- install(app) {
1151
- app.use(DatePicker);
1152
- }
1153
- };
1154
- export { DatePicker, StickSlider, index as default };