@next-bricks/advanced 0.51.2 → 0.51.4
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/4758.703acb39.js +3 -0
- package/dist/chunks/4758.703acb39.js.map +1 -0
- package/dist/chunks/{6070.74d93326.js → 7039.0ea489d5.js} +2 -2
- package/dist/chunks/7039.0ea489d5.js.map +1 -0
- package/dist/chunks/8382.eba253d7.js +2 -0
- package/dist/chunks/8382.eba253d7.js.map +1 -0
- package/dist/chunks/eo-cascader.b5d6ee02.js +2 -0
- package/dist/chunks/eo-cascader.b5d6ee02.js.map +1 -0
- package/dist/chunks/eo-next-table.25f4bf4d.js.map +1 -1
- package/dist/chunks/eo-table.5dd09651.js.map +1 -1
- package/dist/chunks/eo-text-tooltip.74db365e.js.map +1 -1
- package/dist/chunks/eo-tree-select.4034b1d9.js +2 -0
- package/dist/chunks/eo-tree-select.4034b1d9.js.map +1 -0
- package/dist/chunks/eo-tree.22180778.js.map +1 -1
- package/dist/chunks/eo-workbench-layout-v2.24da89e7.js.map +1 -1
- package/dist/chunks/eo-workbench-layout.1ed8ce80.js.map +1 -1
- package/dist/chunks/{main.f43a8ad8.js → main.6b40d042.js} +2 -2
- package/dist/chunks/{main.f43a8ad8.js.map → main.6b40d042.js.map} +1 -1
- package/dist/chunks/pdf-viewer.036787d7.js.map +1 -1
- package/dist/examples.json +13 -7
- package/dist/{index.d1112026.js → index.6f2baf4a.js} +2 -2
- package/dist/{index.d1112026.js.map → index.6f2baf4a.js.map} +1 -1
- package/dist/manifest.json +145 -52
- package/dist/types.json +466 -414
- package/dist-types/cascader/index.d.ts +23 -4
- package/dist-types/next-table/index.d.ts +43 -29
- package/dist-types/pdf-viewer/index.d.ts +7 -1
- package/dist-types/table/index.d.ts +31 -26
- package/dist-types/text-tooltip/index.d.ts +5 -4
- package/dist-types/tree/index.d.ts +12 -0
- package/dist-types/tree-select/index.d.ts +41 -1
- package/dist-types/workbench-layout/index.d.ts +26 -1
- package/dist-types/workbench-layout-v2/index.d.ts +31 -9
- package/docs/eo-cascader.md +184 -1
- package/docs/eo-cascader.react.md +247 -0
- package/docs/eo-next-table.md +343 -168
- package/docs/eo-next-table.react.md +923 -0
- package/docs/eo-table.md +296 -0
- package/docs/eo-table.react.md +223 -0
- package/docs/eo-text-tooltip.md +46 -1
- package/docs/eo-text-tooltip.react.md +69 -0
- package/docs/eo-tree-select.md +127 -1
- package/docs/eo-tree-select.react.md +206 -0
- package/docs/eo-tree.md +108 -2
- package/docs/eo-tree.react.md +220 -0
- package/docs/eo-workbench-layout-v2.md +204 -0
- package/docs/eo-workbench-layout-v2.react.md +162 -0
- package/docs/eo-workbench-layout.md +45 -3
- package/docs/eo-workbench-layout.react.md +141 -0
- package/docs/pdf-viewer.md +48 -1
- package/docs/pdf-viewer.react.md +63 -0
- package/package.json +2 -2
- package/dist/chunks/4758.5f79e636.js +0 -3
- package/dist/chunks/4758.5f79e636.js.map +0 -1
- package/dist/chunks/6070.74d93326.js.map +0 -1
- package/dist/chunks/8382.d552299f.js +0 -2
- package/dist/chunks/8382.d552299f.js.map +0 -1
- package/dist/chunks/eo-cascader.86a685ca.js +0 -2
- package/dist/chunks/eo-cascader.86a685ca.js.map +0 -1
- package/dist/chunks/eo-tree-select.31dae71f.js +0 -2
- package/dist/chunks/eo-tree-select.31dae71f.js.map +0 -1
- /package/dist/chunks/{4758.5f79e636.js.LICENSE.txt → 4758.703acb39.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-tree
|
|
3
|
+
displayName: WrappedEoTree
|
|
4
|
+
description: 树形构件
|
|
5
|
+
category: display
|
|
6
|
+
source: "@next-bricks/advanced"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedEoTree
|
|
10
|
+
|
|
11
|
+
> 树形构件
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedEoTree } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| ---------------- | ---------------------------------- | ---- | ------ | ------------------------------------------------------------------------------- |
|
|
23
|
+
| dataSource | `TreeNode[]` | 否 | - | 树形数据源 |
|
|
24
|
+
| checkable | `boolean` | 否 | - | 是否显示 Checkbox,开启后可勾选节点 |
|
|
25
|
+
| selectable | `boolean` | 否 | - | 是否可选中节点 |
|
|
26
|
+
| defaultExpandAll | `boolean` | 否 | - | 是否默认展开所有树节点 |
|
|
27
|
+
| showLine | `boolean` | 否 | - | 是否显示连接线 |
|
|
28
|
+
| expandedKeys | `TreeNodeKey[]` | 否 | - | 受控展开的节点 key 集合 |
|
|
29
|
+
| checkedKeys | `TreeNodeKey[]` | 否 | - | 受控勾选的节点 key 集合(仅在 checkable 为 true 时有效) |
|
|
30
|
+
| nodeDraggable | `boolean \| { icon?: false }` | 否 | - | 是否允许拖拽节点,也可传入对象配置是否显示拖拽图标 |
|
|
31
|
+
| switcherIcon | `"auto" \| "chevron" \| false` | 否 | - | 自定义展开/折叠图标,可选 auto(默认箭头)、chevron(下箭头)或 false(不显示) |
|
|
32
|
+
| allowDrop | `(info: AllowDropInfo) => boolean` | 否 | - | 是否允许拖放到指定位置的判断函数 |
|
|
33
|
+
| titleSuffixBrick | `{ useBrick: UseBrickConf }` | 否 | - | 节点标题后缀插槽,通过 useBrick 在每个节点标题后渲染自定义构件 |
|
|
34
|
+
|
|
35
|
+
## Events
|
|
36
|
+
|
|
37
|
+
| 事件 | detail | 说明 |
|
|
38
|
+
| ------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
|
|
39
|
+
| onCheck | `TreeNodeKey[]` — 所有勾选节点的 key 数组 | 勾选状态变化时触发 |
|
|
40
|
+
| onCheckDetail | `CheckDetail` — { checkedKeys: 已勾选的节点 key 数组, halfCheckedKeys: 半选中的节点 key 数组 } | 勾选状态变化时触发,包含半选中状态 |
|
|
41
|
+
| onExpand | `TreeNodeKey[]` — 当前展开的节点 key 数组 | 展开/折叠节点时触发 |
|
|
42
|
+
| onNodeDrop | `DropDetail` — { dragNode: 被拖拽的节点, dropNode: 放置目标节点, dropPosition: 放置位置(0 表示内部,-1 表示上方,1 表示下方) } | 节点拖拽放置时触发 |
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
### Basic
|
|
47
|
+
|
|
48
|
+
展示树形构件的基本用法,默认展开所有节点。
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<WrappedEoTree
|
|
52
|
+
defaultExpandAll={true}
|
|
53
|
+
dataSource={[
|
|
54
|
+
{
|
|
55
|
+
title: "parent 1",
|
|
56
|
+
key: "0-0",
|
|
57
|
+
children: [
|
|
58
|
+
{
|
|
59
|
+
title: "parent 1-0",
|
|
60
|
+
key: "0-0-0",
|
|
61
|
+
children: [
|
|
62
|
+
{ title: "leaf", key: "0-0-0-0" },
|
|
63
|
+
{ title: "leaf", key: "0-0-0-1" },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: "parent 1-1",
|
|
68
|
+
key: "0-0-1",
|
|
69
|
+
children: [{ title: "sss", key: "0-0-1-0" }],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
]}
|
|
74
|
+
/>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Checkable
|
|
78
|
+
|
|
79
|
+
开启 checkable 显示勾选框,并配置 showLine 显示连接线,勾选变化时触发 onCheck 事件。
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<WrappedEoTree
|
|
83
|
+
defaultExpandAll={true}
|
|
84
|
+
checkable={true}
|
|
85
|
+
selectable={false}
|
|
86
|
+
showLine={true}
|
|
87
|
+
switcherIcon="chevron"
|
|
88
|
+
dataSource={[
|
|
89
|
+
{
|
|
90
|
+
title: "parent 1",
|
|
91
|
+
key: "0-0",
|
|
92
|
+
children: [
|
|
93
|
+
{
|
|
94
|
+
title: "parent 1-0",
|
|
95
|
+
key: "0-0-0",
|
|
96
|
+
children: [
|
|
97
|
+
{ title: "leaf", key: "0-0-0-0" },
|
|
98
|
+
{ title: "leaf", key: "0-0-0-1" },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
title: "parent 1-1",
|
|
103
|
+
key: "0-0-1",
|
|
104
|
+
children: [{ title: "sss", key: "0-0-1-0" }],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
]}
|
|
109
|
+
onCheck={(e) => console.log(e.detail)}
|
|
110
|
+
onCheckDetail={(e) => console.log(e.detail)}
|
|
111
|
+
/>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Title Suffix Brick
|
|
115
|
+
|
|
116
|
+
通过 titleSuffixBrick 在每个节点标题后渲染自定义构件。
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
<WrappedEoTree
|
|
120
|
+
defaultExpandAll={true}
|
|
121
|
+
titleSuffixBrick={{
|
|
122
|
+
useBrick: {
|
|
123
|
+
brick: "eo-link",
|
|
124
|
+
properties: {
|
|
125
|
+
icon: { lib: "antd", icon: "edit", theme: "outlined" },
|
|
126
|
+
style: { marginLeft: "5px", fontSize: "12px" },
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
}}
|
|
130
|
+
dataSource={[
|
|
131
|
+
{
|
|
132
|
+
title: "parent 1",
|
|
133
|
+
key: "0-0",
|
|
134
|
+
children: [
|
|
135
|
+
{
|
|
136
|
+
title: "parent 1-0",
|
|
137
|
+
key: "0-0-0",
|
|
138
|
+
children: [
|
|
139
|
+
{ title: "leaf", key: "0-0-0-0" },
|
|
140
|
+
{ title: "leaf", key: "0-0-0-1" },
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: "parent 1-1",
|
|
145
|
+
key: "0-0-1",
|
|
146
|
+
children: [{ title: "sss", key: "0-0-1-0" }],
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
]}
|
|
151
|
+
/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Draggable
|
|
155
|
+
|
|
156
|
+
开启 nodeDraggable 允许拖拽节点,拖拽放置后触发 onNodeDrop 事件。
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
<WrappedEoTree
|
|
160
|
+
defaultExpandAll={true}
|
|
161
|
+
nodeDraggable={true}
|
|
162
|
+
dataSource={[
|
|
163
|
+
{
|
|
164
|
+
title: "parent 1",
|
|
165
|
+
key: "0-0",
|
|
166
|
+
children: [
|
|
167
|
+
{
|
|
168
|
+
title: "parent 1-0",
|
|
169
|
+
key: "0-0-0",
|
|
170
|
+
children: [
|
|
171
|
+
{ title: "leaf", key: "0-0-0-0" },
|
|
172
|
+
{ title: "leaf", key: "0-0-0-1" },
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
title: "parent 1-1",
|
|
177
|
+
key: "0-0-1",
|
|
178
|
+
children: [{ title: "sss", key: "0-0-1-0" }],
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
]}
|
|
183
|
+
onNodeDrop={(e) => console.log(e.detail)}
|
|
184
|
+
/>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Controlled Expand and Check
|
|
188
|
+
|
|
189
|
+
通过 expandedKeys 和 checkedKeys 受控管理展开与勾选状态,并监听 onExpand 事件。
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<WrappedEoTree
|
|
193
|
+
checkable={true}
|
|
194
|
+
expandedKeys={["0-0"]}
|
|
195
|
+
checkedKeys={["0-0-0-0"]}
|
|
196
|
+
dataSource={[
|
|
197
|
+
{
|
|
198
|
+
title: "parent 1",
|
|
199
|
+
key: "0-0",
|
|
200
|
+
children: [
|
|
201
|
+
{
|
|
202
|
+
title: "parent 1-0",
|
|
203
|
+
key: "0-0-0",
|
|
204
|
+
children: [
|
|
205
|
+
{ title: "leaf", key: "0-0-0-0" },
|
|
206
|
+
{ title: "leaf", key: "0-0-0-1" },
|
|
207
|
+
],
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
title: "parent 1-1",
|
|
211
|
+
key: "0-0-1",
|
|
212
|
+
children: [{ title: "sss", key: "0-0-1-0" }],
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
]}
|
|
217
|
+
onExpand={(e) => console.log(e.detail)}
|
|
218
|
+
onCheck={(e) => console.log(e.detail)}
|
|
219
|
+
/>
|
|
220
|
+
```
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-workbench-layout-v2
|
|
3
|
+
displayName: WrappedEoWorkbenchLayoutV2
|
|
4
|
+
description: 工作台布局 V2,支持拖拽式卡片布局与全局样式(不使用 shadow DOM)
|
|
5
|
+
category: layout
|
|
6
|
+
source: "@next-bricks/advanced"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# eo-workbench-layout-v2
|
|
10
|
+
|
|
11
|
+
> 工作台布局 V2,支持拖拽式卡片布局与全局样式(不使用 shadow DOM)
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| -------------------------- | ------------------------------------ | ---- | ------ | ------------------------------------------------------------ |
|
|
17
|
+
| cardTitle | `string` | 否 | - | 编辑模式下左侧卡片列表面板的标题 |
|
|
18
|
+
| isEdit | `boolean` | 否 | - | 是否进入编辑模式,编辑模式下可拖拽调整布局并显示卡片选择面板 |
|
|
19
|
+
| layouts | `ExtraLayout[]` | 否 | - | 当前布局配置,每项对应一个卡片的位置与大小及样式信息 |
|
|
20
|
+
| toolbarBricks | `{ useBrick: UseSingleBrickConf[] }` | 否 | - | 编辑模式下工具栏区域的自定义构件 |
|
|
21
|
+
| componentList | `WorkbenchComponent[]` | 否 | - | 组件列表,每项包含 key、title、useBrick 和 position 信息 |
|
|
22
|
+
| customDefaultCardConfigMap | `Record<string, CardStyleConfig>` | 否 | - | 自定义卡片默认配置,用于覆盖默认卡片样式配置 |
|
|
23
|
+
| showSettingButton | `boolean` | 否 | - | 是否显示设置按钮,用于触发页面样式和布局设置 |
|
|
24
|
+
| gap | `number` | 否 | - | 卡片之间的间距(px) |
|
|
25
|
+
|
|
26
|
+
## Events
|
|
27
|
+
|
|
28
|
+
| 事件 | detail | 说明 |
|
|
29
|
+
| ------------ | --------------------------------------------------------------------------------------------------- | ------------------------------ |
|
|
30
|
+
| change | `ExtraLayout[]` — 当前布局配置数组 | 布局发生变化时触发 |
|
|
31
|
+
| save | `ExtraLayout[]` — 保存时的布局配置数组 | 点击保存按钮时触发 |
|
|
32
|
+
| cancel | `void` | 点击取消按钮时触发 |
|
|
33
|
+
| setting | `void` | 点击设置按钮时触发 |
|
|
34
|
+
| action.click | `{ action: SimpleAction; layouts: Layout[] }` — { action: 点击的操作项, layouts: 当前布局配置数组 } | 更多操作菜单中的操作点击时触发 |
|
|
35
|
+
|
|
36
|
+
## Methods
|
|
37
|
+
|
|
38
|
+
| 方法 | 参数 | 返回值 | 说明 |
|
|
39
|
+
| ---------- | ----------------------------- | ------ | ------------ |
|
|
40
|
+
| setLayouts | `(layouts: Layout[]) => void` | `void` | 设置布局配置 |
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
### Basic
|
|
45
|
+
|
|
46
|
+
展示工作台布局 V2 的基本用法,通过 layouts 和 componentList 配置卡片布局。
|
|
47
|
+
|
|
48
|
+
```yaml preview
|
|
49
|
+
- brick: eo-workbench-layout-v2
|
|
50
|
+
properties:
|
|
51
|
+
layouts:
|
|
52
|
+
- i: hello
|
|
53
|
+
x: 0
|
|
54
|
+
y: 0
|
|
55
|
+
w: 2
|
|
56
|
+
h: 1
|
|
57
|
+
type: hello
|
|
58
|
+
cardWidth: 2
|
|
59
|
+
- i: world
|
|
60
|
+
x: 0
|
|
61
|
+
y: 1
|
|
62
|
+
w: 2
|
|
63
|
+
h: 1
|
|
64
|
+
type: world
|
|
65
|
+
cardWidth: 2
|
|
66
|
+
- i: small
|
|
67
|
+
x: 2
|
|
68
|
+
y: 0
|
|
69
|
+
w: 1
|
|
70
|
+
h: 1
|
|
71
|
+
type: small
|
|
72
|
+
cardWidth: 1
|
|
73
|
+
componentList:
|
|
74
|
+
- title: Hello 卡片
|
|
75
|
+
key: hello
|
|
76
|
+
position:
|
|
77
|
+
i: hello
|
|
78
|
+
x: 0
|
|
79
|
+
y: 0
|
|
80
|
+
w: 2
|
|
81
|
+
h: 1
|
|
82
|
+
useBrick:
|
|
83
|
+
brick: div
|
|
84
|
+
properties:
|
|
85
|
+
style:
|
|
86
|
+
padding: 16px
|
|
87
|
+
background: "#fff"
|
|
88
|
+
height: 100%
|
|
89
|
+
textContent: Hello World
|
|
90
|
+
- title: World 卡片
|
|
91
|
+
key: world
|
|
92
|
+
position:
|
|
93
|
+
i: world
|
|
94
|
+
x: 0
|
|
95
|
+
y: 2
|
|
96
|
+
w: 2
|
|
97
|
+
h: 1
|
|
98
|
+
useBrick:
|
|
99
|
+
brick: div
|
|
100
|
+
properties:
|
|
101
|
+
style:
|
|
102
|
+
padding: 16px
|
|
103
|
+
background: "#fff"
|
|
104
|
+
height: 100%
|
|
105
|
+
textContent: World Content
|
|
106
|
+
- title: Small 卡片
|
|
107
|
+
key: small
|
|
108
|
+
position:
|
|
109
|
+
i: small
|
|
110
|
+
x: 2
|
|
111
|
+
y: 0
|
|
112
|
+
w: 1
|
|
113
|
+
h: 1
|
|
114
|
+
useBrick:
|
|
115
|
+
brick: div
|
|
116
|
+
properties:
|
|
117
|
+
style:
|
|
118
|
+
padding: 16px
|
|
119
|
+
background: "#fff"
|
|
120
|
+
height: 100%
|
|
121
|
+
textContent: Small
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Edit Mode with Settings
|
|
125
|
+
|
|
126
|
+
开启编辑模式,显示设置按钮,并监听 save、cancel、setting 事件。
|
|
127
|
+
|
|
128
|
+
```yaml preview
|
|
129
|
+
- brick: eo-workbench-layout-v2
|
|
130
|
+
events:
|
|
131
|
+
save:
|
|
132
|
+
- action: console.log
|
|
133
|
+
cancel:
|
|
134
|
+
- action: console.log
|
|
135
|
+
change:
|
|
136
|
+
- action: console.log
|
|
137
|
+
setting:
|
|
138
|
+
- action: console.log
|
|
139
|
+
properties:
|
|
140
|
+
isEdit: true
|
|
141
|
+
showSettingButton: true
|
|
142
|
+
gap: 16
|
|
143
|
+
layouts:
|
|
144
|
+
- i: hello
|
|
145
|
+
x: 0
|
|
146
|
+
y: 0
|
|
147
|
+
w: 2
|
|
148
|
+
h: 1
|
|
149
|
+
type: hello
|
|
150
|
+
cardWidth: 2
|
|
151
|
+
- i: small
|
|
152
|
+
x: 2
|
|
153
|
+
y: 0
|
|
154
|
+
w: 1
|
|
155
|
+
h: 1
|
|
156
|
+
type: small
|
|
157
|
+
cardWidth: 1
|
|
158
|
+
componentList:
|
|
159
|
+
- title: Hello 卡片
|
|
160
|
+
key: hello
|
|
161
|
+
position:
|
|
162
|
+
i: hello
|
|
163
|
+
x: 0
|
|
164
|
+
y: 0
|
|
165
|
+
w: 2
|
|
166
|
+
h: 1
|
|
167
|
+
useBrick:
|
|
168
|
+
brick: div
|
|
169
|
+
properties:
|
|
170
|
+
style:
|
|
171
|
+
padding: 16px
|
|
172
|
+
height: 100%
|
|
173
|
+
textContent: Hello World
|
|
174
|
+
- title: Small 卡片
|
|
175
|
+
key: small
|
|
176
|
+
position:
|
|
177
|
+
i: small
|
|
178
|
+
x: 2
|
|
179
|
+
y: 0
|
|
180
|
+
w: 1
|
|
181
|
+
h: 1
|
|
182
|
+
useBrick:
|
|
183
|
+
brick: div
|
|
184
|
+
properties:
|
|
185
|
+
style:
|
|
186
|
+
padding: 16px
|
|
187
|
+
height: 100%
|
|
188
|
+
textContent: Small
|
|
189
|
+
- title: Extra 卡片
|
|
190
|
+
key: extra
|
|
191
|
+
position:
|
|
192
|
+
i: extra
|
|
193
|
+
x: 0
|
|
194
|
+
y: 2
|
|
195
|
+
w: 2
|
|
196
|
+
h: 1
|
|
197
|
+
useBrick:
|
|
198
|
+
brick: div
|
|
199
|
+
properties:
|
|
200
|
+
style:
|
|
201
|
+
padding: 16px
|
|
202
|
+
height: 100%
|
|
203
|
+
textContent: Extra Content
|
|
204
|
+
```
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-workbench-layout-v2
|
|
3
|
+
displayName: WrappedEoWorkbenchLayoutV2
|
|
4
|
+
description: 工作台布局 V2,支持拖拽式卡片布局与全局样式(不使用 shadow DOM)
|
|
5
|
+
category: layout
|
|
6
|
+
source: "@next-bricks/advanced"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# WrappedEoWorkbenchLayoutV2
|
|
10
|
+
|
|
11
|
+
> 工作台布局 V2,支持拖拽式卡片布局与全局样式(不使用 shadow DOM)
|
|
12
|
+
|
|
13
|
+
## 导入
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { WrappedEoWorkbenchLayoutV2 } from "@easyops/wrapped-components";
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
22
|
+
| -------------------------- | ------------------------------------ | ---- | ------ | ------------------------------------------------------------ |
|
|
23
|
+
| cardTitle | `string` | 否 | - | 编辑模式下左侧卡片列表面板的标题 |
|
|
24
|
+
| isEdit | `boolean` | 否 | - | 是否进入编辑模式,编辑模式下可拖拽调整布局并显示卡片选择面板 |
|
|
25
|
+
| layouts | `ExtraLayout[]` | 否 | - | 当前布局配置,每项对应一个卡片的位置与大小及样式信息 |
|
|
26
|
+
| toolbarBricks | `{ useBrick: UseSingleBrickConf[] }` | 否 | - | 编辑模式下工具栏区域的自定义构件 |
|
|
27
|
+
| componentList | `WorkbenchComponent[]` | 否 | - | 组件列表,每项包含 key、title、useBrick 和 position 信息 |
|
|
28
|
+
| customDefaultCardConfigMap | `Record<string, CardStyleConfig>` | 否 | - | 自定义卡片默认配置,用于覆盖默认卡片样式配置 |
|
|
29
|
+
| showSettingButton | `boolean` | 否 | - | 是否显示设置按钮,用于触发页面样式和布局设置 |
|
|
30
|
+
| gap | `number` | 否 | - | 卡片之间的间距(px) |
|
|
31
|
+
|
|
32
|
+
## Events
|
|
33
|
+
|
|
34
|
+
| 事件 | detail | 说明 |
|
|
35
|
+
| ------------- | --------------------------------------------------------------------------------------------------- | ------------------------------ |
|
|
36
|
+
| onChange | `ExtraLayout[]` — 当前布局配置数组 | 布局发生变化时触发 |
|
|
37
|
+
| onSave | `ExtraLayout[]` — 保存时的布局配置数组 | 点击保存按钮时触发 |
|
|
38
|
+
| onCancel | `void` | 点击取消按钮时触发 |
|
|
39
|
+
| onSetting | `void` | 点击设置按钮时触发 |
|
|
40
|
+
| onActionClick | `{ action: SimpleAction; layouts: Layout[] }` — { action: 点击的操作项, layouts: 当前布局配置数组 } | 更多操作菜单中的操作点击时触发 |
|
|
41
|
+
|
|
42
|
+
## Methods
|
|
43
|
+
|
|
44
|
+
| 方法 | 参数 | 返回值 | 说明 |
|
|
45
|
+
| ---------- | ----------------------------- | ------ | ------------ |
|
|
46
|
+
| setLayouts | `(layouts: Layout[]) => void` | `void` | 设置布局配置 |
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
### Basic
|
|
51
|
+
|
|
52
|
+
展示工作台布局 V2 的基本用法,通过 layouts 和 componentList 配置卡片布局。
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
<WrappedEoWorkbenchLayoutV2
|
|
56
|
+
layouts={[
|
|
57
|
+
{ i: "hello", x: 0, y: 0, w: 2, h: 1, type: "hello", cardWidth: 2 },
|
|
58
|
+
{ i: "world", x: 0, y: 1, w: 2, h: 1, type: "world", cardWidth: 2 },
|
|
59
|
+
{ i: "small", x: 2, y: 0, w: 1, h: 1, type: "small", cardWidth: 1 },
|
|
60
|
+
]}
|
|
61
|
+
componentList={[
|
|
62
|
+
{
|
|
63
|
+
title: "Hello 卡片",
|
|
64
|
+
key: "hello",
|
|
65
|
+
position: { i: "hello", x: 0, y: 0, w: 2, h: 1 },
|
|
66
|
+
useBrick: {
|
|
67
|
+
brick: "div",
|
|
68
|
+
properties: {
|
|
69
|
+
style: { padding: "16px", height: "100%" },
|
|
70
|
+
textContent: "Hello World",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
title: "World 卡片",
|
|
76
|
+
key: "world",
|
|
77
|
+
position: { i: "world", x: 0, y: 2, w: 2, h: 1 },
|
|
78
|
+
useBrick: {
|
|
79
|
+
brick: "div",
|
|
80
|
+
properties: {
|
|
81
|
+
style: { padding: "16px", height: "100%" },
|
|
82
|
+
textContent: "World Content",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: "Small 卡片",
|
|
88
|
+
key: "small",
|
|
89
|
+
position: { i: "small", x: 2, y: 0, w: 1, h: 1 },
|
|
90
|
+
useBrick: {
|
|
91
|
+
brick: "div",
|
|
92
|
+
properties: {
|
|
93
|
+
style: { padding: "16px", height: "100%" },
|
|
94
|
+
textContent: "Small",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
]}
|
|
99
|
+
/>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Edit Mode with Settings
|
|
103
|
+
|
|
104
|
+
开启编辑模式,显示设置按钮,并监听 onSave、onCancel、onSetting 事件。
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
const ref = useRef<any>();
|
|
108
|
+
|
|
109
|
+
<WrappedEoWorkbenchLayoutV2
|
|
110
|
+
ref={ref}
|
|
111
|
+
isEdit={true}
|
|
112
|
+
showSettingButton={true}
|
|
113
|
+
gap={16}
|
|
114
|
+
layouts={[
|
|
115
|
+
{ i: "hello", x: 0, y: 0, w: 2, h: 1, type: "hello", cardWidth: 2 },
|
|
116
|
+
{ i: "small", x: 2, y: 0, w: 1, h: 1, type: "small", cardWidth: 1 },
|
|
117
|
+
]}
|
|
118
|
+
componentList={[
|
|
119
|
+
{
|
|
120
|
+
title: "Hello 卡片",
|
|
121
|
+
key: "hello",
|
|
122
|
+
position: { i: "hello", x: 0, y: 0, w: 2, h: 1 },
|
|
123
|
+
useBrick: {
|
|
124
|
+
brick: "div",
|
|
125
|
+
properties: {
|
|
126
|
+
style: { padding: "16px", height: "100%" },
|
|
127
|
+
textContent: "Hello World",
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
title: "Small 卡片",
|
|
133
|
+
key: "small",
|
|
134
|
+
position: { i: "small", x: 2, y: 0, w: 1, h: 1 },
|
|
135
|
+
useBrick: {
|
|
136
|
+
brick: "div",
|
|
137
|
+
properties: {
|
|
138
|
+
style: { padding: "16px", height: "100%" },
|
|
139
|
+
textContent: "Small",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
title: "Extra 卡片",
|
|
145
|
+
key: "extra",
|
|
146
|
+
position: { i: "extra", x: 0, y: 2, w: 2, h: 1 },
|
|
147
|
+
useBrick: {
|
|
148
|
+
brick: "div",
|
|
149
|
+
properties: {
|
|
150
|
+
style: { padding: "16px", height: "100%" },
|
|
151
|
+
textContent: "Extra Content",
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
]}
|
|
156
|
+
onChange={(e) => console.log(e.detail)}
|
|
157
|
+
onSave={(e) => console.log(e.detail)}
|
|
158
|
+
onCancel={() => console.log("cancel")}
|
|
159
|
+
onSetting={() => console.log("setting")}
|
|
160
|
+
onActionClick={(e) => console.log(e.detail)}
|
|
161
|
+
/>;
|
|
162
|
+
```
|
|
@@ -1,9 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
tagName: eo-workbench-layout
|
|
3
|
+
displayName: WrappedEoWorkbenchLayout
|
|
4
|
+
description: 工作台布局(拖拽式卡片布局,支持编辑模式)
|
|
5
|
+
category: layout
|
|
6
|
+
source: "@next-bricks/advanced"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# eo-workbench-layout
|
|
10
|
+
|
|
11
|
+
> 工作台布局(拖拽式卡片布局,支持编辑模式)。⚠️ 已废弃,请使用 `eo-workbench-layout-v2`。
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
16
|
+
| ------------- | ---------- | ---- | ------ | ------------------------------------------------------------ |
|
|
17
|
+
| cardTitle | `string` | 否 | - | 编辑模式下左侧卡片列表面板的标题 |
|
|
18
|
+
| isEdit | `boolean` | 否 | - | 是否进入编辑模式,编辑模式下可拖拽调整布局并显示卡片选择面板 |
|
|
19
|
+
| layouts | `Layout[]` | 否 | - | 当前布局配置,每项对应一个卡片的位置与大小 |
|
|
20
|
+
| componentList | `Item[]` | 否 | - | 组件列表,每项包含 key、title、useBrick 和 position 信息 |
|
|
21
|
+
|
|
22
|
+
## Events
|
|
23
|
+
|
|
24
|
+
| 事件 | detail | 说明 |
|
|
25
|
+
| ------------ | --------------------------------------------------------------------------------------------------- | ------------------ |
|
|
26
|
+
| change | `Layout[]` — 当前布局配置数组 | 布局发生变化时触发 |
|
|
27
|
+
| save | `Layout[]` — 保存时的布局配置数组 | 点击保存按钮时触发 |
|
|
28
|
+
| cancel | `void` | 点击取消按钮时触发 |
|
|
29
|
+
| action.click | `{ action: SimpleAction; layouts: Layout[] }` — { action: 点击的操作项, layouts: 当前布局配置数组 } | 操作点击事件 |
|
|
30
|
+
|
|
31
|
+
## Methods
|
|
32
|
+
|
|
33
|
+
| 方法 | 参数 | 返回值 | 说明 |
|
|
34
|
+
| ---------- | ----------------------------- | ------ | ------------ |
|
|
35
|
+
| setLayouts | `(layouts: Layout[]) => void` | `void` | 设置布局配置 |
|
|
2
36
|
|
|
3
37
|
## Examples
|
|
4
38
|
|
|
5
39
|
### Basic
|
|
6
40
|
|
|
41
|
+
展示工作台布局的基本用法,通过 layouts 和 componentList 配置卡片位置与内容。
|
|
42
|
+
|
|
7
43
|
```yaml preview
|
|
8
44
|
- brick: eo-workbench-layout
|
|
9
45
|
properties:
|
|
@@ -100,12 +136,18 @@
|
|
|
100
136
|
key: custom
|
|
101
137
|
```
|
|
102
138
|
|
|
103
|
-
### Edit
|
|
139
|
+
### Edit Mode
|
|
140
|
+
|
|
141
|
+
开启 isEdit 进入编辑模式,支持拖拽调整卡片位置,并监听 save 和 cancel 事件。
|
|
104
142
|
|
|
105
143
|
```yaml preview
|
|
106
144
|
- brick: eo-workbench-layout
|
|
107
145
|
events:
|
|
108
|
-
save
|
|
146
|
+
save:
|
|
147
|
+
- action: console.log
|
|
148
|
+
cancel:
|
|
149
|
+
- action: console.log
|
|
150
|
+
change:
|
|
109
151
|
- action: console.log
|
|
110
152
|
properties:
|
|
111
153
|
isEdit: true
|