aloha-vue 1.2.101 → 1.2.103
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/ATable/ATable.js +2 -0
- package/src/ATable/ATableHeader/ATableHeader.js +2 -1
- package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +1 -0
- package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +1 -0
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +1 -0
- package/src/ATable/ATableTr/ATableTr.js +3 -0
- package/src/ATable/compositionAPI/ColumnsAPI.js +24 -6
- package/src/ATable/compositionAPI/ColumnsOrderingAPI.js +7 -1
- package/src/ATable/compositionAPI/DragAndDropChildAPI.js +11 -4
- package/src/ATable/compositionAPI/DragAndDropParentAPI.js +2 -0
- package/src/styles/components/ATable.scss +36 -56
package/package.json
CHANGED
package/src/ATable/ATable.js
CHANGED
|
@@ -407,6 +407,7 @@ export default {
|
|
|
407
407
|
const {
|
|
408
408
|
columnIdsGroupByLocked,
|
|
409
409
|
columnsFilteredForRender,
|
|
410
|
+
columnsFilteredForRenderIndexesMapping,
|
|
410
411
|
columnsOrdered,
|
|
411
412
|
countNotHiddenColumns,
|
|
412
413
|
} = ColumnsAPI(props, {
|
|
@@ -462,6 +463,7 @@ export default {
|
|
|
462
463
|
} = ColumnsOrderingAPI(props, context, {
|
|
463
464
|
checkVisibleColumns,
|
|
464
465
|
columnIdsGroupByLocked,
|
|
466
|
+
columnsFilteredForRenderIndexesMapping,
|
|
465
467
|
});
|
|
466
468
|
|
|
467
469
|
const {
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from "../utils/utils.js";
|
|
10
10
|
import {
|
|
11
11
|
cloneDeep,
|
|
12
|
-
filter,
|
|
13
12
|
forEach,
|
|
14
13
|
keyBy,
|
|
15
14
|
} from "lodash-es";
|
|
@@ -68,17 +67,35 @@ export default function ColumnsAPI(props, {
|
|
|
68
67
|
return COLUMNS;
|
|
69
68
|
});
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
const columnsFilteredForRenderObj = computed(() => {
|
|
71
|
+
const COLUMNS = [];
|
|
72
|
+
const COLUMNS_INDEXES_MAPPING = {};
|
|
73
|
+
forEach(columnsOrdered.value, (column, columnIndex) => {
|
|
74
|
+
if (isColumnVisible({
|
|
75
75
|
column,
|
|
76
76
|
columnIndex,
|
|
77
77
|
modelIsTableWithoutScroll: modelIsTableWithoutScroll.value,
|
|
78
78
|
modelColumnsVisibleLocal: modelColumnsVisibleLocal.value,
|
|
79
79
|
indexFirstScrollInvisibleColumn: indexFirstScrollInvisibleColumn.value,
|
|
80
|
-
})
|
|
80
|
+
})) {
|
|
81
|
+
COLUMNS_INDEXES_MAPPING[COLUMNS.length] = columnIndex;
|
|
82
|
+
COLUMNS.push(column);
|
|
83
|
+
}
|
|
81
84
|
});
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
columns: COLUMNS,
|
|
88
|
+
columnsIndexesMapping: COLUMNS_INDEXES_MAPPING,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const columnsFilteredForRenderIndexesMapping = computed(() => {
|
|
93
|
+
return columnsFilteredForRenderObj.value.columnsIndexesMapping;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
const columnsFilteredForRender = computed(() => {
|
|
98
|
+
return columnsFilteredForRenderObj.value.columns;
|
|
82
99
|
});
|
|
83
100
|
|
|
84
101
|
const countNotHiddenColumns = computed(() => {
|
|
@@ -98,6 +115,7 @@ export default function ColumnsAPI(props, {
|
|
|
98
115
|
return {
|
|
99
116
|
columnIdsGroupByLocked,
|
|
100
117
|
columnsFilteredForRender,
|
|
118
|
+
columnsFilteredForRenderIndexesMapping,
|
|
101
119
|
columnsOrdered,
|
|
102
120
|
countNotHiddenColumns,
|
|
103
121
|
};
|
|
@@ -20,14 +20,20 @@ export default function ColumnsOrderingAPI(props, { emit }, {
|
|
|
20
20
|
trueColumns: [],
|
|
21
21
|
falseColumns: [],
|
|
22
22
|
})),
|
|
23
|
+
columnsFilteredForRenderIndexesMapping = computed(() => ({})),
|
|
23
24
|
}) {
|
|
24
25
|
const columns = toRef(props, "columns");
|
|
25
26
|
const modelColumnsOrdering = toRef(props, "modelColumnsOrdering");
|
|
26
27
|
|
|
27
|
-
const changeColumnsOrdering = ({ columnIndexDraggable, columnIndexOver, reset }) => {
|
|
28
|
+
const changeColumnsOrdering = ({ columnIndexDraggable, columnIndexOver, reset, inHeader }) => {
|
|
28
29
|
if (columnIndexDraggable === columnIndexOver && !reset) {
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
32
|
+
// Not all columns may be shown, so the order may be out of order
|
|
33
|
+
if (inHeader) {
|
|
34
|
+
columnIndexDraggable = columnsFilteredForRenderIndexesMapping.value[columnIndexDraggable];
|
|
35
|
+
columnIndexOver = columnsFilteredForRenderIndexesMapping.value[columnIndexOver];
|
|
36
|
+
}
|
|
31
37
|
let modelColumnsOrderingLocal = [];
|
|
32
38
|
if (reset) {
|
|
33
39
|
modelColumnsOrderingLocal = [...columnIdsGroupByLocked.value.true, ...columnIdsGroupByLocked.value.false];
|
|
@@ -5,8 +5,11 @@ import {
|
|
|
5
5
|
toRef,
|
|
6
6
|
} from "vue";
|
|
7
7
|
|
|
8
|
+
const CLASS_DRAG = "a_table__drag_element";
|
|
9
|
+
|
|
8
10
|
export default function DragAndDropChildAPI(props, { emit }, {
|
|
9
11
|
classOverString = "",
|
|
12
|
+
inDropdown = false,
|
|
10
13
|
}) {
|
|
11
14
|
const column = toRef(props, "column");
|
|
12
15
|
const columnIndex = toRef(props, "columnIndex");
|
|
@@ -25,7 +28,11 @@ export default function DragAndDropChildAPI(props, { emit }, {
|
|
|
25
28
|
});
|
|
26
29
|
|
|
27
30
|
const dragstart = $event => {
|
|
28
|
-
$event.target.
|
|
31
|
+
$event.target?.classList.add(CLASS_DRAG);
|
|
32
|
+
if (inDropdown) {
|
|
33
|
+
const HEIGHT = $event.target?.offsetHeight || 30;
|
|
34
|
+
$event.target?.parentElement.style.setProperty("--a_table_draggable_li_height", `${ HEIGHT }px`);
|
|
35
|
+
}
|
|
29
36
|
$event.dataTransfer.effectAllowed = "move";
|
|
30
37
|
emit("dragstartParent", {
|
|
31
38
|
columnIndex: columnIndex.value,
|
|
@@ -33,8 +40,8 @@ export default function DragAndDropChildAPI(props, { emit }, {
|
|
|
33
40
|
};
|
|
34
41
|
|
|
35
42
|
const dragend = $event => {
|
|
36
|
-
$event.target.
|
|
37
|
-
$event.target
|
|
43
|
+
$event.target?.classList.remove(classOver.value);
|
|
44
|
+
$event.target?.classList.remove(CLASS_DRAG);
|
|
38
45
|
emit("dragendParent");
|
|
39
46
|
};
|
|
40
47
|
|
|
@@ -55,7 +62,7 @@ export default function DragAndDropChildAPI(props, { emit }, {
|
|
|
55
62
|
};
|
|
56
63
|
|
|
57
64
|
const dragleave = () => {
|
|
58
|
-
if (root.value && root.value) {
|
|
65
|
+
if (root.value && root.value.classList) {
|
|
59
66
|
root.value.classList.remove(classOver.value);
|
|
60
67
|
}
|
|
61
68
|
emit("dragleaveParent", {
|
|
@@ -13,6 +13,7 @@ export default function DragAndDropParentAPI({
|
|
|
13
13
|
classOver = "",
|
|
14
14
|
classOverRight = "",
|
|
15
15
|
classOverParent = "",
|
|
16
|
+
inHeader = false,
|
|
16
17
|
}) {
|
|
17
18
|
const root = ref(undefined);
|
|
18
19
|
const columnIndexDraggable = ref(undefined);
|
|
@@ -45,6 +46,7 @@ export default function DragAndDropParentAPI({
|
|
|
45
46
|
changeColumnsOrdering({
|
|
46
47
|
columnIndexDraggable: columnIndexDraggable.value,
|
|
47
48
|
columnIndexOver: columnIndexOver.value,
|
|
49
|
+
inHeader,
|
|
48
50
|
});
|
|
49
51
|
$event.stopPropagation();
|
|
50
52
|
return false;
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
--a_table_multiple_items_selected_bg: var(--a_table_row_preview_was_open_bg);
|
|
45
45
|
--a_table_sort_sequence_num_bg: var(--a_color_primary);
|
|
46
46
|
--a_table_sort_sequence_num_color: var(--a_color_white);
|
|
47
|
+
--a_table_dnd_th_bg: var(--a_color_gray_500);
|
|
48
|
+
--a_table_dnd_th_width: 50px;
|
|
47
49
|
|
|
48
50
|
width: 100%;
|
|
49
51
|
overflow-x: hidden;
|
|
@@ -83,6 +85,7 @@
|
|
|
83
85
|
|
|
84
86
|
.a_table__cell__child {
|
|
85
87
|
width: 100%;
|
|
88
|
+
overflow-x: auto;
|
|
86
89
|
}
|
|
87
90
|
.a_table__cell_checkbox {
|
|
88
91
|
--a_table_cell_padding_x: 0;
|
|
@@ -126,8 +129,13 @@
|
|
|
126
129
|
align-items: center;
|
|
127
130
|
position: relative;
|
|
128
131
|
background-color: inherit;
|
|
132
|
+
padding: 0;
|
|
133
|
+
.a_table__cell__child {
|
|
134
|
+
padding: var(--a_table_cell_padding_y) var(--a_table_cell_padding_x);
|
|
135
|
+
}
|
|
129
136
|
&.a_table__cell_action {
|
|
130
137
|
background-color: inherit;
|
|
138
|
+
padding: var(--a_table_cell_padding_y) var(--a_table_cell_padding_x);
|
|
131
139
|
}
|
|
132
140
|
+ .a_table__th {
|
|
133
141
|
border-left: var(--a_table_th_border_left_width) solid var(--a_table_th_border_left_color);
|
|
@@ -155,41 +163,29 @@
|
|
|
155
163
|
cursor: move;
|
|
156
164
|
}
|
|
157
165
|
.a_table__th_over {
|
|
158
|
-
border-left: 6px solid var(--a_table_draggable_color);
|
|
159
166
|
position: relative;
|
|
160
|
-
&:before,
|
|
161
|
-
&:after {
|
|
162
|
-
content: "";
|
|
163
|
-
position: absolute;
|
|
164
|
-
left: -15px;
|
|
165
|
-
border: 12px solid transparent;
|
|
166
|
-
}
|
|
167
167
|
&:before {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
border-bottom: 15px solid var(--a_table_draggable_color);
|
|
168
|
+
content: "";
|
|
169
|
+
display: block;
|
|
170
|
+
width: var(--a_table_dnd_th_width);
|
|
171
|
+
height: 100%;
|
|
172
|
+
background-color: var(--a_table_dnd_th_bg);
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
.a_table__th_over_right {
|
|
177
|
-
border-right: 6px solid var(--a_table_draggable_color);
|
|
178
|
-
position: relative;
|
|
179
|
-
&:before,
|
|
180
176
|
&:after {
|
|
181
177
|
content: "";
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
&:before {
|
|
187
|
-
top: 0;
|
|
188
|
-
border-top: 15px solid var(--a_table_draggable_color);
|
|
178
|
+
display: block;
|
|
179
|
+
width: var(--a_table_dnd_th_width);
|
|
180
|
+
height: 100%;
|
|
181
|
+
background-color: var(--a_table_dnd_th_bg);
|
|
189
182
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
183
|
+
}
|
|
184
|
+
.a_table__th,
|
|
185
|
+
.a_table__th__dropdown__li {
|
|
186
|
+
.a_sr_only,
|
|
187
|
+
.a_sr_only_focusable:not(:focus):not(:focus-within) {
|
|
188
|
+
position: absolute !important;
|
|
193
189
|
}
|
|
194
190
|
}
|
|
195
191
|
|
|
@@ -203,41 +199,19 @@
|
|
|
203
199
|
}
|
|
204
200
|
|
|
205
201
|
.a_table__th__dropdown__li_over {
|
|
206
|
-
border-top: 6px solid var(--a_table_draggable_color);
|
|
207
|
-
position: relative;
|
|
208
|
-
&:before,
|
|
209
|
-
&:after {
|
|
210
|
-
content: "";
|
|
211
|
-
position: absolute;
|
|
212
|
-
top: -15px;
|
|
213
|
-
border: 12px solid transparent;
|
|
214
|
-
}
|
|
215
202
|
&:before {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
right: 0;
|
|
221
|
-
border-right: 15px solid var(--a_table_draggable_color);
|
|
203
|
+
content: "";
|
|
204
|
+
display: block;
|
|
205
|
+
height: var(--a_table_draggable_li_height);
|
|
206
|
+
background-color: var(--a_table_dnd_dropdown_li_bg);
|
|
222
207
|
}
|
|
223
208
|
}
|
|
224
209
|
.a_table__th__dropdown__li_over_right {
|
|
225
|
-
border-bottom: 6px solid var(--a_table_draggable_color);
|
|
226
|
-
position: relative;
|
|
227
|
-
&:before,
|
|
228
210
|
&:after {
|
|
229
211
|
content: "";
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
&:before {
|
|
235
|
-
left: 0;
|
|
236
|
-
border-left: 15px solid var(--a_table_draggable_color);
|
|
237
|
-
}
|
|
238
|
-
&:after {
|
|
239
|
-
right: 0;
|
|
240
|
-
border-right: 15px solid var(--a_table_draggable_color);
|
|
212
|
+
display: block;
|
|
213
|
+
height: var(--a_table_draggable_li_height);
|
|
214
|
+
background-color: var(--a_table_dnd_dropdown_li_bg);
|
|
241
215
|
}
|
|
242
216
|
}
|
|
243
217
|
|
|
@@ -366,11 +340,17 @@
|
|
|
366
340
|
|
|
367
341
|
.a_table__th__dropdown__ul {
|
|
368
342
|
--a_table_draggable_color: var(--a_color_primary);
|
|
343
|
+
--a_table_dnd_dropdown_li_bg: var(--a_color_gray_200);
|
|
344
|
+
--a_table_draggable_li_height: 30px;
|
|
369
345
|
|
|
346
|
+
position: relative;
|
|
370
347
|
list-style: none;
|
|
371
348
|
margin: 0;
|
|
372
349
|
padding: 0;
|
|
373
350
|
}
|
|
351
|
+
.a_table__drag_element {
|
|
352
|
+
opacity: 0.4;
|
|
353
|
+
}
|
|
374
354
|
.a_table__th__dropdown__ul_dragstart .a_table__th__dropdown__li > * {
|
|
375
355
|
pointer-events: none;
|
|
376
356
|
}
|