el-plus-crud 0.0.39 → 0.0.41

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 (73) hide show
  1. package/.eslintrc.js +78 -78
  2. package/.prettierrc.js +39 -39
  3. package/CHANGELOG.md +5 -1
  4. package/build.js +31 -31
  5. package/dist/el-plus-crud.mjs +1803 -1801
  6. package/dist/el-plus-crud.umd.js +7 -7
  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 +771 -774
  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 -53
  20. package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +44 -44
  21. package/lib/components/el-plus-form/components/ElPlusFormCheckboxButton.vue +44 -44
  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 -46
  25. package/lib/components/el-plus-form/components/ElPlusFormDatetime.vue +40 -40
  26. package/lib/components/el-plus-form/components/ElPlusFormFile.vue +47 -47
  27. package/lib/components/el-plus-form/components/ElPlusFormImage.vue +113 -113
  28. package/lib/components/el-plus-form/components/ElPlusFormLink.vue +281 -281
  29. package/lib/components/el-plus-form/components/ElPlusFormLkuser.vue +489 -489
  30. package/lib/components/el-plus-form/components/ElPlusFormNbinput.vue +53 -53
  31. package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +146 -146
  32. package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +94 -94
  33. package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +42 -42
  34. package/lib/components/el-plus-form/components/ElPlusFormRate.vue +38 -38
  35. package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +161 -161
  36. package/lib/components/el-plus-form/components/ElPlusFormSlider.vue +38 -38
  37. package/lib/components/el-plus-form/components/ElPlusFormSwitch.vue +38 -38
  38. package/lib/components/el-plus-form/components/ElPlusFormTag.vue +78 -78
  39. package/lib/components/el-plus-form/components/ElPlusFormText.vue +99 -99
  40. package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +49 -49
  41. package/lib/components/el-plus-form/components/ElPlusFormTransfer.vue +44 -44
  42. package/lib/components/el-plus-form/components/ElPlusFormTree.vue +76 -76
  43. package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +59 -59
  44. package/lib/components/el-plus-form/components/ElPlusFormUpload.vue +368 -368
  45. package/lib/components/el-plus-form/components/components/file-icons/FileIcons.vue +135 -135
  46. package/lib/components/el-plus-form/components/components/file-icons/data/index.ts +27 -27
  47. package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +12 -12
  48. package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +18 -18
  49. package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +13 -13
  50. package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +12 -12
  51. package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +12 -12
  52. package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +12 -12
  53. package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +12 -12
  54. package/lib/components/el-plus-form/components/index.ts +17 -17
  55. package/lib/components/el-plus-form/data/file.ts +74 -74
  56. package/lib/components/el-plus-form/mixins/index.ts +115 -113
  57. package/lib/components/el-plus-form/util/index.ts +257 -257
  58. package/lib/components/el-plus-form/util/validate.ts +332 -332
  59. package/lib/components/el-plus-table/components/columnItem.vue +205 -205
  60. package/lib/components/el-plus-table/components/header.vue +240 -240
  61. package/lib/components/el-plus-table/components/statisticInfo.vue +47 -47
  62. package/lib/components/el-plus-table/util/index.ts +147 -147
  63. package/lib/config/index.ts +30 -30
  64. package/lib/index.d.ts +4 -4
  65. package/lib/index.ts +51 -51
  66. package/package.json +1 -1
  67. package/types/axios.d.ts +13 -13
  68. package/types/formList.d.ts +440 -440
  69. package/types/layout.d.ts +57 -57
  70. package/types/mitt.d.ts +38 -38
  71. package/types/pinia.d.ts +149 -149
  72. package/types/views.d.ts +329 -329
  73. 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>