vue-super-crud 1.7.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/.browserslistrc +3 -0
- package/.versionrc.json +36 -0
- package/CHANGELOG.md +232 -0
- package/LICENSE +201 -0
- package/README.md +46 -0
- package/babel.config.js +12 -0
- package/build/alias.js +10 -0
- package/build/build.js +52 -0
- package/build/config.js +70 -0
- package/deploy.bat +14 -0
- package/docs/.vuepress/components/button/base.vue +88 -0
- package/docs/.vuepress/components/common/code-format.vue +331 -0
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +68 -0
- package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +73 -0
- package/docs/.vuepress/components/commonConfig/renderType/component.vue +160 -0
- package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +49 -0
- package/docs/.vuepress/components/commonConfig/renderType/render.vue +91 -0
- package/docs/.vuepress/components/commonConfig/renderType/slot.vue +63 -0
- package/docs/.vuepress/components/crud/baseUse/baseUse.vue +98 -0
- package/docs/.vuepress/components/crud/baseUse/columnAction.vue +72 -0
- package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +107 -0
- package/docs/.vuepress/components/crud/baseUse/handleRow.vue +65 -0
- package/docs/.vuepress/components/crud/baseUse/height.vue +82 -0
- package/docs/.vuepress/components/crud/baseUse/index.vue +54 -0
- package/docs/.vuepress/components/crud/baseUse/loading.vue +70 -0
- package/docs/.vuepress/components/crud/baseUse/pagination.vue +108 -0
- package/docs/.vuepress/components/crud/baseUse/selection.vue +114 -0
- package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +118 -0
- package/docs/.vuepress/components/crud/baseUse/title.vue +54 -0
- package/docs/.vuepress/components/crud/baseUse/toolbar.vue +69 -0
- package/docs/.vuepress/components/crud/buttons/common.vue +115 -0
- package/docs/.vuepress/components/crud/buttons/fast.vue +82 -0
- package/docs/.vuepress/components/crud/contextMenu/base.vue +72 -0
- package/docs/.vuepress/components/crud/copy.vue +52 -0
- package/docs/.vuepress/components/crud/crudEvents/api.vue +157 -0
- package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +93 -0
- package/docs/.vuepress/components/crud/crudEvents/events.vue +188 -0
- package/docs/.vuepress/components/crud/dataSort/base.vue +142 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +53 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +111 -0
- package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +68 -0
- package/docs/.vuepress/components/crud/handleBar/handleRow.vue +65 -0
- package/docs/.vuepress/components/crud/handleBar/toolbar.vue +69 -0
- package/docs/.vuepress/components/crud/renderType/1.vue +57 -0
- package/docs/.vuepress/components/crud/renderType/2.vue +63 -0
- package/docs/.vuepress/components/crud/renderType/3.vue +105 -0
- package/docs/.vuepress/components/crud/renderType/5.vue +91 -0
- package/docs/.vuepress/components/crud/search/1.vue +90 -0
- package/docs/.vuepress/components/crud/search/2.vue +78 -0
- package/docs/.vuepress/components/crud/search/3.vue +107 -0
- package/docs/.vuepress/components/crud/search/base.vue +123 -0
- package/docs/.vuepress/components/crud/search/localSearch.vue +124 -0
- package/docs/.vuepress/components/crud/search/special.vue +148 -0
- package/docs/.vuepress/components/crud/selection/events.vue +47 -0
- package/docs/.vuepress/components/crud/selection/pagination.vue +94 -0
- package/docs/.vuepress/components/crud/selection/singleSelection.vue +64 -0
- package/docs/.vuepress/components/crud/span/base.vue +69 -0
- package/docs/.vuepress/components/crud/span/special.vue +75 -0
- package/docs/.vuepress/components/crud/summary/base.vue +99 -0
- package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +174 -0
- package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +194 -0
- package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +219 -0
- package/docs/.vuepress/components/crud/tableEdit/dialog.vue +172 -0
- package/docs/.vuepress/components/crud/tableEdit/free.vue +88 -0
- package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +82 -0
- package/docs/.vuepress/components/crud/tableEdit/methods.vue +154 -0
- package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +107 -0
- package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +116 -0
- package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +98 -0
- package/docs/.vuepress/components/crud/validate/base.vue +122 -0
- package/docs/.vuepress/components/crud/validate/custom.vue +82 -0
- package/docs/.vuepress/components/crud/validate/regulars.vue +88 -0
- package/docs/.vuepress/components/crud/validate/relation.vue +91 -0
- package/docs/.vuepress/components/crud/validate/tree.vue +82 -0
- package/docs/.vuepress/components/dialog/baseUse/base.vue +92 -0
- package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +78 -0
- package/docs/.vuepress/components/dialog/baseUse/control.vue +79 -0
- package/docs/.vuepress/components/dialog/baseUse/drawer.vue +59 -0
- package/docs/.vuepress/components/dialog/baseUse/footer.vue +87 -0
- package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +79 -0
- package/docs/.vuepress/components/dict/DictLinkage.vue +91 -0
- package/docs/.vuepress/components/dict/baseUse.vue +72 -0
- package/docs/.vuepress/components/dict/component.vue +82 -0
- package/docs/.vuepress/components/dict/localDict.vue +68 -0
- package/docs/.vuepress/components/form/baseUse/base.vue +48 -0
- package/docs/.vuepress/components/form/baseUse/dataFormat.vue +92 -0
- package/docs/.vuepress/components/form/baseUse/deep.vue +57 -0
- package/docs/.vuepress/components/form/baseUse/gridLayout.vue +47 -0
- package/docs/.vuepress/components/form/baseUse/group.vue +66 -0
- package/docs/.vuepress/components/form/baseUse/hidden.vue +40 -0
- package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +48 -0
- package/docs/.vuepress/components/form/baseUse/label.vue +51 -0
- package/docs/.vuepress/components/form/baseUse/tooltip.vue +40 -0
- package/docs/.vuepress/components/form/baseUse/validate.vue +52 -0
- package/docs/.vuepress/components/form/detail/base.vue +78 -0
- package/docs/.vuepress/components/form/detail/border.vue +90 -0
- package/docs/.vuepress/components/form/detail/singleDetail.vue +72 -0
- package/docs/.vuepress/components/formatData/baseUse.vue +131 -0
- package/docs/.vuepress/components/mock/index.js +347 -0
- package/docs/.vuepress/components/mockData/custom.vue +69 -0
- package/docs/.vuepress/components/mockData/example.vue +290 -0
- package/docs/.vuepress/components/positionSlot/base.vue +24 -0
- package/docs/.vuepress/components/positionSlot/form.vue +71 -0
- package/docs/.vuepress/components/positionSlot/table.vue +85 -0
- package/docs/.vuepress/components/tabs/base.vue +57 -0
- package/docs/.vuepress/components/temp.js +195 -0
- package/docs/.vuepress/config.js +146 -0
- package/docs/.vuepress/enhanceApp.js +142 -0
- package/docs/.vuepress/public/favicon.ico +0 -0
- package/docs/.vuepress/public/super.png +0 -0
- package/docs/.vuepress/styles/index.styl +25 -0
- package/docs/.vuepress/styles/palette.styl +6 -0
- package/docs/README.md +14 -0
- package/docs/guide/button/base.md +31 -0
- package/docs/guide/commonConfig/jsx.md +166 -0
- package/docs/guide/commonConfig/presetCodeTemplate.md +68 -0
- package/docs/guide/commonConfig/renderType.md +181 -0
- package/docs/guide/crud/baseUse.md +120 -0
- package/docs/guide/crud/buttons.md +18 -0
- package/docs/guide/crud/config.md +217 -0
- package/docs/guide/crud/contextMenu.md +18 -0
- package/docs/guide/crud/dataSort.md +66 -0
- package/docs/guide/crud/genDynamicColumns.md +145 -0
- package/docs/guide/crud/handleBar.md +26 -0
- package/docs/guide/crud/renderType.md +4 -0
- package/docs/guide/crud/search.md +150 -0
- package/docs/guide/crud/selection.md +73 -0
- package/docs/guide/crud/span.md +98 -0
- package/docs/guide/crud/summary.md +167 -0
- package/docs/guide/crud/tableEdit.md +377 -0
- package/docs/guide/crud/validate.md +158 -0
- package/docs/guide/dialog/baseUse.md +81 -0
- package/docs/guide/dict/baseUse.md +174 -0
- package/docs/guide/dict/component.md +88 -0
- package/docs/guide/dict/config.md +44 -0
- package/docs/guide/form/baseUse.md +142 -0
- package/docs/guide/form/detail.md +38 -0
- package/docs/guide/formatData/baseUse.md +98 -0
- package/docs/guide/formatData/config.md +142 -0
- package/docs/guide/mockData/base.md +26 -0
- package/docs/guide/positionSlot/base.md +41 -0
- package/docs/guide/question/base.md +44 -0
- package/docs/guide/start/base.md +30 -0
- package/docs/guide/tabs/base.md +63 -0
- package/examples/App.vue +52 -0
- package/examples/Layout/components/AppMain.vue +40 -0
- package/examples/Layout/components/Item.vue +29 -0
- package/examples/Layout/components/Link.vue +44 -0
- package/examples/Layout/components/SidebarItem.vue +93 -0
- package/examples/Layout/index.vue +69 -0
- package/examples/assets/logo.png +0 -0
- package/examples/favicon.ico +0 -0
- package/examples/index.html +18 -0
- package/examples/main.js +54 -0
- package/examples/router/index.js +140 -0
- package/examples/store/index.js +0 -0
- package/examples/styles/index.scss +63 -0
- package/examples/styles/sidebar.scss +226 -0
- package/examples/styles/transition.scss +48 -0
- package/examples/styles/variables.scss +25 -0
- package/examples/views/crud/base.vue +68 -0
- package/examples/views/crud/handleRow.vue +84 -0
- package/examples/views/crud/search.vue +116 -0
- package/examples/views/dashboard/index.vue +244 -0
- package/examples/views/dashboard/index1.vue +234 -0
- package/examples/views/dashboard/test.vue +9 -0
- package/examples/views/formTest/index.vue +168 -0
- package/examples/views/nested/menu1/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-1/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-2/index.vue +7 -0
- package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
- package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
- package/examples/views/nested/menu1/menu1-3/index.vue +5 -0
- package/examples/views/nested/menu2/index.vue +5 -0
- package/gulpfile.js +84 -0
- package/lib/index.css +1 -0
- package/lib/super-crud.min.js +15 -0
- package/package.json +66 -0
- package/packages/button/index.vue +189 -0
- package/packages/core/components/comp.vue +223 -0
- package/packages/core/components/position.vue +135 -0
- package/packages/core/components/render.vue +460 -0
- package/packages/core/configManager.js +302 -0
- package/packages/core/create.js +8 -0
- package/packages/core/defaultRender.js +64 -0
- package/packages/core/dict/global.js +10 -0
- package/packages/core/dict/index.js +432 -0
- package/packages/core/dict/mixin.js +94 -0
- package/packages/core/event.js +60 -0
- package/packages/core/index.js +6 -0
- package/packages/core/init.js +122 -0
- package/packages/core/mock/genConfig.js +228 -0
- package/packages/core/mock/genData.js +422 -0
- package/packages/core/mock/index.js +4 -0
- package/packages/core/rules.js +111 -0
- package/packages/crud/column.vue +205 -0
- package/packages/crud/columnAction.vue +207 -0
- package/packages/crud/columnCell.vue +146 -0
- package/packages/crud/defaultColumn.vue +130 -0
- package/packages/crud/drawerColumn.vue +225 -0
- package/packages/crud/form.vue +69 -0
- package/packages/crud/index.vue +564 -0
- package/packages/crud/menuBar.vue +298 -0
- package/packages/crud/mixins/cacheHandler.js +36 -0
- package/packages/crud/mixins/calcColumnWidth.js +79 -0
- package/packages/crud/mixins/calcHeight.js +105 -0
- package/packages/crud/mixins/columnHandler.js +128 -0
- package/packages/crud/mixins/contextMenu.js +98 -0
- package/packages/crud/mixins/dataProcessor.js +202 -0
- package/packages/crud/mixins/dialog.js +109 -0
- package/packages/crud/mixins/excelHandler.js +150 -0
- package/packages/crud/mixins/exposeMethods.js +107 -0
- package/packages/crud/mixins/generateDynamicColumns.js +250 -0
- package/packages/crud/mixins/props.js +38 -0
- package/packages/crud/mixins/searchHandler.js +151 -0
- package/packages/crud/mixins/select.js +359 -0
- package/packages/crud/mixins/spanMethod.js +288 -0
- package/packages/crud/mixins/summary.js +177 -0
- package/packages/crud/mixins/tableEdit.js +547 -0
- package/packages/crud/mixins/validate.js +219 -0
- package/packages/crud/pagination.vue +110 -0
- package/packages/crud/search.vue +119 -0
- package/packages/crud/searchHeader.vue +231 -0
- package/packages/crud/selectBanner.vue +138 -0
- package/packages/crud/utils/EditState.js +319 -0
- package/packages/crud/utils/excelExport.js +112 -0
- package/packages/crud/utils/excelImport.js +112 -0
- package/packages/crud/utils/index.js +98 -0
- package/packages/dialog/dialog.js +233 -0
- package/packages/dialog/dialog.vue +15 -0
- package/packages/dialog/index.js +22 -0
- package/packages/dict/cascadeFormat.vue +179 -0
- package/packages/dict/dateFormat.vue +40 -0
- package/packages/dict/form/cascade.vue +61 -0
- package/packages/dict/form/checkbox.vue +90 -0
- package/packages/dict/form/extendMethod.js +22 -0
- package/packages/dict/form/input-base.js +31 -0
- package/packages/dict/form/input.js +20 -0
- package/packages/dict/form/radio.vue +69 -0
- package/packages/dict/form/select.vue +118 -0
- package/packages/dict/form/switch.vue +75 -0
- package/packages/dict/valueFormat.vue +188 -0
- package/packages/directive/dialog/drag.js +86 -0
- package/packages/directive/dialog/dragSize.js +42 -0
- package/packages/directive/index.js +9 -0
- package/packages/directive/insertSlot.js +10 -0
- package/packages/form/contextMenu.js +192 -0
- package/packages/form/draftDrawer.vue +391 -0
- package/packages/form/formAction.vue +97 -0
- package/packages/form/formItem.vue +259 -0
- package/packages/form/index.vue +451 -0
- package/packages/form/props.js +15 -0
- package/packages/grid/cell.vue +65 -0
- package/packages/grid/index.vue +130 -0
- package/packages/group/index.vue +96 -0
- package/packages/tabs/index.vue +290 -0
- package/packages/tooltip/index.js +9 -0
- package/packages/tooltip/tooltip.vue +32 -0
- package/packages/tooltip/tooltipComponent.js +38 -0
- package/packages/verifyInput/index.vue +131 -0
- package/src/config/common.js +88 -0
- package/src/config/crud.js +567 -0
- package/src/config/dialog.js +87 -0
- package/src/config/form.js +215 -0
- package/src/config/index.js +9 -0
- package/src/constants/index.js +72 -0
- package/src/index.js +67 -0
- package/src/template/btn/crud.js +6 -0
- package/src/template/btn/dialog.js +1 -0
- package/src/template/btn/form.js +3 -0
- package/src/template/btn/index.js +9 -0
- package/src/template/dicts.js +1 -0
- package/src/template/formatData.js +507 -0
- package/src/template/index.js +19 -0
- package/src/template/render.js +124 -0
- package/src/template/rules.js +53 -0
- package/src/utils/bem.js +49 -0
- package/src/utils/cache.js +77 -0
- package/src/utils/getType.js +34 -0
- package/src/utils/index.js +212 -0
- package/src/utils/mergeTemp.js +124 -0
- package/styles/button.scss +3 -0
- package/styles/crud.scss +425 -0
- package/styles/dialog.scss +95 -0
- package/styles/form.scss +532 -0
- package/styles/group.scss +78 -0
- package/styles/index.scss +94 -0
- package/styles/tabs.scss +139 -0
- package/styles/verifyInput.scss +56 -0
- package/vue-jsx-sync.js +90 -0
- package/vue.config.js +54 -0
@@ -0,0 +1,567 @@
|
|
1
|
+
import { renderItem, buttonItem, presetButtonType } from "./common";
|
2
|
+
import { isPlainObject, merge } from "lodash-es";
|
3
|
+
|
4
|
+
const tableColumnKeys = [
|
5
|
+
"type",
|
6
|
+
"className",
|
7
|
+
"labelClassName",
|
8
|
+
"width",
|
9
|
+
"minWidth",
|
10
|
+
"renderHeader",
|
11
|
+
"sortable",
|
12
|
+
"sortMethod",
|
13
|
+
"sortBy",
|
14
|
+
"resizable",
|
15
|
+
"align",
|
16
|
+
"headerAlign",
|
17
|
+
"showOverflowTooltip",
|
18
|
+
"fixed",
|
19
|
+
"formatter",
|
20
|
+
"selectable",
|
21
|
+
"reserveSelection",
|
22
|
+
"filterMethod",
|
23
|
+
"filteredValue",
|
24
|
+
"filters",
|
25
|
+
"filterPlacement",
|
26
|
+
"filterMultiple",
|
27
|
+
"index",
|
28
|
+
"sortOrders",
|
29
|
+
];
|
30
|
+
|
31
|
+
const tableKeys = [
|
32
|
+
"key",
|
33
|
+
"data",
|
34
|
+
"size",
|
35
|
+
"width",
|
36
|
+
"height",
|
37
|
+
"maxHeight",
|
38
|
+
"fit",
|
39
|
+
"stripe",
|
40
|
+
"border",
|
41
|
+
"rowKey",
|
42
|
+
"context",
|
43
|
+
"showHeader",
|
44
|
+
"showSummary",
|
45
|
+
"sumText",
|
46
|
+
"summaryMethod",
|
47
|
+
"rowClassName",
|
48
|
+
"rowStyle",
|
49
|
+
"cellClassName",
|
50
|
+
"cellStyle",
|
51
|
+
"headerRowClassName",
|
52
|
+
"headerRowStyle",
|
53
|
+
"headerCellClassName",
|
54
|
+
"headerCellStyle",
|
55
|
+
"highlightCurrentRow",
|
56
|
+
"currentRowKey",
|
57
|
+
"emptyText",
|
58
|
+
"expandRowKeys",
|
59
|
+
"defaultExpandAll",
|
60
|
+
"defaultSort",
|
61
|
+
"tooltipEffect",
|
62
|
+
"spanMethod",
|
63
|
+
"selectOnIndeterminate",
|
64
|
+
"indent",
|
65
|
+
"treeProps",
|
66
|
+
"lazy",
|
67
|
+
"load",
|
68
|
+
];
|
69
|
+
export default {
|
70
|
+
ignoreKeys: tableKeys,
|
71
|
+
// 配置结构
|
72
|
+
schema: {
|
73
|
+
// 表格标题
|
74
|
+
title: String,
|
75
|
+
// 表格尺寸
|
76
|
+
size: {
|
77
|
+
type: String,
|
78
|
+
default: "small",
|
79
|
+
},
|
80
|
+
summaryData: Array, // 外部传入的统计数据
|
81
|
+
// 是否禁用
|
82
|
+
disabled: Boolean,
|
83
|
+
// 是否开启初始化
|
84
|
+
init: Boolean,
|
85
|
+
// 是否开启表格底部追加行新增按钮
|
86
|
+
footerAddBtn: Boolean,
|
87
|
+
// 是否开启新增按钮
|
88
|
+
addBtn: Boolean,
|
89
|
+
// 是否开启删除按钮
|
90
|
+
deleteBtn: Boolean,
|
91
|
+
// 是否开启编辑按钮
|
92
|
+
editBtn: Boolean,
|
93
|
+
// 是否开启查看按钮
|
94
|
+
viewBtn: Boolean,
|
95
|
+
// 是否开启行新增按钮
|
96
|
+
rowAddBtn: Boolean,
|
97
|
+
// 行新增类型,first: 第一行,last: 最后一行
|
98
|
+
rowAddType: {
|
99
|
+
type: String,
|
100
|
+
enum: ["first", "last"],
|
101
|
+
},
|
102
|
+
editConfig: {
|
103
|
+
type: Object,
|
104
|
+
strict: true,
|
105
|
+
default: () => ({}),
|
106
|
+
properties: {
|
107
|
+
mode: {
|
108
|
+
// 编辑模式
|
109
|
+
type: String,
|
110
|
+
enum: ["free", "cell", "row", "dialog"],
|
111
|
+
},
|
112
|
+
trigger: {
|
113
|
+
// 触发方式
|
114
|
+
type: String,
|
115
|
+
enum: ["manual", "click", "dblclick"],
|
116
|
+
default: "manual",
|
117
|
+
},
|
118
|
+
edit: buttonItem, // 编辑按钮配置
|
119
|
+
batch: merge(buttonItem, {
|
120
|
+
// 批量操作按钮配置,仅限`row`模式
|
121
|
+
properties: {
|
122
|
+
isSelect: Boolean,
|
123
|
+
},
|
124
|
+
}),
|
125
|
+
add: merge(buttonItem, {
|
126
|
+
// 新增按钮配置
|
127
|
+
properties: {
|
128
|
+
addType: {
|
129
|
+
type: String,
|
130
|
+
enum: ["first", "last"],
|
131
|
+
},
|
132
|
+
},
|
133
|
+
}),
|
134
|
+
lastAdd: merge(buttonItem, {
|
135
|
+
// 底部新增行按钮配置
|
136
|
+
properties: {
|
137
|
+
addType: {
|
138
|
+
type: String,
|
139
|
+
enum: ["first", "last"],
|
140
|
+
},
|
141
|
+
},
|
142
|
+
}),
|
143
|
+
batchDelete: buttonItem, // 批量删除按钮配置
|
144
|
+
delete: buttonItem, // 删除按钮配置
|
145
|
+
view: buttonItem, // 查看按钮配置,仅限`dialog`模式
|
146
|
+
isRowEdit: Function, // 控制行是否可编辑
|
147
|
+
autofocus: {
|
148
|
+
// 是否自动聚焦,支持字符串(prop)
|
149
|
+
type: [Boolean, String],
|
150
|
+
default: true,
|
151
|
+
},
|
152
|
+
exclusive: Boolean, // 行编辑是否互斥(同时只能编辑一行)
|
153
|
+
},
|
154
|
+
},
|
155
|
+
// 是否开启批量删除按钮
|
156
|
+
batchDeleteBtn: Boolean,
|
157
|
+
// 是否开启自由编辑
|
158
|
+
freeEdit: Boolean,
|
159
|
+
// 是否开启行编辑
|
160
|
+
rowEdit: [Boolean, Object],
|
161
|
+
// 是否开启单元格编辑
|
162
|
+
cellEdit: [Boolean, Object],
|
163
|
+
// 是否开启批量编辑
|
164
|
+
batchEdit: [Boolean, Object],
|
165
|
+
// 是否开启批量行编辑
|
166
|
+
batchRowEdit: [Boolean, Object],
|
167
|
+
// 控制行编辑状态
|
168
|
+
isRowEdit: Function,
|
169
|
+
// 操作后刷新表格
|
170
|
+
refreshAfterOperation: {
|
171
|
+
type: Boolean,
|
172
|
+
default: true,
|
173
|
+
},
|
174
|
+
// 是否开启编辑主题
|
175
|
+
editTheme: {
|
176
|
+
type: Boolean,
|
177
|
+
default: true,
|
178
|
+
},
|
179
|
+
// 校验信息是否提示
|
180
|
+
validateMsg: Boolean,
|
181
|
+
// 所有列配置统一设置的属性
|
182
|
+
allColumn: Object,
|
183
|
+
// 表格高度
|
184
|
+
height: String,
|
185
|
+
// 自动计算高度减去的偏差值
|
186
|
+
calcHeight: {
|
187
|
+
type: Number,
|
188
|
+
default: 0,
|
189
|
+
},
|
190
|
+
// 表格外间距
|
191
|
+
gap: {
|
192
|
+
type: [Number, String],
|
193
|
+
default: 20,
|
194
|
+
},
|
195
|
+
// 排序字段
|
196
|
+
sortProps: Array,
|
197
|
+
// 自定义排序方法
|
198
|
+
sortMethod: Function,
|
199
|
+
// 加载中文字
|
200
|
+
loadingText: String,
|
201
|
+
// 加载中图标
|
202
|
+
loadingSpinner: String,
|
203
|
+
// 加载中背景
|
204
|
+
loadingBackground: String,
|
205
|
+
// 是否禁用加载状态
|
206
|
+
disableLoading: Boolean,
|
207
|
+
// 是否开启本地分页
|
208
|
+
localPagination: Boolean,
|
209
|
+
// 是否开启本地搜索
|
210
|
+
localSearch: Boolean,
|
211
|
+
// 搜索弹窗是否打开
|
212
|
+
showPopper: Boolean,
|
213
|
+
// 搜索表单初始化是否展开
|
214
|
+
expandSearch: Boolean,
|
215
|
+
// 新增表单配置
|
216
|
+
addForm: {
|
217
|
+
type: Object,
|
218
|
+
default: () => ({}),
|
219
|
+
},
|
220
|
+
// 编辑表单配置
|
221
|
+
editForm: {
|
222
|
+
type: Object,
|
223
|
+
default: () => ({}),
|
224
|
+
},
|
225
|
+
// 查看表单配置
|
226
|
+
viewForm: {
|
227
|
+
type: Object,
|
228
|
+
default: () => ({
|
229
|
+
viewType: "form",
|
230
|
+
}),
|
231
|
+
},
|
232
|
+
// 表单配置
|
233
|
+
formOptions: {
|
234
|
+
type: Object,
|
235
|
+
default: () => ({}),
|
236
|
+
},
|
237
|
+
// 弹窗配置
|
238
|
+
dialog: {
|
239
|
+
type: Object,
|
240
|
+
default: () => ({}),
|
241
|
+
},
|
242
|
+
// 权限配置
|
243
|
+
permission: {
|
244
|
+
type: Object,
|
245
|
+
default: () => ({}),
|
246
|
+
},
|
247
|
+
// 属性配置
|
248
|
+
props: {
|
249
|
+
type: Object,
|
250
|
+
default: () => ({
|
251
|
+
pageNum: "pageNum",
|
252
|
+
pageSize: "pageSize",
|
253
|
+
detailResult: "data",
|
254
|
+
listResult: "data",
|
255
|
+
total: "total",
|
256
|
+
}),
|
257
|
+
},
|
258
|
+
// 是否本地生成唯一标识
|
259
|
+
uniqueId: {
|
260
|
+
type: Boolean,
|
261
|
+
default: false,
|
262
|
+
},
|
263
|
+
// 唯一值的Key
|
264
|
+
valueKey: {
|
265
|
+
type: String,
|
266
|
+
default: "id",
|
267
|
+
},
|
268
|
+
// 搜索表单配置
|
269
|
+
searchForm: {
|
270
|
+
type: [Boolean, Object],
|
271
|
+
default: () => ({
|
272
|
+
initShow: false,
|
273
|
+
}),
|
274
|
+
properties: {
|
275
|
+
show: Boolean,
|
276
|
+
initShow: Boolean,
|
277
|
+
},
|
278
|
+
},
|
279
|
+
// 搜索表头配置
|
280
|
+
searchHeader: {
|
281
|
+
type: [Boolean, Object],
|
282
|
+
default: () => ({
|
283
|
+
show: true,
|
284
|
+
width: 290,
|
285
|
+
resetBtn: true,
|
286
|
+
}),
|
287
|
+
properties: {
|
288
|
+
width: [Number, String], // popover宽度
|
289
|
+
searchBtn: Boolean, // 是否开启搜索按钮
|
290
|
+
resetBtn: Boolean, // 是否开启重置按钮
|
291
|
+
},
|
292
|
+
},
|
293
|
+
singleSelection: {
|
294
|
+
type: [Boolean, Object],
|
295
|
+
default: () => ({
|
296
|
+
width: 50,
|
297
|
+
align: "center",
|
298
|
+
clear: true,
|
299
|
+
ctrlSelect: true,
|
300
|
+
}),
|
301
|
+
},
|
302
|
+
// 选择列配置
|
303
|
+
selection: {
|
304
|
+
type: [Boolean, Object],
|
305
|
+
default: () => ({
|
306
|
+
width: 50,
|
307
|
+
align: "center",
|
308
|
+
maxDisplay: 3,
|
309
|
+
clear: true,
|
310
|
+
shiftSelect: true,
|
311
|
+
ctrlSelect: true,
|
312
|
+
}),
|
313
|
+
},
|
314
|
+
// 序号列配置
|
315
|
+
index: {
|
316
|
+
type: [Boolean, Object],
|
317
|
+
default: () => ({
|
318
|
+
label: "序号",
|
319
|
+
width: 50,
|
320
|
+
align: "center",
|
321
|
+
}),
|
322
|
+
},
|
323
|
+
// 展开列配置
|
324
|
+
expand: {
|
325
|
+
type: [Boolean, Object],
|
326
|
+
default: () => ({
|
327
|
+
width: 50,
|
328
|
+
align: "center",
|
329
|
+
}),
|
330
|
+
},
|
331
|
+
// 分页配置
|
332
|
+
pagination: {
|
333
|
+
type: [Boolean, Object],
|
334
|
+
default: () => ({
|
335
|
+
align: "right",
|
336
|
+
pageSizes: [10, 20, 30, 50, 100, 200],
|
337
|
+
layout: "total, sizes, prev, pager, next, jumper",
|
338
|
+
background: true,
|
339
|
+
pagerCount: 5,
|
340
|
+
}),
|
341
|
+
},
|
342
|
+
// 空状态配置
|
343
|
+
empty: {
|
344
|
+
type: [Boolean, Object],
|
345
|
+
default: () => ({
|
346
|
+
image: "",
|
347
|
+
size: 100,
|
348
|
+
text: "暂无数据",
|
349
|
+
}),
|
350
|
+
properties: {
|
351
|
+
show: Boolean,
|
352
|
+
hidden: Boolean,
|
353
|
+
image: String,
|
354
|
+
size: Number,
|
355
|
+
text: String,
|
356
|
+
},
|
357
|
+
},
|
358
|
+
// 行操作配置
|
359
|
+
handleRow: {
|
360
|
+
type: [Boolean, Object],
|
361
|
+
properties: {
|
362
|
+
show: Boolean,
|
363
|
+
hidden: Boolean,
|
364
|
+
add: presetButtonType,
|
365
|
+
rowAdd: presetButtonType,
|
366
|
+
batchDelete: presetButtonType,
|
367
|
+
handles: {
|
368
|
+
type: Array,
|
369
|
+
arrayOf: buttonItem,
|
370
|
+
},
|
371
|
+
},
|
372
|
+
},
|
373
|
+
// 工具栏配置
|
374
|
+
toolbar: {
|
375
|
+
type: [Boolean, Object],
|
376
|
+
strict: true,
|
377
|
+
properties: {
|
378
|
+
show: Boolean,
|
379
|
+
hidden: Boolean,
|
380
|
+
zoom: presetButtonType,
|
381
|
+
search: presetButtonType,
|
382
|
+
refresh: presetButtonType,
|
383
|
+
reset: presetButtonType,
|
384
|
+
column: presetButtonType,
|
385
|
+
excelImport: presetButtonType,
|
386
|
+
excelExport: presetButtonType,
|
387
|
+
handles: {
|
388
|
+
type: Array,
|
389
|
+
arrayOf: buttonItem,
|
390
|
+
},
|
391
|
+
},
|
392
|
+
},
|
393
|
+
// 操作列配置
|
394
|
+
action: {
|
395
|
+
type: [Boolean, Object],
|
396
|
+
strict: true,
|
397
|
+
properties: {
|
398
|
+
show: Boolean,
|
399
|
+
hidden: Boolean,
|
400
|
+
type: String, //废弃
|
401
|
+
prop: String,
|
402
|
+
width: [String, Number],
|
403
|
+
label: String,
|
404
|
+
align: String,
|
405
|
+
calcWidth: Number,
|
406
|
+
defaultWidth: Number,
|
407
|
+
sameRowSpan: [String, Boolean],
|
408
|
+
fixed: [String, Boolean],
|
409
|
+
handles: {
|
410
|
+
type: Array,
|
411
|
+
default: () => [],
|
412
|
+
arrayOf: buttonItem,
|
413
|
+
},
|
414
|
+
delete: presetButtonType,
|
415
|
+
view: presetButtonType,
|
416
|
+
edit: presetButtonType,
|
417
|
+
rowEdit: presetButtonType,
|
418
|
+
rowSave: presetButtonType,
|
419
|
+
rowCancel: presetButtonType,
|
420
|
+
},
|
421
|
+
default: () => ({
|
422
|
+
prop: "action",
|
423
|
+
width: "auto",
|
424
|
+
label: "操作",
|
425
|
+
align: "center",
|
426
|
+
calcWidth: 20,
|
427
|
+
defaultWidth: 50,
|
428
|
+
handles: [],
|
429
|
+
}),
|
430
|
+
},
|
431
|
+
// 右键菜单配置
|
432
|
+
contextMenu: {
|
433
|
+
type: [Boolean, Object],
|
434
|
+
strict: true,
|
435
|
+
properties: {
|
436
|
+
show: Boolean,
|
437
|
+
hidden: Boolean,
|
438
|
+
actionBtn: Boolean,
|
439
|
+
copy: presetButtonType,
|
440
|
+
mock: presetButtonType,
|
441
|
+
reset: presetButtonType,
|
442
|
+
handles: {
|
443
|
+
type: Array,
|
444
|
+
default: () => [],
|
445
|
+
arrayOf: buttonItem,
|
446
|
+
},
|
447
|
+
},
|
448
|
+
default: () => ({
|
449
|
+
copy: true,
|
450
|
+
mock: true,
|
451
|
+
reset: true,
|
452
|
+
actionBtn: true,
|
453
|
+
handles: [],
|
454
|
+
}),
|
455
|
+
},
|
456
|
+
// 渲染列配置
|
457
|
+
renderColumns: {
|
458
|
+
type: Array,
|
459
|
+
required: true,
|
460
|
+
default: () => [],
|
461
|
+
arrayOf: {
|
462
|
+
type: Object,
|
463
|
+
properties: {
|
464
|
+
...renderItem,
|
465
|
+
hiddenList: Boolean, // 是否只隐藏列表
|
466
|
+
children: Array, // 嵌套列子列
|
467
|
+
sameRowSpan: [String, Boolean], // 是否合并单元格
|
468
|
+
spanMethod: Function, // 合并单元格方法
|
469
|
+
isEdit: [Boolean, Function], // 是否允许编辑
|
470
|
+
summary: {
|
471
|
+
// 是否开启汇总
|
472
|
+
type: Object,
|
473
|
+
strict: true,
|
474
|
+
properties: {
|
475
|
+
type: String,
|
476
|
+
enum: ["sum", "avg", "count", "max", "min", "custom"],
|
477
|
+
path: String, // 汇总字段
|
478
|
+
prefix: String, // 前缀
|
479
|
+
suffix: String, // 后缀
|
480
|
+
decimals: Number, // 小数位数
|
481
|
+
ignoreZero: Boolean, // 忽略0值
|
482
|
+
absolute: Boolean, // 取绝对值
|
483
|
+
predicate: Function, // 条件
|
484
|
+
method: Function, // 自定义方法
|
485
|
+
},
|
486
|
+
},
|
487
|
+
add: {
|
488
|
+
// 新增配置
|
489
|
+
type: [Object, Boolean],
|
490
|
+
properties: renderItem,
|
491
|
+
},
|
492
|
+
edit: {
|
493
|
+
// 编辑配置
|
494
|
+
type: [Object, Boolean],
|
495
|
+
properties: renderItem,
|
496
|
+
},
|
497
|
+
view: {
|
498
|
+
// 查看配置
|
499
|
+
type: [Object, Boolean],
|
500
|
+
properties: renderItem,
|
501
|
+
},
|
502
|
+
form: {
|
503
|
+
// 通用表单配置
|
504
|
+
type: [Object, Boolean],
|
505
|
+
properties: renderItem,
|
506
|
+
},
|
507
|
+
search: {
|
508
|
+
// 搜索配置
|
509
|
+
type: [Object, Boolean],
|
510
|
+
properties: renderItem,
|
511
|
+
},
|
512
|
+
searchHeader: {
|
513
|
+
// 搜索表头配置
|
514
|
+
type: [Object, Boolean],
|
515
|
+
properties: renderItem,
|
516
|
+
},
|
517
|
+
},
|
518
|
+
ignoreKeys: tableColumnKeys,
|
519
|
+
},
|
520
|
+
},
|
521
|
+
},
|
522
|
+
// 配置转换函数
|
523
|
+
transforms: [
|
524
|
+
(source, key, value) => {
|
525
|
+
const showKeys = [
|
526
|
+
"searchHeader",
|
527
|
+
"singleSelection",
|
528
|
+
"selection",
|
529
|
+
"index",
|
530
|
+
"expand",
|
531
|
+
"pagination",
|
532
|
+
"empty",
|
533
|
+
"handleRow",
|
534
|
+
"toolbar",
|
535
|
+
"action",
|
536
|
+
"contextMenu",
|
537
|
+
];
|
538
|
+
if (showKeys.includes(key)) {
|
539
|
+
// 传入布尔值时,直接设置show
|
540
|
+
if (typeof value === "boolean") {
|
541
|
+
source[key] = {
|
542
|
+
show: value,
|
543
|
+
};
|
544
|
+
} else if (
|
545
|
+
// 传入对象时,默认show为true
|
546
|
+
isPlainObject(value) &&
|
547
|
+
value.show === undefined &&
|
548
|
+
value.hidden === undefined
|
549
|
+
) {
|
550
|
+
source[key] = {
|
551
|
+
show: true,
|
552
|
+
...value,
|
553
|
+
};
|
554
|
+
}
|
555
|
+
}
|
556
|
+
},
|
557
|
+
(source, key, value) => {
|
558
|
+
const buttonKeys = ["handleRow", "toolbar", "action", "contextMenu"];
|
559
|
+
if (buttonKeys.includes(key) && Array.isArray(value)) {
|
560
|
+
source[key] = {
|
561
|
+
show: true,
|
562
|
+
handles: value,
|
563
|
+
};
|
564
|
+
}
|
565
|
+
},
|
566
|
+
],
|
567
|
+
};
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { buttonItem, presetButtonType } from "./common";
|
2
|
+
export default {
|
3
|
+
schema: {
|
4
|
+
title: String,
|
5
|
+
// 宽度
|
6
|
+
width: {
|
7
|
+
type: [Number, String],
|
8
|
+
default: "",
|
9
|
+
},
|
10
|
+
// 尺寸
|
11
|
+
size: {
|
12
|
+
type: String,
|
13
|
+
default: "small",
|
14
|
+
},
|
15
|
+
drag: {
|
16
|
+
type: Boolean,
|
17
|
+
default: true,
|
18
|
+
},
|
19
|
+
dragSize: {
|
20
|
+
type: Boolean,
|
21
|
+
default: true,
|
22
|
+
},
|
23
|
+
// 挂载后回调
|
24
|
+
mounted: {
|
25
|
+
type: Function,
|
26
|
+
default: () => {},
|
27
|
+
},
|
28
|
+
// 确认回调
|
29
|
+
confirm: {
|
30
|
+
type: Function,
|
31
|
+
default: () => {},
|
32
|
+
},
|
33
|
+
// 取消回调
|
34
|
+
cancel: {
|
35
|
+
type: Function,
|
36
|
+
default: () => {},
|
37
|
+
},
|
38
|
+
// 关闭回调
|
39
|
+
closed: {
|
40
|
+
type: Function,
|
41
|
+
default: () => {},
|
42
|
+
},
|
43
|
+
// 底部按钮配置
|
44
|
+
footer: {
|
45
|
+
type: Object,
|
46
|
+
default: () => ({
|
47
|
+
align: "right",
|
48
|
+
confirm: {},
|
49
|
+
cancel: {},
|
50
|
+
handles: [],
|
51
|
+
}),
|
52
|
+
properties: {
|
53
|
+
show: Boolean,
|
54
|
+
hidden: Boolean,
|
55
|
+
align: String, // 对齐方式
|
56
|
+
confirm: presetButtonType, // 确认按钮配置
|
57
|
+
cancel: presetButtonType, // 取消按钮配置
|
58
|
+
handles: {
|
59
|
+
type: Array,
|
60
|
+
arrayOf: buttonItem,
|
61
|
+
}, // 按钮配置
|
62
|
+
},
|
63
|
+
},
|
64
|
+
},
|
65
|
+
transforms: [
|
66
|
+
(source, key, value) => {
|
67
|
+
const showKeys = ["footer"];
|
68
|
+
if (showKeys.includes(key)) {
|
69
|
+
if (typeof value === "boolean") {
|
70
|
+
source[key] = {
|
71
|
+
show: value,
|
72
|
+
};
|
73
|
+
}
|
74
|
+
}
|
75
|
+
},
|
76
|
+
(source, key, value) => {
|
77
|
+
const buttonKeys = ["footer"];
|
78
|
+
if (Array.isArray(value) && buttonKeys.includes(key)) {
|
79
|
+
source[key] = {
|
80
|
+
confirm: false,
|
81
|
+
cancel: false,
|
82
|
+
handles: value,
|
83
|
+
};
|
84
|
+
}
|
85
|
+
},
|
86
|
+
],
|
87
|
+
};
|