@next-bricks/presentational 1.21.9 → 1.21.11
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/dist/bricks.json +1 -1
- package/dist/chunks/1614.5ce43617.js +2 -0
- package/dist/chunks/1614.5ce43617.js.map +1 -0
- package/dist/chunks/{1889.4559a6f7.js → 1889.01e1c38a.js} +2 -2
- package/dist/chunks/{1889.4559a6f7.js.map → 1889.01e1c38a.js.map} +1 -1
- package/dist/chunks/3171.7708784b.js +2 -0
- package/dist/chunks/3171.7708784b.js.map +1 -0
- package/dist/chunks/5399.2ab60504.js +2 -0
- package/dist/chunks/5399.2ab60504.js.map +1 -0
- package/dist/chunks/5552.f77213dd.js +2 -0
- package/dist/chunks/5552.f77213dd.js.map +1 -0
- package/dist/chunks/7116.05a51bac.js +2 -0
- package/dist/chunks/7116.05a51bac.js.map +1 -0
- package/dist/chunks/7455.0f5298ce.js +3 -0
- package/dist/chunks/7455.0f5298ce.js.LICENSE.txt +11 -0
- package/dist/chunks/7455.0f5298ce.js.map +1 -0
- package/dist/chunks/948.b8effe9f.js +3 -0
- package/dist/chunks/948.b8effe9f.js.map +1 -0
- package/dist/chunks/code-wrapper.40655769.js.map +1 -1
- package/dist/chunks/{eo-card-item.fbff6f7e.js → eo-card-item.f56c41e5.js} +3 -3
- package/dist/chunks/eo-card-item.f56c41e5.js.map +1 -0
- package/dist/chunks/eo-carousel-text.d8e8c2c9.js.map +1 -1
- package/dist/chunks/{eo-code-block.7efe5647.js → eo-code-block.a7162247.js} +2 -2
- package/dist/chunks/eo-code-block.a7162247.js.map +1 -0
- package/dist/chunks/eo-code-display.ffd79558.js.map +1 -1
- package/dist/chunks/eo-current-time.7cbef918.js.map +1 -1
- package/dist/chunks/{eo-descriptions.b8320ca9.js → eo-descriptions.1ab98c43.js} +3 -3
- package/dist/chunks/{eo-descriptions.b8320ca9.js.map → eo-descriptions.1ab98c43.js.map} +1 -1
- package/dist/chunks/eo-humanize-time.2397ce6e.js.map +1 -1
- package/dist/chunks/{eo-info-card-item.0d15cb28.js → eo-info-card-item.e6403b4d.js} +3 -3
- package/dist/chunks/eo-info-card-item.e6403b4d.js.map +1 -0
- package/dist/chunks/{eo-loading-step.834e0aa3.js → eo-loading-step.259d7985.js} +3 -3
- package/dist/chunks/{eo-loading-step.834e0aa3.js.map → eo-loading-step.259d7985.js.map} +1 -1
- package/dist/chunks/eo-pagination.16fd816a.js.map +1 -1
- package/dist/chunks/eo-statistics-card.410b5416.js.map +1 -1
- package/dist/chunks/{main.7a4b0b01.js → main.519bfa38.js} +2 -2
- package/dist/chunks/main.519bfa38.js.map +1 -0
- package/dist/examples.json +13 -13
- package/dist/{index.db5144bf.js → index.71ea98e1.js} +2 -2
- package/dist/index.71ea98e1.js.map +1 -0
- package/dist/manifest.json +49 -39
- package/dist/types.json +2 -2
- package/dist-types/card-item/index.d.ts +8 -4
- package/dist-types/carousel-text/index.d.ts +1 -1
- package/dist-types/code-block/index.d.ts +12 -3
- package/dist-types/code-display/index.d.ts +0 -1
- package/dist-types/code-wrapper/index.d.ts +7 -2
- package/dist-types/current-time/index.d.ts +1 -1
- package/dist-types/descriptions/index.d.ts +4 -3
- package/dist-types/humanize-time/index.d.ts +8 -8
- package/dist-types/info-card-item/index.d.ts +10 -9
- package/dist-types/loading-step/index.d.ts +8 -8
- package/dist-types/pagination/index.d.ts +7 -0
- package/dist-types/statistics-card/index.d.ts +2 -2
- package/docs/eo-alert.md +65 -1
- package/docs/eo-alert.react.md +127 -0
- package/docs/eo-card-item.md +179 -210
- package/docs/eo-card-item.react.md +578 -0
- package/docs/eo-carousel-text.md +49 -2
- package/docs/eo-carousel-text.react.md +62 -0
- package/docs/eo-code-block.md +135 -4
- package/docs/eo-code-block.react.md +146 -0
- package/docs/eo-code-display.md +97 -1
- package/docs/eo-code-display.react.md +116 -0
- package/docs/eo-code-wrapper.md +108 -0
- package/docs/eo-code-wrapper.react.md +100 -0
- package/docs/eo-current-time.md +40 -1
- package/docs/eo-current-time.react.md +53 -0
- package/docs/eo-descriptions.md +74 -4
- package/docs/eo-descriptions.react.md +329 -0
- package/docs/eo-divider.md +105 -17
- package/docs/eo-divider.react.md +129 -0
- package/docs/eo-humanize-time.md +89 -42
- package/docs/eo-humanize-time.react.md +109 -0
- package/docs/eo-info-card-item.md +129 -183
- package/docs/eo-info-card-item.react.md +188 -0
- package/docs/eo-loading-step.md +96 -1
- package/docs/eo-loading-step.react.md +102 -0
- package/docs/eo-pagination.md +74 -1
- package/docs/eo-pagination.react.md +93 -0
- package/docs/eo-statistics-card.md +175 -456
- package/docs/eo-statistics-card.react.md +376 -0
- package/package.json +2 -2
- package/dist/chunks/3171.3bb3ff80.js +0 -2
- package/dist/chunks/3171.3bb3ff80.js.map +0 -1
- package/dist/chunks/4837.3ae6253e.js +0 -2
- package/dist/chunks/4837.3ae6253e.js.map +0 -1
- package/dist/chunks/5045.b0f85f6b.js +0 -2
- package/dist/chunks/5045.b0f85f6b.js.map +0 -1
- package/dist/chunks/5399.23640b2d.js +0 -2
- package/dist/chunks/5399.23640b2d.js.map +0 -1
- package/dist/chunks/5552.5d29c532.js +0 -2
- package/dist/chunks/5552.5d29c532.js.map +0 -1
- package/dist/chunks/7218.4acefe69.js +0 -2
- package/dist/chunks/7218.4acefe69.js.map +0 -1
- package/dist/chunks/948.817a1ef0.js +0 -3
- package/dist/chunks/948.817a1ef0.js.map +0 -1
- package/dist/chunks/eo-card-item.fbff6f7e.js.map +0 -1
- package/dist/chunks/eo-code-block.7efe5647.js.map +0 -1
- package/dist/chunks/eo-info-card-item.0d15cb28.js.map +0 -1
- package/dist/chunks/main.7a4b0b01.js.map +0 -1
- package/dist/index.db5144bf.js.map +0 -1
- /package/dist/chunks/{948.817a1ef0.js.LICENSE.txt → 948.b8effe9f.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-card-item.fbff6f7e.js.LICENSE.txt → eo-card-item.f56c41e5.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-descriptions.b8320ca9.js.LICENSE.txt → eo-descriptions.1ab98c43.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-info-card-item.0d15cb28.js.LICENSE.txt → eo-info-card-item.e6403b4d.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{eo-loading-step.834e0aa3.js.LICENSE.txt → eo-loading-step.259d7985.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: presentational.code-wrapper
|
|
3
|
+
displayName: WrappedPresentationalCodeWrapper
|
|
4
|
+
description: 代码内容包裹容器,提供统一的代码展示结构并支持一键复制功能。
|
|
5
|
+
category: ""
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedPresentationalCodeWrapper
|
|
10
|
+
|
|
11
|
+
> 代码内容包裹容器,提供统一的代码展示结构并支持一键复制功能。
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedPresentationalCodeWrapper } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| -------------- | ------------------------------------------------------- | ---- | ------ | ----------------------------------------------------------------- |
|
|
23
|
+
| preProps | `React.PropsWithChildren<JSX.IntrinsicElements["pre"]>` | 否 | - | 传递给 `<pre>` 元素的额外属性,例如 `className`、`style` 等 |
|
|
24
|
+
| showCopyButton | `boolean` | 否 | `true` | 是否展示复制按钮 |
|
|
25
|
+
| themeVariant | `"default" \| "elevo"` | 否 | - | 主题变体,影响复制按钮等内部元素的样式风格。`elevo` 为 Elevo 风格 |
|
|
26
|
+
|
|
27
|
+
## CSS Parts
|
|
28
|
+
|
|
29
|
+
| 名称 | 说明 |
|
|
30
|
+
| ---- | --------------------------- |
|
|
31
|
+
| pre | 包裹代码内容的 `<pre>` 元素 |
|
|
32
|
+
| copy | 复制按钮 |
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Basic
|
|
37
|
+
|
|
38
|
+
展示代码包裹容器的基本用法,将代码内容放入 `<code>` 子节点,默认展示复制按钮。
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<WrappedPresentationalCodeWrapper
|
|
42
|
+
preProps={{ children: <code>{"const greeting = 'Hello, World!';"}</code> }}
|
|
43
|
+
/>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 隐藏复制按钮
|
|
47
|
+
|
|
48
|
+
设置 `showCopyButton` 为 `false` 可隐藏右上角的复制按钮。
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<WrappedPresentationalCodeWrapper
|
|
52
|
+
showCopyButton={false}
|
|
53
|
+
preProps={{ children: <code>{"const greeting = 'Hello, World!';"}</code> }}
|
|
54
|
+
/>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Elevo 主题变体
|
|
58
|
+
|
|
59
|
+
设置 `themeVariant` 为 `"elevo"` 使复制按钮采用 Elevo 主题样式。
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<WrappedPresentationalCodeWrapper
|
|
63
|
+
themeVariant="elevo"
|
|
64
|
+
preProps={{ children: <code>{"const greeting = 'Hello, World!';"}</code> }}
|
|
65
|
+
/>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 自定义 pre 元素样式
|
|
69
|
+
|
|
70
|
+
通过 `preProps` 的 `style` 字段为 `<pre>` 元素设置自定义内联样式。
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<WrappedPresentationalCodeWrapper
|
|
74
|
+
preProps={{
|
|
75
|
+
style: {
|
|
76
|
+
background: "#1e1e1e",
|
|
77
|
+
color: "#d4d4d4",
|
|
78
|
+
padding: "16px",
|
|
79
|
+
borderRadius: "8px",
|
|
80
|
+
},
|
|
81
|
+
children: <code>{"const greeting = 'Hello, World!';"}</code>,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 自定义 CSS Parts
|
|
87
|
+
|
|
88
|
+
通过 `pre` 和 `copy` CSS Parts 对内部元素进行样式定制,例如修改 `<pre>` 背景色和圆角、调整复制按钮颜色。
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<WrappedPresentationalCodeWrapper
|
|
92
|
+
style={
|
|
93
|
+
{
|
|
94
|
+
"--part-pre-border-radius": "8px",
|
|
95
|
+
"--part-copy-color": "var(--color-brand)",
|
|
96
|
+
} as React.CSSProperties
|
|
97
|
+
}
|
|
98
|
+
preProps={{ children: <code>{"const greeting = 'Hello, World!';"}</code> }}
|
|
99
|
+
/>
|
|
100
|
+
```
|
package/docs/eo-current-time.md
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-current-time
|
|
3
|
+
displayName: EoCurrentTime
|
|
4
|
+
description: 实时当前时间展示构件,每秒自动刷新,支持自定义时间格式和前置图标。
|
|
5
|
+
category: ""
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# eo-current-time
|
|
10
|
+
|
|
11
|
+
> 实时当前时间展示构件,每秒自动刷新,支持自定义时间格式和前置图标。
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| ------ | ------------------------------- | ---- | ----------------------- | ----------------------------------- |
|
|
17
|
+
| format | `string` | 是 | `"YYYY-MM-DD HH:mm:ss"` | 时间格式,使用 moment.js 格式字符串 |
|
|
18
|
+
| icon | `GeneralIconProps \| undefined` | 否 | - | 前置图标,仅在时间已渲染后显示 |
|
|
2
19
|
|
|
3
20
|
## Examples
|
|
4
21
|
|
|
5
22
|
### Basic
|
|
6
23
|
|
|
24
|
+
使用默认时间格式展示当前时间,每秒自动刷新。
|
|
25
|
+
|
|
26
|
+
```yaml preview
|
|
27
|
+
brick: eo-current-time
|
|
28
|
+
properties:
|
|
29
|
+
format: "YYYY-MM-DD HH:mm:ss"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### With Icon
|
|
33
|
+
|
|
34
|
+
在时间前面展示一个图标,图标仅在时间渲染后可见。
|
|
35
|
+
|
|
7
36
|
```yaml preview
|
|
8
37
|
brick: eo-current-time
|
|
9
38
|
properties:
|
|
@@ -13,3 +42,13 @@ properties:
|
|
|
13
42
|
category: itsc-form
|
|
14
43
|
icon: time
|
|
15
44
|
```
|
|
45
|
+
|
|
46
|
+
### Custom Format
|
|
47
|
+
|
|
48
|
+
使用自定义格式只展示时分秒。
|
|
49
|
+
|
|
50
|
+
```yaml preview
|
|
51
|
+
brick: eo-current-time
|
|
52
|
+
properties:
|
|
53
|
+
format: "HH:mm:ss"
|
|
54
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-current-time
|
|
3
|
+
displayName: WrappedEoCurrentTime
|
|
4
|
+
description: 实时当前时间展示构件,每秒自动刷新,支持自定义时间格式和前置图标。
|
|
5
|
+
category: ""
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedEoCurrentTime
|
|
10
|
+
|
|
11
|
+
> 实时当前时间展示构件,每秒自动刷新,支持自定义时间格式和前置图标。
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedEoCurrentTime } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| ------ | ------------------------------- | ---- | ----------------------- | ----------------------------------- |
|
|
23
|
+
| format | `string` | 是 | `"YYYY-MM-DD HH:mm:ss"` | 时间格式,使用 moment.js 格式字符串 |
|
|
24
|
+
| icon | `GeneralIconProps \| undefined` | 否 | - | 前置图标,仅在时间已渲染后显示 |
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Basic
|
|
29
|
+
|
|
30
|
+
使用默认时间格式展示当前时间,每秒自动刷新。
|
|
31
|
+
|
|
32
|
+
```tsx preview
|
|
33
|
+
<WrappedEoCurrentTime format="YYYY-MM-DD HH:mm:ss" />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### With Icon
|
|
37
|
+
|
|
38
|
+
在时间前面展示一个图标,图标仅在时间渲染后可见。
|
|
39
|
+
|
|
40
|
+
```tsx preview
|
|
41
|
+
<WrappedEoCurrentTime
|
|
42
|
+
format="YYYY-MM-DD HH:mm:ss"
|
|
43
|
+
icon={{ lib: "easyops", category: "itsc-form", icon: "time" }}
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Custom Format
|
|
48
|
+
|
|
49
|
+
使用自定义格式只展示时分秒。
|
|
50
|
+
|
|
51
|
+
```tsx preview
|
|
52
|
+
<WrappedEoCurrentTime format="HH:mm:ss" />
|
|
53
|
+
```
|
package/docs/eo-descriptions.md
CHANGED
|
@@ -1,4 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-descriptions
|
|
3
|
+
displayName: EoDescriptions
|
|
4
|
+
description: 通用描述列表构件
|
|
5
|
+
category: text
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# eo-descriptions
|
|
10
|
+
|
|
11
|
+
> 通用描述列表构件
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| ---------------- | ---------------------------- | ---- | -------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
17
|
+
| descriptionTitle | `string` | 否 | - | 描述标题 |
|
|
18
|
+
| list | `DescriptionItem[]` | 否 | - | 描述列表,每项可通过 `text`、`field` 或 `useBrick` 指定内容 |
|
|
19
|
+
| showCard | `boolean` | 否 | `true` | 是否展示卡片背景(`themeVariant` 为 `elevo` 时强制不展示卡片) |
|
|
20
|
+
| column | `number` | 否 | `3` | 列数 |
|
|
21
|
+
| templateColumns | `string` | 否 | - | CSS [grid-template-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns),优先级高于 `column` |
|
|
22
|
+
| layout | `"horizontal" \| "vertical"` | 否 | `"horizontal"` | 布局模式 |
|
|
23
|
+
| bordered | `boolean` | 否 | `false` | 是否展示边框 |
|
|
24
|
+
| hideGroups | `string \| string[]` | 否 | - | 需要隐藏的分组名称,匹配 list 项的 group 字段,支持字符串或字符串数组 |
|
|
25
|
+
| dataSource | `object` | 否 | - | 数据源,供 list 项通过 `field` 读取字段值或通过 `useBrick` 的 `DATA` 引用 |
|
|
26
|
+
| themeVariant | `"default" \| "elevo"` | 否 | - | 主题变体;`elevo` 模式下不渲染外层卡片,且标签后不添加冒号 |
|
|
27
|
+
|
|
28
|
+
### DescriptionItem
|
|
29
|
+
|
|
30
|
+
| 字段 | 类型 | 说明 |
|
|
31
|
+
| ---------- | ------------------ | ----------------------------------------------------- |
|
|
32
|
+
| label | `string` | 描述项标签文本 |
|
|
33
|
+
| field | `string` | 从 `dataSource` 中读取值的字段路径(使用 lodash get) |
|
|
34
|
+
| group | `string` | 所属分组名,可配合 `hideGroups` 隐藏整组 |
|
|
35
|
+
| text | `string \| number` | 静态文本内容,`field` 未设置时使用 |
|
|
36
|
+
| useBrick | `UseBrickConf` | 自定义渲染 brick,`dataSource` 作为 `DATA` 传入 |
|
|
37
|
+
| gridColumn | `string` | CSS `grid-column` 值,用于手动控制该项的列跨度 |
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Basic
|
|
42
|
+
|
|
43
|
+
最简用法,展示一组描述列表。
|
|
2
44
|
|
|
3
45
|
```yaml preview
|
|
4
46
|
- brick: eo-descriptions
|
|
@@ -14,10 +56,10 @@
|
|
|
14
56
|
text: 篮球
|
|
15
57
|
```
|
|
16
58
|
|
|
17
|
-
## Examples
|
|
18
|
-
|
|
19
59
|
### Column
|
|
20
60
|
|
|
61
|
+
通过 `column` 控制列数,并通过 `descriptionTitle` 设置标题。
|
|
62
|
+
|
|
21
63
|
```yaml preview
|
|
22
64
|
- brick: eo-descriptions
|
|
23
65
|
properties:
|
|
@@ -82,6 +124,8 @@
|
|
|
82
124
|
|
|
83
125
|
### Layout
|
|
84
126
|
|
|
127
|
+
`layout` 支持 `horizontal`(标签与内容同行)和 `vertical`(标签在内容上方)两种布局。
|
|
128
|
+
|
|
85
129
|
```yaml preview
|
|
86
130
|
- brick: eo-descriptions
|
|
87
131
|
properties:
|
|
@@ -147,6 +191,8 @@
|
|
|
147
191
|
|
|
148
192
|
### Bordered
|
|
149
193
|
|
|
194
|
+
`bordered` 为 `true` 时,列表项添加边框线,标签后不显示冒号。
|
|
195
|
+
|
|
150
196
|
```yaml preview
|
|
151
197
|
- brick: eo-descriptions
|
|
152
198
|
properties:
|
|
@@ -210,6 +256,8 @@
|
|
|
210
256
|
|
|
211
257
|
### Hide Groups
|
|
212
258
|
|
|
259
|
+
通过 `hideGroups` 隐藏指定 group 的所有描述项,支持单个字符串或字符串数组。
|
|
260
|
+
|
|
213
261
|
```yaml preview
|
|
214
262
|
- brick: eo-descriptions
|
|
215
263
|
properties:
|
|
@@ -279,6 +327,8 @@
|
|
|
279
327
|
|
|
280
328
|
### DataSource
|
|
281
329
|
|
|
330
|
+
通过 `dataSource` 提供数据源,list 项可用 `field` 读取字段,也可在 `useBrick` 中通过 `DATA` 引用整个数据源。
|
|
331
|
+
|
|
282
332
|
```yaml preview
|
|
283
333
|
- brick: eo-descriptions
|
|
284
334
|
properties:
|
|
@@ -301,7 +351,27 @@
|
|
|
301
351
|
textContent: "<% DATA.text %>"
|
|
302
352
|
```
|
|
303
353
|
|
|
304
|
-
###
|
|
354
|
+
### Template Columns
|
|
355
|
+
|
|
356
|
+
通过 `templateColumns` 精确控制各列宽度,list 项可用 `gridColumn` 跨列显示。
|
|
357
|
+
|
|
358
|
+
```yaml preview
|
|
359
|
+
- brick: eo-descriptions
|
|
360
|
+
properties:
|
|
361
|
+
templateColumns: "200px 1fr 2fr"
|
|
362
|
+
list:
|
|
363
|
+
- label: 姓名
|
|
364
|
+
text: Tom
|
|
365
|
+
- label: 年龄
|
|
366
|
+
text: 18
|
|
367
|
+
- label: 备注
|
|
368
|
+
text: 这是一段较长的备注信息
|
|
369
|
+
gridColumn: "2 / 4"
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Theme Variant Elevo
|
|
373
|
+
|
|
374
|
+
`themeVariant` 为 `elevo` 时,不渲染外层卡片,适用于 AI 门户等特殊背景场景。
|
|
305
375
|
|
|
306
376
|
```yaml preview
|
|
307
377
|
# Use this container to emulate background
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-descriptions
|
|
3
|
+
displayName: WrappedEoDescriptions
|
|
4
|
+
description: 通用描述列表构件
|
|
5
|
+
category: text
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedEoDescriptions
|
|
10
|
+
|
|
11
|
+
> 通用描述列表构件
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| ---------------- | ---------------------------- | ---- | -------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
23
|
+
| descriptionTitle | `string` | 否 | - | 描述标题 |
|
|
24
|
+
| list | `DescriptionItem[]` | 否 | - | 描述列表,每项可通过 `text`、`field` 或 `useBrick` 指定内容 |
|
|
25
|
+
| showCard | `boolean` | 否 | `true` | 是否展示卡片背景(`themeVariant` 为 `elevo` 时强制不展示卡片) |
|
|
26
|
+
| column | `number` | 否 | `3` | 列数 |
|
|
27
|
+
| templateColumns | `string` | 否 | - | CSS [grid-template-columns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns),优先级高于 `column` |
|
|
28
|
+
| layout | `"horizontal" \| "vertical"` | 否 | `"horizontal"` | 布局模式 |
|
|
29
|
+
| bordered | `boolean` | 否 | `false` | 是否展示边框 |
|
|
30
|
+
| hideGroups | `string \| string[]` | 否 | - | 需要隐藏的分组名称,匹配 list 项的 group 字段,支持字符串或字符串数组 |
|
|
31
|
+
| dataSource | `object` | 否 | - | 数据源,供 list 项通过 `field` 读取字段值或通过 `useBrick` 的 `DATA` 引用 |
|
|
32
|
+
| themeVariant | `"default" \| "elevo"` | 否 | - | 主题变体;`elevo` 模式下不渲染外层卡片,且标签后不添加冒号 |
|
|
33
|
+
|
|
34
|
+
### DescriptionItem
|
|
35
|
+
|
|
36
|
+
| 字段 | 类型 | 说明 |
|
|
37
|
+
| ---------- | ------------------ | ----------------------------------------------------- |
|
|
38
|
+
| label | `string` | 描述项标签文本 |
|
|
39
|
+
| field | `string` | 从 `dataSource` 中读取值的字段路径(使用 lodash get) |
|
|
40
|
+
| group | `string` | 所属分组名,可配合 `hideGroups` 隐藏整组 |
|
|
41
|
+
| text | `string \| number` | 静态文本内容,`field` 未设置时使用 |
|
|
42
|
+
| useBrick | `UseBrickConf` | 自定义渲染 brick,`dataSource` 作为 `DATA` 传入 |
|
|
43
|
+
| gridColumn | `string` | CSS `grid-column` 值,用于手动控制该项的列跨度 |
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
### Basic
|
|
48
|
+
|
|
49
|
+
最简用法,展示一组描述列表。
|
|
50
|
+
|
|
51
|
+
```tsx preview
|
|
52
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
53
|
+
|
|
54
|
+
export default function App() {
|
|
55
|
+
return (
|
|
56
|
+
<WrappedEoDescriptions
|
|
57
|
+
list={[
|
|
58
|
+
{ label: "姓名", text: "Tom" },
|
|
59
|
+
{ label: "年龄", text: 18 },
|
|
60
|
+
{ label: "身高", text: "180cm" },
|
|
61
|
+
{ label: "爱好", text: "篮球" },
|
|
62
|
+
]}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Column
|
|
69
|
+
|
|
70
|
+
通过 `column` 控制列数,并通过 `descriptionTitle` 设置标题。
|
|
71
|
+
|
|
72
|
+
```tsx preview
|
|
73
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
74
|
+
import { WrappedEoDivider } from "@easyops/wrapped-components";
|
|
75
|
+
|
|
76
|
+
const tagList = [
|
|
77
|
+
{ text: "阳光", key: 0, color: "blue" },
|
|
78
|
+
{ text: "开朗", key: 1, color: "red" },
|
|
79
|
+
{ text: "大男孩", key: 2, color: "green" },
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
export default function App() {
|
|
83
|
+
return (
|
|
84
|
+
<>
|
|
85
|
+
<WrappedEoDescriptions
|
|
86
|
+
descriptionTitle="UserInfo"
|
|
87
|
+
column={2}
|
|
88
|
+
list={[
|
|
89
|
+
{ label: "姓名", text: "Tom" },
|
|
90
|
+
{ label: "年龄", text: 18 },
|
|
91
|
+
{ label: "身高", text: "180cm" },
|
|
92
|
+
{ label: "爱好", text: "篮球" },
|
|
93
|
+
{
|
|
94
|
+
label: "标签",
|
|
95
|
+
useBrick: [{ brick: "eo-tag-list", properties: { list: tagList } }],
|
|
96
|
+
},
|
|
97
|
+
]}
|
|
98
|
+
/>
|
|
99
|
+
<WrappedEoDivider dividerStyle={{ margin: "8px 0 4px 0" }} />
|
|
100
|
+
<WrappedEoDescriptions
|
|
101
|
+
descriptionTitle="用户信息"
|
|
102
|
+
column={4}
|
|
103
|
+
list={[
|
|
104
|
+
{ label: "姓名", text: "Tom" },
|
|
105
|
+
{ label: "年龄", text: 18 },
|
|
106
|
+
{ label: "身高", text: "180cm" },
|
|
107
|
+
{ label: "爱好", text: "篮球" },
|
|
108
|
+
{
|
|
109
|
+
label: "标签",
|
|
110
|
+
useBrick: [{ brick: "eo-tag-list", properties: { list: tagList } }],
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
/>
|
|
114
|
+
</>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Layout
|
|
120
|
+
|
|
121
|
+
`layout` 支持 `horizontal`(标签与内容同行)和 `vertical`(标签在内容上方)两种布局。
|
|
122
|
+
|
|
123
|
+
```tsx preview
|
|
124
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
125
|
+
import { WrappedEoDivider } from "@easyops/wrapped-components";
|
|
126
|
+
|
|
127
|
+
const tagList = [
|
|
128
|
+
{ text: "阳光", key: 0, color: "blue" },
|
|
129
|
+
{ text: "开朗", key: 1, color: "red" },
|
|
130
|
+
{ text: "大男孩", key: 2, color: "green" },
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
const items = [
|
|
134
|
+
{ label: "姓名", text: "Tom" },
|
|
135
|
+
{ label: "年龄", text: 18 },
|
|
136
|
+
{ label: "身高", text: "180cm" },
|
|
137
|
+
{ label: "爱好", text: "篮球" },
|
|
138
|
+
{
|
|
139
|
+
label: "标签",
|
|
140
|
+
useBrick: [{ brick: "eo-tag-list", properties: { list: tagList } }],
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
export default function App() {
|
|
145
|
+
return (
|
|
146
|
+
<>
|
|
147
|
+
<WrappedEoDescriptions layout="horizontal" list={items} />
|
|
148
|
+
<WrappedEoDivider dividerStyle={{ margin: "8px 0 4px 0" }} />
|
|
149
|
+
<WrappedEoDescriptions layout="vertical" list={items} />
|
|
150
|
+
<div style={{ margin: "10px 0px" }} />
|
|
151
|
+
</>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Bordered
|
|
157
|
+
|
|
158
|
+
`bordered` 为 `true` 时,列表项添加边框线,标签后不显示冒号。
|
|
159
|
+
|
|
160
|
+
```tsx preview
|
|
161
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
162
|
+
|
|
163
|
+
const tagList = [
|
|
164
|
+
{ text: "阳光", key: 0, color: "blue" },
|
|
165
|
+
{ text: "开朗", key: 1, color: "red" },
|
|
166
|
+
{ text: "大男孩", key: 2, color: "green" },
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
const items = [
|
|
170
|
+
{ label: "姓名", text: "Tom" },
|
|
171
|
+
{ label: "年龄", text: 18 },
|
|
172
|
+
{ label: "身高", text: "180cm" },
|
|
173
|
+
{ label: "爱好", text: "篮球" },
|
|
174
|
+
{
|
|
175
|
+
label: "标签",
|
|
176
|
+
useBrick: [{ brick: "eo-tag-list", properties: { list: tagList } }],
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
export default function App() {
|
|
181
|
+
return (
|
|
182
|
+
<>
|
|
183
|
+
<WrappedEoDescriptions bordered layout="vertical" list={items} />
|
|
184
|
+
<div style={{ margin: "10px 0px" }} />
|
|
185
|
+
<WrappedEoDescriptions bordered layout="horizontal" list={items} />
|
|
186
|
+
</>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Hide Groups
|
|
192
|
+
|
|
193
|
+
通过 `hideGroups` 隐藏指定 group 的所有描述项,支持单个字符串或字符串数组。
|
|
194
|
+
|
|
195
|
+
```tsx preview
|
|
196
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
197
|
+
|
|
198
|
+
export default function App() {
|
|
199
|
+
return (
|
|
200
|
+
<>
|
|
201
|
+
<WrappedEoDescriptions
|
|
202
|
+
hideGroups="other"
|
|
203
|
+
list={[
|
|
204
|
+
{ label: "姓名", text: "Tom" },
|
|
205
|
+
{ label: "年龄", text: 18 },
|
|
206
|
+
{ label: "身高", text: "180cm" },
|
|
207
|
+
{ label: "爱好", text: "篮球", group: "other" },
|
|
208
|
+
{
|
|
209
|
+
label: "标签",
|
|
210
|
+
group: "other",
|
|
211
|
+
useBrick: [
|
|
212
|
+
{
|
|
213
|
+
brick: "eo-tag-list",
|
|
214
|
+
properties: {
|
|
215
|
+
list: [
|
|
216
|
+
{ text: "阳光", key: 0, color: "blue" },
|
|
217
|
+
{ text: "开朗", key: 1, color: "red" },
|
|
218
|
+
{ text: "大男孩", key: 2, color: "green" },
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
},
|
|
224
|
+
]}
|
|
225
|
+
/>
|
|
226
|
+
<div style={{ margin: "10px 0px" }} />
|
|
227
|
+
<WrappedEoDescriptions
|
|
228
|
+
hideGroups={["name", "other"]}
|
|
229
|
+
list={[
|
|
230
|
+
{ label: "姓名", text: "Tom", group: "name" },
|
|
231
|
+
{ label: "年龄", text: 18, group: "age" },
|
|
232
|
+
{ label: "身高", text: "180cm" },
|
|
233
|
+
{ label: "爱好", text: "篮球", group: "other" },
|
|
234
|
+
{
|
|
235
|
+
label: "标签",
|
|
236
|
+
useBrick: [
|
|
237
|
+
{
|
|
238
|
+
brick: "eo-tag-list",
|
|
239
|
+
properties: {
|
|
240
|
+
list: [
|
|
241
|
+
{ text: "阳光", key: 0, color: "blue" },
|
|
242
|
+
{ text: "开朗", key: 1, color: "red" },
|
|
243
|
+
{ text: "大男孩", key: 2, color: "green" },
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
]}
|
|
250
|
+
/>
|
|
251
|
+
</>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### DataSource
|
|
257
|
+
|
|
258
|
+
通过 `dataSource` 提供数据源,list 项可用 `field` 读取字段,也可在 `useBrick` 中通过 `DATA` 引用整个数据源。
|
|
259
|
+
|
|
260
|
+
```tsx preview
|
|
261
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
262
|
+
|
|
263
|
+
export default function App() {
|
|
264
|
+
return (
|
|
265
|
+
<WrappedEoDescriptions
|
|
266
|
+
dataSource={{ text: "Hello world", name: "Tom" }}
|
|
267
|
+
list={[
|
|
268
|
+
{ label: "姓名", field: "name" },
|
|
269
|
+
{ label: "年龄", text: 18 },
|
|
270
|
+
{ label: "身高", text: "180cm" },
|
|
271
|
+
{ label: "爱好", text: "篮球" },
|
|
272
|
+
{
|
|
273
|
+
label: "Form dataSource",
|
|
274
|
+
useBrick: {
|
|
275
|
+
brick: "div",
|
|
276
|
+
properties: { textContent: "<% DATA.text %>" },
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
]}
|
|
280
|
+
/>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Template Columns
|
|
286
|
+
|
|
287
|
+
通过 `templateColumns` 精确控制各列宽度,list 项可用 `gridColumn` 跨列显示。
|
|
288
|
+
|
|
289
|
+
```tsx preview
|
|
290
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
291
|
+
|
|
292
|
+
export default function App() {
|
|
293
|
+
return (
|
|
294
|
+
<WrappedEoDescriptions
|
|
295
|
+
templateColumns="200px 1fr 2fr"
|
|
296
|
+
list={[
|
|
297
|
+
{ label: "姓名", text: "Tom" },
|
|
298
|
+
{ label: "年龄", text: 18 },
|
|
299
|
+
{ label: "备注", text: "这是一段较长的备注信息", gridColumn: "2 / 4" },
|
|
300
|
+
]}
|
|
301
|
+
/>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Theme Variant Elevo
|
|
307
|
+
|
|
308
|
+
`themeVariant` 为 `elevo` 时,不渲染外层卡片,适用于 AI 门户等特殊背景场景。
|
|
309
|
+
|
|
310
|
+
```tsx preview
|
|
311
|
+
import { WrappedEoDescriptions } from "@easyops/wrapped-components";
|
|
312
|
+
|
|
313
|
+
export default function App() {
|
|
314
|
+
return (
|
|
315
|
+
<div style={{ padding: "2em", backgroundColor: "#d8d8d8" }}>
|
|
316
|
+
<WrappedEoDescriptions
|
|
317
|
+
themeVariant="elevo"
|
|
318
|
+
column={1}
|
|
319
|
+
list={[
|
|
320
|
+
{ label: "姓名", text: "Tom" },
|
|
321
|
+
{ label: "年龄", text: 18 },
|
|
322
|
+
{ label: "身高", text: "180cm" },
|
|
323
|
+
{ label: "爱好", text: "篮球" },
|
|
324
|
+
]}
|
|
325
|
+
/>
|
|
326
|
+
</div>
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
```
|