el-plus-crud 0.0.38 → 0.0.39

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 (76) hide show
  1. package/.eslintrc.js +78 -78
  2. package/.prettierrc.js +39 -39
  3. package/CHANGELOG.md +7 -5
  4. package/build.js +31 -31
  5. package/dist/el-plus-crud.mjs +2750 -2722
  6. package/dist/el-plus-crud.umd.js +14 -14
  7. package/dist/style.css +1 -1
  8. package/example/App.vue +67 -67
  9. package/example/main.js +18 -18
  10. package/index.html +13 -13
  11. package/lib/components/el-plus-form/ElPlusForm.vue +774 -772
  12. package/lib/components/el-plus-form/ElPlusFormDialog.vue +90 -90
  13. package/lib/components/el-plus-form/ElPlusFormGroup.vue +116 -116
  14. package/lib/components/el-plus-form/components/ElPlusFormArea.vue +61 -61
  15. package/lib/components/el-plus-form/components/ElPlusFormAutocomplete.vue +49 -49
  16. package/lib/components/el-plus-form/components/ElPlusFormBtn.vue +102 -102
  17. package/lib/components/el-plus-form/components/ElPlusFormBtns.vue +133 -133
  18. package/lib/components/el-plus-form/components/ElPlusFormCascader.vue +63 -63
  19. package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +53 -51
  20. package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +44 -42
  21. package/lib/components/el-plus-form/components/ElPlusFormCheckboxButton.vue +44 -42
  22. package/lib/components/el-plus-form/components/ElPlusFormColor.vue +38 -38
  23. package/lib/components/el-plus-form/components/ElPlusFormDate.vue +39 -39
  24. package/lib/components/el-plus-form/components/ElPlusFormDaterange.vue +46 -44
  25. package/lib/components/el-plus-form/components/ElPlusFormDatetime.vue +40 -38
  26. package/lib/components/el-plus-form/components/ElPlusFormDatetimerange.vue +3 -1
  27. package/lib/components/el-plus-form/components/ElPlusFormFile.vue +47 -47
  28. package/lib/components/el-plus-form/components/ElPlusFormImage.vue +113 -113
  29. package/lib/components/el-plus-form/components/ElPlusFormInput.vue +3 -1
  30. package/lib/components/el-plus-form/components/ElPlusFormLink.vue +281 -281
  31. package/lib/components/el-plus-form/components/ElPlusFormLkuser.vue +489 -489
  32. package/lib/components/el-plus-form/components/ElPlusFormNbinput.vue +53 -51
  33. package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +146 -144
  34. package/lib/components/el-plus-form/components/ElPlusFormPassword.vue +3 -1
  35. package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +94 -92
  36. package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +42 -42
  37. package/lib/components/el-plus-form/components/ElPlusFormRate.vue +38 -38
  38. package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +161 -161
  39. package/lib/components/el-plus-form/components/ElPlusFormSlider.vue +38 -38
  40. package/lib/components/el-plus-form/components/ElPlusFormSwitch.vue +38 -38
  41. package/lib/components/el-plus-form/components/ElPlusFormTag.vue +78 -78
  42. package/lib/components/el-plus-form/components/ElPlusFormText.vue +99 -99
  43. package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +49 -47
  44. package/lib/components/el-plus-form/components/ElPlusFormTransfer.vue +44 -44
  45. package/lib/components/el-plus-form/components/ElPlusFormTree.vue +76 -76
  46. package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +59 -59
  47. package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +368 -368
  48. package/lib/components/el-plus-form/components/components/file-icons/FileIcons.vue +135 -135
  49. package/lib/components/el-plus-form/components/components/file-icons/data/index.ts +27 -27
  50. package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +12 -12
  51. package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +18 -18
  52. package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +13 -13
  53. package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +12 -12
  54. package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +12 -12
  55. package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +12 -12
  56. package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +12 -12
  57. package/lib/components/el-plus-form/components/index.ts +17 -17
  58. package/lib/components/el-plus-form/data/file.ts +74 -74
  59. package/lib/components/el-plus-form/mixins/index.ts +113 -113
  60. package/lib/components/el-plus-form/util/index.ts +257 -257
  61. package/lib/components/el-plus-form/util/validate.ts +332 -332
  62. package/lib/components/el-plus-table/components/columnItem.vue +205 -205
  63. package/lib/components/el-plus-table/components/header.vue +240 -240
  64. package/lib/components/el-plus-table/components/statisticInfo.vue +47 -47
  65. package/lib/components/el-plus-table/util/index.ts +147 -147
  66. package/lib/config/index.ts +30 -30
  67. package/lib/index.d.ts +4 -4
  68. package/lib/index.ts +51 -51
  69. package/package.json +1 -1
  70. package/types/axios.d.ts +13 -13
  71. package/types/formList.d.ts +440 -440
  72. package/types/layout.d.ts +57 -57
  73. package/types/mitt.d.ts +38 -38
  74. package/types/pinia.d.ts +149 -149
  75. package/types/views.d.ts +329 -329
  76. package/vite.config.ts +78 -78
@@ -1,205 +1,205 @@
1
- <template>
2
- <div class="el-plus-table-column-item" :class="[desc.inline ? 'el-plus-table-column-row' : 'el-plus-table-column-column']">
3
- <template v-for="(item, i) in cells" :key="i + (item.options && item.options.length > 0 ? item.options[0].value || item.options[0].v : '0')">
4
- <el-popover v-if="desc.content && popoverContent" placement="left" :width="200" trigger="hover" effect="dark" :content="popoverContent">
5
- <template #reference>
6
- <el-icon style="color: #f56c6c; font-size: 26px; padding: 0px 8px 0 0"><WarningFilled /></el-icon>
7
- </template>
8
- </el-popover>
9
- <div style="width: 100%; display: flex">
10
- <component v-if="item.vshow === undefined || item.vshow" v-bind="item" :isTable="true" :formData="props.scope?.row" :size="item.size || size" :rowIndex="rowIndex" v-model="props.scope.row[item.field]" :is="'el-plus-form-' + item.desc.type"> </component>
11
- </div>
12
- </template>
13
- </div>
14
- </template>
15
- <script lang="ts" setup>
16
- import { ref, onMounted, computed } from 'vue'
17
- import { WarningFilled } from '@element-plus/icons-vue'
18
-
19
- const props = defineProps<{
20
- modelValue?: any
21
- field?: string
22
- desc: IColumnItem
23
- scope: { [key: string]: any }
24
- size?: string
25
- }>()
26
-
27
- const rowIndex = ref(props.scope?.$index || 0)
28
- const cells = computed(() => {
29
- const _cells = [] as any
30
-
31
- // 判断有没有nodes
32
- if (props.desc.nodes) {
33
- props.desc.nodes.map((item, i) => {
34
- _cells.push(handelItem(item.field || props.field, item, i))
35
- })
36
- } else {
37
- const porpList = props.field ? props.field.split(',') : ([] as string[])
38
- porpList.map((item, i) => {
39
- _cells.push(handelItem(item, props.desc, i))
40
- })
41
- }
42
- // 处理下没有prop的属性
43
- if (_cells.length <= 0) {
44
- _cells.push(handelItem('', props.desc, 0))
45
- }
46
- return _cells
47
- })
48
-
49
- // 鼠标悬浮
50
- const popoverContent = computed(() => {
51
- if (typeof props.desc.content === 'function') {
52
- // 如果有方法类型的判断,则需要启用动态监测
53
- return props.desc.content(props.modelValue, props.scope?.row, props.field)
54
- } else {
55
- return props.desc.content || ''
56
- }
57
- })
58
-
59
- const handelItem = (prop: string, item: any, i: number) => {
60
- const tempCell = {
61
- field: prop,
62
- desc: {
63
- prop: prop,
64
- default: '',
65
- size: item.size || props.size || 'small'
66
- }
67
- } as any
68
- Object.assign(tempCell.desc, item)
69
- if (item.type === 'btn') {
70
- tempCell.desc.btnType = item.btnType || 'primary'
71
- tempCell.desc.btnLabel = item.btnLabel || item.label
72
- tempCell.desc.plain = item.plain || true
73
- tempCell.desc.text = true
74
- }
75
- if (item.type) {
76
- if (item.type === 'text') {
77
- tempCell.desc.default = item.default || '-'
78
- }
79
- if (item.type === 'tag') {
80
- // tempCell.size = tempCell.size || 'small '
81
- } else {
82
- // tempCell.size = tempCell.size || size || 'small';
83
- }
84
- if (typeof item.type === 'string') {
85
- tempCell.desc.type = item.type
86
- } else {
87
- tempCell.desc.type = item.type[i] || item.type[0]
88
- }
89
- if (item.format) {
90
- if (typeof item.format === 'string' || typeof item.format === 'function') {
91
- tempCell.desc.format = item.format
92
- } else {
93
- tempCell.desc.format = item.format[i] === null ? null : item.format[i] || item.format[0]
94
- }
95
- }
96
- if (item.title) {
97
- if (typeof item.title === 'string') {
98
- tempCell.desc.title = item.title
99
- } else {
100
- tempCell.desc.title = item.title[i] || item.title[0]
101
- }
102
- }
103
- } else {
104
- tempCell.desc.type = 'text'
105
- }
106
- if (item.elType) {
107
- tempCell.desc.elType = item.elType
108
- }
109
- if (item.linkType) {
110
- tempCell.desc.linkType = item.linkType
111
- }
112
- if (item.linkId) {
113
- tempCell.desc.linkId = item.linkId
114
- }
115
- if (item.color) {
116
- tempCell.desc.style = item.style || {}
117
-
118
- if (typeof item.color === 'function') {
119
- tempCell.desc.style.color = item.color(props.scope?.row[props.field || ''], props.scope?.row, props.field)
120
- } else if (typeof item.color === 'string') {
121
- tempCell.desc.style.color = item.color
122
- } else {
123
- tempCell.desc.style.color = item.color[i] === null ? null : item.color[i] || item.color[0]
124
- }
125
- }
126
- if (item.on) {
127
- if (Object.prototype.toString.call(item.on) === '[object Array]') {
128
- tempCell.desc.on = item.on[i] === null ? null : item.on[i] || item.on[0]
129
- } else {
130
- tempCell.desc.on = item.on
131
- }
132
- }
133
- if (item.disabled) {
134
- tempCell.disabled = true
135
- }
136
- // 处理下options
137
- if (typeof item.options === 'function') {
138
- tempCell.desc.options = item.options(props.scope)
139
- }
140
-
141
- // 处理下vif
142
- tempCell.vshow = handelColumnVIf(item)
143
-
144
- // 处理下attrs
145
- if (item.attrs) {
146
- if (typeof item.attrs === 'function') {
147
- tempCell.desc.attrs = item.attrs(props.scope?.row)
148
- } else {
149
- tempCell.desc.attrs = item.attrs
150
- }
151
- }
152
-
153
- tempCell.desc._label = item.label
154
-
155
- // 处理attrs
156
- return tempCell
157
- }
158
-
159
- const handelColumnVIf = (item: any) => {
160
- if (item.vshow !== undefined && item.vshow !== null && item.vshow !== '') {
161
- if (typeof item.vshow === 'boolean') return item.vshow
162
- if (typeof item.vshow === 'function') return item.vshow(props.scope?.row)
163
- return !!item.vshow
164
- }
165
- return true
166
- }
167
-
168
- onMounted(() => {})
169
- </script>
170
- <style lang="scss" scoped>
171
- .el-plus-table-column-item {
172
- width: 100%;
173
- display: flex;
174
- :deep(.ele-form-text) {
175
- display: inline-block;
176
- text-overflow: ellipsis;
177
- overflow: hidden;
178
- white-space: nowrap;
179
- }
180
- }
181
-
182
- .el-plus-table-column-row {
183
- flex-direction: row;
184
-
185
- & > div {
186
- margin-right: 10px;
187
-
188
- &:last-child {
189
- margin: 0;
190
- }
191
- }
192
- }
193
-
194
- .el-plus-table-column-column {
195
- flex-direction: row;
196
-
197
- & > div {
198
- margin-bottom: 10px;
199
-
200
- &:last-child {
201
- margin: 0;
202
- }
203
- }
204
- }
205
- </style>
1
+ <template>
2
+ <div class="el-plus-table-column-item" :class="[desc.inline ? 'el-plus-table-column-row' : 'el-plus-table-column-column']">
3
+ <template v-for="(item, i) in cells" :key="i + (item.options && item.options.length > 0 ? item.options[0].value || item.options[0].v : '0')">
4
+ <el-popover v-if="desc.content && popoverContent" placement="left" :width="200" trigger="hover" effect="dark" :content="popoverContent">
5
+ <template #reference>
6
+ <el-icon style="color: #f56c6c; font-size: 26px; padding: 0px 8px 0 0"><WarningFilled /></el-icon>
7
+ </template>
8
+ </el-popover>
9
+ <div style="width: 100%; display: flex">
10
+ <component v-if="item.vshow === undefined || item.vshow" v-bind="item" :isTable="true" :formData="props.scope?.row" :size="item.size || size" :rowIndex="rowIndex" v-model="props.scope.row[item.field]" :is="'el-plus-form-' + item.desc.type"> </component>
11
+ </div>
12
+ </template>
13
+ </div>
14
+ </template>
15
+ <script lang="ts" setup>
16
+ import { ref, onMounted, computed } from 'vue'
17
+ import { WarningFilled } from '@element-plus/icons-vue'
18
+
19
+ const props = defineProps<{
20
+ modelValue?: any
21
+ field?: string
22
+ desc: IColumnItem
23
+ scope: { [key: string]: any }
24
+ size?: string
25
+ }>()
26
+
27
+ const rowIndex = ref(props.scope?.$index || 0)
28
+ const cells = computed(() => {
29
+ const _cells = [] as any
30
+
31
+ // 判断有没有nodes
32
+ if (props.desc.nodes) {
33
+ props.desc.nodes.map((item, i) => {
34
+ _cells.push(handelItem(item.field || props.field, item, i))
35
+ })
36
+ } else {
37
+ const porpList = props.field ? props.field.split(',') : ([] as string[])
38
+ porpList.map((item, i) => {
39
+ _cells.push(handelItem(item, props.desc, i))
40
+ })
41
+ }
42
+ // 处理下没有prop的属性
43
+ if (_cells.length <= 0) {
44
+ _cells.push(handelItem('', props.desc, 0))
45
+ }
46
+ return _cells
47
+ })
48
+
49
+ // 鼠标悬浮
50
+ const popoverContent = computed(() => {
51
+ if (typeof props.desc.content === 'function') {
52
+ // 如果有方法类型的判断,则需要启用动态监测
53
+ return props.desc.content(props.modelValue, props.scope?.row, props.field)
54
+ } else {
55
+ return props.desc.content || ''
56
+ }
57
+ })
58
+
59
+ const handelItem = (prop: string, item: any, i: number) => {
60
+ const tempCell = {
61
+ field: prop,
62
+ desc: {
63
+ prop: prop,
64
+ default: '',
65
+ size: item.size || props.size || 'small'
66
+ }
67
+ } as any
68
+ Object.assign(tempCell.desc, item)
69
+ if (item.type === 'btn') {
70
+ tempCell.desc.btnType = item.btnType || 'primary'
71
+ tempCell.desc.btnLabel = item.btnLabel || item.label
72
+ tempCell.desc.plain = item.plain || true
73
+ tempCell.desc.text = true
74
+ }
75
+ if (item.type) {
76
+ if (item.type === 'text') {
77
+ tempCell.desc.default = item.default || '-'
78
+ }
79
+ if (item.type === 'tag') {
80
+ // tempCell.size = tempCell.size || 'small '
81
+ } else {
82
+ // tempCell.size = tempCell.size || size || 'small';
83
+ }
84
+ if (typeof item.type === 'string') {
85
+ tempCell.desc.type = item.type
86
+ } else {
87
+ tempCell.desc.type = item.type[i] || item.type[0]
88
+ }
89
+ if (item.format) {
90
+ if (typeof item.format === 'string' || typeof item.format === 'function') {
91
+ tempCell.desc.format = item.format
92
+ } else {
93
+ tempCell.desc.format = item.format[i] === null ? null : item.format[i] || item.format[0]
94
+ }
95
+ }
96
+ if (item.title) {
97
+ if (typeof item.title === 'string') {
98
+ tempCell.desc.title = item.title
99
+ } else {
100
+ tempCell.desc.title = item.title[i] || item.title[0]
101
+ }
102
+ }
103
+ } else {
104
+ tempCell.desc.type = 'text'
105
+ }
106
+ if (item.elType) {
107
+ tempCell.desc.elType = item.elType
108
+ }
109
+ if (item.linkType) {
110
+ tempCell.desc.linkType = item.linkType
111
+ }
112
+ if (item.linkId) {
113
+ tempCell.desc.linkId = item.linkId
114
+ }
115
+ if (item.color) {
116
+ tempCell.desc.style = item.style || {}
117
+
118
+ if (typeof item.color === 'function') {
119
+ tempCell.desc.style.color = item.color(props.scope?.row[props.field || ''], props.scope?.row, props.field)
120
+ } else if (typeof item.color === 'string') {
121
+ tempCell.desc.style.color = item.color
122
+ } else {
123
+ tempCell.desc.style.color = item.color[i] === null ? null : item.color[i] || item.color[0]
124
+ }
125
+ }
126
+ if (item.on) {
127
+ if (Object.prototype.toString.call(item.on) === '[object Array]') {
128
+ tempCell.desc.on = item.on[i] === null ? null : item.on[i] || item.on[0]
129
+ } else {
130
+ tempCell.desc.on = item.on
131
+ }
132
+ }
133
+ if (item.disabled) {
134
+ tempCell.disabled = true
135
+ }
136
+ // 处理下options
137
+ if (typeof item.options === 'function') {
138
+ tempCell.desc.options = item.options(props.scope)
139
+ }
140
+
141
+ // 处理下vif
142
+ tempCell.vshow = handelColumnVIf(item)
143
+
144
+ // 处理下attrs
145
+ if (item.attrs) {
146
+ if (typeof item.attrs === 'function') {
147
+ tempCell.desc.attrs = item.attrs(props.scope?.row)
148
+ } else {
149
+ tempCell.desc.attrs = item.attrs
150
+ }
151
+ }
152
+
153
+ tempCell.desc._label = item.label
154
+
155
+ // 处理attrs
156
+ return tempCell
157
+ }
158
+
159
+ const handelColumnVIf = (item: any) => {
160
+ if (item.vshow !== undefined && item.vshow !== null && item.vshow !== '') {
161
+ if (typeof item.vshow === 'boolean') return item.vshow
162
+ if (typeof item.vshow === 'function') return item.vshow(props.scope?.row)
163
+ return !!item.vshow
164
+ }
165
+ return true
166
+ }
167
+
168
+ onMounted(() => {})
169
+ </script>
170
+ <style lang="scss" scoped>
171
+ .el-plus-table-column-item {
172
+ width: 100%;
173
+ display: flex;
174
+ :deep(.ele-form-text) {
175
+ display: inline-block;
176
+ text-overflow: ellipsis;
177
+ overflow: hidden;
178
+ white-space: nowrap;
179
+ }
180
+ }
181
+
182
+ .el-plus-table-column-row {
183
+ flex-direction: row;
184
+
185
+ & > div {
186
+ margin-right: 10px;
187
+
188
+ &:last-child {
189
+ margin: 0;
190
+ }
191
+ }
192
+ }
193
+
194
+ .el-plus-table-column-column {
195
+ flex-direction: row;
196
+
197
+ & > div {
198
+ margin-bottom: 10px;
199
+
200
+ &:last-child {
201
+ margin: 0;
202
+ }
203
+ }
204
+ }
205
+ </style>