aloha-vue 1.2.158 → 1.2.160
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 +6 -1
- package/src/ATable/ATableGroupedHeader/ATableGroupedHeader.js +37 -5
- package/src/ATable/ATablePreviewRight/ATablePreviewRight.js +12 -3
- package/src/ATable/ATablePreviewRight/compositionAPI/ArrowsAPI.js +14 -8
- package/src/ATable/ATablePreviewRight/compositionAPI/RowAPI.js +41 -0
- package/src/ATable/ATableTr/compositionAPI/AttributesAPI.js +4 -1
- package/src/ATable/compositionAPI/RowsAPI.js +2 -1
package/package.json
CHANGED
package/src/ATable/ATable.js
CHANGED
|
@@ -54,6 +54,11 @@ export default {
|
|
|
54
54
|
required: false,
|
|
55
55
|
default: () => [],
|
|
56
56
|
},
|
|
57
|
+
clearSelectedRowsOnDataChange: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: true,
|
|
61
|
+
},
|
|
57
62
|
columnActionsWidth: {
|
|
58
63
|
type: Number,
|
|
59
64
|
required: false,
|
|
@@ -118,7 +123,6 @@ export default {
|
|
|
118
123
|
disabledPreviewRowCallback: {
|
|
119
124
|
type: Function,
|
|
120
125
|
required: false,
|
|
121
|
-
default: () => {},
|
|
122
126
|
},
|
|
123
127
|
disabledRowActions: {
|
|
124
128
|
type: Boolean,
|
|
@@ -1006,6 +1010,7 @@ export default {
|
|
|
1006
1010
|
previewStyles: this.previewStyles,
|
|
1007
1011
|
rowIndex: this.previewRightRowIndex,
|
|
1008
1012
|
rows: this.rowsLocalAll,
|
|
1013
|
+
disabledPreviewRowCallback: this.disabledPreviewRowCallback,
|
|
1009
1014
|
usePagination: !!this.usePaginationLocal,
|
|
1010
1015
|
onClosePreview: this.closePreview,
|
|
1011
1016
|
onMousedownResizePreviewRight: this.mousedownResizePreviewRight,
|
|
@@ -2,15 +2,13 @@ import {
|
|
|
2
2
|
h,
|
|
3
3
|
} from "vue";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import AOneCheckbox from "../../ui/AOneCheckbox/AOneCheckbox";
|
|
6
6
|
import ATableHeaderThAction from "../ATableHeaderThAction/ATableHeaderThAction";
|
|
7
7
|
|
|
8
|
+
import CheckboxAPI from "../ATableHeader/compositionAPI/CheckboxAPI";
|
|
9
|
+
|
|
8
10
|
export default {
|
|
9
11
|
name: "ATableGroupedHeader",
|
|
10
|
-
components: {
|
|
11
|
-
ATableHeaderTh,
|
|
12
|
-
ATableHeaderThAction,
|
|
13
|
-
},
|
|
14
12
|
props: {
|
|
15
13
|
areAllRowsSelected: {
|
|
16
14
|
type: Boolean,
|
|
@@ -75,6 +73,23 @@ export default {
|
|
|
75
73
|
"isMobile",
|
|
76
74
|
"isMultipleActionsActive",
|
|
77
75
|
],
|
|
76
|
+
setup(props, context) {
|
|
77
|
+
const {
|
|
78
|
+
isCheckboxDisabled,
|
|
79
|
+
isCheckboxIndeterminate,
|
|
80
|
+
labelCheckbox,
|
|
81
|
+
modelValueCheckboxLocal,
|
|
82
|
+
toggleCheckbox,
|
|
83
|
+
} = CheckboxAPI(props, context);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
isCheckboxDisabled,
|
|
87
|
+
isCheckboxIndeterminate,
|
|
88
|
+
labelCheckbox,
|
|
89
|
+
modelValueCheckboxLocal,
|
|
90
|
+
toggleCheckbox,
|
|
91
|
+
};
|
|
92
|
+
},
|
|
78
93
|
render() {
|
|
79
94
|
return h("div", {
|
|
80
95
|
ref: "root",
|
|
@@ -85,6 +100,23 @@ export default {
|
|
|
85
100
|
class: "a_table__row a_table__head__row",
|
|
86
101
|
role: "row",
|
|
87
102
|
}, [
|
|
103
|
+
this.isMultipleActionsActive && h("div", {
|
|
104
|
+
role: "columnheader",
|
|
105
|
+
class: "a_table__th a_table__cell a_table__cell_checkbox",
|
|
106
|
+
style: `width: 50px; min-width: 50px; max-width: 50px;`,
|
|
107
|
+
"aria-colindex": 1,
|
|
108
|
+
}, [
|
|
109
|
+
h(AOneCheckbox, {
|
|
110
|
+
isWidthAuto: true,
|
|
111
|
+
modelValue: this.modelValueCheckboxLocal,
|
|
112
|
+
indeterminate: this.isCheckboxIndeterminate,
|
|
113
|
+
disabled: this.isCheckboxDisabled,
|
|
114
|
+
label: this.labelCheckbox,
|
|
115
|
+
labelClass: "a_sr_only",
|
|
116
|
+
isLabelTitle: true,
|
|
117
|
+
"onUpdate:modelValue": this.toggleCheckbox,
|
|
118
|
+
}),
|
|
119
|
+
]),
|
|
88
120
|
this.columnsForRender,
|
|
89
121
|
this.isActionColumnVisible && h(ATableHeaderThAction, {
|
|
90
122
|
disabledOptions: this.disabledOptions,
|
|
@@ -24,6 +24,11 @@ export default {
|
|
|
24
24
|
type: Number,
|
|
25
25
|
required: true,
|
|
26
26
|
},
|
|
27
|
+
disabledPreviewRowCallback: {
|
|
28
|
+
type: Function,
|
|
29
|
+
required: false,
|
|
30
|
+
default: () => {},
|
|
31
|
+
},
|
|
27
32
|
isLoadingTable: {
|
|
28
33
|
type: Boolean,
|
|
29
34
|
required: false,
|
|
@@ -102,6 +107,8 @@ export default {
|
|
|
102
107
|
const {
|
|
103
108
|
countAllRowsFormatted,
|
|
104
109
|
currentRow,
|
|
110
|
+
nextAvailableRowIndex,
|
|
111
|
+
previousAvailableRowIndex,
|
|
105
112
|
rowNumber,
|
|
106
113
|
rowNumberFormatted,
|
|
107
114
|
} = RowAPI(props);
|
|
@@ -109,9 +116,11 @@ export default {
|
|
|
109
116
|
const {
|
|
110
117
|
disabledBtnArrowLeft,
|
|
111
118
|
disabledBtnArrowRight,
|
|
112
|
-
toLastRow,
|
|
113
119
|
toNextRow,
|
|
120
|
+
toPreviousRow,
|
|
114
121
|
} = ArrowsAPI(props, context, {
|
|
122
|
+
nextAvailableRowIndex,
|
|
123
|
+
previousAvailableRowIndex,
|
|
115
124
|
rowNumber,
|
|
116
125
|
});
|
|
117
126
|
|
|
@@ -146,8 +155,8 @@ export default {
|
|
|
146
155
|
previewRef,
|
|
147
156
|
rowNumber,
|
|
148
157
|
rowNumberFormatted,
|
|
149
|
-
toLastRow,
|
|
150
158
|
toNextRow,
|
|
159
|
+
toPreviousRow,
|
|
151
160
|
};
|
|
152
161
|
},
|
|
153
162
|
render() {
|
|
@@ -175,7 +184,7 @@ export default {
|
|
|
175
184
|
iconLeft: "ArrowLeft",
|
|
176
185
|
title: "_A_TABLE_PREVIEW_RIGHT_PREVIOUS_ROW_",
|
|
177
186
|
textScreenReader: "_A_TABLE_PREVIEW_RIGHT_PREVIOUS_ROW_",
|
|
178
|
-
onClick: this.
|
|
187
|
+
onClick: this.toPreviousRow,
|
|
179
188
|
}),
|
|
180
189
|
h(AButton, {
|
|
181
190
|
class: "a_btn a_btn_transparent_dark a_btn_small",
|
|
@@ -3,7 +3,13 @@ import {
|
|
|
3
3
|
toRef,
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
|
+
import {
|
|
7
|
+
isNil,
|
|
8
|
+
} from "lodash-es";
|
|
9
|
+
|
|
6
10
|
export default function ArrowsAPI(props, { emit }, {
|
|
11
|
+
nextAvailableRowIndex,
|
|
12
|
+
previousAvailableRowIndex,
|
|
7
13
|
rowNumber = computed(() => 0),
|
|
8
14
|
}) {
|
|
9
15
|
const countAllRows = toRef(props, "countAllRows");
|
|
@@ -13,14 +19,14 @@ export default function ArrowsAPI(props, { emit }, {
|
|
|
13
19
|
const usePagination = toRef(props, "usePagination");
|
|
14
20
|
|
|
15
21
|
const disabledBtnArrowLeft = computed(() => {
|
|
16
|
-
return rowNumber.value <= 1;
|
|
22
|
+
return rowNumber.value <= 1 || isNil(previousAvailableRowIndex.value);
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
const disabledBtnArrowRight = computed(() => {
|
|
20
|
-
return rowNumber.value >= countAllRows.value;
|
|
26
|
+
return rowNumber.value >= countAllRows.value || isNil(nextAvailableRowIndex.value);
|
|
21
27
|
});
|
|
22
28
|
|
|
23
|
-
const
|
|
29
|
+
const toPreviousRow = () => {
|
|
24
30
|
if (disabledBtnArrowLeft.value) {
|
|
25
31
|
return;
|
|
26
32
|
}
|
|
@@ -30,10 +36,10 @@ export default function ArrowsAPI(props, { emit }, {
|
|
|
30
36
|
emit("update:offset", { offset: offsetPagination.value - limitPagination.value, reload: false });
|
|
31
37
|
emit("togglePreview", { rowIndex: limitPagination.value - 1 });
|
|
32
38
|
} else {
|
|
33
|
-
emit("togglePreview", { rowIndex:
|
|
39
|
+
emit("togglePreview", { rowIndex: previousAvailableRowIndex.value });
|
|
34
40
|
}
|
|
35
41
|
} else {
|
|
36
|
-
emit("togglePreview", { rowIndex:
|
|
42
|
+
emit("togglePreview", { rowIndex: previousAvailableRowIndex.value });
|
|
37
43
|
}
|
|
38
44
|
};
|
|
39
45
|
|
|
@@ -47,17 +53,17 @@ export default function ArrowsAPI(props, { emit }, {
|
|
|
47
53
|
emit("update:offset", { offset: offsetPagination.value + limitPagination.value, reload: false });
|
|
48
54
|
emit("togglePreview", { rowIndex: 0 });
|
|
49
55
|
} else {
|
|
50
|
-
emit("togglePreview", { rowIndex:
|
|
56
|
+
emit("togglePreview", { rowIndex: nextAvailableRowIndex.value });
|
|
51
57
|
}
|
|
52
58
|
} else {
|
|
53
|
-
emit("togglePreview", { rowIndex:
|
|
59
|
+
emit("togglePreview", { rowIndex: nextAvailableRowIndex.value });
|
|
54
60
|
}
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
return {
|
|
58
64
|
disabledBtnArrowLeft,
|
|
59
65
|
disabledBtnArrowRight,
|
|
60
|
-
toLastRow,
|
|
61
66
|
toNextRow,
|
|
67
|
+
toPreviousRow,
|
|
62
68
|
};
|
|
63
69
|
}
|
|
@@ -5,8 +5,13 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import AFiltersAPI from "../../../compositionAPI/AFiltersAPI";
|
|
7
7
|
|
|
8
|
+
import {
|
|
9
|
+
isFunction,
|
|
10
|
+
} from "lodash-es";
|
|
11
|
+
|
|
8
12
|
export default function RowAPI(props) {
|
|
9
13
|
const countAllRows = toRef(props, "countAllRows");
|
|
14
|
+
const disabledPreviewRowCallback = toRef(props, "disabledPreviewRowCallback");
|
|
10
15
|
const offsetPagination = toRef(props, "offsetPagination");
|
|
11
16
|
const rowIndex = toRef(props, "rowIndex");
|
|
12
17
|
const rows = toRef(props, "rows");
|
|
@@ -27,6 +32,40 @@ export default function RowAPI(props) {
|
|
|
27
32
|
const currentRow = computed(() => {
|
|
28
33
|
return rows.value[rowIndex.value];
|
|
29
34
|
});
|
|
35
|
+
const nextAvailableRowIndex = computed(() => {
|
|
36
|
+
let nextIndex = null;
|
|
37
|
+
if (!isFunction(disabledPreviewRowCallback.value)) {
|
|
38
|
+
nextIndex = rowIndex.value === rows.value.length - 1 ? null : rowIndex.value++;
|
|
39
|
+
} else {
|
|
40
|
+
for (let index = rowIndex.value + 1; index < rows.value.length; index++) {
|
|
41
|
+
const ROW = rows.value[index];
|
|
42
|
+
|
|
43
|
+
if (!disabledPreviewRowCallback.value({ row: ROW, rowIndex: index })) {
|
|
44
|
+
nextIndex = index;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return nextIndex;
|
|
51
|
+
});
|
|
52
|
+
const previousAvailableRowIndex = computed(() => {
|
|
53
|
+
let prevIndex = null;
|
|
54
|
+
if (!isFunction(disabledPreviewRowCallback.value)) {
|
|
55
|
+
prevIndex = rowIndex.value === 0 ? null : rowIndex.value--;
|
|
56
|
+
} else {
|
|
57
|
+
for (let index = rowIndex.value - 1; index >= 0; index--) {
|
|
58
|
+
const ROW = rows.value[index];
|
|
59
|
+
|
|
60
|
+
if (!disabledPreviewRowCallback.value({ row: ROW, rowIndex: index })) {
|
|
61
|
+
prevIndex = index;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return prevIndex;
|
|
68
|
+
});
|
|
30
69
|
|
|
31
70
|
const countAllRowsFormatted = computed(() => {
|
|
32
71
|
return filterCurrency(countAllRows.value, { suffix: "", digits: 0 });
|
|
@@ -39,6 +78,8 @@ export default function RowAPI(props) {
|
|
|
39
78
|
return {
|
|
40
79
|
countAllRowsFormatted,
|
|
41
80
|
currentRow,
|
|
81
|
+
nextAvailableRowIndex,
|
|
82
|
+
previousAvailableRowIndex,
|
|
42
83
|
rowNumber,
|
|
43
84
|
rowNumberFormatted,
|
|
44
85
|
};
|
|
@@ -61,7 +61,10 @@ export default function AttributesAPI(props, {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
const disabledPreviewRow = computed(() => {
|
|
64
|
-
|
|
64
|
+
if (isFunction(disabledPreviewRowCallback.value)) {
|
|
65
|
+
return disabledPreviewRowCallback.value({ row: row.value, rowIndex: rowIndex.value });
|
|
66
|
+
}
|
|
67
|
+
return disabledPreview.value;
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
const onClickRow = $event => {
|
|
@@ -17,6 +17,7 @@ export default function RowsAPI(props, {
|
|
|
17
17
|
setEmptySelectedRowsIndexes = () => {},
|
|
18
18
|
usePaginationLocal = computed(() => false),
|
|
19
19
|
}) {
|
|
20
|
+
const clearSelectedRowsOnDataChange = toRef(props, "clearSelectedRowsOnDataChange");
|
|
20
21
|
const pagination = toRef(props, "pagination");
|
|
21
22
|
const rowsCountRenderPerTick = toRef(props, "rowsCountRenderPerTick");
|
|
22
23
|
|
|
@@ -88,7 +89,7 @@ export default function RowsAPI(props, {
|
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
prevDataPaginated.value = [...newValue];
|
|
91
|
-
if (!firstLoad) {
|
|
92
|
+
if (!firstLoad && clearSelectedRowsOnDataChange.value) {
|
|
92
93
|
setEmptySelectedRowsIndexes();
|
|
93
94
|
}
|
|
94
95
|
firstLoad = false;
|