vue-super-crud 1.7.1 → 1.7.2

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 (269) 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/.browserslistrc +0 -3
  6. package/.versionrc.json +0 -36
  7. package/CHANGELOG.md +0 -232
  8. package/babel.config.js +0 -12
  9. package/build/alias.js +0 -10
  10. package/build/build.js +0 -52
  11. package/build/config.js +0 -70
  12. package/deploy.bat +0 -14
  13. package/docs/.vuepress/components/button/base.vue +0 -88
  14. package/docs/.vuepress/components/common/code-format.vue +0 -331
  15. package/docs/.vuepress/components/commonConfig/presetCodeTemplate/base.vue +0 -68
  16. package/docs/.vuepress/components/commonConfig/presetCodeTemplate/customParams.vue +0 -73
  17. package/docs/.vuepress/components/commonConfig/renderType/component.vue +0 -160
  18. package/docs/.vuepress/components/commonConfig/renderType/formatter.vue +0 -49
  19. package/docs/.vuepress/components/commonConfig/renderType/render.vue +0 -91
  20. package/docs/.vuepress/components/commonConfig/renderType/slot.vue +0 -63
  21. package/docs/.vuepress/components/crud/baseUse/baseUse.vue +0 -98
  22. package/docs/.vuepress/components/crud/baseUse/columnAction.vue +0 -72
  23. package/docs/.vuepress/components/crud/baseUse/columnWidth.vue +0 -107
  24. package/docs/.vuepress/components/crud/baseUse/handleRow.vue +0 -65
  25. package/docs/.vuepress/components/crud/baseUse/height.vue +0 -82
  26. package/docs/.vuepress/components/crud/baseUse/index.vue +0 -54
  27. package/docs/.vuepress/components/crud/baseUse/loading.vue +0 -70
  28. package/docs/.vuepress/components/crud/baseUse/pagination.vue +0 -108
  29. package/docs/.vuepress/components/crud/baseUse/selection.vue +0 -114
  30. package/docs/.vuepress/components/crud/baseUse/summaryMethod.vue +0 -118
  31. package/docs/.vuepress/components/crud/baseUse/title.vue +0 -54
  32. package/docs/.vuepress/components/crud/baseUse/toolbar.vue +0 -69
  33. package/docs/.vuepress/components/crud/buttons/common.vue +0 -115
  34. package/docs/.vuepress/components/crud/buttons/fast.vue +0 -82
  35. package/docs/.vuepress/components/crud/contextMenu/base.vue +0 -72
  36. package/docs/.vuepress/components/crud/copy.vue +0 -52
  37. package/docs/.vuepress/components/crud/crudEvents/api.vue +0 -157
  38. package/docs/.vuepress/components/crud/crudEvents/deleteTip.vue +0 -93
  39. package/docs/.vuepress/components/crud/crudEvents/events.vue +0 -188
  40. package/docs/.vuepress/components/crud/dataSort/base.vue +0 -142
  41. package/docs/.vuepress/components/crud/genDynamicColumns/base.vue +0 -53
  42. package/docs/.vuepress/components/crud/genDynamicColumns/dynamicAndFixed.vue +0 -111
  43. package/docs/.vuepress/components/crud/genDynamicColumns/treeDynamic.vue +0 -68
  44. package/docs/.vuepress/components/crud/handleBar/handleRow.vue +0 -65
  45. package/docs/.vuepress/components/crud/handleBar/toolbar.vue +0 -69
  46. package/docs/.vuepress/components/crud/renderType/1.vue +0 -57
  47. package/docs/.vuepress/components/crud/renderType/2.vue +0 -63
  48. package/docs/.vuepress/components/crud/renderType/3.vue +0 -105
  49. package/docs/.vuepress/components/crud/renderType/5.vue +0 -91
  50. package/docs/.vuepress/components/crud/search/1.vue +0 -90
  51. package/docs/.vuepress/components/crud/search/2.vue +0 -78
  52. package/docs/.vuepress/components/crud/search/3.vue +0 -107
  53. package/docs/.vuepress/components/crud/search/base.vue +0 -123
  54. package/docs/.vuepress/components/crud/search/localSearch.vue +0 -124
  55. package/docs/.vuepress/components/crud/search/special.vue +0 -148
  56. package/docs/.vuepress/components/crud/selection/events.vue +0 -47
  57. package/docs/.vuepress/components/crud/selection/pagination.vue +0 -94
  58. package/docs/.vuepress/components/crud/selection/singleSelection.vue +0 -64
  59. package/docs/.vuepress/components/crud/span/base.vue +0 -69
  60. package/docs/.vuepress/components/crud/span/special.vue +0 -75
  61. package/docs/.vuepress/components/crud/summary/base.vue +0 -99
  62. package/docs/.vuepress/components/crud/tableEdit/addDeleteBtn.vue +0 -174
  63. package/docs/.vuepress/components/crud/tableEdit/cellEdit.vue +0 -194
  64. package/docs/.vuepress/components/crud/tableEdit/controlEdit.vue +0 -219
  65. package/docs/.vuepress/components/crud/tableEdit/dialog.vue +0 -172
  66. package/docs/.vuepress/components/crud/tableEdit/free.vue +0 -88
  67. package/docs/.vuepress/components/crud/tableEdit/freeColumn.vue +0 -82
  68. package/docs/.vuepress/components/crud/tableEdit/methods.vue +0 -154
  69. package/docs/.vuepress/components/crud/tableEdit/rowAction.vue +0 -107
  70. package/docs/.vuepress/components/crud/tableEdit/rowBatch.vue +0 -116
  71. package/docs/.vuepress/components/crud/tableEdit/rowClick.vue +0 -98
  72. package/docs/.vuepress/components/crud/validate/base.vue +0 -122
  73. package/docs/.vuepress/components/crud/validate/custom.vue +0 -82
  74. package/docs/.vuepress/components/crud/validate/regulars.vue +0 -88
  75. package/docs/.vuepress/components/crud/validate/relation.vue +0 -91
  76. package/docs/.vuepress/components/crud/validate/tree.vue +0 -82
  77. package/docs/.vuepress/components/dialog/baseUse/base.vue +0 -92
  78. package/docs/.vuepress/components/dialog/baseUse/beforeConfirm.vue +0 -78
  79. package/docs/.vuepress/components/dialog/baseUse/control.vue +0 -79
  80. package/docs/.vuepress/components/dialog/baseUse/drawer.vue +0 -59
  81. package/docs/.vuepress/components/dialog/baseUse/footer.vue +0 -87
  82. package/docs/.vuepress/components/dialog/baseUse/insertSlot.vue +0 -79
  83. package/docs/.vuepress/components/dict/DictLinkage.vue +0 -91
  84. package/docs/.vuepress/components/dict/baseUse.vue +0 -72
  85. package/docs/.vuepress/components/dict/component.vue +0 -82
  86. package/docs/.vuepress/components/dict/localDict.vue +0 -68
  87. package/docs/.vuepress/components/form/baseUse/base.vue +0 -48
  88. package/docs/.vuepress/components/form/baseUse/dataFormat.vue +0 -92
  89. package/docs/.vuepress/components/form/baseUse/deep.vue +0 -57
  90. package/docs/.vuepress/components/form/baseUse/gridLayout.vue +0 -47
  91. package/docs/.vuepress/components/form/baseUse/group.vue +0 -66
  92. package/docs/.vuepress/components/form/baseUse/hidden.vue +0 -40
  93. package/docs/.vuepress/components/form/baseUse/inlineLayout.vue +0 -48
  94. package/docs/.vuepress/components/form/baseUse/label.vue +0 -51
  95. package/docs/.vuepress/components/form/baseUse/tooltip.vue +0 -40
  96. package/docs/.vuepress/components/form/baseUse/validate.vue +0 -52
  97. package/docs/.vuepress/components/form/detail/base.vue +0 -78
  98. package/docs/.vuepress/components/form/detail/border.vue +0 -90
  99. package/docs/.vuepress/components/form/detail/singleDetail.vue +0 -72
  100. package/docs/.vuepress/components/formatData/baseUse.vue +0 -131
  101. package/docs/.vuepress/components/mock/index.js +0 -347
  102. package/docs/.vuepress/components/mockData/custom.vue +0 -69
  103. package/docs/.vuepress/components/mockData/example.vue +0 -290
  104. package/docs/.vuepress/components/positionSlot/base.vue +0 -24
  105. package/docs/.vuepress/components/positionSlot/form.vue +0 -71
  106. package/docs/.vuepress/components/positionSlot/table.vue +0 -85
  107. package/docs/.vuepress/components/tabs/base.vue +0 -57
  108. package/docs/.vuepress/components/temp.js +0 -195
  109. package/docs/.vuepress/config.js +0 -146
  110. package/docs/.vuepress/enhanceApp.js +0 -142
  111. package/docs/.vuepress/public/favicon.ico +0 -0
  112. package/docs/.vuepress/public/super.png +0 -0
  113. package/docs/.vuepress/styles/index.styl +0 -25
  114. package/docs/.vuepress/styles/palette.styl +0 -6
  115. package/docs/README.md +0 -14
  116. package/docs/guide/button/base.md +0 -31
  117. package/docs/guide/commonConfig/jsx.md +0 -166
  118. package/docs/guide/commonConfig/presetCodeTemplate.md +0 -68
  119. package/docs/guide/commonConfig/renderType.md +0 -181
  120. package/docs/guide/crud/baseUse.md +0 -120
  121. package/docs/guide/crud/buttons.md +0 -18
  122. package/docs/guide/crud/config.md +0 -217
  123. package/docs/guide/crud/contextMenu.md +0 -18
  124. package/docs/guide/crud/dataSort.md +0 -66
  125. package/docs/guide/crud/genDynamicColumns.md +0 -145
  126. package/docs/guide/crud/handleBar.md +0 -26
  127. package/docs/guide/crud/renderType.md +0 -4
  128. package/docs/guide/crud/search.md +0 -150
  129. package/docs/guide/crud/selection.md +0 -73
  130. package/docs/guide/crud/span.md +0 -98
  131. package/docs/guide/crud/summary.md +0 -167
  132. package/docs/guide/crud/tableEdit.md +0 -377
  133. package/docs/guide/crud/validate.md +0 -158
  134. package/docs/guide/dialog/baseUse.md +0 -81
  135. package/docs/guide/dict/baseUse.md +0 -174
  136. package/docs/guide/dict/component.md +0 -88
  137. package/docs/guide/dict/config.md +0 -44
  138. package/docs/guide/form/baseUse.md +0 -142
  139. package/docs/guide/form/detail.md +0 -38
  140. package/docs/guide/formatData/baseUse.md +0 -98
  141. package/docs/guide/formatData/config.md +0 -142
  142. package/docs/guide/mockData/base.md +0 -26
  143. package/docs/guide/positionSlot/base.md +0 -41
  144. package/docs/guide/question/base.md +0 -44
  145. package/docs/guide/start/base.md +0 -30
  146. package/docs/guide/tabs/base.md +0 -63
  147. package/examples/App.vue +0 -52
  148. package/examples/Layout/components/AppMain.vue +0 -40
  149. package/examples/Layout/components/Item.vue +0 -29
  150. package/examples/Layout/components/Link.vue +0 -44
  151. package/examples/Layout/components/SidebarItem.vue +0 -93
  152. package/examples/Layout/index.vue +0 -69
  153. package/examples/assets/logo.png +0 -0
  154. package/examples/favicon.ico +0 -0
  155. package/examples/index.html +0 -18
  156. package/examples/main.js +0 -54
  157. package/examples/router/index.js +0 -140
  158. package/examples/store/index.js +0 -0
  159. package/examples/styles/index.scss +0 -63
  160. package/examples/styles/sidebar.scss +0 -226
  161. package/examples/styles/transition.scss +0 -48
  162. package/examples/styles/variables.scss +0 -25
  163. package/examples/views/crud/base.vue +0 -68
  164. package/examples/views/crud/handleRow.vue +0 -84
  165. package/examples/views/crud/search.vue +0 -116
  166. package/examples/views/dashboard/index.vue +0 -244
  167. package/examples/views/dashboard/index1.vue +0 -234
  168. package/examples/views/dashboard/test.vue +0 -9
  169. package/examples/views/formTest/index.vue +0 -168
  170. package/examples/views/nested/menu1/index.vue +0 -7
  171. package/examples/views/nested/menu1/menu1-1/index.vue +0 -7
  172. package/examples/views/nested/menu1/menu1-2/index.vue +0 -7
  173. package/examples/views/nested/menu1/menu1-2/menu1-2-1/index.vue +0 -5
  174. package/examples/views/nested/menu1/menu1-2/menu1-2-2/index.vue +0 -5
  175. package/examples/views/nested/menu1/menu1-3/index.vue +0 -5
  176. package/examples/views/nested/menu2/index.vue +0 -5
  177. package/gulpfile.js +0 -84
  178. package/packages/button/index.vue +0 -189
  179. package/packages/core/components/comp.vue +0 -223
  180. package/packages/core/components/position.vue +0 -135
  181. package/packages/core/components/render.vue +0 -460
  182. package/packages/core/configManager.js +0 -302
  183. package/packages/core/create.js +0 -8
  184. package/packages/core/defaultRender.js +0 -64
  185. package/packages/core/dict/global.js +0 -10
  186. package/packages/core/dict/index.js +0 -432
  187. package/packages/core/dict/mixin.js +0 -94
  188. package/packages/core/event.js +0 -60
  189. package/packages/core/index.js +0 -6
  190. package/packages/core/init.js +0 -122
  191. package/packages/core/mock/genConfig.js +0 -228
  192. package/packages/core/mock/genData.js +0 -422
  193. package/packages/core/mock/index.js +0 -4
  194. package/packages/core/rules.js +0 -111
  195. package/packages/crud/column.vue +0 -205
  196. package/packages/crud/columnAction.vue +0 -207
  197. package/packages/crud/columnCell.vue +0 -146
  198. package/packages/crud/defaultColumn.vue +0 -130
  199. package/packages/crud/drawerColumn.vue +0 -225
  200. package/packages/crud/form.vue +0 -69
  201. package/packages/crud/index.vue +0 -564
  202. package/packages/crud/menuBar.vue +0 -298
  203. package/packages/crud/mixins/cacheHandler.js +0 -36
  204. package/packages/crud/mixins/calcColumnWidth.js +0 -79
  205. package/packages/crud/mixins/calcHeight.js +0 -105
  206. package/packages/crud/mixins/columnHandler.js +0 -128
  207. package/packages/crud/mixins/contextMenu.js +0 -98
  208. package/packages/crud/mixins/dataProcessor.js +0 -202
  209. package/packages/crud/mixins/dialog.js +0 -109
  210. package/packages/crud/mixins/excelHandler.js +0 -150
  211. package/packages/crud/mixins/exposeMethods.js +0 -107
  212. package/packages/crud/mixins/generateDynamicColumns.js +0 -250
  213. package/packages/crud/mixins/props.js +0 -38
  214. package/packages/crud/mixins/searchHandler.js +0 -151
  215. package/packages/crud/mixins/select.js +0 -359
  216. package/packages/crud/mixins/spanMethod.js +0 -288
  217. package/packages/crud/mixins/summary.js +0 -177
  218. package/packages/crud/mixins/tableEdit.js +0 -547
  219. package/packages/crud/mixins/validate.js +0 -219
  220. package/packages/crud/pagination.vue +0 -110
  221. package/packages/crud/search.vue +0 -119
  222. package/packages/crud/searchHeader.vue +0 -231
  223. package/packages/crud/selectBanner.vue +0 -138
  224. package/packages/crud/utils/EditState.js +0 -319
  225. package/packages/crud/utils/excelExport.js +0 -112
  226. package/packages/crud/utils/excelImport.js +0 -112
  227. package/packages/crud/utils/index.js +0 -98
  228. package/packages/dialog/dialog.js +0 -233
  229. package/packages/dialog/dialog.vue +0 -15
  230. package/packages/dialog/index.js +0 -22
  231. package/packages/dict/cascadeFormat.vue +0 -179
  232. package/packages/dict/dateFormat.vue +0 -40
  233. package/packages/dict/form/cascade.vue +0 -61
  234. package/packages/dict/form/checkbox.vue +0 -90
  235. package/packages/dict/form/extendMethod.js +0 -22
  236. package/packages/dict/form/input-base.js +0 -31
  237. package/packages/dict/form/input.js +0 -20
  238. package/packages/dict/form/radio.vue +0 -69
  239. package/packages/dict/form/select.vue +0 -118
  240. package/packages/dict/form/switch.vue +0 -75
  241. package/packages/dict/valueFormat.vue +0 -188
  242. package/packages/directive/dialog/drag.js +0 -86
  243. package/packages/directive/dialog/dragSize.js +0 -42
  244. package/packages/directive/index.js +0 -9
  245. package/packages/directive/insertSlot.js +0 -10
  246. package/packages/form/contextMenu.js +0 -192
  247. package/packages/form/draftDrawer.vue +0 -391
  248. package/packages/form/formAction.vue +0 -97
  249. package/packages/form/formItem.vue +0 -259
  250. package/packages/form/index.vue +0 -451
  251. package/packages/form/props.js +0 -15
  252. package/packages/grid/cell.vue +0 -65
  253. package/packages/grid/index.vue +0 -130
  254. package/packages/group/index.vue +0 -96
  255. package/packages/tabs/index.vue +0 -290
  256. package/packages/tooltip/index.js +0 -9
  257. package/packages/tooltip/tooltip.vue +0 -32
  258. package/packages/tooltip/tooltipComponent.js +0 -38
  259. package/packages/verifyInput/index.vue +0 -131
  260. package/styles/button.scss +0 -3
  261. package/styles/crud.scss +0 -425
  262. package/styles/dialog.scss +0 -95
  263. package/styles/form.scss +0 -532
  264. package/styles/group.scss +0 -78
  265. package/styles/index.scss +0 -94
  266. package/styles/tabs.scss +0 -139
  267. package/styles/verifyInput.scss +0 -56
  268. package/vue-jsx-sync.js +0 -90
  269. package/vue.config.js +0 -54
@@ -1,168 +0,0 @@
1
- <template>
2
- <div>
3
- <sc-form v-model="formData" ref="form" :options="options"> </sc-form>
4
- <el-button type="primary" size="default" @click="openDialog(false)"
5
- >Dialog</el-button
6
- >
7
- <el-button type="primary" size="default" @click="openDialog(true)"
8
- >Drawer</el-button
9
- >
10
- <div>字典数据:{{ $sc_dicts.data["sys_notice_status"] }}</div>
11
- </div>
12
- </template>
13
-
14
- <script>
15
- export default {
16
- data() {
17
- return {
18
- checkList: [],
19
- formData: {
20
- checkList1: ["张三", "李四"],
21
- dateStart: "2022-01-03",
22
- dateEnd: "2022-01-25",
23
- },
24
- dictData: [
25
- {
26
- value: "张三",
27
- label: "1111",
28
- },
29
- {
30
- value: "李四",
31
- label: "2222",
32
- },
33
- ],
34
- a: {
35
- value: "张三",
36
- label: "1111",
37
- },
38
- };
39
- },
40
- mounted() {
41
- this.$sc_dicts.get(["sys_status", "sys_notice_status", "listAll"]);
42
-
43
- setTimeout(() => {
44
- console.log(this.$sc_dicts.getMap("listAll"));
45
- }, 1000);
46
- },
47
- computed: {
48
- options() {
49
- return {
50
- // detail: true,
51
- action: {
52
- search: {},
53
- reset: {},
54
- },
55
- renderColumns: [
56
- {
57
- label: "11111",
58
- icon: "el-icon-user",
59
- collapse: false,
60
- children: [
61
- {
62
- label: "年龄",
63
- prop: "name",
64
- labelPosition: "top",
65
- comp: (scope) => {
66
- return {
67
- name: "el-select",
68
- clearable: true,
69
- on: {
70
- change(v, a, vm) {
71
- console.log(v, a, vm, scope);
72
- },
73
- },
74
- children: (this.$sc_dicts.data["sys_notice_status"] || []).map(
75
- (i) => ({
76
- name: "el-option",
77
- label: i.label,
78
- value: i.value,
79
- })
80
- ),
81
- };
82
- },
83
- rules: {
84
- required: {},
85
- },
86
- },
87
- {
88
- label: "日期",
89
- prop: "dateStart-dateEnd",
90
- formatTemp: {
91
- inner: (value, key, inner, outer) => {
92
- return value;
93
- },
94
- outer: (value, key, outer, inner) => {
95
- return value;
96
- },
97
- },
98
- render: (h, { form }) => {
99
- return (
100
- <el-date-picker
101
- v-model={form["dateStart-dateEnd"]}
102
- value-format="yyyy-MM-dd"
103
- type="daterange"
104
- range-separator="至"
105
- start-placeholder="开始日期"
106
- end-placeholder="结束日期"
107
- ></el-date-picker>
108
- );
109
- },
110
- },
111
- ],
112
- },
113
- {
114
- label: "11111",
115
- children: [
116
- {
117
- label: "年龄",
118
- prop: "checkList",
119
- rules: {
120
- required: {},
121
- },
122
- formatTemp: "str2array",
123
- comp: (scope) => {
124
- return {
125
- name: "el-checkbox-group",
126
- children: this.dictData.map((i) => ({
127
- name: "el-checkbox",
128
- label: i.value,
129
- children: i.label,
130
- })),
131
- };
132
- },
133
- },
134
- ],
135
- },
136
- ],
137
- };
138
- },
139
- },
140
- methods: {
141
- openDialog(drawer) {
142
- const dialog = this.$dialog({
143
- drawer,
144
- presetType: "success-msg",
145
- // class: "1231231",
146
- // title: "测试",
147
- // width: "1000px",
148
- // cache: true,
149
- // comp: {
150
- // name: "div",
151
- // children: "12321312",
152
- // },
153
- // render: () => {
154
- // return <div ref="test">23423432</div>;
155
- // },
156
- beforeClose: (done, val) => {
157
- if (val === "cancel") {
158
- done();
159
- }
160
- },
161
- });
162
- dialog.show().then((res) => {});
163
- },
164
- },
165
- };
166
- </script>
167
-
168
- <style lang="scss" scoped></style>
@@ -1,7 +0,0 @@
1
- <template>
2
- <div style="padding:30px;">
3
- <el-alert :closable="false" title="menu 1">
4
- <router-view />
5
- </el-alert>
6
- </div>
7
- </template>
@@ -1,7 +0,0 @@
1
- <template>
2
- <div style="padding:30px;">
3
- <el-alert :closable="false" title="menu 1-1" type="success">
4
- <router-view />
5
- </el-alert>
6
- </div>
7
- </template>
@@ -1,7 +0,0 @@
1
- <template>
2
- <div style="padding:30px;">
3
- <el-alert :closable="false" title="menu 1-2" type="success">
4
- <router-view />
5
- </el-alert>
6
- </div>
7
- </template>
@@ -1,5 +0,0 @@
1
- <template functional>
2
- <div style="padding:30px;">
3
- <el-alert :closable="false" title="menu 1-2-1" type="warning" />
4
- </div>
5
- </template>
@@ -1,5 +0,0 @@
1
- <template functional>
2
- <div style="padding:30px;">
3
- <el-alert :closable="false" title="menu 1-2-2" type="warning" />
4
- </div>
5
- </template>
@@ -1,5 +0,0 @@
1
- <template functional>
2
- <div style="padding:30px;">
3
- <el-alert :closable="false" title="menu 1-3" type="success" />
4
- </div>
5
- </template>
@@ -1,5 +0,0 @@
1
- <template>
2
- <div style="padding:30px;">
3
- <el-alert :closable="false" title="menu 2" />
4
- </div>
5
- </template>
package/gulpfile.js DELETED
@@ -1,84 +0,0 @@
1
- const gulp = require("gulp");
2
- const sass = require("gulp-sass")(require("sass"));
3
- var autoprefixer = require("gulp-autoprefixer");
4
- var cssmin = require("gulp-cssmin");
5
- const webpack = require("webpack");
6
- const webpackConf = require("./build/build.js");
7
-
8
- // 构建webpack配置
9
- gulp.task("webpack", async function () {
10
- try {
11
- const stats = await new Promise((resolve, reject) => {
12
- webpack(webpackConf, (err, stats) => {
13
- if (err) {
14
- reject(err);
15
- return;
16
- }
17
- resolve(stats);
18
- });
19
- });
20
-
21
- // 处理编译过程中的错误和警告
22
- const info = stats.toJson();
23
-
24
- if (stats.hasErrors()) {
25
- console.error("\x1b[31m%s\x1b[0m", "打包失败!"); // 红色文字
26
- console.error(info.errors);
27
- throw new Error("Webpack 编译失败");
28
- }
29
-
30
- if (stats.hasWarnings()) {
31
- console.warn("\x1b[33m%s\x1b[0m", "打包警告:"); // 黄色文字
32
- console.warn(info.warnings);
33
- }
34
-
35
- console.log("\x1b[32m%s\x1b[0m", "打包成功!"); // 绿色文字
36
- } catch (error) {
37
- console.error("\x1b[31m%s\x1b[0m", "打包过程发生错误:"); // 红色文字
38
- console.error(error);
39
- throw error; // 抛出错误以中断 gulp 任务
40
- }
41
- });
42
-
43
- // 处理样式的配置
44
- gulp.task("compile", function () {
45
- return gulp
46
- .src("./styles/index.scss")
47
- .pipe(sass())
48
- .pipe(
49
- autoprefixer({
50
- browsers: ["ie > 9", "last 2 versions"],
51
- cascade: false,
52
- })
53
- )
54
- .pipe(cssmin())
55
- .pipe(gulp.dest("./lib/"));
56
- });
57
-
58
- // 打包文件
59
- gulp.task("build", gulp.series(["compile", "webpack"]));
60
-
61
- function debounce(func, wait) {
62
- let timeout;
63
-
64
- return function () {
65
- let context = this;
66
- let args = arguments;
67
-
68
- clearTimeout(timeout);
69
- timeout = setTimeout(function () {
70
- func.apply(context, args);
71
- }, wait);
72
- };
73
- }
74
-
75
- // 监听文件变化
76
- gulp.task("listen", async function () {
77
- gulp.watch(["./styles/**"], debounce(gulp.series(["compile"]), 2000));
78
- gulp.watch(
79
- ["./src/**", "./packages/**"],
80
- debounce(gulp.series(["webpack"]), 2000)
81
- );
82
- });
83
-
84
- gulp.task("watch", gulp.series(["compile", "webpack", "listen"]));
@@ -1,189 +0,0 @@
1
- <template>
2
- <el-button
3
- v-if="getIsShow() && !attrs.children"
4
- :disabled="isDebounce || attrs.disabled"
5
- v-bind="attrs"
6
- :size="size"
7
- :class="b()"
8
- @click="handleClick()"
9
- >
10
- <span v-if="attrs.label">{{ attrs.label }}</span>
11
- <slot v-if="$slots.default"></slot>
12
- </el-button>
13
- <el-dropdown
14
- v-else-if="getIsShow()"
15
- v-bind="attrs"
16
- trigger="click"
17
- :size="size"
18
- :disabled="isDebounce || attrs.disabled"
19
- >
20
- <el-button
21
- :class="b()"
22
- :size="size"
23
- :disabled="isDebounce || attrs.disabled"
24
- v-bind="attrs"
25
- ><span v-if="attrs.label">{{ attrs.label }}</span
26
- ><slot v-if="$slots.default"></slot
27
- ><i class="el-icon-arrow-down el-icon--right"></i
28
- ></el-button>
29
- <el-dropdown-menu slot="dropdown">
30
- <el-dropdown-item
31
- v-for="(child, idx) in attrs.children"
32
- @click.native="handleClick(child)"
33
- :key="idx"
34
- v-bind="child"
35
- >{{ child.label }}</el-dropdown-item
36
- >
37
- </el-dropdown-menu>
38
- </el-dropdown>
39
- </template>
40
- <script>
41
- import { create } from "core";
42
- import { isFunction } from "lodash-es";
43
- export default create({
44
- inheritAttrs: false,
45
- name: "button",
46
- props: {
47
- time: {
48
- type: Number,
49
- default: 300,
50
- },
51
- size: String,
52
- scope: {},
53
- onClick: {},
54
- confirm: {},
55
- customConfirm: {},
56
- successBack: {},
57
- textSubmit: {},
58
- batchConfirm: {},
59
- },
60
- data() {
61
- return {
62
- isDebounce: false,
63
- attrs: {},
64
- };
65
- },
66
- watch: {
67
- $attrs() {
68
- this.attrs = this.getBindAttrs();
69
- },
70
- },
71
- created() {
72
- this.attrs = this.getBindAttrs();
73
- },
74
- methods: {
75
- getBindAttrs() {
76
- const attrs = {};
77
- Object.keys(this.$attrs).forEach((key) => {
78
- if (isFunction(this.$attrs[key])) {
79
- attrs[key] = this.$attrs[key](this.scope);
80
- } else {
81
- attrs[key] = this.$attrs[key];
82
- }
83
- });
84
- return attrs;
85
- },
86
- getIsShow() {
87
- const bindAttrs = this.attrs;
88
- if (bindAttrs.hidden) return false;
89
- if (bindAttrs.show === false) return false;
90
- return true;
91
- },
92
- handleClick(item = this) {
93
- this.beforeClick((...args) => {
94
- if (item.onClick) {
95
- item.onClick(this.scope, ...args);
96
- } else {
97
- this.$emit("click", ...args);
98
- }
99
- this.isDebounce = true;
100
- setTimeout(() => {
101
- this.isDebounce = false;
102
- }, this.time);
103
- }, item);
104
- },
105
- beforeClick(cb, item) {
106
- if (item.confirm) {
107
- this.handleConfirm(item.confirm, cb);
108
- } else if (item.customConfirm) {
109
- this.handleCustomConfirm(item.customConfirm, cb);
110
- } else if (item.successBack) {
111
- this.handleSuccessBack(item.successBack, cb);
112
- } else if (item.textSubmit) {
113
- this.handleFormSubmit(item.textSubmit, cb);
114
- } else if (item.batchConfirm) {
115
- this.$scDialog({
116
- presetType: "batchConfirm",
117
- ...item.batchConfirm,
118
- }).show(cb);
119
- } else {
120
- cb();
121
- }
122
- },
123
- handleConfirm(confirm, cb) {
124
- if (isFunction(confirm)) confirm = confirm(this.scope);
125
- // 处理字符串和布尔值配置
126
- if (confirm === true || typeof confirm === "string") {
127
- const message = confirm === true ? "确定要执行此操作吗?" : confirm;
128
- this.$confirm(message, "提示", {
129
- confirmButtonText: "确定",
130
- cancelButtonText: "取消",
131
- type: "warning",
132
- }).then(() => {
133
- cb();
134
- });
135
- return;
136
- }
137
- // 处理对象配置
138
- const {
139
- label,
140
- title = "提示",
141
- confirmButtonText = "确定",
142
- cancelButtonText = "取消",
143
- type = "warning",
144
- } = confirm;
145
- this.$confirm(label || "确定要执行此操作吗?", title, {
146
- confirmButtonText,
147
- cancelButtonText,
148
- type,
149
- }).then(() => {
150
- cb();
151
- });
152
- },
153
- handleCustomConfirm(customConfirm, cb) {
154
- if (isFunction(customConfirm)) customConfirm = customConfirm(this.scope);
155
- this.$scDialog({
156
- presetType: "confirmTip",
157
- label: customConfirm.label,
158
- content: customConfirm.content,
159
- title: customConfirm.title,
160
- }).show(cb);
161
- },
162
- handleSuccessBack(successBack, cb) {
163
- const vm = this.$scDialog({
164
- presetType: "successBack",
165
- onClick: () => {
166
- if (isFunction(successBack)) {
167
- successBack(this.scope);
168
- vm.hide();
169
- } else {
170
- setTimeout(() => {
171
- this.$router.go(-1);
172
- vm.hide();
173
- }, 50);
174
- }
175
- },
176
- });
177
- cb(() => vm.show());
178
- },
179
- handleFormSubmit(textSubmit, clickCb) {
180
- if (isFunction(textSubmit)) textSubmit = textSubmit(this.scope);
181
- this.$scDialog({
182
- presetType: "textSubmit",
183
- ...textSubmit,
184
- submit: clickCb,
185
- }).show();
186
- },
187
- },
188
- });
189
- </script>