@a2simcode/ui 0.0.220 → 0.0.221
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/components/input-rows/src/input-rows.vue.d.ts +4 -4
- package/dist/components/layer-form/index.d.ts +18 -3
- package/dist/components/layer-form/src/layer-form-content.vue.d.ts +43 -0
- package/dist/components/layer-form/src/layer-form.vue.d.ts +16 -1
- package/dist/components/table/index.d.ts +15 -0
- package/dist/components/table/src/layer-form-cell-content.vue.d.ts +52 -0
- package/dist/components/table/src/table.vue.d.ts +15 -0
- package/dist/simcode-ui.es.js +5910 -5771
- package/dist/simcode-ui.umd.js +2 -2
- package/dist/stats.html +1 -1
- package/docs/components/meta/table.ts +6 -0
- package/docs/components/table.md +30 -0
- package/docs/examples/table/layer-form.vue +133 -0
- package/docs/examples/table/row-drag.vue +67 -0
- package/package.json +1 -1
package/docs/components/table.md
CHANGED
|
@@ -68,6 +68,19 @@
|
|
|
68
68
|
</template>
|
|
69
69
|
</Demo>
|
|
70
70
|
|
|
71
|
+
## Layer Form 弹层表单
|
|
72
|
+
|
|
73
|
+
通过列类型 `j-layerform` 可以在单元格中渲染一个按钮,点击后打开弹层表单,表单内容复用 `j-layer-form` 的 `schema` 和 `formConfig` 配置方式。
|
|
74
|
+
|
|
75
|
+
<Demo :source-code="tableLayerFormCode">
|
|
76
|
+
<template #source>
|
|
77
|
+
<table-layer-form />
|
|
78
|
+
</template>
|
|
79
|
+
<template #description>
|
|
80
|
+
在 `columns` 中设置 `type: 'j-layerform'`,并通过 `config.schema`、`config.formConfig`、`config.layerLabel`、`config.layerWidth`、`config.layerHeight` 配置弹层表单。示例中编辑内容会直接同步当前行数据。
|
|
81
|
+
</template>
|
|
82
|
+
</Demo>
|
|
83
|
+
|
|
71
84
|
## Checkbox 交互布局
|
|
72
85
|
|
|
73
86
|
通过列类型 `checkbox` 可以渲染一个内置的交互布局:两行内容(like/collect + normal/special),点击会实时更新当前行的数据并刷新显示。
|
|
@@ -345,6 +358,19 @@
|
|
|
345
358
|
</template>
|
|
346
359
|
</Demo>
|
|
347
360
|
|
|
361
|
+
## 行拖动排序
|
|
362
|
+
|
|
363
|
+
通过 `row-drag` 属性开启行拖动排序。拖动列与序号列分开显示,拖动完成后会自动同步 `v-model`,并触发 `change` 事件,事件类型为 `sort`。
|
|
364
|
+
|
|
365
|
+
<Demo :source-code="tableRowDragCode">
|
|
366
|
+
<template #source>
|
|
367
|
+
<table-row-drag />
|
|
368
|
+
</template>
|
|
369
|
+
<template #description>
|
|
370
|
+
开启 <code>row-drag</code> 后,会新增独立的拖动列,序号列仍单独显示。示例中通过 <code>v-model</code> 直接展示拖动后的最新数据顺序。
|
|
371
|
+
</template>
|
|
372
|
+
</Demo>
|
|
373
|
+
|
|
348
374
|
## API
|
|
349
375
|
|
|
350
376
|
<ApiTable :data="tableApi" componentName="table" />
|
|
@@ -354,6 +380,7 @@ import TableBasic from '../examples/table/basic.vue'
|
|
|
354
380
|
import TableTag from '../examples/table/tag.vue'
|
|
355
381
|
import TableIcon from '../examples/table/icon.vue'
|
|
356
382
|
import TableLink from '../examples/table/link.vue'
|
|
383
|
+
import TableLayerForm from '../examples/table/layer-form.vue'
|
|
357
384
|
import TableDynamicType from '../examples/table/dynamic-type.vue'
|
|
358
385
|
import TableCheckboxLayout from '../examples/table/checkbox-layout.vue'
|
|
359
386
|
import TableCustomLayout from '../examples/table/custom-layout.vue'
|
|
@@ -375,12 +402,14 @@ import TableActions from '../examples/table/actions.vue'
|
|
|
375
402
|
import TableActionFilter from '../examples/table/action-filter.vue'
|
|
376
403
|
import TableEditable from '../examples/table/editable.vue'
|
|
377
404
|
import TableAddRow from '../examples/table/add-row.vue'
|
|
405
|
+
import TableRowDrag from '../examples/table/row-drag.vue'
|
|
378
406
|
import tableApi from './meta/table'
|
|
379
407
|
|
|
380
408
|
import tableBasicCode from '../examples/table/basic.vue?raw'
|
|
381
409
|
import tableTagCode from '../examples/table/tag.vue?raw'
|
|
382
410
|
import tableIconCode from '../examples/table/icon.vue?raw'
|
|
383
411
|
import tableLinkCode from '../examples/table/link.vue?raw'
|
|
412
|
+
import tableLayerFormCode from '../examples/table/layer-form.vue?raw'
|
|
384
413
|
import tableDynamicTypeCode from '../examples/table/dynamic-type.vue?raw'
|
|
385
414
|
import tableCheckboxLayoutCode from '../examples/table/checkbox-layout.vue?raw'
|
|
386
415
|
import tableCustomLayoutCode from '../examples/table/custom-layout.vue?raw'
|
|
@@ -402,4 +431,5 @@ import tableActionsCode from '../examples/table/actions.vue?raw'
|
|
|
402
431
|
import tableActionFilterCode from '../examples/table/action-filter.vue?raw'
|
|
403
432
|
import tableEditableCode from '../examples/table/editable.vue?raw'
|
|
404
433
|
import tableAddRowCode from '../examples/table/add-row.vue?raw'
|
|
434
|
+
import tableRowDragCode from '../examples/table/row-drag.vue?raw'
|
|
405
435
|
</script>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div style="position: relative; width: 100%; height: 360px">
|
|
4
|
+
<j-table :columns="columns" :records="records" />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<div style="margin-top: 16px">
|
|
8
|
+
<div style="margin-bottom: 8px; font-weight: 600">当前表格数据</div>
|
|
9
|
+
<pre
|
|
10
|
+
style="
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 12px;
|
|
13
|
+
background: #f7f8fa;
|
|
14
|
+
border-radius: 4px;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
"
|
|
17
|
+
>{{ JSON.stringify(records, null, 2) }}</pre>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { ref } from 'vue'
|
|
24
|
+
|
|
25
|
+
const columns = ref([
|
|
26
|
+
{
|
|
27
|
+
id: 'name',
|
|
28
|
+
config: {
|
|
29
|
+
label: '姓名',
|
|
30
|
+
width: 160,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'department',
|
|
35
|
+
config: {
|
|
36
|
+
label: '部门',
|
|
37
|
+
width: 160,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'phone',
|
|
42
|
+
config: {
|
|
43
|
+
label: '手机号',
|
|
44
|
+
width: 180,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'setting',
|
|
49
|
+
type: 'j-layerform',
|
|
50
|
+
config: {
|
|
51
|
+
label: '资料设置',
|
|
52
|
+
width: 120,
|
|
53
|
+
align: 'center',
|
|
54
|
+
buttonLabel: '编辑资料',
|
|
55
|
+
layerLabel: '编辑员工资料',
|
|
56
|
+
layerWidth: 640,
|
|
57
|
+
layerHeight: 320,
|
|
58
|
+
formConfig: {
|
|
59
|
+
labelWidth: 90,
|
|
60
|
+
labelPosition: 'right',
|
|
61
|
+
size: 'default',
|
|
62
|
+
gutter: 16,
|
|
63
|
+
span: 12,
|
|
64
|
+
},
|
|
65
|
+
schema: [
|
|
66
|
+
{
|
|
67
|
+
id: 'name',
|
|
68
|
+
type: 'j-input',
|
|
69
|
+
config: {
|
|
70
|
+
label: '姓名',
|
|
71
|
+
placeholder: '请输入姓名',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'department',
|
|
76
|
+
type: 'j-select',
|
|
77
|
+
config: {
|
|
78
|
+
label: '部门',
|
|
79
|
+
placeholder: '请选择部门',
|
|
80
|
+
dataType: 'options',
|
|
81
|
+
options: [
|
|
82
|
+
{ label: '研发部', value: '研发部' },
|
|
83
|
+
{ label: '产品部', value: '产品部' },
|
|
84
|
+
{ label: '运营部', value: '运营部' },
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'phone',
|
|
90
|
+
type: 'j-input',
|
|
91
|
+
config: {
|
|
92
|
+
label: '手机号',
|
|
93
|
+
placeholder: '请输入手机号',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'remark',
|
|
98
|
+
type: 'j-input',
|
|
99
|
+
config: {
|
|
100
|
+
label: '备注',
|
|
101
|
+
placeholder: '请输入备注',
|
|
102
|
+
span: 24,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
])
|
|
109
|
+
|
|
110
|
+
const records = ref([
|
|
111
|
+
{
|
|
112
|
+
id: '1',
|
|
113
|
+
name: '张三',
|
|
114
|
+
department: '研发部',
|
|
115
|
+
phone: '13800000001',
|
|
116
|
+
remark: '负责前端模块',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: '2',
|
|
120
|
+
name: '李四',
|
|
121
|
+
department: '产品部',
|
|
122
|
+
phone: '13800000002',
|
|
123
|
+
remark: '负责需求梳理',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: '3',
|
|
127
|
+
name: '王五',
|
|
128
|
+
department: '运营部',
|
|
129
|
+
phone: '13800000003',
|
|
130
|
+
remark: '负责活动投放',
|
|
131
|
+
},
|
|
132
|
+
])
|
|
133
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div style="height: 360px">
|
|
4
|
+
<j-table v-model="records" row-drag :columns="columns" />
|
|
5
|
+
</div>
|
|
6
|
+
<div style="margin-top: 16px">
|
|
7
|
+
<h3>当前顺序:</h3>
|
|
8
|
+
<pre>{{ records.map((item) => `${item.id} - ${item.name}`).join('\n') }}</pre>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { ref } from 'vue'
|
|
15
|
+
|
|
16
|
+
const columns = ref([
|
|
17
|
+
{
|
|
18
|
+
id: 'name',
|
|
19
|
+
config: {
|
|
20
|
+
label: '姓名',
|
|
21
|
+
width: 160,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'department',
|
|
26
|
+
config: {
|
|
27
|
+
label: '部门',
|
|
28
|
+
width: 160,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'score',
|
|
33
|
+
config: {
|
|
34
|
+
label: '绩效分',
|
|
35
|
+
width: 100,
|
|
36
|
+
align: 'right',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
const records = ref([
|
|
42
|
+
{
|
|
43
|
+
id: 'U001',
|
|
44
|
+
name: '张三',
|
|
45
|
+
department: '产品',
|
|
46
|
+
score: 95,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'U002',
|
|
50
|
+
name: '李四',
|
|
51
|
+
department: '研发',
|
|
52
|
+
score: 88,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'U003',
|
|
56
|
+
name: '王五',
|
|
57
|
+
department: '测试',
|
|
58
|
+
score: 91,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'U004',
|
|
62
|
+
name: '赵六',
|
|
63
|
+
department: '运营',
|
|
64
|
+
score: 84,
|
|
65
|
+
},
|
|
66
|
+
])
|
|
67
|
+
</script>
|