vue-super-crud 1.7.1 → 1.7.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.
Files changed (273) hide show
  1. package/README.md +42 -10
  2. package/lib/index.css +1 -1
  3. package/lib/super-crud.min.js +2 -2
  4. package/package.json +21 -16
  5. package/src/config/common.js +2 -1
  6. package/src/config/crud.js +3 -3
  7. package/src/index.js +4 -0
  8. package/src/template/formatData.js +75 -87
  9. package/.browserslistrc +0 -3
  10. package/.versionrc.json +0 -36
  11. package/CHANGELOG.md +0 -232
  12. package/babel.config.js +0 -12
  13. package/build/alias.js +0 -10
  14. package/build/build.js +0 -52
  15. package/build/config.js +0 -70
  16. package/deploy.bat +0 -14
  17. package/docs/.vuepress/components/button/base.vue +0 -88
  18. package/docs/.vuepress/components/common/code-format.vue +0 -331
  19. package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +0 -68
  20. package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +0 -73
  21. package/docs/.vuepress/components/commonConfig/renderType/component.vue +0 -160
  22. package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +0 -49
  23. package/docs/.vuepress/components/commonConfig/renderType/render.vue +0 -91
  24. package/docs/.vuepress/components/commonConfig/renderType/slot.vue +0 -63
  25. package/docs/.vuepress/components/crud/baseUse/baseUse.vue +0 -98
  26. package/docs/.vuepress/components/crud/baseUse/columnAction.vue +0 -72
  27. package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +0 -107
  28. package/docs/.vuepress/components/crud/baseUse/handleRow.vue +0 -65
  29. package/docs/.vuepress/components/crud/baseUse/height.vue +0 -82
  30. package/docs/.vuepress/components/crud/baseUse/index.vue +0 -54
  31. package/docs/.vuepress/components/crud/baseUse/loading.vue +0 -70
  32. package/docs/.vuepress/components/crud/baseUse/pagination.vue +0 -108
  33. package/docs/.vuepress/components/crud/baseUse/selection.vue +0 -114
  34. package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +0 -118
  35. package/docs/.vuepress/components/crud/baseUse/title.vue +0 -54
  36. package/docs/.vuepress/components/crud/baseUse/toolbar.vue +0 -69
  37. package/docs/.vuepress/components/crud/buttons/common.vue +0 -115
  38. package/docs/.vuepress/components/crud/buttons/fast.vue +0 -82
  39. package/docs/.vuepress/components/crud/contextMenu/base.vue +0 -72
  40. package/docs/.vuepress/components/crud/copy.vue +0 -52
  41. package/docs/.vuepress/components/crud/crudEvents/api.vue +0 -157
  42. package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +0 -93
  43. package/docs/.vuepress/components/crud/crudEvents/events.vue +0 -188
  44. package/docs/.vuepress/components/crud/dataSort/base.vue +0 -142
  45. package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +0 -53
  46. package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +0 -111
  47. package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +0 -68
  48. package/docs/.vuepress/components/crud/handleBar/handleRow.vue +0 -65
  49. package/docs/.vuepress/components/crud/handleBar/toolbar.vue +0 -69
  50. package/docs/.vuepress/components/crud/renderType/1.vue +0 -57
  51. package/docs/.vuepress/components/crud/renderType/2.vue +0 -63
  52. package/docs/.vuepress/components/crud/renderType/3.vue +0 -105
  53. package/docs/.vuepress/components/crud/renderType/5.vue +0 -91
  54. package/docs/.vuepress/components/crud/search/1.vue +0 -90
  55. package/docs/.vuepress/components/crud/search/2.vue +0 -78
  56. package/docs/.vuepress/components/crud/search/3.vue +0 -107
  57. package/docs/.vuepress/components/crud/search/base.vue +0 -123
  58. package/docs/.vuepress/components/crud/search/localSearch.vue +0 -124
  59. package/docs/.vuepress/components/crud/search/special.vue +0 -148
  60. package/docs/.vuepress/components/crud/selection/events.vue +0 -47
  61. package/docs/.vuepress/components/crud/selection/pagination.vue +0 -94
  62. package/docs/.vuepress/components/crud/selection/singleSelection.vue +0 -64
  63. package/docs/.vuepress/components/crud/span/base.vue +0 -69
  64. package/docs/.vuepress/components/crud/span/special.vue +0 -75
  65. package/docs/.vuepress/components/crud/summary/base.vue +0 -99
  66. package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +0 -174
  67. package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +0 -194
  68. package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +0 -219
  69. package/docs/.vuepress/components/crud/tableEdit/dialog.vue +0 -172
  70. package/docs/.vuepress/components/crud/tableEdit/free.vue +0 -88
  71. package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +0 -82
  72. package/docs/.vuepress/components/crud/tableEdit/methods.vue +0 -154
  73. package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +0 -107
  74. package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +0 -116
  75. package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +0 -98
  76. package/docs/.vuepress/components/crud/validate/base.vue +0 -122
  77. package/docs/.vuepress/components/crud/validate/custom.vue +0 -82
  78. package/docs/.vuepress/components/crud/validate/regulars.vue +0 -88
  79. package/docs/.vuepress/components/crud/validate/relation.vue +0 -91
  80. package/docs/.vuepress/components/crud/validate/tree.vue +0 -82
  81. package/docs/.vuepress/components/dialog/baseUse/base.vue +0 -92
  82. package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +0 -78
  83. package/docs/.vuepress/components/dialog/baseUse/control.vue +0 -79
  84. package/docs/.vuepress/components/dialog/baseUse/drawer.vue +0 -59
  85. package/docs/.vuepress/components/dialog/baseUse/footer.vue +0 -87
  86. package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +0 -79
  87. package/docs/.vuepress/components/dict/DictLinkage.vue +0 -91
  88. package/docs/.vuepress/components/dict/baseUse.vue +0 -72
  89. package/docs/.vuepress/components/dict/component.vue +0 -82
  90. package/docs/.vuepress/components/dict/localDict.vue +0 -68
  91. package/docs/.vuepress/components/form/baseUse/base.vue +0 -48
  92. package/docs/.vuepress/components/form/baseUse/dataFormat.vue +0 -92
  93. package/docs/.vuepress/components/form/baseUse/deep.vue +0 -57
  94. package/docs/.vuepress/components/form/baseUse/gridLayout.vue +0 -47
  95. package/docs/.vuepress/components/form/baseUse/group.vue +0 -66
  96. package/docs/.vuepress/components/form/baseUse/hidden.vue +0 -40
  97. package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +0 -48
  98. package/docs/.vuepress/components/form/baseUse/label.vue +0 -51
  99. package/docs/.vuepress/components/form/baseUse/tooltip.vue +0 -40
  100. package/docs/.vuepress/components/form/baseUse/validate.vue +0 -52
  101. package/docs/.vuepress/components/form/detail/base.vue +0 -78
  102. package/docs/.vuepress/components/form/detail/border.vue +0 -90
  103. package/docs/.vuepress/components/form/detail/singleDetail.vue +0 -72
  104. package/docs/.vuepress/components/formatData/baseUse.vue +0 -131
  105. package/docs/.vuepress/components/mock/index.js +0 -347
  106. package/docs/.vuepress/components/mockData/custom.vue +0 -69
  107. package/docs/.vuepress/components/mockData/example.vue +0 -290
  108. package/docs/.vuepress/components/positionSlot/base.vue +0 -24
  109. package/docs/.vuepress/components/positionSlot/form.vue +0 -71
  110. package/docs/.vuepress/components/positionSlot/table.vue +0 -85
  111. package/docs/.vuepress/components/tabs/base.vue +0 -57
  112. package/docs/.vuepress/components/temp.js +0 -195
  113. package/docs/.vuepress/config.js +0 -146
  114. package/docs/.vuepress/enhanceApp.js +0 -142
  115. package/docs/.vuepress/public/favicon.ico +0 -0
  116. package/docs/.vuepress/public/super.png +0 -0
  117. package/docs/.vuepress/styles/index.styl +0 -25
  118. package/docs/.vuepress/styles/palette.styl +0 -6
  119. package/docs/README.md +0 -14
  120. package/docs/guide/button/base.md +0 -31
  121. package/docs/guide/commonConfig/jsx.md +0 -166
  122. package/docs/guide/commonConfig/presetCodeTemplate.md +0 -68
  123. package/docs/guide/commonConfig/renderType.md +0 -181
  124. package/docs/guide/crud/baseUse.md +0 -120
  125. package/docs/guide/crud/buttons.md +0 -18
  126. package/docs/guide/crud/config.md +0 -217
  127. package/docs/guide/crud/contextMenu.md +0 -18
  128. package/docs/guide/crud/dataSort.md +0 -66
  129. package/docs/guide/crud/genDynamicColumns.md +0 -145
  130. package/docs/guide/crud/handleBar.md +0 -26
  131. package/docs/guide/crud/renderType.md +0 -4
  132. package/docs/guide/crud/search.md +0 -150
  133. package/docs/guide/crud/selection.md +0 -73
  134. package/docs/guide/crud/span.md +0 -98
  135. package/docs/guide/crud/summary.md +0 -167
  136. package/docs/guide/crud/tableEdit.md +0 -377
  137. package/docs/guide/crud/validate.md +0 -158
  138. package/docs/guide/dialog/baseUse.md +0 -81
  139. package/docs/guide/dict/baseUse.md +0 -174
  140. package/docs/guide/dict/component.md +0 -88
  141. package/docs/guide/dict/config.md +0 -44
  142. package/docs/guide/form/baseUse.md +0 -142
  143. package/docs/guide/form/detail.md +0 -38
  144. package/docs/guide/formatData/baseUse.md +0 -98
  145. package/docs/guide/formatData/config.md +0 -142
  146. package/docs/guide/mockData/base.md +0 -26
  147. package/docs/guide/positionSlot/base.md +0 -41
  148. package/docs/guide/question/base.md +0 -44
  149. package/docs/guide/start/base.md +0 -30
  150. package/docs/guide/tabs/base.md +0 -63
  151. package/examples/App.vue +0 -52
  152. package/examples/Layout/components/AppMain.vue +0 -40
  153. package/examples/Layout/components/Item.vue +0 -29
  154. package/examples/Layout/components/Link.vue +0 -44
  155. package/examples/Layout/components/SidebarItem.vue +0 -93
  156. package/examples/Layout/index.vue +0 -69
  157. package/examples/assets/logo.png +0 -0
  158. package/examples/favicon.ico +0 -0
  159. package/examples/index.html +0 -18
  160. package/examples/main.js +0 -54
  161. package/examples/router/index.js +0 -140
  162. package/examples/store/index.js +0 -0
  163. package/examples/styles/index.scss +0 -63
  164. package/examples/styles/sidebar.scss +0 -226
  165. package/examples/styles/transition.scss +0 -48
  166. package/examples/styles/variables.scss +0 -25
  167. package/examples/views/crud/base.vue +0 -68
  168. package/examples/views/crud/handleRow.vue +0 -84
  169. package/examples/views/crud/search.vue +0 -116
  170. package/examples/views/dashboard/index.vue +0 -244
  171. package/examples/views/dashboard/index1.vue +0 -234
  172. package/examples/views/dashboard/test.vue +0 -9
  173. package/examples/views/formTest/index.vue +0 -168
  174. package/examples/views/nested/menu1/index.vue +0 -7
  175. package/examples/views/nested/menu1/menu1-1/index.vue +0 -7
  176. package/examples/views/nested/menu1/menu1-2/index.vue +0 -7
  177. package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +0 -5
  178. package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +0 -5
  179. package/examples/views/nested/menu1/menu1-3/index.vue +0 -5
  180. package/examples/views/nested/menu2/index.vue +0 -5
  181. package/gulpfile.js +0 -84
  182. package/packages/button/index.vue +0 -189
  183. package/packages/core/components/comp.vue +0 -223
  184. package/packages/core/components/position.vue +0 -135
  185. package/packages/core/components/render.vue +0 -460
  186. package/packages/core/configManager.js +0 -302
  187. package/packages/core/create.js +0 -8
  188. package/packages/core/defaultRender.js +0 -64
  189. package/packages/core/dict/global.js +0 -10
  190. package/packages/core/dict/index.js +0 -432
  191. package/packages/core/dict/mixin.js +0 -94
  192. package/packages/core/event.js +0 -60
  193. package/packages/core/index.js +0 -6
  194. package/packages/core/init.js +0 -122
  195. package/packages/core/mock/genConfig.js +0 -228
  196. package/packages/core/mock/genData.js +0 -422
  197. package/packages/core/mock/index.js +0 -4
  198. package/packages/core/rules.js +0 -111
  199. package/packages/crud/column.vue +0 -205
  200. package/packages/crud/columnAction.vue +0 -207
  201. package/packages/crud/columnCell.vue +0 -146
  202. package/packages/crud/defaultColumn.vue +0 -130
  203. package/packages/crud/drawerColumn.vue +0 -225
  204. package/packages/crud/form.vue +0 -69
  205. package/packages/crud/index.vue +0 -564
  206. package/packages/crud/menuBar.vue +0 -298
  207. package/packages/crud/mixins/cacheHandler.js +0 -36
  208. package/packages/crud/mixins/calcColumnWidth.js +0 -79
  209. package/packages/crud/mixins/calcHeight.js +0 -105
  210. package/packages/crud/mixins/columnHandler.js +0 -128
  211. package/packages/crud/mixins/contextMenu.js +0 -98
  212. package/packages/crud/mixins/dataProcessor.js +0 -202
  213. package/packages/crud/mixins/dialog.js +0 -109
  214. package/packages/crud/mixins/excelHandler.js +0 -150
  215. package/packages/crud/mixins/exposeMethods.js +0 -107
  216. package/packages/crud/mixins/generateDynamicColumns.js +0 -250
  217. package/packages/crud/mixins/props.js +0 -38
  218. package/packages/crud/mixins/searchHandler.js +0 -151
  219. package/packages/crud/mixins/select.js +0 -359
  220. package/packages/crud/mixins/spanMethod.js +0 -288
  221. package/packages/crud/mixins/summary.js +0 -177
  222. package/packages/crud/mixins/tableEdit.js +0 -547
  223. package/packages/crud/mixins/validate.js +0 -219
  224. package/packages/crud/pagination.vue +0 -110
  225. package/packages/crud/search.vue +0 -119
  226. package/packages/crud/searchHeader.vue +0 -231
  227. package/packages/crud/selectBanner.vue +0 -138
  228. package/packages/crud/utils/EditState.js +0 -319
  229. package/packages/crud/utils/excelExport.js +0 -112
  230. package/packages/crud/utils/excelImport.js +0 -112
  231. package/packages/crud/utils/index.js +0 -98
  232. package/packages/dialog/dialog.js +0 -233
  233. package/packages/dialog/dialog.vue +0 -15
  234. package/packages/dialog/index.js +0 -22
  235. package/packages/dict/cascadeFormat.vue +0 -179
  236. package/packages/dict/dateFormat.vue +0 -40
  237. package/packages/dict/form/cascade.vue +0 -61
  238. package/packages/dict/form/checkbox.vue +0 -90
  239. package/packages/dict/form/extendMethod.js +0 -22
  240. package/packages/dict/form/input-base.js +0 -31
  241. package/packages/dict/form/input.js +0 -20
  242. package/packages/dict/form/radio.vue +0 -69
  243. package/packages/dict/form/select.vue +0 -118
  244. package/packages/dict/form/switch.vue +0 -75
  245. package/packages/dict/valueFormat.vue +0 -188
  246. package/packages/directive/dialog/drag.js +0 -86
  247. package/packages/directive/dialog/dragSize.js +0 -42
  248. package/packages/directive/index.js +0 -9
  249. package/packages/directive/insertSlot.js +0 -10
  250. package/packages/form/contextMenu.js +0 -192
  251. package/packages/form/draftDrawer.vue +0 -391
  252. package/packages/form/formAction.vue +0 -97
  253. package/packages/form/formItem.vue +0 -259
  254. package/packages/form/index.vue +0 -451
  255. package/packages/form/props.js +0 -15
  256. package/packages/grid/cell.vue +0 -65
  257. package/packages/grid/index.vue +0 -130
  258. package/packages/group/index.vue +0 -96
  259. package/packages/tabs/index.vue +0 -290
  260. package/packages/tooltip/index.js +0 -9
  261. package/packages/tooltip/tooltip.vue +0 -32
  262. package/packages/tooltip/tooltipComponent.js +0 -38
  263. package/packages/verifyInput/index.vue +0 -131
  264. package/styles/button.scss +0 -3
  265. package/styles/crud.scss +0 -425
  266. package/styles/dialog.scss +0 -95
  267. package/styles/form.scss +0 -532
  268. package/styles/group.scss +0 -78
  269. package/styles/index.scss +0 -94
  270. package/styles/tabs.scss +0 -139
  271. package/styles/verifyInput.scss +0 -56
  272. package/vue-jsx-sync.js +0 -90
  273. package/vue.config.js +0 -54
@@ -1,150 +0,0 @@
1
- # 搜索
2
-
3
- 搜索功能支持表单搜索和表头搜索两种方式,并可配置本地搜索或远程搜索。
4
-
5
- ## 基础用法
6
-
7
- 通过配置列的 `search` 属性启用搜索功能。支持表单搜索和表头搜索两种方式。</br>
8
- 使用 `search.sync` 可以双向绑定搜索参数对象。
9
-
10
- <ClientOnly>
11
- <common-code-format>
12
- <crud-search-base slot="source"></crud-search-base>
13
-
14
- <<< @/docs/.vuepress/components/crud/search/base.vue
15
- </common-code-format>
16
- </ClientOnly>
17
-
18
- ## 自定义搜索组件
19
-
20
- 支持插槽自定义搜索组件、搜索标题</br>
21
- 支持自定义搜索表单、搜索头配置。
22
-
23
- <ClientOnly>
24
- <common-code-format>
25
- <crud-search-special slot="source"></crud-search-special>
26
-
27
- <<< @/docs/.vuepress/components/crud/search/special.vue
28
- </common-code-format>
29
- </ClientOnly>
30
-
31
- ### 搜索表单配置
32
-
33
- 通过 `searchForm` 可以自定义搜索表单的配置。
34
-
35
- ```js
36
- searchForm: {
37
- initShow: true, // 初始展开
38
- columnWidth: "200px", // 列宽
39
- labelWidth: "100px", // 标签宽度
40
- action: {
41
- search: {
42
- text: "查询" // 自定义按钮文本
43
- },
44
- reset: {
45
- text: "重置"
46
- }
47
- }
48
- }
49
- ```
50
-
51
- ### 表头搜索
52
-
53
- 通过 `searchHeader` 配置表头搜索的行为:
54
-
55
- ```js
56
- options: {
57
- searchHeader: {
58
- placement: "bottom", // 弹出位置
59
- width: "290px" // 搜索框宽度
60
- }
61
- }
62
- ```
63
-
64
- ## 本地搜索
65
-
66
- 通过配置 `localSearch: true` 启用本地搜索功能,可直接对表格数据进行筛选,无需发送请求。</br>
67
- 启用本地搜索时,可以搭配本地分页使用 `localPagination: true`。
68
- </br>
69
- 支持输入框搜索、下拉选择搜索、日期搜索、自定义搜索过滤。</br>
70
- search组件使用插槽或者函数自定义时,需要指定`search.type`。
71
-
72
- <ClientOnly>
73
- <common-code-format>
74
- <crud-search-localSearch slot="source"></crud-search-localSearch>
75
-
76
- <<< @/docs/.vuepress/components/crud/search/localSearch.vue
77
- </common-code-format>
78
- </ClientOnly>
79
-
80
- ### 本地搜索指定搜索类型
81
- ```js
82
- {
83
- prop: "date",
84
- label: "日期",
85
- search: {
86
- type: "date" // 本地搜索类型
87
- }
88
- }
89
- ```
90
-
91
- ### 本地搜索自定义搜索过滤
92
- ```js
93
- {
94
- prop: "custom",
95
- label: "自定义",
96
- search: {
97
- filter: (cellValue, searchValue, row) => {
98
- // 返回 true 表示匹配,false 表示不匹配
99
- return customFilter(cellValue, searchValue, row);
100
- }
101
- }
102
- }
103
- ```
104
-
105
- ## API
106
-
107
- ### Column 配置
108
-
109
- | 参数 | 说明 | 类型 | 默认值 |
110
- | ---------------------- | ------------------------------------------------------------------------------------------------------------- | -------------- | ------------------- |
111
- | search | 是否启用搜索 | boolean/object | false |
112
- | search.prop | 搜索字段 | object | 默认继承列的prop |
113
- | search.validateProp | 搜索验证字段、用于验证表头是否为空 | string | 默认继承search.prop |
114
- | search.label | 搜索标签 | string | 默认继承列的label |
115
- | search.labelRender | 搜索标签渲染函数 | function | - |
116
- | search.reset | 单个重置事件 | function | - |
117
- | search.comp | 搜索组件 | object | el-input |
118
- | search.render | 搜索组件渲染函数 | function | - |
119
- | search.type | 本地搜索类型,支持input、select、date | string | input |
120
- | search.filter | 本地搜索过滤函数 | function | - |
121
- | searchHeader | 是否启用表头搜索, [可配置el-popover组件属性](https://element.eleme.cn/2.15/#/zh-CN/component/popover#events) | boolean/object | 默认继承search |
122
- | searchHeader.width | 表头搜索宽度 | string | 290px |
123
- | searchHeader.searchBtn | 是否显示表头搜索按钮 | boolean | false |
124
- | searchHeader.resetBtn | 是否显示表头重置按钮 | boolean | true |
125
- | searchHeader.comp | 表头搜索组件 | object | 默认继承search |
126
- | searchHeader.render | 表头搜索组件渲染函数 | function | 默认继承search |
127
-
128
- ### Options 配置
129
-
130
- | 参数 | 说明 | 类型 | 默认值 |
131
- | ------------ | ------------------ | ------- | ------ |
132
- | expandSearch | 初始是否展开搜索框 | boolean | false |
133
- | localSearch | 是否启用本地搜索 | boolean | false |
134
- | searchForm | 搜索表单配置 | object | - |
135
- | searchHeader | 表头搜索配置 | object | - |
136
-
137
- ### Events
138
-
139
- | 事件名 | 说明 | 参数 |
140
- | ------ | -------- | ---------- |
141
- | search | 搜索事件 | searchData |
142
- | reset | 重置事件 | - |
143
-
144
- ### slots
145
-
146
- | 插槽名 | 说明 | 默认值 |
147
- | --------------------- | -------------------- | -------------- |
148
- | `{prop}-search` | 自定义列搜索组件 | - |
149
- | `{prop}-search-label` | 自定义列搜索标签 | - |
150
- | `{prop}-searchHeader` | 自定义列表头搜索内容 | 默认继承search |
@@ -1,73 +0,0 @@
1
- # 表格选中
2
-
3
- ## 概述
4
-
5
- 表格选中分为单选和多选,通过 `selected` 响应式绑定选中数据。
6
-
7
-
8
- ## 跨分页选中
9
-
10
- `selected` 绑定响应式选中数据,存在数据时会自动选中 </br>
11
- `selection` 开启表格多选选中 </br>
12
- `selection.reserveSelection` 开启数据更新时保持选中状态 </br>
13
-
14
- <ClientOnly>
15
- <common-code-format>
16
- <crud-selection-pagination slot="source"></crud-selection-pagination>
17
-
18
- <<< @/docs/.vuepress/components/crud/selection/pagination.vue
19
- </common-code-format>
20
- </ClientOnly>
21
-
22
- ## 选中事件
23
-
24
- `@selection-change` 选中项发生变化时触发 </br>
25
- `@select` 用户手动选择/取消选择某一行时触发 </br>
26
- `@select-all` 用户手动选择/取消选择所有行时触发
27
-
28
- <ClientOnly>
29
- <common-code-format>
30
- <crud-selection-events slot="source"></crud-selection-events>
31
-
32
- <<< @/docs/.vuepress/components/crud/selection/events.vue
33
- </common-code-format>
34
- </ClientOnly>
35
-
36
-
37
- ## 单选
38
-
39
- `selected` 绑定响应式选中数据,存在数据时会自动选中 </br>
40
- `singleSelection` 开启单选模式 </br>
41
-
42
- <ClientOnly>
43
- <common-code-format>
44
- <crud-selection-singleSelection slot="source"></crud-selection-singleSelection>
45
-
46
- <<< @/docs/.vuepress/components/crud/selection/singleSelection.vue
47
- </common-code-format>
48
- </ClientOnly>
49
-
50
-
51
- ## selection 配置项
52
-
53
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
54
- | ---------------- | ------------------------- | -------------------- | ------ | ------ |
55
- | reserveSelection | 是否启用分页选中 | boolean | - | false |
56
- | selectable | 是否可以勾选 | Function(row, index) | - | - |
57
- | banner | 是否显示选中项横幅 | boolean | - | false |
58
- | ctrlSelect | 是否启用 Ctrl 键点击选中 | boolean | - | true |
59
- | shiftSelect | 是否启用 Shift 键批量选中 | boolean | - | true |
60
- | maxDisplay | 直接显示的最大数量 | number | - | 3 |
61
- | labelKey | 显示的字段名 | string | - | 'id' |
62
- | clear | 是否显示清除按钮 | boolean | - | true |
63
-
64
-
65
- ## singleSelection 配置项
66
-
67
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
68
- | ---------- | ------------------------ | -------------------- | ------ | ------ |
69
- | selectable | 是否可以勾选 | Function(row, index) | - | - |
70
- | banner | 是否显示选中项横幅 | boolean | - | false |
71
- | ctrlSelect | 是否启用 Ctrl 键点击选中 | boolean | - | true |
72
- | labelKey | 显示的字段名 | string | - | 'id' |
73
- | clear | 是否显示清除按钮 | boolean | - | true |
@@ -1,98 +0,0 @@
1
- # 表格合并
2
-
3
- 表格支持按照指定字段对行进行合并,支持多字段优先级合并。并根据配置的合并字段,自动使用多级排序。
4
-
5
- ## 基础用法
6
-
7
- 通过配置合并字段 `spanProp` 启用列的合并功能。自动合并`相同字段值`的行。</br>
8
- 特殊列也可以启用合并功能,`index` 列可以获取合并后的索引。
9
-
10
- <ClientOnly>
11
- <common-code-format>
12
- <crud-span-base slot="source"></crud-span-base>
13
-
14
- <<< @/docs/.vuepress/components/crud/span/base.vue
15
- </common-code-format>
16
- </ClientOnly>
17
-
18
- ## 特殊列处理
19
-
20
- 索引列配置`spanProp`,可以获取合并后的索引。</br>
21
- 选中列配置`spanProp`,可以操作合并后的选中数据,实际选中还是合并前的数据。</br>
22
-
23
- <ClientOnly>
24
- <common-code-format>
25
- <crud-span-special slot="source"></crud-span-special>
26
-
27
- <<< @/docs/.vuepress/components/crud/span/special.vue
28
- </common-code-format>
29
- </ClientOnly>
30
-
31
- ## 列级别自定义
32
-
33
- 通过 `spanMethod` 属性可以自定义某一列的合并规则。
34
-
35
- ```js
36
- renderColumns: [
37
- {
38
- prop: "status",
39
- label: "状态",
40
- // 自定义合并规则
41
- spanMethod: ({ row, rowIndex }) => {
42
- if (row.status === "pending") {
43
- return {
44
- rowspan: 2,
45
- colspan: 1,
46
- };
47
- }
48
- return {
49
- rowspan: 1,
50
- colspan: 1,
51
- };
52
- },
53
- },
54
- ];
55
- ```
56
-
57
- ## 表格级别自定义
58
-
59
- 通过 `spanMethod` 可以自定义整个表格的合并规则。
60
-
61
- ```js
62
- spanMethod: ({ row, column, rowIndex, columnIndex }) => {
63
- if (row.status === "pending") {
64
- return {
65
- rowspan: 2,
66
- colspan: 1,
67
- };
68
- }
69
- return {
70
- rowspan: 1,
71
- colspan: 1,
72
- };
73
- };
74
- ```
75
-
76
- ## API
77
-
78
- ### Column 配置
79
-
80
- | 参数 | 说明 | 类型 | 默认值 |
81
- | ---------- | -------------------- | -------------- | ------ |
82
- | spanProp | 是否启用列合并 | boolean/string | false |
83
- | spanMethod | 列级别自定义合并方法 | Function | - |
84
-
85
- ### Options 配置
86
-
87
- | 参数 | 说明 | 类型 | 默认值 |
88
- | ---------- | ---------------------- | -------- | ------ |
89
- | spanMethod | 表格级别自定义合并方法 | Function | - |
90
-
91
- ### spanMethod 参数
92
-
93
- | 参数 | 说明 | 类型 |
94
- | ----------- | ------ | ------ |
95
- | row | 行数据 | object |
96
- | column | 列配置 | object |
97
- | rowIndex | 行索引 | number |
98
- | columnIndex | 列索引 | number |
@@ -1,167 +0,0 @@
1
- # 表格统计
2
-
3
- 表格支持在底部显示统计信息,内置多种统计方式,也支持自定义统计逻辑。
4
-
5
- ## 基础用法
6
-
7
- 通过配置列的 `summary` 属性启用统计功能。支持以下统计方式:
8
- - `sum`: 求和
9
- - `avg`: 平均值
10
- - `max`: 最大值
11
- - `min`: 最小值
12
- - `count`: 计数
13
-
14
- <ClientOnly>
15
- <common-code-format>
16
- <crud-summary-base slot="source"></crud-summary-base>
17
-
18
- <<< @/docs/.vuepress/components/crud/summary/base.vue
19
- </common-code-format>
20
- </ClientOnly>
21
-
22
- ## 格式化配置
23
-
24
- 通过 `prefix`、`suffix` 和 `decimals` 属性可以对统计结果进行格式化:
25
-
26
- ```js
27
- renderColumns: [
28
- {
29
- prop: "amount",
30
- label: "金额",
31
- summary: {
32
- type: "sum",
33
- prefix: "¥", // 添加前缀
34
- suffix: "元", // 添加后缀
35
- decimals: 2 // 保留2位小数
36
- }
37
- }
38
- ]
39
- ```
40
-
41
- ## 高级统计
42
-
43
- ### 加权平均值
44
- ```js
45
- {
46
- prop: "score",
47
- label: "加权平均分",
48
- summary: {
49
- type: "avg",
50
- decimals: 1,
51
- suffix: "分"
52
- }
53
- }
54
- ```
55
-
56
- ### 条件统计
57
- ```js
58
- {
59
- prop: "status",
60
- label: "状态统计",
61
- summary: {
62
- type: "count",
63
- predicate: value => value === 'active', // 只统计active状态
64
- suffix: "个"
65
- }
66
- }
67
- ```
68
-
69
- ## 自定义统计方法
70
-
71
- 通过传入函数作为 `method` 可以自定义统计逻辑:
72
-
73
- ```js
74
- {
75
- prop: "custom",
76
- label: "自定义统计",
77
- summary: {
78
- type: "custom",
79
- method: (values, data) => {
80
- // values: 当前列的所有数值
81
- // data: 表格完整数据
82
- return values.reduce((sum, val) => sum + val, 0);
83
- },
84
- prefix: "¥",
85
- decimals: 2
86
- }
87
- }
88
- ```
89
-
90
- ## 表格级别自定义
91
-
92
- 通过 `summaryMethod` 可以自定义整个表格的统计规则:
93
-
94
- ```js
95
- options: {
96
- summaryMethod: ({ columns, data }) => {
97
- const sums = [];
98
- columns.forEach((column, index) => {
99
- if (index === 0) {
100
- sums[index] = '总计';
101
- return;
102
- }
103
- const values = data.map(item => Number(item[column.property]));
104
- sums[index] = values.reduce((sum, val) => sum + val, 0);
105
- });
106
- return sums;
107
- }
108
- }
109
- ```
110
-
111
- ## 嵌套数据统计
112
-
113
- 通过 `path` 属性可以统计嵌套对象中的数据:
114
-
115
- ```js
116
- {
117
- prop: "nested.value",
118
- label: "嵌套数据",
119
- summary: {
120
- type: "sum",
121
- path: "nested.value", // 指定数据路径
122
- decimals: 2
123
- }
124
- }
125
- ```
126
-
127
- ## API
128
-
129
- ### Column Summary 配置
130
-
131
- | 参数 | 说明 | 类型 | 默认值 |
132
- | ---------- | ------------------------------ | -------- | ------ |
133
- | type | 统计类型 | string | - |
134
- | prefix | 统计值前缀 | string | '' |
135
- | suffix | 统计值后缀 | string | '' |
136
- | decimals | 小数位数 | number | 2 |
137
- | path | 数据路径(用于嵌套数据) | string | - |
138
- | ignoreZero | 是否忽略0值 | boolean | false |
139
- | absolute | 是否取绝对值 | boolean | false |
140
- | predicate | 计数条件(仅用于count) | function | - |
141
- | method | 自定义统计方法(仅用于custom) | function | - |
142
-
143
- ### Options 配置
144
-
145
- | 参数 | 说明 | 类型 | 默认值 |
146
- | ------------- | -------------------------------------------- | -------- | ------ |
147
- | summaryData | 不使用表格data数据,而使用外部传入的统计数据 | array | - |
148
- | showSummary | 是否显示统计行 | boolean | false |
149
- | summaryMethod | 自定义统计方法 | function | - |
150
-
151
- ### 内置统计类型
152
-
153
- | 类型 | 说明 | 可选值 |
154
- | ------ | ---------- | --------------------- |
155
- | sum | 求和 | ignoreZero, absolute |
156
- | avg | 平均值 | ignoreZero |
157
- | count | 计数 | ignoreZero, predicate |
158
- | max | 最大值 | absolute |
159
- | min | 最小值 | absolute |
160
- | custom | 自定义方法 | method |
161
-
162
- ### summaryMethod 参数
163
-
164
- | 参数 | 说明 | 类型 |
165
- | ------- | ---------- | ----- |
166
- | columns | 列配置数组 | array |
167
- | data | 表格数据 | array |