aloha-vue 2.57.6 → 2.57.8

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.57.6",
3
+ "version": "2.57.8",
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",
@@ -7,6 +7,8 @@
7
7
  --a_table_form_row_dragging_bg: #e9eef5;
8
8
  --a_table_form_row_dragging_opacity: .65;
9
9
  --a_table_form_row_dragging_outline: 2px dashed var(--a_color_gray_700);
10
+ --a_table_form_focus_color: var(--a_color_primary);
11
+ --a_table_form_focus_box_shadow: 0 0 0 2px var(--a_table_form_focus_color);
10
12
  --a_table_form_row_hover_bg: #eef6ff;
11
13
  --a_table_form_row_drag_bg: #dfefff;
12
14
  --a_table_form_footer_bg: var(--a_color_gray_100);
@@ -24,6 +26,12 @@
24
26
 
25
27
  .a_table_form__wrapper {
26
28
  overflow-x: auto;
29
+
30
+ &:has(> .a_table_form__table:focus) {
31
+ position: relative;
32
+ z-index: 3;
33
+ box-shadow: var(--a_table_form_focus_box_shadow);
34
+ }
27
35
  }
28
36
 
29
37
  .a_table_form__drag_preview {
@@ -68,7 +76,7 @@
68
76
  border-left: 1px solid var(--a_table_form_border_color);
69
77
  }
70
78
 
71
- .a_table_form__row > .a_table_form__cell:last-child {
79
+ .a_table_form__row > .a_table_form__cell:last-child:not(.a_table_form__cell_actions_sticky) {
72
80
  border-right: 1px solid var(--a_table_form_border_color);
73
81
  }
74
82
 
@@ -120,6 +128,20 @@
120
128
 
121
129
  .a_table_form__row {
122
130
  position: relative;
131
+
132
+ &:focus {
133
+ z-index: 3;
134
+ box-shadow: var(--a_table_form_focus_box_shadow);
135
+
136
+ > .a_table_form__cell:first-child {
137
+ box-shadow: inset 1px 0 0 var(--a_table_form_focus_color);
138
+ }
139
+
140
+ > .a_table_form__cell_actions_sticky {
141
+ --a_table_form_cell_actions_edge_box_shadow:
142
+ inset -2px 0 0 var(--a_table_form_focus_color);
143
+ }
144
+ }
123
145
  }
124
146
 
125
147
  .a_table_form__row_drag_over .a_table_form__cell_td,
@@ -204,11 +226,15 @@
204
226
  }
205
227
 
206
228
  .a_table_form__cell_actions_sticky {
229
+ --a_table_form_cell_actions_edge_box_shadow:
230
+ inset -1px 0 0 var(--a_table_form_border_color);
231
+
207
232
  position: sticky;
208
233
  right: 0;
209
234
  z-index: 2;
210
235
  background: var(--a_table_form_bg);
211
236
  box-shadow:
237
+ var(--a_table_form_cell_actions_edge_box_shadow),
212
238
  inset 1px 0 0 rgba(0, 0, 0, .12),
213
239
  -8px 0 14px -8px rgba(17, 24, 39, .34),
214
240
  -18px 0 24px -20px rgba(17, 24, 39, .55);
@@ -198,6 +198,7 @@ export default {
198
198
 
199
199
  const {
200
200
  allColumnsLength,
201
+ columnsVisible,
201
202
  hasActionsColumn,
202
203
  } = ColumnsAPI(props);
203
204
 
@@ -228,6 +229,7 @@ export default {
228
229
  destroyColumnsGrowObserver,
229
230
  initColumnsGrowObserver,
230
231
  } = ColumnsGrowAPI(props, {
232
+ columnsVisible,
231
233
  hasActionsColumn,
232
234
  widthsLocal,
233
235
  });
@@ -251,6 +253,7 @@ export default {
251
253
  onCancelEditRow,
252
254
  onEditRow,
253
255
  } = EditAPI(props, {
256
+ columnsVisible,
254
257
  getRowKey,
255
258
  });
256
259
 
@@ -309,6 +312,7 @@ export default {
309
312
  canMoveRowUp,
310
313
  actionsClassesLocal,
311
314
  columnsStylesGrow,
315
+ columnsVisible,
312
316
  draggedRowIndex,
313
317
  dragOverPosition,
314
318
  dragOverRowIndex,
@@ -375,7 +379,7 @@ export default {
375
379
  canMoveRowUp: this.canMoveRowUp,
376
380
  cellTag: "th",
377
381
  changeModel: this.changeModel,
378
- columns: this.columns,
382
+ columns: this.columnsVisible,
379
383
  columnsStylesGrow: this.columnsStylesGrow,
380
384
  draggedRowIndex: this.draggedRowIndex,
381
385
  extra: this.extra,
@@ -426,7 +430,7 @@ export default {
426
430
  canMoveRowDown: this.canMoveRowDown,
427
431
  canMoveRowUp: this.canMoveRowUp,
428
432
  changeModel: this.changeModel,
429
- columns: this.columns,
433
+ columns: this.columnsVisible,
430
434
  columnsStylesGrow: this.columnsStylesGrow,
431
435
  draggedRowIndex: this.draggedRowIndex,
432
436
  editModel: this.activeEditRowKey === rowKey ? this.activeEditModel : undefined,
@@ -482,7 +486,7 @@ export default {
482
486
  canMoveRowDown: this.canMoveRowDown,
483
487
  canMoveRowUp: this.canMoveRowUp,
484
488
  changeModel: this.changeModel,
485
- columns: this.columns,
489
+ columns: this.columnsVisible,
486
490
  columnsStylesGrow: this.columnsStylesGrow,
487
491
  draggedRowIndex: this.draggedRowIndex,
488
492
  editModel: this.activeEditModel,
@@ -545,7 +549,7 @@ export default {
545
549
  canMoveRowDown: this.canMoveRowDown,
546
550
  canMoveRowUp: this.canMoveRowUp,
547
551
  changeModel: this.changeModel,
548
- columns: this.columns,
552
+ columns: this.columnsVisible,
549
553
  columnsStylesGrow: this.columnsStylesGrow,
550
554
  draggedRowIndex: this.draggedRowIndex,
551
555
  extra: this.extra,
@@ -15,8 +15,12 @@ export default function ColumnsAPI(props) {
15
15
  return !!(isEditable.value || isDeletable.value || isDeletableConfirm.value);
16
16
  });
17
17
 
18
+ const columnsVisible = computed(() => {
19
+ return columns.value.filter(column => column.isRender !== false);
20
+ });
21
+
18
22
  const allColumnsLength = computed(() => {
19
- let length = columns.value?.length || 0;
23
+ let length = columnsVisible.value.length;
20
24
  if (isDragAndDrop.value) {
21
25
  length += 1;
22
26
  }
@@ -29,6 +33,7 @@ export default function ColumnsAPI(props) {
29
33
 
30
34
  return {
31
35
  allColumnsLength,
36
+ columnsVisible,
32
37
  hasActionsColumn,
33
38
  };
34
39
  }
@@ -17,10 +17,10 @@ import {
17
17
  const TABLE_WIDTH_SAFE_DELTA = 2;
18
18
 
19
19
  export default function ColumnsGrowAPI(props, {
20
+ columnsVisible = computed(() => []),
20
21
  hasActionsColumn = computed(() => false),
21
22
  widthsLocal = computed(() => ({})),
22
23
  }) {
23
- const columns = toRef(props, "columns");
24
24
  const id = toRef(props, "id");
25
25
  const isColumnsGrow = toRef(props, "isColumnsGrow");
26
26
  const isDeletable = toRef(props, "isDeletable");
@@ -107,7 +107,7 @@ export default function ColumnsGrowAPI(props, {
107
107
  return;
108
108
  }
109
109
 
110
- const columnsLocal = columns.value || [];
110
+ const columnsLocal = columnsVisible.value || [];
111
111
  // Leave a small buffer to avoid subpixel overflow triggering a useless scrollbar.
112
112
  const tableWidthAvailable = tableWidth.value - actionsColumnWidth.value - dndColumnWidth.value - TABLE_WIDTH_SAFE_DELTA;
113
113
 
@@ -190,7 +190,7 @@ export default function ColumnsGrowAPI(props, {
190
190
  };
191
191
 
192
192
  watch([
193
- columns,
193
+ columnsVisible,
194
194
  hasActionsColumn,
195
195
  isDeletable,
196
196
  isDeletableConfirm,
@@ -13,10 +13,10 @@ import {
13
13
  } from "lodash-es";
14
14
 
15
15
  export default function EditAPI(props, {
16
+ columnsVisible = computed(() => []),
16
17
  getRowKey = () => {},
17
18
  }) {
18
19
  const addRow = toRef(props, "addRow");
19
- const columns = toRef(props, "columns");
20
20
  const isAddable = toRef(props, "isAddable");
21
21
  const isEditable = toRef(props, "isEditable");
22
22
  const prepareEditModel = toRef(props, "prepareEditModel");
@@ -43,7 +43,7 @@ export default function EditAPI(props, {
43
43
  return false;
44
44
  }
45
45
 
46
- return columns.value.some(column => {
46
+ return columnsVisible.value.some(column => {
47
47
  return !!column.formElement?.required;
48
48
  });
49
49
  });
@@ -95,7 +95,7 @@ export default function InputEventsAPI(props, {
95
95
  if (!validationOnChange.value) {
96
96
  return false;
97
97
  }
98
- if (!required.value && (isNil(val) || val === "")) {
98
+ if ((!required.value || skipRequiredModelInit.value) && (isNil(val) || val === "")) {
99
99
  return false;
100
100
  }
101
101
  const numValue = getNumValue(val);
@@ -644,7 +644,7 @@ export default function InputEventsAPI(props, {
644
644
  valueToCheck = splitVal[0];
645
645
  }
646
646
  if (isNil(valueToCheck) || valueToCheck === "") {
647
- if (required.value) {
647
+ if (required.value && !skipRequiredModelInit.value) {
648
648
  if (min.value > 0) {
649
649
  const value = decimalDivider.value
650
650
  ? `0${ decimalDivider.value }${ times(decimalPartLength.value, () => "0").join("") }`
@@ -653,12 +653,10 @@ export default function InputEventsAPI(props, {
653
653
  } else {
654
654
  setMinimumValue({ trigger: "blur", triggerDetails: "blur" });
655
655
  }
656
- onBlur($event);
657
-
658
- return;
656
+ } else {
657
+ const value = modelUndefinedLocal.value;
658
+ setValueLocal({ value, trigger: "blur", triggerDetails: "blur" });
659
659
  }
660
- const value = modelUndefinedLocal.value;
661
- setValueLocal({ value, trigger: "blur", triggerDetails: "blur" });
662
660
  onBlur($event);
663
661
 
664
662
  return;
@@ -46,12 +46,25 @@ export function setFocusToElement({ element, selector }) {
46
46
 
47
47
  const ELEMENT = element ? element : document.querySelector(selector);
48
48
  if (ELEMENT) {
49
- if (!ELEMENT.hasAttribute("tabindex")) {
50
- ELEMENT.setAttribute("tabindex", "-1");
51
- ELEMENT.focus();
52
- ELEMENT.removeAttribute("tabindex");
53
- } else {
49
+ if (ELEMENT.matches(focusableSelector)) {
54
50
  ELEMENT.focus();
51
+
52
+ return;
53
+ }
54
+
55
+ const hasTabindex = ELEMENT.hasAttribute("tabindex");
56
+ const removeTemporaryTabindex = () => ELEMENT.removeAttribute("tabindex");
57
+ if (!hasTabindex) {
58
+ ELEMENT.setAttribute("tabindex", "-1");
59
+ ELEMENT.addEventListener("blur", removeTemporaryTabindex, { once: true });
60
+ }
61
+
62
+ ELEMENT.focus();
63
+
64
+ // For example disabled button
65
+ if (!hasTabindex && document.activeElement !== ELEMENT) {
66
+ ELEMENT.removeEventListener("blur", removeTemporaryTabindex);
67
+ removeTemporaryTabindex();
55
68
  }
56
69
  }
57
70
  }