aloha-vue 2.66.1 → 2.66.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
- "version": "2.66.1",
3
+ "version": "2.66.2",
4
4
  "description": "Aloha-vue is a JavaScript library that provides a wide range of accessible components and directives for Vue.js. Accessibility is of paramount importance to us, and we have designed all our components to meet accessibility compliance criteria. This library is a valuable tool for frontend developers and has already been used in three projects, including two large-scale ones",
5
5
  "keywords": [
6
6
  "accessibility compliance criteria",
@@ -1044,9 +1044,10 @@ export default {
1044
1044
  level: 1,
1045
1045
  row,
1046
1046
  rowActionsClass: this.rowActionsClass,
1047
- rowClass: this.rowClass,
1048
- rowIndex,
1049
- rowsLength: this.rowsLocal.length,
1047
+ rowClass: this.rowClass,
1048
+ rowIndex,
1049
+ rowIndexPath: `${ rowIndex }`,
1050
+ rowsLength: this.rowsLocal.length,
1050
1051
  selectedRowsIndexes: this.selectedRowsIndexes,
1051
1052
  onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1052
1053
  }, {
@@ -1094,9 +1095,10 @@ export default {
1094
1095
  level: 1,
1095
1096
  row,
1096
1097
  rowActionsClass: this.rowActionsClass,
1097
- rowClass: this.rowClass,
1098
- rowIndex,
1099
- rowsLength: this.rowsFooter.length,
1098
+ rowClass: this.rowClass,
1099
+ rowIndex,
1100
+ rowIndexPath: `${ rowIndex }`,
1101
+ rowsLength: this.rowsFooter.length,
1100
1102
  selectedRowsIndexes: this.selectedRowsIndexes,
1101
1103
  onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
1102
1104
  }, {
@@ -52,10 +52,15 @@ export default {
52
52
  required: false,
53
53
  default: undefined,
54
54
  },
55
- rowIndex: {
56
- type: Number,
57
- required: true,
58
- },
55
+ rowIndex: {
56
+ type: Number,
57
+ required: true,
58
+ },
59
+ rowIndexPath: {
60
+ type: String,
61
+ required: false,
62
+ default: undefined,
63
+ },
59
64
  },
60
65
  inject: [
61
66
  "columnActionsOnePlusDropdownOptions",
@@ -119,6 +119,11 @@ export default {
119
119
  type: Number,
120
120
  required: true,
121
121
  },
122
+ rowIndexPath: {
123
+ type: String,
124
+ required: false,
125
+ default: undefined,
126
+ },
122
127
  rowsLength: {
123
128
  type: Number,
124
129
  required: true,
@@ -222,6 +227,7 @@ export default {
222
227
  "isMobile",
223
228
  ],
224
229
  render() {
230
+ const ROW_INDEX_PATH = this.rowIndexPath || `${ this.rowIndex }`;
225
231
  let tds = [];
226
232
  if (this.isMobile && !this.isAllColumnsVisibleMobile) {
227
233
  forEach(this.allVisibleMobileColumns, (column, columnIndex) => {
@@ -264,6 +270,7 @@ export default {
264
270
  disabledRowActions: this.disabledRowActions,
265
271
  row: this.row,
266
272
  rowIndex: this.rowIndex,
273
+ rowIndexPath: ROW_INDEX_PATH,
267
274
  isFooter: this.isFooter,
268
275
  rowActionsClass: this.rowActionsClass,
269
276
  isRowActionsStickyLocal: this.isRowActionsStickyLocal,
@@ -375,6 +382,7 @@ export default {
375
382
  rowActionsClass: this.rowActionsClass,
376
383
  rowClass: this.rowClass,
377
384
  rowIndex,
385
+ rowIndexPath: `${ ROW_INDEX_PATH }_${ rowIndex }`,
378
386
  rowsLength: this.children.length,
379
387
  selectedRowsIndexes: this.selectedRowsIndexes,
380
388
  }, {
@@ -29,6 +29,7 @@ export default function AttributesAPI(props, {
29
29
  const row = toRef(props, "row");
30
30
  const rowClass = toRef(props, "rowClass");
31
31
  const rowIndex = toRef(props, "rowIndex");
32
+ const rowIndexPath = toRef(props, "rowIndexPath");
32
33
 
33
34
  const isMobile = inject("isMobile");
34
35
  const onTogglePreview = inject("onTogglePreview");
@@ -36,7 +37,8 @@ export default function AttributesAPI(props, {
36
37
 
37
38
  const rowHtmlId = computed(() => {
38
39
  const FOOTER_ID = isFooter.value ? "_footer" : "";
39
- return `${ tableId.value }${ FOOTER_ID }_${ rowIndex.value }`;
40
+ const ROW_INDEX_PATH = rowIndexPath.value || rowIndex.value;
41
+ return `${ tableId.value }${ FOOTER_ID }_${ ROW_INDEX_PATH }`;
40
42
  });
41
43
 
42
44
  const rowClassLocal = computed(() => {
@@ -0,0 +1,66 @@
1
+ import {
2
+ beforeAll,
3
+ describe,
4
+ expect,
5
+ it,
6
+ } from "@jest/globals";
7
+
8
+ import {
9
+ mockVueInject,
10
+ } from "../../../utilsTests/utilsTests";
11
+
12
+ describe("ATable row IDs", () => {
13
+ let AttributesAPI;
14
+ let RowActionsAPI;
15
+
16
+ beforeAll(async() => {
17
+ mockVueInject({
18
+ columnActionsOnePlusDropdownOptions: {},
19
+ rowActions: [],
20
+ tableId: "aloha",
21
+ });
22
+
23
+ AttributesAPI = (await import("../ATableTr/compositionAPI/AttributesAPI")).default;
24
+ RowActionsAPI = (await import("../compositionAPI/RowActionsAPI")).default;
25
+ });
26
+
27
+ it("uses the complete tree index path for a child row ID", () => {
28
+ const {
29
+ rowHtmlId,
30
+ } = AttributesAPI({
31
+ rowIndex: 1,
32
+ rowIndexPath: "0_1",
33
+ }, {});
34
+
35
+ expect(rowHtmlId.value).toBe("aloha_0_1");
36
+ });
37
+
38
+ it("uses the complete tree index path for a child actions ID", () => {
39
+ const {
40
+ buttonActionsId,
41
+ } = RowActionsAPI({
42
+ row: {},
43
+ rowIndex: 1,
44
+ rowIndexPath: "0_1",
45
+ });
46
+
47
+ expect(buttonActionsId.value).toBe("aloha_action_0_1");
48
+ });
49
+
50
+ it("keeps the existing ID format when no tree index path is provided", () => {
51
+ const {
52
+ rowHtmlId,
53
+ } = AttributesAPI({
54
+ rowIndex: 2,
55
+ }, {});
56
+ const {
57
+ buttonActionsId,
58
+ } = RowActionsAPI({
59
+ row: {},
60
+ rowIndex: 2,
61
+ });
62
+
63
+ expect(rowHtmlId.value).toBe("aloha_2");
64
+ expect(buttonActionsId.value).toBe("aloha_action_2");
65
+ });
66
+ });
@@ -24,13 +24,15 @@ export default function RowActionsAPI(props) {
24
24
  const isFooter = toRef(props, "isFooter");
25
25
  const row = toRef(props, "row");
26
26
  const rowIndex = toRef(props, "rowIndex");
27
+ const rowIndexPath = toRef(props, "rowIndexPath");
27
28
 
28
29
  const columnActionsOnePlusDropdownOptions = inject("columnActionsOnePlusDropdownOptions");
29
30
  const rowActions = inject("rowActions");
30
31
  const tableId = inject("tableId");
31
32
 
32
33
  const buttonActionsId = computed(() => {
33
- return `${ tableId.value }_action_${ rowIndex.value }`;
34
+ const ROW_INDEX_PATH = rowIndexPath.value || rowIndex.value;
35
+ return `${ tableId.value }_action_${ ROW_INDEX_PATH }`;
34
36
  });
35
37
 
36
38
  const indexFirstDropdownActionLocal = computed(() => {