flame-plus 0.1.8 → 0.1.11
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/package.json +2 -2
- package/packages/components/base/flmButton/flmButton.vue +29 -0
- package/packages/components/base/flmCascader/flmCascader.vue +39 -0
- package/packages/components/base/flmCheckbox/flmCheckbox.vue +34 -0
- package/packages/components/base/flmCheckbox/flmCheckboxGroup.vue +71 -0
- package/packages/components/base/flmColorPicker/flmColorPicker.vue +34 -0
- package/packages/components/base/flmDatePicker/flmDatePicker.vue +47 -0
- package/packages/components/base/flmDialog/flmDialog.vue +39 -0
- package/packages/components/base/flmInput/flmInput.vue +38 -0
- package/packages/components/base/flmInputNumber/flmInputNumber.vue +36 -0
- package/packages/components/base/flmPagination/flmPagination.vue +37 -0
- package/packages/components/base/flmRadio/flmRadio.vue +64 -0
- package/packages/components/base/flmRate/flmRate.vue +34 -0
- package/packages/components/base/flmRead/flmRead.vue +18 -0
- package/packages/components/base/flmSelect/flmSelect.vue +74 -0
- package/packages/components/base/flmSlider/flmSlider.vue +35 -0
- package/packages/components/base/flmSwitch/flmSwitch.vue +29 -0
- package/packages/components/base/flmTimePicker/flmTimePicker.vue +37 -0
- package/packages/components/base/flmTimeSelect/flmTimeSelect.vue +36 -0
- package/packages/components/base/flmTransfer/flmTransfer.vue +42 -0
- package/packages/components/complex/flmForm/flmForm.vue +223 -0
- package/packages/components/complex/flmSearch/flmSearch.vue +148 -0
- package/packages/components/complex/flmTable/flmTable.vue +90 -0
- package/packages/components/complex/flmToolbar/flmToolbar.vue +55 -0
- package/packages/components/index.ts +29 -0
- package/packages/components/page/flmReportPage/flmReportPage.vue +690 -0
- package/packages/index.ts +8 -0
- package/packages/model/flmComponentConfig/base/flmButton.ts +50 -0
- package/packages/model/flmComponentConfig/base/flmCascader.ts +77 -0
- package/packages/model/flmComponentConfig/base/flmCheckbox.ts +51 -0
- package/packages/model/flmComponentConfig/base/flmColorPicker.ts +30 -0
- package/packages/model/flmComponentConfig/base/flmDatePicker.ts +73 -0
- package/packages/model/flmComponentConfig/base/flmDialog.ts +49 -0
- package/packages/model/flmComponentConfig/base/flmInput.ts +57 -0
- package/packages/model/flmComponentConfig/base/flmInputNumber.ts +37 -0
- package/packages/model/flmComponentConfig/base/flmPagination.ts +38 -0
- package/packages/model/flmComponentConfig/base/flmRadio.ts +42 -0
- package/packages/model/flmComponentConfig/base/flmRate.ts +49 -0
- package/packages/model/flmComponentConfig/base/flmRead.ts +6 -0
- package/packages/model/flmComponentConfig/base/flmSelect.ts +104 -0
- package/packages/model/flmComponentConfig/base/flmSlider.ts +51 -0
- package/packages/model/flmComponentConfig/base/flmSwitch.ts +37 -0
- package/packages/model/flmComponentConfig/base/flmTimePicker.ts +61 -0
- package/packages/model/flmComponentConfig/base/flmTimeSelect.ts +44 -0
- package/packages/model/flmComponentConfig/base/flmTransfer.ts +51 -0
- package/packages/model/flmComponentConfig/complex/flmForm.ts +146 -0
- package/packages/model/flmComponentConfig/complex/flmTable.ts +110 -0
- package/packages/model/flmComponentConfig/complex/flmToolbar.ts +13 -0
- package/packages/model/flmComponentConfig/index.ts +30 -0
- package/packages/model/flmComponentConfig/page/flmReportPage.ts +22 -0
- package/packages/model/flmComponentConfig/public.ts +293 -0
- package/packages/utils/filterConfig.ts +39 -0
- package/packages/utils/index.ts +2 -0
- package/packages/utils/isValidKey.ts +13 -0
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, computed } from 'vue'
|
|
3
|
+
import { ButtonConfig, buttonDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['buttonClick'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<ButtonConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 按钮设置
|
|
17
|
+
const buttonConfig = computed((): ButtonConfig => {
|
|
18
|
+
return filterConfig(buttonDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return () => (
|
|
22
|
+
<el-button
|
|
23
|
+
{...buttonConfig.value}
|
|
24
|
+
onClick={() => ctx.emit('buttonClick')}
|
|
25
|
+
>{buttonConfig.value.text || '点击'}</el-button>
|
|
26
|
+
)
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, computed, reactive } from 'vue'
|
|
3
|
+
import { CascaderConfig, CascaderDefaultEvent, cascaderDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['change', 'expand-change', 'blur', 'focus', 'visible-change', 'remove-tag'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<CascaderConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 级联选择器设置
|
|
17
|
+
const cascaderConfig = computed((): CascaderConfig => {
|
|
18
|
+
return filterConfig(cascaderDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 级联选择器事件
|
|
22
|
+
const cascaderDefaultEvent: CascaderDefaultEvent = reactive({
|
|
23
|
+
onChange: (value: CascaderConfig['model-value']) => ctx.emit('change', value),
|
|
24
|
+
onExpandChange: (event: any) => ctx.emit('expand-change', event),
|
|
25
|
+
onBlur: (event: any) => ctx.emit('blur', event),
|
|
26
|
+
onFocus: (event: any) => ctx.emit('focus', event),
|
|
27
|
+
onVisibleChange: (event: boolean) => ctx.emit('visible-change', event),
|
|
28
|
+
onRemoveTag: (event: any) => ctx.emit('remove-tag', event)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
return () => (
|
|
32
|
+
<el-cascader
|
|
33
|
+
{...cascaderConfig.value}
|
|
34
|
+
{...cascaderDefaultEvent}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, reactive, computed } from 'vue'
|
|
3
|
+
import { CheckboxConfig, CheckboxDefaultEvent, checkboxDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['change'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<CheckboxConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 多选框设置
|
|
17
|
+
const checkboxConfig = computed((): CheckboxConfig => {
|
|
18
|
+
return filterConfig(checkboxDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 多选框事件
|
|
22
|
+
const checkboxDefaultEvent: CheckboxDefaultEvent = reactive({
|
|
23
|
+
onChange: (value: CheckboxConfig['model-value']) => ctx.emit('change', value)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return () => (
|
|
27
|
+
<el-checkbox
|
|
28
|
+
{...checkboxConfig.value}
|
|
29
|
+
{...checkboxDefaultEvent}
|
|
30
|
+
></el-checkbox>
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, ref, Ref, computed } from 'vue'
|
|
3
|
+
import { flmCheckbox } from '@/components'
|
|
4
|
+
import {
|
|
5
|
+
CheckboxConfig,
|
|
6
|
+
CheckboxGroupConfig,
|
|
7
|
+
checkboxGroupDefaultConfig
|
|
8
|
+
} from '@/model/flmComponentConfig'
|
|
9
|
+
import { filterConfig } from '@/utils'
|
|
10
|
+
|
|
11
|
+
export default defineComponent({
|
|
12
|
+
components: { flmCheckbox },
|
|
13
|
+
emits: ['change'],
|
|
14
|
+
props: {
|
|
15
|
+
// 默认设置
|
|
16
|
+
config: {
|
|
17
|
+
type: Object as PropType<CheckboxGroupConfig>,
|
|
18
|
+
default: {}
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
setup(props, ctx) {
|
|
22
|
+
// 多选框组设置
|
|
23
|
+
const checkboxGroupConfig = computed((): CheckboxGroupConfig => {
|
|
24
|
+
return filterConfig(checkboxGroupDefaultConfig, props.config)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const isCheckAll: Ref<boolean> = ref(false) // 全选
|
|
28
|
+
const isIndeterminate: Ref<boolean> = ref(false) // 半选
|
|
29
|
+
// 全选值变化
|
|
30
|
+
const checkAllChange = (value: boolean) => {
|
|
31
|
+
isCheckAll.value = value
|
|
32
|
+
isIndeterminate.value = false
|
|
33
|
+
ctx.emit('change', value
|
|
34
|
+
? checkboxGroupConfig.value.items?.map(({ label }) => label)
|
|
35
|
+
: []
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
// 多选框组值变化
|
|
39
|
+
const checkboxGroupChange = (value: CheckboxGroupConfig['model-value']) => {
|
|
40
|
+
const checkedCount = value?.length ?? 0,
|
|
41
|
+
itemsCount = checkboxGroupConfig.value.items?.length ?? 0
|
|
42
|
+
isCheckAll.value = checkedCount === itemsCount
|
|
43
|
+
isIndeterminate.value = checkedCount > 0 && checkedCount < itemsCount
|
|
44
|
+
ctx.emit('change', value)
|
|
45
|
+
}
|
|
46
|
+
// 多选框组元素
|
|
47
|
+
const checkboxGroupDom = ({ hasCheckAll, checkAllConfig, ...defaultConfig }: CheckboxGroupConfig) => {
|
|
48
|
+
return (
|
|
49
|
+
<div>
|
|
50
|
+
{
|
|
51
|
+
hasCheckAll && <flmCheckbox
|
|
52
|
+
config={{
|
|
53
|
+
'label': '全选',
|
|
54
|
+
...checkAllConfig,
|
|
55
|
+
'model-value': isCheckAll.value,
|
|
56
|
+
'indeterminate': isIndeterminate.value
|
|
57
|
+
}}
|
|
58
|
+
onChange={checkAllChange}
|
|
59
|
+
/>
|
|
60
|
+
}
|
|
61
|
+
<el-checkbox-group {...defaultConfig} onChange={checkboxGroupChange}>
|
|
62
|
+
{defaultConfig.items?.map((item: CheckboxConfig) => <flmCheckbox config={item} />)}
|
|
63
|
+
</el-checkbox-group>
|
|
64
|
+
</div>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return () => (checkboxGroupDom(checkboxGroupConfig.value))
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, reactive, computed } from 'vue'
|
|
3
|
+
import { ColorPickerConfig, ColorPickerDefaultEvent, colorPickerDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['change'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<ColorPickerConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 颜色选择器设置
|
|
17
|
+
const colorPickerConfig = computed((): ColorPickerConfig => {
|
|
18
|
+
return filterConfig(colorPickerDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 颜色选择器事件
|
|
22
|
+
const colorPickerDefaultEvent: ColorPickerDefaultEvent = reactive({
|
|
23
|
+
onChange: (value: ColorPickerConfig['model-value']) => ctx.emit('change', value)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return () => (
|
|
27
|
+
<el-colorPicker
|
|
28
|
+
{...colorPickerConfig.value}
|
|
29
|
+
{...colorPickerDefaultEvent}
|
|
30
|
+
/>
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, computed, reactive } from 'vue'
|
|
3
|
+
import { DatePickerConfig, DatePickerDefaultEvent, datePickerDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: [
|
|
8
|
+
'change',
|
|
9
|
+
'blur',
|
|
10
|
+
'focus',
|
|
11
|
+
'calendar-change',
|
|
12
|
+
'panel-change',
|
|
13
|
+
'visible-change',
|
|
14
|
+
],
|
|
15
|
+
props: {
|
|
16
|
+
// 默认设置
|
|
17
|
+
config: {
|
|
18
|
+
type: Object as PropType<DatePickerConfig>,
|
|
19
|
+
default: {}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
setup(props, ctx) {
|
|
23
|
+
// 日期选择器设置
|
|
24
|
+
const datePickerConfig = computed((): DatePickerConfig => {
|
|
25
|
+
return filterConfig(datePickerDefaultConfig, props.config)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
// 日期选择器事件
|
|
29
|
+
const datePickerDefaultEvent: DatePickerDefaultEvent = reactive({
|
|
30
|
+
'onUpdate:modelValue': (value: DatePickerConfig['model-value']) => ctx.emit('change', value), // v-model 不用改不了值
|
|
31
|
+
// onChange: (value: DatePickerConfig['model-value']) => {},
|
|
32
|
+
onBlur: (event: any) => ctx.emit('blur', event),
|
|
33
|
+
onFocus: (event: any) => ctx.emit('focus', event),
|
|
34
|
+
onCalendarChange: (event: Array<Date>) => ctx.emit('calendar-change', event),
|
|
35
|
+
onPanelChange: (date: any, mode: any, view: any) => ctx.emit('panel-change', { date, mode, view }),
|
|
36
|
+
onVisibleChange: (event: boolean) => ctx.emit('visible-change', event),
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return () => (
|
|
40
|
+
<el-date-picker
|
|
41
|
+
{...datePickerConfig.value}
|
|
42
|
+
{...datePickerDefaultEvent}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, reactive, computed } from 'vue'
|
|
3
|
+
import { DialogConfig, DialogDefaultEvent, dialogDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['open', 'opened', 'close', 'closed', 'open-auto-focus', 'close-auto-focus'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<DialogConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 弹窗设置
|
|
17
|
+
const dialogConfig = computed((): DialogConfig => {
|
|
18
|
+
return filterConfig(dialogDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 弹窗事件
|
|
22
|
+
const dialogDefaultEvent: DialogDefaultEvent = reactive({
|
|
23
|
+
onOpen: () => ctx.emit('open'),
|
|
24
|
+
onOpened: () => ctx.emit('opened'),
|
|
25
|
+
onClose: () => ctx.emit('close'),
|
|
26
|
+
onClosed: () => ctx.emit('closed'),
|
|
27
|
+
onOpenAutoFocus: () => ctx.emit('open-auto-focus'),
|
|
28
|
+
onCloseAutoFocus: () => ctx.emit('close-auto-focus'),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
return () => (
|
|
32
|
+
<el-dialog
|
|
33
|
+
{...dialogConfig.value}
|
|
34
|
+
{...dialogDefaultEvent}
|
|
35
|
+
>{{ default: () => ctx.slots['default']?.() }}</el-dialog>
|
|
36
|
+
)
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, reactive, computed } from 'vue'
|
|
3
|
+
import { InputConfig, InputDefaultEvent, inputDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['blur', 'focus', 'change', 'input', 'clear'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<InputConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 输入框设置
|
|
17
|
+
const inputConfig = computed((): InputConfig => {
|
|
18
|
+
return filterConfig(inputDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 输入框事件
|
|
22
|
+
const inputDefaultEvent: InputDefaultEvent = reactive({
|
|
23
|
+
onBlur: () => ctx.emit('blur'),
|
|
24
|
+
onFocus: () => ctx.emit('focus'),
|
|
25
|
+
onChange: (value: InputConfig['modelValue']) => ctx.emit('change', value),
|
|
26
|
+
onInput: (value: InputConfig['modelValue']) => ctx.emit('input', value),
|
|
27
|
+
onClear: () => ctx.emit('clear'),
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
return () => (
|
|
31
|
+
<el-input
|
|
32
|
+
{...inputConfig.value}
|
|
33
|
+
{...inputDefaultEvent}
|
|
34
|
+
></el-input>
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, computed, reactive } from 'vue'
|
|
3
|
+
import { InputNumberConfig, InputNumberDefaultEvent, inputNumberDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['change', 'blur', 'focus'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<InputNumberConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 数字输入框设置
|
|
17
|
+
const inputNumberConfig = computed((): InputNumberConfig => {
|
|
18
|
+
return filterConfig(inputNumberDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 数字输入框默认事件
|
|
22
|
+
const inputNumberDefaultEvent: InputNumberDefaultEvent = reactive({
|
|
23
|
+
onChange: (value: InputNumberConfig['model-value']) => ctx.emit('change', value),
|
|
24
|
+
onBlur: () => ctx.emit('blur'),
|
|
25
|
+
onFocus: () => ctx.emit('focus'),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return () => (
|
|
29
|
+
<el-input-number
|
|
30
|
+
{...inputNumberConfig.value}
|
|
31
|
+
{...inputNumberDefaultEvent}
|
|
32
|
+
></el-input-number>
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, reactive, computed } from 'vue'
|
|
3
|
+
import { PaginationConfig, PaginationDefaultEvent, paginationDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['size-change', 'current-change', 'prev-click', 'next-click'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<PaginationConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 按钮设置
|
|
17
|
+
const paginationConfig = computed((): PaginationConfig => {
|
|
18
|
+
return filterConfig(paginationDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 数字输入框默认事件
|
|
22
|
+
const paginationDefaultEvent: PaginationDefaultEvent = reactive({
|
|
23
|
+
onSizeChange: (pageSize: number) => ctx.emit('size-change', pageSize),
|
|
24
|
+
onCurrentChange: (current: number) => ctx.emit('current-change', current),
|
|
25
|
+
onPrevClick: (current: number) => ctx.emit('prev-click', current),
|
|
26
|
+
onNextClick: (current: number) => ctx.emit('next-click', current)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return () => (
|
|
30
|
+
<el-pagination
|
|
31
|
+
{...paginationConfig.value}
|
|
32
|
+
{...paginationDefaultEvent}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, h, PropType, computed, reactive } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
RadioConfig,
|
|
5
|
+
RadioGroupConfig,
|
|
6
|
+
RadioGroupDefaultEvent,
|
|
7
|
+
radioDefaultConfig,
|
|
8
|
+
radioGroupDefaultConfig
|
|
9
|
+
} from '@/model/flmComponentConfig'
|
|
10
|
+
import { filterConfig } from '@/utils'
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
emits: ['change'],
|
|
14
|
+
props: {
|
|
15
|
+
// 默认设置
|
|
16
|
+
config: {
|
|
17
|
+
type: Object as PropType<RadioGroupConfig>,
|
|
18
|
+
default: {}
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
setup(props, ctx) {
|
|
22
|
+
// 单选框组设置
|
|
23
|
+
const radioGroupConfig = computed((): RadioGroupConfig => {
|
|
24
|
+
return filterConfig(radioGroupDefaultConfig, props.config)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// 计算属性传入参需要优化
|
|
28
|
+
// 单选框设置
|
|
29
|
+
// const radioConfig = computed((): (config: RadioConfig) => RadioConfig => (config: RadioConfig) => {
|
|
30
|
+
// return filterConfig(radioDefaultConfig, config)
|
|
31
|
+
// }
|
|
32
|
+
// )
|
|
33
|
+
|
|
34
|
+
// 单选框默认事件
|
|
35
|
+
const radioDefaultEvent: RadioGroupDefaultEvent = reactive({
|
|
36
|
+
onChange: (value: RadioGroupConfig['model-value']) => ctx.emit('change', value)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const radioGroupDom = () => {
|
|
40
|
+
const { useButton = false, radios = [], ...radioGroup } = radioGroupConfig.value
|
|
41
|
+
const radioDom = (radios: RadioGroupConfig['radios']) => {
|
|
42
|
+
return radios?.map((radio: RadioConfig) => {
|
|
43
|
+
// 动态组件名方式需要优化
|
|
44
|
+
return (useButton
|
|
45
|
+
? <el-radio-button {...filterConfig(radioDefaultConfig, radio)} />
|
|
46
|
+
: <el-radio {...filterConfig(radioDefaultConfig, radio)} />
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
return (
|
|
52
|
+
<el-radio-group
|
|
53
|
+
{...radioGroup}
|
|
54
|
+
{...radioDefaultEvent}
|
|
55
|
+
>
|
|
56
|
+
{radioDom(radios)}
|
|
57
|
+
</el-radio-group>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return () => (radioGroupDom())
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, computed, reactive } from 'vue'
|
|
3
|
+
import { RateConfig, RateDefaultEvent, rateDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['change'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<RateConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 评分设置
|
|
17
|
+
const rateConfig = computed((): RateConfig => {
|
|
18
|
+
return filterConfig(rateDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 评分默认事件
|
|
22
|
+
const rateDefaultEvent: RateDefaultEvent = reactive({
|
|
23
|
+
onChange: (value: RateConfig['model-value']) => ctx.emit('change', value),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return () => (
|
|
27
|
+
<el-rate
|
|
28
|
+
{...rateConfig.value}
|
|
29
|
+
{...rateDefaultEvent}
|
|
30
|
+
></el-rate>
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="config.class" :style="config.style">
|
|
3
|
+
{{ config['model-value'] }}
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { defineProps, PropType } from 'vue'
|
|
9
|
+
import { ReadConfig } from '@/model/flmComponentConfig'
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
// 默认设置
|
|
13
|
+
config: {
|
|
14
|
+
type: Object as PropType<ReadConfig>,
|
|
15
|
+
default: {}
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, reactive, computed } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
SelectConfig,
|
|
5
|
+
SelectDefaultEvent,
|
|
6
|
+
OptionGroupConfig,
|
|
7
|
+
OptionConfig,
|
|
8
|
+
selectDefaultConfig
|
|
9
|
+
} from '@/model/flmComponentConfig'
|
|
10
|
+
import { filterConfig } from '@/utils'
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
emits: ['change', 'visible-change', 'remove-tag', 'clear', 'blur', 'focus'],
|
|
14
|
+
props: {
|
|
15
|
+
// 默认设置
|
|
16
|
+
config: {
|
|
17
|
+
type: Object as PropType<SelectConfig>,
|
|
18
|
+
default: {}
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
setup(props, ctx) {
|
|
22
|
+
// 选择器设置
|
|
23
|
+
const selectConfig = computed((): SelectConfig => {
|
|
24
|
+
return filterConfig(selectDefaultConfig, props.config)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// 选择器默认事件
|
|
28
|
+
const selectDefaultEvent: SelectDefaultEvent = reactive({
|
|
29
|
+
onChange: (value: SelectConfig['model-value']) => ctx.emit('change', value),
|
|
30
|
+
onVisibleChange: (showOption: boolean) => ctx.emit('visible-change', showOption),
|
|
31
|
+
onRemoveTag: (tagValue: SelectConfig['model-value']) => ctx.emit('remove-tag', tagValue),
|
|
32
|
+
onClear: () => ctx.emit('clear'),
|
|
33
|
+
onBlur: () => ctx.emit('blur'),
|
|
34
|
+
onFocus: () => ctx.emit('focus'),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 选择器的子元素
|
|
39
|
+
* @date 2022-04-12
|
|
40
|
+
* @param {object} props
|
|
41
|
+
* @param {boolean} props.hasGroup 是否为分组选项
|
|
42
|
+
* @param {array} props.group 分组选项
|
|
43
|
+
* @param {array} props.options 普通选项
|
|
44
|
+
* @returns {tsx} 选择器子元素tsx
|
|
45
|
+
*/
|
|
46
|
+
const childrenDom = ({ hasGroup, groups = [], options = [] }: SelectConfig) => {
|
|
47
|
+
const groupsDom = (groups: Array<OptionGroupConfig>) => {
|
|
48
|
+
return groups.map(({ options, ...group }: OptionGroupConfig) => {
|
|
49
|
+
return (
|
|
50
|
+
<el-option-group key={group.label} {...group}>
|
|
51
|
+
{options && optionsDom(options)}
|
|
52
|
+
</el-option-group>
|
|
53
|
+
)
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
const optionsDom = (options: Array<OptionConfig>) => {
|
|
57
|
+
return options.map((option: OptionConfig) => (
|
|
58
|
+
<el-option key={option.value} {...option} />
|
|
59
|
+
))
|
|
60
|
+
}
|
|
61
|
+
return hasGroup ? groupsDom(groups) : optionsDom(options)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return () => (
|
|
65
|
+
<el-select
|
|
66
|
+
{...selectConfig.value}
|
|
67
|
+
{...selectDefaultEvent}
|
|
68
|
+
>
|
|
69
|
+
{childrenDom(selectConfig.value)}
|
|
70
|
+
</el-select>
|
|
71
|
+
)
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, computed, reactive } from 'vue'
|
|
3
|
+
import { SliderConfig, SliderDefaultEvent, sliderDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['change', 'input'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<SliderConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 滑块设置
|
|
17
|
+
const sliderConfig = computed((): SliderConfig => {
|
|
18
|
+
return filterConfig(sliderDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 滑块默认事件
|
|
22
|
+
const sliderDefaultEvent: SliderDefaultEvent = reactive({
|
|
23
|
+
onChange: (value: SliderConfig['model-value']) => ctx.emit('change', value),
|
|
24
|
+
onInput: (value: SliderConfig['model-value']) => ctx.emit('input', value),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
return () => (
|
|
28
|
+
<el-slider
|
|
29
|
+
{...sliderConfig.value}
|
|
30
|
+
{...sliderDefaultEvent}
|
|
31
|
+
></el-slider>
|
|
32
|
+
)
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="tsx">
|
|
2
|
+
import { defineComponent, PropType, computed } from 'vue'
|
|
3
|
+
import { SwitchConfig, switchDefaultConfig } from '@/model/flmComponentConfig'
|
|
4
|
+
import { filterConfig } from '@/utils'
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
emits: ['change'],
|
|
8
|
+
props: {
|
|
9
|
+
// 默认设置
|
|
10
|
+
config: {
|
|
11
|
+
type: Object as PropType<SwitchConfig>,
|
|
12
|
+
default: {}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
setup(props, ctx) {
|
|
16
|
+
// 开关设置
|
|
17
|
+
const switchConfig = computed((): SwitchConfig => {
|
|
18
|
+
return filterConfig(switchDefaultConfig, props.config)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return () => (
|
|
22
|
+
<el-switch
|
|
23
|
+
{...switchConfig.value}
|
|
24
|
+
onChange={(value: SwitchConfig['model-value']) => ctx.emit('change', value)}
|
|
25
|
+
></el-switch>
|
|
26
|
+
)
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
</script>
|