aloha-vue 1.2.109 → 1.2.111
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/Functions/Utils/PageUtilsIsArrayOfArrays/PageUtilsIsArrayOfArraysExample/compositionAPI/JsAPI.js +2 -0
- package/docs/src/views/Functions/Utils/PageUtilsIsArrayOfArrays/i18n/hr.json +2 -2
- package/docs/src/views/Functions/Utils/PageUtilsIsArrayOfStrings/PageUtilsIsArrayOfStringsExample/compositionAPI/JsAPI.js +14 -1
- package/docs/src/views/Functions/Utils/PageUtilsIsArrayOfStrings/i18n/hr.json +2 -2
- package/docs/src/views/Functions/i18n/hr.json +1 -1
- package/docs/src/views/PageTable/PageTableSimple/PageTableSimpleExample/PageTableSimpleExample.js +51 -0
- package/docs/src/views/PageTable/PageTableSimple/PageTableSimpleExample/PageTableSimpleExample.pug +7 -0
- package/package.json +1 -1
- package/src/ADropdown/ADropdown.js +3 -3
- package/src/ATable/ATable.js +49 -14
- package/src/ATable/ATableGroupedHeader/ATableGroupedHeader.js +104 -0
- package/src/ATable/ATableGroupedHeader/compositionAPI/ColumnsGroupedAPI.js +134 -0
- package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +10 -0
- package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +2 -1
- package/src/ATable/compositionAPI/ColumnsAPI.js +9 -0
- package/src/ATable/compositionAPI/SimpleTableAPI.js +37 -0
- package/src/ATable/compositionAPI/VariablesAPI.js +2 -0
- package/src/styles/components/ATable.scss +34 -0
- package/src/utils/__tests__/utils.isArrayOfArrays.test.js +4 -0
- package/src/utils/__tests__/utils.isArrayOfStrings.test.js +4 -0
- package/src/utils/utils.js +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_PAGE_UTILS_IS_ARRAY_OF_ARRAYS_ARGUMENTS_VALUE_": "
|
|
3
|
-
"_PAGE_UTILS_IS_ARRAY_OF_ARRAYS_DESCRIPTION_": "
|
|
2
|
+
"_PAGE_UTILS_IS_ARRAY_OF_ARRAYS_ARGUMENTS_VALUE_": "Vrijednost koju treba provjeriti.",
|
|
3
|
+
"_PAGE_UTILS_IS_ARRAY_OF_ARRAYS_DESCRIPTION_": "Provjerava je li ulazna vrijednost niz nizova."
|
|
4
4
|
}
|
|
@@ -16,7 +16,20 @@ isArrayOfStrings(["Aloha", false]);
|
|
|
16
16
|
isArrayOfStrings(["Aloha", undefined]);
|
|
17
17
|
// ${ isArrayOfStrings(["Aloha", undefined]) }
|
|
18
18
|
isArrayOfStrings(["Aloha", null]);
|
|
19
|
-
// ${ isArrayOfStrings(["Aloha", null]) }
|
|
19
|
+
// ${ isArrayOfStrings(["Aloha", null]) }
|
|
20
|
+
|
|
21
|
+
isArrayOfStrings([]);
|
|
22
|
+
// ${ isArrayOfStrings([]) }
|
|
23
|
+
isArrayOfStrings("Aloha");
|
|
24
|
+
// ${ isArrayOfStrings("Aloha") }
|
|
25
|
+
isArrayOfStrings(1);
|
|
26
|
+
// ${ isArrayOfStrings(1) }
|
|
27
|
+
isArrayOfStrings(undefined);
|
|
28
|
+
// ${ isArrayOfStrings(undefined) }
|
|
29
|
+
isArrayOfStrings(null);
|
|
30
|
+
// ${ isArrayOfStrings(null) }
|
|
31
|
+
isArrayOfStrings({});
|
|
32
|
+
// ${ isArrayOfStrings({}) }`;
|
|
20
33
|
|
|
21
34
|
return {
|
|
22
35
|
codeJs,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_PAGE_UTILS_IS_ARRAY_OF_STRINGS_ARGUMENTS_VALUE_": "
|
|
3
|
-
"_PAGE_UTILS_IS_ARRAY_OF_STRINGS_DESCRIPTION_": "
|
|
2
|
+
"_PAGE_UTILS_IS_ARRAY_OF_STRINGS_ARGUMENTS_VALUE_": "Vrijednost koju treba provjeriti.",
|
|
3
|
+
"_PAGE_UTILS_IS_ARRAY_OF_STRINGS_DESCRIPTION_": "Provjerava je li ulazna vrijednost niz stringova."
|
|
4
4
|
}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
"_PAGE_FUNCTIONS_ARGUMENTS_HEADER_": "Argumenti",
|
|
3
3
|
"_PAGE_FUNCTIONS_IMPORT_COMPOSITION_API_HEADER_": "Import kao kompozicijski API",
|
|
4
4
|
"_PAGE_FUNCTIONS_IMPORT_FUNCTION_HEADER_": "Import kao funkcija",
|
|
5
|
-
"_PAGE_FUNCTIONS_TESTS_HEADER_": "
|
|
5
|
+
"_PAGE_FUNCTIONS_TESTS_HEADER_": "Testovi"
|
|
6
6
|
}
|
package/docs/src/views/PageTable/PageTableSimple/PageTableSimpleExample/PageTableSimpleExample.js
CHANGED
|
@@ -55,6 +55,56 @@ export default {
|
|
|
55
55
|
},
|
|
56
56
|
];
|
|
57
57
|
|
|
58
|
+
const columnsGrouped = [
|
|
59
|
+
{
|
|
60
|
+
id: "column1",
|
|
61
|
+
keyLabel: "id",
|
|
62
|
+
label: "_A_TABLE_COLUMN_1_",
|
|
63
|
+
group: ["Group 1", "Group 1.3"],
|
|
64
|
+
width: 500,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "column6",
|
|
68
|
+
keyLabel: "id",
|
|
69
|
+
label: "_A_TABLE_COLUMN_2_",
|
|
70
|
+
group: ["Group 1", "Group 1.1", "Group 1.1.1"],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "column7",
|
|
74
|
+
keyLabel: "id",
|
|
75
|
+
label: "_A_TABLE_COLUMN_3_",
|
|
76
|
+
group: ["Group 1.1", "Group 1.1.2", "Group 1"],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "column2",
|
|
80
|
+
keyLabel: "aloha",
|
|
81
|
+
label: "_A_TABLE_COLUMN_4_",
|
|
82
|
+
group: ["Group 1", "Group 1.2"],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "column3",
|
|
86
|
+
keyLabel: "aloha",
|
|
87
|
+
label: "_A_TABLE_COLUMN_5_",
|
|
88
|
+
group: ["Group 2", "Group 2.1"],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "column4",
|
|
92
|
+
keyLabel: "aloha",
|
|
93
|
+
label: "_A_TABLE_COLUMN_6_",
|
|
94
|
+
group: ["_A_TABLE_COLUMN_6_", "Group 2.2"],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "column5",
|
|
98
|
+
keyLabel: "aloha",
|
|
99
|
+
label: "_A_TABLE_COLUMN_7_",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "column6",
|
|
103
|
+
keyLabel: "aloha",
|
|
104
|
+
label: "_A_TABLE_COLUMN_8_",
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
|
|
58
108
|
const data = ref([]);
|
|
59
109
|
|
|
60
110
|
const setData = () => {
|
|
@@ -74,6 +124,7 @@ export default {
|
|
|
74
124
|
codeHtml,
|
|
75
125
|
codeJs,
|
|
76
126
|
columns,
|
|
127
|
+
columnsGrouped,
|
|
77
128
|
data,
|
|
78
129
|
};
|
|
79
130
|
},
|
package/package.json
CHANGED
|
@@ -110,7 +110,7 @@ export default {
|
|
|
110
110
|
default: "button",
|
|
111
111
|
},
|
|
112
112
|
buttonText: {
|
|
113
|
-
type: [String, Number, Object],
|
|
113
|
+
type: [String, Number, Object, Array],
|
|
114
114
|
required: false,
|
|
115
115
|
default: undefined,
|
|
116
116
|
},
|
|
@@ -125,12 +125,12 @@ export default {
|
|
|
125
125
|
default: undefined,
|
|
126
126
|
},
|
|
127
127
|
buttonTextScreenReader: {
|
|
128
|
-
type: String,
|
|
128
|
+
type: [String, Number, Object, Array],
|
|
129
129
|
required: false,
|
|
130
130
|
default: undefined,
|
|
131
131
|
},
|
|
132
132
|
buttonTitle: {
|
|
133
|
-
type: String,
|
|
133
|
+
type: [String, Number, Object, Array],
|
|
134
134
|
required: false,
|
|
135
135
|
default: undefined,
|
|
136
136
|
},
|
package/src/ATable/ATable.js
CHANGED
|
@@ -9,12 +9,12 @@ import AGet from "../AGet/AGet";
|
|
|
9
9
|
import ALoading from "../ALoading/ALoading";
|
|
10
10
|
import APagination from "../APagination/APagination";
|
|
11
11
|
import ATableHeader from "./ATableHeader/ATableHeader";
|
|
12
|
+
import ATableGroupedHeader from "./ATableGroupedHeader/ATableGroupedHeader";
|
|
12
13
|
import ATablePreviewRight from "./ATablePreviewRight/ATablePreviewRight";
|
|
13
14
|
import ATableTopPanel from "./ATableTopPanel/ATableTopPanel";
|
|
14
15
|
import ATableTr from "./ATableTr/ATableTr";
|
|
15
16
|
import ATranslation from "../ATranslation/ATranslation";
|
|
16
17
|
|
|
17
|
-
import AMobileAPI from "../compositionAPI/AMobileAPI";
|
|
18
18
|
import ColumnsAPI from "./compositionAPI/ColumnsAPI";
|
|
19
19
|
import ColumnsOrderingAPI from "./compositionAPI/ColumnsOrderingAPI";
|
|
20
20
|
import FocusTableAPI from "./compositionAPI/FocusTableAPI";
|
|
@@ -25,6 +25,7 @@ import MultipleActionAPI from "./compositionAPI/MultipleActionAPI";
|
|
|
25
25
|
import PreviewAPI from "./compositionAPI/PreviewAPI";
|
|
26
26
|
import RowsAPI from "./compositionAPI/RowsAPI";
|
|
27
27
|
import ScrollControlAPI from "./compositionAPI/ScrollControlAPI";
|
|
28
|
+
import SimpleTableAPI from "./compositionAPI/SimpleTableAPI";
|
|
28
29
|
import SortAPI from "./compositionAPI/SortAPI";
|
|
29
30
|
import SortChangeAPI from "./compositionAPI/SortChangeAPI";
|
|
30
31
|
import StickyAPI from "./compositionAPI/StickyAPI";
|
|
@@ -128,6 +129,11 @@ export default {
|
|
|
128
129
|
required: false,
|
|
129
130
|
default: false,
|
|
130
131
|
},
|
|
132
|
+
isActionIconVisible: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
required: false,
|
|
135
|
+
default: true,
|
|
136
|
+
},
|
|
131
137
|
isColumnsDnd: {
|
|
132
138
|
type: Boolean,
|
|
133
139
|
required: false,
|
|
@@ -154,6 +160,11 @@ export default {
|
|
|
154
160
|
type: Boolean,
|
|
155
161
|
required: false,
|
|
156
162
|
},
|
|
163
|
+
isSimpleTable: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
required: false,
|
|
166
|
+
default: false,
|
|
167
|
+
},
|
|
157
168
|
isSortingMultiColumn: {
|
|
158
169
|
type: Boolean,
|
|
159
170
|
required: false,
|
|
@@ -389,7 +400,6 @@ export default {
|
|
|
389
400
|
columnActionsWidthLocal: computed(() => this.columnActionsWidth),
|
|
390
401
|
columnWidthDefault: computed(() => this.columnWidthDefault),
|
|
391
402
|
isActionColumnVisible: computed(() => this.isActionColumnVisible),
|
|
392
|
-
isColumnsDnd: computed(() => this.isColumnsDnd),
|
|
393
403
|
isLoadingOptions: computed(() => this.isLoadingOptions),
|
|
394
404
|
isLoadingTable: computed(() => this.isLoadingTable),
|
|
395
405
|
rowActions: computed(() => this.rowActions),
|
|
@@ -398,12 +408,19 @@ export default {
|
|
|
398
408
|
};
|
|
399
409
|
},
|
|
400
410
|
setup(props, context) {
|
|
411
|
+
const {
|
|
412
|
+
isActionIconVisibleLocal,
|
|
413
|
+
isColumnsDndLocal,
|
|
414
|
+
isMobile,
|
|
415
|
+
modelIsTableWithoutScrollStartLocal,
|
|
416
|
+
} = SimpleTableAPI(props);
|
|
417
|
+
|
|
401
418
|
const {
|
|
402
419
|
columnsScrollInvisible,
|
|
420
|
+
groupedHeaderRef,
|
|
403
421
|
indexFirstScrollInvisibleColumn,
|
|
404
422
|
isMultipleActionsActive,
|
|
405
423
|
modelColumnsVisibleLocal,
|
|
406
|
-
modelIsTableWithoutScroll,
|
|
407
424
|
tableGrandparentRef,
|
|
408
425
|
tableRef,
|
|
409
426
|
} = VariablesAPI(props);
|
|
@@ -433,15 +450,12 @@ export default {
|
|
|
433
450
|
countNotHiddenColumns,
|
|
434
451
|
} = ColumnsAPI(props, {
|
|
435
452
|
columnsScrollInvisible,
|
|
453
|
+
groupedHeaderRef,
|
|
436
454
|
indexFirstScrollInvisibleColumn,
|
|
437
455
|
modelColumnsVisibleLocal,
|
|
438
|
-
modelIsTableWithoutScroll,
|
|
456
|
+
modelIsTableWithoutScroll: modelIsTableWithoutScrollStartLocal,
|
|
439
457
|
});
|
|
440
458
|
|
|
441
|
-
const {
|
|
442
|
-
isMobileWidth: isMobile,
|
|
443
|
-
} = AMobileAPI();
|
|
444
|
-
|
|
445
459
|
const {
|
|
446
460
|
dataSorted,
|
|
447
461
|
initModelSort,
|
|
@@ -491,7 +505,7 @@ export default {
|
|
|
491
505
|
isMobile,
|
|
492
506
|
isMultipleActionsActive,
|
|
493
507
|
modelColumnsVisibleLocal,
|
|
494
|
-
modelIsTableWithoutScroll,
|
|
508
|
+
modelIsTableWithoutScroll: modelIsTableWithoutScrollStartLocal,
|
|
495
509
|
});
|
|
496
510
|
|
|
497
511
|
const {
|
|
@@ -501,13 +515,14 @@ export default {
|
|
|
501
515
|
checkVisibleColumns,
|
|
502
516
|
columnIdsGroupByLocked,
|
|
503
517
|
columnsFilteredForRenderIndexesMapping,
|
|
518
|
+
groupedHeaderRef,
|
|
504
519
|
});
|
|
505
520
|
|
|
506
521
|
const {
|
|
507
522
|
isRowActionsStickyLocal,
|
|
508
523
|
} = StickyAPI(props, {
|
|
509
524
|
isMobile,
|
|
510
|
-
modelIsTableWithoutScroll,
|
|
525
|
+
modelIsTableWithoutScroll: modelIsTableWithoutScrollStartLocal,
|
|
511
526
|
});
|
|
512
527
|
|
|
513
528
|
const {
|
|
@@ -615,9 +630,11 @@ export default {
|
|
|
615
630
|
provide("currentMultipleActions", currentMultipleActions);
|
|
616
631
|
provide("hasPreview", hasPreview);
|
|
617
632
|
provide("indexFirstScrollInvisibleColumn", indexFirstScrollInvisibleColumn);
|
|
633
|
+
provide("isActionIconVisible", isActionIconVisibleLocal);
|
|
634
|
+
provide("isColumnsDnd", isColumnsDndLocal);
|
|
618
635
|
provide("isMobile", isMobile);
|
|
619
636
|
provide("isMultipleActionsActive", isMultipleActionsActive);
|
|
620
|
-
provide("modelIsTableWithoutScroll",
|
|
637
|
+
provide("modelIsTableWithoutScroll", modelIsTableWithoutScrollStartLocal);
|
|
621
638
|
provide("onTogglePreview", onTogglePreview);
|
|
622
639
|
provide("previewRightRowIndex", previewRightRowIndex);
|
|
623
640
|
provide("previewRightRowIndexLast", previewRightRowIndexLast);
|
|
@@ -648,6 +665,7 @@ export default {
|
|
|
648
665
|
columnsOrdered,
|
|
649
666
|
deleteRow,
|
|
650
667
|
emptyText,
|
|
668
|
+
groupedHeaderRef,
|
|
651
669
|
hasMultipleActions,
|
|
652
670
|
hasRows,
|
|
653
671
|
hasViews,
|
|
@@ -658,7 +676,7 @@ export default {
|
|
|
658
676
|
isViewTableVisible,
|
|
659
677
|
limit,
|
|
660
678
|
modelColumnsVisibleLocal,
|
|
661
|
-
|
|
679
|
+
modelIsTableWithoutScrollStartLocal,
|
|
662
680
|
modelSortLocal,
|
|
663
681
|
mousedownResizePreviewRight,
|
|
664
682
|
mousemoveResizePreviewRight,
|
|
@@ -737,7 +755,7 @@ export default {
|
|
|
737
755
|
return h("div", {
|
|
738
756
|
ref: "tableGrandparentRef",
|
|
739
757
|
class: ["a_table__grandparent", {
|
|
740
|
-
a_table_mobile: this.isMobile,
|
|
758
|
+
a_table_mobile: !this.isSimpleTable && this.isMobile,
|
|
741
759
|
}],
|
|
742
760
|
}, [
|
|
743
761
|
this.$slots.tablePrepend &&
|
|
@@ -747,7 +765,7 @@ export default {
|
|
|
747
765
|
h("div", {
|
|
748
766
|
ref: "aTableRef",
|
|
749
767
|
class: ["a_table__parent", {
|
|
750
|
-
a_table__parent_scrollable: !this.
|
|
768
|
+
a_table__parent_scrollable: !this.modelIsTableWithoutScrollStartLocal,
|
|
751
769
|
}],
|
|
752
770
|
}, [
|
|
753
771
|
h(ATableTopPanel, {
|
|
@@ -791,6 +809,23 @@ export default {
|
|
|
791
809
|
],
|
|
792
810
|
...this.tableRoleAttributes,
|
|
793
811
|
}, [
|
|
812
|
+
this.isSimpleTable ?
|
|
813
|
+
h(ATableGroupedHeader, {
|
|
814
|
+
ref: "groupedHeaderRef",
|
|
815
|
+
areAllRowsSelected: this.areAllRowsSelected,
|
|
816
|
+
areAllVisibleRowsSelected: this.areAllVisibleRowsSelected,
|
|
817
|
+
areSomeRowsSelected: this.areSomeRowsSelected,
|
|
818
|
+
disabledOptions: this.disabledOptions,
|
|
819
|
+
disabledSort: this.disabledSort,
|
|
820
|
+
hasMultipleActions: this.hasMultipleActions,
|
|
821
|
+
isRowActionsStickyLocal: this.isRowActionsStickyLocal,
|
|
822
|
+
isSortingMultiColumn: this.isSortingMultiColumn,
|
|
823
|
+
modelSort: this.modelSortLocal,
|
|
824
|
+
rowsLocalLength: this.rowsLocalLength,
|
|
825
|
+
showFirstSortingSequenceNumber: this.showFirstSortingSequenceNumber,
|
|
826
|
+
sortingSequenceNumberClass: this.sortingSequenceNumberClass,
|
|
827
|
+
onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
|
|
828
|
+
}) :
|
|
794
829
|
h(ATableHeader, {
|
|
795
830
|
areAllRowsSelected: this.areAllRowsSelected,
|
|
796
831
|
areAllVisibleRowsSelected: this.areAllVisibleRowsSelected,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
h,
|
|
3
|
+
} from "vue";
|
|
4
|
+
|
|
5
|
+
import ATableHeaderTh from "../ATableHeaderTh/ATableHeaderTh";
|
|
6
|
+
import ATableHeaderThAction from "../ATableHeaderThAction/ATableHeaderThAction";
|
|
7
|
+
import ColumnsGroupedAPI from "./compositionAPI/ColumnsGroupedAPI";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
name: "ATableGroupedHeader",
|
|
11
|
+
components: {
|
|
12
|
+
ATableHeaderTh,
|
|
13
|
+
ATableHeaderThAction,
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
areAllRowsSelected: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
areAllVisibleRowsSelected: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
areSomeRowsSelected: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
disabledOptions: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
required: false,
|
|
31
|
+
},
|
|
32
|
+
disabledSort: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
required: false,
|
|
35
|
+
},
|
|
36
|
+
hasMultipleActions: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
isRowActionsStickyLocal: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
isSortingMultiColumn: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
required: false,
|
|
47
|
+
},
|
|
48
|
+
modelSort: {
|
|
49
|
+
type: Array,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
rowsLocalLength: {
|
|
53
|
+
type: Number,
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
showFirstSortingSequenceNumber: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
required: false,
|
|
59
|
+
},
|
|
60
|
+
sortingSequenceNumberClass: {
|
|
61
|
+
type: [String, Object],
|
|
62
|
+
required: false,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
emits: [
|
|
66
|
+
"setSelectedRowsIndexes",
|
|
67
|
+
],
|
|
68
|
+
inject: [
|
|
69
|
+
"changeColumnsOrdering",
|
|
70
|
+
"columnsFilteredForRender",
|
|
71
|
+
"isActionColumnVisible",
|
|
72
|
+
"isMobile",
|
|
73
|
+
"isMultipleActionsActive",
|
|
74
|
+
],
|
|
75
|
+
setup() {
|
|
76
|
+
const {
|
|
77
|
+
columnsOrdered,
|
|
78
|
+
renderedGroupedColumns,
|
|
79
|
+
} = ColumnsGroupedAPI();
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
columnsOrdered,
|
|
83
|
+
renderedGroupedColumns,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
render() {
|
|
87
|
+
return h("div", {
|
|
88
|
+
ref: "root",
|
|
89
|
+
role: "rowgroup",
|
|
90
|
+
class: "a_table__head",
|
|
91
|
+
}, [
|
|
92
|
+
h("div", {
|
|
93
|
+
class: "a_table__row a_table__head__row",
|
|
94
|
+
role: "row",
|
|
95
|
+
}, [
|
|
96
|
+
this.renderedGroupedColumns,
|
|
97
|
+
this.isActionColumnVisible && h(ATableHeaderThAction, {
|
|
98
|
+
disabledOptions: this.disabledOptions,
|
|
99
|
+
isRowActionsStickyLocal: this.isRowActionsStickyLocal,
|
|
100
|
+
}),
|
|
101
|
+
]),
|
|
102
|
+
]);
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
h,
|
|
4
|
+
inject,
|
|
5
|
+
} from "vue";
|
|
6
|
+
|
|
7
|
+
import ATableHeaderTh from "../../ATableHeaderTh/ATableHeaderTh";
|
|
8
|
+
import ATranslation from "../../../ATranslation/ATranslation";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
cloneDeep,
|
|
12
|
+
filter,
|
|
13
|
+
get,
|
|
14
|
+
includes,
|
|
15
|
+
isArray,
|
|
16
|
+
map,
|
|
17
|
+
uniqBy,
|
|
18
|
+
} from "lodash-es";
|
|
19
|
+
|
|
20
|
+
export default function ColumnsGroupedAPI() {
|
|
21
|
+
const columns = cloneDeep(inject("columnsFilteredForRender"));
|
|
22
|
+
|
|
23
|
+
const columnsWithIndexedGroups = computed(() => {
|
|
24
|
+
return map(columns.value, column => {
|
|
25
|
+
if (column.group && column.group.length) {
|
|
26
|
+
column.group = map(column.group, (_group, groupIndex) => {
|
|
27
|
+
return [
|
|
28
|
+
_group,
|
|
29
|
+
groupIndex,
|
|
30
|
+
].join("%%%");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return column;
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const getRecursiveChildrenForGroup = ({ groups, group, level, columnsOrderedFromGroups }) => {
|
|
39
|
+
const foundGroupsForCurrentLevel = group ? filter(groups, _group => {
|
|
40
|
+
return includes(_group, group[level - 1]);
|
|
41
|
+
}) : groups;
|
|
42
|
+
|
|
43
|
+
const uniqGroupsForCurrentLevel = uniqBy(foundGroupsForCurrentLevel, _group => _group[level]);
|
|
44
|
+
|
|
45
|
+
const recursiveGroup = map(uniqGroupsForCurrentLevel, _group => {
|
|
46
|
+
const groupObjectToReturn = {
|
|
47
|
+
id: _group[level].split("%%%")[0],
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (_group.length > level + 1) {
|
|
51
|
+
groupObjectToReturn.children = get(getRecursiveChildrenForGroup({ groups, group: _group, level: level + 1, columnsOrderedFromGroups }), "recursiveGroup");
|
|
52
|
+
} else if (_group.length === level + 1) {
|
|
53
|
+
groupObjectToReturn.columns = filter(columnsWithIndexedGroups.value, column => includes(column.group, _group[level]));
|
|
54
|
+
columnsOrderedFromGroups.push(...groupObjectToReturn.columns);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return groupObjectToReturn;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
columnsOrderedFromGroups,
|
|
62
|
+
recursiveGroup,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const plainGroupsAndColumns = computed(() => {
|
|
67
|
+
return map(columnsWithIndexedGroups.value, column => {
|
|
68
|
+
return get(column, "group", column);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
const onlyGroups = computed(() => {
|
|
72
|
+
return filter(plainGroupsAndColumns.value, group => isArray(group));
|
|
73
|
+
});
|
|
74
|
+
const onlyColumns = computed(() => {
|
|
75
|
+
return filter(plainGroupsAndColumns.value, group => !isArray(group));
|
|
76
|
+
});
|
|
77
|
+
const columnsGrouped = computed(() => {
|
|
78
|
+
const columnsOrderedFromGroupsLocal = [];
|
|
79
|
+
|
|
80
|
+
return getRecursiveChildrenForGroup({ groups: onlyGroups.value, group: null, level: 0, columnsOrderedFromGroups: columnsOrderedFromGroupsLocal });
|
|
81
|
+
});
|
|
82
|
+
const columnsOrdered = computed(() => {
|
|
83
|
+
return [
|
|
84
|
+
...columnsGrouped.value.columnsOrderedFromGroups,
|
|
85
|
+
...onlyColumns.value,
|
|
86
|
+
];
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const getColumnsForRender = cols => {
|
|
90
|
+
return map(cols, (column, columnIndex) => {
|
|
91
|
+
return h(ATableHeaderTh, {
|
|
92
|
+
ref: "th",
|
|
93
|
+
column: column,
|
|
94
|
+
columnIndex: columnIndex,
|
|
95
|
+
class: "a_table__cell__child_group",
|
|
96
|
+
columnGroupNames: column.group,
|
|
97
|
+
hasMultipleActions: false,
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
const getRecursiveGroupForRender = cols => {
|
|
102
|
+
return map(cols, col => h("div", {
|
|
103
|
+
class: "a_table__th_group",
|
|
104
|
+
}, [
|
|
105
|
+
h("div", {
|
|
106
|
+
class: "a_table__th_child_group",
|
|
107
|
+
}, [
|
|
108
|
+
h("div", {
|
|
109
|
+
class: "a_table__cell_group",
|
|
110
|
+
}, [
|
|
111
|
+
col.id && h(ATranslation, {
|
|
112
|
+
html: col.id,
|
|
113
|
+
tag: "span",
|
|
114
|
+
"aria-hidden": true,
|
|
115
|
+
}),
|
|
116
|
+
]),
|
|
117
|
+
h("div", {
|
|
118
|
+
class: "a_table__th_group_container",
|
|
119
|
+
}, col.children ? getRecursiveGroupForRender(col.children) : getColumnsForRender(col.columns)),
|
|
120
|
+
]),
|
|
121
|
+
]));
|
|
122
|
+
};
|
|
123
|
+
const renderedGroupedColumns = computed(() => {
|
|
124
|
+
return [
|
|
125
|
+
...getRecursiveGroupForRender(columnsGrouped.value.recursiveGroup),
|
|
126
|
+
...getColumnsForRender(onlyColumns.value),
|
|
127
|
+
];
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return {
|
|
131
|
+
columnsOrdered,
|
|
132
|
+
renderedGroupedColumns,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -17,6 +17,11 @@ export default {
|
|
|
17
17
|
type: Object,
|
|
18
18
|
required: true,
|
|
19
19
|
},
|
|
20
|
+
columnGroupNames: {
|
|
21
|
+
type: Array,
|
|
22
|
+
required: false,
|
|
23
|
+
default: undefined,
|
|
24
|
+
},
|
|
20
25
|
columnIndex: {
|
|
21
26
|
type: Number,
|
|
22
27
|
required: true,
|
|
@@ -120,6 +125,11 @@ export default {
|
|
|
120
125
|
this.column.classHeader,
|
|
121
126
|
],
|
|
122
127
|
}, [
|
|
128
|
+
this.columnGroupNames && h(ATranslation, {
|
|
129
|
+
html: this.columnGroupNames,
|
|
130
|
+
tag: "span",
|
|
131
|
+
class: "a_sr_only",
|
|
132
|
+
}),
|
|
123
133
|
h(AButton, {
|
|
124
134
|
class: [
|
|
125
135
|
"a_table__th__btn",
|
|
@@ -27,6 +27,7 @@ export default {
|
|
|
27
27
|
"changeModelColumnsVisible",
|
|
28
28
|
"columns",
|
|
29
29
|
"columnsOrdered",
|
|
30
|
+
"isActionIconVisible",
|
|
30
31
|
"modelIsTableWithoutScroll",
|
|
31
32
|
],
|
|
32
33
|
props: {
|
|
@@ -110,7 +111,7 @@ export default {
|
|
|
110
111
|
h("span", {
|
|
111
112
|
class: "a_sr_only"
|
|
112
113
|
}, "Aktionen"),
|
|
113
|
-
h(ADropdown, {
|
|
114
|
+
this.isActionIconVisible && h(ADropdown, {
|
|
114
115
|
buttonClass: "a_btn a_btn_secondary a_table__cell_action__btn",
|
|
115
116
|
buttonTitle: "_A_TABLE_DROPDOWN_OPTIONS_TITLE_",
|
|
116
117
|
buttonTextScreenReader: "_A_TABLE_DROPDOWN_OPTIONS_TITLE_",
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
cloneDeep,
|
|
12
12
|
forEach,
|
|
13
|
+
get,
|
|
13
14
|
keyBy,
|
|
14
15
|
} from "lodash-es";
|
|
15
16
|
|
|
16
17
|
export default function ColumnsAPI(props, {
|
|
17
18
|
columnsScrollInvisible = ref([]),
|
|
19
|
+
groupedHeaderRef = ref({}),
|
|
18
20
|
indexFirstScrollInvisibleColumn = ref(undefined),
|
|
19
21
|
modelColumnsVisibleLocal = ref({}),
|
|
20
22
|
modelIsTableWithoutScroll = ref(false),
|
|
@@ -28,6 +30,10 @@ export default function ColumnsAPI(props, {
|
|
|
28
30
|
return keyBy(columns.value, "id");
|
|
29
31
|
});
|
|
30
32
|
|
|
33
|
+
const columnsFromGroupedHeader = computed(() => {
|
|
34
|
+
return get(groupedHeaderRef, "value.columnsOrdered");
|
|
35
|
+
});
|
|
36
|
+
|
|
31
37
|
const columnIdsGroupByLocked = computed(() => {
|
|
32
38
|
const COLUMNS_GROUP_BY_LOCKED = {
|
|
33
39
|
true: [],
|
|
@@ -53,6 +59,9 @@ export default function ColumnsAPI(props, {
|
|
|
53
59
|
});
|
|
54
60
|
|
|
55
61
|
const columnsOrdered = computed(() => {
|
|
62
|
+
if (columnsFromGroupedHeader.value && columnsFromGroupedHeader.value.length) {
|
|
63
|
+
return columnsFromGroupedHeader.value;
|
|
64
|
+
}
|
|
56
65
|
if (!modelColumnsOrdering.value.length) {
|
|
57
66
|
return [...columnIdsGroupByLocked.value.trueColumns, ...columnIdsGroupByLocked.value.falseColumns];
|
|
58
67
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import AMobileAPI from "../../compositionAPI/AMobileAPI";
|
|
7
|
+
|
|
8
|
+
export default function SimpleTableAPI(props) {
|
|
9
|
+
const isActionIconVisible = toRef(props, "isActionColumnVisible");
|
|
10
|
+
const isColumnsDnd = toRef(props, "isColumnsDnd");
|
|
11
|
+
const isSimpleTable = toRef(props, "isSimpleTable");
|
|
12
|
+
const modelIsTableWithoutScrollStart = toRef(props, "modelIsTableWithoutScrollStart");
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
isMobileWidth,
|
|
16
|
+
} = AMobileAPI();
|
|
17
|
+
|
|
18
|
+
const isActionIconVisibleLocal = computed(() => {
|
|
19
|
+
return !!(isActionIconVisible.value && !isSimpleTable.value);
|
|
20
|
+
});
|
|
21
|
+
const isColumnsDndLocal = computed(() => {
|
|
22
|
+
return !!(isColumnsDnd.value && !isSimpleTable.value);
|
|
23
|
+
});
|
|
24
|
+
const isMobile = computed(() => {
|
|
25
|
+
return !!(isMobileWidth.value && !isSimpleTable.value);
|
|
26
|
+
});
|
|
27
|
+
const modelIsTableWithoutScrollStartLocal = computed(() => {
|
|
28
|
+
return !!(modelIsTableWithoutScrollStart.value && !isSimpleTable.value);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
isActionIconVisibleLocal,
|
|
33
|
+
isColumnsDndLocal,
|
|
34
|
+
isMobile,
|
|
35
|
+
modelIsTableWithoutScrollStartLocal,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -7,6 +7,7 @@ export default function VariablesAPI(props) {
|
|
|
7
7
|
const modelIsTableWithoutScrollStart = toRef(props, "modelIsTableWithoutScrollStart");
|
|
8
8
|
|
|
9
9
|
const columnsScrollInvisible = ref([]);
|
|
10
|
+
const groupedHeaderRef = ref(undefined);
|
|
10
11
|
const indexFirstScrollInvisibleColumn = ref(undefined);
|
|
11
12
|
const isMultipleActionsActive = ref(undefined);
|
|
12
13
|
const modelColumnsVisibleLocal = ref({});
|
|
@@ -16,6 +17,7 @@ export default function VariablesAPI(props) {
|
|
|
16
17
|
|
|
17
18
|
return {
|
|
18
19
|
columnsScrollInvisible,
|
|
20
|
+
groupedHeaderRef,
|
|
19
21
|
indexFirstScrollInvisibleColumn,
|
|
20
22
|
isMultipleActionsActive,
|
|
21
23
|
modelColumnsVisibleLocal,
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
--a_table_th_bg: var(--a_color_gray_300);
|
|
4
4
|
--a_table_th_border_vertical_width: 2px;
|
|
5
5
|
--a_table_th_border_vertical_color: var(--a_color_gray_100);
|
|
6
|
+
--a_table_th_border_horizontal_width: 2px;
|
|
7
|
+
--a_table_th_border_horizontal_color: var(--a_color_gray_100);
|
|
6
8
|
--a_table_th_border_bottom_width: 2px;
|
|
7
9
|
--a_table_th_border_bottom_color: var(--a_color_gray_500);
|
|
8
10
|
--a_table_th_sorting_bg: #d0e3a4;
|
|
@@ -144,6 +146,20 @@
|
|
|
144
146
|
height: 100%;
|
|
145
147
|
}
|
|
146
148
|
}
|
|
149
|
+
.a_table__th_group_container {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: row;
|
|
152
|
+
}
|
|
153
|
+
.a_table__cell_group {
|
|
154
|
+
height: 100%;
|
|
155
|
+
padding: var(--a_table_cell_padding_y) var(--a_table_cell_padding_x);
|
|
156
|
+
}
|
|
157
|
+
.a_table__th_child_group {
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
justify-content: space-between;
|
|
161
|
+
height: 100%;
|
|
162
|
+
}
|
|
147
163
|
.a_table__th__btn {
|
|
148
164
|
padding: 0;
|
|
149
165
|
position: relative;
|
|
@@ -583,4 +599,22 @@
|
|
|
583
599
|
.a_table__th + .a_table__th {
|
|
584
600
|
border-left: var(--a_table_th_border_vertical_width) solid var(--a_table_th_border_vertical_color);
|
|
585
601
|
}
|
|
602
|
+
.a_table__th_group {
|
|
603
|
+
width: 100%;
|
|
604
|
+
&:not(:first-child) {
|
|
605
|
+
.a_table__cell_group,
|
|
606
|
+
.a_table__cell__child_group {
|
|
607
|
+
border-left: var(--a_table_th_border_vertical_width) solid var(--a_table_th_border_vertical_color);
|
|
608
|
+
}
|
|
609
|
+
+ .a_table__th {
|
|
610
|
+
border-left: var(--a_table_th_border_vertical_width) solid var(--a_table_th_border_vertical_color);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
.a_table__cell_action {
|
|
615
|
+
border-left: var(--a_table_th_border_vertical_width) solid var(--a_table_th_border_vertical_color);
|
|
616
|
+
}
|
|
617
|
+
.a_table__cell_group {
|
|
618
|
+
border-bottom: var(--a_table_th_border_horizontal_width) solid var(--a_table_th_border_horizontal_color);
|
|
619
|
+
}
|
|
586
620
|
}
|
|
@@ -25,6 +25,10 @@ describe("isArrayOfArrays", () => {
|
|
|
25
25
|
expect(isArrayOfArrays({})).toBe(false);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
it("should return false if provided with a empty array", () => {
|
|
29
|
+
expect(isArrayOfArrays([])).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
|
|
28
32
|
it("should return false if provided with an array that contains non-array elements", () => {
|
|
29
33
|
const testData = [[1, 2, 3], "This is not an array", [7, 8, 9]];
|
|
30
34
|
const result = isArrayOfArrays(testData);
|
|
@@ -17,6 +17,10 @@ describe("isArrayOfStrings function", () => {
|
|
|
17
17
|
expect(result).toBe(false);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
it("should return false if provided with a empty array", () => {
|
|
21
|
+
expect(isArrayOfStrings([])).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
20
24
|
test("should return false when input is an array but not all elements are strings", () => {
|
|
21
25
|
expect(isArrayOfStrings(["hello", 1234])).toBe(false);
|
|
22
26
|
expect(isArrayOfStrings(["hello", false])).toBe(false);
|
package/src/utils/utils.js
CHANGED
|
@@ -35,7 +35,7 @@ function toCorrectFormat(value) {
|
|
|
35
35
|
* @return {boolean} - True if the input is an array of strings, false otherwise.
|
|
36
36
|
*/
|
|
37
37
|
export function isArrayOfStrings(array) {
|
|
38
|
-
if (!isArray(array)) {
|
|
38
|
+
if (!isArray(array) || !array.length) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -50,7 +50,7 @@ export function isArrayOfStrings(array) {
|
|
|
50
50
|
* @return {boolean} - True if the input is an array of arrays, false otherwise.
|
|
51
51
|
*/
|
|
52
52
|
export function isArrayOfArrays(array) {
|
|
53
|
-
if (!isArray(array)) {
|
|
53
|
+
if (!isArray(array) || !array.length) {
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
|