kui-vue 4.0.0 → 4.0.1

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 (78) hide show
  1. package/components/button/styles/index.less +1 -0
  2. package/components/checkbox/demo/info.md +5 -8
  3. package/components/colorPicker/paint.jsx +1 -1
  4. package/components/components.js +4 -1
  5. package/components/form/formitem.jsx +1 -1
  6. package/components/grid/demo/align-white-space.md +30 -0
  7. package/components/grid/demo/architecture.md +152 -0
  8. package/components/grid/demo/auto-fill-min-width.md +27 -0
  9. package/components/grid/demo/basic.md +23 -19
  10. package/components/grid/demo/bento.md +160 -0
  11. package/components/grid/demo/breakpoint-fallback.md +28 -0
  12. package/components/grid/demo/fixed-rows-areas.md +55 -0
  13. package/components/grid/demo/footer-strategy.md +38 -0
  14. package/components/grid/demo/hero-section.md +37 -0
  15. package/components/grid/demo/index.jsx +21 -12
  16. package/components/grid/demo/info.md +23 -9
  17. package/components/grid/demo/suffix-display-none.md +27 -0
  18. package/components/grid/grid.jsx +73 -0
  19. package/components/grid/gridItem.jsx +55 -0
  20. package/components/grid/index.js +3 -3
  21. package/components/grid/index.md +30 -13
  22. package/components/grid/styles/index.less +6 -67
  23. package/components/grid/useBreakpoint.js +46 -0
  24. package/components/icon/demo/search.vue +9 -11
  25. package/components/input/styles/index.less +3 -0
  26. package/components/menu/styles/index.less +6 -2
  27. package/components/rowCol/demo/basic.md +30 -0
  28. package/components/rowCol/demo/index.jsx +24 -0
  29. package/components/rowCol/demo/info.md +14 -0
  30. package/components/rowCol/index.js +4 -0
  31. package/components/rowCol/index.md +16 -0
  32. package/components/rowCol/styles/index.less +70 -0
  33. package/components/statCard/demo/card.md +40 -7
  34. package/components/statCard/index.md +8 -7
  35. package/components/statCard/statCard.jsx +6 -2
  36. package/components/statCard/statNumber.jsx +9 -5
  37. package/components/statCard/styles/index.less +6 -3
  38. package/components/styles/index.less +1 -0
  39. package/components/styles/less-css-var.less +1 -0
  40. package/components/styles/less-var.less +1 -0
  41. package/components/table/demo/table-check.md +1 -1
  42. package/components/tabs/demo/info.md +6 -11
  43. package/components/tree/demo/info.md +3 -8
  44. package/components/tree/tree.jsx +1 -1
  45. package/dist/k-ui.cjs.js +2 -2
  46. package/dist/k-ui.css +2 -2
  47. package/dist/k-ui.d.ts +80 -43
  48. package/dist/k-ui.esm.js +2 -2
  49. package/dist/k-ui.umd.js +2 -2
  50. package/dist/locale/de.js +1 -1
  51. package/dist/locale/el.js +1 -1
  52. package/dist/locale/en.js +1 -1
  53. package/dist/locale/fr.js +1 -1
  54. package/dist/locale/it.js +1 -1
  55. package/dist/locale/ja.js +1 -1
  56. package/dist/locale/ko.js +1 -1
  57. package/dist/locale/ru.js +1 -1
  58. package/dist/locale/th.js +1 -1
  59. package/dist/locale/uk.js +1 -1
  60. package/dist/locale/vi.js +1 -1
  61. package/dist/locale/zh-CN.js +1 -1
  62. package/dist/locale/zh-TW.js +1 -1
  63. package/package.json +1 -1
  64. package/test/i18n@6.x.html +3 -3
  65. package/types/grid/Grid.d.ts +24 -0
  66. package/types/grid/GridItem.d.ts +18 -0
  67. package/types/index.d.ts +12 -8
  68. package/types/statCard/StatCard.d.ts +1 -0
  69. package/components/styles/color.less +0 -209
  70. /package/components/{grid → rowCol}/col.jsx +0 -0
  71. /package/components/{grid → rowCol}/demo/align.md +0 -0
  72. /package/components/{grid → rowCol}/demo/fill.md +0 -0
  73. /package/components/{grid → rowCol}/demo/flex.md +0 -0
  74. /package/components/{grid → rowCol}/demo/gutter.md +0 -0
  75. /package/components/{grid → rowCol}/demo/offset.md +0 -0
  76. /package/components/{grid → rowCol}/row.jsx +0 -0
  77. /package/types/{grid → rowCol}/Col.d.ts +0 -0
  78. /package/types/{grid → rowCol}/Row.d.ts +0 -0
@@ -0,0 +1,70 @@
1
+ @import "../../styles/less-css-var.less";
2
+
3
+ .k-row {
4
+ display: flex;
5
+ box-sizing: border-box;
6
+ flex-flow: row wrap;
7
+ }
8
+
9
+ .k-col {
10
+ position: relative;
11
+ max-width: 100%;
12
+ min-height: 1px;
13
+ }
14
+
15
+ @fix: ~"k-col";
16
+ @counts: 24;
17
+
18
+ .make_col(@index) when(@index>0) {
19
+ .@{fix}-@{index} {
20
+ display: block;
21
+ box-sizing: border-box;
22
+ max-width: percentage((@index / @counts));
23
+ flex: 0 0 percentage((@index / @counts));
24
+ }
25
+
26
+ .@{fix}-offset-@{index} {
27
+ margin-left: percentage((@index / @counts));
28
+ }
29
+
30
+ .make_col((@index - 1));
31
+ }
32
+
33
+ .make_col(@counts);
34
+
35
+ .k-row-flex {
36
+ display: flex;
37
+ flex-flow: row wrap;
38
+ }
39
+
40
+ .k-row-flex-top {
41
+ align-items: flex-start;
42
+ }
43
+
44
+ .k-row-flex-middle {
45
+ align-items: center;
46
+ }
47
+
48
+ .k-row-flex-bottom {
49
+ align-items: flex-end;
50
+ }
51
+
52
+ .k-row-flex-start {
53
+ justify-content: flex-start;
54
+ }
55
+
56
+ .k-row-flex-end {
57
+ justify-content: flex-end;
58
+ }
59
+
60
+ .k-row-flex-center {
61
+ justify-content: center;
62
+ }
63
+
64
+ .k-row-flex-space-around {
65
+ justify-content: space-around;
66
+ }
67
+
68
+ .k-row-flex-space-between {
69
+ justify-content: space-between;
70
+ }
@@ -1,24 +1,52 @@
1
1
  <cn>
2
2
  ### 卡片展示
3
- 用于 Dashboard 场景
3
+ 用于 Dashboard 场景 , 结合 `Grid` 可以很好的适配多种设备.
4
4
  </cn>
5
5
 
6
6
  ```vue
7
7
  <template>
8
8
  <Space vertical block>
9
- <Checkbox v-model="bordered">Show border</Checkbox>
10
- <Space block style="max-width: 900px;">
11
- <StatCard title="今日订单" :items="items" :bordered="bordered" />
12
- <StatCard statNumberType="rollup" title="今日进账" :items="items1" :bordered="bordered" />
13
- <StatCard statNumberType="rollup" title="媒体数据" :items="items2" :bordered="bordered">
14
- </StatCard>
9
+ <Space>
10
+ <Checkbox v-model="showTitle">Show Title</Checkbox>
11
+ <Checkbox v-model="bordered">Show border</Checkbox>
12
+ <Checkbox v-model="reverse">Reverse</Checkbox>
15
13
  </Space>
14
+ <Grid :cols="{ xs: 1, sm: 2, md: 3 }" :xGap="16" :yGap="16">
15
+ <GridItem>
16
+ <StatCard
17
+ :title="showTitle ? '今日订单' : null"
18
+ :reverse="reverse"
19
+ :items="items"
20
+ :bordered="bordered"
21
+ />
22
+ </GridItem>
23
+ <GridItem>
24
+ <StatCard
25
+ statNumberType="rollup"
26
+ :title="showTitle ? '今日进账' : null"
27
+ :items="items1"
28
+ :bordered="bordered"
29
+ :reverse="reverse"
30
+ />
31
+ </GridItem>
32
+ <GridItem :span="{ xs: 1, sm: 2, md: 1 }">
33
+ <StatCard
34
+ :reverse="reverse"
35
+ statNumberType="rollup"
36
+ :title="showTitle ? '媒体数据' : null"
37
+ :items="items2"
38
+ :bordered="bordered"
39
+ />
40
+ </GridItem>
41
+ </Grid>
16
42
  </Space>
17
43
  </template>
18
44
  <script setup>
19
45
  import { ref, h } from "vue";
20
46
  import { Icon } from "kui-vue";
21
47
  import { Star, Heart } from "kui-icons";
48
+ const showTitle = ref(true);
49
+ const reverse = ref(false);
22
50
  const bordered = ref(false);
23
51
  const items = [
24
52
  { value: 5872, desc: "订单数" },
@@ -42,4 +70,9 @@ const items2 = [
42
70
  },
43
71
  ];
44
72
  </script>
73
+ <style scoped>
74
+ .k-stat-card {
75
+ /* min-width: 330px; */
76
+ }
77
+ </style>
45
78
  ```
@@ -1,12 +1,13 @@
1
1
  ## StatCard API
2
2
 
3
- | 属性 | 说明 | 类型 | 默认值 |
4
- | -------------- | ------------ | ----------------- | --------- |
5
- | title | 卡片标题 | String | - |
6
- | items | 展示的数据 | Array | [] |
7
- | precision | 数值精度 | Number | 0 |
8
- | statNumberType | 数值变化类型 | `rollup, countup` | 'countup' |
9
- | separator | 分隔符 | String | - |
3
+ | 属性 | 说明 | 类型 | 默认值 |
4
+ | -------------- | ------------------------- | ----------------- | --------- |
5
+ | title | 卡片标题 | String | - |
6
+ | items | 展示的数据 | Array | [] |
7
+ | precision | 数值精度 | Number | 0 |
8
+ | statNumberType | 数值变化类型 | `rollup, countup` | 'countup' |
9
+ | separator | 分隔符 | String | - |
10
+ | reverse | 数值/数值描述是否反相排列 | Boolean | false |
10
11
 
11
12
  ### items Options
12
13
 
@@ -10,17 +10,21 @@ const StatCard = defineComponent({
10
10
  items: { type: Array, default: () => [] },
11
11
  separator: String,
12
12
  statNumberType: String,
13
+ reverse: Boolean,
13
14
  bordered: { type: Boolean, default: false },
14
15
  },
15
16
  setup(props, { slots }) {
16
17
  return () => {
17
18
  return (
18
19
  <div class={["k-stat-card", { "k-stat-card-bordered": props.bordered }]}>
19
- <div class="k-stat-card-title">{props.title}</div>
20
+ {props.title && <div class="k-stat-card-title">{props.title}</div>}
20
21
  <div class="k-stat-card-items">
21
22
  {(props.items || []).map((item, index) => {
22
23
  return (
23
- <div key={index} class="k-stat-card-item">
24
+ <div
25
+ key={index}
26
+ class={["k-stat-card-item", { "k-stat-card-item-reverse": props.reverse }]}
27
+ >
24
28
  <div class="k-stat-card-item-value">
25
29
  <StatNumber
26
30
  v-slots={{
@@ -1,5 +1,6 @@
1
- import { defineComponent } from "vue";
1
+ import { defineComponent, computed } from "vue";
2
2
  import { withInstall } from "../utils/vue.js";
3
+ import { getChildren } from "../utils/vnode.jsx";
3
4
  import CountUp from "./countup.jsx";
4
5
  import RollUp from "./rollup.jsx";
5
6
  const StatNumber = defineComponent({
@@ -24,6 +25,9 @@ const StatNumber = defineComponent({
24
25
  suffix: String,
25
26
  },
26
27
  setup(props, { slots }) {
28
+ const prefixNode = props.prefix || getChildren(slots.prefix?.());
29
+ const suffixNode = props.suffix || getChildren(slots.suffix?.());
30
+ console.log(prefixNode);
27
31
  return () => {
28
32
  const items = {
29
33
  modelValue: props.modelValue,
@@ -31,13 +35,13 @@ const StatNumber = defineComponent({
31
35
  duration: props.duration,
32
36
  precision: props.precision,
33
37
  };
34
- const prefixNode = props.prefix || slots.prefix?.();
35
- const suffixNode = props.suffix || slots.suffix?.();
38
+
39
+ console.log(prefixNode);
36
40
  return (
37
41
  <div class="k-stat-number">
38
- {prefixNode && <span class="k-stat-number-prefix">{prefixNode}</span>}
42
+ {prefixNode?.length > 0 && <span class="k-stat-number-prefix">{prefixNode}</span>}
39
43
  {props.type === "rollup" ? <RollUp {...items} /> : <CountUp {...items} />}
40
- {suffixNode && <span class="k-stat-number-suffix">{suffixNode}</span>}
44
+ {suffixNode?.length > 0 && <span class="k-stat-number-suffix">{suffixNode}</span>}
41
45
  </div>
42
46
  );
43
47
  };
@@ -9,14 +9,14 @@
9
9
  border: 1px solid transparent;
10
10
  }
11
11
  .k-stat-card-title {
12
- margin-bottom: 16px;
12
+ margin-bottom: 20px;
13
13
  font-size: 16px;
14
14
  font-weight: 600;
15
15
  }
16
16
  .k-stat-card-items {
17
17
  display: flex;
18
- flex-wrap: wrap;
19
- gap: 8px;
18
+ // flex-wrap: wrap;
19
+ gap: 12px;
20
20
  }
21
21
  .k-stat-card-item {
22
22
  display: flex;
@@ -24,6 +24,9 @@
24
24
  gap: 8px;
25
25
  flex: 1;
26
26
  }
27
+ .k-stat-card-item-reverse {
28
+ flex-direction: column-reverse;
29
+ }
27
30
  .k-stat-card-item-value {
28
31
  font-size: 20px;
29
32
  font-weight: 600;
@@ -19,6 +19,7 @@
19
19
  @import "../empty/styles/index.less";
20
20
  @import "../form/styles/index.less";
21
21
  @import "../flex/styles/index.less";
22
+ @import "../rowCol/styles/index.less";
22
23
  @import "../grid/styles/index.less";
23
24
  @import "../icon/styles/index.less";
24
25
  @import "../input/styles/index.less";
@@ -2,6 +2,7 @@
2
2
  :root {
3
3
  /* 基础尺寸 */
4
4
  --kui-border-radius: @radius;
5
+ --kui-border-radius-lg: @radius-lg;
5
6
  --kui-border-radius-card: @cardRadius;
6
7
 
7
8
  --kui-padding-block-sm: 2px;
@@ -1,5 +1,6 @@
1
1
  // --- 基础半径 ---
2
2
  @radius: 6px;
3
+ @radius-lg: 8px;
3
4
  @cardRadius: 10px;
4
5
  @component-shadow: 0 0 2px @main-9;
5
6
  @pop-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
@@ -1,7 +1,7 @@
1
1
  <cn>
2
2
  ### 勾选
3
3
  `checkable=true`,即可自动开启多选功能。
4
- 注意: 默认勾选的依赖为 `key` , 可以通过 `rowKey` 属性进行自定义。 如: `rowKey="ID"`
4
+ > 注意: 默认勾选的依赖为 `key` , 可以通过 `rowKey` 属性进行自定义。 如: `rowKey="ID"`
5
5
  </cn>
6
6
  <en>
7
7
  ### Checkable
@@ -1,17 +1,12 @@
1
1
  # Tabs 标签页
2
2
 
3
- <en>
4
- ### Tabs
5
- Tab switching component.
3
+ 选项卡切换组件。
6
4
 
7
- ### When to use
5
+ ## 何时使用
8
6
 
9
- Provide areas to organize and display large blocks of content in a clean interface.
7
+ 提供平级的区域将大块内容进行收纳和展现,保持界面整洁。
10
8
 
11
- - Card-style tabs with closable style, commonly used at the top of a container.
12
- - Standard tab bar with plain lines for primary container switching; most commonly used Tabs.
9
+ - 卡片式的页签,提供可关闭的样式,常用于容器顶部。
10
+ - 标准线条式页签,用于容器内部的主功能切换,这是最常用的 Tabs。
13
11
 
14
- ### Demos
15
-
16
- </en>
17
- ## Code Demos
12
+ ## 代码演示
@@ -1,12 +1,7 @@
1
1
  # Tree 树形控件
2
2
 
3
- <en>
4
- ### Tree
3
+ ## 何时使用
5
4
 
6
- ### When to use
5
+ 文件夹、组织架构、生物分类、国家地区等等,世间万物的大多数结构都是树形结构。使用`树控件` 可以完整展现其中的层级关系并具有展开收起选择等交互功能。
7
6
 
8
- A tree control is suitable for hierarchical data such as folders, organizational structures, taxonomy, or geographic regions. It supports expansion, collapse, and selection interactions.
9
-
10
- ### Demos
11
-
12
- </en>
7
+ ## 代码演示
@@ -52,7 +52,7 @@ const Tree = defineComponent({
52
52
  targetNode.loading = false;
53
53
  targetNode.expanded = true;
54
54
 
55
- // 注意:这里通常不需要手动把数据 push 进 children。
55
+ // 这里通常不需要手动把数据 push 进 children。
56
56
  // 因为外部数据变更会触发 watch(() => ps.data),
57
57
  // 从而触发 buildTree 重新渲染整个树。
58
58
  // 只需要确保 expandedKeys 里有这个 key 即可。