aloha-vue 1.2.165 → 1.2.166
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/docs/src/views/PageTable/PageTableComplex/PageTableComplexExample/PageTableComplexExample.js +3 -3
- package/docs/src/views/PageTable/PageTableComplex/PageTableComplexSlotRowActions/PageTableComplexSlotRowActions.js +0 -1
- package/docs/src/views/PageTable/PageTableComplex/PageTableComplexSlotRowActions/PageTableComplexSlotRowActions.pug +2 -0
- package/package.json +1 -1
- package/src/AGroupButtonDropdown/AGroupButtonDropdown.js +6 -0
- package/src/AGroupButtonDropdown/AGroupButtonDropdownItem/AGroupButtonDropdownItem.js +8 -0
- package/src/ATable/ATable.js +44 -4
- package/src/ATable/ATableHeaderThAction/compositionAPI/StylesThTdAction.js +2 -2
- package/src/ATable/ATableTdAction/ATableTdAction.js +56 -18
- package/src/ATable/ATableTr/ATableTr.js +13 -0
- package/src/ATable/compositionAPI/ColumnActionAPI.js +102 -0
- package/src/ATable/compositionAPI/RowActionsAPI.js +25 -16
- package/src/ATable/compositionAPI/ScrollControlAPI.js +2 -2
- package/src/ATable/utils/utils.js +16 -1
- package/src/styles/components/ATable.scss +3 -0
package/docs/src/views/PageTable/PageTableComplex/PageTableComplexExample/PageTableComplexExample.js
CHANGED
|
@@ -173,15 +173,15 @@ export default {
|
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
type: "button",
|
|
176
|
-
text: "Click me",
|
|
177
|
-
title: "Click me title",
|
|
176
|
+
text: "Click me Click me Click me Click me",
|
|
178
177
|
isHidden: false,
|
|
179
178
|
callback: this.clickMe,
|
|
180
|
-
class: "aloha a_dropdown__item",
|
|
181
179
|
disabled: false,
|
|
182
180
|
extraCallback: ({ row }) => ({
|
|
183
181
|
aloha: row.aloha,
|
|
184
182
|
}),
|
|
183
|
+
iconLeft: "Export",
|
|
184
|
+
isHiddenCallback: ({ rowIndex }) => rowIndex > 5,
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
187
|
type: "divider",
|
|
@@ -3,6 +3,7 @@ aloha-example(
|
|
|
3
3
|
:code-js="codeJs"
|
|
4
4
|
header="_A_TABLE_GROUP_COMPLEX_HEADER_"
|
|
5
5
|
description="_A_TABLE_GROUP_COMPLEX_DESCRIPTION_"
|
|
6
|
+
:props="['dropdown']"
|
|
6
7
|
)
|
|
7
8
|
div
|
|
8
9
|
div
|
|
@@ -11,6 +12,7 @@ aloha-example(
|
|
|
11
12
|
)
|
|
12
13
|
a-table(
|
|
13
14
|
ref="aloha"
|
|
15
|
+
column-actions-view="dropdown"
|
|
14
16
|
:column-actions-width="250"
|
|
15
17
|
:column-actions-width-min="150"
|
|
16
18
|
:columns="columns"
|
package/package.json
CHANGED
|
@@ -23,6 +23,11 @@ export default {
|
|
|
23
23
|
required: false,
|
|
24
24
|
default: () => groupButtonDropdownPluginOptions.value.propsDefault.actionsClasses,
|
|
25
25
|
},
|
|
26
|
+
actionsIds: {
|
|
27
|
+
type: Array,
|
|
28
|
+
required: false,
|
|
29
|
+
default: () => [],
|
|
30
|
+
},
|
|
26
31
|
disabled: {
|
|
27
32
|
type: Boolean,
|
|
28
33
|
required: false,
|
|
@@ -96,6 +101,7 @@ export default {
|
|
|
96
101
|
hasDropdownActions: this.hasDropdownActions,
|
|
97
102
|
dropdownAttributes: this.dropdownAttributes,
|
|
98
103
|
actionsClasses: this.actionsClasses,
|
|
104
|
+
actionsIds: this.actionsIds,
|
|
99
105
|
isLast: itemIndex === this.actionsGrouped.buttons.length - 1,
|
|
100
106
|
hasDividerBeforeDropdown: this.hasDividerBeforeDropdown,
|
|
101
107
|
}, this.$slots);
|
|
@@ -15,6 +15,10 @@ export default {
|
|
|
15
15
|
type: Array,
|
|
16
16
|
required: true,
|
|
17
17
|
},
|
|
18
|
+
actionsIds: {
|
|
19
|
+
type: Array,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
18
22
|
actionsDropdown: {
|
|
19
23
|
type: Array,
|
|
20
24
|
required: true,
|
|
@@ -62,10 +66,12 @@ export default {
|
|
|
62
66
|
}, [
|
|
63
67
|
...this.data.children.map(action => {
|
|
64
68
|
const CLASS = action.classButton ? action.classButton : this.actionsClasses[action.actionNotDividerIndex];
|
|
69
|
+
const ID = action.id ? action.id : this.actionsIds[action.actionNotDividerIndex];
|
|
65
70
|
const DISABLED = this.disabled || action.disabled;
|
|
66
71
|
if (action.type === "button") {
|
|
67
72
|
return h(AButton, {
|
|
68
73
|
...action,
|
|
74
|
+
id: ID,
|
|
69
75
|
class: CLASS,
|
|
70
76
|
classButton: undefined,
|
|
71
77
|
disabled: DISABLED,
|
|
@@ -78,6 +84,7 @@ export default {
|
|
|
78
84
|
if (action.type === "link") {
|
|
79
85
|
return h(ALink, {
|
|
80
86
|
...action,
|
|
87
|
+
id: ID,
|
|
81
88
|
classButton: undefined,
|
|
82
89
|
disabled: DISABLED,
|
|
83
90
|
class: CLASS,
|
|
@@ -90,6 +97,7 @@ export default {
|
|
|
90
97
|
action.slotName &&
|
|
91
98
|
this.$slots[action.slotName]) {
|
|
92
99
|
return this.$slots[action.slotName]({
|
|
100
|
+
id: ID,
|
|
93
101
|
class: CLASS,
|
|
94
102
|
action: action,
|
|
95
103
|
});
|
package/src/ATable/ATable.js
CHANGED
|
@@ -15,6 +15,7 @@ import ATableTopPanel from "./ATableTopPanel/ATableTopPanel";
|
|
|
15
15
|
import ATableTr from "./ATableTr/ATableTr";
|
|
16
16
|
import ATranslation from "../ATranslation/ATranslation";
|
|
17
17
|
|
|
18
|
+
import ColumnActionAPI from "./compositionAPI/ColumnActionAPI";
|
|
18
19
|
import ColumnsAPI from "./compositionAPI/ColumnsAPI";
|
|
19
20
|
import ColumnsGroupedAPI from "./compositionAPI/ColumnsGroupedAPI";
|
|
20
21
|
import ColumnsOrderingAPI from "./compositionAPI/ColumnsOrderingAPI";
|
|
@@ -65,12 +66,29 @@ export default {
|
|
|
65
66
|
columnActionsWidth: {
|
|
66
67
|
type: Number,
|
|
67
68
|
required: false,
|
|
68
|
-
default:
|
|
69
|
+
default: undefined,
|
|
70
|
+
},
|
|
71
|
+
columnActionsWidthDefaults: {
|
|
72
|
+
type: Object,
|
|
73
|
+
required: false,
|
|
74
|
+
default: () => ({
|
|
75
|
+
default: 170,
|
|
76
|
+
min: 50,
|
|
77
|
+
onePlusDropdown: 320,
|
|
78
|
+
onePlusDropdownMin: 200,
|
|
79
|
+
btnGroupMaxWidth: 180,
|
|
80
|
+
}),
|
|
69
81
|
},
|
|
70
82
|
columnActionsWidthMin: {
|
|
71
83
|
type: Number,
|
|
72
84
|
required: false,
|
|
73
|
-
default:
|
|
85
|
+
default: undefined,
|
|
86
|
+
},
|
|
87
|
+
columnActionsView: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: false,
|
|
90
|
+
default: "dropdown",
|
|
91
|
+
validator: value => ["onePlusDropdown", "onePlusDropdownEmptyPlace", "dropdown"].indexOf(value) !== -1,
|
|
74
92
|
},
|
|
75
93
|
columns: {
|
|
76
94
|
type: Array,
|
|
@@ -444,8 +462,6 @@ export default {
|
|
|
444
462
|
provide() {
|
|
445
463
|
return {
|
|
446
464
|
changeModelColumnsVisible: this.changeModelColumnsVisible,
|
|
447
|
-
columnActionsWidthLocal: computed(() => this.columnActionsWidth),
|
|
448
|
-
columnActionsWidthMin: computed(() => this.columnActionsWidthMin),
|
|
449
465
|
columns: computed(() => this.columns),
|
|
450
466
|
columnsDefaultValue: computed(() => this.columnsDefaultValue),
|
|
451
467
|
columnWidthDefault: computed(() => this.columnWidthDefault),
|
|
@@ -558,6 +574,15 @@ export default {
|
|
|
558
574
|
usePaginationLocal,
|
|
559
575
|
});
|
|
560
576
|
|
|
577
|
+
const {
|
|
578
|
+
columnActionsBtnGroupMaxWidthStyle,
|
|
579
|
+
columnActionsWidthLocal,
|
|
580
|
+
columnActionsWidthMinLocal,
|
|
581
|
+
isColumnActionWide,
|
|
582
|
+
} = ColumnActionAPI(props, {
|
|
583
|
+
rowsLocal,
|
|
584
|
+
});
|
|
585
|
+
|
|
561
586
|
const {
|
|
562
587
|
aTableRef,
|
|
563
588
|
changeModelIsTableWithoutScroll,
|
|
@@ -565,6 +590,8 @@ export default {
|
|
|
565
590
|
columnsVisibleAdditionalSpaceForOneGrow,
|
|
566
591
|
onWatchMobileScrollControl,
|
|
567
592
|
} = ScrollControlAPI(props, context, {
|
|
593
|
+
columnActionsWidth: columnActionsWidthLocal,
|
|
594
|
+
columnActionsWidthMin: columnActionsWidthMinLocal,
|
|
568
595
|
columnsOrdered,
|
|
569
596
|
columnsScrollInvisible,
|
|
570
597
|
indexFirstScrollInvisibleColumn,
|
|
@@ -686,12 +713,20 @@ export default {
|
|
|
686
713
|
closePreviewAll();
|
|
687
714
|
});
|
|
688
715
|
|
|
716
|
+
watch(isColumnActionWide, (newValue, oldValue) => {
|
|
717
|
+
if (newValue === oldValue) {
|
|
718
|
+
checkVisibleColumns();
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
|
|
689
722
|
provide("changeModelIsTableWithoutScroll", changeModelIsTableWithoutScroll);
|
|
690
723
|
provide("changeModelSort", changeModelSort);
|
|
691
724
|
provide("columnsOrdered", columnsOrdered);
|
|
692
725
|
provide("columnsFilteredForRender", columnsFilteredForRender);
|
|
693
726
|
provide("columnsScrollInvisible", columnsScrollInvisible);
|
|
694
727
|
provide("columnsVisibleAdditionalSpaceForOneGrow", columnsVisibleAdditionalSpaceForOneGrow);
|
|
728
|
+
provide("columnActionsWidthLocal", columnActionsWidthLocal);
|
|
729
|
+
provide("columnActionsWidthMinLocal", columnActionsWidthMinLocal);
|
|
695
730
|
provide("currentMultipleActions", currentMultipleActions);
|
|
696
731
|
provide("hasPreview", hasPreview);
|
|
697
732
|
provide("indexFirstScrollInvisibleColumn", indexFirstScrollInvisibleColumn);
|
|
@@ -727,6 +762,7 @@ export default {
|
|
|
727
762
|
closeMultipleActionsActive,
|
|
728
763
|
closePreview,
|
|
729
764
|
closePreviewAll,
|
|
765
|
+
columnActionsBtnGroupMaxWidthStyle,
|
|
730
766
|
columnsFilteredForRender,
|
|
731
767
|
columnsOrdered,
|
|
732
768
|
countAllRowsLocal,
|
|
@@ -910,6 +946,8 @@ export default {
|
|
|
910
946
|
key: ROW_ID,
|
|
911
947
|
allVisibleMobileColumns: this.allVisibleMobileColumns,
|
|
912
948
|
areAllRowsSelected: this.areAllRowsSelected,
|
|
949
|
+
columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
|
|
950
|
+
columnActionsView: this.columnActionsView,
|
|
913
951
|
countVisibleMobileColumns: this.countVisibleMobileColumns,
|
|
914
952
|
disabledPreview: this.disabledPreview,
|
|
915
953
|
disabledPreviewRowCallback: this.disabledPreviewRowCallback,
|
|
@@ -953,6 +991,8 @@ export default {
|
|
|
953
991
|
key: ROW_ID,
|
|
954
992
|
allVisibleMobileColumns: this.allVisibleMobileColumns,
|
|
955
993
|
areAllRowsSelected: this.areAllRowsSelected,
|
|
994
|
+
columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
|
|
995
|
+
columnActionsView: this.columnActionsView,
|
|
956
996
|
countVisibleMobileColumns: this.countVisibleMobileColumns,
|
|
957
997
|
disabledPreview: this.disabledPreview,
|
|
958
998
|
disabledPreviewRowCallback: this.disabledPreviewRowCallback,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
6
|
export default function StylesThTdAction() {
|
|
7
|
-
const
|
|
7
|
+
const columnActionsWidthMinLocal = inject("columnActionsWidthMinLocal");
|
|
8
8
|
const modelIsTableWithoutScroll = inject("modelIsTableWithoutScroll");
|
|
9
9
|
|
|
10
10
|
const stylesThTd = computed(() => {
|
|
@@ -13,7 +13,7 @@ export default function StylesThTdAction() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
return {
|
|
16
|
-
style: `width: ${
|
|
16
|
+
style: `width: ${ columnActionsWidthMinLocal.value }px;`,
|
|
17
17
|
};
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
} from "vue";
|
|
4
4
|
|
|
5
5
|
import ADropdown from "../../ADropdown/ADropdown";
|
|
6
|
+
import AGroupButtonDropdown from "../../AGroupButtonDropdown/AGroupButtonDropdown";
|
|
6
7
|
import AIcon from "../../AIcon/AIcon";
|
|
7
8
|
import ATableListItem from "../ATableListItem/ATableListItem";
|
|
8
9
|
|
|
@@ -14,11 +15,19 @@ import StylesThTdAction from "../ATableHeaderThAction/compositionAPI/StylesThTdA
|
|
|
14
15
|
export default {
|
|
15
16
|
name: "ATableTdAction",
|
|
16
17
|
components: {
|
|
17
|
-
ADropdown,
|
|
18
18
|
AIcon,
|
|
19
19
|
ATableListItem,
|
|
20
20
|
},
|
|
21
21
|
props: {
|
|
22
|
+
columnActionsBtnGroupMaxWidthStyle: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false,
|
|
25
|
+
default: undefined,
|
|
26
|
+
},
|
|
27
|
+
columnActionsView: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
22
31
|
disabledRowActions: {
|
|
23
32
|
type: Boolean,
|
|
24
33
|
required: false,
|
|
@@ -52,6 +61,7 @@ export default {
|
|
|
52
61
|
setup(props) {
|
|
53
62
|
const {
|
|
54
63
|
buttonActionsId,
|
|
64
|
+
buttonFirstActionId,
|
|
55
65
|
isRowActionsDropdownVisible,
|
|
56
66
|
rowActionsFiltered,
|
|
57
67
|
} = RowActionsAPI(props);
|
|
@@ -72,6 +82,7 @@ export default {
|
|
|
72
82
|
|
|
73
83
|
return {
|
|
74
84
|
buttonActionsId,
|
|
85
|
+
buttonFirstActionId,
|
|
75
86
|
columnsScrollInvisibleText,
|
|
76
87
|
countColumnsScrollInvisible,
|
|
77
88
|
isColumnsScrollInvisibleDropdownVisible,
|
|
@@ -99,7 +110,7 @@ export default {
|
|
|
99
110
|
],
|
|
100
111
|
}, [
|
|
101
112
|
this.isColumnsScrollInvisibleDropdownVisible && h(ADropdown, {
|
|
102
|
-
buttonClass: "a_btn a_btn_link",
|
|
113
|
+
buttonClass: "a_btn a_btn_link a_text_nowrap",
|
|
103
114
|
buttonIconLeft: "Plus",
|
|
104
115
|
buttonIconClass: "a_table__cell_action__additional_icon",
|
|
105
116
|
buttonTitle: "_A_TABLE_DROPDOWN_HIDE_FIELDS_TITLE_{{count}}_",
|
|
@@ -140,7 +151,8 @@ export default {
|
|
|
140
151
|
}),
|
|
141
152
|
this.isRowActionsDropdownVisible || this.$slots.rowActions ?
|
|
142
153
|
h("div", {
|
|
143
|
-
class: "a_table__cell_action__group"
|
|
154
|
+
class: "a_table__cell_action__group",
|
|
155
|
+
style: this.columnActionsBtnGroupMaxWidthStyle,
|
|
144
156
|
}, [
|
|
145
157
|
this.$slots.rowActions ?
|
|
146
158
|
this.$slots.rowActions({
|
|
@@ -150,21 +162,47 @@ export default {
|
|
|
150
162
|
isFooter: this.isFooter,
|
|
151
163
|
}) :
|
|
152
164
|
"",
|
|
153
|
-
this.isRowActionsDropdownVisible
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
this.isRowActionsDropdownVisible ?
|
|
166
|
+
this.columnActionsView === "dropdown" ?
|
|
167
|
+
h(ADropdown, {
|
|
168
|
+
id: this.buttonActionsId,
|
|
169
|
+
actions: this.rowActionsFiltered,
|
|
170
|
+
buttonClass: "a_btn a_btn_secondary a_table__cell_action__btn",
|
|
171
|
+
buttonIconLeft: "OptionVertical",
|
|
172
|
+
buttonTextScreenReader: "_A_TABLE_DROPDOWN_ACTIONS_TITLE_{{rowNumber}}_",
|
|
173
|
+
buttonTitle: "_A_TABLE_DROPDOWN_ACTIONS_TITLE_{{rowNumber}}_",
|
|
174
|
+
disabled: this.disabledRowActions,
|
|
175
|
+
extra: {
|
|
176
|
+
rowNumber: this.rowNumber,
|
|
177
|
+
},
|
|
178
|
+
hasCaret: false,
|
|
179
|
+
inBody: true,
|
|
180
|
+
placement: "bottom-end",
|
|
181
|
+
}, this.$slots) :
|
|
182
|
+
h(AGroupButtonDropdown, {
|
|
183
|
+
actions: this.rowActionsFiltered,
|
|
184
|
+
dropdownAttributes: {
|
|
185
|
+
id: this.buttonActionsId,
|
|
186
|
+
buttonClass: "a_btn a_btn_secondary a_table__cell_action__btn",
|
|
187
|
+
buttonIconLeft: "ChevronDown",
|
|
188
|
+
buttonTextScreenReader: "_A_TABLE_DROPDOWN_ACTIONS_TITLE_{{rowNumber}}_",
|
|
189
|
+
buttonTitle: "_A_TABLE_DROPDOWN_ACTIONS_TITLE_{{rowNumber}}_",
|
|
190
|
+
extra: {
|
|
191
|
+
rowNumber: this.rowNumber,
|
|
192
|
+
},
|
|
193
|
+
hasCaret: false,
|
|
194
|
+
inBody: true,
|
|
195
|
+
placement: "bottom-end",
|
|
196
|
+
},
|
|
197
|
+
disabled: this.disabledRowActions,
|
|
198
|
+
hasDividerBeforeDropdown: false,
|
|
199
|
+
indexFirstDropdownAction: 1,
|
|
200
|
+
indexFirstDropdownActionMobile: 0,
|
|
201
|
+
minDropdownActions: 1,
|
|
202
|
+
actionsClasses: ["a_btn a_btn_primary a_text_truncate"],
|
|
203
|
+
actionsIds: [this.buttonFirstActionId],
|
|
204
|
+
}, this.$slots) :
|
|
205
|
+
"",
|
|
168
206
|
]) :
|
|
169
207
|
"",
|
|
170
208
|
]),
|
|
@@ -30,6 +30,15 @@ export default {
|
|
|
30
30
|
type: Boolean,
|
|
31
31
|
required: true,
|
|
32
32
|
},
|
|
33
|
+
columnActionsBtnGroupMaxWidthStyle: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: false,
|
|
36
|
+
default: undefined,
|
|
37
|
+
},
|
|
38
|
+
columnActionsView: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
33
42
|
countVisibleMobileColumns: {
|
|
34
43
|
type: Number,
|
|
35
44
|
required: true,
|
|
@@ -232,6 +241,8 @@ export default {
|
|
|
232
241
|
|
|
233
242
|
const ACTIONS = this.isActionColumnVisible &&
|
|
234
243
|
h(ATableTdAction, {
|
|
244
|
+
columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
|
|
245
|
+
columnActionsView: this.columnActionsView,
|
|
235
246
|
disabledRowActions: this.disabledRowActions,
|
|
236
247
|
row: this.row,
|
|
237
248
|
rowIndex: this.rowIndex,
|
|
@@ -299,6 +310,8 @@ export default {
|
|
|
299
310
|
key: row[this.keyId] || rowIndex,
|
|
300
311
|
allVisibleMobileColumns: this.allVisibleMobileColumns,
|
|
301
312
|
areAllRowsSelected: this.areAllRowsSelected,
|
|
313
|
+
columnActionsBtnGroupMaxWidthStyle: this.columnActionsBtnGroupMaxWidthStyle,
|
|
314
|
+
columnActionsView: this.columnActionsView,
|
|
302
315
|
countVisibleMobileColumns: this.countVisibleMobileColumns,
|
|
303
316
|
disabledPreview: this.disabledPreviewRow,
|
|
304
317
|
disabledRowActions: this.disabledRowActions,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
ref,
|
|
4
|
+
toRef,
|
|
5
|
+
} from "vue";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
isRowActionVisible,
|
|
9
|
+
} from "../utils/utils";
|
|
10
|
+
import {
|
|
11
|
+
isUndefined,
|
|
12
|
+
} from "lodash-es";
|
|
13
|
+
|
|
14
|
+
export default function ColumnActionAPI(props, {
|
|
15
|
+
rowsLocal = ref([]),
|
|
16
|
+
}) {
|
|
17
|
+
const columnActionsView = toRef(props, "columnActionsView");
|
|
18
|
+
const columnActionsWidth = toRef(props, "columnActionsWidth");
|
|
19
|
+
const columnActionsWidthDefaults = toRef(props, "columnActionsWidthDefaults");
|
|
20
|
+
const columnActionsWidthMin = toRef(props, "columnActionsWidthMin");
|
|
21
|
+
const rowActions = toRef(props, "rowActions");
|
|
22
|
+
|
|
23
|
+
const shouldChangeActionWidth = computed(() => {
|
|
24
|
+
return columnActionsView.value === "onePlusDropdown";
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const hasMinOneActionInRows = computed(() => {
|
|
28
|
+
let hasAction = false;
|
|
29
|
+
outerLoop: for (let rowIndex = 0; rowIndex < rowsLocal.value.length; rowIndex++) {
|
|
30
|
+
const row = rowsLocal.value[rowIndex];
|
|
31
|
+
for (let actionIndex = 0; actionIndex < rowActions.value.length; actionIndex++) {
|
|
32
|
+
const rowAction = rowActions.value[actionIndex];
|
|
33
|
+
if (isRowActionVisible({
|
|
34
|
+
rowAction,
|
|
35
|
+
row,
|
|
36
|
+
rowIndex,
|
|
37
|
+
}) && rowAction.type !== "divider") {
|
|
38
|
+
hasAction = true;
|
|
39
|
+
break outerLoop;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return hasAction;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const isColumnActionWide = computed(() => {
|
|
48
|
+
if (!rowActions.value.length || !shouldChangeActionWidth.value) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return hasMinOneActionInRows.value;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const columnActionsWidthLocal = computed(() => {
|
|
55
|
+
if (!isUndefined(columnActionsWidth.value)) {
|
|
56
|
+
return columnActionsWidth.value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!isColumnActionWide.value) {
|
|
60
|
+
return columnActionsWidthDefaults.value.default;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (columnActionsView.value === "onePlusDropdown") {
|
|
64
|
+
return columnActionsWidthDefaults.value.onePlusDropdown;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return columnActionsWidthDefaults.value.default;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const columnActionsWidthMinLocal = computed(() => {
|
|
71
|
+
if (!isUndefined(columnActionsWidthMin.value)) {
|
|
72
|
+
return columnActionsWidth.value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!isColumnActionWide.value) {
|
|
76
|
+
return columnActionsWidthDefaults.value.min;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (columnActionsView.value === "onePlusDropdown") {
|
|
80
|
+
return columnActionsWidthDefaults.value.onePlusDropdownMin;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return columnActionsWidthDefaults.value.min;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const columnActionsBtnGroupMaxWidthStyle = computed(() => {
|
|
87
|
+
const MAX_WIDTH = columnActionsWidthDefaults.value.btnGroupMaxWidth;
|
|
88
|
+
if (columnActionsView.value !== "dropdown" &&
|
|
89
|
+
!isUndefined(MAX_WIDTH)) {
|
|
90
|
+
return `max-width: ${ MAX_WIDTH }px`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return undefined;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
columnActionsBtnGroupMaxWidthStyle,
|
|
98
|
+
columnActionsWidthLocal,
|
|
99
|
+
columnActionsWidthMinLocal,
|
|
100
|
+
isColumnActionWide,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
toRef,
|
|
5
5
|
} from "vue";
|
|
6
6
|
|
|
7
|
+
import {
|
|
8
|
+
isRowActionVisible,
|
|
9
|
+
} from "../utils/utils";
|
|
7
10
|
import {
|
|
8
11
|
cloneDeep,
|
|
9
12
|
endsWith,
|
|
@@ -16,6 +19,7 @@ import {
|
|
|
16
19
|
} from "lodash-es";
|
|
17
20
|
|
|
18
21
|
export default function RowActionsAPI(props) {
|
|
22
|
+
const columnActionsView = toRef(props, "columnActionsView");
|
|
19
23
|
const row = toRef(props, "row");
|
|
20
24
|
const rowIndex = toRef(props, "rowIndex");
|
|
21
25
|
const isFooter = toRef(props, "isFooter");
|
|
@@ -23,23 +27,14 @@ export default function RowActionsAPI(props) {
|
|
|
23
27
|
const rowActions = inject("rowActions");
|
|
24
28
|
const tableId = inject("tableId");
|
|
25
29
|
|
|
30
|
+
const buttonFirstActionId = computed(() => {
|
|
31
|
+
return `${ tableId.value }_action_${ rowIndex.value }_first`;
|
|
32
|
+
});
|
|
33
|
+
|
|
26
34
|
const buttonActionsId = computed(() => {
|
|
27
35
|
return `${ tableId.value }_action_${ rowIndex.value }`;
|
|
28
36
|
});
|
|
29
37
|
|
|
30
|
-
const isRowActionVisible = ({ rowAction }) => {
|
|
31
|
-
if (rowAction.isHidden) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
if (isFunction(rowAction.isHiddenCallback)) {
|
|
35
|
-
return !rowAction.isHiddenCallback({
|
|
36
|
-
row: row.value,
|
|
37
|
-
rowIndex: rowIndex.value,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
38
|
const getRowActionText = ({ rowAction }) => {
|
|
44
39
|
if (rowAction.text) {
|
|
45
40
|
return rowAction.text;
|
|
@@ -219,8 +214,13 @@ export default function RowActionsAPI(props) {
|
|
|
219
214
|
|
|
220
215
|
const rowActionsFiltered = computed(() => {
|
|
221
216
|
const ROW_ACTIONS = [];
|
|
217
|
+
let rowActionIndexVisible = 0;
|
|
222
218
|
forEach(cloneDeep(rowActions.value), rowAction => {
|
|
223
|
-
if (isRowActionVisible({
|
|
219
|
+
if (isRowActionVisible({
|
|
220
|
+
rowAction,
|
|
221
|
+
row: row.value,
|
|
222
|
+
rowIndex: rowIndex.value,
|
|
223
|
+
})) {
|
|
224
224
|
if (rowAction.type !== "divider") {
|
|
225
225
|
const TEXT = getRowActionText({ rowAction });
|
|
226
226
|
if (TEXT) {
|
|
@@ -233,6 +233,8 @@ export default function RowActionsAPI(props) {
|
|
|
233
233
|
const TITLE = getRowActionTitle({ rowAction });
|
|
234
234
|
if (TITLE) {
|
|
235
235
|
rowAction.title = TITLE;
|
|
236
|
+
} else if (TEXT) {
|
|
237
|
+
rowAction.title = TEXT;
|
|
236
238
|
}
|
|
237
239
|
const DISABLED = getRowActionDisabled({ rowAction });
|
|
238
240
|
if (DISABLED) {
|
|
@@ -263,18 +265,24 @@ export default function RowActionsAPI(props) {
|
|
|
263
265
|
}
|
|
264
266
|
}
|
|
265
267
|
if (isFunction(rowAction.callback)) {
|
|
268
|
+
let buttonId = buttonActionsId.value;
|
|
269
|
+
if (columnActionsView.value !== "dropdown" && rowActionIndexVisible === 0) {
|
|
270
|
+
buttonId = buttonFirstActionId.value;
|
|
271
|
+
}
|
|
272
|
+
|
|
266
273
|
const CALLBACK_DEFAULT = rowAction.callback;
|
|
267
274
|
rowAction.callback = () => CALLBACK_DEFAULT({
|
|
268
275
|
row: row.value,
|
|
269
276
|
rowIndex: rowIndex.value,
|
|
270
|
-
id:
|
|
271
|
-
ids: [
|
|
277
|
+
id: buttonId,
|
|
278
|
+
ids: [buttonId, tableId.value],
|
|
272
279
|
rowAction,
|
|
273
280
|
});
|
|
274
281
|
}
|
|
275
282
|
replacePropertiesByRowAction(rowAction);
|
|
276
283
|
}
|
|
277
284
|
|
|
285
|
+
rowActionIndexVisible++;
|
|
278
286
|
ROW_ACTIONS.push(rowAction);
|
|
279
287
|
}
|
|
280
288
|
});
|
|
@@ -288,6 +296,7 @@ export default function RowActionsAPI(props) {
|
|
|
288
296
|
|
|
289
297
|
return {
|
|
290
298
|
buttonActionsId,
|
|
299
|
+
buttonFirstActionId,
|
|
291
300
|
isRowActionsDropdownVisible,
|
|
292
301
|
rowActionsFiltered,
|
|
293
302
|
};
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
} from "lodash-es";
|
|
18
18
|
|
|
19
19
|
export default function ScrollControlAPI(props, { emit }, {
|
|
20
|
+
columnActionsWidth = computed(() => 0),
|
|
21
|
+
columnActionsWidthMin = computed(() => 0),
|
|
20
22
|
columnsOrdered = computed(() => []),
|
|
21
23
|
columnsScrollInvisible = ref([]),
|
|
22
24
|
indexFirstScrollInvisibleColumn = ref(undefined),
|
|
@@ -26,8 +28,6 @@ export default function ScrollControlAPI(props, { emit }, {
|
|
|
26
28
|
modelIsTableWithoutScroll = ref(false),
|
|
27
29
|
}) {
|
|
28
30
|
const columnWidthDefault = toRef(props, "columnWidthDefault");
|
|
29
|
-
const columnActionsWidth = toRef(props, "columnActionsWidth");
|
|
30
|
-
const columnActionsWidthMin = toRef(props, "columnActionsWidthMin");
|
|
31
31
|
const isActionColumnVisible = toRef(props, "isActionColumnVisible");
|
|
32
32
|
const isSimpleTable = toRef(props, "isSimpleTable");
|
|
33
33
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { get, isNil } from "lodash-es";
|
|
1
|
+
import { get, isFunction, isNil } from "lodash-es";
|
|
2
2
|
|
|
3
3
|
export function getModelColumnsVisibleDefault(columns) {
|
|
4
4
|
const MODEL_COLUMNS_VISIBLE = {};
|
|
@@ -86,3 +86,18 @@ export function getRowIdOrIndex({ row, rowIndex, keyId }) {
|
|
|
86
86
|
|
|
87
87
|
return rowIndex;
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
export function isRowActionVisible({ rowAction, row, rowIndex }) {
|
|
91
|
+
if (rowAction.isHidden) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (isFunction(rowAction.isHiddenCallback)) {
|
|
96
|
+
return !rowAction.isHiddenCallback({
|
|
97
|
+
row,
|
|
98
|
+
rowIndex,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return true;
|
|
103
|
+
}
|