el-plus-crud 0.0.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 (86) hide show
  1. package/.eslintignore +18 -0
  2. package/.eslintrc.js +78 -0
  3. package/.lintstagedrc +3 -0
  4. package/.prettierrc.js +39 -0
  5. package/CHANGELOG.md +5 -0
  6. package/LICENSE +21 -0
  7. package/README.md +15 -0
  8. package/example/App.vue +79 -0
  9. package/example/assets/vue.svg +1 -0
  10. package/example/main.js +18 -0
  11. package/example/style.css +5 -0
  12. package/index.html +13 -0
  13. package/lib/components/el-plus-form/ElPlusForm.vue +744 -0
  14. package/lib/components/el-plus-form/ElPlusFormDialog.vue +107 -0
  15. package/lib/components/el-plus-form/components/ElPlusFormAutocomplete.vue +49 -0
  16. package/lib/components/el-plus-form/components/ElPlusFormBtn.vue +96 -0
  17. package/lib/components/el-plus-form/components/ElPlusFormBtns.vue +133 -0
  18. package/lib/components/el-plus-form/components/ElPlusFormCascader.vue +38 -0
  19. package/lib/components/el-plus-form/components/ElPlusFormCascaderPanel.vue +51 -0
  20. package/lib/components/el-plus-form/components/ElPlusFormCheckbox.vue +42 -0
  21. package/lib/components/el-plus-form/components/ElPlusFormCheckboxButton.vue +42 -0
  22. package/lib/components/el-plus-form/components/ElPlusFormColor.vue +38 -0
  23. package/lib/components/el-plus-form/components/ElPlusFormDate.vue +37 -0
  24. package/lib/components/el-plus-form/components/ElPlusFormDaterange.vue +44 -0
  25. package/lib/components/el-plus-form/components/ElPlusFormDatetime.vue +38 -0
  26. package/lib/components/el-plus-form/components/ElPlusFormFile.vue +47 -0
  27. package/lib/components/el-plus-form/components/ElPlusFormImage.vue +113 -0
  28. package/lib/components/el-plus-form/components/ElPlusFormInput.vue +56 -0
  29. package/lib/components/el-plus-form/components/ElPlusFormLink.vue +271 -0
  30. package/lib/components/el-plus-form/components/ElPlusFormNbinput.vue +51 -0
  31. package/lib/components/el-plus-form/components/ElPlusFormNumber.vue +107 -0
  32. package/lib/components/el-plus-form/components/ElPlusFormPassword.vue +39 -0
  33. package/lib/components/el-plus-form/components/ElPlusFormRadio.vue +42 -0
  34. package/lib/components/el-plus-form/components/ElPlusFormRate.vue +38 -0
  35. package/lib/components/el-plus-form/components/ElPlusFormSelect.vue +149 -0
  36. package/lib/components/el-plus-form/components/ElPlusFormSlider.vue +38 -0
  37. package/lib/components/el-plus-form/components/ElPlusFormStatus.vue +67 -0
  38. package/lib/components/el-plus-form/components/ElPlusFormSwitch.vue +38 -0
  39. package/lib/components/el-plus-form/components/ElPlusFormTag.vue +78 -0
  40. package/lib/components/el-plus-form/components/ElPlusFormText.vue +115 -0
  41. package/lib/components/el-plus-form/components/ElPlusFormTextarea.vue +45 -0
  42. package/lib/components/el-plus-form/components/ElPlusFormTransfer.vue +44 -0
  43. package/lib/components/el-plus-form/components/ElPlusFormTree.vue +53 -0
  44. package/lib/components/el-plus-form/components/ElPlusFormTreeSelect.vue +36 -0
  45. package/lib/components/el-plus-form/components/components/IconSelectorList.vue +92 -0
  46. package/lib/components/el-plus-form/components/components/file-icons/FileIcons.vue +135 -0
  47. package/lib/components/el-plus-form/components/components/file-icons/data/index.ts +27 -0
  48. package/lib/components/el-plus-form/components/components/file-icons/images/doc.svg +13 -0
  49. package/lib/components/el-plus-form/components/components/file-icons/images/file.svg +19 -0
  50. package/lib/components/el-plus-form/components/components/file-icons/images/jpg.svg +14 -0
  51. package/lib/components/el-plus-form/components/components/file-icons/images/pdf.svg +13 -0
  52. package/lib/components/el-plus-form/components/components/file-icons/images/png.svg +13 -0
  53. package/lib/components/el-plus-form/components/components/file-icons/images/ppt.svg +13 -0
  54. package/lib/components/el-plus-form/components/components/file-icons/images/xls.svg +13 -0
  55. package/lib/components/el-plus-form/components/index.ts +17 -0
  56. package/lib/components/el-plus-form/data/file.ts +74 -0
  57. package/lib/components/el-plus-form/images/icon/excel.png +0 -0
  58. package/lib/components/el-plus-form/images/icon/file.png +0 -0
  59. package/lib/components/el-plus-form/images/icon/pdf.png +0 -0
  60. package/lib/components/el-plus-form/images/icon/ppt.png +0 -0
  61. package/lib/components/el-plus-form/images/icon/txt.png +0 -0
  62. package/lib/components/el-plus-form/images/icon/word.png +0 -0
  63. package/lib/components/el-plus-form/images/icon/zip.png +0 -0
  64. package/lib/components/el-plus-form/mixins/index.ts +113 -0
  65. package/lib/components/el-plus-form/util/index.ts +266 -0
  66. package/lib/components/el-plus-form/util/validate.ts +310 -0
  67. package/lib/components/el-plus-table/ElPlusTable.vue +723 -0
  68. package/lib/components/el-plus-table/components/columnItem.vue +185 -0
  69. package/lib/components/el-plus-table/components/header.vue +185 -0
  70. package/lib/components/el-plus-table/components/settingColumn.vue +168 -0
  71. package/lib/components/el-plus-table/components/statisticInfo.vue +47 -0
  72. package/lib/components/el-plus-table/util/index.ts +123 -0
  73. package/lib/config/form.ts +12 -0
  74. package/lib/config/index.ts +9 -0
  75. package/lib/index.ts +29 -0
  76. package/package.json +65 -0
  77. package/public/vite.svg +1 -0
  78. package/tsconfig.json +68 -0
  79. package/types/axios.d.ts +13 -0
  80. package/types/formList.d.ts +365 -0
  81. package/types/global.d.ts +145 -0
  82. package/types/layout.d.ts +57 -0
  83. package/types/mitt.d.ts +38 -0
  84. package/types/pinia.d.ts +149 -0
  85. package/types/views.d.ts +329 -0
  86. package/vite.config.ts +68 -0
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <el-dialog class="el-plus-form-dialog" v-model="currentShow" :title="props.title" v-bind="dialogAttrs" destroy-on-close>
3
+ <!-- title 插槽 -->
4
+ <template #header>
5
+ <slot name="header" />
6
+ </template>
7
+ <ElPlusForm ref="refElPlusDialogForm" style="padding: 20px" :isDialog="true" v-model="currentValue" v-bind="attrs" :success="dialogSuccess" @cancel="close">
8
+ <template #top>
9
+ <slot name="top" />
10
+ </template>
11
+ <template #default>
12
+ <slot name="default" />
13
+ </template>
14
+ </ElPlusForm>
15
+ </el-dialog>
16
+ </template>
17
+ <script lang="ts">
18
+ export default {
19
+ name: 'ElPlusFormDialog',
20
+ inheritAttrs: false,
21
+ customOptions: {}
22
+ }
23
+ </script>
24
+ <script lang="ts" setup>
25
+ import { ref, computed, useAttrs, nextTick } from 'vue'
26
+ import ElPlusForm from './ElPlusForm.vue'
27
+ import { ElMessage } from 'element-plus'
28
+
29
+ const emits = defineEmits(['update:show', 'update:modelValue'])
30
+ const props = withDefaults(defineProps<{ modelValue?: { [key: string]: any } | {}; show?: boolean; title?: string; tableRef?: any; success?: Function; successTip?: string }>(), {
31
+ title: '',
32
+ modelValue: () => {
33
+ return {}
34
+ },
35
+ show: false,
36
+ successTip: '操作成功!'
37
+ })
38
+
39
+ // 重新定义当前值
40
+ const currentValue = computed({
41
+ get: () => props.modelValue,
42
+ set(val: any) {
43
+ emits('update:modelValue', val)
44
+ }
45
+ })
46
+
47
+ // 是否显示弹框
48
+ const currentShow = computed({
49
+ get() {
50
+ // 打开时,清空一下校验
51
+ if (props.show) {
52
+ nextTick(() => {
53
+ setTimeout(() => {
54
+ refElPlusDialogForm.value?.clearValid()
55
+ }, 10)
56
+ })
57
+ }
58
+ return props.show
59
+ },
60
+ set(val: boolean) {
61
+ val ? open() : close()
62
+ }
63
+ })
64
+ const refElPlusDialogForm = ref(null as any)
65
+
66
+ // 合并属性
67
+ const { width, top, modal, appendToBody, showClose, draggable, closeOnClickModal, ...attrs } = Object.assign({ width: '700px', draggable: true, top: '15vh', closeOnClickModal: false, showCancel: true }, useAttrs())
68
+ // 弹框属性
69
+ const dialogAttrs = { width, top, modal, appendToBody, showClose, draggable, closeOnClickModal }
70
+
71
+ /**
72
+ * 这里重新定义一下成功事件
73
+ * @param formBack
74
+ */
75
+ function dialogSuccess(formBack: IFormBack) {
76
+ if (props.success) {
77
+ props.success(formBack)
78
+ } else {
79
+ if (props.tableRef) {
80
+ ElMessage.success(props.successTip)
81
+ props.tableRef.reload()
82
+ close()
83
+ setTimeout(() => {
84
+ formBack.callback()
85
+ }, 200)
86
+ }
87
+ }
88
+ }
89
+
90
+ /**
91
+ * 打开弹框
92
+ */
93
+ function open() {
94
+ emits('update:show', true)
95
+ }
96
+
97
+ /**
98
+ * 关闭弹框
99
+ */
100
+ function close() {
101
+ emits('update:show', false)
102
+ // 这里清空一下表单
103
+ refElPlusDialogForm.value?.clear()
104
+ }
105
+
106
+ defineExpose({ open, close })
107
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <el-autocomplete class="ElPlusFormAutocomplete-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue">
3
+ <!-- 作用域插槽 -->
4
+ <template #default="data">
5
+ <slot :data="data" />
6
+ </template>
7
+
8
+ <!-- 非作用域插槽 -->
9
+ <template v-for="(item, key, index) in slots" #[key]="data" :key="index">
10
+ <slot :name="key" :data="data" />
11
+ </template>
12
+ </el-autocomplete>
13
+ </template>
14
+ <script lang="ts">
15
+ export default {
16
+ name: 'ElPlusFormAutocomplete',
17
+ inheritAttrs: false,
18
+ typeName: 'autocomplete',
19
+ customOptions: {}
20
+ }
21
+ </script>
22
+ <script lang="ts" setup>
23
+ import { ref, useAttrs, useSlots, onBeforeMount } from 'vue'
24
+ import { getAttrs, getEvents } from '../mixins'
25
+
26
+ const props = defineProps<{
27
+ modelValue?: string | number | '' | null
28
+ field: string
29
+ desc: { [key: string]: any }
30
+ formData: { [key: string]: any }
31
+ }>()
32
+
33
+ const emits = defineEmits(['update:modelValue'])
34
+ const currentValue = ref(props.modelValue)
35
+ emits('update:modelValue', currentValue)
36
+
37
+ const slots = ref(Object.assign({}, useSlots(), props.desc.slots))
38
+ const attrs = ref({} as any)
39
+ const onEvents = ref(getEvents(props))
40
+
41
+ onBeforeMount(async () => {
42
+ attrs.value = await getAttrs(props, { autocomplete: 'new-password', ...useAttrs() })
43
+ })
44
+ </script>
45
+ <style lang="scss" scoped>
46
+ .ElPlusFormAutocomplete-panel {
47
+ display: flex;
48
+ }
49
+ </style>
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <template v-if="props.desc.confirm">
3
+ <el-popconfirm @confirm="onEvents.click" :title="props.desc.confirm">
4
+ <template #reference>
5
+ <el-button :loading="localLoading" :size="props.desc.size || 'small'" v-bind="attrs">
6
+ <template #default v-if="!!desc.label">
7
+ {{ btnShowText }}
8
+ </template>
9
+ </el-button>
10
+ </template>
11
+ </el-popconfirm>
12
+ </template>
13
+
14
+ <el-button v-else :loading="localLoading" :size="props.desc.size || 'small'" v-bind="attrs" v-on="onEvents" :style="{ pointerEvents: desc.isTag ? 'none' : 'all' }">
15
+ <template #default v-if="!!props.desc.label">
16
+ {{ btnShowText }}
17
+ </template>
18
+ </el-button>
19
+ </template>
20
+ <script lang="ts">
21
+ export default {
22
+ name: 'ElPlusFormBtn',
23
+ inheritAttrs: false,
24
+ typeName: 'btn',
25
+ customOptions: {}
26
+ }
27
+ </script>
28
+ <script lang="ts" setup>
29
+ import { ref, computed, useAttrs, watch } from 'vue'
30
+ import { cloneDeep } from 'lodash'
31
+
32
+ const props = defineProps<{
33
+ field?: string
34
+ rowIndex?: number
35
+ loading?: boolean
36
+ desc: { [key: string]: any }
37
+ formData?: { [key: string]: any }
38
+ }>()
39
+
40
+ const localLoading = ref(props.loading ?? false)
41
+
42
+ const attrs = computed(() => {
43
+ const attrs = Object.assign({}, useAttrs(), props.desc, props.desc?._attrs)
44
+ if (attrs.btnType) {
45
+ attrs.type = attrs.btnType
46
+ }
47
+ if (!attrs.plain) {
48
+ delete attrs.plain
49
+ }
50
+ return attrs
51
+ })
52
+
53
+ const onEvents = computed(() => {
54
+ const events = {} as any
55
+ if (props.desc && props.desc.on) {
56
+ for (const key in props.desc.on) {
57
+ if (key === 'click' && props.desc.mask) {
58
+ events[key] = function () {
59
+ localLoading.value = true
60
+ props.desc.on[key]({
61
+ row: props.formData,
62
+ callBack: () => {
63
+ setTimeout(() => (localLoading.value = false), 500)
64
+ },
65
+ field: props.field,
66
+ rowIndex: props.rowIndex
67
+ } as IBtnBack)
68
+ }
69
+ } else {
70
+ events[key] = function () {
71
+ props.desc.on[key]({ row: cloneDeep(props.formData || {}), field: props.field, rowIndex: props.rowIndex } as IBtnBack)
72
+ }
73
+ }
74
+ }
75
+ }
76
+ return events
77
+ })
78
+
79
+ const btnShowText = computed(() => {
80
+ if (props.desc.label) {
81
+ if (typeof props.desc.label === 'function') {
82
+ return props.desc.label(props.formData)
83
+ }
84
+ return props.desc.label
85
+ }
86
+ return ''
87
+ })
88
+
89
+ watch(
90
+ () => props.loading,
91
+ (val) => {
92
+ localLoading.value = val
93
+ }
94
+ )
95
+ </script>
96
+ <style lang="scss" scoped></style>
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <div class="el-plus-form-btn-group" :style="{ 'justify-content': getAlignItems }">
3
+ <template v-for="(item, i) in localBtnList" :key="i + (item.label || item.title || '')">
4
+ <ElPlusFormBtn type="primary" :field="field" :desc="item || {}" :formData="formData" :plain="(item && item.plain) ?? desc.plain ?? true" :text="desc.text" :rowIndex="rowIndex" />
5
+ </template>
6
+ <template v-if="limitList && limitList.length > 0">
7
+ <el-dropdown class="group-menu-btn" :size="desc.size || 'small'">
8
+ <el-button type="primary" :size="desc.size || 'small'" :plain="desc.plain ?? true"> 更多<i class="ele-ArrowDown el-icon--right" /> </el-button>
9
+ <template #dropdown>
10
+ <el-dropdown-menu>
11
+ <el-dropdown-item v-for="(item, i) in limitList" :key="i + (item.label || item.title)" v-on="handelEvelt(item)">
12
+ {{ item.label || item.title }}
13
+ </el-dropdown-item>
14
+ </el-dropdown-menu>
15
+ </template>
16
+ </el-dropdown>
17
+ </template>
18
+ </div>
19
+ </template>
20
+ <script lang="ts">
21
+ export default {
22
+ name: 'ElPlusFormBtns',
23
+ inheritAttrs: false,
24
+ typeName: 'btns',
25
+ customOptions: {}
26
+ }
27
+ </script>
28
+ <script lang="ts" setup>
29
+ import { ref, computed, watch, onMounted } from 'vue'
30
+ import ElPlusFormBtn from './ElPlusFormBtn.vue'
31
+ import { ElMessageBox } from 'element-plus'
32
+
33
+ const props = defineProps<{
34
+ field: string
35
+ rowIndex?: number
36
+ desc: { [key: string]: any }
37
+ formData: { [key: string]: any }
38
+ }>()
39
+
40
+ const localBtnList = ref([] as any[])
41
+ const limitList = ref([] as any[])
42
+
43
+ const getAlignItems = computed(() => {
44
+ switch (props.desc.align) {
45
+ case 'right':
46
+ return 'flex-end'
47
+ case 'center':
48
+ return 'center'
49
+ case undefined:
50
+ case 'left':
51
+ return 'flex-start'
52
+ default:
53
+ return 'flex-start'
54
+ }
55
+ })
56
+
57
+ const handelEvelt = computed(() => {
58
+ return (item: any) => {
59
+ const events = {} as any
60
+ if (item && item.on) {
61
+ for (const key in item.on) {
62
+ if (key === 'click' && item.confirm) {
63
+ events[key] = function () {
64
+ ElMessageBox.confirm(item.confirm, '提示', {
65
+ type: 'warning'
66
+ }).then(() => {
67
+ item.on[key]({ row: props.formData, field: props.field, rowIndex: props.rowIndex } as IBtnBack)
68
+ })
69
+ }
70
+ } else {
71
+ events[key] = function () {
72
+ item.on[key]({ row: props.formData, field: props.field, rowIndex: props.rowIndex } as IBtnBack)
73
+ }
74
+ }
75
+ }
76
+ }
77
+ return events
78
+ }
79
+ })
80
+
81
+ // 初始化
82
+ const initBtnList = () => {
83
+ const tempList = [] as any[]
84
+ if (props.desc.btns.length > 0) {
85
+ props.desc.btns.map((item: any) => {
86
+ if (handelItemVIf(item)) {
87
+ tempList.push(item)
88
+ }
89
+ })
90
+ }
91
+ localBtnList.value = tempList
92
+ const limit = props.desc.limit || 3
93
+ if (localBtnList.value.length > limit) {
94
+ limitList.value = localBtnList.value.splice(limit - 1)
95
+ }
96
+ }
97
+ // 执行一次vif的处理
98
+ const handelItemVIf = (formItem: any): Boolean => {
99
+ if (typeof formItem.vif === 'function') {
100
+ return Boolean(runFnGetData(formItem.vif))
101
+ } else if (typeof formItem.vif === 'boolean') {
102
+ return formItem.vif
103
+ }
104
+ return true
105
+ }
106
+ // 执行函数,获取相关数据
107
+ const runFnGetData = (fn: Function) => {
108
+ return fn(props.formData)
109
+ }
110
+
111
+ watch(
112
+ () => props.desc,
113
+ () => initBtnList()
114
+ )
115
+ watch(
116
+ () => props.formData,
117
+ () => initBtnList()
118
+ )
119
+
120
+ onMounted(() => {
121
+ initBtnList()
122
+ })
123
+ </script>
124
+
125
+ <style lang="scss">
126
+ .el-plus-form-btn-group {
127
+ display: flex;
128
+
129
+ .group-menu-btn {
130
+ margin-left: 10px;
131
+ }
132
+ }
133
+ </style>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <el-cascader class="ElPlusFormCascader-panel" v-bind="attrs" v-on="onEvents" :options="props.desc.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 } from 'vue'
14
+ import { getAttrs, getEvents } from '../mixins'
15
+
16
+ const props = defineProps<{
17
+ modelValue?: Array<string> | string | null
18
+ field: string
19
+ desc: { [key: string]: any }
20
+ formData: { [key: string]: any }
21
+ }>()
22
+
23
+ const emits = defineEmits(['update:modelValue'])
24
+ const currentValue = ref(typeof props.modelValue === 'string' ? [props.modelValue] : props.modelValue)
25
+ emits('update:modelValue', currentValue)
26
+
27
+ const attrs = ref({} as any)
28
+ const onEvents = ref(getEvents(props))
29
+
30
+ onBeforeMount(async () => {
31
+ attrs.value = await getAttrs(props, { clearable: true, props: { value: 'value', label: 'label', children: 'children', checkStrictly: !!props.desc.checkStrictly }, ...useAttrs() })
32
+ })
33
+ </script>
34
+ <style lang="scss" scoped>
35
+ .ElPlusFormCascader-panel {
36
+ display: flex;
37
+ }
38
+ </style>
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <el-cascader-panel class="ElPlusFormCascaderPanel-panel" v-bind="attrs" v-on="onEvents" :options="props.desc.options" v-model="currentValue">
3
+ <!-- 非作用域插槽 -->
4
+ <template v-for="(item, key, index) in slots" #[key]="data" :key="index">
5
+ <slot :name="key" :data="data" />
6
+ </template>
7
+ </el-cascader-panel>
8
+ </template>
9
+ <script lang="ts">
10
+ export default {
11
+ name: 'ElPlusFormCascaderPanel',
12
+ inheritAttrs: false,
13
+ typeName: 'cascaderPanel',
14
+ customOptions: {}
15
+ }
16
+ </script>
17
+ <script lang="ts" setup>
18
+ import { ref, useAttrs, useSlots, onBeforeMount } from 'vue'
19
+ import { getAttrs, getEvents } from '../mixins'
20
+
21
+ const props = defineProps<{
22
+ modelValue?: string | number | '' | null
23
+ field: string
24
+ desc: { [key: string]: any }
25
+ formData: { [key: string]: any }
26
+ }>()
27
+
28
+ const emits = defineEmits(['update:modelValue'])
29
+ const currentValue = ref(props.modelValue)
30
+ emits('update:modelValue', currentValue)
31
+
32
+ const slots = ref(Object.assign({}, useSlots(), props.desc.slots))
33
+ const attrs = ref({} as any)
34
+ const onEvents = ref(getEvents(props))
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
+ })
46
+ </script>
47
+ <style lang="scss" scoped>
48
+ .ElPlusFormCascaderPanel-panel {
49
+ display: flex;
50
+ }
51
+ </style>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <el-checkbox-group class="ElPlusFormCheckbox-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue">
3
+ <el-checkbox v-for="option of desc.options" :key="option.value" :label="option.value" v-bind="option.attrs">
4
+ {{ option.text }}
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, useAttrs, onBeforeMount } from 'vue'
18
+ import { getAttrs, getEvents } from '../mixins'
19
+
20
+ const props = defineProps<{
21
+ modelValue?: string | number | '' | null
22
+ field: string
23
+ desc: { [key: string]: any }
24
+ formData: { [key: string]: any }
25
+ }>()
26
+
27
+ const emits = defineEmits(['update:modelValue'])
28
+ const currentValue = ref(props.modelValue)
29
+ emits('update:modelValue', currentValue)
30
+
31
+ const attrs = ref({} as any)
32
+ const onEvents = ref(getEvents(props))
33
+
34
+ onBeforeMount(async () => {
35
+ attrs.value = await getAttrs(props, { ...useAttrs() })
36
+ })
37
+ </script>
38
+ <style lang="scss" scoped>
39
+ .ElPlusFormCheckbox-panel {
40
+ display: flex;
41
+ }
42
+ </style>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <el-checkbox-group class="ElPlusFormCheckboxButton-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue">
3
+ <el-checkbox-button v-for="option of desc.options" :key="option.value" :label="option.value" v-bind="option.attrs">
4
+ {{ option.text }}
5
+ </el-checkbox-button>
6
+ </el-checkbox-group>
7
+ </template>
8
+ <script lang="ts">
9
+ export default {
10
+ name: 'ElPlusFormCheckboxButton',
11
+ inheritAttrs: false,
12
+ typeName: 'checkboxButton',
13
+ customOptions: {}
14
+ }
15
+ </script>
16
+ <script lang="ts" setup>
17
+ import { ref, useAttrs, onBeforeMount } from 'vue'
18
+ import { getAttrs, getEvents } from '../mixins'
19
+
20
+ const props = defineProps<{
21
+ modelValue?: string | number | '' | null
22
+ field: string
23
+ desc: { [key: string]: any }
24
+ formData: { [key: string]: any }
25
+ }>()
26
+
27
+ const emits = defineEmits(['update:modelValue'])
28
+ const currentValue = ref(props.modelValue)
29
+ emits('update:modelValue', currentValue)
30
+
31
+ const attrs = ref({} as any)
32
+ const onEvents = ref(getEvents(props))
33
+
34
+ onBeforeMount(async () => {
35
+ attrs.value = await getAttrs(props, { ...useAttrs() })
36
+ })
37
+ </script>
38
+ <style lang="scss" scoped>
39
+ .ElPlusFormCheckboxButton-panel {
40
+ display: flex;
41
+ }
42
+ </style>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <el-color-picker class="ElPlusFormColor-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue" />
3
+ </template>
4
+ <script lang="ts">
5
+ export default {
6
+ name: 'ElPlusFormColor',
7
+ inheritAttrs: false,
8
+ typeName: 'color',
9
+ customOptions: {}
10
+ }
11
+ </script>
12
+ <script lang="ts" setup>
13
+ import { ref, useAttrs, onBeforeMount } from 'vue'
14
+ import { getAttrs, getEvents } from '../mixins'
15
+
16
+ const props = defineProps<{
17
+ modelValue?: string | number | '' | null
18
+ field: string
19
+ desc: { [key: string]: any }
20
+ formData: { [key: string]: any }
21
+ }>()
22
+
23
+ const emits = defineEmits(['update:modelValue'])
24
+ const currentValue = ref(props.modelValue)
25
+ const attrs = ref({} as any)
26
+ const onEvents = ref(getEvents(props))
27
+ // const { attrs, slots, onEvents } = useMixins({ modelValue: props.modelValue, field: props.field, desc: props.desc, formData: props.formData, useAttrs, useSlots })
28
+ emits('update:modelValue', currentValue)
29
+
30
+ onBeforeMount(async () => {
31
+ attrs.value = await getAttrs(props, { ...useAttrs() })
32
+ })
33
+ </script>
34
+ <style lang="scss" scoped>
35
+ .ElPlusFormColor-panel {
36
+ display: flex;
37
+ }
38
+ </style>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <el-date-picker class="ElPlusFormDate-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue" />
3
+ </template>
4
+ <script lang="ts">
5
+ export default {
6
+ name: 'ElPlusFormDate',
7
+ inheritAttrs: false,
8
+ typeName: 'date',
9
+ customOptions: {}
10
+ }
11
+ </script>
12
+ <script lang="ts" setup>
13
+ import { ref, useAttrs, onBeforeMount } from 'vue'
14
+ import { getAttrs, getEvents } from '../mixins'
15
+
16
+ const props = defineProps<{
17
+ modelValue?: string | number | '' | null
18
+ field: string
19
+ desc: { [key: string]: any }
20
+ formData: { [key: string]: any }
21
+ }>()
22
+
23
+ const emits = defineEmits(['update:modelValue'])
24
+ const attrs = ref({} as any)
25
+ const onEvents = ref(getEvents(props))
26
+ const currentValue = ref(props.modelValue)
27
+ emits('update:modelValue', currentValue)
28
+
29
+ onBeforeMount(async () => {
30
+ attrs.value = await getAttrs(props, { valueFormat: 'YYYY-MM-DD HH:mm:ss', editable: false, ...useAttrs() })
31
+ })
32
+ </script>
33
+ <style lang="scss" scoped>
34
+ .ElPlusFormDate-panel {
35
+ display: flex;
36
+ }
37
+ </style>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <el-date-picker class="el-plusF-form-daterange-panel" v-bind="attrs" v-on="onEvents" v-model="currentValue">
3
+ <!-- 非作用域插槽 -->
4
+ <template v-for="(item, key, index) in slots" #[key]="data" :key="index">
5
+ <slot :name="key" :data="data" />
6
+ </template>
7
+ </el-date-picker>
8
+ </template>
9
+ <script lang="ts">
10
+ export default {
11
+ name: 'ElPlusFormDaterange',
12
+ inheritAttrs: false,
13
+ typeName: 'daterange',
14
+ customOptions: {}
15
+ }
16
+ </script>
17
+ <script lang="ts" setup>
18
+ import { ref, useAttrs, useSlots, onBeforeMount } from 'vue'
19
+ import { getAttrs, getEvents } from '../mixins'
20
+
21
+ const props = defineProps<{
22
+ modelValue?: Array<string> | Date
23
+ field: string
24
+ desc: { [key: string]: any }
25
+ formData: { [key: string]: any }
26
+ }>()
27
+
28
+ const emits = defineEmits(['update:modelValue'])
29
+ const currentValue = ref(props.modelValue)
30
+ const slots = ref(Object.assign({}, useSlots(), props.desc.slots))
31
+ const attrs = ref({} as any)
32
+ const onEvents = ref(getEvents(props))
33
+
34
+ emits('update:modelValue', currentValue)
35
+
36
+ onBeforeMount(async () => {
37
+ attrs.value = await getAttrs(props, { type: 'daterange', format: 'YYYY-MM-DD', valueFormat: 'x', editable: false, ...useAttrs() })
38
+ })
39
+ </script>
40
+ <style lang="scss" scoped>
41
+ .el-plusF-form-daterange-panel {
42
+ display: flex;
43
+ }
44
+ </style>