@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
package/docs/eo-divider.md
CHANGED
|
@@ -1,54 +1,142 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-divider
|
|
3
|
+
displayName: WrappedEoDivider
|
|
4
|
+
description: 分割线
|
|
5
|
+
category: container-display
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# eo-divider
|
|
10
|
+
|
|
11
|
+
> 分割线
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| ------------ | ------------------------------------------- | ---- | -------------- | ---------------------------------------------------------------------- |
|
|
17
|
+
| orientation | `"left" \| "center" \| "right"` | 否 | `"center"` | 标题位置,在 `horizontal` 类型的分割线中使用 |
|
|
18
|
+
| dashed | `boolean` | 否 | `false` | 是否渲染为虚线 |
|
|
19
|
+
| type | `"horizontal" \| "vertical" \| "radiation"` | 否 | `"horizontal"` | 分割线类型:水平、垂直或放射。`radiation` 是特殊样式类型,外观固定 |
|
|
20
|
+
| proportion | `[number, number]` | 否 | - | 数值比例,仅在 `type="radiation"` 时生效。例如展示"1/3"时传入 `[1, 3]` |
|
|
21
|
+
| dividerStyle | `CSSProperties` | 否 | - | 分割线容器的自定义内联样式 |
|
|
2
22
|
|
|
3
23
|
## Examples
|
|
4
24
|
|
|
5
25
|
### Basic
|
|
6
26
|
|
|
27
|
+
水平分割线,无文字内容。
|
|
28
|
+
|
|
7
29
|
```yaml preview
|
|
8
30
|
- brick: eo-divider
|
|
9
31
|
```
|
|
10
32
|
|
|
11
33
|
### orientation
|
|
12
34
|
|
|
35
|
+
设置 `orientation` 控制插槽文字在水平分割线中的对齐位置。
|
|
36
|
+
|
|
13
37
|
```yaml preview
|
|
14
|
-
- brick:
|
|
38
|
+
- brick: div
|
|
15
39
|
properties:
|
|
16
|
-
|
|
17
|
-
|
|
40
|
+
style:
|
|
41
|
+
display: flex
|
|
42
|
+
flexDirection: column
|
|
43
|
+
gap: 8px
|
|
44
|
+
children:
|
|
45
|
+
- brick: eo-divider
|
|
46
|
+
properties:
|
|
47
|
+
orientation: left
|
|
48
|
+
children:
|
|
49
|
+
- brick: span
|
|
50
|
+
properties:
|
|
51
|
+
textContent: 左对齐
|
|
52
|
+
- brick: eo-divider
|
|
53
|
+
properties:
|
|
54
|
+
orientation: center
|
|
55
|
+
children:
|
|
56
|
+
- brick: span
|
|
57
|
+
properties:
|
|
58
|
+
textContent: 居中
|
|
59
|
+
- brick: eo-divider
|
|
60
|
+
properties:
|
|
61
|
+
orientation: right
|
|
62
|
+
children:
|
|
63
|
+
- brick: span
|
|
64
|
+
properties:
|
|
65
|
+
textContent: 右对齐
|
|
18
66
|
```
|
|
19
67
|
|
|
20
|
-
###
|
|
68
|
+
### dashed
|
|
69
|
+
|
|
70
|
+
启用 `dashed` 后分割线以虚线样式呈现。
|
|
21
71
|
|
|
22
72
|
```yaml preview
|
|
23
73
|
- brick: eo-divider
|
|
24
74
|
properties:
|
|
25
|
-
orientation: center
|
|
26
|
-
textContent: 基本
|
|
27
75
|
dashed: true
|
|
76
|
+
children:
|
|
77
|
+
- brick: span
|
|
78
|
+
properties:
|
|
79
|
+
textContent: 虚线分割
|
|
28
80
|
```
|
|
29
81
|
|
|
30
82
|
### type vertical
|
|
31
83
|
|
|
84
|
+
`type="vertical"` 用于行内元素之间的垂直分隔。
|
|
85
|
+
|
|
32
86
|
```yaml preview
|
|
33
|
-
- brick:
|
|
34
|
-
properties:
|
|
35
|
-
textContent: span1
|
|
36
|
-
- brick: eo-divider
|
|
37
|
-
properties:
|
|
38
|
-
type: vertical
|
|
39
|
-
- brick: span
|
|
87
|
+
- brick: div
|
|
40
88
|
properties:
|
|
41
|
-
|
|
89
|
+
style:
|
|
90
|
+
display: flex
|
|
91
|
+
alignItems: center
|
|
92
|
+
children:
|
|
93
|
+
- brick: span
|
|
94
|
+
properties:
|
|
95
|
+
textContent: 文本A
|
|
96
|
+
- brick: eo-divider
|
|
97
|
+
properties:
|
|
98
|
+
type: vertical
|
|
99
|
+
- brick: span
|
|
100
|
+
properties:
|
|
101
|
+
textContent: 文本B
|
|
102
|
+
- brick: eo-divider
|
|
103
|
+
properties:
|
|
104
|
+
type: vertical
|
|
105
|
+
dashed: true
|
|
106
|
+
- brick: span
|
|
107
|
+
properties:
|
|
108
|
+
textContent: 文本C
|
|
42
109
|
```
|
|
43
110
|
|
|
44
111
|
### type radiation
|
|
45
112
|
|
|
113
|
+
`type="radiation"` 配合 `proportion` 展示数值比例(如进度或占比)。
|
|
114
|
+
|
|
46
115
|
```yaml preview
|
|
47
116
|
- brick: eo-divider
|
|
48
117
|
properties:
|
|
49
118
|
type: radiation
|
|
50
|
-
textContent: 标题
|
|
51
119
|
proportion:
|
|
52
|
-
-
|
|
120
|
+
- 1
|
|
53
121
|
- 3
|
|
122
|
+
children:
|
|
123
|
+
- brick: span
|
|
124
|
+
properties:
|
|
125
|
+
textContent: 完成进度
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### dividerStyle
|
|
129
|
+
|
|
130
|
+
通过 `dividerStyle` 自定义分割线容器的内联样式。
|
|
131
|
+
|
|
132
|
+
```yaml preview
|
|
133
|
+
- brick: eo-divider
|
|
134
|
+
properties:
|
|
135
|
+
dividerStyle:
|
|
136
|
+
borderColor: "#1890ff"
|
|
137
|
+
margin: "16px 0"
|
|
138
|
+
children:
|
|
139
|
+
- brick: span
|
|
140
|
+
properties:
|
|
141
|
+
textContent: 自定义样式
|
|
54
142
|
```
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-divider
|
|
3
|
+
displayName: WrappedEoDivider
|
|
4
|
+
description: 分割线
|
|
5
|
+
category: container-display
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# eo-divider (React)
|
|
10
|
+
|
|
11
|
+
> 分割线
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| ------------ | ------------------------------------------- | ---- | -------------- | ---------------------------------------------------------------------- |
|
|
17
|
+
| orientation | `"left" \| "center" \| "right"` | 否 | `"center"` | 标题位置,在 `horizontal` 类型的分割线中使用 |
|
|
18
|
+
| dashed | `boolean` | 否 | `false` | 是否渲染为虚线 |
|
|
19
|
+
| type | `"horizontal" \| "vertical" \| "radiation"` | 否 | `"horizontal"` | 分割线类型:水平、垂直或放射。`radiation` 是特殊样式类型,外观固定 |
|
|
20
|
+
| proportion | `[number, number]` | 否 | - | 数值比例,仅在 `type="radiation"` 时生效。例如展示"1/3"时传入 `[1, 3]` |
|
|
21
|
+
| dividerStyle | `CSSProperties` | 否 | - | 分割线容器的自定义内联样式 |
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Basic
|
|
26
|
+
|
|
27
|
+
水平分割线,无文字内容。
|
|
28
|
+
|
|
29
|
+
```tsx preview
|
|
30
|
+
import { WrappedEoDivider } from "@next-bricks/presentational/eo-divider";
|
|
31
|
+
|
|
32
|
+
export function App() {
|
|
33
|
+
return <WrappedEoDivider />;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### orientation
|
|
38
|
+
|
|
39
|
+
设置 `orientation` 控制插槽文字在水平分割线中的对齐位置。
|
|
40
|
+
|
|
41
|
+
```tsx preview
|
|
42
|
+
import { WrappedEoDivider } from "@next-bricks/presentational/eo-divider";
|
|
43
|
+
|
|
44
|
+
export function App() {
|
|
45
|
+
return (
|
|
46
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
47
|
+
<WrappedEoDivider orientation="left">
|
|
48
|
+
<span>左对齐</span>
|
|
49
|
+
</WrappedEoDivider>
|
|
50
|
+
<WrappedEoDivider orientation="center">
|
|
51
|
+
<span>居中</span>
|
|
52
|
+
</WrappedEoDivider>
|
|
53
|
+
<WrappedEoDivider orientation="right">
|
|
54
|
+
<span>右对齐</span>
|
|
55
|
+
</WrappedEoDivider>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### dashed
|
|
62
|
+
|
|
63
|
+
启用 `dashed` 后分割线以虚线样式呈现。
|
|
64
|
+
|
|
65
|
+
```tsx preview
|
|
66
|
+
import { WrappedEoDivider } from "@next-bricks/presentational/eo-divider";
|
|
67
|
+
|
|
68
|
+
export function App() {
|
|
69
|
+
return (
|
|
70
|
+
<WrappedEoDivider dashed>
|
|
71
|
+
<span>虚线分割</span>
|
|
72
|
+
</WrappedEoDivider>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### type vertical
|
|
78
|
+
|
|
79
|
+
`type="vertical"` 用于行内元素之间的垂直分隔。
|
|
80
|
+
|
|
81
|
+
```tsx preview
|
|
82
|
+
import { WrappedEoDivider } from "@next-bricks/presentational/eo-divider";
|
|
83
|
+
|
|
84
|
+
export function App() {
|
|
85
|
+
return (
|
|
86
|
+
<div style={{ display: "flex", alignItems: "center" }}>
|
|
87
|
+
<span>文本A</span>
|
|
88
|
+
<WrappedEoDivider type="vertical" />
|
|
89
|
+
<span>文本B</span>
|
|
90
|
+
<WrappedEoDivider type="vertical" dashed />
|
|
91
|
+
<span>文本C</span>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### type radiation
|
|
98
|
+
|
|
99
|
+
`type="radiation"` 配合 `proportion` 展示数值比例(如进度或占比)。
|
|
100
|
+
|
|
101
|
+
```tsx preview
|
|
102
|
+
import { WrappedEoDivider } from "@next-bricks/presentational/eo-divider";
|
|
103
|
+
|
|
104
|
+
export function App() {
|
|
105
|
+
return (
|
|
106
|
+
<WrappedEoDivider type="radiation" proportion={[1, 3]}>
|
|
107
|
+
<span>完成进度</span>
|
|
108
|
+
</WrappedEoDivider>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### dividerStyle
|
|
114
|
+
|
|
115
|
+
通过 `dividerStyle` 自定义分割线容器的内联样式。
|
|
116
|
+
|
|
117
|
+
```tsx preview
|
|
118
|
+
import { WrappedEoDivider } from "@next-bricks/presentational/eo-divider";
|
|
119
|
+
|
|
120
|
+
export function App() {
|
|
121
|
+
return (
|
|
122
|
+
<WrappedEoDivider
|
|
123
|
+
dividerStyle={{ borderColor: "#1890ff", margin: "16px 0" }}
|
|
124
|
+
>
|
|
125
|
+
<span>自定义样式</span>
|
|
126
|
+
</WrappedEoDivider>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
```
|
package/docs/eo-humanize-time.md
CHANGED
|
@@ -1,73 +1,120 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-humanize-time
|
|
3
|
+
displayName: EoHumanizeTime
|
|
4
|
+
description: 人性化时间展示,可显示完整时间、相对时间、未来时间、耗时等,支持自定义输入值格式和输出格式。
|
|
5
|
+
category: ""
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# eo-humanize-time
|
|
10
|
+
|
|
11
|
+
> 人性化时间展示,可显示完整时间、相对时间、未来时间、耗时等,支持自定义输入值格式和输出格式。
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| ------------- | --------------------------------------------------------------------------------- | ---- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| value | `number \| string` | 是 | - | 时间戳(秒或毫秒,由 `isMillisecond` 决定),或时间字符串(字符串类型时应提供 `inputFormat`) |
|
|
18
|
+
| formatter | `"full" \| "default" \| "relative" \| "past" \| "future" \| "accurate" \| "auto"` | 否 | `"auto"` | 格式类型:`"full"` 完整时间、`"default"` 自动相对/完整、`"relative"` 相对时间(支持过去和未来)、`"past"` 仅过去相对时间、`"future"` 仅未来相对时间、`"accurate"` 精确耗时、`"auto"` 自动 |
|
|
19
|
+
| isMillisecond | `boolean` | 否 | `false` | `value` 值的单位是否为毫秒,默认将 `value` 视为秒级时间戳 |
|
|
20
|
+
| isCostTime | `boolean` | 否 | `false` | 是否展示为耗费时间,例如:'1 个月 20 天' |
|
|
21
|
+
| inputFormat | `string` | 否 | - | 字符串类型 `value` 的解析格式,如 `"YYYY-MM-DD"`,[时间格式参照表](https://momentjs.com/docs/#/parsing/string-format/) |
|
|
22
|
+
| outputFormat | `string` | 否 | - | 自定义输出格式,如 `"YYYY-MM-DD HH:mm:ss"`,设置后 `formatter` 属性无效,[时间格式参照表](https://momentjs.com/docs/#/displaying/format/) |
|
|
23
|
+
| type | `"datetime" \| "date"` | 否 | `"datetime"` | 使用日期+时间格式输出还是仅日期 |
|
|
24
|
+
| link | `LinkInfo` | 否 | - | 将时间显示为可点击链接,`LinkInfo` — { url: 链接地址, target: 打开方式 } |
|
|
25
|
+
| isMicrosecond | `boolean` | 否 | - | **已废弃**,请使用 `isMillisecond` |
|
|
2
26
|
|
|
3
27
|
## Examples
|
|
4
28
|
|
|
5
|
-
###
|
|
29
|
+
### Basic
|
|
30
|
+
|
|
31
|
+
使用默认格式展示一个秒级时间戳。
|
|
6
32
|
|
|
7
33
|
```yaml preview
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: 1714026348
|
|
34
|
+
brick: eo-humanize-time
|
|
35
|
+
properties:
|
|
36
|
+
value: 1714026348
|
|
12
37
|
```
|
|
13
38
|
|
|
14
|
-
###
|
|
39
|
+
### 完整时间
|
|
40
|
+
|
|
41
|
+
使用 `formatter: full` 展示精确的完整时间。
|
|
15
42
|
|
|
16
43
|
```yaml preview
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
44
|
+
brick: eo-humanize-time
|
|
45
|
+
properties:
|
|
46
|
+
formatter: full
|
|
47
|
+
value: 1714026348
|
|
21
48
|
```
|
|
22
49
|
|
|
23
|
-
###
|
|
50
|
+
### 精确时间
|
|
51
|
+
|
|
52
|
+
使用 `formatter: accurate` 展示精确的相对耗时。
|
|
24
53
|
|
|
25
54
|
```yaml preview
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
value: 1714026348000
|
|
55
|
+
brick: eo-humanize-time
|
|
56
|
+
properties:
|
|
57
|
+
formatter: accurate
|
|
58
|
+
value: 1714026348
|
|
31
59
|
```
|
|
32
60
|
|
|
33
|
-
###
|
|
61
|
+
### 相对时间
|
|
62
|
+
|
|
63
|
+
使用毫秒级时间戳和 `formatter: relative` 展示相对时间(如"3 天前")。
|
|
34
64
|
|
|
35
65
|
```yaml preview
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
66
|
+
brick: eo-humanize-time
|
|
67
|
+
properties:
|
|
68
|
+
formatter: relative
|
|
69
|
+
isMillisecond: true
|
|
70
|
+
value: 1714026348000
|
|
41
71
|
```
|
|
42
72
|
|
|
43
|
-
###
|
|
73
|
+
### 耗时展示
|
|
74
|
+
|
|
75
|
+
使用 `isCostTime` 将时间戳转换为易读的耗时格式(如"1 个月 20 天")。
|
|
44
76
|
|
|
45
77
|
```yaml preview
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
78
|
+
brick: eo-humanize-time
|
|
79
|
+
properties:
|
|
80
|
+
isCostTime: true
|
|
81
|
+
value: 1000
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 仅日期
|
|
85
|
+
|
|
86
|
+
使用 `type: date` 只展示日期部分,不展示时间。
|
|
87
|
+
|
|
88
|
+
```yaml preview
|
|
89
|
+
brick: eo-humanize-time
|
|
90
|
+
properties:
|
|
91
|
+
formatter: full
|
|
92
|
+
type: date
|
|
93
|
+
value: 1714026348
|
|
53
94
|
```
|
|
54
95
|
|
|
55
96
|
### 自定义格式
|
|
56
97
|
|
|
98
|
+
通过 `inputFormat` 解析字符串输入,通过 `outputFormat` 自定义展示格式。
|
|
99
|
+
|
|
57
100
|
```yaml preview
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
101
|
+
brick: eo-humanize-time
|
|
102
|
+
properties:
|
|
103
|
+
inputFormat: YYYY-MM-DD
|
|
104
|
+
outputFormat: LLL
|
|
105
|
+
value: "2020-02-27 16:36"
|
|
63
106
|
```
|
|
64
107
|
|
|
65
|
-
###
|
|
108
|
+
### 链接
|
|
109
|
+
|
|
110
|
+
设置 `link` 将时间文本渲染为可点击链接。
|
|
66
111
|
|
|
67
112
|
```yaml preview
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
113
|
+
brick: eo-humanize-time
|
|
114
|
+
properties:
|
|
115
|
+
formatter: full
|
|
116
|
+
link:
|
|
117
|
+
target: _blank
|
|
118
|
+
url: /aaa/bbb
|
|
119
|
+
value: 1714026348
|
|
73
120
|
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-humanize-time
|
|
3
|
+
displayName: WrappedEoHumanizeTime
|
|
4
|
+
description: 人性化时间展示,可显示完整时间、相对时间、未来时间、耗时等,支持自定义输入值格式和输出格式。
|
|
5
|
+
category: ""
|
|
6
|
+
source: "@next-bricks/presentational"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedEoHumanizeTime
|
|
10
|
+
|
|
11
|
+
> 人性化时间展示,可显示完整时间、相对时间、未来时间、耗时等,支持自定义输入值格式和输出格式。
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedEoHumanizeTime } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| ------------- | --------------------------------------------------------------------------------- | ---- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| value | `number \| string` | 是 | - | 时间戳(秒或毫秒,由 `isMillisecond` 决定),或时间字符串(字符串类型时应提供 `inputFormat`) |
|
|
24
|
+
| formatter | `"full" \| "default" \| "relative" \| "past" \| "future" \| "accurate" \| "auto"` | 否 | `"auto"` | 格式类型:`"full"` 完整时间、`"default"` 自动相对/完整、`"relative"` 相对时间(支持过去和未来)、`"past"` 仅过去相对时间、`"future"` 仅未来相对时间、`"accurate"` 精确耗时、`"auto"` 自动 |
|
|
25
|
+
| isMillisecond | `boolean` | 否 | `false` | `value` 值的单位是否为毫秒,默认将 `value` 视为秒级时间戳 |
|
|
26
|
+
| isCostTime | `boolean` | 否 | `false` | 是否展示为耗费时间,例如:'1 个月 20 天' |
|
|
27
|
+
| inputFormat | `string` | 否 | - | 字符串类型 `value` 的解析格式,如 `"YYYY-MM-DD"`,[时间格式参照表](https://momentjs.com/docs/#/parsing/string-format/) |
|
|
28
|
+
| outputFormat | `string` | 否 | - | 自定义输出格式,如 `"YYYY-MM-DD HH:mm:ss"`,设置后 `formatter` 属性无效,[时间格式参照表](https://momentjs.com/docs/#/displaying/format/) |
|
|
29
|
+
| type | `"datetime" \| "date"` | 否 | `"datetime"` | 使用日期+时间格式输出还是仅日期 |
|
|
30
|
+
| link | `LinkInfo` | 否 | - | 将时间显示为可点击链接,`LinkInfo` — { url: 链接地址, target: 打开方式 } |
|
|
31
|
+
| isMicrosecond | `boolean` | 否 | - | **已废弃**,请使用 `isMillisecond` |
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Basic
|
|
36
|
+
|
|
37
|
+
使用默认格式展示一个秒级时间戳。
|
|
38
|
+
|
|
39
|
+
```tsx preview
|
|
40
|
+
<WrappedEoHumanizeTime value={1714026348} />
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 完整时间
|
|
44
|
+
|
|
45
|
+
使用 `formatter="full"` 展示精确的完整时间。
|
|
46
|
+
|
|
47
|
+
```tsx preview
|
|
48
|
+
<WrappedEoHumanizeTime formatter="full" value={1714026348} />
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 精确时间
|
|
52
|
+
|
|
53
|
+
使用 `formatter="accurate"` 展示精确的相对耗时。
|
|
54
|
+
|
|
55
|
+
```tsx preview
|
|
56
|
+
<WrappedEoHumanizeTime formatter="accurate" value={1714026348} />
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 相对时间
|
|
60
|
+
|
|
61
|
+
使用毫秒级时间戳和 `formatter="relative"` 展示相对时间(如"3 天前")。
|
|
62
|
+
|
|
63
|
+
```tsx preview
|
|
64
|
+
<WrappedEoHumanizeTime
|
|
65
|
+
formatter="relative"
|
|
66
|
+
isMillisecond={true}
|
|
67
|
+
value={1714026348000}
|
|
68
|
+
/>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 耗时展示
|
|
72
|
+
|
|
73
|
+
使用 `isCostTime` 将时间戳转换为易读的耗时格式(如"1 个月 20 天")。
|
|
74
|
+
|
|
75
|
+
```tsx preview
|
|
76
|
+
<WrappedEoHumanizeTime isCostTime={true} value={1000} />
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 仅日期
|
|
80
|
+
|
|
81
|
+
使用 `type="date"` 只展示日期部分,不展示时间。
|
|
82
|
+
|
|
83
|
+
```tsx preview
|
|
84
|
+
<WrappedEoHumanizeTime formatter="full" type="date" value={1714026348} />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 自定义格式
|
|
88
|
+
|
|
89
|
+
通过 `inputFormat` 解析字符串输入,通过 `outputFormat` 自定义展示格式。
|
|
90
|
+
|
|
91
|
+
```tsx preview
|
|
92
|
+
<WrappedEoHumanizeTime
|
|
93
|
+
inputFormat="YYYY-MM-DD"
|
|
94
|
+
outputFormat="LLL"
|
|
95
|
+
value="2020-02-27 16:36"
|
|
96
|
+
/>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 链接
|
|
100
|
+
|
|
101
|
+
设置 `link` 将时间文本渲染为可点击链接。
|
|
102
|
+
|
|
103
|
+
```tsx preview
|
|
104
|
+
<WrappedEoHumanizeTime
|
|
105
|
+
formatter="full"
|
|
106
|
+
link={{ url: "/aaa/bbb", target: "_blank" }}
|
|
107
|
+
value={1714026348}
|
|
108
|
+
/>
|
|
109
|
+
```
|