vue-devui 1.0.0-rc.13 → 1.0.0-rc.16

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 (114) hide show
  1. package/README.md +161 -156
  2. package/alert/index.umd.js +1 -1
  3. package/auto-complete/index.es.js +241 -82
  4. package/auto-complete/index.umd.js +28 -17
  5. package/auto-complete/style.css +1 -1
  6. package/avatar/index.umd.js +1 -1
  7. package/badge/index.umd.js +1 -1
  8. package/button/index.es.js +21 -42
  9. package/button/index.umd.js +9 -9
  10. package/card/index.umd.js +1 -1
  11. package/checkbox/index.es.js +94 -77
  12. package/checkbox/index.umd.js +26 -15
  13. package/collapse/index.es.js +3 -21
  14. package/collapse/index.umd.js +1 -1
  15. package/countdown/index.umd.js +1 -1
  16. package/date-picker-pro/index.es.js +1384 -220
  17. package/date-picker-pro/index.umd.js +25 -14
  18. package/date-picker-pro/style.css +1 -1
  19. package/drawer/index.es.js +4 -17
  20. package/drawer/index.umd.js +1 -1
  21. package/dropdown/index.es.js +4 -22
  22. package/dropdown/index.umd.js +1 -1
  23. package/editable-select/index.es.js +254 -99
  24. package/editable-select/index.umd.js +1 -1
  25. package/editable-select/style.css +1 -1
  26. package/form/index.es.js +85 -71
  27. package/form/index.umd.js +22 -11
  28. package/fullscreen/index.umd.js +1 -1
  29. package/grid/index.es.js +7 -20
  30. package/grid/index.umd.js +1 -1
  31. package/icon/index.umd.js +1 -1
  32. package/image-preview/index.es.js +12 -23
  33. package/image-preview/index.umd.js +1 -1
  34. package/image-preview/style.css +1 -1
  35. package/input/index.es.js +239 -75
  36. package/input/index.umd.js +27 -16
  37. package/input-number/index.es.js +1 -16
  38. package/input-number/index.umd.js +1 -1
  39. package/layout/index.es.js +1 -1
  40. package/layout/index.umd.js +1 -1
  41. package/loading/index.es.js +15 -38
  42. package/loading/index.umd.js +1 -1
  43. package/message/index.d.ts +7 -0
  44. package/message/index.es.js +534 -0
  45. package/message/index.umd.js +1 -0
  46. package/message/package.json +7 -0
  47. package/message/style.css +1 -0
  48. package/modal/index.es.js +11 -43
  49. package/modal/index.umd.js +1 -1
  50. package/notification/index.es.js +16 -22
  51. package/notification/index.umd.js +1 -1
  52. package/nuxt/components/Message.js +3 -0
  53. package/nuxt/components/animationInjectionKey.js +3 -0
  54. package/nuxt/components/messageProps.js +3 -0
  55. package/nuxt/components/roundInjectionKey.js +3 -0
  56. package/nuxt/components/skeletonItemProps.js +3 -0
  57. package/overlay/index.es.js +1 -1
  58. package/overlay/index.umd.js +1 -1
  59. package/package.json +4 -2
  60. package/pagination/index.es.js +152 -2
  61. package/pagination/index.umd.js +1 -1
  62. package/panel/index.umd.js +1 -1
  63. package/popover/index.es.js +1 -1
  64. package/popover/index.umd.js +4 -4
  65. package/progress/index.umd.js +3 -3
  66. package/radio/index.es.js +91 -75
  67. package/radio/index.umd.js +28 -17
  68. package/radio/style.css +1 -1
  69. package/rate/index.umd.js +1 -1
  70. package/result/index.umd.js +1 -1
  71. package/ripple/index.es.js +5 -18
  72. package/ripple/index.umd.js +1 -1
  73. package/search/index.es.js +255 -78
  74. package/search/index.umd.js +27 -16
  75. package/search/style.css +1 -1
  76. package/select/index.es.js +283 -114
  77. package/select/index.umd.js +27 -16
  78. package/select/style.css +1 -1
  79. package/skeleton/index.es.js +87 -261
  80. package/skeleton/index.umd.js +1 -1
  81. package/skeleton/style.css +1 -1
  82. package/slider/index.umd.js +1 -1
  83. package/splitter/index.es.js +175 -32
  84. package/splitter/index.umd.js +13 -13
  85. package/statistic/index.es.js +0 -21
  86. package/statistic/index.umd.js +1 -1
  87. package/status/index.umd.js +1 -1
  88. package/steps/index.umd.js +1 -1
  89. package/style.css +1 -1
  90. package/switch/index.es.js +85 -71
  91. package/switch/index.umd.js +25 -14
  92. package/table/index.es.js +309 -96
  93. package/table/index.umd.js +25 -14
  94. package/table/style.css +1 -1
  95. package/tabs/index.umd.js +1 -1
  96. package/tag/index.umd.js +1 -1
  97. package/textarea/index.es.js +88 -72
  98. package/textarea/index.umd.js +26 -15
  99. package/time-picker/index.es.js +248 -89
  100. package/time-picker/index.umd.js +25 -14
  101. package/time-select/index.es.js +283 -114
  102. package/time-select/index.umd.js +26 -15
  103. package/time-select/style.css +1 -1
  104. package/timeline/index.umd.js +1 -1
  105. package/tooltip/index.es.js +1 -1
  106. package/tooltip/index.umd.js +4 -4
  107. package/tree/index.es.js +422 -110
  108. package/tree/index.umd.js +25 -14
  109. package/tree/style.css +1 -1
  110. package/upload/index.es.js +168 -49
  111. package/upload/index.umd.js +1 -1
  112. package/vue-devui.es.js +13601 -13023
  113. package/vue-devui.umd.js +32 -21
  114. package/LICENSE +0 -23
@@ -0,0 +1,534 @@
1
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, Transition, shallowReactive, createApp, onUnmounted, isVNode, reactive } from "vue";
2
+ const isString = (val) => typeof val === "string";
3
+ const DEFAULT_PREFIX = "icon";
4
+ const iconProps = {
5
+ name: {
6
+ type: String,
7
+ default: "",
8
+ required: true
9
+ },
10
+ size: {
11
+ type: [Number, String],
12
+ default: "inherit"
13
+ },
14
+ color: {
15
+ type: String,
16
+ default: "inherit"
17
+ },
18
+ component: {
19
+ type: Object,
20
+ default: null
21
+ },
22
+ classPrefix: {
23
+ type: String,
24
+ default: DEFAULT_PREFIX
25
+ },
26
+ operable: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ rotate: {
35
+ type: [Number, String]
36
+ }
37
+ };
38
+ const svgIconProps = {
39
+ name: {
40
+ type: String,
41
+ default: "",
42
+ required: true
43
+ },
44
+ color: {
45
+ type: String,
46
+ default: "inherit"
47
+ },
48
+ size: {
49
+ type: [Number, String],
50
+ default: "inherit"
51
+ }
52
+ };
53
+ function createBem(namespace, element, modifier) {
54
+ let cls = namespace;
55
+ if (element) {
56
+ cls += `__${element}`;
57
+ }
58
+ if (modifier) {
59
+ cls += `--${modifier}`;
60
+ }
61
+ return cls;
62
+ }
63
+ function useNamespace(block, needDot = false) {
64
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
65
+ const b = () => createBem(namespace);
66
+ const e = (element) => element ? createBem(namespace, element) : "";
67
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
68
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
69
+ return {
70
+ b,
71
+ e,
72
+ m,
73
+ em
74
+ };
75
+ }
76
+ var icon = "";
77
+ var svgIcon = defineComponent({
78
+ name: "DSvgIcon",
79
+ props: svgIconProps,
80
+ setup(props) {
81
+ const {
82
+ name,
83
+ color,
84
+ size
85
+ } = toRefs(props);
86
+ const ns2 = useNamespace("svg-icon");
87
+ const iconName = computed(() => `#icon-${name.value}`);
88
+ const iconSize = computed(() => {
89
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
90
+ });
91
+ const styles = {
92
+ width: iconSize.value,
93
+ height: iconSize.value
94
+ };
95
+ return () => {
96
+ return createVNode("svg", {
97
+ "class": ns2.b(),
98
+ "style": styles
99
+ }, [createVNode("use", {
100
+ "xlink:href": iconName.value,
101
+ "fill": color.value
102
+ }, null)]);
103
+ };
104
+ }
105
+ });
106
+ function isUrl(value) {
107
+ return /^((http|https):)?\/\//.test(value);
108
+ }
109
+ function useIconDom(props, ctx) {
110
+ const {
111
+ component,
112
+ name,
113
+ size,
114
+ color,
115
+ classPrefix,
116
+ rotate
117
+ } = toRefs(props);
118
+ const ns2 = useNamespace("icon");
119
+ const iconSize = computed(() => {
120
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
121
+ });
122
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
123
+ const imgIconDom = () => {
124
+ return createVNode("img", mergeProps({
125
+ "src": name.value,
126
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
127
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
128
+ "style": {
129
+ width: iconSize.value || "",
130
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
131
+ verticalAlign: "middle"
132
+ }
133
+ }, ctx.attrs), null);
134
+ };
135
+ const svgIconDom = () => {
136
+ return createVNode(IconComponent, mergeProps({
137
+ "name": name.value,
138
+ "color": color.value,
139
+ "size": iconSize.value,
140
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
141
+ "style": {
142
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
143
+ }
144
+ }, ctx.attrs), null);
145
+ };
146
+ const fontIconDom = () => {
147
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
148
+ return createVNode("i", mergeProps({
149
+ "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
150
+ "style": {
151
+ fontSize: iconSize.value,
152
+ color: color.value,
153
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
154
+ }
155
+ }, ctx.attrs), null);
156
+ };
157
+ const iconDom = () => {
158
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
159
+ };
160
+ return {
161
+ iconDom
162
+ };
163
+ }
164
+ var Icon = defineComponent({
165
+ name: "DIcon",
166
+ props: iconProps,
167
+ emits: ["click"],
168
+ setup(props, ctx) {
169
+ const {
170
+ disabled,
171
+ operable
172
+ } = toRefs(props);
173
+ const {
174
+ iconDom
175
+ } = useIconDom(props, ctx);
176
+ const ns2 = useNamespace("icon");
177
+ const wrapClassed = computed(() => ({
178
+ [ns2.e("container")]: true,
179
+ [ns2.m("disabled")]: disabled.value,
180
+ [ns2.m("operable")]: operable.value
181
+ }));
182
+ const onClick = (e) => {
183
+ if (disabled.value) {
184
+ return;
185
+ }
186
+ ctx.emit("click", e);
187
+ };
188
+ return () => {
189
+ var _a, _b, _c, _d;
190
+ return createVNode("div", {
191
+ "class": wrapClassed.value,
192
+ "onClick": onClick
193
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
194
+ };
195
+ }
196
+ });
197
+ var iconGroup = "";
198
+ defineComponent({
199
+ name: "DIconGroup",
200
+ setup(_, ctx) {
201
+ const ns2 = useNamespace("icon-group");
202
+ return () => {
203
+ var _a, _b;
204
+ return createVNode("div", {
205
+ "class": ns2.b()
206
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
207
+ };
208
+ }
209
+ });
210
+ var Close = defineComponent({
211
+ emits: ["click"],
212
+ setup(props, {
213
+ emit
214
+ }) {
215
+ const ns2 = useNamespace("message");
216
+ return () => createVNode("div", {
217
+ "class": ns2.e("icon-close"),
218
+ "onClick": (e) => emit("click", e)
219
+ }, [createVNode(Icon, {
220
+ "name": "close",
221
+ "size": "14px"
222
+ }, null)]);
223
+ }
224
+ });
225
+ const messageProps = {
226
+ id: {
227
+ type: String,
228
+ default: ""
229
+ },
230
+ visible: {
231
+ type: Boolean,
232
+ default: false
233
+ },
234
+ message: {
235
+ type: String,
236
+ default: ""
237
+ },
238
+ type: {
239
+ type: String,
240
+ default: "normal"
241
+ },
242
+ bordered: {
243
+ type: Boolean,
244
+ default: true
245
+ },
246
+ shadow: {
247
+ type: Boolean,
248
+ default: true
249
+ },
250
+ duration: {
251
+ type: Number,
252
+ default: 3e3
253
+ },
254
+ showClose: {
255
+ type: Boolean,
256
+ default: false
257
+ },
258
+ onClose: {
259
+ type: Function
260
+ }
261
+ };
262
+ const ns = useNamespace("message");
263
+ function SuccessIcon() {
264
+ return createVNode("svg", {
265
+ "viewBox": "0 0 1024 1024",
266
+ "xmlns": "http://www.w3.org/2000/svg",
267
+ "class": ns.e("icon")
268
+ }, [createVNode("path", {
269
+ "fill": "currentColor",
270
+ "d": "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"
271
+ }, null)]);
272
+ }
273
+ function WarningIcon() {
274
+ return createVNode("svg", {
275
+ "viewBox": "0 0 1024 1024",
276
+ "xmlns": "http://www.w3.org/2000/svg",
277
+ "class": ns.e("icon")
278
+ }, [createVNode("path", {
279
+ "fill": "currentColor",
280
+ "d": "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
281
+ }, null)]);
282
+ }
283
+ function InfoIcon() {
284
+ return createVNode("svg", {
285
+ "viewBox": "0 0 1024 1024",
286
+ "xmlns": "http://www.w3.org/2000/svg",
287
+ "class": ns.e("icon")
288
+ }, [createVNode("path", {
289
+ "fill": "currentColor",
290
+ "d": "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
291
+ }, null)]);
292
+ }
293
+ function ErrorIcon() {
294
+ return createVNode("svg", {
295
+ "viewBox": "0 0 1024 1024",
296
+ "xmlns": "http://www.w3.org/2000/svg",
297
+ "class": ns.e("icon")
298
+ }, [createVNode("path", {
299
+ "fill": "currentColor",
300
+ "d": "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"
301
+ }, null)]);
302
+ }
303
+ var message$1 = "";
304
+ var Message$1 = defineComponent({
305
+ name: "DMessage",
306
+ props: messageProps,
307
+ emits: ["destroy", "close"],
308
+ setup(props, {
309
+ emit,
310
+ slots
311
+ }) {
312
+ const {
313
+ visible,
314
+ message: message2,
315
+ type,
316
+ bordered,
317
+ shadow,
318
+ showClose
319
+ } = toRefs(props);
320
+ const ns2 = useNamespace("message");
321
+ let timer = null;
322
+ let timestamp;
323
+ const handleDestroy = () => {
324
+ emit("destroy");
325
+ };
326
+ const close = () => {
327
+ var _a;
328
+ timer && clearTimeout(timer);
329
+ timer = null;
330
+ (_a = props.onClose) == null ? void 0 : _a.call(props);
331
+ };
332
+ const interrupt = () => {
333
+ if (timer) {
334
+ clearTimeout(timer);
335
+ timer = null;
336
+ }
337
+ };
338
+ const removeReset = () => {
339
+ if (props.visible) {
340
+ const remainTime = props.duration - (Date.now() - timestamp);
341
+ timer = setTimeout(close, remainTime);
342
+ }
343
+ };
344
+ watch(() => props.visible, (val) => {
345
+ if (val) {
346
+ timestamp = Date.now();
347
+ if (props.duration) {
348
+ timer = setTimeout(close, props.duration);
349
+ }
350
+ }
351
+ });
352
+ const classes = computed(() => ({
353
+ [ns2.b()]: true,
354
+ [ns2.m(type.value)]: true
355
+ }));
356
+ const lastOffset = computed(() => getLastOffset(props.id));
357
+ const styles = computed(() => {
358
+ const messageStyles = {};
359
+ if (!bordered.value) {
360
+ messageStyles["border"] = "none";
361
+ }
362
+ if (!shadow.value) {
363
+ messageStyles["box-shadow"] = "none";
364
+ }
365
+ return {
366
+ ...messageStyles,
367
+ top: `${lastOffset.value}px`
368
+ };
369
+ });
370
+ const renderIcon = computed(() => {
371
+ const iconClasses = computed(() => ({
372
+ [ns2.e("image")]: true,
373
+ [ns2.em("image", type.value)]: true
374
+ }));
375
+ return !(!type.value || type.value === "normal") && createVNode("span", {
376
+ "class": iconClasses.value
377
+ }, [type.value && (type.value === "success" && createVNode(SuccessIcon, null, null) || type.value === "info" && createVNode(InfoIcon, null, null) || type.value === "warning" && createVNode(WarningIcon, null, null) || type.value === "error" && createVNode(ErrorIcon, null, null))]);
378
+ });
379
+ const renderText = computed(() => {
380
+ var _a;
381
+ const textClasses = computed(() => ({
382
+ [ns2.e("content")]: true,
383
+ [ns2.em("content", type.value)]: true
384
+ }));
385
+ return createVNode("span", {
386
+ "class": textClasses.value
387
+ }, [message2.value ? message2.value : (_a = slots.default) == null ? void 0 : _a.call(slots)]);
388
+ });
389
+ const renderClose = computed(() => {
390
+ return showClose.value && createVNode("span", {
391
+ "class": [ns2.e("close")],
392
+ "onClick": close
393
+ }, [createVNode(Close, null, null)]);
394
+ });
395
+ return () => {
396
+ return createVNode(Transition, {
397
+ "name": "message-fade",
398
+ "onAfterLeave": handleDestroy
399
+ }, {
400
+ default: () => [visible.value && createVNode("div", {
401
+ "class": classes.value,
402
+ "style": {
403
+ ...styles.value
404
+ },
405
+ "onMouseenter": interrupt,
406
+ "onMouseleave": removeReset
407
+ }, [renderIcon.value, renderText.value, renderClose.value])]
408
+ });
409
+ };
410
+ }
411
+ });
412
+ function _isSlot(s) {
413
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
414
+ }
415
+ const instances = shallowReactive([]);
416
+ const getLastOffset = (id) => {
417
+ const idx = instances.findIndex((instance) => instance.id === id);
418
+ return idx * 65 + 80;
419
+ };
420
+ const deleteInstance = (id) => {
421
+ const idx = instances.findIndex((instance) => instance.id === id);
422
+ if (idx !== -1) {
423
+ instances.splice(idx, 1);
424
+ }
425
+ return idx;
426
+ };
427
+ const initInstance = (id, props, message2) => {
428
+ const container = document.createElement("div");
429
+ container.id = id;
430
+ const app = createApp({
431
+ setup() {
432
+ onUnmounted(() => {
433
+ document.body.removeChild(container);
434
+ });
435
+ return () => createVNode(Message$1, mergeProps(props, {
436
+ "id": id,
437
+ "onDestroy": app.unmount
438
+ }), _isSlot(message2) ? message2 : {
439
+ default: () => [message2]
440
+ });
441
+ }
442
+ });
443
+ document.body.appendChild(container);
444
+ app.mount(container);
445
+ return {
446
+ id,
447
+ props
448
+ };
449
+ };
450
+ const defaultOptions = {
451
+ duration: 3e3,
452
+ type: "normal"
453
+ };
454
+ const normalizeOptions = (params) => {
455
+ const options = !params || isString(params) ? {
456
+ message: params
457
+ } : params;
458
+ const normalized = {
459
+ ...defaultOptions,
460
+ ...options
461
+ };
462
+ return normalized;
463
+ };
464
+ let seed = 0;
465
+ function open(options) {
466
+ const originOnClose = options.onClose || null;
467
+ const messageContent = options.message;
468
+ delete options.message;
469
+ const props = reactive({
470
+ ...defaultOptions,
471
+ ...options,
472
+ onClose: () => {
473
+ props.visible = false;
474
+ deleteInstance(props.id);
475
+ originOnClose == null ? void 0 : originOnClose();
476
+ }
477
+ });
478
+ seed++;
479
+ const id = `message_${seed}`;
480
+ props.id = id;
481
+ const messageContext = initInstance(id, props, messageContent);
482
+ instances.push(messageContext);
483
+ props.visible = true;
484
+ }
485
+ function message(params) {
486
+ const options = normalizeOptions(params);
487
+ open({
488
+ ...options
489
+ });
490
+ }
491
+ function success(params) {
492
+ const options = normalizeOptions(params);
493
+ open({
494
+ ...options,
495
+ type: "success"
496
+ });
497
+ }
498
+ function error(params) {
499
+ const options = normalizeOptions(params);
500
+ open({
501
+ ...options,
502
+ type: "error"
503
+ });
504
+ }
505
+ function warning(params) {
506
+ const options = normalizeOptions(params);
507
+ open({
508
+ ...options,
509
+ type: "warning"
510
+ });
511
+ }
512
+ function info(params) {
513
+ const options = normalizeOptions(params);
514
+ open({
515
+ ...options,
516
+ type: "info"
517
+ });
518
+ }
519
+ const Message = Object.assign(message, {
520
+ success,
521
+ error,
522
+ warning,
523
+ info
524
+ });
525
+ console.log(Message);
526
+ var index = {
527
+ title: "Message \u5168\u5C40\u63D0\u793A",
528
+ category: "\u53CD\u9988",
529
+ status: "100%",
530
+ install(app) {
531
+ app.config.globalProperties.$message = Message;
532
+ }
533
+ };
534
+ export { Message, index as default, messageProps };
@@ -0,0 +1 @@
1
+ (function(f,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(f=typeof globalThis!="undefined"?globalThis:f||self,e(f.index={},f.Vue))})(this,function(f,e){"use strict";const M=n=>typeof n=="string",P={name:{type:String,default:"",required:!0},size:{type:[Number,String],default:"inherit"},color:{type:String,default:"inherit"},component:{type:Object,default:null},classPrefix:{type:String,default:"icon"},operable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},rotate:{type:[Number,String]}},T={name:{type:String,default:"",required:!0},color:{type:String,default:"inherit"},size:{type:[Number,String],default:"inherit"}};function w(n,t,s){let o=n;return t&&(o+=`__${t}`),s&&(o+=`--${s}`),o}function p(n,t=!1){const s=t?`.devui-${n}`:`devui-${n}`;return{b:()=>w(s),e:l=>l?w(s,l):"",m:l=>l?w(s,"",l):"",em:(l,u)=>l&&u?w(s,l,u):""}}var ae="",B=e.defineComponent({name:"DSvgIcon",props:T,setup(n){const{name:t,color:s,size:o}=e.toRefs(n),c=p("svg-icon"),a=e.computed(()=>`#icon-${t.value}`),m=e.computed(()=>typeof o.value=="number"?`${o.value}px`:o.value),l={width:m.value,height:m.value};return()=>e.createVNode("svg",{class:c.b(),style:l},[e.createVNode("use",{"xlink:href":a.value,fill:s.value},null)])}});function L(n){return/^((http|https):)?\/\//.test(n)}function _(n,t){const{component:s,name:o,size:c,color:a,classPrefix:m,rotate:l}=e.toRefs(n),u=p("icon"),r=e.computed(()=>typeof c.value=="number"?`${c.value}px`:c.value),d=s.value?e.resolveDynamicComponent(s.value):e.resolveDynamicComponent(B),g=()=>e.createVNode("img",e.mergeProps({src:o.value,alt:o.value.split("/")[o.value.split("/").length-1],class:[(l==null?void 0:l.value)==="infinite"&&u.m("spin")],style:{width:r.value||"",transform:`rotate(${l==null?void 0:l.value}deg)`,verticalAlign:"middle"}},t.attrs),null),V=()=>e.createVNode(d,e.mergeProps({name:o.value,color:a.value,size:r.value,class:[(l==null?void 0:l.value)==="infinite"&&u.m("spin")],style:{transform:`rotate(${l==null?void 0:l.value}deg)`}},t.attrs),null),b=()=>{const I=/^icon-/.test(o.value)?o.value:`${m.value}-${o.value}`;return e.createVNode("i",e.mergeProps({class:[m.value,I,(l==null?void 0:l.value)==="infinite"&&u.m("spin")],style:{fontSize:r.value,color:a.value,transform:`rotate(${l==null?void 0:l.value}deg)`}},t.attrs),null)};return{iconDom:()=>s.value?V():L(o.value)?g():b()}}var k=e.defineComponent({name:"DIcon",props:P,emits:["click"],setup(n,t){const{disabled:s,operable:o}=e.toRefs(n),{iconDom:c}=_(n,t),a=p("icon"),m=e.computed(()=>({[a.e("container")]:!0,[a.m("disabled")]:s.value,[a.m("operable")]:o.value})),l=u=>{s.value||t.emit("click",u)};return()=>{var u,r,d,g;return e.createVNode("div",{class:m.value,onClick:l},[(r=(u=t.slots).prefix)==null?void 0:r.call(u),c(),(g=(d=t.slots).suffix)==null?void 0:g.call(d)])}}}),ce="";e.defineComponent({name:"DIconGroup",setup(n,t){const s=p("icon-group");return()=>{var o,c;return e.createVNode("div",{class:s.b()},[(c=(o=t.slots).default)==null?void 0:c.call(o)])}}});var A=e.defineComponent({emits:["click"],setup(n,{emit:t}){const s=p("message");return()=>e.createVNode("div",{class:s.e("icon-close"),onClick:o=>t("click",o)},[e.createVNode(k,{name:"close",size:"14px"},null)])}});const x={id:{type:String,default:""},visible:{type:Boolean,default:!1},message:{type:String,default:""},type:{type:String,default:"normal"},bordered:{type:Boolean,default:!0},shadow:{type:Boolean,default:!0},duration:{type:Number,default:3e3},showClose:{type:Boolean,default:!1},onClose:{type:Function}},N=p("message");function O(){return e.createVNode("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",class:N.e("icon")},[e.createVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"},null)])}function R(){return e.createVNode("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",class:N.e("icon")},[e.createVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"},null)])}function j(){return e.createVNode("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",class:N.e("icon")},[e.createVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"},null)])}function E(){return e.createVNode("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",class:N.e("icon")},[e.createVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"},null)])}var re="",F=e.defineComponent({name:"DMessage",props:x,emits:["destroy","close"],setup(n,{emit:t,slots:s}){const{visible:o,message:c,type:a,bordered:m,shadow:l,showClose:u}=e.toRefs(n),r=p("message");let d=null,g;const V=()=>{t("destroy")},b=()=>{var i;d&&clearTimeout(d),d=null,(i=n.onClose)==null||i.call(n)},D=()=>{d&&(clearTimeout(d),d=null)},I=()=>{if(n.visible){const i=n.duration-(Date.now()-g);d=setTimeout(b,i)}};e.watch(()=>n.visible,i=>{i&&(g=Date.now(),n.duration&&(d=setTimeout(b,n.duration)))});const Z=e.computed(()=>({[r.b()]:!0,[r.m(a.value)]:!0})),ee=e.computed(()=>q(n.id)),ne=e.computed(()=>{const i={};return m.value||(i.border="none"),l.value||(i["box-shadow"]="none"),{...i,top:`${ee.value}px`}}),te=e.computed(()=>{const i=e.computed(()=>({[r.e("image")]:!0,[r.em("image",a.value)]:!0}));return!(!a.value||a.value==="normal")&&e.createVNode("span",{class:i.value},[a.value&&(a.value==="success"&&e.createVNode(O,null,null)||a.value==="info"&&e.createVNode(j,null,null)||a.value==="warning"&&e.createVNode(R,null,null)||a.value==="error"&&e.createVNode(E,null,null))])}),oe=e.computed(()=>{var $;const i=e.computed(()=>({[r.e("content")]:!0,[r.em("content",a.value)]:!0}));return e.createVNode("span",{class:i.value},[c.value?c.value:($=s.default)==null?void 0:$.call(s)])}),se=e.computed(()=>u.value&&e.createVNode("span",{class:[r.e("close")],onClick:b},[e.createVNode(A,null,null)]));return()=>e.createVNode(e.Transition,{name:"message-fade",onAfterLeave:V},{default:()=>[o.value&&e.createVNode("div",{class:Z.value,style:{...ne.value},onMouseenter:D,onMouseleave:I},[te.value,oe.value,se.value])]})}});function U(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!e.isVNode(n)}const h=e.shallowReactive([]),q=n=>h.findIndex(s=>s.id===n)*65+80,G=n=>{const t=h.findIndex(s=>s.id===n);return t!==-1&&h.splice(t,1),t},X=(n,t,s)=>{const o=document.createElement("div");o.id=n;const c=e.createApp({setup(){return e.onUnmounted(()=>{document.body.removeChild(o)}),()=>e.createVNode(F,e.mergeProps(t,{id:n,onDestroy:c.unmount}),U(s)?s:{default:()=>[s]})}});return document.body.appendChild(o),c.mount(o),{id:n,props:t}},z={duration:3e3,type:"normal"},v=n=>{const t=!n||M(n)?{message:n}:n;return{...z,...t}};let S=0;function y(n){const t=n.onClose||null,s=n.message;delete n.message;const o=e.reactive({...z,...n,onClose:()=>{o.visible=!1,G(o.id),t==null||t()}});S++;const c=`message_${S}`;o.id=c;const a=X(c,o,s);h.push(a),o.visible=!0}function W(n){const t=v(n);y({...t})}function H(n){const t=v(n);y({...t,type:"success"})}function J(n){const t=v(n);y({...t,type:"error"})}function K(n){const t=v(n);y({...t,type:"warning"})}function Q(n){const t=v(n);y({...t,type:"info"})}const C=Object.assign(W,{success:H,error:J,warning:K,info:Q});console.log(C);var Y={title:"Message \u5168\u5C40\u63D0\u793A",category:"\u53CD\u9988",status:"100%",install(n){n.config.globalProperties.$message=C}};f.Message=C,f.default=Y,f.messageProps=x,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "message",
3
+ "version": "0.0.0",
4
+ "main": "index.umd.js",
5
+ "module": "index.es.js",
6
+ "style": "style.css"
7
+ }
@@ -0,0 +1 @@
1
+ .devui-icon__container{display:inline-block;color:var(--devui-icon-fill, #71757f)}.devui-icon__container>*:not(:last-child){vertical-align:middle;margin-right:8px}.devui-icon__container i{vertical-align:middle;transition:all var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-icon--disabled{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-icon--disabled i{color:var(--devui-disabled-text, #adb0b8)}.devui-icon--operable:not(.devui-icon--disabled){cursor:pointer;transition:color var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-icon--operable:not(.devui-icon--disabled) i{cursor:pointer}.devui-icon--operable:hover:not(.devui-icon--disabled){color:var(--devui-icon-fill-hover, #252b3a)}.devui-icon--operable:hover:not(.devui-icon--disabled).devui-icon__container{background-color:var(--devui-icon-background-hover, var(--devui-list-item-hover-bg, #f2f2f3))}.devui-icon--operable:hover:not(.devui-icon--disabled) i{color:var(--devui-icon-fill-hover, #252b3a)}.devui-icon--operable:active:not(.devui-icon--disabled){color:var(--devui-icon-active-color, var(--devui-icon-fill-active, #252b3a))}.devui-icon--operable:active:not(.devui-icon--disabled).devui-icon__container{background-color:var(--devui-icon-background-active, var(--devui-list-item-active-bg, #f2f5fc))}.devui-icon--operable:active:not(.devui-icon--disabled) i{color:var(--devui-icon-active-color, var(--devui-icon-fill-active, #252b3a))}.devui-icon--operable.devui-icon__container{height:32px;line-height:32px;padding:0 8px;margin-left:-8px;border-radius:var(--devui-border-radius, 4px);transition:all var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out-smooth, cubic-bezier(.645, .045, .355, 1))}.devui-icon--spin{animation:iconSpin 2.5s linear infinite}.devui-svg-icon{vertical-align:middle}@keyframes iconSpin{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}.devui-icon-group{display:inline-flex;align-items:center}.devui-icon-group>.devui-icon__container:not(.devui-icon--operable){padding:8px;margin-left:0}.devui-icon-group>.devui-icon__container:not(.devui-icon--operable):first-child{margin-left:-8px}.devui-icon-group>*:not(:first-child){margin-left:0}.devui-message{position:fixed;z-index:var(--devui-z-index-modal, 1079);padding:10px 15px;border-radius:var(--devui-border-radius-feedback, 4px);left:50%;transform:translate(-50%);top:80px;display:flex;align-items:center;border-width:1px;border-style:solid;box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;background-color:var(--devui-base-bg, #ffffff);transition:top .5s ease}.devui-message--success{background-color:var(--devui-success-bg, #edfff9);border-color:var(--devui-success-line, #50d4ab)}.devui-message--info{background-color:var(--devui-info-bg, #f2f5fc);border-color:var(--devui-info-line, #5e7ce0)}.devui-message--warning{background-color:var(--devui-warning-bg, #fff3e8);border-color:var(--devui-warning-line, #fa9841)}.devui-message--error{background-color:var(--devui-danger-bg, #ffeeed);border-color:var(--devui-danger-line, #f66f6a)}.devui-message__close{margin-left:auto;padding-left:10px;margin-top:-2px}.devui-message__image{margin-top:1px;display:inline-block;width:var(--devui-font-size-icon, 16px);min-width:var(--devui-font-size-icon, 16px);min-height:var(--devui-font-size-icon, 16px);height:var(--devui-font-size-icon, 16px);padding:0;line-height:1;margin-right:10px}.devui-message__image--success{color:var(--devui-success, #50d4ab)}.devui-message__image--info{color:var(--devui-info, #5e7ce0)}.devui-message__image--warning{color:var(--devui-warning, #fac20a)}.devui-message__image--error{color:var(--devui-danger, #f66f6a)}.devui-message__content{font-size:var(--devui-font-size-page-title, 16px);overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}.devui-message__content--success{color:var(--devui-success, #50d4ab)}.devui-message__content--info{color:var(--devui-info, #5e7ce0)}.devui-message__content--warning{color:var(--devui-warning, #fac20a)}.devui-message__content--error{color:var(--devui-danger, #f66f6a)}.message-fade-enter-active,.message-fade-leave-active{transform:translate(-50%);transition:all .5s ease}.message-fade-enter-from,.message-fade-leave-to{opacity:0;transform:translate(-50%,-200%)}
package/modal/index.es.js CHANGED
@@ -1,39 +1,4 @@
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
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- var __publicField = (obj, key, value) => {
33
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
- return value;
35
- };
36
- import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, unref, nextTick, onMounted, Teleport, h, render } from "vue";
1
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, onUnmounted, Transition, ref, nextTick, unref, onMounted, Teleport, h, render } from "vue";
37
2
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
38
3
  const modalProps = {
39
4
  modelValue: {
@@ -579,6 +544,8 @@ function useModalRender(props) {
579
544
  showContainer.value = false;
580
545
  }, 100);
581
546
  }
547
+ }, {
548
+ immediate: true
582
549
  });
583
550
  onUnmounted(removeBodyAdditions);
584
551
  return { showContainer, showModal };
@@ -714,15 +681,16 @@ class ModalService extends CommonModalService {
714
681
  open(props = {}) {
715
682
  const anchor = document.createElement("div");
716
683
  this.anchorContainer.appendChild(anchor);
717
- const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
684
+ const { header, content, footer, ...resProps } = props;
718
685
  const renderOrigin = (propsValue, onUpdateModelValue) => {
719
- return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
686
+ return this.renderModal(anchor, {
687
+ ...propsValue,
720
688
  modelValue: true,
721
689
  "onUpdate:modelValue": onUpdateModelValue
722
- }), { header, default: content, footer });
690
+ }, { header, default: content, footer });
723
691
  };
724
692
  const hide = () => {
725
- var _a2, _b, _c;
693
+ var _a, _b, _c;
726
694
  const innerNeedHideOrNot = (value) => {
727
695
  if (!value) {
728
696
  hide();
@@ -730,13 +698,13 @@ class ModalService extends CommonModalService {
730
698
  };
731
699
  renderOrigin(resProps, (value) => {
732
700
  if (!value) {
733
- this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
701
+ this.renderModal(anchor, { ...resProps, modelValue: false });
734
702
  this.renderNull(anchor);
735
703
  } else {
736
704
  renderOrigin(resProps, innerNeedHideOrNot);
737
705
  }
738
706
  });
739
- (_c = (_b = (_a2 = vm == null ? void 0 : vm.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
707
+ (_c = (_b = (_a = vm == null ? void 0 : vm.component) == null ? void 0 : _a.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
740
708
  };
741
709
  const needHideOrNot = (value) => {
742
710
  if (!value) {
@@ -748,7 +716,7 @@ class ModalService extends CommonModalService {
748
716
  return { hide };
749
717
  }
750
718
  }
751
- __publicField(ModalService, "token", "MODAL_SERVICE_TOKEN");
719
+ ModalService.token = "MODAL_SERVICE_TOKEN";
752
720
  var index = {
753
721
  title: "Modal \u5F39\u7A97",
754
722
  category: "\u53CD\u9988",