aloha-vue 1.2.156 → 1.2.158

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.
@@ -68,6 +68,10 @@ export default {
68
68
  data.value = DATA;
69
69
  };
70
70
 
71
+ const disableRowPreview = ({ row }) => {
72
+ return row.id === 2 || row.id === 4;
73
+ };
74
+
71
75
  setData();
72
76
 
73
77
  return {
@@ -75,6 +79,7 @@ export default {
75
79
  codeJs,
76
80
  columns,
77
81
  data,
82
+ disableRowPreview,
78
83
  };
79
84
  },
80
85
  };
@@ -11,6 +11,7 @@ aloha-example(
11
11
  label="_A_TABLE_GROUP_SIMPLE_LABEL_"
12
12
  key-id="id"
13
13
  preview="right"
14
+ :disabled-preview-row-callback="disableRowPreview"
14
15
  )
15
16
  template(
16
17
  v-slot:preview="vm"
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.2.156",
17
+ "version": "1.2.158",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -115,6 +115,11 @@ export default {
115
115
  type: Boolean,
116
116
  required: false,
117
117
  },
118
+ disabledPreviewRowCallback: {
119
+ type: Function,
120
+ required: false,
121
+ default: () => {},
122
+ },
118
123
  disabledRowActions: {
119
124
  type: Boolean,
120
125
  required: false,
@@ -135,6 +140,7 @@ export default {
135
140
  hasScrollClass: {
136
141
  type: Boolean,
137
142
  required: false,
143
+ default: true,
138
144
  },
139
145
  id: {
140
146
  type: String,
@@ -839,6 +845,7 @@ export default {
839
845
  class: [
840
846
  "a_table",
841
847
  {
848
+ a_table_simple: this.isSimpleTable,
842
849
  a_table_bordered: this.borderType === "bordered",
843
850
  a_table_inner_bordered: this.borderType === "innerBordered",
844
851
  },
@@ -894,6 +901,7 @@ export default {
894
901
  areAllRowsSelected: this.areAllRowsSelected,
895
902
  countVisibleMobileColumns: this.countVisibleMobileColumns,
896
903
  disabledPreview: this.disabledPreview,
904
+ disabledPreviewRowCallback: this.disabledPreviewRowCallback,
897
905
  disabledRowActions: this.disabledRowActions,
898
906
  isFooter: false,
899
907
  isPreviewDownOpen: this.previewDownRowIndexes[rowIndex],
@@ -933,6 +941,7 @@ export default {
933
941
  areAllRowsSelected: this.areAllRowsSelected,
934
942
  countVisibleMobileColumns: this.countVisibleMobileColumns,
935
943
  disabledPreview: this.disabledPreview,
944
+ disabledPreviewRowCallback: this.disabledPreviewRowCallback,
936
945
  disabledRowActions: this.disabledRowActions,
937
946
  isFooter: true,
938
947
  isRowActionsStickyLocal: this.isRowActionsStickyLocal,
@@ -8,6 +8,7 @@ import ColumnStylesAPI from "../../compositionAPI/ColumnStylesAPI";
8
8
 
9
9
  export default function AttributesAPI(props) {
10
10
  const column = toRef(props, "column");
11
+ const disabledPreview = toRef(props, "disabledPreview");
11
12
  const isFooter = toRef(props, "isFooter");
12
13
 
13
14
  const hasPreview = inject("hasPreview");
@@ -22,7 +23,7 @@ export default function AttributesAPI(props) {
22
23
  class: [
23
24
  "a_table__td a_table__cell",
24
25
  {
25
- a_table__cell_click: hasPreview.value && !isFooter.value,
26
+ a_table__cell_click: hasPreview.value && !isFooter.value && !disabledPreview.value,
26
27
  },
27
28
  column.value.classRowParent,
28
29
  ],
@@ -38,6 +38,10 @@ export default {
38
38
  type: Boolean,
39
39
  required: false,
40
40
  },
41
+ disabledPreviewRowCallback: {
42
+ type: Function,
43
+ required: false,
44
+ },
41
45
  disabledRowActions: {
42
46
  type: Boolean,
43
47
  required: false,
@@ -133,6 +137,7 @@ export default {
133
137
  });
134
138
 
135
139
  const {
140
+ disabledPreviewRow,
136
141
  eventsLocal,
137
142
  roleLocal,
138
143
  rowClassComputed,
@@ -166,6 +171,7 @@ export default {
166
171
  ariaTreeAttributes,
167
172
  children,
168
173
  countInvisibleMobileColumns,
174
+ disabledPreviewRow,
169
175
  eventsLocal,
170
176
  hasChildren,
171
177
  isAllColumnsVisibleMobile,
@@ -202,7 +208,7 @@ export default {
202
208
  key: column.id,
203
209
  column,
204
210
  columnIndex,
205
- disabledPreview: this.disabledPreview,
211
+ disabledPreview: this.disabledPreviewRow,
206
212
  row: this.row,
207
213
  rowIndex: this.rowIndex,
208
214
  isFooter: this.isFooter,
@@ -215,7 +221,7 @@ export default {
215
221
  key: column.id,
216
222
  column,
217
223
  columnIndex,
218
- disabledPreview: this.disabledPreview,
224
+ disabledPreview: this.disabledPreviewRow,
219
225
  row: this.row,
220
226
  rowIndex: this.rowIndex,
221
227
  isFooter: this.isFooter,
@@ -294,7 +300,7 @@ export default {
294
300
  allVisibleMobileColumns: this.allVisibleMobileColumns,
295
301
  areAllRowsSelected: this.areAllRowsSelected,
296
302
  countVisibleMobileColumns: this.countVisibleMobileColumns,
297
- disabledPreview: this.disabledPreview,
303
+ disabledPreview: this.disabledPreviewRow,
298
304
  disabledRowActions: this.disabledRowActions,
299
305
  isFooter: this.isFooter,
300
306
  isOneOfParentsClose: this.isOneOfParentsCloseForChildren,
@@ -21,6 +21,7 @@ export default function AttributesAPI(props, {
21
21
  toggleChildren = () => {},
22
22
  }) {
23
23
  const disabledPreview = toRef(props, "disabledPreview");
24
+ const disabledPreviewRowCallback = toRef(props, "disabledPreviewRowCallback");
24
25
  const isFooter = toRef(props, "isFooter");
25
26
  const row = toRef(props, "row");
26
27
  const rowClass = toRef(props, "rowClass");
@@ -59,6 +60,10 @@ export default function AttributesAPI(props, {
59
60
  return isMobile.value ? "listitem" : "row";
60
61
  });
61
62
 
63
+ const disabledPreviewRow = computed(() => {
64
+ return disabledPreview.value || disabledPreviewRowCallback.value({ row: row.value, rowIndex: rowIndex.value });
65
+ });
66
+
62
67
  const onClickRow = $event => {
63
68
  if (isClickTags({
64
69
  $event,
@@ -75,9 +80,6 @@ export default function AttributesAPI(props, {
75
80
  if (hasChildren.value) {
76
81
  toggleChildren();
77
82
  } else if (hasPreviewLocal.value) {
78
- if (disabledPreview.value) {
79
- return;
80
- }
81
83
  onTogglePreview({
82
84
  row: row.value,
83
85
  rowIndex: rowIndex.value,
@@ -92,7 +94,7 @@ export default function AttributesAPI(props, {
92
94
  };
93
95
 
94
96
  const eventsLocal = computed(() => {
95
- if (hasChildren.value || hasPreviewLocal.value) {
97
+ if ((hasChildren.value || hasPreviewLocal.value) && !disabledPreviewRow.value) {
96
98
  return {
97
99
  tabindex: 0,
98
100
  onClick: onClickRow,
@@ -104,6 +106,7 @@ export default function AttributesAPI(props, {
104
106
  });
105
107
 
106
108
  return {
109
+ disabledPreviewRow,
107
110
  eventsLocal,
108
111
  roleLocal,
109
112
  rowClassComputed,
@@ -29,6 +29,7 @@ export default function ScrollControlAPI(props, { emit }, {
29
29
  const columnActionsWidth = toRef(props, "columnActionsWidth");
30
30
  const columnActionsWidthMin = toRef(props, "columnActionsWidthMin");
31
31
  const isActionColumnVisible = toRef(props, "isActionColumnVisible");
32
+ const isSimpleTable = toRef(props, "isSimpleTable");
32
33
 
33
34
  let changingTableWidth = false;
34
35
 
@@ -40,7 +41,7 @@ export default function ScrollControlAPI(props, { emit }, {
40
41
  });
41
42
  const columnsSpecialWidth = computed(() => {
42
43
  const columnMultipleActionsWidth = isMultipleActionsActive.value ? columnActionsWidthMin.value : 0;
43
- const scrollBarWidth = 10;
44
+ const scrollBarWidth = isSimpleTable.value ? 0 : 10; // delta for table resize when scrollbar appears
44
45
  return columnMultipleActionsWidth + scrollBarWidth;
45
46
  });
46
47
 
@@ -153,6 +154,7 @@ export default function ScrollControlAPI(props, { emit }, {
153
154
 
154
155
  const resizeOb = new ResizeObserver(entries => {
155
156
  // since we are observing only a single element, so we access the first element in entries array
157
+ // TODO add delta for table resize when scrollbar appears
156
158
  const RECT = entries[0].contentRect;
157
159
  if (tableWidth.value !== RECT.width) {
158
160
  if (!changingTableWidth) {
@@ -421,6 +421,7 @@
421
421
  padding-left: var(--a_table_between_actions_margin);
422
422
  }
423
423
  .a_table__top_panel__actions {
424
+ margin-left: auto;
424
425
  .a_table__action {
425
426
  margin-left: var(--a_table_between_actions_margin);
426
427
  }
@@ -608,27 +609,23 @@
608
609
  top: .5rem;
609
610
  }
610
611
  }
611
-
612
612
  .a_table_bordered {
613
613
  .a_table__body__row {
614
- border-left: var(--a_table_td_border_vertical_width) solid var(--a_table_td_border_vertical_color);
615
614
  border-right: var(--a_table_td_border_vertical_width) solid var(--a_table_td_border_vertical_color);
616
615
  }
617
616
  .a_table__head__row {
618
617
  border-right: var(--a_table_th_border_vertical_width) solid var(--a_table_th_border_vertical_color);
619
- border-left: var(--a_table_th_border_vertical_width) solid var(--a_table_th_border_vertical_color);
620
618
  }
621
619
  }
622
620
  .a_table_bordered,
623
621
  .a_table_inner_bordered {
624
- .a_table__td + .a_table__td {
622
+ .a_table__td {
625
623
  border-left: var(--a_table_td_border_vertical_width) solid var(--a_table_td_border_vertical_color);
626
624
  }
627
- .a_table__th + .a_table__th {
625
+ .a_table__th {
628
626
  border-left: var(--a_table_th_border_vertical_width) solid var(--a_table_th_border_vertical_color);
629
627
  }
630
628
  .a_table__th_group {
631
- width: 100%;
632
629
  &:not(:first-child) {
633
630
  .a_table__cell_group,
634
631
  .a_table__cell__child_group {
@@ -646,6 +643,18 @@
646
643
  border-bottom: var(--a_table_th_border_horizontal_width) solid var(--a_table_th_border_horizontal_color);
647
644
  }
648
645
  }
646
+ .a_table_simple.a_table_bordered {
647
+ .a_table__td:last-child {
648
+ border-right: var(--a_table_td_border_vertical_width) solid var(--a_table_td_border_vertical_color);
649
+ }
650
+ .a_table__th:last-child {
651
+ border-right: var(--a_table_td_border_vertical_width) solid var(--a_table_td_border_vertical_color);
652
+ }
653
+ .a_table__body__row,
654
+ .a_table__head__row {
655
+ border-right: none;
656
+ }
657
+ }
649
658
  .a_table__grandparent_without_scroll {
650
659
  .a_table__parent {
651
660
  overflow-x: unset;