el-plus-crud 0.1.13 → 0.1.14
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.
- package/.eslintignore +18 -18
- package/.eslintrc.js +78 -78
- package/.lintstagedrc +3 -3
- package/.prettierrc.js +39 -39
- package/CHANGELOG.md +261 -259
- package/LICENSE +21 -21
- package/README.md +19 -19
- package/build.js +31 -31
- package/dist/el-plus-crud.mjs +1952 -1952
- package/example/App.vue +252 -252
- package/example/main.js +18 -18
- package/example/style.css +4 -4
- package/index.html +13 -13
- package/lib/components/el-plus-form/ElPlusForm.vue +4 -7
- package/lib/components/el-plus-form/ElPlusFormDialog.vue +93 -93
- package/lib/components/el-plus-form/ElPlusFormGroup.vue +201 -201
- package/lib/components/el-plus-form/components/ElPlusFormCascader.vue +65 -65
- package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +72 -72
- package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +81 -81
- package/lib/components/el-plus-form/components/ElPlusFormImage.vue +115 -115
- package/lib/components/el-plus-form/components/ElPlusFormLink.vue +285 -285
- package/lib/components/el-plus-form/components/ElPlusFormQuickInput.vue +98 -98
- package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +69 -69
- package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +185 -185
- package/lib/components/el-plus-form/components/ElPlusFormStatus.vue +102 -102
- package/lib/components/el-plus-form/components/ElPlusFormText.vue +113 -113
- package/lib/components/el-plus-form/components/ElPlusFormTree.vue +79 -79
- package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +62 -62
- package/lib/components/el-plus-form/components/components/file-icons/data/index.ts +27 -27
- package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +18 -18
- package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +13 -13
- package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +12 -12
- package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +12 -12
- package/lib/components/el-plus-form/components/index.ts +17 -17
- package/lib/components/el-plus-form/data/file.ts +74 -74
- package/lib/components/el-plus-form/util/validate.ts +346 -346
- package/lib/components/el-plus-table/ElPlusTable.vue +972 -972
- package/lib/components/el-plus-table/components/columnItem.vue +220 -220
- package/lib/components/el-plus-table/components/header.vue +345 -345
- package/lib/components/el-plus-table/components/statisticInfo.vue +47 -47
- package/lib/index.d.ts +4 -4
- package/lib/util/index.ts +390 -390
- package/package.json +70 -70
- package/tsconfig.json +78 -78
- package/types/global.d.ts +13 -13
- package/types/index.d.ts +561 -561
- package/vite.config.ts +78 -78
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-cascader v-if="isInit" class="ElPlusFormCascader-panel" v-bind="attrs" :disabled="disabled" v-on="onEvents" :options="options" v-model="currentValue" />
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
export default {
|
|
6
|
-
name: 'ElPlusFormCascader',
|
|
7
|
-
inheritAttrs: false,
|
|
8
|
-
typeName: 'cascader',
|
|
9
|
-
customOptions: {}
|
|
10
|
-
}
|
|
11
|
-
</script>
|
|
12
|
-
<script lang="ts" setup>
|
|
13
|
-
import { ref, useAttrs, onBeforeMount, inject, reactive, watch } from 'vue'
|
|
14
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
-
import { isEqual } from '../../../util'
|
|
16
|
-
|
|
17
|
-
const globalData = inject('globalData') as any
|
|
18
|
-
|
|
19
|
-
const props = defineProps<{
|
|
20
|
-
modelValue?: Array<string> | string | null
|
|
21
|
-
field?: string
|
|
22
|
-
desc: { [key: string]: any }
|
|
23
|
-
formData?: { [key: string]: any }
|
|
24
|
-
disabled?: boolean
|
|
25
|
-
}>()
|
|
26
|
-
|
|
27
|
-
const emits = defineEmits(['update:modelValue'])
|
|
28
|
-
const currentValue = ref(props.modelValue)
|
|
29
|
-
emits('update:modelValue', currentValue)
|
|
30
|
-
|
|
31
|
-
const isInit = ref(false)
|
|
32
|
-
const attrs = ref({} as any)
|
|
33
|
-
const onEvents = ref(getEvents(props))
|
|
34
|
-
const options = reactive([] as any[])
|
|
35
|
-
|
|
36
|
-
onBeforeMount(async () => {
|
|
37
|
-
attrs.value = await getAttrs(props, { clearable: true, props: { value: 'value', label: 'label', children: 'children', checkStrictly: !!props.desc.checkStrictly }, ...useAttrs() })
|
|
38
|
-
isInit.value = true
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
//监听options数据
|
|
42
|
-
watch(
|
|
43
|
-
() => props.desc.options,
|
|
44
|
-
async (data) => {
|
|
45
|
-
if (typeof data === 'string') {
|
|
46
|
-
options.splice(0, options.length, ...(globalData[data] || []))
|
|
47
|
-
} else if (typeof data === 'function') {
|
|
48
|
-
options.splice(0, options.length, ...(await data(props.formData || {})))
|
|
49
|
-
} else if (Array.isArray(data)) {
|
|
50
|
-
if (data && options && !isEqual(data, options)) {
|
|
51
|
-
options.splice(0, options.length, ...data)
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
options.splice(0, options.length)
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{ immediate: true }
|
|
58
|
-
)
|
|
59
|
-
</script>
|
|
60
|
-
<style lang="scss" scoped>
|
|
61
|
-
.ElPlusFormCascader-panel {
|
|
62
|
-
display: flex;
|
|
63
|
-
}
|
|
64
|
-
</style>
|
|
65
|
-
../util/aaaaa
|
|
1
|
+
<template>
|
|
2
|
+
<el-cascader v-if="isInit" class="ElPlusFormCascader-panel" v-bind="attrs" :disabled="disabled" v-on="onEvents" :options="options" v-model="currentValue" />
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts">
|
|
5
|
+
export default {
|
|
6
|
+
name: 'ElPlusFormCascader',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
typeName: 'cascader',
|
|
9
|
+
customOptions: {}
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { ref, useAttrs, onBeforeMount, inject, reactive, watch } from 'vue'
|
|
14
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
+
import { isEqual } from '../../../util'
|
|
16
|
+
|
|
17
|
+
const globalData = inject('globalData') as any
|
|
18
|
+
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
modelValue?: Array<string> | string | null
|
|
21
|
+
field?: string
|
|
22
|
+
desc: { [key: string]: any }
|
|
23
|
+
formData?: { [key: string]: any }
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
const emits = defineEmits(['update:modelValue'])
|
|
28
|
+
const currentValue = ref(props.modelValue)
|
|
29
|
+
emits('update:modelValue', currentValue)
|
|
30
|
+
|
|
31
|
+
const isInit = ref(false)
|
|
32
|
+
const attrs = ref({} as any)
|
|
33
|
+
const onEvents = ref(getEvents(props))
|
|
34
|
+
const options = reactive([] as any[])
|
|
35
|
+
|
|
36
|
+
onBeforeMount(async () => {
|
|
37
|
+
attrs.value = await getAttrs(props, { clearable: true, props: { value: 'value', label: 'label', children: 'children', checkStrictly: !!props.desc.checkStrictly }, ...useAttrs() })
|
|
38
|
+
isInit.value = true
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
//监听options数据
|
|
42
|
+
watch(
|
|
43
|
+
() => props.desc.options,
|
|
44
|
+
async (data) => {
|
|
45
|
+
if (typeof data === 'string') {
|
|
46
|
+
options.splice(0, options.length, ...(globalData[data] || []))
|
|
47
|
+
} else if (typeof data === 'function') {
|
|
48
|
+
options.splice(0, options.length, ...(await data(props.formData || {})))
|
|
49
|
+
} else if (Array.isArray(data)) {
|
|
50
|
+
if (data && options && !isEqual(data, options)) {
|
|
51
|
+
options.splice(0, options.length, ...data)
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
options.splice(0, options.length)
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{ immediate: true }
|
|
58
|
+
)
|
|
59
|
+
</script>
|
|
60
|
+
<style lang="scss" scoped>
|
|
61
|
+
.ElPlusFormCascader-panel {
|
|
62
|
+
display: flex;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
../util/aaaaa
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-cascader-panel v-if="isInit" class="ElPlusFormCascaderPanel-panel" v-bind="attrs" :disabled="disabled" v-on="onEvents" :options="options" v-model="currentValue"> </el-cascader-panel>
|
|
3
|
-
</template>
|
|
4
|
-
<script lang="ts">
|
|
5
|
-
export default {
|
|
6
|
-
name: 'ElPlusFormCascaderPanel',
|
|
7
|
-
inheritAttrs: false,
|
|
8
|
-
typeName: 'cascaderPanel',
|
|
9
|
-
customOptions: {}
|
|
10
|
-
}
|
|
11
|
-
</script>
|
|
12
|
-
<script lang="ts" setup>
|
|
13
|
-
import { ref, reactive, useAttrs, watch, onBeforeMount, inject } from 'vue'
|
|
14
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
-
import { isEqual } from '../../../util'
|
|
16
|
-
|
|
17
|
-
const globalData = inject('globalData') as any
|
|
18
|
-
|
|
19
|
-
const props = defineProps<{
|
|
20
|
-
modelValue?: Array<string> | string | null
|
|
21
|
-
field?: string
|
|
22
|
-
desc: { [key: string]: any }
|
|
23
|
-
formData?: { [key: string]: any }
|
|
24
|
-
disabled?: boolean
|
|
25
|
-
}>()
|
|
26
|
-
|
|
27
|
-
const emits = defineEmits(['update:modelValue'])
|
|
28
|
-
const currentValue = ref(Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue])
|
|
29
|
-
emits('update:modelValue', currentValue)
|
|
30
|
-
|
|
31
|
-
const attrs = ref({} as any)
|
|
32
|
-
const isInit = ref(false)
|
|
33
|
-
const onEvents = ref(getEvents(props))
|
|
34
|
-
const options = reactive([] as any[])
|
|
35
|
-
|
|
36
|
-
onBeforeMount(async () => {
|
|
37
|
-
attrs.value = await getAttrs(props, {
|
|
38
|
-
props: { value: 'value', label: 'label', children: 'children' },
|
|
39
|
-
fetchSuggestions(s: any, cb: Function) {
|
|
40
|
-
const res: any[] = []
|
|
41
|
-
cb(res)
|
|
42
|
-
},
|
|
43
|
-
...useAttrs()
|
|
44
|
-
})
|
|
45
|
-
isInit.value = true
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
//监听options数据
|
|
49
|
-
watch(
|
|
50
|
-
() => props.desc.options,
|
|
51
|
-
async (data) => {
|
|
52
|
-
if (typeof data === 'string') {
|
|
53
|
-
options.splice(0, options.length, ...(globalData[data] || []))
|
|
54
|
-
} else if (typeof data === 'function') {
|
|
55
|
-
options.splice(0, options.length, ...(await data(props.formData || {})))
|
|
56
|
-
} else if (Array.isArray(data)) {
|
|
57
|
-
if (data && options && !isEqual(data, options)) {
|
|
58
|
-
options.splice(0, options.length, ...data)
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
options.splice(0, options.length)
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{ immediate: true }
|
|
65
|
-
)
|
|
66
|
-
</script>
|
|
67
|
-
<style lang="scss" scoped>
|
|
68
|
-
.ElPlusFormCascaderPanel-panel {
|
|
69
|
-
display: flex;
|
|
70
|
-
}
|
|
71
|
-
</style>
|
|
72
|
-
../util/aaaaa
|
|
1
|
+
<template>
|
|
2
|
+
<el-cascader-panel v-if="isInit" class="ElPlusFormCascaderPanel-panel" v-bind="attrs" :disabled="disabled" v-on="onEvents" :options="options" v-model="currentValue"> </el-cascader-panel>
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts">
|
|
5
|
+
export default {
|
|
6
|
+
name: 'ElPlusFormCascaderPanel',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
typeName: 'cascaderPanel',
|
|
9
|
+
customOptions: {}
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { ref, reactive, useAttrs, watch, onBeforeMount, inject } from 'vue'
|
|
14
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
15
|
+
import { isEqual } from '../../../util'
|
|
16
|
+
|
|
17
|
+
const globalData = inject('globalData') as any
|
|
18
|
+
|
|
19
|
+
const props = defineProps<{
|
|
20
|
+
modelValue?: Array<string> | string | null
|
|
21
|
+
field?: string
|
|
22
|
+
desc: { [key: string]: any }
|
|
23
|
+
formData?: { [key: string]: any }
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
const emits = defineEmits(['update:modelValue'])
|
|
28
|
+
const currentValue = ref(Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue])
|
|
29
|
+
emits('update:modelValue', currentValue)
|
|
30
|
+
|
|
31
|
+
const attrs = ref({} as any)
|
|
32
|
+
const isInit = ref(false)
|
|
33
|
+
const onEvents = ref(getEvents(props))
|
|
34
|
+
const options = reactive([] as any[])
|
|
35
|
+
|
|
36
|
+
onBeforeMount(async () => {
|
|
37
|
+
attrs.value = await getAttrs(props, {
|
|
38
|
+
props: { value: 'value', label: 'label', children: 'children' },
|
|
39
|
+
fetchSuggestions(s: any, cb: Function) {
|
|
40
|
+
const res: any[] = []
|
|
41
|
+
cb(res)
|
|
42
|
+
},
|
|
43
|
+
...useAttrs()
|
|
44
|
+
})
|
|
45
|
+
isInit.value = true
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
//监听options数据
|
|
49
|
+
watch(
|
|
50
|
+
() => props.desc.options,
|
|
51
|
+
async (data) => {
|
|
52
|
+
if (typeof data === 'string') {
|
|
53
|
+
options.splice(0, options.length, ...(globalData[data] || []))
|
|
54
|
+
} else if (typeof data === 'function') {
|
|
55
|
+
options.splice(0, options.length, ...(await data(props.formData || {})))
|
|
56
|
+
} else if (Array.isArray(data)) {
|
|
57
|
+
if (data && options && !isEqual(data, options)) {
|
|
58
|
+
options.splice(0, options.length, ...data)
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
options.splice(0, options.length)
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{ immediate: true }
|
|
65
|
+
)
|
|
66
|
+
</script>
|
|
67
|
+
<style lang="scss" scoped>
|
|
68
|
+
.ElPlusFormCascaderPanel-panel {
|
|
69
|
+
display: flex;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
72
|
+
../util/aaaaa
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-checkbox-group v-if="isInit" class="ElPlusFormCheckbox-panel" v-bind="attrs" :disabled="disabled" v-on="onEvents" v-model="currentValue">
|
|
3
|
-
<el-checkbox v-for="option of options" :key="option.value" :label="option.value" v-bind="option.attrs">
|
|
4
|
-
{{ option.text || option.label }}
|
|
5
|
-
</el-checkbox>
|
|
6
|
-
</el-checkbox-group>
|
|
7
|
-
</template>
|
|
8
|
-
<script lang="ts">
|
|
9
|
-
export default {
|
|
10
|
-
name: 'ElPlusFormCheckbox',
|
|
11
|
-
inheritAttrs: false,
|
|
12
|
-
typeName: 'checkbox',
|
|
13
|
-
customOptions: {}
|
|
14
|
-
}
|
|
15
|
-
</script>
|
|
16
|
-
<script lang="ts" setup>
|
|
17
|
-
import { ref, reactive, watch, useAttrs, onBeforeMount, inject } from 'vue'
|
|
18
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
19
|
-
import { isEqual } from '../../../util'
|
|
20
|
-
|
|
21
|
-
const globalData = inject('globalData') as any
|
|
22
|
-
|
|
23
|
-
const props = defineProps<{
|
|
24
|
-
modelValue?: Array<string | number> | string | number | null
|
|
25
|
-
field?: string
|
|
26
|
-
desc: { [key: string]: any }
|
|
27
|
-
formData?: { [key: string]: any }
|
|
28
|
-
disabled?: boolean
|
|
29
|
-
}>()
|
|
30
|
-
|
|
31
|
-
const emits = defineEmits(['update:modelValue'])
|
|
32
|
-
const currentValue = ref([] as any)
|
|
33
|
-
emits('update:modelValue', currentValue)
|
|
34
|
-
|
|
35
|
-
const options = reactive([] as any[])
|
|
36
|
-
const isInit = ref(false)
|
|
37
|
-
const attrs = ref({} as any)
|
|
38
|
-
const onEvents = ref(getEvents(props))
|
|
39
|
-
|
|
40
|
-
onBeforeMount(async () => {
|
|
41
|
-
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
42
|
-
isInit.value = true
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
watch(
|
|
46
|
-
() => props.desc.options,
|
|
47
|
-
async (data) => {
|
|
48
|
-
if (typeof data === 'string') {
|
|
49
|
-
// 从全局数据中获取options
|
|
50
|
-
options.splice(0, options.length, ...(globalData[data] || []))
|
|
51
|
-
} else if (typeof data === 'function') {
|
|
52
|
-
options.splice(0, options.length, ...(await data(props.formData || {})))
|
|
53
|
-
} else if (Array.isArray(data)) {
|
|
54
|
-
if (data && options && !isEqual(data, options)) {
|
|
55
|
-
options.splice(0, options.length, ...data)
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
options.splice(0, options.length)
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{ immediate: true }
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
watch(
|
|
65
|
-
() => props.modelValue,
|
|
66
|
-
(data: Array<string | number> | string | number | null | undefined) => {
|
|
67
|
-
if (data) {
|
|
68
|
-
currentValue.value = Array.isArray(data) ? data : [data]
|
|
69
|
-
} else {
|
|
70
|
-
currentValue.value = []
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{ immediate: true }
|
|
74
|
-
)
|
|
75
|
-
</script>
|
|
76
|
-
<style lang="scss" scoped>
|
|
77
|
-
.ElPlusFormCheckbox-panel {
|
|
78
|
-
display: flex;
|
|
79
|
-
}
|
|
80
|
-
</style>
|
|
81
|
-
../util/aaaaa
|
|
1
|
+
<template>
|
|
2
|
+
<el-checkbox-group v-if="isInit" class="ElPlusFormCheckbox-panel" v-bind="attrs" :disabled="disabled" v-on="onEvents" v-model="currentValue">
|
|
3
|
+
<el-checkbox v-for="option of options" :key="option.value" :label="option.value" v-bind="option.attrs">
|
|
4
|
+
{{ option.text || option.label }}
|
|
5
|
+
</el-checkbox>
|
|
6
|
+
</el-checkbox-group>
|
|
7
|
+
</template>
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export default {
|
|
10
|
+
name: 'ElPlusFormCheckbox',
|
|
11
|
+
inheritAttrs: false,
|
|
12
|
+
typeName: 'checkbox',
|
|
13
|
+
customOptions: {}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import { ref, reactive, watch, useAttrs, onBeforeMount, inject } from 'vue'
|
|
18
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
19
|
+
import { isEqual } from '../../../util'
|
|
20
|
+
|
|
21
|
+
const globalData = inject('globalData') as any
|
|
22
|
+
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
modelValue?: Array<string | number> | string | number | null
|
|
25
|
+
field?: string
|
|
26
|
+
desc: { [key: string]: any }
|
|
27
|
+
formData?: { [key: string]: any }
|
|
28
|
+
disabled?: boolean
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const emits = defineEmits(['update:modelValue'])
|
|
32
|
+
const currentValue = ref([] as any)
|
|
33
|
+
emits('update:modelValue', currentValue)
|
|
34
|
+
|
|
35
|
+
const options = reactive([] as any[])
|
|
36
|
+
const isInit = ref(false)
|
|
37
|
+
const attrs = ref({} as any)
|
|
38
|
+
const onEvents = ref(getEvents(props))
|
|
39
|
+
|
|
40
|
+
onBeforeMount(async () => {
|
|
41
|
+
attrs.value = await getAttrs(props, { ...useAttrs() })
|
|
42
|
+
isInit.value = true
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
watch(
|
|
46
|
+
() => props.desc.options,
|
|
47
|
+
async (data) => {
|
|
48
|
+
if (typeof data === 'string') {
|
|
49
|
+
// 从全局数据中获取options
|
|
50
|
+
options.splice(0, options.length, ...(globalData[data] || []))
|
|
51
|
+
} else if (typeof data === 'function') {
|
|
52
|
+
options.splice(0, options.length, ...(await data(props.formData || {})))
|
|
53
|
+
} else if (Array.isArray(data)) {
|
|
54
|
+
if (data && options && !isEqual(data, options)) {
|
|
55
|
+
options.splice(0, options.length, ...data)
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
options.splice(0, options.length)
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{ immediate: true }
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
watch(
|
|
65
|
+
() => props.modelValue,
|
|
66
|
+
(data: Array<string | number> | string | number | null | undefined) => {
|
|
67
|
+
if (data) {
|
|
68
|
+
currentValue.value = Array.isArray(data) ? data : [data]
|
|
69
|
+
} else {
|
|
70
|
+
currentValue.value = []
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{ immediate: true }
|
|
74
|
+
)
|
|
75
|
+
</script>
|
|
76
|
+
<style lang="scss" scoped>
|
|
77
|
+
.ElPlusFormCheckbox-panel {
|
|
78
|
+
display: flex;
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
81
|
+
../util/aaaaa
|
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ele-form-image">
|
|
3
|
-
<template v-if="imagList && imagList.length > 0">
|
|
4
|
-
<template v-for="(image, i) in imagList" :key="image + i">
|
|
5
|
-
<el-image :class="desc.class" :src="image" :preview-src-list="attrs.isShowPreview === false ? null : imagList" :initial-index="i" v-bind="attrs" :style="styles" v-on="onEvents" :fit="attrs.fit || 'cover'" />
|
|
6
|
-
</template>
|
|
7
|
-
</template>
|
|
8
|
-
<div v-else>
|
|
9
|
-
<span class="no-img-tip">-</span>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
export default {
|
|
15
|
-
name: 'ElPlusFormImage',
|
|
16
|
-
inheritAttrs: false,
|
|
17
|
-
typeName: 'image',
|
|
18
|
-
customOptions: {}
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
<script lang="ts" setup>
|
|
22
|
-
import { ref, computed, useAttrs, onBeforeMount } from 'vue'
|
|
23
|
-
import { getAttrs, getEvents } from '../mixins'
|
|
24
|
-
|
|
25
|
-
const props = defineProps<{
|
|
26
|
-
modelValue?: Array<any> | string | null
|
|
27
|
-
field?: string
|
|
28
|
-
loading?: boolean
|
|
29
|
-
desc: { [key: string]: any }
|
|
30
|
-
formData?: { [key: string]: any }
|
|
31
|
-
}>()
|
|
32
|
-
|
|
33
|
-
const attrs = ref({} as any)
|
|
34
|
-
const onEvents = ref(getEvents(props))
|
|
35
|
-
|
|
36
|
-
onBeforeMount(async () => {
|
|
37
|
-
attrs.value = await getAttrs(props, { isShowPreview: true, previewTeleported: true, ...useAttrs() })
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const imagList = computed(() => {
|
|
41
|
-
if (!props.modelValue) {
|
|
42
|
-
return []
|
|
43
|
-
}
|
|
44
|
-
if (Array.isArray(props.modelValue)) {
|
|
45
|
-
if (typeof props.modelValue[0] === 'string') {
|
|
46
|
-
return props.modelValue
|
|
47
|
-
} else {
|
|
48
|
-
return props.modelValue.map((item) => item.shareUrl || item.furl)
|
|
49
|
-
}
|
|
50
|
-
} else if (typeof props.modelValue === 'string') {
|
|
51
|
-
return props.modelValue.split(',')
|
|
52
|
-
} else {
|
|
53
|
-
// console.log('unknown image Type.....')
|
|
54
|
-
}
|
|
55
|
-
return []
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 格式化样式
|
|
60
|
-
* large,default,small
|
|
61
|
-
*/
|
|
62
|
-
const styles = computed(() => {
|
|
63
|
-
let width = ''
|
|
64
|
-
let height = ''
|
|
65
|
-
let size = props.desc.size || 'default'
|
|
66
|
-
switch (size) {
|
|
67
|
-
case 'large':
|
|
68
|
-
width = '44px'
|
|
69
|
-
height = '44px'
|
|
70
|
-
break
|
|
71
|
-
case 'default':
|
|
72
|
-
width = '36px'
|
|
73
|
-
height = '36px'
|
|
74
|
-
break
|
|
75
|
-
case 'small':
|
|
76
|
-
width = '28px'
|
|
77
|
-
height = '28px'
|
|
78
|
-
break
|
|
79
|
-
default:
|
|
80
|
-
width = parseInt(size) + 'px'
|
|
81
|
-
height = parseInt(size) + 'px'
|
|
82
|
-
break
|
|
83
|
-
}
|
|
84
|
-
return Object.assign({}, props.desc.style, { width, height, 'max-width': width })
|
|
85
|
-
})
|
|
86
|
-
</script>
|
|
87
|
-
<style lang="scss">
|
|
88
|
-
.ele-form-image {
|
|
89
|
-
display: flex;
|
|
90
|
-
// justify-content: center;
|
|
91
|
-
flex-wrap: wrap;
|
|
92
|
-
margin-bottom: 10px;
|
|
93
|
-
|
|
94
|
-
.no-img-tip {
|
|
95
|
-
color: #999999;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.el-image {
|
|
99
|
-
margin: 5px !important;
|
|
100
|
-
}
|
|
101
|
-
.el-image:first-child {
|
|
102
|
-
margin-left: 0px !important;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.ele-form-image .el-image {
|
|
107
|
-
border-radius: 5px;
|
|
108
|
-
margin-bottom: 10px;
|
|
109
|
-
|
|
110
|
-
.el-image__error {
|
|
111
|
-
font-size: 12px;
|
|
112
|
-
line-height: 13px;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ele-form-image">
|
|
3
|
+
<template v-if="imagList && imagList.length > 0">
|
|
4
|
+
<template v-for="(image, i) in imagList" :key="image + i">
|
|
5
|
+
<el-image :class="desc.class" :src="image" :preview-src-list="attrs.isShowPreview === false ? null : imagList" :initial-index="i" v-bind="attrs" :style="styles" v-on="onEvents" :fit="attrs.fit || 'cover'" />
|
|
6
|
+
</template>
|
|
7
|
+
</template>
|
|
8
|
+
<div v-else>
|
|
9
|
+
<span class="no-img-tip">-</span>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
export default {
|
|
15
|
+
name: 'ElPlusFormImage',
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
typeName: 'image',
|
|
18
|
+
customOptions: {}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
<script lang="ts" setup>
|
|
22
|
+
import { ref, computed, useAttrs, onBeforeMount } from 'vue'
|
|
23
|
+
import { getAttrs, getEvents } from '../mixins'
|
|
24
|
+
|
|
25
|
+
const props = defineProps<{
|
|
26
|
+
modelValue?: Array<any> | string | null
|
|
27
|
+
field?: string
|
|
28
|
+
loading?: boolean
|
|
29
|
+
desc: { [key: string]: any }
|
|
30
|
+
formData?: { [key: string]: any }
|
|
31
|
+
}>()
|
|
32
|
+
|
|
33
|
+
const attrs = ref({} as any)
|
|
34
|
+
const onEvents = ref(getEvents(props))
|
|
35
|
+
|
|
36
|
+
onBeforeMount(async () => {
|
|
37
|
+
attrs.value = await getAttrs(props, { isShowPreview: true, previewTeleported: true, ...useAttrs() })
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const imagList = computed(() => {
|
|
41
|
+
if (!props.modelValue) {
|
|
42
|
+
return []
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(props.modelValue)) {
|
|
45
|
+
if (typeof props.modelValue[0] === 'string') {
|
|
46
|
+
return props.modelValue
|
|
47
|
+
} else {
|
|
48
|
+
return props.modelValue.map((item) => item.shareUrl || item.furl)
|
|
49
|
+
}
|
|
50
|
+
} else if (typeof props.modelValue === 'string') {
|
|
51
|
+
return props.modelValue.split(',')
|
|
52
|
+
} else {
|
|
53
|
+
// console.log('unknown image Type.....')
|
|
54
|
+
}
|
|
55
|
+
return []
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 格式化样式
|
|
60
|
+
* large,default,small
|
|
61
|
+
*/
|
|
62
|
+
const styles = computed(() => {
|
|
63
|
+
let width = ''
|
|
64
|
+
let height = ''
|
|
65
|
+
let size = props.desc.size || 'default'
|
|
66
|
+
switch (size) {
|
|
67
|
+
case 'large':
|
|
68
|
+
width = '44px'
|
|
69
|
+
height = '44px'
|
|
70
|
+
break
|
|
71
|
+
case 'default':
|
|
72
|
+
width = '36px'
|
|
73
|
+
height = '36px'
|
|
74
|
+
break
|
|
75
|
+
case 'small':
|
|
76
|
+
width = '28px'
|
|
77
|
+
height = '28px'
|
|
78
|
+
break
|
|
79
|
+
default:
|
|
80
|
+
width = parseInt(size) + 'px'
|
|
81
|
+
height = parseInt(size) + 'px'
|
|
82
|
+
break
|
|
83
|
+
}
|
|
84
|
+
return Object.assign({}, props.desc.style, { width, height, 'max-width': width })
|
|
85
|
+
})
|
|
86
|
+
</script>
|
|
87
|
+
<style lang="scss">
|
|
88
|
+
.ele-form-image {
|
|
89
|
+
display: flex;
|
|
90
|
+
// justify-content: center;
|
|
91
|
+
flex-wrap: wrap;
|
|
92
|
+
margin-bottom: 10px;
|
|
93
|
+
|
|
94
|
+
.no-img-tip {
|
|
95
|
+
color: #999999;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.el-image {
|
|
99
|
+
margin: 5px !important;
|
|
100
|
+
}
|
|
101
|
+
.el-image:first-child {
|
|
102
|
+
margin-left: 0px !important;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ele-form-image .el-image {
|
|
107
|
+
border-radius: 5px;
|
|
108
|
+
margin-bottom: 10px;
|
|
109
|
+
|
|
110
|
+
.el-image__error {
|
|
111
|
+
font-size: 12px;
|
|
112
|
+
line-height: 13px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
</style>
|