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.
Files changed (291) hide show
  1. package/.browserslistrc +3 -0
  2. package/.versionrc.json +36 -0
  3. package/CHANGELOG.md +232 -0
  4. package/LICENSE +201 -0
  5. package/README.md +46 -0
  6. package/babel.config.js +12 -0
  7. package/build/alias.js +10 -0
  8. package/build/build.js +52 -0
  9. package/build/config.js +70 -0
  10. package/deploy.bat +14 -0
  11. package/docs/.vuepress/components/button/base.vue +88 -0
  12. package/docs/.vuepress/components/common/code-format.vue +331 -0
  13. package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +68 -0
  14. package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +73 -0
  15. package/docs/.vuepress/components/commonConfig/renderType/component.vue +160 -0
  16. package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +49 -0
  17. package/docs/.vuepress/components/commonConfig/renderType/render.vue +91 -0
  18. package/docs/.vuepress/components/commonConfig/renderType/slot.vue +63 -0
  19. package/docs/.vuepress/components/crud/baseUse/baseUse.vue +98 -0
  20. package/docs/.vuepress/components/crud/baseUse/columnAction.vue +72 -0
  21. package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +107 -0
  22. package/docs/.vuepress/components/crud/baseUse/handleRow.vue +65 -0
  23. package/docs/.vuepress/components/crud/baseUse/height.vue +82 -0
  24. package/docs/.vuepress/components/crud/baseUse/index.vue +54 -0
  25. package/docs/.vuepress/components/crud/baseUse/loading.vue +70 -0
  26. package/docs/.vuepress/components/crud/baseUse/pagination.vue +108 -0
  27. package/docs/.vuepress/components/crud/baseUse/selection.vue +114 -0
  28. package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +118 -0
  29. package/docs/.vuepress/components/crud/baseUse/title.vue +54 -0
  30. package/docs/.vuepress/components/crud/baseUse/toolbar.vue +69 -0
  31. package/docs/.vuepress/components/crud/buttons/common.vue +115 -0
  32. package/docs/.vuepress/components/crud/buttons/fast.vue +82 -0
  33. package/docs/.vuepress/components/crud/contextMenu/base.vue +72 -0
  34. package/docs/.vuepress/components/crud/copy.vue +52 -0
  35. package/docs/.vuepress/components/crud/crudEvents/api.vue +157 -0
  36. package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +93 -0
  37. package/docs/.vuepress/components/crud/crudEvents/events.vue +188 -0
  38. package/docs/.vuepress/components/crud/dataSort/base.vue +142 -0
  39. package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +53 -0
  40. package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +111 -0
  41. package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +68 -0
  42. package/docs/.vuepress/components/crud/handleBar/handleRow.vue +65 -0
  43. package/docs/.vuepress/components/crud/handleBar/toolbar.vue +69 -0
  44. package/docs/.vuepress/components/crud/renderType/1.vue +57 -0
  45. package/docs/.vuepress/components/crud/renderType/2.vue +63 -0
  46. package/docs/.vuepress/components/crud/renderType/3.vue +105 -0
  47. package/docs/.vuepress/components/crud/renderType/5.vue +91 -0
  48. package/docs/.vuepress/components/crud/search/1.vue +90 -0
  49. package/docs/.vuepress/components/crud/search/2.vue +78 -0
  50. package/docs/.vuepress/components/crud/search/3.vue +107 -0
  51. package/docs/.vuepress/components/crud/search/base.vue +123 -0
  52. package/docs/.vuepress/components/crud/search/localSearch.vue +124 -0
  53. package/docs/.vuepress/components/crud/search/special.vue +148 -0
  54. package/docs/.vuepress/components/crud/selection/events.vue +47 -0
  55. package/docs/.vuepress/components/crud/selection/pagination.vue +94 -0
  56. package/docs/.vuepress/components/crud/selection/singleSelection.vue +64 -0
  57. package/docs/.vuepress/components/crud/span/base.vue +69 -0
  58. package/docs/.vuepress/components/crud/span/special.vue +75 -0
  59. package/docs/.vuepress/components/crud/summary/base.vue +99 -0
  60. package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +174 -0
  61. package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +194 -0
  62. package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +219 -0
  63. package/docs/.vuepress/components/crud/tableEdit/dialog.vue +172 -0
  64. package/docs/.vuepress/components/crud/tableEdit/free.vue +88 -0
  65. package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +82 -0
  66. package/docs/.vuepress/components/crud/tableEdit/methods.vue +154 -0
  67. package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +107 -0
  68. package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +116 -0
  69. package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +98 -0
  70. package/docs/.vuepress/components/crud/validate/base.vue +122 -0
  71. package/docs/.vuepress/components/crud/validate/custom.vue +82 -0
  72. package/docs/.vuepress/components/crud/validate/regulars.vue +88 -0
  73. package/docs/.vuepress/components/crud/validate/relation.vue +91 -0
  74. package/docs/.vuepress/components/crud/validate/tree.vue +82 -0
  75. package/docs/.vuepress/components/dialog/baseUse/base.vue +92 -0
  76. package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +78 -0
  77. package/docs/.vuepress/components/dialog/baseUse/control.vue +79 -0
  78. package/docs/.vuepress/components/dialog/baseUse/drawer.vue +59 -0
  79. package/docs/.vuepress/components/dialog/baseUse/footer.vue +87 -0
  80. package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +79 -0
  81. package/docs/.vuepress/components/dict/DictLinkage.vue +91 -0
  82. package/docs/.vuepress/components/dict/baseUse.vue +72 -0
  83. package/docs/.vuepress/components/dict/component.vue +82 -0
  84. package/docs/.vuepress/components/dict/localDict.vue +68 -0
  85. package/docs/.vuepress/components/form/baseUse/base.vue +48 -0
  86. package/docs/.vuepress/components/form/baseUse/dataFormat.vue +92 -0
  87. package/docs/.vuepress/components/form/baseUse/deep.vue +57 -0
  88. package/docs/.vuepress/components/form/baseUse/gridLayout.vue +47 -0
  89. package/docs/.vuepress/components/form/baseUse/group.vue +66 -0
  90. package/docs/.vuepress/components/form/baseUse/hidden.vue +40 -0
  91. package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +48 -0
  92. package/docs/.vuepress/components/form/baseUse/label.vue +51 -0
  93. package/docs/.vuepress/components/form/baseUse/tooltip.vue +40 -0
  94. package/docs/.vuepress/components/form/baseUse/validate.vue +52 -0
  95. package/docs/.vuepress/components/form/detail/base.vue +78 -0
  96. package/docs/.vuepress/components/form/detail/border.vue +90 -0
  97. package/docs/.vuepress/components/form/detail/singleDetail.vue +72 -0
  98. package/docs/.vuepress/components/formatData/baseUse.vue +131 -0
  99. package/docs/.vuepress/components/mock/index.js +347 -0
  100. package/docs/.vuepress/components/mockData/custom.vue +69 -0
  101. package/docs/.vuepress/components/mockData/example.vue +290 -0
  102. package/docs/.vuepress/components/positionSlot/base.vue +24 -0
  103. package/docs/.vuepress/components/positionSlot/form.vue +71 -0
  104. package/docs/.vuepress/components/positionSlot/table.vue +85 -0
  105. package/docs/.vuepress/components/tabs/base.vue +57 -0
  106. package/docs/.vuepress/components/temp.js +195 -0
  107. package/docs/.vuepress/config.js +146 -0
  108. package/docs/.vuepress/enhanceApp.js +142 -0
  109. package/docs/.vuepress/public/favicon.ico +0 -0
  110. package/docs/.vuepress/public/super.png +0 -0
  111. package/docs/.vuepress/styles/index.styl +25 -0
  112. package/docs/.vuepress/styles/palette.styl +6 -0
  113. package/docs/README.md +14 -0
  114. package/docs/guide/button/base.md +31 -0
  115. package/docs/guide/commonConfig/jsx.md +166 -0
  116. package/docs/guide/commonConfig/presetCodeTemplate.md +68 -0
  117. package/docs/guide/commonConfig/renderType.md +181 -0
  118. package/docs/guide/crud/baseUse.md +120 -0
  119. package/docs/guide/crud/buttons.md +18 -0
  120. package/docs/guide/crud/config.md +217 -0
  121. package/docs/guide/crud/contextMenu.md +18 -0
  122. package/docs/guide/crud/dataSort.md +66 -0
  123. package/docs/guide/crud/genDynamicColumns.md +145 -0
  124. package/docs/guide/crud/handleBar.md +26 -0
  125. package/docs/guide/crud/renderType.md +4 -0
  126. package/docs/guide/crud/search.md +150 -0
  127. package/docs/guide/crud/selection.md +73 -0
  128. package/docs/guide/crud/span.md +98 -0
  129. package/docs/guide/crud/summary.md +167 -0
  130. package/docs/guide/crud/tableEdit.md +377 -0
  131. package/docs/guide/crud/validate.md +158 -0
  132. package/docs/guide/dialog/baseUse.md +81 -0
  133. package/docs/guide/dict/baseUse.md +174 -0
  134. package/docs/guide/dict/component.md +88 -0
  135. package/docs/guide/dict/config.md +44 -0
  136. package/docs/guide/form/baseUse.md +142 -0
  137. package/docs/guide/form/detail.md +38 -0
  138. package/docs/guide/formatData/baseUse.md +98 -0
  139. package/docs/guide/formatData/config.md +142 -0
  140. package/docs/guide/mockData/base.md +26 -0
  141. package/docs/guide/positionSlot/base.md +41 -0
  142. package/docs/guide/question/base.md +44 -0
  143. package/docs/guide/start/base.md +30 -0
  144. package/docs/guide/tabs/base.md +63 -0
  145. package/examples/App.vue +52 -0
  146. package/examples/Layout/components/AppMain.vue +40 -0
  147. package/examples/Layout/components/Item.vue +29 -0
  148. package/examples/Layout/components/Link.vue +44 -0
  149. package/examples/Layout/components/SidebarItem.vue +93 -0
  150. package/examples/Layout/index.vue +69 -0
  151. package/examples/assets/logo.png +0 -0
  152. package/examples/favicon.ico +0 -0
  153. package/examples/index.html +18 -0
  154. package/examples/main.js +54 -0
  155. package/examples/router/index.js +140 -0
  156. package/examples/store/index.js +0 -0
  157. package/examples/styles/index.scss +63 -0
  158. package/examples/styles/sidebar.scss +226 -0
  159. package/examples/styles/transition.scss +48 -0
  160. package/examples/styles/variables.scss +25 -0
  161. package/examples/views/crud/base.vue +68 -0
  162. package/examples/views/crud/handleRow.vue +84 -0
  163. package/examples/views/crud/search.vue +116 -0
  164. package/examples/views/dashboard/index.vue +244 -0
  165. package/examples/views/dashboard/index1.vue +234 -0
  166. package/examples/views/dashboard/test.vue +9 -0
  167. package/examples/views/formTest/index.vue +168 -0
  168. package/examples/views/nested/menu1/index.vue +7 -0
  169. package/examples/views/nested/menu1/menu1-1/index.vue +7 -0
  170. package/examples/views/nested/menu1/menu1-2/index.vue +7 -0
  171. package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
  172. package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
  173. package/examples/views/nested/menu1/menu1-3/index.vue +5 -0
  174. package/examples/views/nested/menu2/index.vue +5 -0
  175. package/gulpfile.js +84 -0
  176. package/lib/index.css +1 -0
  177. package/lib/super-crud.min.js +15 -0
  178. package/package.json +66 -0
  179. package/packages/button/index.vue +189 -0
  180. package/packages/core/components/comp.vue +223 -0
  181. package/packages/core/components/position.vue +135 -0
  182. package/packages/core/components/render.vue +460 -0
  183. package/packages/core/configManager.js +302 -0
  184. package/packages/core/create.js +8 -0
  185. package/packages/core/defaultRender.js +64 -0
  186. package/packages/core/dict/global.js +10 -0
  187. package/packages/core/dict/index.js +432 -0
  188. package/packages/core/dict/mixin.js +94 -0
  189. package/packages/core/event.js +60 -0
  190. package/packages/core/index.js +6 -0
  191. package/packages/core/init.js +122 -0
  192. package/packages/core/mock/genConfig.js +228 -0
  193. package/packages/core/mock/genData.js +422 -0
  194. package/packages/core/mock/index.js +4 -0
  195. package/packages/core/rules.js +111 -0
  196. package/packages/crud/column.vue +205 -0
  197. package/packages/crud/columnAction.vue +207 -0
  198. package/packages/crud/columnCell.vue +146 -0
  199. package/packages/crud/defaultColumn.vue +130 -0
  200. package/packages/crud/drawerColumn.vue +225 -0
  201. package/packages/crud/form.vue +69 -0
  202. package/packages/crud/index.vue +564 -0
  203. package/packages/crud/menuBar.vue +298 -0
  204. package/packages/crud/mixins/cacheHandler.js +36 -0
  205. package/packages/crud/mixins/calcColumnWidth.js +79 -0
  206. package/packages/crud/mixins/calcHeight.js +105 -0
  207. package/packages/crud/mixins/columnHandler.js +128 -0
  208. package/packages/crud/mixins/contextMenu.js +98 -0
  209. package/packages/crud/mixins/dataProcessor.js +202 -0
  210. package/packages/crud/mixins/dialog.js +109 -0
  211. package/packages/crud/mixins/excelHandler.js +150 -0
  212. package/packages/crud/mixins/exposeMethods.js +107 -0
  213. package/packages/crud/mixins/generateDynamicColumns.js +250 -0
  214. package/packages/crud/mixins/props.js +38 -0
  215. package/packages/crud/mixins/searchHandler.js +151 -0
  216. package/packages/crud/mixins/select.js +359 -0
  217. package/packages/crud/mixins/spanMethod.js +288 -0
  218. package/packages/crud/mixins/summary.js +177 -0
  219. package/packages/crud/mixins/tableEdit.js +547 -0
  220. package/packages/crud/mixins/validate.js +219 -0
  221. package/packages/crud/pagination.vue +110 -0
  222. package/packages/crud/search.vue +119 -0
  223. package/packages/crud/searchHeader.vue +231 -0
  224. package/packages/crud/selectBanner.vue +138 -0
  225. package/packages/crud/utils/EditState.js +319 -0
  226. package/packages/crud/utils/excelExport.js +112 -0
  227. package/packages/crud/utils/excelImport.js +112 -0
  228. package/packages/crud/utils/index.js +98 -0
  229. package/packages/dialog/dialog.js +233 -0
  230. package/packages/dialog/dialog.vue +15 -0
  231. package/packages/dialog/index.js +22 -0
  232. package/packages/dict/cascadeFormat.vue +179 -0
  233. package/packages/dict/dateFormat.vue +40 -0
  234. package/packages/dict/form/cascade.vue +61 -0
  235. package/packages/dict/form/checkbox.vue +90 -0
  236. package/packages/dict/form/extendMethod.js +22 -0
  237. package/packages/dict/form/input-base.js +31 -0
  238. package/packages/dict/form/input.js +20 -0
  239. package/packages/dict/form/radio.vue +69 -0
  240. package/packages/dict/form/select.vue +118 -0
  241. package/packages/dict/form/switch.vue +75 -0
  242. package/packages/dict/valueFormat.vue +188 -0
  243. package/packages/directive/dialog/drag.js +86 -0
  244. package/packages/directive/dialog/dragSize.js +42 -0
  245. package/packages/directive/index.js +9 -0
  246. package/packages/directive/insertSlot.js +10 -0
  247. package/packages/form/contextMenu.js +192 -0
  248. package/packages/form/draftDrawer.vue +391 -0
  249. package/packages/form/formAction.vue +97 -0
  250. package/packages/form/formItem.vue +259 -0
  251. package/packages/form/index.vue +451 -0
  252. package/packages/form/props.js +15 -0
  253. package/packages/grid/cell.vue +65 -0
  254. package/packages/grid/index.vue +130 -0
  255. package/packages/group/index.vue +96 -0
  256. package/packages/tabs/index.vue +290 -0
  257. package/packages/tooltip/index.js +9 -0
  258. package/packages/tooltip/tooltip.vue +32 -0
  259. package/packages/tooltip/tooltipComponent.js +38 -0
  260. package/packages/verifyInput/index.vue +131 -0
  261. package/src/config/common.js +88 -0
  262. package/src/config/crud.js +567 -0
  263. package/src/config/dialog.js +87 -0
  264. package/src/config/form.js +215 -0
  265. package/src/config/index.js +9 -0
  266. package/src/constants/index.js +72 -0
  267. package/src/index.js +67 -0
  268. package/src/template/btn/crud.js +6 -0
  269. package/src/template/btn/dialog.js +1 -0
  270. package/src/template/btn/form.js +3 -0
  271. package/src/template/btn/index.js +9 -0
  272. package/src/template/dicts.js +1 -0
  273. package/src/template/formatData.js +507 -0
  274. package/src/template/index.js +19 -0
  275. package/src/template/render.js +124 -0
  276. package/src/template/rules.js +53 -0
  277. package/src/utils/bem.js +49 -0
  278. package/src/utils/cache.js +77 -0
  279. package/src/utils/getType.js +34 -0
  280. package/src/utils/index.js +212 -0
  281. package/src/utils/mergeTemp.js +124 -0
  282. package/styles/button.scss +3 -0
  283. package/styles/crud.scss +425 -0
  284. package/styles/dialog.scss +95 -0
  285. package/styles/form.scss +532 -0
  286. package/styles/group.scss +78 -0
  287. package/styles/index.scss +94 -0
  288. package/styles/tabs.scss +139 -0
  289. package/styles/verifyInput.scss +56 -0
  290. package/vue-jsx-sync.js +90 -0
  291. package/vue.config.js +54 -0
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <div
3
+ v-if="!hidden"
4
+ :class="[b({ header: !isHeader, arrow: disabled, border: border })]"
5
+ >
6
+ <slot name="tabs" />
7
+ <el-collapse v-model="activeName" :value="text" @change="handleChange">
8
+ <el-collapse-item :name="1" :disabled="disabled">
9
+ <template #title>
10
+ <div v-if="$slots.header && !hiddenHeader" :class="[b('header')]">
11
+ <slot name="header" />
12
+ </div>
13
+ <div
14
+ v-else-if="(label || icon) && !hiddenHeader"
15
+ :class="[b('header')]"
16
+ >
17
+ <i v-if="icon" :class="[icon, b('icon')]" />
18
+ <h1 v-if="label" :class="[b('title'), tag ? b('tag') : '']">
19
+ {{ label }}
20
+ </h1>
21
+ </div>
22
+ </template>
23
+ <slot />
24
+ </el-collapse-item>
25
+ </el-collapse>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ import create from "core/create";
31
+
32
+ export default create({
33
+ name: "group",
34
+ data() {
35
+ return {
36
+ activeName: "",
37
+ };
38
+ },
39
+ props: {
40
+ border: {
41
+ type: Boolean,
42
+ default: true,
43
+ },
44
+ disabled: {
45
+ type: Boolean,
46
+ default: false,
47
+ },
48
+ hiddenHeader: {
49
+ type: Boolean,
50
+ default: false,
51
+ },
52
+ collapse: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ icon: {
57
+ type: String,
58
+ },
59
+ hidden: {
60
+ type: Boolean,
61
+ default: false,
62
+ },
63
+ label: {
64
+ type: String,
65
+ },
66
+ tag: {
67
+ type: Boolean,
68
+ default: true,
69
+ },
70
+ },
71
+ watch: {
72
+ text(val) {
73
+ this.activeName = [val];
74
+ },
75
+ },
76
+ computed: {
77
+ text() {
78
+ return this.collapse ? 1 : 0;
79
+ },
80
+ isHeader() {
81
+ return (
82
+ (this.$slots.header && !this.hiddenHeader) ||
83
+ ((this.label || this.icon) && !this.hiddenHeader)
84
+ );
85
+ },
86
+ },
87
+ created() {
88
+ this.activeName = [this.text];
89
+ },
90
+ methods: {
91
+ handleChange(activeNames) {
92
+ this.$emit("change", activeNames);
93
+ },
94
+ },
95
+ });
96
+ </script>
@@ -0,0 +1,290 @@
1
+ <template>
2
+ <div :class="[b(), { [b('border')]: border || $attrs.type === 'card' }]">
3
+ <!-- 标签页头部 -->
4
+ <el-tabs
5
+ v-model="activeName"
6
+ v-if="tabList.length"
7
+ v-bind="$attrs"
8
+ v-on="omitListeners"
9
+ @tab-click="handleTabClick"
10
+ >
11
+ <!-- 全部标签页 -->
12
+ <el-tab-pane v-if="all" :label="allConfig.label" name="all" />
13
+
14
+ <!-- 动态标签页 -->
15
+ <el-tab-pane
16
+ v-for="(item, index) in tabList"
17
+ :key="getItemKey(item, index)"
18
+ :label="getItemLabel(item)"
19
+ :name="getItemName(item, index)"
20
+ v-bind="getItem(item)"
21
+ >
22
+ <template #label>
23
+ <i v-if="item.icon" :class="item.icon"></i>
24
+ <slot
25
+ v-if="$scopedSlots[getItemName(item, index) + '-label']"
26
+ :name="getItemName(item, index) + '-label'"
27
+ v-bind="item"
28
+ />
29
+ <template v-else>{{ getItemLabel(item) }}</template>
30
+ <i
31
+ v-if="refresh && cache && activeName === getItemName(item, index)"
32
+ class="el-icon-refresh"
33
+ :class="{ rotating: isRefreshing }"
34
+ title="刷新"
35
+ @click.stop="refreshTab(item, index)"
36
+ />
37
+ </template>
38
+ </el-tab-pane>
39
+ </el-tabs>
40
+
41
+ <!-- 插槽内容 -->
42
+ <slot />
43
+
44
+ <!-- 标签页内容区 -->
45
+ <div :class="[b('content'), { [b('is-refresh')]: isRefreshing }]">
46
+ <transition-group name="fade-transform" mode="out-in">
47
+ <template v-for="(item, index) in tabList">
48
+ <div
49
+ v-if="shouldRenderTab(item, index)"
50
+ :key="getItemKey(item, index)"
51
+ v-show="currentTab === getItemName(item, index)"
52
+ class="tab-pane"
53
+ :class="{ 'is-active': currentTab === getItemName(item, index) }"
54
+ >
55
+ <slot
56
+ v-if="$scopedSlots[getItemName(item, index)]"
57
+ :name="getItemName(item, index)"
58
+ />
59
+ <Render
60
+ v-else
61
+ v-bind="item"
62
+ :item="item"
63
+ :scope="{
64
+ row: item.value,
65
+ }"
66
+ />
67
+ </div>
68
+ </template>
69
+ </transition-group>
70
+ </div>
71
+ </div>
72
+ </template>
73
+
74
+ <script>
75
+ import { create } from "core";
76
+ import { isPlainObject, omit } from "lodash-es";
77
+ import Render from "core/components/render";
78
+
79
+ export default create({
80
+ name: "tabs",
81
+
82
+ props: {
83
+ value: {},
84
+ tabList: {
85
+ type: Array,
86
+ default: () => [],
87
+ },
88
+ cache: {
89
+ type: Boolean,
90
+ default: true,
91
+ },
92
+ all: [Boolean, Object],
93
+ border: Boolean,
94
+ cacheActive: {
95
+ type: Boolean,
96
+ default: true,
97
+ },
98
+ refresh: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+ },
103
+ components: {
104
+ Render,
105
+ },
106
+
107
+ data() {
108
+ return {
109
+ activeName: "",
110
+ renderedTabs: new Set(),
111
+ currentTab: "",
112
+ isRefreshing: false,
113
+ scope: { row: {} },
114
+ };
115
+ },
116
+
117
+ computed: {
118
+ omitListeners() {
119
+ return omit(this.$listeners, ["tab-click", "input"]);
120
+ },
121
+
122
+ allConfig() {
123
+ const defaultConfig = {
124
+ label: "全部",
125
+ name: null,
126
+ };
127
+ return isPlainObject(this.all)
128
+ ? { ...defaultConfig, ...this.all }
129
+ : defaultConfig;
130
+ },
131
+ },
132
+
133
+ watch: {
134
+ value: {
135
+ handler(val) {
136
+ this.initActiveName(val);
137
+ },
138
+ immediate: true,
139
+ },
140
+
141
+ activeName: {
142
+ handler(val) {
143
+ if (!val) return;
144
+
145
+ this.handleTabTransition(val);
146
+ this.renderedTabs.add(val);
147
+
148
+ const emitValue = this.all && val === "all" ? this.allConfig.name : val;
149
+ this.$emit("input", emitValue);
150
+ },
151
+ immediate: true,
152
+ },
153
+
154
+ tabList: {
155
+ handler() {
156
+ this.initActiveName(this.value);
157
+ },
158
+ },
159
+ },
160
+
161
+ mounted() {
162
+ // 从路由中恢复激活的标签
163
+ if (this.cacheActive && this.$route?.query.tabActive) {
164
+ this.activeName = this.$route.query.tabActive;
165
+ }
166
+ this.$nextTick(this.updateContentHeight);
167
+
168
+ // 创建 ResizeObserver 实例
169
+ this.resizeObserver = new ResizeObserver(() => {
170
+ this.updateContentHeight();
171
+ });
172
+
173
+ // 观察活动面板
174
+ this.observeActivePane();
175
+ },
176
+ updated() {
177
+ this.$nextTick(this.updateContentHeight);
178
+ },
179
+
180
+ beforeDestroy() {
181
+ // 清理 ResizeObserver
182
+ if (this.resizeObserver) {
183
+ this.resizeObserver.disconnect();
184
+ }
185
+ },
186
+
187
+ methods: {
188
+ handleTabClick(tab) {
189
+ this.$nextTick(() => {
190
+ if (this.cacheActive) {
191
+ this.updateRouteQuery(this.activeName);
192
+ }
193
+ this.$emit(
194
+ "tab-click",
195
+ tab,
196
+ this.tabList.find(
197
+ (item) => this.getItemName(item) === this.activeName
198
+ )
199
+ );
200
+ });
201
+ },
202
+
203
+ initActiveName(val) {
204
+ if (!this.tabList.length) return;
205
+
206
+ this.activeName =
207
+ val || (this.all && "all") || this.getItemName(this.tabList[0], 0);
208
+ },
209
+
210
+ getItem(item) {
211
+ return isPlainObject(item) ? item : {};
212
+ },
213
+
214
+ getItemKey(item, index) {
215
+ return `${item?.label || index}`;
216
+ },
217
+
218
+ getItemLabel(item) {
219
+ return item?.label || item;
220
+ },
221
+
222
+ getItemName(item, index) {
223
+ return `${item?.name || item?.value || index}`;
224
+ },
225
+
226
+ shouldRenderTab(item, index) {
227
+ const tabName = this.getItemName(item, index);
228
+ const shouldCache = item.cache === undefined ? this.cache : item.cache;
229
+ return shouldCache
230
+ ? this.renderedTabs.has(tabName)
231
+ : this.currentTab === tabName;
232
+ },
233
+
234
+ updateRouteQuery(val) {
235
+ if (!this.$route) return;
236
+
237
+ this.$router.replace({
238
+ path: this.$route.path,
239
+ query: {
240
+ ...this.$route.query,
241
+ tabActive: val,
242
+ },
243
+ });
244
+ },
245
+
246
+ async refreshTab(item, index) {
247
+ if (this.isRefreshing) return;
248
+
249
+ this.$emit("refresh", item, index);
250
+ const tabName = this.getItemName(item, index);
251
+ this.isRefreshing = true;
252
+
253
+ // 移除缓存
254
+ this.renderedTabs.delete(tabName);
255
+ await this.$nextTick();
256
+
257
+ // 重新渲染
258
+ setTimeout(() => {
259
+ this.renderedTabs.add(tabName);
260
+ this.isRefreshing = false;
261
+ }, 300);
262
+ },
263
+ updateContentHeight() {
264
+ // 获取当前激活的面板
265
+ const activePane = this.$el.querySelector(".tab-pane.is-active");
266
+ if (activePane) {
267
+ // 获取面板实际高度并设置给容器
268
+ const height = activePane.offsetHeight;
269
+ const content = this.$el.querySelector(".sc-tabs__content");
270
+ if (content) {
271
+ content.style.height = `${height}px`;
272
+ }
273
+ }
274
+ },
275
+ observeActivePane() {
276
+ const activePane = this.$el.querySelector(".tab-pane.is-active");
277
+ if (activePane && this.resizeObserver) {
278
+ this.resizeObserver.disconnect(); // 先断开之前的观察
279
+ this.resizeObserver.observe(activePane); // 观察新的活动面板
280
+ }
281
+ },
282
+
283
+ async handleTabTransition(val) {
284
+ this.currentTab = val;
285
+ await this.$nextTick();
286
+ this.observeActivePane(); // 切换标签页时重新观察
287
+ },
288
+ },
289
+ });
290
+ </script>
@@ -0,0 +1,9 @@
1
+ import tooltipComponent from "./tooltipComponent.js";
2
+
3
+ export default function (options) {
4
+ let DialogConstructor = window.Vue.extend(tooltipComponent(options));
5
+ let instance = new DialogConstructor();
6
+ instance.vm = instance.$mount();
7
+ document.body.appendChild(instance.vm.$el);
8
+ return instance.vm;
9
+ }
@@ -0,0 +1,32 @@
1
+ <script>
2
+ import tooltip from "./index";
3
+ export default {
4
+ props: {
5
+ hide: {},
6
+ },
7
+ render(h) {
8
+ return !this.hide ? (
9
+ <span
10
+ class="tooltip-wrapper"
11
+ on={{
12
+ mouseenter: (e) => {
13
+ this.vm = tooltip({
14
+ placement: "top",
15
+ ...this.$attrs,
16
+ target: e.target,
17
+ });
18
+ this.vm.show();
19
+ },
20
+ mouseleave: (e) => {
21
+ this.vm && this.vm.hide();
22
+ },
23
+ }}
24
+ >
25
+ {this.$slots.default}
26
+ </span>
27
+ ) : (
28
+ this.$slots.default
29
+ );
30
+ },
31
+ };
32
+ </script>
@@ -0,0 +1,38 @@
1
+ import create from "core/create";
2
+ export default (options = {}) => {
3
+ return create({
4
+ name: "tooltip",
5
+ methods: {
6
+ show() {
7
+ if (!options.content) return;
8
+ const tooltip = this.$refs.tooltip;
9
+ tooltip.referenceElm = options.target;
10
+ if (options.overflow) {
11
+ const dom = options.target;
12
+ const range = document.createRange();
13
+ range.setStart(dom, 0);
14
+ range.setEnd(dom, dom.childNodes.length);
15
+ const rangeWidth = range.getBoundingClientRect().width;
16
+ const selfWidth = dom.getBoundingClientRect().width;
17
+ const isOverflowing =
18
+ rangeWidth > selfWidth || dom.scrollWidth > dom.offsetWidth;
19
+ if (!isOverflowing) return;
20
+ }
21
+ tooltip.setExpectedState(true);
22
+ tooltip.handleShowPopper();
23
+ },
24
+ hide() {
25
+ const tooltip = this.$refs.tooltip;
26
+ tooltip.setExpectedState(false);
27
+ tooltip.handleClosePopper();
28
+ this.$destroy();
29
+ this.$el.remove();
30
+ },
31
+ },
32
+ render(h) {
33
+ return (
34
+ <el-tooltip ref="tooltip" props={options} attrs={options}></el-tooltip>
35
+ );
36
+ },
37
+ });
38
+ };
@@ -0,0 +1,131 @@
1
+ <template>
2
+ <div :class="[b(), inputSize ? 'sc-verify-input--' + inputSize : '']">
3
+ <input
4
+ v-for="(code, index) in codes"
5
+ :key="index"
6
+ type="number"
7
+ min="0"
8
+ max="9"
9
+ required
10
+ ref="codeInput"
11
+ v-model="codes[index]"
12
+ @keydown="handleKeyDown(index, $event)"
13
+ @paste="handlePaste($event)"
14
+ :disabled="inputDisabled"
15
+ placeholder=""
16
+ v-bind="$attrs"
17
+ v-on="omitListeners"
18
+ />
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { create } from "core";
24
+ import { omit } from "lodash-es";
25
+ export default create({
26
+ name: "verify-input",
27
+ inject: {
28
+ elForm: {
29
+ default: "",
30
+ },
31
+ elFormItem: {
32
+ default: "",
33
+ },
34
+ },
35
+ props: {
36
+ length: {
37
+ type: Number,
38
+ default: 6,
39
+ },
40
+ size: String,
41
+ disabled: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ allowLetters: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ },
50
+ data() {
51
+ return {
52
+ codes: Array.from({ length: this.length }, () => ""),
53
+ timer: null,
54
+ };
55
+ },
56
+ mounted() {
57
+ this.$nextTick(() => {
58
+ this.$refs.codeInput[0].focus();
59
+ });
60
+ },
61
+ watch: {
62
+ value(val) {
63
+ this.codes = val.split("");
64
+ },
65
+ codes(val) {
66
+ this.$emit("input", val.join(""));
67
+ },
68
+ },
69
+ computed: {
70
+ omitListeners() {
71
+ return omit(this.$listeners, ["input"]);
72
+ },
73
+ _elFormItemSize() {
74
+ return (this.elFormItem || {}).elFormItemSize;
75
+ },
76
+ inputSize() {
77
+ return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
78
+ },
79
+ inputDisabled() {
80
+ return this.disabled || (this.elForm || {}).disabled;
81
+ },
82
+ },
83
+ methods: {
84
+ handleKeyDown(index, event) {
85
+ if (event.key >= 0 && event.key <= 9) {
86
+ this.codes.splice(index, 1, "");
87
+ this.timer = setTimeout(() => {
88
+ if (index < this.codes.length - 1) {
89
+ this.$refs.codeInput[index + 1].focus();
90
+ }
91
+ }, 10);
92
+ } else if (event.key === "Backspace") {
93
+ this.timer = setTimeout(() => {
94
+ if (index > 0) {
95
+ this.$refs.codeInput[index - 1].focus();
96
+ }
97
+ }, 10);
98
+ }
99
+ },
100
+ handlePaste(event) {
101
+ event.preventDefault();
102
+ const pastedText = event.clipboardData.getData("text");
103
+ const numbers = pastedText
104
+ .replace(/[^\d]/g, "")
105
+ .split("")
106
+ .slice(0, this.length);
107
+
108
+ if (numbers.length > 0) {
109
+ this.codes = Array.from(
110
+ { length: this.length },
111
+ (_, index) => numbers[index] || ""
112
+ );
113
+
114
+ // 如果输入完成,聚焦到最后一个输入框
115
+ if (numbers.length >= this.length) {
116
+ this.$refs.codeInput[this.length - 1].focus();
117
+ } else {
118
+ // 否则聚焦到下一个空输入框
119
+ this.$refs.codeInput[numbers.length].focus();
120
+ }
121
+ }
122
+ },
123
+ focus(index = 0) {
124
+ this.$refs.codeInput[index].focus();
125
+ },
126
+ },
127
+ beforeDestroy() {
128
+ clearTimeout(this.timer); // 清除定时器
129
+ },
130
+ });
131
+ </script>
@@ -0,0 +1,88 @@
1
+ export const renderItem = {
2
+ show: [Boolean, Function],
3
+ hidden: [Boolean, Function], // 是否隐藏
4
+ prop: String, // 绑定字段
5
+ label: String, // 列标题
6
+ presetType: {
7
+ // 预设类型
8
+ type: String,
9
+ },
10
+ dict: {
11
+ strict: true,
12
+ type: [String, Object],
13
+ properties: {
14
+ request: Function,
15
+ label: String, // 数据字典中label字段的属性名
16
+ value: String, // 数据字典中value字段的属性名
17
+ color: String, // 数据字典中color字段的属性名
18
+ children: String, // 数据字典中children字段的属性名
19
+ params: [Object, Function], // 请求参数,支持函数形式监听响应式数据变化
20
+ immediate: Boolean, // 是否立即加载,默认为懒加载,即使用时才加载
21
+ cache: Boolean, // 是否启用缓存
22
+ dataPath: String, // 字典数组的路径
23
+ transform: Function, // 数据转换函数
24
+ otherPath: [String, Array], // 需要额外获取的数据路径
25
+ debounceTime: Number, // 防抖时间(毫秒)
26
+ enhanceDict: Object, // 自定义增强方法
27
+ local: Boolean, // 是否启用局部字典
28
+ },
29
+ }, // 字典配置
30
+ comp: {
31
+ type: [Object, Function],
32
+ properties: {
33
+ name: [String, Object], // 组件名称或组件对象
34
+ on: Object, // 事件
35
+ bind: [Object, Function], // 属性
36
+ },
37
+ },
38
+ formatter: Function, // 格式化函数
39
+ html: Boolean, // 是否开启HTML渲染
40
+ render: Function, // 渲染函数
41
+ required: [Boolean, Object, Function], // 是否必填
42
+ rules: {
43
+ type: [Array, Function],
44
+ arrayOf: {
45
+ strict: true,
46
+ type: [Object, String],
47
+ properties: {
48
+ validator: Function,
49
+ message: String,
50
+ trigger: String,
51
+ regular: RegExp,
52
+ msg: String,
53
+ },
54
+ },
55
+ }, // 验证规则
56
+ position: Boolean, // 是否开启位置渲染
57
+ };
58
+
59
+ export const buttonItem = {
60
+ type: [Object, String, Boolean],
61
+ strict: true,
62
+ properties: {
63
+ label: [String, Function],
64
+ type: {
65
+ type: String,
66
+ enum: ["primary", "success", "warning", "danger", "info", "text"],
67
+ },
68
+ icon: [String, Function],
69
+ disabled: [Boolean, Function],
70
+ onClick: Function,
71
+ size: {
72
+ type: String,
73
+ enum: ["medium", "small", "mini"],
74
+ },
75
+ loading: [Boolean, Function],
76
+ plain: [Boolean, Function],
77
+ round: [Boolean, Function],
78
+ circle: [Boolean, Function],
79
+ children: [Array, Function],
80
+ hidden: [Boolean, Function],
81
+ show: [Boolean, Function],
82
+ hasPermi: Array,
83
+ confirm: [String, Function], // 操作确认
84
+ successBack: Function, // 操作成功回调
85
+ },
86
+ };
87
+
88
+ export const presetButtonType = [Object, Boolean];