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,98 +0,0 @@
1
- /**
2
- * 查找并触发表单元素的聚焦
3
- * @param {HTMLElement} dom - 要搜索的DOM元素
4
- * @returns {Boolean} - 是否成功触发了聚焦
5
- */
6
- export function focusFormElement(dom, isSelect = false) {
7
- if (!dom) return false;
8
-
9
- // 处理需要点击的组件
10
- const clickSelectors = [
11
- ".el-cascader .el-cascader__label, .el-cascader .el-input__inner",
12
- ".el-select .el-input__inner",
13
- ".el-date-editor.el-input__inner",
14
- ".el-time-picker.el-input__inner",
15
- ".el-color-picker .el-color-picker__trigger",
16
- ].join(",");
17
-
18
- const clickElement = dom.querySelector(clickSelectors);
19
- if (clickElement) {
20
- clickElement.click();
21
- return true;
22
- }
23
-
24
- // 处理需要focus的组件
25
- const focusElement = dom.querySelector(
26
- ".el-rate .el-rate__item:not(.is-disabled)"
27
- );
28
- if (focusElement) {
29
- focusElement.focus();
30
- return true;
31
- }
32
-
33
- // 处理基础表单元素
34
- const basicInput = dom.querySelector(`
35
- input:not([type="hidden"]):not([readonly]):not([disabled]),
36
- textarea:not([readonly]):not([disabled]),
37
- [tabindex]:not([tabindex="-1"]):not([disabled])
38
- `);
39
-
40
- if (basicInput) {
41
- basicInput.focus();
42
- const shouldSelect =
43
- isSelect &&
44
- basicInput.tagName.toLowerCase() === "input" &&
45
- ["text", "number", "password", "search", "email", "tel", "url"].includes(
46
- basicInput.type
47
- );
48
-
49
- if (shouldSelect) {
50
- basicInput.select();
51
- }
52
- return true;
53
- }
54
-
55
- return false;
56
- }
57
-
58
- /**
59
- * 查找树形数据中指定节点的路径
60
- * @param {Array} tree - 树形数据
61
- * @param {Function} predicate - 判断条件函数
62
- * @param {string} childrenKey - 子节点的键名,默认为 'children'
63
- * @param {string} parentPath - 父节点路径(递归用)
64
- * @returns {string|null} - 返回找到的路径或 null
65
- */
66
- export function findTreeNodePath(
67
- tree,
68
- predicate,
69
- childrenKey = "children",
70
- parentPath = ""
71
- ) {
72
- if (!Array.isArray(tree)) return null;
73
-
74
- for (let i = 0; i < tree.length; i++) {
75
- const node = tree[i];
76
- const currentPath = parentPath ? `${parentPath}.${i}` : `${i}`;
77
-
78
- // 判断当前节点是否符合条件
79
- if (predicate(node)) {
80
- return currentPath;
81
- }
82
-
83
- // 如果有子节点,递归查找
84
- if (node[childrenKey] && Array.isArray(node[childrenKey])) {
85
- const childPath = findTreeNodePath(
86
- node[childrenKey],
87
- predicate,
88
- childrenKey,
89
- `${currentPath}.${childrenKey}`
90
- );
91
- if (childPath) {
92
- return childPath;
93
- }
94
- }
95
- }
96
-
97
- return null;
98
- }
@@ -1,233 +0,0 @@
1
- import create from "core/create";
2
- import init from "core/init";
3
- import { omit, pick, mergeWith, isFunction } from "lodash-es";
4
- import { batchMerge } from "utils/mergeTemp";
5
- import Render from "core/components/render";
6
- import scButton from "pak/button";
7
- import { checkVisibility, setPx, resolveRender } from "utils";
8
-
9
- export const vnodes = {};
10
- export default (options = {}) => {
11
- return create({
12
- name: "dialog",
13
- mixins: [init("dialogOptions", options)],
14
- data() {
15
- return {
16
- fullscreen: false,
17
- visible: false,
18
- loading: false,
19
- value: {},
20
- };
21
- },
22
- created() {
23
- this.$nextTick(() => {
24
- if (isFunction(options.created)) {
25
- options.created(this);
26
- }
27
- });
28
- },
29
- mounted() {
30
- this.$nextTick(() => {
31
- if (isFunction(options.mounted)) {
32
- options.mounted(this);
33
- }
34
- });
35
- },
36
- computed: {
37
- dialogOptions() {
38
- let opt = this.resultOptions;
39
- // init时已删除presetType
40
- if (options.presetType) {
41
- opt.presetType = options.presetType;
42
- }
43
- opt = batchMerge("render", [opt], this, {}, true)[0];
44
- return opt;
45
- },
46
- dialogType() {
47
- return this.dialogOptions.drawer ? "elDrawer" : "elDialog";
48
- },
49
- footerTemps() {
50
- return {
51
- confirm: {
52
- icon: "el-icon-circle-check",
53
- label: "确定",
54
- type: "primary",
55
- onClick: this.confirm,
56
- },
57
- cancel: {
58
- icon: "el-icon-circle-close",
59
- label: "取消",
60
- onClick: this.cancel,
61
- },
62
- close: {
63
- label: "关闭",
64
- type: "primary",
65
- onClick: this.hide,
66
- },
67
- };
68
- },
69
- footerButtons() {
70
- const footer = { ...this.dialogOptions.footer };
71
- return footer
72
- ? batchMerge("btn.dialog", footer, { ctx: this }, this.footerTemps)
73
- : [];
74
- },
75
- showFooter() {
76
- return checkVisibility(
77
- this.dialogOptions.footer,
78
- null,
79
- this.footerButtons.length > 0
80
- );
81
- },
82
- omitProps() {
83
- return omit(this.dialogOptions, ["size", "beforeClose", "title"]);
84
- },
85
- },
86
- methods: {
87
- async confirm(params) {
88
- const cb = (p) => {
89
- this.visible = false;
90
- this.confirmCb(this, p);
91
- };
92
- if (typeof this.dialogOptions.confirm === "function") {
93
- this.dialogOptions.confirm(cb, this, params);
94
- } else {
95
- cb();
96
- }
97
- return this;
98
- },
99
- cancel(params) {
100
- const cb = (p) => {
101
- this.visible = false;
102
- this.cancelCb(this, p);
103
- };
104
- if (typeof this.dialogOptions.cancel === "function") {
105
- this.dialogOptions.cancel(cb, this, params);
106
- } else {
107
- cb();
108
- }
109
- return this;
110
- },
111
- closed() {
112
- if (!this.dialogOptions.cache) {
113
- this.destroy();
114
- }
115
- if (isFunction(this.dialogOptions.closed)) {
116
- this.dialogOptions.closed(this);
117
- }
118
- },
119
- destroy() {
120
- this.$destroy();
121
- this.$el.remove();
122
- },
123
- hide() {
124
- this.visible = false;
125
- return this;
126
- },
127
- show(confirmCb = () => {}, cancelCb = () => {}) {
128
- this.visible = true;
129
- this.confirmCb = confirmCb;
130
- this.cancelCb = cancelCb;
131
- return this;
132
- },
133
- },
134
- render(h) {
135
- const on = {
136
- ...this.dialogOptions,
137
- "update:visible": (value) => {
138
- this.visible = value;
139
- },
140
- closed: this.closed,
141
- };
142
- const title = () => {
143
- return (
144
- <div
145
- class={[this.b("title")]}
146
- style={{ height: this.dialogOptions.drawer ? "" : "50px" }}
147
- >
148
- <span>{this.dialogOptions.title}</span>
149
- {this.dialogOptions.drawer ? null : (
150
- <span>
151
- <i
152
- title="最大化"
153
- onClick={() => (this.fullscreen = !this.fullscreen)}
154
- class={[
155
- this.fullscreen ? "el-icon-news" : "el-icon-full-screen",
156
- ]}
157
- ></i>
158
- {this.dialogOptions.drag ? (
159
- <i title="拖拽" class="el-icon-rank dialog-drag"></i>
160
- ) : null}
161
- </span>
162
- )}
163
- </div>
164
- );
165
- };
166
- const content = (h) => {
167
- return (
168
- <Render
169
- v-loading={this.loading}
170
- prop="value"
171
- props={this.dialogOptions}
172
- item={this.dialogOptions}
173
- scope={{
174
- ref: this,
175
- row: this,
176
- }}
177
- controlDefault={() => {
178
- return null;
179
- }}
180
- ></Render>
181
- );
182
- };
183
- const footer = (h) => {
184
- if (this.showFooter === false) return;
185
- const render = this.dialogOptions.footer.render;
186
- const buttonRender = () => {
187
- return this.footerButtons.map((item) => (
188
- <scButton
189
- props={item}
190
- attrs={omit(item, ["onClick"])}
191
- loading={this.loading}
192
- size={this.dialogOptions.size}
193
- onClick={() => item.onClick(this)}
194
- scope={this}
195
- ></scButton>
196
- ));
197
- };
198
- return (
199
- <div
200
- class={this.b("footer", this.dialogOptions.footer.align || "right")}
201
- >
202
- {render
203
- ? resolveRender(render, h, this, buttonRender)
204
- : buttonRender()}
205
- </div>
206
- );
207
- };
208
- return (
209
- <this.dialogType
210
- v-scDialogDrag={this.dialogOptions.drag}
211
- v-scDialogDragHeight={this.dialogOptions.dragSize}
212
- class={[this.b(), this.dialogOptions.class]}
213
- size={setPx(this.dialogOptions.width || "600px")}
214
- width={setPx(this.dialogOptions.width || "600px")}
215
- fullscreen={this.fullscreen}
216
- visible={this.visible}
217
- beforeClose={this.cancel}
218
- close-on-click-modal={false}
219
- props={this.omitProps}
220
- on={on}
221
- scopedSlots={{
222
- title,
223
- }}
224
- >
225
- <div class={[this.b("body"), this.showFooter ? "has-footer" : ""]}>
226
- {content(h)}
227
- </div>
228
- {footer(h)}
229
- </this.dialogType>
230
- );
231
- },
232
- });
233
- };
@@ -1,15 +0,0 @@
1
- <script>
2
- export default {
3
- mounted() {
4
- this.vm = this.$scDialog({
5
- ...this.$attrs,
6
- render: () => this.$slots.default,
7
- });
8
- },
9
- methods: {
10
- show() {
11
- return this.vm.show();
12
- },
13
- },
14
- };
15
- </script>
@@ -1,22 +0,0 @@
1
- import DialogComponent from "./dialog.js";
2
-
3
- export default function (options) {
4
- const caller = this || {};
5
-
6
- let DialogConstructor = window.Vue.extend(DialogComponent(options));
7
-
8
- // 注入路由根实例
9
- const routerMixin = {
10
- beforeCreate() {
11
- this._routerRoot = caller._routerRoot;
12
- },
13
- };
14
- if (caller._routerRoot) {
15
- DialogConstructor.mixin(routerMixin);
16
- }
17
-
18
- let instance = new DialogConstructor();
19
- instance.vm = instance.$mount();
20
- document.body.appendChild(instance.vm.$el);
21
- return instance.vm;
22
- }
@@ -1,179 +0,0 @@
1
- <template>
2
- <span>
3
- <template v-if="multiple">
4
- <div v-for="(Labels, Index) in multipleLabels" :key="Index">
5
- <span v-for="(label, index) in Labels" :key="index">
6
- <span v-if="index !== 0"> / </span>
7
- <span>{{ label }}</span>
8
- </span>
9
- </div>
10
- </template>
11
- <template v-else>
12
- <span v-for="(label, index) in labels" :key="index">
13
- <span v-if="index !== 0"> / </span>
14
- <span>{{ label }}</span>
15
- </span>
16
- </template>
17
- </span>
18
- </template>
19
-
20
- <script>
21
- import { create } from "core";
22
- // 级联数据格式化组件
23
- export default create({
24
- name: "cascade-format",
25
- props: {
26
- // 值<br/>
27
- // 单选时 '1,2,3' 或 [1,2,3]<br/>
28
- // 多选[[1,2,3],[4,5,6]]<br/>
29
- value: {
30
- type: [String, Array],
31
- require: true,
32
- },
33
- // value的分隔符<br/>
34
- // 多选时,如果value为string,则以该分隔符分割成多个展示<br/>
35
- // 传入空字符串,表示不分割<br/>
36
- separator: { default: ",", require: false },
37
- // 是否多选
38
- multiple: { type: Boolean, default: false },
39
- scope: Object,
40
- options: Array,
41
- props: {
42
- type: Object,
43
- default() {
44
- return {
45
- value: "value",
46
- label: "label",
47
- children: "children",
48
- };
49
- },
50
- },
51
- },
52
- data() {
53
- return {};
54
- },
55
- computed: {
56
- labels() {
57
- if (this.value == null) {
58
- return [];
59
- }
60
- return this.buildValueItem(this.value);
61
- },
62
- multipleLabels() {
63
- if (this.value == null) {
64
- return [];
65
- }
66
- const arr = [];
67
- for (const item of this.value) {
68
- arr.push(this.buildValueItem(item));
69
- }
70
- return arr;
71
- },
72
- _options() {
73
- return this.options || this.scope.dict;
74
- },
75
- },
76
- methods: {
77
- getValueArr(values) {
78
- if (values == null) {
79
- if (this.multiple) {
80
- values = [];
81
- for (const item of this.value) {
82
- for (const sub of item) {
83
- values.push(sub);
84
- }
85
- }
86
- } else {
87
- values = this.value;
88
- }
89
- }
90
- if (values == null) {
91
- return [];
92
- }
93
- let arr = null;
94
- if (
95
- typeof values === "string" &&
96
- !this.multiple &&
97
- this.separator != null &&
98
- this.separator !== ""
99
- ) {
100
- arr = values.split(this.separator);
101
- } else if (values instanceof Array) {
102
- arr = values;
103
- } else {
104
- arr = [values];
105
- }
106
- return arr;
107
- },
108
- getDictItem(value, dict, deepMatch) {
109
- let valueName = "value";
110
- if (this.props.value) {
111
- valueName = this.props.value;
112
- }
113
- if (deepMatch) {
114
- let childrenName = "children";
115
- if (this.props.children) {
116
- childrenName = this.props.children;
117
- }
118
- return this.deepMatch(value, valueName, childrenName, dict);
119
- } else {
120
- for (const item of dict) {
121
- if (item[valueName] === value) {
122
- return item;
123
- }
124
- }
125
- }
126
- },
127
- deepMatch(value, valueName, childrenName, dict) {
128
- for (const item of dict) {
129
- if (item[valueName] === value) {
130
- return item;
131
- }
132
- }
133
- for (const item of dict) {
134
- if (item[childrenName]) {
135
- const matched = this.deepMatch(
136
- value,
137
- valueName,
138
- childrenName,
139
- item[childrenName]
140
- );
141
- if (matched) {
142
- return matched;
143
- }
144
- }
145
- }
146
- },
147
- buildValueItem(values) {
148
- const arr = this.getValueArr(values);
149
- let labelName = "label";
150
- if (this.props != null && this.props.label != null) {
151
- labelName = this.props.label;
152
- }
153
-
154
- let childrenName = "children";
155
- if (this.props != null && this.props.children != null) {
156
- childrenName = this.props.children;
157
- }
158
- const labelArr = [];
159
-
160
- if (this._options && this._options.length > 0) {
161
- let dict = this._options;
162
- const deepMatch = arr.length === 1;
163
- for (const value of arr) {
164
- if (dict != null) {
165
- const dictItem = this.getDictItem(value, dict, deepMatch);
166
- if (dictItem != null) {
167
- dict = dictItem[childrenName];
168
- labelArr.push(dictItem[labelName]);
169
- continue;
170
- }
171
- }
172
- labelArr.push(value);
173
- }
174
- }
175
- return labelArr;
176
- },
177
- },
178
- });
179
- </script>
@@ -1,40 +0,0 @@
1
- <template>
2
- <span>{{ doFormat}}</span>
3
- </template>
4
-
5
- <script>
6
- import dayjs from 'dayjs'
7
- // 日期格式化展示组件
8
- export default {
9
- name: 'date-format',
10
- props: {
11
- // 日期时间值,支持long,string,date等,由dayjs转化
12
- value: { required: true },
13
- // 输入格式化,不传则由dayjs自动转化
14
- valueFormat: { required: false },
15
- // 输出格式化
16
- format: { default: 'YYYY-MM-DD HH:mm:ss', required: false }
17
- },
18
- computed: {
19
- doFormat () {
20
- if (this.value == null || this.value === '') {
21
- return ''
22
- }
23
- let date = null
24
- if (this.valueFormat != null) {
25
- date = dayjs(this.value, this.valueFormat)
26
- } else {
27
- date = dayjs(this.value)
28
- }
29
- return date.format(this.format)
30
- }
31
- },
32
- data () {
33
- return {
34
- item: {}
35
- }
36
- },
37
- created () {},
38
- methods: {}
39
- }
40
- </script>
@@ -1,61 +0,0 @@
1
- <template>
2
- <el-cascader
3
- ref="target"
4
- :value="currentValue"
5
- v-bind="$attrs"
6
- @input="onInput"
7
- v-on="listeners"
8
- :options="_options"
9
- />
10
- </template>
11
-
12
- <script>
13
- import input from "./input";
14
- import { create } from "core";
15
- import { omit } from "lodash-es";
16
- import extendMethod from "./extendMethod";
17
- // 级联选择器
18
- export default create({
19
- name: "cascader",
20
- mixins: [input, extendMethod],
21
- props: {
22
- // 值
23
- value: {
24
- default: () => {
25
- return [];
26
- },
27
- require: false,
28
- },
29
- scope: Object,
30
- options: Array,
31
- },
32
- data() {
33
- return {};
34
- },
35
- computed: {
36
- _options() {
37
- return this.options || this.scope?.dict;
38
- },
39
- listeners() {
40
- return omit(this.$listeners, ["input"]);
41
- },
42
- },
43
- methods: {
44
- setValue(value) {
45
- if (value == null) {
46
- this.currentValue = [];
47
- return;
48
- }
49
- if (typeof this.value === "string") {
50
- this.currentValue = value.split(",");
51
- return;
52
- }
53
- if (value instanceof Array) {
54
- this.currentValue = value;
55
- return;
56
- }
57
- this.currentValue = [];
58
- },
59
- },
60
- });
61
- </script>