kui-vue 3.6.7 → 3.6.9

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 (66) hide show
  1. package/components/alert/demo/basic.md +2 -2
  2. package/components/alert/demo/close.md +2 -2
  3. package/components/alert/demo/customIcon.md +2 -2
  4. package/components/alert/styles/index.less +0 -1
  5. package/components/avatar/styles/index.less +1 -1
  6. package/components/datePicker/datepicker.jsx +0 -5
  7. package/components/form/demo/valid.md +8 -7
  8. package/components/image/demo/group.md +1 -1
  9. package/components/image/group.jsx +10 -4
  10. package/components/image/image.jsx +47 -99
  11. package/components/image/preview.jsx +130 -116
  12. package/components/image/styles/index.less +219 -224
  13. package/components/image/utils.js +31 -0
  14. package/components/input/demo/event.md +0 -1
  15. package/components/input/inputBox.jsx +1 -1
  16. package/components/inputNumber/styles/index.less +2 -2
  17. package/components/layout/demo/layout5.md +0 -1
  18. package/components/loading/loading.jsx +5 -21
  19. package/components/modal/styles/index.less +1 -0
  20. package/components/page/demo/basic.md +3 -3
  21. package/components/page/demo/size.md +4 -4
  22. package/components/page/demo/sizer-elevator.md +6 -6
  23. package/components/page/index.md +1 -1
  24. package/components/page/page.jsx +8 -8
  25. package/components/progress/progress.jsx +23 -5
  26. package/components/progress/styles/index.less +7 -6
  27. package/components/select/demo/theme.md +2 -1
  28. package/components/select/select.jsx +1 -1
  29. package/components/select/styles/index.less +1 -1
  30. package/components/slider/demo/formatter.md +8 -9
  31. package/components/slider/slider.jsx +3 -4
  32. package/components/slider/thumb.jsx +4 -3
  33. package/components/space/demo/compact.md +9 -9
  34. package/components/statCard/countup.jsx +8 -0
  35. package/components/statCard/demo/card.md +2 -2
  36. package/components/statCard/index.md +12 -7
  37. package/components/statCard/statCard.jsx +12 -0
  38. package/components/styles/less-css-var.less +4 -0
  39. package/components/styles/less-var.less +1 -1
  40. package/components/table/table.jsx +1 -1
  41. package/components/tabs/styles/index.less +2 -2
  42. package/dist/k-ui.cjs.js +2 -2
  43. package/dist/k-ui.css +2 -2
  44. package/dist/k-ui.d.ts +183 -179
  45. package/dist/k-ui.esm.js +2 -2
  46. package/dist/k-ui.umd.js +2 -2
  47. package/dist/locale/de.js +1 -1
  48. package/dist/locale/el.js +1 -1
  49. package/dist/locale/en.js +1 -1
  50. package/dist/locale/fr.js +1 -1
  51. package/dist/locale/it.js +1 -1
  52. package/dist/locale/ja.js +1 -1
  53. package/dist/locale/ko.js +1 -1
  54. package/dist/locale/ru.js +1 -1
  55. package/dist/locale/th.js +1 -1
  56. package/dist/locale/ua.js +2 -2
  57. package/dist/locale/uk.js +1 -1
  58. package/dist/locale/vi.js +1 -1
  59. package/dist/locale/zh-CN.js +1 -1
  60. package/dist/locale/zh-TW.js +1 -1
  61. package/package.json +1 -1
  62. package/types/index.d.ts +16 -16
  63. package/types/page/Page.d.ts +1 -1
  64. package/types/slider/Slider.d.ts +1 -0
  65. package/types/statCard/StatCard.d.ts +3 -0
  66. package/types/table/Table.d.ts +1 -1
@@ -6,12 +6,12 @@
6
6
  ```vue
7
7
  <template>
8
8
  <Space vertical>
9
- <Page v-model:current="current" :total="100" />
9
+ <Page v-model:page="page" :total="100" />
10
10
  <code>showSizer</code>
11
- <Page v-model:current="current" :total="100" showSizer :page-size="20" />
11
+ <Page v-model:page="page" :total="100" showSizer :page-size="20" />
12
12
  <code>showElevator</code>
13
13
  <Page
14
- v-model:current="current"
14
+ v-model:page="page"
15
15
  :total="100"
16
16
  showSizer
17
17
  showElevator
@@ -20,7 +20,7 @@
20
20
  />
21
21
  <code>theme="light"</code>
22
22
  <Page
23
- v-model:current="current"
23
+ v-model:page="page"
24
24
  :total="100"
25
25
  showSizer
26
26
  showElevator
@@ -30,7 +30,7 @@
30
30
  />
31
31
  <code>disabled</code>
32
32
  <Page
33
- v-model:current="current"
33
+ v-model:page="page"
34
34
  :total="100"
35
35
  disabled
36
36
  showSizer
@@ -42,7 +42,7 @@
42
42
  </template>
43
43
  <script setup>
44
44
  import { ref } from "vue";
45
- const current = ref(3);
45
+ const page = ref(3);
46
46
  const sizeData = [30, 50, 80, 100];
47
47
  </script>
48
48
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  | 属性 | 说明 | 类型 | 默认值 |
4
4
  | ------------- | ---------------------------------------- | ----------------------- | ---------------- |
5
- | current | 当前页码 | Number | 1 |
5
+ | page | 当前页码 | Number | 1 |
6
6
  | total | 数据总数 | Number | 0 |
7
7
  | page-size | 每页条数 | Number | 10 |
8
8
  | show-sizer | 是否显示页码组 | Boolean | false |
@@ -28,13 +28,13 @@ const Page = defineComponent({
28
28
  },
29
29
  total: { default: 0, type: Number },
30
30
  pageSize: { default: 10, type: Number },
31
- current: { default: 1, type: Number },
31
+ page: { default: 1, type: Number },
32
32
  },
33
33
  setup(ps, { emit }) {
34
34
  const nextPageGroup = ref(false);
35
35
  const prevPageGroup = ref(false);
36
36
  const pageCount = ref(Math.ceil(ps.total / ps.pageSize) || 1);
37
- const defaultPage = ref(ps.current);
37
+ const defaultPage = ref(ps.page);
38
38
  const defaultPageSize = ref(ps.pageSize);
39
39
  const injectedLocale = inject("locale", zhCN);
40
40
 
@@ -58,7 +58,7 @@ const Page = defineComponent({
58
58
  );
59
59
 
60
60
  watch(
61
- () => ps.current,
61
+ () => ps.page,
62
62
  (v) => {
63
63
  defaultPage.value = v;
64
64
  resetPage();
@@ -164,7 +164,7 @@ const Page = defineComponent({
164
164
  if (ps.disabled) return;
165
165
  if (defaultPage.value > 1) {
166
166
  defaultPage.value--;
167
- emit("update:current", defaultPage.value);
167
+ emit("update:page", defaultPage.value);
168
168
  emit("change", defaultPage.value, defaultPageSize.value);
169
169
  }
170
170
  };
@@ -172,7 +172,7 @@ const Page = defineComponent({
172
172
  if (ps.disabled) return;
173
173
  if (defaultPage.value < pageCount.value) {
174
174
  defaultPage.value++;
175
- emit("update:current", defaultPage.value);
175
+ emit("update:page", defaultPage.value);
176
176
  emit("change", defaultPage.value, defaultPageSize.value);
177
177
  }
178
178
  };
@@ -188,7 +188,7 @@ const Page = defineComponent({
188
188
  page = pageCount.value;
189
189
  }
190
190
  defaultPage.value = page;
191
- emit("update:current", page);
191
+ emit("update:page", page);
192
192
  emit("change", defaultPage.value, defaultPageSize.value);
193
193
  };
194
194
  const changeSize = (value) => {
@@ -196,7 +196,7 @@ const Page = defineComponent({
196
196
  pageCount.value = Math.ceil(ps.total / defaultPageSize.value) || 1;
197
197
  if (defaultPage.value > pageCount.value) {
198
198
  defaultPage.value = pageCount.value;
199
- emit("update:current", defaultPage.value);
199
+ emit("update:page", defaultPage.value);
200
200
  }
201
201
  emit("change", defaultPage.value, defaultPageSize.value);
202
202
  };
@@ -280,7 +280,7 @@ const Page = defineComponent({
280
280
 
281
281
  if ((page >= 1 || page <= pCount) && defaultPage.value != page) {
282
282
  defaultPage.value = page;
283
- emit("update:current", page);
283
+ emit("update:page", page);
284
284
  emit("change", page, defaultPageSize.value);
285
285
  }
286
286
  nextTick(() => {
@@ -1,7 +1,7 @@
1
1
  import Icon from "../icon";
2
2
  import { CheckmarkCircle, CloseCircle, Close, Checkmark } from "kui-icons";
3
3
  import { defineComponent, watch, ref } from "vue";
4
- import { withInstall } from '../utils/vue';
4
+ import { withInstall } from "../utils/vue";
5
5
  const Progress = defineComponent({
6
6
  name: "Progress",
7
7
  props: {
@@ -42,7 +42,7 @@ const Progress = defineComponent({
42
42
  () => ps.percent,
43
43
  (nv, no) => {
44
44
  currentPercent.value = nv;
45
- }
45
+ },
46
46
  );
47
47
  const currentPercent = ref(ps.percent);
48
48
  const renderTip = () => {
@@ -108,8 +108,20 @@ const Progress = defineComponent({
108
108
 
109
109
  return (
110
110
  <svg viewBox={`0 0 ${50 * 2} ${50 * 2}`}>
111
- <path d={d} fill="none" stroke-width={strokeWidth} style={ds} class="k-progress-inner" />
112
- <path d={d} fill="none" stroke-width={strokeWidth} style={style} class="k-progress-bg" />
111
+ <path
112
+ d={d}
113
+ fill="none"
114
+ stroke-width={strokeWidth}
115
+ style={ds}
116
+ class="k-progress-inner"
117
+ />
118
+ <path
119
+ d={d}
120
+ fill="none"
121
+ stroke-width={strokeWidth}
122
+ style={style}
123
+ class="k-progress-bg"
124
+ />
113
125
  </svg>
114
126
  );
115
127
  };
@@ -139,7 +151,13 @@ const Progress = defineComponent({
139
151
  if (currentPercent.value == 100 && status != "exception") {
140
152
  status = "success";
141
153
  }
142
- let classes = ["k-progress", `k-progress-${type}`, `k-progress-${status}`, { "k-progress-sm": type == "line" && size == "small" }, { "k-progress-hide-info": !showInfo }];
154
+ let classes = [
155
+ "k-progress",
156
+ `k-progress-${type}`,
157
+ `k-progress-${status}`,
158
+ { "k-progress-sm": type == "line" && size == "small" },
159
+ { "k-progress-hide-info": !showInfo },
160
+ ];
143
161
  let tipNode = renderTip();
144
162
  let bar = renderBar(),
145
163
  style = {};
@@ -1,14 +1,16 @@
1
1
  @import "../../styles/less-css-var.less";
2
2
  .k-progress {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ gap: 8px;
6
+ width: 100%;
3
7
  .k-progress-inner {
4
8
  display: inline-block;
5
9
  border-radius: 10px;
6
10
  background-color: var(--kui-color-bg-component);
7
11
  stroke: var(--kui-color-bg-component);
8
12
  overflow: hidden;
9
- vertical-align: middle;
10
- width: calc(100% - 38px);
11
- margin-right: 8px;
13
+ flex: 1;
12
14
  }
13
15
  .k-progress-bg {
14
16
  height: 8px;
@@ -19,13 +21,12 @@
19
21
  transition: all 0.3s ease-in-out;
20
22
  }
21
23
  .k-progress-text {
22
- display: inline-block;
23
- width: 30px;
24
+ display: inline-flex;
25
+ align-items: center;
24
26
  font-size: 14px;
25
27
  color: var(--kui-color-text);
26
28
  line-height: 1;
27
29
  white-space: nowrap;
28
- vertical-align: middle;
29
30
  .k-icon {
30
31
  font-size: 20px;
31
32
  }
@@ -40,9 +40,10 @@
40
40
  </Space>
41
41
  </template>
42
42
  <script setup>
43
+ import { ref } from "vue";
43
44
  import { Search, CaretDown } from "kui-icons";
44
45
 
45
- const value = ["1", "3"];
46
+ const value = ref(["1", "3"]);
46
47
  const options = [
47
48
  { label: "Apple", value: "1" },
48
49
  { label: "Orange", value: "2" },
@@ -339,7 +339,7 @@ const Select = defineComponent({
339
339
  const emitValue = () => {
340
340
  const result = ps.multiple
341
341
  ? currentValue.value
342
- : currentValue.value[0] || null;
342
+ : currentValue.value[0];
343
343
  emit("input", result);
344
344
  emit("change", result);
345
345
  };
@@ -251,7 +251,7 @@
251
251
  -webkit-user-select: none;
252
252
  user-select: none;
253
253
  border-radius: var(--kui-border-radius);
254
- width: inherit;
254
+ width: auto;
255
255
  max-height: 200px;
256
256
  overflow: auto;
257
257
  background-color: var(--kui-color-bg-pop);
@@ -1,19 +1,18 @@
1
1
  <cn>
2
2
  ### 自定义提示
3
- 使用 tipFormatter 可以设置 Tooltip 的显示的格式。设置 tipFormatter={null},则隐藏 Tooltip。
3
+ 使用 tipFormatter 可以设置 Tooltip 的显示的格式。
4
4
  当 tooltipVisible 为 true 时,将始终显示 ToolTip;反之则始终不显示,即使在拖动、移入时也是如此。
5
5
  </cn>
6
6
 
7
7
  ```vue
8
8
  <template>
9
- <div style="max-width:520px;">
9
+ <Space style="max-width:520px;" vertical block>
10
+ <code>show %</code>
10
11
  <Slider :tipFormatter="(v) => `${v}%`" :value="20" />
11
- <br />
12
- <br />
13
- <Slider :tipFormatter="null" :value="10" />
14
- <br />
15
- <br />
16
- <Slider :value="10" :tooltipVisible="true" />
17
- </div>
12
+ <code>hide tooltip</code>
13
+ <Slider :tooltipVisible="false" :value="20" />
14
+ <code>show tooltip for ever</code>
15
+ <Slider :value="70" :tooltipVisible="true" />
16
+ </Space>
18
17
  </template>
19
18
  ```
@@ -19,7 +19,7 @@ const Slider = defineComponent({
19
19
  size: [String, Number],
20
20
  included: { type: Boolean, default: true },
21
21
  tipFormatter: Function,
22
- tooltipVisible: Boolean,
22
+ tooltipVisible: { type: Boolean, default: null },
23
23
  },
24
24
  emits: ["input", "change"],
25
25
 
@@ -60,7 +60,7 @@ const Slider = defineComponent({
60
60
  internalValue.value = formatValue(nv);
61
61
  }
62
62
  },
63
- { immediate: true }
63
+ { immediate: true },
64
64
  );
65
65
 
66
66
  const getPercent = (val) => {
@@ -169,7 +169,6 @@ const Slider = defineComponent({
169
169
  let [e1, e2] = touch
170
170
  ? ["touchmove", "touchend"]
171
171
  : ["mousemove", "mouseup"];
172
- console.log(e1,e2,222);
173
172
  const onMove = (e) => handleThumbMove(e);
174
173
  const onUp = () => {
175
174
  draggingIndex.value = -1;
@@ -210,7 +209,7 @@ const Slider = defineComponent({
210
209
  }
211
210
  } else {
212
211
  nextValue = Number(
213
- new Big(targetValue).plus(isPlus ? props.step : -props.step)
212
+ new Big(targetValue).plus(isPlus ? props.step : -props.step),
214
213
  );
215
214
  }
216
215
 
@@ -10,7 +10,7 @@ export default defineComponent({
10
10
  reverse: Boolean,
11
11
  disabled: Boolean,
12
12
  size: [String, Number],
13
- tooltipVisible: Boolean,
13
+ tooltipVisible: { type: Boolean, default: null },
14
14
  tipFormatter: Function,
15
15
  dragging: Boolean, // 接收父组件传入的拖拽状态
16
16
  },
@@ -31,7 +31,7 @@ export default defineComponent({
31
31
  if (diff === 0) return 0;
32
32
  return Math.max(
33
33
  0,
34
- Math.min(100, ((props.value - props.min) / diff) * 100)
34
+ Math.min(100, ((props.value - props.min) / diff) * 100),
35
35
  );
36
36
  });
37
37
 
@@ -63,6 +63,7 @@ export default defineComponent({
63
63
  return (
64
64
  <Tooltip
65
65
  title={displayValue}
66
+ disabled={props.disabled || props.tooltipVisible === false}
66
67
  show={showTooltip && !props.disabled}
67
68
  placement={props.vertical ? "right" : "top"}
68
69
  >
@@ -76,7 +77,7 @@ export default defineComponent({
76
77
  ]}
77
78
  style={thumbStyle.value}
78
79
  ref={elRef}
79
- tabindex={props.disabled ? -1 : 0}
80
+ tabindex={props.disabled ? null : 0}
80
81
  onMousedown={handleDown}
81
82
  onTouchstart={handleDown}
82
83
  onKeydown={(e) => emit("keydownUpdate", e)}
@@ -5,10 +5,10 @@
5
5
 
6
6
  ```vue
7
7
  <template>
8
- <Space vertical size="middle">
9
- <Space compact>
10
- <Input style="width:20%" value="027" />
11
- <Input style="width:30%" value="28398987" />
8
+ <Space vertical size="middle" block style="max-width: 520px">
9
+ <Space compact :style="{ width: '50%' }">
10
+ <Input :style="{ width: '50%' }" value="027" />
11
+ <Input :style="{ width: '50%' }" value="28398987" />
12
12
  </Space>
13
13
  <Space compact size="small" block>
14
14
  <Input :style="{ width: 'calc(100% - 200px)' }" value="https://k-ui.cn" />
@@ -46,12 +46,12 @@
46
46
  </Select>
47
47
  <Input :style="{ width: '50%' }" value="Nanshan District, Shenzheng" />
48
48
  </Space>
49
- <Space compact>
49
+ <Space compact block>
50
50
  <Input :style="{ width: '30%' }" value="0755" />
51
51
  <Input clearable :style="{ width: '50%' }" value="28398987" />
52
52
  <Input :style="{ width: '20%' }" value="+1" />
53
53
  </Space>
54
- <Space compact>
54
+ <Space compact block>
55
55
  <Select value="Option1">
56
56
  <Option value="Option1">Option1</Option>
57
57
  <Option value="Option2">Option2</Option>
@@ -59,16 +59,16 @@
59
59
  <Input :style="{ width: '50%' }" value="input content" />
60
60
  <InputNumber :value="12" />
61
61
  </Space>
62
- <Space compact>
62
+ <Space compact block>
63
63
  <Input :style="{ width: '50%' }" value="input content" />
64
64
  <DatePicker />
65
65
  </Space>
66
- <Space compact>
66
+ <Space compact block>
67
67
  <DatePicker mode="dateRange" />
68
68
  <Input :style="{ width: '30%' }" value="input content" />
69
69
  <Button type="primary">查询</Button>
70
70
  </Space>
71
- <Space compact>
71
+ <Space compact block>
72
72
  <Input :style="{ width: '30%' }" value="input content" />
73
73
  <DatePicker mdoe="dateRange" />
74
74
  </Space>
@@ -37,6 +37,14 @@ const CountUpNumber = defineComponent({
37
37
  }
38
38
  }
39
39
  );
40
+ watch(
41
+ () => props.precision,
42
+ (newVal) => {
43
+ if (countUp) {
44
+ countUp.options.decimalPlaces = newVal;
45
+ }
46
+ }
47
+ );
40
48
 
41
49
  return () => <span class="k-stat-countup-number" ref={el}></span>;
42
50
  },
@@ -35,8 +35,8 @@ const items = [
35
35
  ];
36
36
 
37
37
  const items1 = [
38
- { value: 5872, desc: "支付宝收入", prefix: "$" },
39
- { value: 9873672, desc: "微信收入", prefix: "¥" },
38
+ { value: 5872, desc: "支付宝收入", prefix: "$", precision: 2 },
39
+ { value: 9873672, desc: "微信收入", prefix: "¥", precision: 2 },
40
40
  ];
41
41
  const items2 = [
42
42
  {
@@ -4,17 +4,21 @@
4
4
  | -------------- | ------------ | ----------------- | --------- |
5
5
  | title | 卡片标题 | String | - |
6
6
  | items | 展示的数据 | Array | [] |
7
+ | precision | 数值精度 | Number | 0 |
7
8
  | statNumberType | 数值变化类型 | `rollup, countup` | 'countup' |
9
+ | separator | 分隔符 | String | - |
8
10
 
9
11
  ### items Options
10
12
 
11
- | 属性 | 说明 | 类型 | 默认值 |
12
- | -------- | -------------------- | ------ | ------ |
13
- | value | 数值 | Number | - |
14
- | desc | 数值描述 | String | [] |
15
- | prefix | 数值的前置内容 | String | - |
16
- | suffix | 数值的后置内容 | String | - |
17
- | duration | 数值动态展示时间(秒) | Number | 1.2 |
13
+ | 属性 | 说明 | 类型 | 默认值 |
14
+ | --------- | -------------------- | ------ | ------ |
15
+ | value | 数值 | Number | - |
16
+ | desc | 数值描述 | String | [] |
17
+ | prefix | 数值的前置内容 | String | - |
18
+ | suffix | 数值的后置内容 | String | - |
19
+ | precision | 数值精度 | Number | 0 |
20
+ | separator | 分隔符 | String | - |
21
+ | duration | 数值动态展示时间(秒) | Number | 1.2 |
18
22
 
19
23
  ## StatNumber API
20
24
 
@@ -26,3 +30,4 @@
26
30
  | suffix | 数值的后置内容 | String | - |
27
31
  | precision | 数值精度 | Number | 0 |
28
32
  | type | 数值变化类型 | `rollup, countup` | 'countup' |
33
+ | separator | 分隔符 | String | - |
@@ -6,7 +6,9 @@ const StatCard = defineComponent({
6
6
  name: "StatCard",
7
7
  props: {
8
8
  title: String,
9
+ precision: { type: Number, default: 0 },
9
10
  items: { type: Array, default: () => [] },
11
+ separator: String,
10
12
  statNumberType: String,
11
13
  bordered: { type: Boolean, default: false },
12
14
  },
@@ -29,6 +31,16 @@ const StatCard = defineComponent({
29
31
  }}
30
32
  value={item.value}
31
33
  duration={item.duration}
34
+ precision={
35
+ item.precision !== undefined
36
+ ? item.precision
37
+ : props.precision
38
+ }
39
+ separator={
40
+ item.separator !== undefined
41
+ ? item.separator
42
+ : props.separator
43
+ }
32
44
  type={props.statNumberType}
33
45
  />
34
46
  </div>
@@ -21,6 +21,10 @@
21
21
  .theme-dark-vars();
22
22
  }
23
23
 
24
+ [theme-mode="light"] {
25
+ .theme-light-vars();
26
+ }
27
+
24
28
  .theme-light-vars() {
25
29
  color-scheme: light;
26
30
  /* 文字色体系 */
@@ -222,7 +222,7 @@
222
222
  // 边框颜色
223
223
  @outline-color: @main-8;
224
224
  @border-color: #e9e9e9;
225
- @dark-border-color: #262626;
225
+ @dark-border-color: #333;
226
226
 
227
227
  @pop-border-color: #e7e7e7;
228
228
  @dark-pop-border-color: #313131;
@@ -29,7 +29,7 @@ const Table = defineComponent({
29
29
  return ["small", "large", "default"].indexOf(value) >= 0;
30
30
  },
31
31
  },
32
- bordered: { type: Boolean, default: true },
32
+ bordered: { type: Boolean, default: false },
33
33
  checkable: Boolean,
34
34
  loading: Boolean,
35
35
  emptyText: String,
@@ -172,12 +172,12 @@
172
172
  .k-tabs-tab {
173
173
  margin-right: 2px;
174
174
  border: 1px solid var(--kui-color-border);
175
- border-bottom-color: transparent;
176
175
  padding: 8px 16px;
176
+ background: var(--kui-color-bg-1);
177
177
  }
178
178
 
179
179
  .k-tabs-tab-active {
180
- background: var(--kui-color-back);
180
+ background: var(--kui-color-bg);
181
181
  border-bottom-color: transparent;
182
182
 
183
183
  &::after {