flame-plus 0.1.9 → 0.1.12
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/complex/flmForm/flmForm.vue +3 -3
- package/packages/components/complex/flmSearch/flmSearch.vue +3 -9
- package/packages/components/complex/flmTable/flmTable.vue +2 -2
- package/packages/components/complex/flmToolbar/flmToolbar.vue +2 -2
- package/packages/components/page/flmReportPage/flmReportPage.vue +3 -3
- 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/page/flmReportPage.ts +22 -0
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
flmTimePicker,
|
|
28
28
|
flmTimeSelect,
|
|
29
29
|
flmTransfer,
|
|
30
|
-
} from '
|
|
30
|
+
} from '../../index'
|
|
31
31
|
import {
|
|
32
32
|
ControlTypes,
|
|
33
33
|
ControlConfig,
|
|
@@ -37,8 +37,8 @@ import {
|
|
|
37
37
|
FormItemConfig,
|
|
38
38
|
FormButtonConfig,
|
|
39
39
|
formDefaultConfig
|
|
40
|
-
} from '
|
|
41
|
-
import { filterConfig, isValidKey } from '
|
|
40
|
+
} from '../../../model/flmComponentConfig'
|
|
41
|
+
import { filterConfig, isValidKey } from '../../../utils'
|
|
42
42
|
|
|
43
43
|
export default defineComponent({
|
|
44
44
|
components: {
|
|
@@ -38,15 +38,9 @@
|
|
|
38
38
|
|
|
39
39
|
<script lang="ts" setup>
|
|
40
40
|
import { defineProps, PropType, ref, Ref, computed, ComputedRef } from 'vue'
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
ElementSize,
|
|
45
|
-
ControlTypes,
|
|
46
|
-
FormConfig,
|
|
47
|
-
} from '@/model/flmComponentConfig'
|
|
48
|
-
import { isValidKey } from '@/utils'
|
|
49
|
-
import { nextTick } from 'process'
|
|
41
|
+
import { flmForm } from '../../index'
|
|
42
|
+
import { FormConfig, FormItemConfig } from '../../../model/flmComponentConfig'
|
|
43
|
+
import { isValidKey } from '../../../utils'
|
|
50
44
|
|
|
51
45
|
const emit = defineEmits(['searchSubmit', 'searchCancel', 'searchCustomEvent'])
|
|
52
46
|
const props = defineProps({
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
TableColumnConfig,
|
|
6
6
|
tableDefaultConfig,
|
|
7
7
|
tableColumnDefaultConfig
|
|
8
|
-
} from '
|
|
9
|
-
import { filterConfig } from '
|
|
8
|
+
} from '../../../model/flmComponentConfig'
|
|
9
|
+
import { filterConfig } from '../../../utils'
|
|
10
10
|
|
|
11
11
|
export default defineComponent({
|
|
12
12
|
emits: [
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
|
|
30
30
|
<script lang="ts" setup>
|
|
31
31
|
import { defineEmits, defineProps, PropType, computed, ComputedRef } from 'vue'
|
|
32
|
-
import { flmButton } from '
|
|
33
|
-
import { ToolbarConfig, ToolbarButtonConfig } from '
|
|
32
|
+
import { flmButton } from '../../index'
|
|
33
|
+
import { ToolbarConfig, ToolbarButtonConfig } from '../../../model/flmComponentConfig'
|
|
34
34
|
|
|
35
35
|
const emit = defineEmits(['toolbarClick'])
|
|
36
36
|
const props = defineProps({
|
|
@@ -72,15 +72,15 @@ import {
|
|
|
72
72
|
flmTable,
|
|
73
73
|
flmPagination,
|
|
74
74
|
flmDialog
|
|
75
|
-
} from '
|
|
75
|
+
} from '../../index'
|
|
76
76
|
import {
|
|
77
77
|
ControlTypes,
|
|
78
78
|
FormItemConfig,
|
|
79
79
|
FormConfig,
|
|
80
80
|
TableColumnConfig,
|
|
81
81
|
ReportPageSetting,
|
|
82
|
-
} from '
|
|
83
|
-
import { isValidKey } from '
|
|
82
|
+
} from '../../../model/flmComponentConfig'
|
|
83
|
+
import { isValidKey } from '../../../utils'
|
|
84
84
|
|
|
85
85
|
const emit = defineEmits(['customEvent'])
|
|
86
86
|
const reportPageRef = ref()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** @transfer 穿梭框 */
|
|
2
|
+
|
|
3
|
+
// 右侧排序方式
|
|
4
|
+
export enum TargetSort {
|
|
5
|
+
'original' = 'original', // 和原始数据一致
|
|
6
|
+
'push' = 'push', // 新元素在最后
|
|
7
|
+
'unshift' = 'unshift', // 新元素在最前
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// 数据单项格式
|
|
11
|
+
export interface TransferItem {
|
|
12
|
+
key?: any
|
|
13
|
+
label?: any
|
|
14
|
+
disabled?: any
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 穿梭框设置(https://element-plus.gitee.io/zh-CN/component/transfer.html)
|
|
18
|
+
export interface TransferConfig {
|
|
19
|
+
// 默认属性
|
|
20
|
+
'model-value'?: Array<TransferItem>
|
|
21
|
+
'data'?: Array<TransferItem>
|
|
22
|
+
'filterable'?: boolean
|
|
23
|
+
'filter-placeholder'?: string
|
|
24
|
+
'filter-method'?: Function
|
|
25
|
+
'target-order'?: TargetSort
|
|
26
|
+
'titles'?: Array<string>
|
|
27
|
+
'button-texts'?: Array<string>
|
|
28
|
+
'render-content'?: Function
|
|
29
|
+
'format'?: { 'noChecked'?: string, 'hasChecked'?: string }
|
|
30
|
+
'props'?: TransferItem
|
|
31
|
+
'left-default-checked'?: Array<any>
|
|
32
|
+
'right-default-checked'?: Array<any>
|
|
33
|
+
}
|
|
34
|
+
// 穿梭框默认事件
|
|
35
|
+
export interface TransferDefaultEvent {
|
|
36
|
+
onChange: (value: TransferConfig['model-value']) => void
|
|
37
|
+
onLeftCheckChange: (value: TransferConfig['model-value']) => void
|
|
38
|
+
onRightCheckChange: (value: TransferConfig['model-value']) => void
|
|
39
|
+
}
|
|
40
|
+
// 穿梭框默认设置
|
|
41
|
+
export const transferDefaultConfig: TransferConfig = {
|
|
42
|
+
'data': [],
|
|
43
|
+
'filterable': false,
|
|
44
|
+
'filter-placeholder': 'Enter keyword',
|
|
45
|
+
'target-order': TargetSort['original'],
|
|
46
|
+
'titles': ['List 1', 'List 2'],
|
|
47
|
+
'button-texts': [],
|
|
48
|
+
'format': { 'noChecked': '${checked}/${total}', 'hasChecked': '${checked}/${total}' },
|
|
49
|
+
'left-default-checked': [],
|
|
50
|
+
'right-default-checked': [],
|
|
51
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { XOR } from 'ts-xor'
|
|
2
|
+
import {
|
|
3
|
+
ElementSize,
|
|
4
|
+
ButtonConfig,
|
|
5
|
+
CascaderConfig,
|
|
6
|
+
CheckboxConfig,
|
|
7
|
+
ColorPickerConfig,
|
|
8
|
+
DatePickerConfig,
|
|
9
|
+
InputConfig,
|
|
10
|
+
InputNumberConfig,
|
|
11
|
+
RadioGroupConfig,
|
|
12
|
+
RateConfig,
|
|
13
|
+
ReadConfig,
|
|
14
|
+
SelectConfig,
|
|
15
|
+
SliderConfig,
|
|
16
|
+
SwitchConfig,
|
|
17
|
+
TimePickerConfig,
|
|
18
|
+
TimeSelectConfig,
|
|
19
|
+
TransferConfig,
|
|
20
|
+
} from '@/model/flmComponentConfig'
|
|
21
|
+
|
|
22
|
+
/** @form 表单 */
|
|
23
|
+
|
|
24
|
+
// 表单控件类型
|
|
25
|
+
export enum ControlTypes {
|
|
26
|
+
'flmCascader' = 'flmCascader',
|
|
27
|
+
'flmCheckbox' = 'flmCheckbox',
|
|
28
|
+
'flmColorPicker' = 'flmColorPicker',
|
|
29
|
+
'flmDatePicker' = 'flmDatePicker',
|
|
30
|
+
'flmInput' = 'flmInput',
|
|
31
|
+
'flmInputNumber' = 'flmInputNumber',
|
|
32
|
+
'flmRadio' = 'flmRadio',
|
|
33
|
+
'flmRate' = 'flmRate',
|
|
34
|
+
'flmRead' = 'flmRead',
|
|
35
|
+
'flmSelect' = 'flmSelect',
|
|
36
|
+
'flmSlider' = 'flmSlider',
|
|
37
|
+
'flmSwitch' = 'flmSwitch',
|
|
38
|
+
'flmTimePicker' = 'flmTimePicker',
|
|
39
|
+
'flmTimeSelect' = 'flmTimeSelect',
|
|
40
|
+
'flmTransfer' = 'flmTransfer',
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 表单控件配置
|
|
44
|
+
export type ControlConfig = CascaderConfig
|
|
45
|
+
| CheckboxConfig
|
|
46
|
+
| ColorPickerConfig
|
|
47
|
+
| DatePickerConfig
|
|
48
|
+
| InputConfig
|
|
49
|
+
| InputNumberConfig
|
|
50
|
+
| RadioGroupConfig
|
|
51
|
+
| RateConfig
|
|
52
|
+
| ReadConfig
|
|
53
|
+
| SelectConfig
|
|
54
|
+
| SliderConfig
|
|
55
|
+
| SwitchConfig
|
|
56
|
+
| TimePickerConfig
|
|
57
|
+
| TimeSelectConfig
|
|
58
|
+
| TransferConfig
|
|
59
|
+
|
|
60
|
+
// 表单model
|
|
61
|
+
export type FormModel = Record<string, any>
|
|
62
|
+
|
|
63
|
+
// 表单设置(https://element-plus.gitee.io/zh-CN/component/button.html)
|
|
64
|
+
export interface FormConfig {
|
|
65
|
+
// 默认属性
|
|
66
|
+
'model'?: FormModel
|
|
67
|
+
'rules'?: Record<string, Array<FormRule>>
|
|
68
|
+
'inline'?: boolean
|
|
69
|
+
'label-position'?: 'left' | 'right' | 'top'
|
|
70
|
+
'label-width'?: string | number
|
|
71
|
+
'label-suffix'?: string
|
|
72
|
+
'hide-required-asterisk'?: boolean
|
|
73
|
+
'show-message'?: boolean
|
|
74
|
+
'inline-message'?: boolean
|
|
75
|
+
'status-icon'?: boolean
|
|
76
|
+
'validate-on-rule-change'?: boolean
|
|
77
|
+
'size'?: ElementSize
|
|
78
|
+
'disabled'?: boolean
|
|
79
|
+
// 自定义属性
|
|
80
|
+
'items'?: Array<FormItemConfig> // 表单项
|
|
81
|
+
'buttons'?: Array<FormButtonConfig> // 表单按钮
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 表单项设置
|
|
85
|
+
export type FormItemConfig = XOR<SlotItemConfig, ControlItemConfig>
|
|
86
|
+
// 表单项默认属性
|
|
87
|
+
export interface FormItemDefaultConfig {
|
|
88
|
+
'prop'?: string | Array<string>
|
|
89
|
+
'label'?: string
|
|
90
|
+
'label-width'?: string | number
|
|
91
|
+
'required'?: boolean
|
|
92
|
+
'rules'?: any
|
|
93
|
+
'error'?: string
|
|
94
|
+
'show-message'?: boolean
|
|
95
|
+
'inline-message'?: boolean
|
|
96
|
+
'size'?: ElementSize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 插槽项属性
|
|
100
|
+
interface SlotItemConfig extends FormItemDefaultConfig {
|
|
101
|
+
'isSlot': boolean // 是否为插槽
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 控件项属性
|
|
105
|
+
interface ControlItemConfig extends FormItemDefaultConfig {
|
|
106
|
+
'controlType': ControlTypes, // 控件类型
|
|
107
|
+
'controlConfig': ControlConfig // 控件设置
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 表单校验规则
|
|
111
|
+
interface FormRule {
|
|
112
|
+
'required'?: true,
|
|
113
|
+
'min'?: number
|
|
114
|
+
'max'?: number
|
|
115
|
+
'message'?: string
|
|
116
|
+
'trigger'?: 'change' | 'blur'
|
|
117
|
+
'validator'?: Function
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 表单默认方法
|
|
121
|
+
export enum FormEvent {
|
|
122
|
+
'submit' = 'submit', // 提交
|
|
123
|
+
'cancel' = 'cancel', // 取消
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 表单按钮属性,增加属性(event - 方法名)
|
|
127
|
+
export interface FormButtonConfig extends ButtonConfig {
|
|
128
|
+
'event': FormEvent | string
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// 表单默认设置
|
|
132
|
+
export const formDefaultConfig: FormConfig = {
|
|
133
|
+
'inline': false,
|
|
134
|
+
'label-position': 'right',
|
|
135
|
+
'hide-required-asterisk': false,
|
|
136
|
+
'show-message': true,
|
|
137
|
+
'inline-message': false,
|
|
138
|
+
'status-icon': false,
|
|
139
|
+
'validate-on-rule-change': true,
|
|
140
|
+
'disabled': false,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// 是否为输入框组件
|
|
144
|
+
export const isInputControl = (control: ControlItemConfig['controlConfig']): control is InputConfig => {
|
|
145
|
+
return (control as InputConfig)['modelValue'] !== undefined
|
|
146
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ElementSize } from '@/model/flmComponentConfig'
|
|
2
|
+
|
|
3
|
+
/** @table 表格 */
|
|
4
|
+
|
|
5
|
+
// 表格设置(https://element-plus.gitee.io/zh-CN/component/table.html)
|
|
6
|
+
export interface TableConfig {
|
|
7
|
+
// 默认属性
|
|
8
|
+
'data'?: Array<any>
|
|
9
|
+
'height'?: string | number
|
|
10
|
+
'max-height'?: string | number
|
|
11
|
+
'stripe'?: boolean
|
|
12
|
+
'border'?: boolean
|
|
13
|
+
'size'?: ElementSize
|
|
14
|
+
'fit'?: boolean
|
|
15
|
+
'show-header'?: boolean
|
|
16
|
+
'highlight-current-row'?: boolean
|
|
17
|
+
'current-row-key'?: string | number
|
|
18
|
+
'row-class-name'?: Function | string
|
|
19
|
+
'row-style'?: Function | object
|
|
20
|
+
'cell-class-name'?: Function | string
|
|
21
|
+
'cell-style'?: Function | object
|
|
22
|
+
'header-row-class-name'?: Function | string
|
|
23
|
+
'header-row-style'?: Function | object
|
|
24
|
+
'header-cell-class-name'?: Function | string
|
|
25
|
+
'header-cell-style'?: Function | object
|
|
26
|
+
'row-key'?: Function | string
|
|
27
|
+
'empty-text'?: string
|
|
28
|
+
'default-expand-all'?: boolean
|
|
29
|
+
'expand-row-keys'?: Array<any>
|
|
30
|
+
'default-sort'?: { prop: any, order: 'ascending' | 'descending' }
|
|
31
|
+
'tooltip-effect'?: 'dark' | 'light'
|
|
32
|
+
'show-summary'?: boolean
|
|
33
|
+
'sum-text'?: string
|
|
34
|
+
'summary-method'?: Function
|
|
35
|
+
'span-method'?: Function
|
|
36
|
+
'select-on-indeterminate'?: boolean
|
|
37
|
+
'indent'?: number
|
|
38
|
+
'lazy'?: boolean
|
|
39
|
+
'load'?: Function
|
|
40
|
+
'tree-props'?: { hasChildren: string, children: string }
|
|
41
|
+
'table-layout'?: 'fixed' | 'auto'
|
|
42
|
+
'scrollbar-always-on'?: boolean
|
|
43
|
+
// 自定义属性
|
|
44
|
+
'columns'?: Array<TableColumnConfig>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 表格列设置
|
|
48
|
+
export interface TableColumnConfig {
|
|
49
|
+
// 默认属性
|
|
50
|
+
'type'?: 'selection' | 'index' | 'expand'
|
|
51
|
+
'index'?: number | Function
|
|
52
|
+
'label'?: string
|
|
53
|
+
'column-key'?: string
|
|
54
|
+
'prop'?: string
|
|
55
|
+
'width'?: string | number
|
|
56
|
+
'min-width'?: string | number
|
|
57
|
+
'fixed'?: true | 'left' | 'right'
|
|
58
|
+
'render-header'?: Function
|
|
59
|
+
'sortable'?: true | false | 'custom'
|
|
60
|
+
'sort-method'?: Function
|
|
61
|
+
'sort-by'?:Function
|
|
62
|
+
'sort-orders'?: Array<'ascending' | 'descending' | null>
|
|
63
|
+
'resizable'?: boolean
|
|
64
|
+
'formatter'?: Function
|
|
65
|
+
'show-overflow-tooltip'?: boolean
|
|
66
|
+
'align'?: 'left' | 'center' | 'right'
|
|
67
|
+
'header-align'?: 'left' | 'center' | 'right'
|
|
68
|
+
'class-name'?: string
|
|
69
|
+
'label-class-name'?: string
|
|
70
|
+
'selectable'?: Function
|
|
71
|
+
'reserve-selection'?: boolean
|
|
72
|
+
'filters'?: Array<{ text: string, value: string }>
|
|
73
|
+
'filter-placement'?: string
|
|
74
|
+
'filter-multiple'?: boolean
|
|
75
|
+
'filter-method'?: Function
|
|
76
|
+
'filtered-value'?: Array<any>
|
|
77
|
+
// 自定义属性
|
|
78
|
+
'isSlot'?: boolean
|
|
79
|
+
'columns'?: Array<TableColumnConfig>
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 表格默认设置
|
|
83
|
+
export const tableDefaultConfig: TableConfig = {
|
|
84
|
+
'stripe': false,
|
|
85
|
+
'border': false,
|
|
86
|
+
'fit': true,
|
|
87
|
+
'show-header': true,
|
|
88
|
+
'highlight-current-row': false,
|
|
89
|
+
'empty-text': '暂无数据',
|
|
90
|
+
'default-expand-all': false,
|
|
91
|
+
'tooltip-effect': 'dark',
|
|
92
|
+
'show-summary': false,
|
|
93
|
+
'sum-text': '合计',
|
|
94
|
+
'select-on-indeterminate': true,
|
|
95
|
+
'indent': 16,
|
|
96
|
+
'tree-props': { hasChildren: 'hasChildren', children: 'children' },
|
|
97
|
+
'table-layout': 'fixed',
|
|
98
|
+
'scrollbar-always-on': false,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 表格列默认设置
|
|
102
|
+
export const tableColumnDefaultConfig: TableColumnConfig = {
|
|
103
|
+
'sortable': false,
|
|
104
|
+
'sort-orders': ['ascending', 'descending', null],
|
|
105
|
+
'resizable': false,
|
|
106
|
+
'show-overflow-tooltip': false,
|
|
107
|
+
'align': 'left',
|
|
108
|
+
'reserve-selection': false,
|
|
109
|
+
'filter-multiple': true,
|
|
110
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ButtonConfig } from '@/model/flmComponentConfig'
|
|
2
|
+
|
|
3
|
+
// 工具栏按钮设置
|
|
4
|
+
export interface ToolbarButtonConfig extends ButtonConfig {
|
|
5
|
+
'event': string // 需要补充页面函数枚举
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// 工具栏设置
|
|
9
|
+
export interface ToolbarConfig {
|
|
10
|
+
'publicConfig': ButtonConfig // 按钮公共设置
|
|
11
|
+
'maxButton': number // 最大按钮数(不包含展开按钮)
|
|
12
|
+
'buttons': Array<ToolbarButtonConfig> // 按钮列表
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormConfig,
|
|
3
|
+
ToolbarConfig,
|
|
4
|
+
TableConfig,
|
|
5
|
+
PaginationConfig,
|
|
6
|
+
DialogConfig
|
|
7
|
+
} from '@/model/flmComponentConfig'
|
|
8
|
+
|
|
9
|
+
// 报表页面设置
|
|
10
|
+
export interface ReportPageSetting {
|
|
11
|
+
'search': FormConfig
|
|
12
|
+
'toolbar': ToolbarConfig
|
|
13
|
+
'table': TableConfig
|
|
14
|
+
'tableAction': ToolbarConfig
|
|
15
|
+
'pagination': PaginationConfig
|
|
16
|
+
'readDialog': DialogConfig
|
|
17
|
+
'readForm': FormConfig
|
|
18
|
+
'addDialog': DialogConfig
|
|
19
|
+
'addForm': FormConfig
|
|
20
|
+
'editDialog': DialogConfig
|
|
21
|
+
'editForm': FormConfig
|
|
22
|
+
}
|