@lx-frontend/wrap-element-ui 1.0.1-beta.6 → 1.0.1-beta.8
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 +1 -1
- package/src/components/EditableTable/bizHooks/index.ts +17 -0
- package/src/components/EditableTable/{useColumnHeaderOperation.ts → bizHooks/useColumnHeaderOperation.ts} +6 -6
- package/src/components/EditableTable/{useDefaultOperation.ts → bizHooks/useDefaultOperation.ts} +1 -1
- package/src/components/EditableTable/{useDragSort.ts → bizHooks/useDragSort.ts} +1 -1
- package/src/components/EditableTable/{usePagination.ts → bizHooks/usePagination.ts} +1 -1
- package/src/components/EditableTable/{useRowBgColor.ts → bizHooks/useRowBgColor.ts} +7 -7
- package/src/components/EditableTable/{useViewSetting.ts → bizHooks/useViewSetting.ts} +64 -65
- package/src/components/EditableTable/features/bizColorSelect.vue +63 -0
- package/src/components/EditableTable/features/bizEditCell.vue +44 -0
- package/src/components/EditableTable/features/bizTableHeaderPopover.vue +202 -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 +13 -4
- package/src/components/EditableTable/index.vue +90 -371
- package/src/components/EditableTable/{types.ts → types/index.ts} +116 -116
- package/src/components/EditableTable/viewColorSelect.vue +0 -65
- /package/src/components/EditableTable/{useCellHover.ts → bizHooks/useCellHover.ts} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-popover
|
|
3
|
+
ref="operationPopoverRef"
|
|
4
|
+
placement="bottom"
|
|
5
|
+
trigger="click"
|
|
6
|
+
popper-class="operation-popover"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
slot="reference"
|
|
10
|
+
class="operation-popover__operation-reference btn-pointer"
|
|
11
|
+
>
|
|
12
|
+
<el-button :class="['operation-popover__operation-btn', hoveringCellInfo.rowIndex === scope.$index && 'operation-popover__operation-btn--active']">
|
|
13
|
+
操作
|
|
14
|
+
</el-button>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="operation-popover__operation">
|
|
17
|
+
<div
|
|
18
|
+
v-if="defaultOperations.includes('delete')"
|
|
19
|
+
class="operation-popover__operation-item btn-pointer"
|
|
20
|
+
@click="() => emit('delete')"
|
|
21
|
+
>
|
|
22
|
+
删除
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
v-if="defaultOperations.includes('edit')"
|
|
26
|
+
class="operation-popover__operation-item btn-pointer"
|
|
27
|
+
@click="() => emit('edit')"
|
|
28
|
+
>
|
|
29
|
+
编辑
|
|
30
|
+
</div>
|
|
31
|
+
<div
|
|
32
|
+
v-if="defaultOperations.includes('top')"
|
|
33
|
+
class="operation-popover__operation-item btn-pointer"
|
|
34
|
+
@click="() => emit('rowPinToTop')"
|
|
35
|
+
>
|
|
36
|
+
置顶
|
|
37
|
+
</div>
|
|
38
|
+
<slot />
|
|
39
|
+
</div>
|
|
40
|
+
</el-popover>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { ref } from 'vue';
|
|
45
|
+
import { IDefaultOperationType } from '../types';
|
|
46
|
+
|
|
47
|
+
defineProps<{
|
|
48
|
+
defaultOperations: IDefaultOperationType[]
|
|
49
|
+
hoveringCellInfo: {
|
|
50
|
+
rowIndex: number
|
|
51
|
+
columnProperty: string
|
|
52
|
+
}
|
|
53
|
+
scope: any
|
|
54
|
+
}>()
|
|
55
|
+
|
|
56
|
+
const emit = defineEmits<{
|
|
57
|
+
(e: 'edit'): void
|
|
58
|
+
(e: 'delete'): void
|
|
59
|
+
(e: 'rowPinToTop'): void
|
|
60
|
+
}>()
|
|
61
|
+
|
|
62
|
+
const operationPopoverRef = ref(null as any)
|
|
63
|
+
|
|
64
|
+
defineExpose({
|
|
65
|
+
doClose: () => operationPopoverRef.value?.doClose?.()
|
|
66
|
+
})
|
|
67
|
+
</script>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
title="显示设置"
|
|
4
|
+
:visible.sync="viewSettingVisible"
|
|
5
|
+
width="750px"
|
|
6
|
+
top="12vh"
|
|
7
|
+
:close-on-click-modal="false"
|
|
8
|
+
append-to-body
|
|
9
|
+
custom-class="view-setting__dialog"
|
|
10
|
+
>
|
|
11
|
+
<div class="view-setting__content">
|
|
12
|
+
<div class="view-setting__content-left">
|
|
13
|
+
<div class="view-setting__checkbox-wrapper">
|
|
14
|
+
<el-checkbox-group v-model="columnsToBeShown">
|
|
15
|
+
<el-checkbox
|
|
16
|
+
v-for="item in props.columnConfig"
|
|
17
|
+
:key="item.label"
|
|
18
|
+
:label="item.prop"
|
|
19
|
+
:disabled="item.isAlwaysShow"
|
|
20
|
+
>
|
|
21
|
+
<div class="view-setting__content-left-item">
|
|
22
|
+
{{ item.label }}
|
|
23
|
+
</div>
|
|
24
|
+
</el-checkbox>
|
|
25
|
+
</el-checkbox-group>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="view-setting__content-right">
|
|
29
|
+
<div class="view-setting__content-right-title">
|
|
30
|
+
已选择
|
|
31
|
+
<div class="view-setting__selected-count">
|
|
32
|
+
{{ columnsToBeShown.length }}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div class="view-setting__content-right-frize">
|
|
36
|
+
冻结前
|
|
37
|
+
<el-input
|
|
38
|
+
class="view-setting__content-right-input"
|
|
39
|
+
:value="tempLeftFixedColumnCount"
|
|
40
|
+
@input="handleInputTempLeftFixedColumnCount"
|
|
41
|
+
/>
|
|
42
|
+
列
|
|
43
|
+
</div>
|
|
44
|
+
<div class="view-setting__content-right-selected">
|
|
45
|
+
<div
|
|
46
|
+
v-for="(item, index) in viewSettingDragSortOptions"
|
|
47
|
+
:key="item.prop"
|
|
48
|
+
class="view-setting__selected-item view-setting-draggable-item"
|
|
49
|
+
>
|
|
50
|
+
<div class="view-setting__selected-item-left">
|
|
51
|
+
<div
|
|
52
|
+
class="view-setting-drag-target view-setting__icon-wrapper"
|
|
53
|
+
:data-index="index"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
class="view-setting-drag-target editable-table-drag-icon"
|
|
57
|
+
:data-index="index"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="view-setting__selected-item-name">
|
|
61
|
+
{{ item.label }}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div
|
|
65
|
+
:class="['view-setting__selected-item-close', item.isAlwaysShow ? 'view-setting__selected-item-close--disabled' : '']"
|
|
66
|
+
@click="handleColumnClose(item)"
|
|
67
|
+
>
|
|
68
|
+
<i class="el-icon-close" />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<template #footer>
|
|
75
|
+
<el-button @click="handleViewSettingClose">
|
|
76
|
+
取消
|
|
77
|
+
</el-button>
|
|
78
|
+
<el-button
|
|
79
|
+
type="primary"
|
|
80
|
+
@click="handleViewSettingConfirm"
|
|
81
|
+
>
|
|
82
|
+
确认
|
|
83
|
+
</el-button>
|
|
84
|
+
</template>
|
|
85
|
+
</el-dialog>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script setup lang="ts">
|
|
89
|
+
import { toRefs } from 'vue';
|
|
90
|
+
import { useViewSetting } from '../bizHooks'
|
|
91
|
+
import { IColumnConfig, IProps } from '../types';
|
|
92
|
+
|
|
93
|
+
const emit = defineEmits<{
|
|
94
|
+
(e: 'update:leftFixedColumnCount', val: number): void
|
|
95
|
+
(e: 'update:showingColumns', val: string[]): void
|
|
96
|
+
(e: 'update:viewSettingDragSortOptions', val: IColumnConfig[]): void
|
|
97
|
+
(e: 'tableDoLayout'): void
|
|
98
|
+
}>()
|
|
99
|
+
|
|
100
|
+
const _props = defineProps<{
|
|
101
|
+
actualColumns: IColumnConfig[]
|
|
102
|
+
viewSettingDragSortOptions: IColumnConfig[]
|
|
103
|
+
showingColumns: string[]
|
|
104
|
+
props: IProps
|
|
105
|
+
}>()
|
|
106
|
+
|
|
107
|
+
const {
|
|
108
|
+
actualColumns,
|
|
109
|
+
showingColumns,
|
|
110
|
+
viewSettingDragSortOptions,
|
|
111
|
+
} = toRefs(_props)
|
|
112
|
+
|
|
113
|
+
const {
|
|
114
|
+
columnsToBeShown,
|
|
115
|
+
viewSettingVisible,
|
|
116
|
+
tempLeftFixedColumnCount,
|
|
117
|
+
handleInputTempLeftFixedColumnCount,
|
|
118
|
+
handleViewSettingShow,
|
|
119
|
+
handleViewSettingClose,
|
|
120
|
+
handleViewSettingConfirm
|
|
121
|
+
} = useViewSetting({
|
|
122
|
+
showingColumns,
|
|
123
|
+
actualColumns,
|
|
124
|
+
viewSettingDragSortOptions,
|
|
125
|
+
props: _props.props,
|
|
126
|
+
emit,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const handleColumnClose = (item) => {
|
|
130
|
+
if (item.isAlwaysShow) return;
|
|
131
|
+
columnsToBeShown.value = columnsToBeShown.value.filter(c => c !== item.prop);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
defineExpose({
|
|
135
|
+
open: handleViewSettingShow
|
|
136
|
+
})
|
|
137
|
+
</script>
|
|
@@ -198,13 +198,19 @@
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
& .cell {
|
|
201
|
-
font-size:
|
|
201
|
+
font-size: 12px;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
.el-table__fixed-body-wrapper {
|
|
206
206
|
background: #fff;
|
|
207
207
|
}
|
|
208
|
+
|
|
209
|
+
.el-checkbox__input.is-checked .el-checkbox__inner,
|
|
210
|
+
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
|
|
211
|
+
background: @--theme-blue--;
|
|
212
|
+
border-color: @--theme-blue--;
|
|
213
|
+
}
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
.view-setting {
|
|
@@ -525,8 +531,8 @@
|
|
|
525
531
|
|
|
526
532
|
.el-checkbox__input.is-checked .el-checkbox__inner,
|
|
527
533
|
.el-radio__input.is-checked .el-radio__inner {
|
|
528
|
-
background:
|
|
529
|
-
border-color:
|
|
534
|
+
background: @--theme-blue--;
|
|
535
|
+
border-color: @--theme-blue--;
|
|
530
536
|
}
|
|
531
537
|
}
|
|
532
538
|
|
|
@@ -642,7 +648,7 @@
|
|
|
642
648
|
|
|
643
649
|
.editable-table {
|
|
644
650
|
& table th {
|
|
645
|
-
font-size:
|
|
651
|
+
font-size: 12px;
|
|
646
652
|
font-weight: bold;
|
|
647
653
|
}
|
|
648
654
|
|
|
@@ -650,6 +656,9 @@
|
|
|
650
656
|
font-size: 12px;
|
|
651
657
|
color: #13161b;
|
|
652
658
|
}
|
|
659
|
+
.el-table th > .cell {
|
|
660
|
+
color: #5b6984
|
|
661
|
+
}
|
|
653
662
|
}
|
|
654
663
|
|
|
655
664
|
.no-inner-cell-border {
|