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,90 +0,0 @@
1
- <template>
2
- <el-checkbox-group
3
- ref="target"
4
- :value="currentValue"
5
- v-bind="$attrs"
6
- style="width: 100%;"
7
- @input="onInput"
8
- @change="onChange"
9
- v-on="listeners"
10
- >
11
- <component
12
- :is="type"
13
- v-for="option in _options"
14
- :key="option[props.value]"
15
- :label="option[props.value]"
16
- v-bind="option"
17
- >{{ option[props.label] }}</component
18
- >
19
- </el-checkbox-group>
20
- </template>
21
-
22
- <script>
23
- import input from "./input";
24
- import { create } from "core";
25
- import { omit } from "lodash-es";
26
- import extendMethod from "./extendMethod";
27
- // 字典radio选择器
28
- export default create({
29
- name: "checkbox",
30
- mixins: [input, extendMethod],
31
- props: {
32
- value: { type: [Number, String, Boolean, Array], require: false },
33
- // value的分隔符<br/>
34
- // 如果value为string,则以该分隔符分割成多个展示<br/>
35
- // 传入空字符串,表示不分割<br/>
36
- separator: { default: ",", require: false },
37
- // 按钮类型 [el-checkbox,el-checkbox-button]
38
- type: {
39
- type: String,
40
- default: "el-checkbox",
41
- },
42
- scope: Object,
43
- options: Array,
44
- props: {
45
- type: Object,
46
- default() {
47
- return {
48
- value: "value",
49
- label: "label",
50
- };
51
- },
52
- },
53
- },
54
- data() {
55
- return {};
56
- },
57
- computed: {
58
- _options() {
59
- return this.options || this.scope?.dict;
60
- },
61
- listeners() {
62
- return omit(this.$listeners, ["input", "change"]);
63
- },
64
- },
65
- methods: {
66
- setValue(newVal) {
67
- if (newVal == null) {
68
- this.currentValue = [];
69
- return;
70
- }
71
- if (
72
- typeof newVal === "string" &&
73
- this.separator != null &&
74
- this.separator !== ""
75
- ) {
76
- this.currentValue = newVal.split(this.separator);
77
- return;
78
- }
79
- this.currentValue = newVal;
80
- },
81
- onChange(value) {
82
- this.$emit(
83
- "objectChange",
84
- this._options.filter((i) => value.includes(i[this.props.value]))
85
- );
86
- this.$emit("change", value);
87
- },
88
- },
89
- });
90
- </script>
@@ -1,22 +0,0 @@
1
- import { isFunction } from "lodash-es";
2
-
3
- export default {
4
- mounted() {
5
- this.extendMethod(this.$refs.target);
6
- },
7
- methods: {
8
- extendMethod(ref, exclude = []) {
9
- const refMethod = Object.entries(ref);
10
- for (const [key, value] of refMethod) {
11
- if (
12
- !(key.includes("$") || key.includes("_")) &&
13
- isFunction(value) &&
14
- !this[key] &&
15
- !exclude.includes(key)
16
- ) {
17
- this[key] = value;
18
- }
19
- }
20
- },
21
- },
22
- };
@@ -1,31 +0,0 @@
1
- export default {
2
- props: {
3
- // 值
4
- value: {
5
- required: false,
6
- },
7
- },
8
- data() {
9
- return {
10
- // 本组件的实际value值
11
- // 由于value值是props参数,是不允许修改的,需要用别的值存起来
12
- currentValue: undefined,
13
- };
14
- },
15
- mounted() {
16
- // this.$emit('ready')
17
- },
18
- methods: {
19
- isValueChanged(value) {
20
- return this.currentValue !== value;
21
- },
22
- setValue(value) {
23
- // 在这里对 传入的value值做处理
24
- this.currentValue = value;
25
- this.onInput(value);
26
- },
27
- onInput(value) {
28
- this.$emit("input", value);
29
- },
30
- },
31
- };
@@ -1,20 +0,0 @@
1
- import inputBase from './input-base'
2
- export default {
3
- mixins: [inputBase],
4
- watch: {
5
- value (value, oldValue) {
6
- // 父组件收到input事件后会通过v-model改变value参数的值
7
- // 然后此处会watch到value的改变,发出change事件
8
- // change事件放在此处发射的好处是,当外部修改value值时,也能够触发form-data-change事件
9
- if (!this.isValueChanged(value)) {
10
- return
11
- }
12
- // 如果值是被外部改变的,则修改本组件的currentValue
13
- this.setValue(value)
14
- }
15
- },
16
- created () {
17
- // 给currentValue设置初始值
18
- this.setValue(this.value)
19
- }
20
- }
@@ -1,69 +0,0 @@
1
- <template>
2
- <el-radio-group
3
- ref="target"
4
- :value="currentValue"
5
- @input="onInput"
6
- @change="onChange"
7
- v-bind="$attrs"
8
- v-on="listeners"
9
- style="width: 100%;"
10
- >
11
- <component
12
- :is="type"
13
- v-for="option in _options"
14
- :key="option[props.value]"
15
- :label="option[props.value]"
16
- v-bind="option"
17
- >{{ option[props.label] }}</component
18
- >
19
- </el-radio-group>
20
- </template>
21
-
22
- <script>
23
- import input from "./input";
24
- import { create } from "core";
25
- import { omit } from "lodash-es";
26
- import extendMethod from "./extendMethod";
27
- // 字典radio选择器
28
- export default create({
29
- name: "radio",
30
- mixins: [input, extendMethod],
31
- props: {
32
- // 值
33
- value: { require: false },
34
- // 按钮类型 [el-radio,el-radio-button]
35
- type: {
36
- type: String,
37
- default: "el-radio",
38
- },
39
- scope: Object,
40
- options: Array,
41
- props: {
42
- type: Object,
43
- default() {
44
- return {
45
- value: "value",
46
- label: "label",
47
- };
48
- },
49
- },
50
- },
51
- computed: {
52
- _options() {
53
- return this.options || this.scope?.dict;
54
- },
55
- listeners() {
56
- return omit(this.$listeners, ["input", "change"]);
57
- },
58
- },
59
- methods: {
60
- onChange(value) {
61
- this.$emit(
62
- "objectChange",
63
- this._options.find((i) => i[this.props.value] === value)
64
- );
65
- this.$emit("change", value);
66
- },
67
- },
68
- });
69
- </script>
@@ -1,118 +0,0 @@
1
- <template>
2
- <el-select
3
- ref="target"
4
- :value="currentValue"
5
- filterable
6
- v-bind="$attrs"
7
- :value-key="props.value"
8
- :multiple="multiple"
9
- @input="onInput"
10
- @change="onChange"
11
- v-on="listeners"
12
- style="width: 100%;"
13
- >
14
- <el-option
15
- v-for="option in _options"
16
- :key="option[props.value]"
17
- :value="option[props.value]"
18
- :label="option[props.label]"
19
- v-bind="option"
20
- >
21
- </el-option>
22
- </el-select>
23
- </template>
24
-
25
- <script>
26
- import input from "./input";
27
- import { create } from "core";
28
- import { omit } from "lodash-es";
29
- import extendMethod from "./extendMethod";
30
- // 字典选择器
31
- export default create({
32
- name: "select",
33
- mixins: [input, extendMethod],
34
- props: {
35
- // 值
36
- value: { type: [Number, String, Boolean, Array], require: false },
37
- // value的分隔符<br/>
38
- // 多选时,如果value为string,则以该分隔符分割成多个展示<br/>
39
- // 传入空字符串,表示不分割<br/>
40
- separator: { default: ",", require: false },
41
- multiple: { default: false },
42
- scope: Object,
43
- options: Array,
44
- props: {
45
- type: Object,
46
- default() {
47
- return {
48
- value: "value",
49
- label: "label",
50
- };
51
- },
52
- },
53
- },
54
- computed: {
55
- _options() {
56
- return this.options || this.scope?.dict || [];
57
- },
58
- listeners() {
59
- return omit(this.$listeners, ["input", "change"]);
60
- },
61
- },
62
- methods: {
63
- setValue(newVal) {
64
- if (!this.multiple) {
65
- // 单选
66
- if (newVal === this.currentValue) {
67
- return;
68
- }
69
- this.currentValue = newVal;
70
- return;
71
- }
72
- // 多选
73
- if (newVal == null) {
74
- this.currentValue = [];
75
- return;
76
- }
77
- if (
78
- typeof newVal === "string" &&
79
- this.separator != null &&
80
- this.separator !== ""
81
- ) {
82
- this.currentValue = newVal.split(this.separator);
83
- return;
84
- }
85
- if (!(newVal instanceof Array)) {
86
- this.currentValue = [newVal];
87
- return;
88
- }
89
-
90
- // TODO 重置表单时,多选的value会重置为[null]
91
- const val = [];
92
- for (const item of newVal) {
93
- if (item != null) {
94
- val.push(item);
95
- }
96
- }
97
- this.currentValue = val;
98
- if (newVal.length === 1 && newVal[0] == null) {
99
- this.onInput(val);
100
- }
101
- },
102
- onChange(value) {
103
- if (value instanceof Array) {
104
- this.$emit(
105
- "objectChange",
106
- this._options.filter((i) => value.includes(i[this.props.value]))
107
- );
108
- } else {
109
- this.$emit(
110
- "objectChange",
111
- this._options.find((i) => i[this.props.value] === value)
112
- );
113
- }
114
- this.$emit("change", value);
115
- },
116
- },
117
- });
118
- </script>
@@ -1,75 +0,0 @@
1
- <template>
2
- <el-switch
3
- ref="target"
4
- :value="value"
5
- @input="onElInput"
6
- :active-color="_active[props.color]"
7
- :active-value="_active[props.value]"
8
- :active-text="showText ? _active[props.label] : ''"
9
- :inactive-color="_inActive[props.color]"
10
- :inactive-value="_inActive[props.value]"
11
- :inactive-text="showText ? _inActive[props.label] : ''"
12
- v-bind="$attrs"
13
- v-on="listeners"
14
- >
15
- </el-switch>
16
- </template>
17
-
18
- <script>
19
- import inputBase from "./input-base";
20
- import { create } from "core";
21
- import { omit } from "lodash-es";
22
- import extendMethod from "./extendMethod";
23
- // 字典switch
24
- export default create({
25
- name: "switch",
26
- mixins: [inputBase, extendMethod],
27
- props: {
28
- value: { require: false },
29
- scope: Object,
30
- options: Array,
31
- props: {
32
- type: Object,
33
- default() {
34
- return {
35
- value: "value",
36
- label: "label",
37
- color: "color",
38
- };
39
- },
40
- },
41
- showText: {
42
- type: Boolean,
43
- default: true,
44
- },
45
- },
46
- data() {
47
- return {};
48
- },
49
- computed: {
50
- _options() {
51
- return this.options || this.scope?.dict;
52
- },
53
- _active() {
54
- if (this._options?.length > 0) {
55
- return this._options[0];
56
- }
57
- return {};
58
- },
59
- _inActive() {
60
- if (this._options?.length > 1) {
61
- return this._options[1];
62
- }
63
- return {};
64
- },
65
- listeners() {
66
- return omit(this.$listeners, ["input"]);
67
- },
68
- },
69
- methods: {
70
- onElInput(value) {
71
- this.onInput(value);
72
- },
73
- },
74
- });
75
- </script>
@@ -1,188 +0,0 @@
1
- <template>
2
- <span>
3
- <template v-for="(item, index) in options">
4
- <el-tag
5
- v-if="item[props.color]"
6
- :key="item[props.value]"
7
- size="small"
8
- :type="item[props.color]"
9
- @click="onClick(item)"
10
- :effect="item.effect"
11
- disable-transitions
12
- v-bind="$attrs"
13
- >
14
- {{ item[props.label] }}
15
- </el-tag>
16
- <span v-else :key="item[props.value]">{{
17
- item[props.label] + (index === options.length - 1 ? "" : "、")
18
- }}</span>
19
- </template>
20
- </span>
21
- </template>
22
-
23
- <script>
24
- import { create } from "core";
25
- const COLOR_LIST = ["primary", "success", "warning", "danger"];
26
- const EFFECT_LIST = ["plain", "light"];
27
-
28
- // value格式化展示组件
29
- export default create({
30
- name: "value-format",
31
- props: {
32
- // 值
33
- value: {
34
- require: false,
35
- },
36
- // 是否多选
37
- multiple: { default: true, require: false },
38
- // value的分隔符<br/>
39
- // 多选时,如果value为string,则以该分隔符分割成多个展示<br/>
40
- // 传入空字符串,表示不分割<br/>
41
- separator: { default: ",", require: false },
42
- // 颜色,【auto, primary, success, warning, danger ,info】
43
- // 配置auto,则自动根据value值hashcode分配颜色值
44
- color: {
45
- require: false,
46
- },
47
- effect: {
48
- require: false,
49
- },
50
-
51
- // 自动颜色列表,【 primary, success, warning, danger 】
52
- autoColors: {
53
- type: Array,
54
- },
55
- // 自动主题列表,【 light, plain 】
56
- autoEffects: {
57
- type: Array,
58
- },
59
- scope: Object,
60
- props: {
61
- type: Object,
62
- default() {
63
- return {
64
- value: "value",
65
- label: "label",
66
- color: "color",
67
- };
68
- },
69
- },
70
- },
71
- data() {
72
- return {};
73
- },
74
- computed: {
75
- options() {
76
- if (this.value == null || this.value === "") {
77
- return [];
78
- }
79
- if (this.loading) return [];
80
- const dictDataMap = this.dictDataMap;
81
- const valueArr = this.getValueArr();
82
- const options = [];
83
- const dict = this.props;
84
- // 没有字典,直接显示值
85
- if (dictDataMap == null || Object.keys(dictDataMap).length === 0) {
86
- for (const str of valueArr) {
87
- const item = {};
88
- item[dict.value] = str;
89
- item[dict.label] = str;
90
- this.setColor(item, dict);
91
- options.push(item);
92
- }
93
- return options;
94
- }
95
- // 根据字典展示
96
- for (const str of valueArr) {
97
- let item = dictDataMap[str];
98
- if (item != null) {
99
- this.setColor(item, dict);
100
- options.push(item);
101
- } else {
102
- item = {};
103
- item[dict.value] = str;
104
- item[dict.label] = str;
105
- this.setColor(item, dict);
106
- options.push(item);
107
- }
108
- }
109
- return options;
110
- },
111
- dictDataMap() {
112
- if (this.$attrs.options) {
113
- return this.formatMap(this.$attrs.options);
114
- }
115
- return this.scope.dict?.toMap();
116
- },
117
- },
118
- methods: {
119
- formatMap(data) {
120
- const dataMap = {};
121
- data.forEach((item) => {
122
- dataMap[item.value] = item;
123
- if (item.children) {
124
- this.formatMap(item.children, dataMap);
125
- }
126
- });
127
- return dataMap;
128
- },
129
- getValueArr() {
130
- let valueArr = [];
131
- if (
132
- typeof this.value === "string" &&
133
- this.multiple &&
134
- this.separator != null &&
135
- this.separator !== ""
136
- ) {
137
- valueArr = this.value.split(this.separator);
138
- } else if (this.value instanceof Array) {
139
- // 本来就是数组的
140
- valueArr = this.value;
141
- } else {
142
- valueArr = [this.value];
143
- }
144
- return valueArr;
145
- },
146
- onClick(item) {
147
- this.$emit("click", { item: item });
148
- },
149
- setColor(item, dict) {
150
- if (!item.effect && this.effect) {
151
- item.effect = this.effect;
152
- }
153
- if (item[dict.color]) {
154
- return;
155
- }
156
- if (this.color === "auto") {
157
- const hashcode = this.hashcode(item[dict.value]);
158
- const colors = this.autoColors ? this.autoColors : COLOR_LIST;
159
- item[dict.color] = colors[hashcode % colors.length];
160
- const effects = this.autoEffects ? this.autoEffects : EFFECT_LIST;
161
- item.effect =
162
- effects[Math.floor(hashcode / colors.length) % effects.length];
163
- } else {
164
- item[dict.color] = this.color;
165
- }
166
- },
167
- hashcode(str) {
168
- if (str == null) {
169
- return 0;
170
- }
171
- if (typeof str !== "string") {
172
- str = JSON.stringify(str);
173
- }
174
- let hash = 0;
175
- let i;
176
- let chr;
177
- let len;
178
- if (str.length === 0) return hash;
179
- for (i = 0, len = str.length; i < len; i++) {
180
- chr = str.charCodeAt(i);
181
- hash = (hash << 5) - hash + chr;
182
- hash |= 0; // Convert to 32bit integer
183
- }
184
- return hash;
185
- },
186
- },
187
- });
188
- </script>
@@ -1,86 +0,0 @@
1
- export default {
2
- // v-dialog-drag: 弹窗拖拽
3
- bind(el, binding, vnode, oldVnode) {
4
- const value = binding.value;
5
- if (value == false) return;
6
- // 获取拖拽内容头部
7
- const dialogHeaderEl = el.querySelector(".el-dialog__header");
8
- const dragEl = el.querySelector(".dialog-drag");
9
- const dragDom = el.querySelector(".el-dialog");
10
-
11
- if (!dragDom & !dialogHeaderEl) return;
12
- dragEl.style.cursor = "move";
13
- // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
14
- const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
15
-
16
- // dragDom.style.position = 'absolute';
17
- // dragDom.style.top = `${dragDom.style.marginTop}`;
18
- // dragDom.style.marginTop = 0;
19
- let width = dragDom.style.width;
20
- if (width.includes("%")) {
21
- width = +document.body.clientWidth * (+width.replace(/\%/g, "") / 100);
22
- } else {
23
- width = +width.replace(/\px/g, "");
24
- }
25
- ``;
26
- // dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`;
27
- // 鼠标按下事件
28
- dragEl.onmousedown = (e) => {
29
- dragDom.style["user-select"] = "none";
30
- // 鼠标按下,计算当前元素距离可视区的距离 (鼠标点击位置距离可视窗口的距离)
31
- const disX = e.clientX - dialogHeaderEl.offsetLeft;
32
- const disY = e.clientY - dialogHeaderEl.offsetTop;
33
-
34
- // 获取到的值带px 正则匹配替换
35
- let styL, styT;
36
-
37
- // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
38
- if (sty.left.includes("%")) {
39
- styL =
40
- +document.body.clientWidth * (+sty.left.replace(/\%/g, "") / 100);
41
- styT =
42
- +document.body.clientHeight * (+sty.top.replace(/\%/g, "") / 100);
43
- } else {
44
- styL = +sty.left.replace(/\px/g, "");
45
- styT = +sty.top.replace(/\px/g, "");
46
- }
47
-
48
- // 鼠标拖拽事件
49
- document.onmousemove = function (e) {
50
- // 通过事件委托,计算移动的距离 (开始拖拽至结束拖拽的距离)
51
- const l = e.clientX - disX;
52
- const t = e.clientY - disY;
53
-
54
- let finallyL = l + styL;
55
- let finallyT = t + styT;
56
-
57
- // // 边界值判定 注意clientWidth scrollWidth区别 要减去之前的top left值
58
- // // dragDom.offsetParent表示弹窗阴影部分
59
- // if (finallyL < 0) {
60
- // finallyL = 0
61
- // } else if (finallyL > dragDom.offsetParent.clientWidth - dragDom.clientWidth - dragDom.offsetParent.offsetLeft) {
62
- // finallyL = dragDom.offsetParent.clientWidth - dragDom.clientWidth - dragDom.offsetParent.offsetLeft
63
- // }
64
-
65
- // if (finallyT < 0) {
66
- // finallyT = 0
67
- // } else if (finallyT > dragDom.offsetParent.clientHeight - dragDom.clientHeight - dragDom.offsetParent.offsetLeft) (
68
- // finallyT = dragDom.offsetParent.clientHeight - dragDom.clientHeight - dragDom.offsetParent.offsetLeft
69
- // )
70
-
71
- // 移动当前元素
72
- dragDom.style.left = `${finallyL}px`;
73
- dragDom.style.top = `${finallyT}px`;
74
-
75
- //将此时的位置传出去
76
- //binding.value({x:e.pageX,y:e.pageY})
77
- };
78
-
79
- document.onmouseup = function (e) {
80
- dragDom.style["user-select"] = "auto";
81
- document.onmousemove = null;
82
- document.onmouseup = null;
83
- };
84
- };
85
- },
86
- };