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.
- package/components/button/styles/index.less +1 -0
- package/components/checkbox/demo/info.md +5 -8
- package/components/colorPicker/paint.jsx +1 -1
- package/components/components.js +4 -1
- package/components/form/formitem.jsx +1 -1
- package/components/grid/demo/align-white-space.md +30 -0
- package/components/grid/demo/architecture.md +152 -0
- package/components/grid/demo/auto-fill-min-width.md +27 -0
- package/components/grid/demo/basic.md +23 -19
- package/components/grid/demo/bento.md +160 -0
- package/components/grid/demo/breakpoint-fallback.md +28 -0
- package/components/grid/demo/fixed-rows-areas.md +55 -0
- package/components/grid/demo/footer-strategy.md +38 -0
- package/components/grid/demo/hero-section.md +37 -0
- package/components/grid/demo/index.jsx +21 -12
- package/components/grid/demo/info.md +23 -9
- package/components/grid/demo/suffix-display-none.md +27 -0
- package/components/grid/grid.jsx +73 -0
- package/components/grid/gridItem.jsx +55 -0
- package/components/grid/index.js +3 -3
- package/components/grid/index.md +30 -13
- package/components/grid/styles/index.less +6 -67
- package/components/grid/useBreakpoint.js +46 -0
- package/components/icon/demo/search.vue +9 -11
- package/components/input/styles/index.less +3 -0
- package/components/menu/styles/index.less +6 -2
- package/components/rowCol/demo/basic.md +30 -0
- package/components/rowCol/demo/index.jsx +24 -0
- package/components/rowCol/demo/info.md +14 -0
- package/components/rowCol/index.js +4 -0
- package/components/rowCol/index.md +16 -0
- package/components/rowCol/styles/index.less +70 -0
- package/components/statCard/demo/card.md +40 -7
- package/components/statCard/index.md +8 -7
- package/components/statCard/statCard.jsx +6 -2
- package/components/statCard/statNumber.jsx +9 -5
- package/components/statCard/styles/index.less +6 -3
- package/components/styles/index.less +1 -0
- package/components/styles/less-css-var.less +1 -0
- package/components/styles/less-var.less +1 -0
- package/components/table/demo/table-check.md +1 -1
- package/components/tabs/demo/info.md +6 -11
- package/components/tree/demo/info.md +3 -8
- package/components/tree/tree.jsx +1 -1
- package/dist/k-ui.cjs.js +2 -2
- package/dist/k-ui.css +2 -2
- package/dist/k-ui.d.ts +80 -43
- package/dist/k-ui.esm.js +2 -2
- package/dist/k-ui.umd.js +2 -2
- package/dist/locale/de.js +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/zh-CN.js +1 -1
- package/dist/locale/zh-TW.js +1 -1
- package/package.json +1 -1
- package/test/i18n@6.x.html +3 -3
- package/types/grid/Grid.d.ts +24 -0
- package/types/grid/GridItem.d.ts +18 -0
- package/types/index.d.ts +12 -8
- package/types/statCard/StatCard.d.ts +1 -0
- package/components/styles/color.less +0 -209
- /package/components/{grid → rowCol}/col.jsx +0 -0
- /package/components/{grid → rowCol}/demo/align.md +0 -0
- /package/components/{grid → rowCol}/demo/fill.md +0 -0
- /package/components/{grid → rowCol}/demo/flex.md +0 -0
- /package/components/{grid → rowCol}/demo/gutter.md +0 -0
- /package/components/{grid → rowCol}/demo/offset.md +0 -0
- /package/components/{grid → rowCol}/row.jsx +0 -0
- /package/types/{grid → rowCol}/Col.d.ts +0 -0
- /package/types/{grid → rowCol}/Row.d.ts +0 -0
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import Info from "./info.md";
|
|
2
2
|
import Basic from "./basic.md";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import AutoFillMinWidth from "./auto-fill-min-width.md";
|
|
4
|
+
import BreakpointFallback from "./breakpoint-fallback.md";
|
|
5
|
+
import FixedRowsAreas from "./fixed-rows-areas.md";
|
|
6
|
+
import SuffixDisplayDone from "./suffix-display-none.md";
|
|
7
|
+
import Bento from "./bento.md";
|
|
8
|
+
import AlignWhiteSpace from "./align-white-space.md";
|
|
9
|
+
import HeroSection from "./hero-section.md";
|
|
10
|
+
import FooterStrategy from "./footer-strategy.md";
|
|
11
|
+
import Architecture from './architecture.md'
|
|
12
|
+
|
|
8
13
|
import CN from "../index.md";
|
|
9
14
|
export default {
|
|
10
15
|
render() {
|
|
11
16
|
return (
|
|
12
|
-
|
|
17
|
+
<>
|
|
13
18
|
<Info />
|
|
14
19
|
<Basic />
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
+
<AutoFillMinWidth />
|
|
21
|
+
<BreakpointFallback />
|
|
22
|
+
<FixedRowsAreas />
|
|
23
|
+
<SuffixDisplayDone />
|
|
24
|
+
<Bento />
|
|
25
|
+
<AlignWhiteSpace />
|
|
26
|
+
<HeroSection />
|
|
27
|
+
<FooterStrategy />
|
|
28
|
+
<Architecture />
|
|
20
29
|
<CN />
|
|
21
|
-
|
|
30
|
+
</>
|
|
22
31
|
);
|
|
23
32
|
},
|
|
24
33
|
};
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
# Grid
|
|
1
|
+
# Grid 网格
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
两个概念,行 `row` 和列 `col` ,具体使用方法如下:
|
|
3
|
+
### 1. 维度与控制力:Grid vs. Row/Col
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
- 将一组 `col` 插入在 `row` 中
|
|
8
|
-
- 在每个 `col` 中,键入自己的内容
|
|
9
|
-
- 通过设置 `col` 的 `span` 参数,指定跨越的范围,其范围是1到24
|
|
10
|
-
- 每个 `row` 中的 `col` 总和应该为24
|
|
5
|
+
这是最常被混淆的一组概念。
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
- Row/Col (传统一维栅格):通常基于 flex 或 float 实现。它将空间划分为 12 或 24 份。
|
|
8
|
+
- 局限性:它本质上是一维的。虽然可以换行,但你很难控制子项在垂直方向上的精确对齐(比如让某个 Col 跨越两行)。它需要负 margin 和 padding 来处理 gutter(间距)。
|
|
9
|
+
|
|
10
|
+
- Grid (二维网格): Grid 是二维的。可以同时精确控制行(Rows)和列(Cols)。
|
|
11
|
+
- 优势:无需负 margin,通过 gap 直接控制间距。支持 rowSpan 和 dense 模式,能轻松实现“便当盒”(Bento)布局。
|
|
12
|
+
|
|
13
|
+
### 2. 逻辑导向:Grid vs. Flex
|
|
14
|
+
|
|
15
|
+
- Flex (内容导向):当你有一组宽度不固定、希望它们根据自身内容大小自动收缩或伸展并在一行内对齐时,使用 Flex。它强调的是灵活性。
|
|
16
|
+
|
|
17
|
+
- Grid (布局导向): 当你先有一个固定的网格框架(比如仪表盘的 8 个格子),然后想把内容“填”进去时,使用 Grid。它强调的是结构感。
|
|
18
|
+
|
|
19
|
+
### 3. 全局架构 vs. 局部排布:Layout 系列
|
|
20
|
+
|
|
21
|
+
Layout 及其子组件(Header, Sider, Content, Footer)属于页面骨架级组件。
|
|
22
|
+
|
|
23
|
+
- Layout:解决的是页面大背景的语义化结构。它负责管理侧边栏的展开收起、顶部导航的置顶、以及整体滚动条的管理。
|
|
24
|
+
|
|
25
|
+
- Grid:通常嵌套在 Layout 的 Content(内容区)内部。
|
|
26
|
+
- 区别:Layout 定义了“房子有几间房”;Grid 定义了“每个房间里的家具怎么摆放”。
|
|
13
27
|
|
|
14
28
|
## 代码演示
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 响应式隐藏与强制排序 (Suffix & Display None)
|
|
3
|
+
`span: 0` 彻底移除 DOM 占位,`suffix` 跨越所有动态项。
|
|
4
|
+
</cn>
|
|
5
|
+
<en>
|
|
6
|
+
### Suffix & Display None
|
|
7
|
+
</en>
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<Grid :cols="{ xs: 2, md: 6 }" :xGap="8">
|
|
12
|
+
<GridItem :span="2">
|
|
13
|
+
<Input placeholder="搜索关键字..." />
|
|
14
|
+
</GridItem>
|
|
15
|
+
|
|
16
|
+
<!-- 手机端隐藏的高 -->
|
|
17
|
+
<GridItem :span="{ xs: 0, md: 2 }">
|
|
18
|
+
<Select><Option :value="1">高级筛选</Option></Select>
|
|
19
|
+
</GridItem>
|
|
20
|
+
|
|
21
|
+
<!-- 无论前面隐藏了多少,搜索按钮始终在当前行末尾 -->
|
|
22
|
+
<GridItem suffix :style="{ justifySelf: 'end' }">
|
|
23
|
+
<Button>立即搜索</Button>
|
|
24
|
+
</GridItem>
|
|
25
|
+
</Grid>
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { computed, defineComponent, provide, ref } from "vue";
|
|
2
|
+
import { withInstall } from "../utils/vue";
|
|
3
|
+
import { useBreakpoint, GRID_KEY } from "./useBreakpoint";
|
|
4
|
+
const Grid = defineComponent({
|
|
5
|
+
name: "Grid",
|
|
6
|
+
props: {
|
|
7
|
+
cols: { type: [Number, String, Object], default: 24 },
|
|
8
|
+
rows: { type: [Number, String, Object], default: "auto" },
|
|
9
|
+
autoRows: { type: String, default: "auto" },
|
|
10
|
+
xGap: { type: [Number, String, Object], default: 0 },
|
|
11
|
+
yGap: { type: [Number, String, Object], default: 0 },
|
|
12
|
+
itemMinWidth: { type: Number },
|
|
13
|
+
align: { type: String },
|
|
14
|
+
justify: { type: String },
|
|
15
|
+
debug: { type: Boolean },
|
|
16
|
+
},
|
|
17
|
+
setup(props, { emit, slots, attrs, listeners }) {
|
|
18
|
+
const gridRef = ref();
|
|
19
|
+
const breakpoint = useBreakpoint(gridRef);
|
|
20
|
+
|
|
21
|
+
const resolveResponsive = (val, fallback) => {
|
|
22
|
+
if (val === undefined) return fallback;
|
|
23
|
+
if (typeof val !== "object") return val;
|
|
24
|
+
const order = ["xxl", "xl", "lg", "md", "sm", "xs"];
|
|
25
|
+
const currentIndex = order.indexOf(breakpoint.value);
|
|
26
|
+
|
|
27
|
+
for (let i = currentIndex; i < order.length; i++) {
|
|
28
|
+
const key = order[i];
|
|
29
|
+
if (val[key] !== undefined) return val[key];
|
|
30
|
+
}
|
|
31
|
+
return fallback;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
provide(GRID_KEY, { breakpoint, resolveResponsive });
|
|
35
|
+
|
|
36
|
+
const gridStyle = computed(() => {
|
|
37
|
+
const activeCols = resolveResponsive(props.cols, 24);
|
|
38
|
+
const activeRows = resolveResponsive(props.rows, "auto");
|
|
39
|
+
const activeXGap = resolveResponsive(props.xGap, 0);
|
|
40
|
+
const activeYGap = resolveResponsive(props.yGap, 0);
|
|
41
|
+
const parseGap = (val) => (typeof val === "number" ? `${val}px` : val);
|
|
42
|
+
|
|
43
|
+
const style = {
|
|
44
|
+
gridTemplateColumns: props.itemMinWidth
|
|
45
|
+
? `repeat(auto-fill, minmax(${props.itemMinWidth}px, 1fr))`
|
|
46
|
+
: typeof activeCols === "number"
|
|
47
|
+
? `repeat(${activeCols}, minmax(0, 1fr))`
|
|
48
|
+
: activeCols,
|
|
49
|
+
gridTemplateRows:
|
|
50
|
+
typeof activeRows === "number" ? `repeat(${activeRows}, minmax(0, 1fr))` : activeRows,
|
|
51
|
+
columnGap: parseGap(activeXGap),
|
|
52
|
+
rowGap: parseGap(activeYGap),
|
|
53
|
+
gridAutoRows: props.autoRows,
|
|
54
|
+
alignItems: props.align,
|
|
55
|
+
justifyItems: props.justify,
|
|
56
|
+
};
|
|
57
|
+
if (props.debug && typeof activeCols === "number") {
|
|
58
|
+
style.backgroundImage = `repeating-linear-gradient(to right, rgba(255,0,0,0.05) 0, rgba(255,0,0,0.05) ${100 / activeCols}%, transparent ${100 / activeCols}%, transparent ${200 / activeCols}%)`;
|
|
59
|
+
}
|
|
60
|
+
return style;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return () => {
|
|
64
|
+
return (
|
|
65
|
+
<div class="k-grid" style={gridStyle.value} ref={gridRef}>
|
|
66
|
+
{slots.default?.()}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export default withInstall(Grid);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { computed, defineComponent, inject } from "vue";
|
|
2
|
+
import { withInstall } from "../utils/vue";
|
|
3
|
+
import { GRID_KEY } from "./useBreakpoint";
|
|
4
|
+
|
|
5
|
+
const GridItem = defineComponent({
|
|
6
|
+
name: "GridItem",
|
|
7
|
+
props: {
|
|
8
|
+
span: { type: [Number, String, Object], default: 1 }, // 跨越几列
|
|
9
|
+
rowSpan: { type: [Number, String, Object], default: 1 }, // 跨越几行
|
|
10
|
+
offset: { type: [Number, Object], default: 0 }, // 左侧偏移(通过 grid-column-start 实现)
|
|
11
|
+
suffix: { type: Boolean, default: false }, // 是否作为末尾填充
|
|
12
|
+
},
|
|
13
|
+
setup(props, { slots }) {
|
|
14
|
+
const context = inject(GRID_KEY);
|
|
15
|
+
const itemStyle = computed(() => {
|
|
16
|
+
if (!context) return {};
|
|
17
|
+
|
|
18
|
+
const s = context.resolveResponsive(props.span, 1);
|
|
19
|
+
const rs = context.resolveResponsive(props.rowSpan, 1);
|
|
20
|
+
const o = context.resolveResponsive(props.offset, 0);
|
|
21
|
+
if (s === 0) return { display: "none" };
|
|
22
|
+
const styles = {};
|
|
23
|
+
if (s !== 1) {
|
|
24
|
+
styles.gridColumn = `span ${s} / span ${s}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (o > 0) {
|
|
28
|
+
styles.gridColumnStart = `span ${s + o}`;
|
|
29
|
+
if (s === 1) {
|
|
30
|
+
styles.gridColumnEnd = `span 1`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (rs !== 1) {
|
|
34
|
+
styles.gridRow = `span ${rs} / span ${rs}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (props.suffix) {
|
|
38
|
+
styles.gridColumnStart = "-1";
|
|
39
|
+
styles.justifySelf = "end";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return styles;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return () => {
|
|
46
|
+
return (
|
|
47
|
+
<div class="k-grid-item" style={itemStyle.value}>
|
|
48
|
+
{slots.default?.()}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export default withInstall(GridItem);
|
package/components/grid/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import Grid from "./grid.jsx";
|
|
2
|
+
import GridItem from "./gridItem.jsx";
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { Grid, GridItem };
|
package/components/grid/index.md
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
##
|
|
1
|
+
## Grid API
|
|
2
2
|
|
|
3
|
-
| 属性
|
|
4
|
-
|
|
|
5
|
-
|
|
|
6
|
-
|
|
|
7
|
-
|
|
|
8
|
-
|
|
|
3
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
4
|
+
| ------------ | ----------------------------------------------------------------- | ------------------------- | ------ |
|
|
5
|
+
| cols | 设置网格的列数。支持数字(平分)或字符串(如 1fr 2fr) | Number,String,Object | 24 |
|
|
6
|
+
| rows | 设置网格的行数或高度。默认为 auto | Number,String,Object | auto |
|
|
7
|
+
| autoRows | 隐式网格行高。在 Bento 布局或瀑布流中用于设定基准高度。 | String | auto |
|
|
8
|
+
| xGap | 水格间距(水平方向)。数字类型会自动补充 px 单位。 | Number,String,Object | 0 |
|
|
9
|
+
| yGap | 行间距(垂直方向)。数字类型会自动补充 px 单位。 | Number,String,Object | 0 |
|
|
10
|
+
| itemMinWidth | 自动填充模式。设置子项最小宽度,Grid 将根据容器宽度自动计算列数。 | Number | - |
|
|
11
|
+
| align | 子项在网格单元格内的垂直对齐方式 | String ( center, start..) | - |
|
|
12
|
+
| justify | 子项在网格单元格内的水平对齐方式。 | String ( center, start..) | - |
|
|
13
|
+
| debug | 调试模式。开启后会显示红色透明背景列,方便开发者校对布局。 | Boolean | false |
|
|
9
14
|
|
|
10
|
-
##
|
|
15
|
+
## GridItem API
|
|
11
16
|
|
|
12
|
-
| 属性
|
|
13
|
-
|
|
|
14
|
-
| span
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
18
|
+
| ------- | ---------------------------------------------------------- | -------------------- | ------ |
|
|
19
|
+
| span | 占据的列数。设为 0 时会在该断点下彻底隐藏(display: none) | Number,String,Object | 1 |
|
|
20
|
+
| rowSpan | 占据的行数。配合容器的 autoRows 可实现非对称布局 | Number,String,Object | 1 |
|
|
21
|
+
| offset | 左侧偏移的列数。用于在不使用空白占位符的情况下产生留白。 | Number, Object | 0 |
|
|
22
|
+
| suffix | 尾部固定。设为 true 时,该项将强制移动到当前行的末尾。 | Boolean | false |
|
|
23
|
+
|
|
24
|
+
## Breakpoints
|
|
25
|
+
|
|
26
|
+
| 标识符 | 全称 | 阈值 (宽度 w) | 典型场景 |
|
|
27
|
+
| ------ | ----------------- | ------------- | ----------------------- |
|
|
28
|
+
| xs | Extra Small | 0≤w<576px | 手机竖屏 (Phones) |
|
|
29
|
+
| sm | Small | 576≤w<768px | 手机横屏 / 小型平板 |
|
|
30
|
+
| md | Medium | 768≤w<992px | 中型平板 (如 iPad) |
|
|
31
|
+
| lg | Large | 992≤w<1200px | 笔记本电脑 / 小屏显示器 |
|
|
32
|
+
| xl | Extra Large | 1200≤w<1600px | 标准桌面显示器 |
|
|
33
|
+
| xxl | Extra Extra Large | w≥1600px | 高分辨率大屏 / 宽屏 |
|
|
@@ -1,70 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
1
|
+
.k-grid {
|
|
2
|
+
display: grid;
|
|
3
|
+
width: 100%;
|
|
66
4
|
}
|
|
67
5
|
|
|
68
|
-
.k-
|
|
69
|
-
|
|
6
|
+
.k-grid-item {
|
|
7
|
+
min-width: 0;
|
|
8
|
+
overflow: hidden;
|
|
70
9
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ref, onMounted, onUnmounted, readonly } from "vue";
|
|
2
|
+
|
|
3
|
+
// const screens = {
|
|
4
|
+
// xs: "(max-width: 575px)",
|
|
5
|
+
// sm: "(min-width: 576px)",
|
|
6
|
+
// md: "(min-width: 768px)",
|
|
7
|
+
// lg: "(min-width: 992px)",
|
|
8
|
+
// xl: "(min-width: 1200px)",
|
|
9
|
+
// xxl: "(min-width: 1600px)",
|
|
10
|
+
// };
|
|
11
|
+
const breakpointMap = {
|
|
12
|
+
0: "xs",
|
|
13
|
+
576: "sm",
|
|
14
|
+
768: "md",
|
|
15
|
+
992: "lg",
|
|
16
|
+
1200: "xl",
|
|
17
|
+
1600: "xxl",
|
|
18
|
+
};
|
|
19
|
+
export const GRID_KEY = Symbol("GRID_KEY");
|
|
20
|
+
|
|
21
|
+
export function useBreakpoint(elRef) {
|
|
22
|
+
if (typeof window === 'undefined') return;
|
|
23
|
+
const active = ref("md");
|
|
24
|
+
let rafId = null;
|
|
25
|
+
|
|
26
|
+
const observer = new ResizeObserver((entries) => {
|
|
27
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
28
|
+
rafId = requestAnimationFrame(() => {
|
|
29
|
+
const width = entries[0].contentRect.width;
|
|
30
|
+
const sortedPoints = Object.keys(breakpointMap)
|
|
31
|
+
.map(Number)
|
|
32
|
+
.sort((a, b) => b - a);
|
|
33
|
+
for (const point of sortedPoints) {
|
|
34
|
+
if (width >= point) {
|
|
35
|
+
active.value = breakpointMap[point];
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
onMounted(() => elRef.value && observer.observe(elRef.value));
|
|
43
|
+
onUnmounted(() => observer.disconnect());
|
|
44
|
+
|
|
45
|
+
return readonly(active);
|
|
46
|
+
}
|
|
@@ -29,26 +29,26 @@
|
|
|
29
29
|
<h3><span>App icons</span></h3>
|
|
30
30
|
</div>
|
|
31
31
|
<br />
|
|
32
|
-
<
|
|
33
|
-
<
|
|
32
|
+
<Grid class="icon-list" :itemMinWidth="130">
|
|
33
|
+
<GridItem v-for="(x, y) in showIcons" :key="y" class="icon-item" @click.stop="copyHandle(x)">
|
|
34
34
|
<Icon :type="icons[x]" />
|
|
35
35
|
<!-- <svg width="1em" height="1em">
|
|
36
36
|
<use :xlink:href="`${sprite}#${x}`"></use>
|
|
37
37
|
</svg> -->
|
|
38
|
-
</
|
|
39
|
-
</
|
|
38
|
+
</GridItem>
|
|
39
|
+
</Grid>
|
|
40
40
|
</template>
|
|
41
41
|
<template v-if="logo.length">
|
|
42
42
|
<h3>Logos</h3>
|
|
43
|
-
<
|
|
44
|
-
<
|
|
43
|
+
<Grid class="icon-list" :itemMinWidth="130">
|
|
44
|
+
<GridItem v-for="(x, y) in logo" :key="y" class="icon-item" @click.stop="copyHandle(x)">
|
|
45
45
|
<Icon :type="icons[x]" />
|
|
46
46
|
<!-- <svg width="1em"
|
|
47
47
|
height="1em">
|
|
48
48
|
<use :xlink:href="`${sprite}#${x}`"></use>
|
|
49
49
|
</svg> -->
|
|
50
|
-
</
|
|
51
|
-
</
|
|
50
|
+
</GridItem>
|
|
51
|
+
</Grid>
|
|
52
52
|
</template>
|
|
53
53
|
<h3
|
|
54
54
|
v-if="!showIcons.length && !logo.length"
|
|
@@ -113,13 +113,11 @@ const copyHandle = (name) => {
|
|
|
113
113
|
<style lang="less">
|
|
114
114
|
.icon-list {
|
|
115
115
|
// overflow: hidden;
|
|
116
|
-
display: inline-block;
|
|
116
|
+
// display: inline-block;
|
|
117
117
|
|
|
118
118
|
.icon-item {
|
|
119
119
|
text-align: center;
|
|
120
|
-
width: 128px;
|
|
121
120
|
height: 80px;
|
|
122
|
-
line-height: 80px;
|
|
123
121
|
color: var(--kui-color-font);
|
|
124
122
|
display: inline-flex;
|
|
125
123
|
flex-direction: column;
|
|
@@ -202,6 +202,7 @@
|
|
|
202
202
|
.k-textarea-lg {
|
|
203
203
|
font-size: 16px;
|
|
204
204
|
padding: 4px 10px;
|
|
205
|
+
border-radius: var(--kui-border-radius-lg);
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
.k-input-sm[single] {
|
|
@@ -246,6 +247,7 @@
|
|
|
246
247
|
padding: 2px 10px;
|
|
247
248
|
height: 40px;
|
|
248
249
|
font-size: 16px;
|
|
250
|
+
border-radius: var(--kui-border-radius-lg);
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
.k-input-group-suffix,
|
|
@@ -270,6 +272,7 @@
|
|
|
270
272
|
|
|
271
273
|
.k-input-lg[multiple] {
|
|
272
274
|
height: 40px;
|
|
275
|
+
border-radius: var(--kui-border-radius-lg);
|
|
273
276
|
|
|
274
277
|
.k-input-text {
|
|
275
278
|
padding: 2px 0;
|
|
@@ -68,7 +68,9 @@
|
|
|
68
68
|
width: calc(100% - 20px);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
.k-menu-item-group{
|
|
72
|
+
padding-bottom: 10px;
|
|
73
|
+
}
|
|
72
74
|
.k-menu-item-group-title {
|
|
73
75
|
font-size: 12px;
|
|
74
76
|
color: var(--kui-color-icon);
|
|
@@ -119,7 +121,7 @@
|
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
.k-menu-item-group-title {
|
|
122
|
-
padding: 0 16px
|
|
124
|
+
padding: 0 16px 10px 10px;
|
|
123
125
|
box-sizing: border-box;
|
|
124
126
|
}
|
|
125
127
|
|
|
@@ -373,6 +375,8 @@
|
|
|
373
375
|
|
|
374
376
|
.k-menu-item-group-list {
|
|
375
377
|
margin: 0;
|
|
378
|
+
padding: 0;
|
|
379
|
+
list-style: none;
|
|
376
380
|
}
|
|
377
381
|
|
|
378
382
|
.k-menu-inline-collapsed {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<cn>
|
|
2
|
+
### 基本用法
|
|
3
|
+
`col` 必须放在 `row` 里面
|
|
4
|
+
</cn>
|
|
5
|
+
<en>
|
|
6
|
+
### Basic Usage
|
|
7
|
+
Columns must be placed inside a Row.
|
|
8
|
+
</en>
|
|
9
|
+
|
|
10
|
+
```vue
|
|
11
|
+
<template>
|
|
12
|
+
<Space block vertical>
|
|
13
|
+
<Row>
|
|
14
|
+
<Col :span="12">col-12</Col>
|
|
15
|
+
<Col :span="12">col-12</Col>
|
|
16
|
+
</Row>
|
|
17
|
+
<Row>
|
|
18
|
+
<Col :span="8">col-8</Col>
|
|
19
|
+
<Col :span="8">col-8</Col>
|
|
20
|
+
<Col :span="8">col-8</Col>
|
|
21
|
+
</Row>
|
|
22
|
+
<Row>
|
|
23
|
+
<Col :span="6">col-6</Col>
|
|
24
|
+
<Col :span="6">col-6</Col>
|
|
25
|
+
<Col :span="6">col-6</Col>
|
|
26
|
+
<Col :span="6">col-6</Col>
|
|
27
|
+
</Row>
|
|
28
|
+
</Space>
|
|
29
|
+
</template>
|
|
30
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Info from "./info.md";
|
|
2
|
+
import Basic from "./basic.md";
|
|
3
|
+
import Gutter from "./gutter.md";
|
|
4
|
+
import Offset from "./offset.md";
|
|
5
|
+
import Align from "./align.md";
|
|
6
|
+
import Flex from "./flex.md";
|
|
7
|
+
import Fill from "./fill.md";
|
|
8
|
+
import CN from "../index.md";
|
|
9
|
+
export default {
|
|
10
|
+
render() {
|
|
11
|
+
return (
|
|
12
|
+
<div class="demo-grid">
|
|
13
|
+
<Info />
|
|
14
|
+
<Basic />
|
|
15
|
+
<Gutter />
|
|
16
|
+
<Offset />
|
|
17
|
+
<Align />
|
|
18
|
+
<Flex />
|
|
19
|
+
<Fill />
|
|
20
|
+
<CN />
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Grid 栅格
|
|
2
|
+
|
|
3
|
+
采用了24栅格系统,将区域进行24等分,这样可以轻松应对大部分布局问题
|
|
4
|
+
两个概念,行 `row` 和列 `col` ,具体使用方法如下:
|
|
5
|
+
|
|
6
|
+
- 使用 `row` 在水平方向创建一行
|
|
7
|
+
- 将一组 `col` 插入在 `row` 中
|
|
8
|
+
- 在每个 `col` 中,键入自己的内容
|
|
9
|
+
- 通过设置 `col` 的 `span` 参数,指定跨越的范围,其范围是1到24
|
|
10
|
+
- 每个 `row` 中的 `col` 总和应该为24
|
|
11
|
+
|
|
12
|
+
> 注意:非 template/render 模式下,需使用 k-col。
|
|
13
|
+
|
|
14
|
+
## 代码演示
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Row API
|
|
2
|
+
|
|
3
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
4
|
+
| ------- | -------------------------------------------------------------------------------- | ------------ | ------- |
|
|
5
|
+
| align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | String | `top` |
|
|
6
|
+
| justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | String | `start` |
|
|
7
|
+
| gutter | 栅格间距,单位 px,左右平分,使用数组形式同时设置 [水平间距, 垂直间距] | Number,Array | - |
|
|
8
|
+
| type | 布局模式,可选 flex,现代浏览器 下有效 | String | |
|
|
9
|
+
|
|
10
|
+
## Col API
|
|
11
|
+
|
|
12
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
13
|
+
| ------ | -------------------------------------- | ------------- | ------ |
|
|
14
|
+
| span | 栅格的占位格数,可选值为0~24的整数 | Number | - |
|
|
15
|
+
| offset | 栅格左侧的间隔格数,可选值为1~24的整数 | Number | - |
|
|
16
|
+
| flex | flex 布局填充 | Number,String | - |
|