@lx-frontend/wrap-element-ui 1.0.0-beta.7 → 1.0.1-7.beta-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.
- package/README.md +2 -2
- package/package.json +6 -5
- package/src/components/EditableTable/bizHooks/index.ts +7 -0
- package/src/components/EditableTable/{useCellHover.ts → bizHooks/useCellHover.ts} +1 -1
- package/src/components/EditableTable/bizHooks/useColumnHeaderOperation.ts +329 -0
- package/src/components/EditableTable/{useDefaultOperation.ts → bizHooks/useDefaultOperation.ts} +2 -2
- package/src/components/EditableTable/{useDragSort.ts → bizHooks/useDragSort.ts} +4 -4
- package/src/components/EditableTable/{usePagination.ts → bizHooks/usePagination.ts} +3 -3
- package/src/components/EditableTable/{useRowBgColor.ts → bizHooks/useRowBgColor.ts} +9 -16
- package/src/components/EditableTable/bizHooks/useViewSetting.ts +125 -0
- package/src/components/EditableTable/features/bizColorSelect.vue +63 -0
- package/src/components/EditableTable/features/bizEditCell.vue +44 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizCheckboxFilter.vue +40 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizColorRadioFilter.vue +56 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizDoubleDatePickerFilter.vue +91 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizInputFilter.vue +26 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizMonthDayPicker.helper.ts +131 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizMonthDayPicker.vue +115 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizRadioFilter.vue +39 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/BizSortFilter.vue +50 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover/index.vue +155 -0
- package/src/components/EditableTable/features/bizTableOperatePopover.vue +67 -0
- package/src/components/EditableTable/features/bizViewSettingDialog.vue +137 -0
- package/src/components/EditableTable/index.less +524 -428
- package/src/components/EditableTable/index.vue +167 -456
- package/src/components/EditableTable/{types.ts → types/index.ts} +176 -116
- package/src/components/SearchForm/index.vue +7 -4
- package/src/components/SearchForm/types/index.ts +63 -0
- package/src/components/EditableTable/useColumnHeaderOperation.ts +0 -326
- package/src/components/EditableTable/useViewSetting.ts +0 -119
|
@@ -1,116 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
label
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
import type { TableColumn, DatePicker } from 'element-ui'
|
|
2
|
+
|
|
3
|
+
export enum IEditType {
|
|
4
|
+
INPUT = 'input',
|
|
5
|
+
SELECT = 'select',
|
|
6
|
+
DATE_ONLY = 'date'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ISortOption {
|
|
10
|
+
prop: string
|
|
11
|
+
label: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 筛选组件 - 输入框 */
|
|
15
|
+
export interface IFilterInput {
|
|
16
|
+
type: 'input'
|
|
17
|
+
prop: string,
|
|
18
|
+
label?: string,
|
|
19
|
+
validator?: (value: string) => boolean
|
|
20
|
+
placeholder?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IFilterSelectOptions {
|
|
24
|
+
value: any;
|
|
25
|
+
text: string;
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** 筛选组件 - 单选/多选 */
|
|
30
|
+
export interface IFilterSelect {
|
|
31
|
+
type: 'radio' | 'checkbox'
|
|
32
|
+
prop: string
|
|
33
|
+
options: IFilterSelectOptions[]
|
|
34
|
+
label?: string
|
|
35
|
+
defaultValue?: any | any[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** 筛选组件 - 日期范围(拆分两个日期选择器) */
|
|
39
|
+
export interface IFilterDoubleDatePicker {
|
|
40
|
+
type: 'doubleDatePicker',
|
|
41
|
+
prop: [string, string],
|
|
42
|
+
label?: string,
|
|
43
|
+
pickerOptions?: DatePicker['pickerOptions']
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** 筛选组件 - 月日选择器 */
|
|
47
|
+
export interface IFilterMonthDayPicker {
|
|
48
|
+
type: 'monthDayPicker',
|
|
49
|
+
prop: [string, string],
|
|
50
|
+
label?: string,
|
|
51
|
+
/** 可选择的范围 */
|
|
52
|
+
limit: number,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** 筛选组件 - 颜色选择器 */
|
|
56
|
+
export interface IFilterColorRadio {
|
|
57
|
+
type: 'colorRadio',
|
|
58
|
+
prop: string,
|
|
59
|
+
label?: string,
|
|
60
|
+
options: Array<IFilterSelectOptions & { color: string }>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type FilterItem = IFilterInput | IFilterSelect | IFilterDoubleDatePicker | IFilterMonthDayPicker | IFilterColorRadio
|
|
64
|
+
|
|
65
|
+
/** 筛选组件类型 */
|
|
66
|
+
export type FilterListType = Array<FilterItem>
|
|
67
|
+
|
|
68
|
+
type _IColumnConfigRequired = {
|
|
69
|
+
prop: string;
|
|
70
|
+
label: string;
|
|
71
|
+
editType?: IEditType; // 编辑格式
|
|
72
|
+
editSlotName?: string; // 编辑时,自定义编辑组件的slotName
|
|
73
|
+
sortable?: boolean | ISortOption[]; // 该列是否允许排序,ture则表头弹窗会显示升降序按钮
|
|
74
|
+
_sortable?: _IColumnConfigRequired['sortable']; // 内部使用,el-table 的 sortable 不支持数组,用来同步 sortable
|
|
75
|
+
/** 内部使用, */
|
|
76
|
+
isColumnSortable?: boolean;
|
|
77
|
+
slotName?: string; // 如果要自定义,传入 slotName
|
|
78
|
+
hoverSlotName?: string; // 悬浮时,自定义悬浮组件的slotName
|
|
79
|
+
isAlwaysShow?: boolean; // 不可隐藏,显示设置中,该列不允许隐藏
|
|
80
|
+
/** 默认隐藏,显示设置中,该列默认隐藏 */
|
|
81
|
+
defaultHide?: boolean;
|
|
82
|
+
summary?: boolean; // 是否可以显示该列的统计
|
|
83
|
+
summaryMethod?: (values: any[]) => string | number; // 这一列的统计方法,values为该列的所有值
|
|
84
|
+
/** 格式化函数,用于自定义渲染 */
|
|
85
|
+
formatter?: (row: any, column: IColumnConfig, value: any, index: number) => string | number;
|
|
86
|
+
width?: number | string;
|
|
87
|
+
minWidth?: number | string;
|
|
88
|
+
/** 自定义颜色表头label */
|
|
89
|
+
customColorLabel?: boolean;
|
|
90
|
+
filters?: FilterListType;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type IColumnConfigRequired = _IColumnConfigRequired & Partial<Omit<TableColumn, keyof _IColumnConfigRequired>>
|
|
94
|
+
|
|
95
|
+
type IInputColumn = IColumnConfigRequired & {
|
|
96
|
+
inputType: string | number;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type ISelectColumn = IColumnConfigRequired & {
|
|
100
|
+
options: { key: string; value: string | number; [key: string]: any }[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type IDateOnlyColumn = IColumnConfigRequired
|
|
104
|
+
type IDateTimeColumn = IColumnConfigRequired
|
|
105
|
+
|
|
106
|
+
export type IColumnConfig = IInputColumn | ISelectColumn | IDateOnlyColumn | IDateTimeColumn
|
|
107
|
+
|
|
108
|
+
export type IColorList = {
|
|
109
|
+
name: string; // 颜色名称
|
|
110
|
+
textColor: string; // 颜色弹窗中文本颜色
|
|
111
|
+
sampleColor: string; // 颜色弹窗中样例的颜色
|
|
112
|
+
bgColor: string; // 选中颜色后,行背景色
|
|
113
|
+
id: number; // 颜色id
|
|
114
|
+
default?: boolean // 是否是默认色,默认色需要显示颜色图标
|
|
115
|
+
}[]
|
|
116
|
+
|
|
117
|
+
type IPointLoc = {
|
|
118
|
+
x: number;
|
|
119
|
+
y: number;
|
|
120
|
+
}
|
|
121
|
+
export type IDraggingData = {
|
|
122
|
+
isDragging?: boolean
|
|
123
|
+
startPosition?: IPointLoc
|
|
124
|
+
draggingRow?: HTMLElement | HTMLElement[]
|
|
125
|
+
draggingIndex?: number
|
|
126
|
+
dropIndex?: number
|
|
127
|
+
rowDoms?: Record<number, HTMLElement[]>
|
|
128
|
+
rowHeight?: number
|
|
129
|
+
rowsRange?: ([number, number] | undefined)[]
|
|
130
|
+
hiddenTds?: HTMLElement[]
|
|
131
|
+
fullScreenDiv?: HTMLElement
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type IDefaultOperationType = 'edit' | 'delete' | 'top'
|
|
135
|
+
|
|
136
|
+
export type ITableDataItem = {
|
|
137
|
+
colorId?: number;
|
|
138
|
+
isPinned?: boolean;
|
|
139
|
+
// 固定背景色:如果行数据中有该值,行背景色将以该值为准,优先级大于colorId指定的背景色(颜色实例不受影响)
|
|
140
|
+
__static_bg_color__?: string;
|
|
141
|
+
[k: string]: any;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface IProps {
|
|
145
|
+
dataList: ITableDataItem[];
|
|
146
|
+
columnConfig: IColumnConfig[];
|
|
147
|
+
hasExpandRow?: boolean;
|
|
148
|
+
hasIndexColumn?: boolean;
|
|
149
|
+
hasSelectionColumn?: boolean;
|
|
150
|
+
rowDragAble?: boolean;
|
|
151
|
+
total: number;
|
|
152
|
+
defaultOperations?: IDefaultOperationType[];
|
|
153
|
+
colorList?: IColorList;
|
|
154
|
+
colorFilterConfig?: IColumnConfig
|
|
155
|
+
leftFixedCount?: number;
|
|
156
|
+
dragSemiRange?: number;
|
|
157
|
+
loading?: boolean;
|
|
158
|
+
settingStorgeKey?: string
|
|
159
|
+
localSort?: boolean
|
|
160
|
+
localFilter?: boolean
|
|
161
|
+
currentPage: number
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface IEmits {
|
|
165
|
+
(e: 'selection-change', selection: any): void
|
|
166
|
+
(e: 'row-bg-change', param: { colorId: number; row: ITableDataItem; rowIndex: number }): void
|
|
167
|
+
(e: 'row-drag-drop', param: { row: any; fromIndex: number; toIndex: number; page: number; size: number; }): void
|
|
168
|
+
(e: 'row-delete', param: { row: any; index: number; page: number; size: number; }): void
|
|
169
|
+
(e: 'row-edit', param: { row: any, index: number; page: number; size: number; }): void
|
|
170
|
+
(e: 'row-pin-to-top', param: { row: any, rawIndex: number; page: number; size: number; }): void
|
|
171
|
+
(e: 'row-edit-save', param: { page: number; size: number; row: any; changedData: Record<string, any>; }): void
|
|
172
|
+
(e: 'row-edit-cancel', param: { row: any; page: number; size: number; }): void
|
|
173
|
+
(e: 'page-change', param: { page: number, size: number }): void
|
|
174
|
+
(e: 'search', param: Record<string, any>): void
|
|
175
|
+
(e: 'sort-change', param: { order: 'descending' | 'ascending' | null, prop: string }): void
|
|
176
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
v-for="({
|
|
9
9
|
isEmpty = true, key, type, prop, label, placeholder, candidate, filterable=false, withoutAll=false, collapseTags=false,
|
|
10
10
|
clearable=false, multiple=false, multipleLimit=0, changeCb, inputLimitCallback, slotName, dateType='date',
|
|
11
|
-
doubleIsInline = true,
|
|
11
|
+
doubleIsInline = true, maxlength = 255,
|
|
12
12
|
}) in config"
|
|
13
13
|
:key="label"
|
|
14
14
|
:label="showLabel ? label : ''"
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
v-if="type === 'input'"
|
|
19
19
|
:placeholder="placeholder ? placeholder : showLabel ? '请输入' : label"
|
|
20
20
|
:value="formData[prop]"
|
|
21
|
+
:maxlength="maxlength"
|
|
21
22
|
@input="val => handleInput(val, prop, inputLimitCallback)"
|
|
22
23
|
/>
|
|
23
24
|
<div
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
/>
|
|
55
56
|
<el-option
|
|
56
57
|
v-for="({name, value, code, id}) in candidate"
|
|
57
|
-
:key="
|
|
58
|
+
:key="value || code || id"
|
|
58
59
|
:value="value || code || id"
|
|
59
60
|
:label="name"
|
|
60
61
|
/>
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
@change="(...args) => changeCb && changeCb(...args)"
|
|
66
67
|
:value="formData[prop]"
|
|
67
68
|
format="yyyy-MM-dd"
|
|
69
|
+
value-format="yyyy-MM-dd"
|
|
68
70
|
:type="dateType"
|
|
69
71
|
range-separator="到"
|
|
70
72
|
:placeholder="dateType == 'date' ? placeholder || '选择日期' : '选择日期范围'"
|
|
@@ -100,7 +102,7 @@
|
|
|
100
102
|
class="is-empty"
|
|
101
103
|
>
|
|
102
104
|
空白
|
|
103
|
-
</el-checkbox>
|
|
105
|
+
</el-checkbox>
|
|
104
106
|
</div>
|
|
105
107
|
<slot
|
|
106
108
|
v-if="type === 'slot'"
|
|
@@ -218,6 +220,7 @@ export default {
|
|
|
218
220
|
this.checkedIds[k] = false
|
|
219
221
|
})
|
|
220
222
|
this.$emit('update:formData', { ...this.formData, ...this.initialData })
|
|
223
|
+
this.$emit('clear')
|
|
221
224
|
},
|
|
222
225
|
|
|
223
226
|
handleFormClose () {
|
|
@@ -241,4 +244,4 @@ export default {
|
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
}
|
|
244
|
-
</style>
|
|
247
|
+
</style>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type BaseOption = {
|
|
2
|
+
label: string
|
|
3
|
+
prop: string
|
|
4
|
+
clearable?: boolean
|
|
5
|
+
placeholder?: string
|
|
6
|
+
key?: string
|
|
7
|
+
changeCb?: (value: any) => any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type SlotOption = Omit<BaseOption, 'prop'> & {
|
|
11
|
+
prop?: string
|
|
12
|
+
type: 'slot'
|
|
13
|
+
slotName: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type InputOption = BaseOption & {
|
|
17
|
+
type: 'input'
|
|
18
|
+
inputLimitCallback?: (value: string) => boolean
|
|
19
|
+
maxlength?: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type SelectOption = BaseOption & {
|
|
23
|
+
type: 'select'
|
|
24
|
+
multiple?: boolean
|
|
25
|
+
filterable?: boolean
|
|
26
|
+
multipleLimit?: number
|
|
27
|
+
collapseTags?: boolean
|
|
28
|
+
withoutAll?: boolean
|
|
29
|
+
candidate: {
|
|
30
|
+
name: string
|
|
31
|
+
value?: string | number
|
|
32
|
+
id?: string | number
|
|
33
|
+
code?: string | number
|
|
34
|
+
}[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type DatePickerOption = BaseOption & {
|
|
38
|
+
type: 'datePicker'
|
|
39
|
+
dateType?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type BaseDoubleOption = Omit<BaseOption, 'prop'> & {
|
|
43
|
+
doubleIsInline?: boolean
|
|
44
|
+
prop: [string, string]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type DoubleInputOption = BaseDoubleOption & {
|
|
48
|
+
type: 'doubleInput'
|
|
49
|
+
inputLimitCallback?: (value: string) => boolean
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type DoubleDatePickerOption = BaseDoubleOption & {
|
|
53
|
+
type: 'doubleDatePicker'
|
|
54
|
+
isEmpty?: boolean
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type SearchFormConfigOption =
|
|
58
|
+
| InputOption
|
|
59
|
+
| SelectOption
|
|
60
|
+
| DatePickerOption
|
|
61
|
+
| DoubleInputOption
|
|
62
|
+
| DoubleDatePickerOption
|
|
63
|
+
| SlotOption
|