kui-vue 3.6.4 → 3.6.7

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 (197) hide show
  1. package/components/alert/alert.jsx +26 -7
  2. package/components/alert/demo/basic.md +4 -4
  3. package/components/alert/demo/icon.md +15 -6
  4. package/components/alert/styles/index.less +42 -14
  5. package/components/avatar/styles/index.less +4 -4
  6. package/components/backtop/styles/index.less +10 -14
  7. package/components/badge/styles/index.less +7 -13
  8. package/components/breadcrumb/index.md +7 -6
  9. package/components/breadcrumb/styles/index.less +7 -21
  10. package/components/button/demo/color.md +0 -1
  11. package/components/button/demo/disabled.md +6 -0
  12. package/components/button/demo/light.md +1 -1
  13. package/components/button/styles/index.less +165 -111
  14. package/components/card/card.jsx +1 -1
  15. package/components/card/demo/basic.md +1 -1
  16. package/components/card/demo/border.md +1 -1
  17. package/components/card/demo/notitle.md +1 -1
  18. package/components/card/styles/index.less +5 -4
  19. package/components/carousel/carousel.jsx +186 -175
  20. package/components/carousel/styles/index.less +11 -16
  21. package/components/checkbox/checkbox.jsx +2 -2
  22. package/components/checkbox/styles/index.less +21 -29
  23. package/components/collapse/styles/index.less +7 -11
  24. package/components/colorPicker/styles/index.less +83 -71
  25. package/components/config/context.js +21 -0
  26. package/components/config/index.js +10 -2
  27. package/components/datePicker/datepicker.jsx +6 -2
  28. package/components/datePicker/styles/index.less +54 -57
  29. package/components/descriptions/styles/index.less +8 -17
  30. package/components/divider/styles/index.less +20 -18
  31. package/components/drawer/demo/target.md +1 -0
  32. package/components/drawer/styles/animal.less +0 -1
  33. package/components/drawer/styles/index.less +8 -11
  34. package/components/dropdown/demo/cascading.md +30 -16
  35. package/components/dropdown/styles/index.less +26 -34
  36. package/components/empty/index.md +3 -2
  37. package/components/empty/styles/index.less +2 -2
  38. package/components/flex/demo/align.md +1 -1
  39. package/components/flex/demo/basic.md +1 -2
  40. package/components/flex/index.md +1 -1
  41. package/components/form/demo/dynamicvalid.md +1 -3
  42. package/components/form/demo/info.md +22 -12
  43. package/components/form/demo/valid.md +6 -6
  44. package/components/form/demo/withmodal.md +6 -6
  45. package/components/form/styles/index.less +10 -11
  46. package/components/grid/index.md +4 -1
  47. package/components/grid/styles/index.less +1 -1
  48. package/components/icon/demo/search.vue +44 -21
  49. package/components/icon/index.md +1 -1
  50. package/components/icon/styles/index.less +7 -8
  51. package/components/image/index.md +7 -1
  52. package/components/image/preview.jsx +17 -4
  53. package/components/image/styles/index.less +36 -42
  54. package/components/index.js +9 -9
  55. package/components/input/demo/icon.md +0 -1
  56. package/components/input/demo/suffix.md +2 -7
  57. package/components/input/input.jsx +31 -29
  58. package/components/input/inputBox.jsx +13 -0
  59. package/components/input/inputGroup.jsx +2 -0
  60. package/components/input/styles/index.less +47 -53
  61. package/components/input/textarea.jsx +1 -1
  62. package/components/inputNumber/demo/basic.md +3 -3
  63. package/components/inputNumber/demo/ffix.md +2 -2
  64. package/components/inputNumber/inputNumber.jsx +2 -2
  65. package/components/inputNumber/styles/index.less +36 -42
  66. package/components/layout/demo/basic.md +5 -5
  67. package/components/layout/demo/info.md +1 -34
  68. package/components/layout/demo/layout1.md +7 -7
  69. package/components/layout/demo/layout2.md +32 -20
  70. package/components/layout/demo/layout3.md +20 -13
  71. package/components/layout/demo/layout4.md +12 -8
  72. package/components/layout/demo/layout5.md +6 -2
  73. package/components/layout/styles/index.less +1 -18
  74. package/components/loading/demo/info.md +3 -3
  75. package/components/loading/styles/index.less +31 -31
  76. package/components/menu/demo/accordion.md +44 -22
  77. package/components/menu/demo/basic.md +35 -20
  78. package/components/menu/demo/collapsed.md +37 -19
  79. package/components/menu/demo/inline.md +44 -23
  80. package/components/menu/demo/mode.md +42 -26
  81. package/components/menu/demo/theme.md +34 -18
  82. package/components/menu/demo/vertical.md +34 -18
  83. package/components/menu/index.md +14 -3
  84. package/components/menu/menu.jsx +9 -3
  85. package/components/menu/menuitem.jsx +4 -4
  86. package/components/menu/recursiveMenu.jsx +40 -0
  87. package/components/menu/styles/index.less +46 -58
  88. package/components/message/demo/basic.md +0 -7
  89. package/components/message/index.js +0 -4
  90. package/components/message/index.md +0 -1
  91. package/components/message/inner.jsx +15 -2
  92. package/components/message/styles/index.less +12 -17
  93. package/components/modal/demo/confirm.md +6 -6
  94. package/components/modal/demo/global.md +0 -15
  95. package/components/modal/demo/info.md +0 -1
  96. package/components/modal/index.js +5 -34
  97. package/components/modal/index.md +1 -2
  98. package/components/modal/modal.jsx +2 -1
  99. package/components/modal/styles/index.less +14 -21
  100. package/components/notice/demo/basic.md +0 -9
  101. package/components/notice/demo/close.md +4 -0
  102. package/components/notice/demo/types.md +1 -2
  103. package/components/notice/index.js +1 -19
  104. package/components/notice/styles/index.less +16 -22
  105. package/components/page/page.jsx +5 -4
  106. package/components/page/styles/index.less +49 -50
  107. package/components/popconfirm/demo/basic.md +11 -18
  108. package/components/popconfirm/demo/info.md +3 -1
  109. package/components/popconfirm/demo/local.md +14 -20
  110. package/components/popconfirm/demo/placement.md +3 -9
  111. package/components/popconfirm/index.md +3 -2
  112. package/components/popconfirm/styles/index.less +9 -15
  113. package/components/poptip/styles/index.less +44 -49
  114. package/components/progress/styles/index.less +13 -13
  115. package/components/radio/index.md +7 -7
  116. package/components/radio/radio.jsx +5 -1
  117. package/components/radio/styles/index.less +26 -32
  118. package/components/rate/index.md +11 -11
  119. package/components/rate/styles/index.less +4 -7
  120. package/components/select/select.jsx +2 -2
  121. package/components/select/styles/index.less +37 -50
  122. package/components/skeleton/index.md +5 -1
  123. package/components/skeleton/styles/index.less +21 -19
  124. package/components/slider/slider.jsx +25 -13
  125. package/components/slider/styles/index.less +13 -12
  126. package/components/space/space.jsx +2 -1
  127. package/components/spin/styles/index.less +25 -40
  128. package/components/statCard/demo/card.md +18 -4
  129. package/components/statCard/index.md +5 -5
  130. package/components/statCard/statCard.jsx +4 -1
  131. package/components/statCard/styles/index.less +9 -6
  132. package/components/styles/less-css-var.less +305 -0
  133. package/components/styles/less-var.less +296 -0
  134. package/components/styles/sys.less +19 -15
  135. package/components/switch/styles/index.less +9 -24
  136. package/components/table/index.md +1 -1
  137. package/components/table/styles/index.less +63 -59
  138. package/components/table/table.jsx +1 -1
  139. package/components/tabs/styles/index.less +22 -24
  140. package/components/tag/demo/basic.md +0 -8
  141. package/components/tag/index.md +2 -1
  142. package/components/tag/styles/index.less +40 -41
  143. package/components/tag/tag.jsx +2 -2
  144. package/components/timeline/styles/index.less +8 -14
  145. package/components/tooltip/styles/index.less +35 -40
  146. package/components/tree/index.md +15 -15
  147. package/components/tree/styles/index.less +36 -56
  148. package/components/tree/tree.jsx +1 -0
  149. package/components/treeselect/index.md +1 -1
  150. package/components/treeselect/styles/index.less +26 -32
  151. package/components/treeselect/treeselect.jsx +3 -3
  152. package/components/upload/demo/forms.md +0 -1
  153. package/components/upload/fileList.jsx +6 -3
  154. package/components/upload/styles/index.less +33 -29
  155. package/components/upload/upload.jsx +5 -1
  156. package/components/utils/vue.js +4 -2
  157. package/dist/k-ui.cjs.js +3 -2
  158. package/dist/k-ui.css +4 -3
  159. package/dist/k-ui.d.ts +71 -54
  160. package/dist/k-ui.esm.js +3 -2
  161. package/dist/k-ui.umd.js +3 -2
  162. package/dist/locale/de.js +2 -1
  163. package/dist/locale/el.js +2 -1
  164. package/dist/locale/en.js +2 -1
  165. package/dist/locale/fr.js +2 -1
  166. package/dist/locale/it.js +2 -1
  167. package/dist/locale/ja.js +2 -1
  168. package/dist/locale/ko.js +2 -1
  169. package/dist/locale/ru.js +2 -1
  170. package/dist/locale/th.js +2 -1
  171. package/dist/locale/uk.js +2 -1
  172. package/dist/locale/vi.js +2 -1
  173. package/dist/locale/zh-CN.js +2 -1
  174. package/dist/locale/zh-TW.js +2 -1
  175. package/package.json +14 -16
  176. package/types/alert/Alert.d.ts +2 -0
  177. package/types/card/Card.d.ts +1 -1
  178. package/types/checkbox/Checkbox.d.ts +1 -0
  179. package/types/datePicker/DatePicker.d.ts +1 -0
  180. package/types/index.d.ts +6 -6
  181. package/types/input/Input.d.ts +1 -0
  182. package/types/input/InputGroup.d.ts +2 -0
  183. package/types/input/TextArea.d.ts +1 -0
  184. package/types/inputNumber/InputNumber.d.ts +1 -0
  185. package/types/menu/Menu.d.ts +1 -0
  186. package/types/page/Page.d.ts +1 -0
  187. package/types/select/Select.d.ts +1 -0
  188. package/types/statCard/StatCard.d.ts +2 -0
  189. package/types/table/Table.d.ts +1 -1
  190. package/types/tag/Tag.d.ts +1 -0
  191. package/types/treeselect/TreeSelect.d.ts +1 -0
  192. package/components/dropdown/demo/custom.md +0 -31
  193. package/components/icon/lib/dist.json +0 -1
  194. package/components/icon/lib/kui-icons.js +0 -1
  195. package/components/icon/lib/sprite.svg +0 -1
  196. package/components/styles/color.less +0 -209
  197. package/components/styles/var.less +0 -207
@@ -1,4 +1,4 @@
1
- @import "../../styles/var.less";
1
+ @import "../../styles/less-css-var.less";
2
2
 
3
3
  .k-menu {
4
4
  display: flex;
@@ -10,11 +10,11 @@
10
10
  font-size: 14px;
11
11
  position: relative;
12
12
  zoom: 1;
13
- background: var(--kui-color-back);
13
+ background: var(--kui-color-bg);
14
14
  list-style: none;
15
- color: var(--kui-color-font);
16
- // transition: background-color .3s cubic-bezier(.645, .045, .355, 1), width .3s cubic-bezier(.645, .045, .355, 1);
15
+ color: var(--kui-color-text);
17
16
  transition: width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
17
+ -webkit-user-select: none;
18
18
  user-select: none;
19
19
  box-sizing: border-box;
20
20
 
@@ -62,9 +62,6 @@
62
62
  display: flex;
63
63
  align-items: center;
64
64
  line-height: 1;
65
- &:hover {
66
- background-color: var(--kui-color-hover);
67
- }
68
65
  }
69
66
 
70
67
  .k-menu-submenu-title {
@@ -80,7 +77,7 @@
80
77
  }
81
78
 
82
79
  a {
83
- color: var(--kui-color-font);
80
+ color: var(--kui-color-text);
84
81
  text-decoration: none;
85
82
 
86
83
  &::before {
@@ -95,12 +92,6 @@
95
92
  }
96
93
  }
97
94
 
98
- .k-menu-submenu-selected {
99
- .k-menu-submenu-title {
100
- color: var(--kui-color-main);
101
- }
102
- }
103
-
104
95
  .k-menu-item-disabled,
105
96
  .k-menu-submenu-disabled {
106
97
  &:hover {
@@ -108,7 +99,7 @@
108
99
  }
109
100
 
110
101
  * {
111
- color: var(--kui-color-disabled);
102
+ color: var(--kui-color-text-disabled);
112
103
  cursor: not-allowed;
113
104
  }
114
105
  }
@@ -142,7 +133,7 @@
142
133
  }
143
134
 
144
135
  .k-menu-item {
145
- padding: 13px 16px;
136
+ padding: 13px 16px 13px 10px;
146
137
  border-radius: var(--kui-border-radius);
147
138
 
148
139
  &::after {
@@ -150,25 +141,28 @@
150
141
  position: absolute;
151
142
  width: 0;
152
143
  height: 0;
153
- border-right: 3px solid var(--kui-color-main);
144
+ border-right: 3px solid var(--kui-color-primary);
154
145
  top: 50%;
155
146
  right: 0;
156
147
  transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
157
148
  }
158
-
159
- &:active {
160
- background: var(--kui-color-active);
149
+ &:not(.k-menu-item-selected) {
150
+ &:hover {
151
+ background: var(--kui-color-item-hover);
152
+ }
153
+ &:active {
154
+ background: var(--kui-color-item-active);
155
+ }
161
156
  }
162
157
  }
163
158
 
164
159
  .k-menu-submenu-active .k-menu-submenu-title:active {
165
- background: var(--kui-color-active);
160
+ background: var(--kui-color-item-active);
166
161
  }
167
162
 
168
163
  .k-menu-submenu-title {
169
- // padding: 10px 36px 10px 12px;
170
164
  padding-top: 13px;
171
- padding-left: 12px;
165
+ padding-left: 10px;
172
166
  padding-right: 12px;
173
167
  padding-bottom: 13px;
174
168
  box-sizing: border-box;
@@ -178,12 +172,6 @@
178
172
  flex: 1;
179
173
  }
180
174
  .k-menu-submenu-arrow {
181
- // mode inline
182
- // position: absolute;
183
- // right: 8px;
184
- // top: 50%;
185
- // transform: translateY(-50%);
186
-
187
175
  &::after,
188
176
  &::before {
189
177
  content: "";
@@ -203,13 +191,14 @@
203
191
  transform: rotate(-45deg) translateX(2.5px);
204
192
  }
205
193
  }
194
+ &:not(.k-menu-item-selected) {
195
+ &:hover {
196
+ background-color: var(--kui-color-item-hover);
197
+ }
206
198
 
207
- &:hover {
208
- background-color: var(--kui-color-hover);
209
- }
210
-
211
- &:active {
212
- background-color: var(--kui-color-active);
199
+ &:active {
200
+ background-color: var(--kui-color-item-active);
201
+ }
213
202
  }
214
203
  }
215
204
 
@@ -233,7 +222,7 @@
233
222
 
234
223
  //light
235
224
  .k-menu-item-selected {
236
- background-color: var(--kui-color-selected);
225
+ background-color: var(--kui-color-item-selected);
237
226
 
238
227
  &::after {
239
228
  display: none;
@@ -247,27 +236,28 @@
247
236
  display: inline-flex;
248
237
 
249
238
  .k-menu-item-selected {
250
- background-color: var(--kui-color-selected);
239
+ background-color: var(--kui-color-item-selected);
251
240
  }
252
241
 
253
242
  .k-menu-submenu-active,
254
243
  .k-menu-submenu-selected {
255
244
  .k-menu-submenu-title {
256
- color: var(--kui-color-main);
245
+ color: var(--kui-color-primary);
257
246
  }
258
247
  }
259
248
 
260
249
  .k-menu-item,
261
250
  .k-menu-submenu-title {
262
- padding: 13px 12px;
251
+ padding: 13px 12px 13px 10px;
263
252
  border-radius: var(--kui-border-radius);
253
+ &:not(.k-menu-item-selected) {
254
+ &:hover {
255
+ background-color: var(--kui-color-item-hover);
256
+ }
264
257
 
265
- &:hover {
266
- background-color: var(--kui-color-hover);
267
- }
268
-
269
- &:active {
270
- background-color: var(--kui-color-active);
258
+ &:active {
259
+ background-color: var(--kui-color-item-active);
260
+ }
271
261
  }
272
262
  }
273
263
 
@@ -306,7 +296,7 @@
306
296
  line-height: 1;
307
297
  flex-direction: row;
308
298
  padding: 0;
309
- gap: 16px;
299
+ gap: 16px 32px;
310
300
  padding: 0 16px;
311
301
  .k-menu-icon-temp {
312
302
  display: none;
@@ -375,13 +365,13 @@
375
365
  > .k-menu-submenu-selected,
376
366
  > .k-menu-item-active,
377
367
  > .k-menu-submenu-active {
378
- border-bottom-color: var(--kui-color-main);
368
+ border-bottom-color: var(--kui-color-primary);
379
369
  background-color: transparent;
380
370
  }
381
371
 
382
372
  .k-menu-submenu {
383
373
  .k-menu-item-selected {
384
- background-color: var(--kui-color-selected);
374
+ background-color: var(--kui-color-item-selected);
385
375
  }
386
376
  }
387
377
  }
@@ -391,8 +381,8 @@
391
381
  }
392
382
 
393
383
  .k-menu-inline-collapsed {
394
- width: 80px;
395
-
384
+ width: 60px;
385
+ overflow: hidden;
396
386
  > .k-menu-item,
397
387
  > .k-menu-submenu > .k-menu-submenu-title {
398
388
  text-overflow: clip;
@@ -441,10 +431,11 @@
441
431
 
442
432
  .k-menu {
443
433
  margin: 0;
444
- box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
445
- border-radius: var(--kui-border-radius-outer);
446
- background-color: var(--kui-color-back-10);
447
- border: 1px solid var(--kui-color-border);
434
+ box-shadow: var(--kui-pop-shadow);
435
+
436
+ border-radius: var(--kui-border-radius);
437
+ background-color: var(--kui-color-bg-pop);
438
+ border: 1px solid var(--kui-color-pop-border);
448
439
 
449
440
  .k-menu-item {
450
441
  padding: 8px 12px;
@@ -462,7 +453,6 @@
462
453
  position: relative;
463
454
 
464
455
  .k-menu-submenu-sub {
465
- // padding-left: 5px;
466
456
  left: calc(100% + 5px);
467
457
  }
468
458
  }
@@ -481,15 +471,13 @@
481
471
 
482
472
  .k-menu-item,
483
473
  .k-menu-submenu-title {
484
- // overflow: visible;
485
- // display: block;
486
474
  padding: 12px calc(50% - 8px);
487
475
  transition: padding 200ms 200ms ease-in-out;
488
476
  }
489
477
 
490
478
  .k-menu-submenu-selected {
491
479
  .k-menu-submenu-title {
492
- background-color: var(--kui-color-selected);
480
+ background-color: var(--kui-color-item-selected);
493
481
  }
494
482
  }
495
483
 
@@ -7,7 +7,6 @@
7
7
  <template>
8
8
  <Space vertical>
9
9
  <Button @click="info" type="primary">Show base info </Button>
10
- <Button @click="useMessage" type="primary">useMessage</Button>
11
10
  </Space>
12
11
  </template>
13
12
  <script setup>
@@ -18,11 +17,5 @@ const info = () => {
18
17
  count.value++;
19
18
  message.info("this is a base message number : " + count.value);
20
19
  };
21
- // useMessage
22
- const api = message.useMessage();
23
- const useMessage = () => {
24
- count.value++;
25
- api.info("this is a base message number : " + count.value);
26
- };
27
20
  </script>
28
21
  ```
@@ -26,10 +26,6 @@ let Message = {
26
26
  // app.config.globalProperties.$message = Message; //for 3
27
27
  app.prototype.$message = Message;
28
28
  },
29
- useMessage() {
30
- // return inject("message"); //for 3
31
- return Message;
32
- },
33
29
  };
34
30
  ["info", "success", "warning", "error"].forEach((type) => {
35
31
  Message[type] = (content, duration, onClose) => {
@@ -11,7 +11,6 @@
11
11
 
12
12
  - `message.show(options)`
13
13
  - `message.destroy()`
14
- - `message.useMessage()`
15
14
 
16
15
  参数 `options` 为对象,具体说明如下:
17
16
 
@@ -1,4 +1,5 @@
1
1
  import Icon from "../icon";
2
+ import { Button } from "../button";
2
3
  import {
3
4
  Close,
4
5
  InformationCircle,
@@ -51,14 +52,26 @@ export default defineComponent({
51
52
  children.push(<span>{content}</span>);
52
53
  if (closable) {
53
54
  children.push(
54
- <Icon class="k-message-close" type={Close} onClick={onClose} />
55
+ <Button
56
+ class="k-message-close"
57
+ size="small"
58
+ type="text"
59
+ icon={Close}
60
+ onClick={onClose}
61
+ />
55
62
  );
56
63
  }
57
64
  } else {
58
65
  children.push(<div class="k-notice-title">{title}</div>);
59
66
  children.push(<div class="k-notice-desc">{content}</div>);
60
67
  children.push(
61
- <Icon class="k-notice-close" type={Close} onClick={onClose} />
68
+ <Button
69
+ class="k-notice-close"
70
+ size="small"
71
+ type="text"
72
+ icon={Close}
73
+ onClick={onClose}
74
+ />
62
75
  );
63
76
  }
64
77
  return (
@@ -1,9 +1,9 @@
1
- @import '../../styles/var.less';
1
+ @import "../../styles/less-css-var.less";
2
2
 
3
3
  .k-message {
4
4
  font-size: 14px;
5
5
  line-height: 1.5;
6
- color: var(--kui-color-font);
6
+ color: var(--kui-color-text);
7
7
  box-sizing: border-box;
8
8
  margin: 0;
9
9
  padding: 0;
@@ -18,7 +18,7 @@
18
18
  box-sizing: content-box;
19
19
  padding: 0 12px 14px 12px;
20
20
  text-align: center;
21
- transition: all .3s;
21
+ transition: all 0.3s;
22
22
  // margin-top: -8px;
23
23
  }
24
24
 
@@ -26,9 +26,11 @@
26
26
  box-sizing: content-box;
27
27
  line-height: 1;
28
28
  padding: 10px 12px;
29
- border-radius: var(--kui-border-radius);
30
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
31
- background: var(--kui-color-back-10);
29
+ border-radius: var(--kui-border-radius-card);
30
+ box-shadow: var(--kui-pop-shadow);
31
+
32
+ background: var(--kui-color-bg-pop);
33
+ border: 1px solid var(--kui-color-pop-border);
32
34
  display: inline-flex;
33
35
  align-items: center;
34
36
  pointer-events: all;
@@ -42,16 +44,10 @@
42
44
  }
43
45
 
44
46
  .k-message-close {
45
- overflow: hidden;
46
47
  cursor: pointer;
47
48
  margin-left: 15px;
48
- font-size: 18px;
49
- vertical-align: sub;
50
- border-radius: var(--kui-border-radius);
51
- padding: 2px;
52
-
53
- &:hover {
54
- background-color: var(--kui-color-gray-80);
49
+ .k-icon {
50
+ font-size: 16px;
55
51
  }
56
52
  }
57
53
  }
@@ -65,7 +61,7 @@
65
61
  }
66
62
 
67
63
  .k-message-info .k-message-icon {
68
- color: var(--kui-color-main);
64
+ color: var(--kui-color-primary);
69
65
  }
70
66
 
71
67
  .k-message-warning .k-message-icon {
@@ -84,7 +80,6 @@
84
80
  }
85
81
  }
86
82
 
87
-
88
83
  .k-message-slide-enter-active,
89
84
  .k-message-slide-leave-active {
90
85
  animation: k-message-slide 0.3s ease;
@@ -93,4 +88,4 @@
93
88
 
94
89
  .k-message-slide-leave-active {
95
90
  animation-direction: reverse; /* ✅ 比写 reverse 简洁可控 */
96
- }
91
+ }
@@ -18,13 +18,13 @@ import { modal, message } from "kui-vue";
18
18
 
19
19
  const confirm = () => {
20
20
  modal.confirm({
21
- title: "您确认要这么做吗",
22
- content: "此操作不可逆转,谨慎!!!",
21
+ title: "Please confirm",
22
+ content: "This operation is irreversible, caution!!!!",
23
23
  onOk: () => {
24
- message.success("你点了确认");
24
+ message.success("OK");
25
25
  },
26
26
  onCancel: () => {
27
- message.info("你点了取消");
27
+ message.info("cancel");
28
28
  },
29
29
  });
30
30
  };
@@ -38,8 +38,8 @@ const custom = () => {
38
38
  };
39
39
  const Async = () => {
40
40
  modal.confirm({
41
- title: "您确认要这么做吗",
42
- content: "此操作不可逆转,谨慎!!!",
41
+ title: "Please confirm",
42
+ content: "This operation is irreversible, caution!!!!",
43
43
  onOk: () => {
44
44
  return new Promise((resolve, reject) => {
45
45
  setTimeout(resolve, 2000);
@@ -12,26 +12,11 @@
12
12
  <Button @click="info" type="primary">Info</Button>
13
13
  <Button @click="show" :icon="Moon">Custom icon</Button>
14
14
  </Space>
15
- <p>
16
- <Button @click="useModalShow">useModal</Button>
17
- </p>
18
15
  </template>
19
16
  <script setup>
20
17
  import { Moon } from "kui-icons";
21
18
  import { modal, message } from "kui-vue";
22
19
 
23
- // 使用 useModal
24
- const useModal = modal.useModal();
25
- const useModalShow = () => {
26
- useModal.success({
27
- title: "操作成功",
28
- content: "恭喜你操作成功!",
29
- onOk: () => {
30
- message.info("success");
31
- },
32
- });
33
- };
34
-
35
20
  //
36
21
  const success = () => {
37
22
  modal.success({
@@ -6,6 +6,5 @@
6
6
 
7
7
  - 需要用户处理事务,又不希望跳转页面以致打断工作流程时,可以使用 Modal 在当前页面正中打开一个浮层,承载相应的操作。
8
8
  - 另外当需要一个简洁的确认框询问用户时,可以使用 Modal.confirm() 等语法糖方法。
9
- - 多`语言环境`需要使用 `modal.useModal()` 来调用。
10
9
 
11
10
  ## 代码演示
@@ -2,16 +2,11 @@ import Modal from "./modal.jsx";
2
2
  import Toast from "./toast";
3
3
  // import { /*createVNode, render,*/ inject } from "vue"; // for 3
4
4
  import { createVNode, render } from "../utils/vue"; //for 2
5
- import { getCurrentInstance } from "vue";
6
-
5
+ import { recordMousePoint } from "../config/context";
7
6
  let modalList = [];
8
7
 
9
- if (typeof window !== "undefined") {
10
- document.addEventListener("mousedown", (e) => {
11
- window.__kui__point = { x: e.clientX, y: e.clientY };
12
- });
13
- }
14
- let createInstance = (props = {}, context = null) => {
8
+ recordMousePoint();
9
+ let showModal = (props = {}, context = null) => {
15
10
  const container = document.createElement("div");
16
11
  document.body.appendChild(container);
17
12
  const vm = createVNode(
@@ -41,22 +36,17 @@ let createInstance = (props = {}, context = null) => {
41
36
  document.body.contains(container) && document.body.removeChild(container);
42
37
  }, 300);
43
38
  };
44
- return instance;
45
- };
46
-
47
- let getModal = (props = {}, context = null) => {
48
- let instance = createInstance(props, context);
49
39
  instance.show();
50
40
  modalList.push(instance);
51
41
  return instance;
52
42
  };
53
43
 
54
44
  ["info", "success", "warning", "error", "confirm"].forEach((type) => {
55
- Modal[type] = (props = {}) => getModal(Object.assign({ type }, props));
45
+ Modal[type] = (props = {}) => showModal(Object.assign({ type }, props));
56
46
  });
57
47
 
58
48
  Modal.show = (props = {}) => {
59
- return getModal(props);
49
+ return showModal(props);
60
50
  };
61
51
 
62
52
  Modal.destroyAll = () => {
@@ -69,23 +59,4 @@ Modal.install = (app) => {
69
59
  // app.config.globalProperties.$modal = Modal;
70
60
  app.prototype.$modal = Modal;
71
61
  };
72
-
73
- Modal.useModal = () => {
74
- // return inject("modal"); //for 3
75
- const instance = getCurrentInstance();
76
- const proxy = instance ? instance.proxy : null;
77
- // console.log(proxy);
78
- const modalWrapper = {};
79
-
80
- ["info", "success", "warning", "error", "confirm", "show"].forEach((type) => {
81
- modalWrapper[type] = (props = {}) => {
82
- const config = type === "show" ? props : Object.assign({ type }, props);
83
- return getModal(config, proxy);
84
- };
85
- });
86
-
87
- modalWrapper.destroyAll = Modal.destroyAll;
88
-
89
- return modalWrapper;
90
- };
91
62
  export default Modal;
@@ -11,7 +11,7 @@
11
11
  | centered | 窗口是否可以居中 , confirm 模式不可用 | Boolean | false |
12
12
  | maximized | 弹框是否可以最大化显示 , confirm 模式不可用 | Boolean | false |
13
13
  | mask-closable | 是否点击遮罩关闭弹窗, 为否时 Esc 键将失效 | Boolean | true |
14
- | ok | 点击确定的回调,`注意:不会关闭 Modal ` | Function | - |
14
+ | ok | 点击确定的回调,`注意:不会关闭 Modal` | Function | - |
15
15
  | cancel | 点击取消的回调 | Function | - |
16
16
  | close | 窗口关闭的回调 | Function | - |
17
17
  | escKey | 是否支持按 Esc 关闭 | Boolean | true |
@@ -24,7 +24,6 @@
24
24
  - modal.success(options)
25
25
  - modal.warning(options)
26
26
  - modal.error(options)
27
- - modal.show(options)
28
27
  - modal.confirm(options)
29
28
 
30
29
  另外提供了全局配置和全局销毁的方法:
@@ -1,6 +1,7 @@
1
1
  import { Button } from "../button";
2
2
  import transfer from "../directives/transfer";
3
3
  import { Close } from "kui-icons";
4
+ import { getMousePoint } from "../config/context";
4
5
  import {
5
6
  defineComponent,
6
7
  ref,
@@ -120,7 +121,7 @@ const Modal = defineComponent({
120
121
  };
121
122
  const updateOrigin = () => {
122
123
  if (refModal.value) {
123
- let { x, y } = window.__kui__point || { x: 0, y: 0 };
124
+ let { x, y } = getMousePoint();
124
125
  let { left, top } = getOffset(refModal.value);
125
126
  refModal.value.style["transform-origin"] = `${x - left}px ${y - top}px`;
126
127
  }