aloha-vue 1.0.140 → 1.0.141

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,7 +1,7 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.140",
4
+ "version": "1.0.141",
5
5
  "author": "Ilia Brykin",
6
6
  "scripts": {
7
7
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1"
@@ -17,14 +17,17 @@ import ATableTopPanel from "./ATableTopPanel/ATableTopPanel";
17
17
  import ATableTr from "./ATableTr/ATableTr";
18
18
 
19
19
  import LimitOffsetAPI from "./compositionAPI/LimitOffsetAPI";
20
+ import MobileAPI from "./compositionAPI/MobileAPI";
21
+ import MobileColumnsAPI from "./compositionAPI/MobileColumnsAPI";
20
22
  import MultipleActionAPI from "./compositionAPI/MultipleActionAPI";
21
23
  import PreviewAPI from "./compositionAPI/PreviewAPI";
22
24
  import RowsAPI from "./compositionAPI/RowsAPI";
23
25
  import ScrollControlAPI from "./compositionAPI/ScrollControlAPI";
26
+ import TableAttributesAPI from "./compositionAPI/TableAttributesAPI";
24
27
  import TableColumnsAPI from "./compositionAPI/TableColumnsAPI";
25
28
  import TableColumnsVisibleAPI from "./compositionAPI/TableColumnsVisibleAPI";
26
- import TableFiltersAPI from "./compositionAPI/TableFiltersAPI";
27
29
  import TableColumnsVisibleFunctionAPI from "./compositionAPI/TableColumnsVisibleFunctionAPI";
30
+ import TableFiltersAPI from "./compositionAPI/TableFiltersAPI";
28
31
 
29
32
  import {
30
33
  getModelColumnsOrderingDefault,
@@ -66,6 +69,12 @@ export default {
66
69
  required: false,
67
70
  default: undefined,
68
71
  },
72
+ countVisibleMobileColumns: {
73
+ type: Number,
74
+ required: false,
75
+ default: 4,
76
+ validator: value => value > 0,
77
+ },
69
78
  data: {
70
79
  type: [Array, Object, Promise],
71
80
  required: false,
@@ -150,6 +159,12 @@ export default {
150
159
  required: false,
151
160
  default: 10,
152
161
  },
162
+ mobileWidth: {
163
+ type: Number,
164
+ required: false,
165
+ default: 768,
166
+ validator: value => value >= 0,
167
+ },
153
168
  modelColumnsOrdering: {
154
169
  type: Array,
155
170
  required: false,
@@ -276,6 +291,10 @@ export default {
276
291
  modelColumnsVisibleLocal,
277
292
  } = TableColumnsVisibleAPI();
278
293
 
294
+ const {
295
+ isMobile,
296
+ } = MobileAPI(props);
297
+
279
298
  const {
280
299
  hasRows,
281
300
  limit,
@@ -311,6 +330,7 @@ export default {
311
330
  modelIsTableWithoutScroll,
312
331
  } = ScrollControlAPI(props, context, {
313
332
  columnsOrdered,
333
+ isMobile,
314
334
  isMultipleActionsActive,
315
335
  modelColumnsVisibleLocal,
316
336
  });
@@ -369,13 +389,29 @@ export default {
369
389
  offset,
370
390
  });
371
391
 
392
+ const {
393
+ tableChildRole,
394
+ tableRoleAttributes,
395
+ } = TableAttributesAPI({
396
+ isMobile,
397
+ });
398
+
399
+ const {
400
+ allVisibleMobileColumns,
401
+ } = MobileColumnsAPI({
402
+ columnsOrdered,
403
+ isMobile,
404
+ modelColumnsVisibleLocal,
405
+ });
406
+
372
407
  provide("changeModelIsTableWithoutScroll", changeModelIsTableWithoutScroll);
373
408
  provide("columnsOrdered", columnsOrdered);
374
- provide("columnsVisibleAdditionalSpaceForOneGrow", columnsVisibleAdditionalSpaceForOneGrow);
375
409
  provide("columnsScrollInvisible", columnsScrollInvisible);
410
+ provide("columnsVisibleAdditionalSpaceForOneGrow", columnsVisibleAdditionalSpaceForOneGrow);
376
411
  provide("currentMultipleActions", currentMultipleActions);
377
412
  provide("hasPreview", hasPreview);
378
413
  provide("indexFirstScrollInvisibleColumn", indexFirstScrollInvisibleColumn);
414
+ provide("isMobile", isMobile);
379
415
  provide("isMultipleActionsActive", isMultipleActionsActive);
380
416
  provide("modelIsTableWithoutScroll", modelIsTableWithoutScroll);
381
417
  provide("onTogglePreview", onTogglePreview);
@@ -389,6 +425,10 @@ export default {
389
425
 
390
426
 
391
427
  return {
428
+ allVisibleMobileColumns,
429
+ isMobile,
430
+ tableRoleAttributes,
431
+ tableChildRole,
392
432
  aTableRef,
393
433
  tableGrandparentRef,
394
434
  checkVisibleColumns,
@@ -537,7 +577,9 @@ export default {
537
577
  render() {
538
578
  return h("div", {
539
579
  ref: "tableGrandparentRef",
540
- class: "a_table__grandparent",
580
+ class: ["a_table__grandparent", {
581
+ a_table_mobile: this.isMobile,
582
+ }],
541
583
  }, [
542
584
  this.hasFilters && h(ATableFiltersTop, {
543
585
  filtersGroup: this.filtersGroup,
@@ -579,7 +621,7 @@ export default {
579
621
  }, this.$slots),
580
622
  h("div", {
581
623
  class: "a_table",
582
- role: "table",
624
+ ...this.tableRoleAttributes,
583
625
  }, [
584
626
  h(ATableHeader, {
585
627
  areAllRowsSelected: this.areAllRowsSelected,
@@ -589,9 +631,11 @@ export default {
589
631
  }),
590
632
  h("div", {
591
633
  class: "a_table__body",
592
- role: "rowgroup",
634
+ role: this.tableChildRole,
593
635
  }, this.rowsLocal.map((row, rowIndex) => {
594
636
  return h(ATableTr, {
637
+ allVisibleMobileColumns: this.allVisibleMobileColumns,
638
+ countVisibleMobileColumns: this.countVisibleMobileColumns,
595
639
  row,
596
640
  rowIndex,
597
641
  selectedRowsIndexes: this.selectedRowsIndexes,
@@ -612,9 +656,11 @@ export default {
612
656
  })),
613
657
  (this.hasRows && this.hasRowsFooter) && h("div", {
614
658
  class: "a_table__footer",
615
- role: "rowgroup",
659
+ role: this.tableChildRole,
616
660
  }, this.rowsFooter.map((row, rowIndex) => {
617
661
  return h(ATableTr, {
662
+ allVisibleMobileColumns: this.allVisibleMobileColumns,
663
+ countVisibleMobileColumns: this.countVisibleMobileColumns,
618
664
  row,
619
665
  rowIndex,
620
666
  selectedRowsIndexes: this.selectedRowsIndexes,
@@ -32,13 +32,15 @@ export default {
32
32
  "setSelectedRowsIndexes",
33
33
  ],
34
34
  inject: [
35
- "isActionColumnVisible",
36
35
  "changeColumnsOrdering",
37
36
  "columnsOrdered",
37
+ "isActionColumnVisible",
38
+ "isMobile",
38
39
  "isMultipleActionsActive",
39
40
  ],
40
41
  setup(props, { emit }) {
41
42
  const {
43
+ columnIndexDraggable,
42
44
  dragstart,
43
45
  dragenter,
44
46
  dragleave,
@@ -48,6 +50,7 @@ export default {
48
50
  root,
49
51
  } = DragAndDropParentAPI({
50
52
  classOver: "a_table__th_over",
53
+ classOverRight: "a_table__th_over_right",
51
54
  classOverParent: "a_table__th"
52
55
  });
53
56
 
@@ -56,6 +59,7 @@ export default {
56
59
  };
57
60
 
58
61
  return {
62
+ columnIndexDraggable,
59
63
  dragstart,
60
64
  dragenter,
61
65
  dragleave,
@@ -68,6 +72,9 @@ export default {
68
72
  };
69
73
  },
70
74
  render() {
75
+ if (this.isMobile) {
76
+ return "";
77
+ }
71
78
  return h("div", {
72
79
  ref: "root",
73
80
  role: "rowgroup",
@@ -98,6 +105,7 @@ export default {
98
105
  ref: "th",
99
106
  column: column,
100
107
  columnIndex: columnIndex,
108
+ columnIndexDraggable: this.columnIndexDraggable,
101
109
  "model-sort": this.modelSort,
102
110
  onDragstartParent: this.dragstart,
103
111
  onDragenterParent: this.dragenter,
@@ -23,6 +23,11 @@ export default {
23
23
  type: Number,
24
24
  required: true,
25
25
  },
26
+ columnIndexDraggable: {
27
+ type: Number,
28
+ required: false,
29
+ default: -1,
30
+ },
26
31
  modelSort: {
27
32
  type: String,
28
33
  required: false,
@@ -50,7 +55,7 @@ export default {
50
55
  isLocked,
51
56
  root,
52
57
  } = DragAndDropChildAPI(props, context, {
53
- classOver: "a_table__th_over",
58
+ classOverString: "a_table__th_over",
54
59
  });
55
60
 
56
61
  return {
@@ -34,15 +34,17 @@ export default {
34
34
  ],
35
35
  setup() {
36
36
  const {
37
- dragstart,
37
+ columnIndexDraggable,
38
+ dragend,
38
39
  dragenter,
39
40
  dragleave,
40
- dragend,
41
+ dragstart,
41
42
  drop,
42
43
  isDragstart,
43
44
  root,
44
45
  } = DragAndDropParentAPI({
45
46
  classOver: "a_table__th__dropdown__li_over",
47
+ classOverRight: "a_table__th__dropdown__li_over_right",
46
48
  classOverParent: "a_table__th__dropdown__li",
47
49
  });
48
50
 
@@ -52,6 +54,7 @@ export default {
52
54
  } = ColumnSearchAPI();
53
55
 
54
56
  return {
57
+ columnIndexDraggable,
55
58
  dragstart,
56
59
  dragenter,
57
60
  dragleave,
@@ -193,6 +196,7 @@ export default {
193
196
  return h(ATableHeaderThActionItem, {
194
197
  column,
195
198
  columnIndex,
199
+ columnIndexDraggable: this.columnIndexDraggable,
196
200
  searchColumnModel: this.searchColumnModel,
197
201
  onDragstartParent: this.dragstart,
198
202
  onDragenterParent: this.dragenter,
@@ -30,6 +30,11 @@ export default {
30
30
  type: Number,
31
31
  required: true,
32
32
  },
33
+ columnIndexDraggable: {
34
+ type: Number,
35
+ required: false,
36
+ default: -1,
37
+ },
33
38
  searchColumnModel: {
34
39
  type: String,
35
40
  required: true,
@@ -57,7 +62,7 @@ export default {
57
62
  isLocked,
58
63
  root,
59
64
  } = DragAndDropChildAPI(props, context, {
60
- classOver: "a_table__th__dropdown__li_over",
65
+ classOverString: "a_table__th__dropdown__li_over",
61
66
  });
62
67
 
63
68
  const {
@@ -3,11 +3,10 @@ import {
3
3
  resolveComponent,
4
4
  } from "vue";
5
5
 
6
- import ColumnStylesAPI from "../compositionAPI/ColumnStylesAPI";
6
+ import ATranslation from "../../ATranslation/ATranslation";
7
+
8
+ import AttributesAPI from "./compositionAPI/AttributesAPI";
7
9
 
8
- import {
9
- isClickOnLinkOrButton
10
- } from "../utils/utils";
11
10
  import {
12
11
  cloneDeep,
13
12
  forEach,
@@ -45,17 +44,18 @@ export default {
45
44
  inject: [
46
45
  "columnsDefaultValue",
47
46
  "hasPreview",
47
+ "isMobile",
48
48
  "onTogglePreview",
49
49
  "rowsLocal",
50
50
  "valuesForColumnDefault",
51
51
  ],
52
52
  setup(props) {
53
53
  const {
54
- columnsStyles,
55
- } = ColumnStylesAPI(props);
54
+ attributesForTd,
55
+ } = AttributesAPI(props);
56
56
 
57
57
  return {
58
- columnsStyles,
58
+ attributesForTd,
59
59
  };
60
60
  },
61
61
  computed: {
@@ -104,31 +104,6 @@ export default {
104
104
  return !!this.slot;
105
105
  },
106
106
 
107
- attributesForTd() {
108
- const ATTRIBUTES = {
109
- role: "cell",
110
- class: [
111
- "a_table__td a_table__cell",
112
- {
113
- a_table__cell_click: this.hasPreview && !this.isFooter,
114
- },
115
- ],
116
- style: this.columnsStyles,
117
- };
118
- if (this.hasPreview && !this.isFooter) {
119
- ATTRIBUTES.onClick = $event => {
120
- if (isClickOnLinkOrButton($event)) {
121
- return;
122
- }
123
- this.onTogglePreview({
124
- row: this.row,
125
- rowIndex: this.rowIndex,
126
- });
127
- };
128
- }
129
- return ATTRIBUTES;
130
- },
131
-
132
107
  isLink() {
133
108
  return !!this.column.to;
134
109
  },
@@ -175,9 +150,9 @@ export default {
175
150
  if (this.column.isRender === false) {
176
151
  return "";
177
152
  }
178
- return h(
179
- "div",
180
- this.attributesForTd,
153
+ const TD = h(
154
+ "div",
155
+ this.attributesForTd,
181
156
  [
182
157
  h("div", {
183
158
  class: [
@@ -210,5 +185,18 @@ export default {
210
185
  ])
211
186
  ]
212
187
  );
188
+
189
+ if (!this.isMobile) {
190
+ return TD;
191
+ }
192
+ return [
193
+ h(ATranslation, {
194
+ text: this.column.label,
195
+ tag: "dt",
196
+ }),
197
+ h("dd", {}, [
198
+ TD,
199
+ ]),
200
+ ];
213
201
  },
214
202
  };
@@ -0,0 +1,56 @@
1
+ import {
2
+ computed,
3
+ inject,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ import ColumnStylesAPI from "../../compositionAPI/ColumnStylesAPI";
8
+
9
+ import {
10
+ isClickOnLinkOrButton,
11
+ } from "../../utils/utils";
12
+
13
+ export default function AttributesAPI(props) {
14
+ const isFooter = toRef(props, "isFooter");
15
+ const row = toRef(props, "row");
16
+ const rowIndex = toRef(props, "rowIndex");
17
+
18
+ const hasPreview = inject("hasPreview");
19
+ const isMobile = inject("isMobile");
20
+ const onTogglePreview = inject("onTogglePreview");
21
+
22
+ const {
23
+ columnsStyles,
24
+ } = ColumnStylesAPI(props);
25
+
26
+ const attributesForTd = computed(() => {
27
+ const ATTRIBUTES = {
28
+ class: [
29
+ "a_table__td a_table__cell",
30
+ {
31
+ a_table__cell_click: hasPreview.value && !isFooter.value,
32
+ },
33
+ ],
34
+ style: columnsStyles.value,
35
+ };
36
+ if (!isMobile.value) {
37
+ ATTRIBUTES.role = "cell";
38
+ }
39
+ if (hasPreview.value && !isFooter.value) {
40
+ ATTRIBUTES.onClick = $event => {
41
+ if (isClickOnLinkOrButton($event)) {
42
+ return;
43
+ }
44
+ onTogglePreview({
45
+ row: row.value,
46
+ rowIndex: rowIndex.value,
47
+ });
48
+ };
49
+ }
50
+ return ATTRIBUTES;
51
+ });
52
+
53
+ return {
54
+ attributesForTd,
55
+ };
56
+ }
@@ -8,7 +8,11 @@ import ATableTd from "../ATableTd/ATableTd";
8
8
  import ATableTdAction from "../ATableTdAction/ATableTdAction";
9
9
  import AOneCheckbox from "../../ui/AOneCheckbox/AOneCheckbox";
10
10
 
11
+ import AttributesAPI from "./compositionAPI/AttributesAPI";
12
+ import MobileAPI from "./compositionAPI/MobileAPI";
13
+
11
14
  import {
15
+ forEach,
12
16
  get,
13
17
  isFunction,
14
18
  } from "lodash-es";
@@ -16,6 +20,14 @@ import {
16
20
  export default {
17
21
  name: "ATableTr",
18
22
  props: {
23
+ allVisibleMobileColumns: {
24
+ type: Array,
25
+ required: true,
26
+ },
27
+ countVisibleMobileColumns: {
28
+ type: Number,
29
+ required: true,
30
+ },
19
31
  row: {
20
32
  type: Object,
21
33
  required: true,
@@ -54,52 +66,33 @@ export default {
54
66
  return false;
55
67
  });
56
68
 
69
+ const {
70
+ rowAttributes,
71
+ } = AttributesAPI(props);
72
+
73
+ const {
74
+ isAllColumnsVisibleMobile,
75
+ isBtnToggleAllColumnsVisible,
76
+ textBtnToggleAllColumns,
77
+ toggleAllColumnsVisibleMobile,
78
+ } = MobileAPI(props);
79
+
57
80
  return {
81
+ isAllColumnsVisibleMobile,
82
+ isBtnToggleAllColumnsVisible,
58
83
  isCheckboxDisabled,
59
84
  isMultipleActionsActive,
85
+ rowAttributes,
86
+ textBtnToggleAllColumns,
87
+ toggleAllColumnsVisibleMobile,
60
88
  };
61
89
  },
62
90
  inject: [
63
91
  "columnsOrdered",
64
- "hasPreview",
65
92
  "isActionColumnVisible",
66
- "previewRightRowIndex",
67
- "previewRightRowIndexLast",
68
- "tableId",
93
+ "isMobile",
69
94
  ],
70
95
  computed: {
71
- rowId() {
72
- return `${ this.tableId }_${ this.rowIndex }`;
73
- },
74
-
75
- rowAttributes() {
76
- const ATTRIBUTES = {
77
- id: this.rowId,
78
- class: this.rowClass,
79
- role: "row",
80
- };
81
- if (this.hasPreview) {
82
- ATTRIBUTES.tabindex = -1;
83
- }
84
- return ATTRIBUTES;
85
- },
86
-
87
- rowClass() {
88
- return ["a_table__row a_table__row_hover", {
89
- a_table__row_focus: this.isPreviewRightForCurrentRowOpen,
90
- a_table__row_focus_was: this.isPreviewRightForCurrentRowWasOpen,
91
- }];
92
- },
93
-
94
- isPreviewRightForCurrentRowOpen() {
95
- return this.rowIndex === this.previewRightRowIndex;
96
- },
97
-
98
- isPreviewRightForCurrentRowWasOpen() {
99
- return !this.isPreviewRightForCurrentRowOpen &&
100
- this.rowIndex === this.previewRightRowIndexLast;
101
- },
102
-
103
96
  isRowSelected() {
104
97
  return !!this.selectedRowsIndexes[this.rowIndex];
105
98
  },
@@ -110,6 +103,47 @@ export default {
110
103
  },
111
104
  },
112
105
  render() {
106
+ let tds = [];
107
+ if (this.isMobile && !this.isAllColumnsVisibleMobile) {
108
+ forEach(this.allVisibleMobileColumns, (column, columnIndex) => {
109
+ if (columnIndex + 1 > this.countVisibleMobileColumns) {
110
+ return false;
111
+ }
112
+ tds.push(
113
+ h(ATableTd, {
114
+ column,
115
+ columnIndex,
116
+ row: this.row,
117
+ rowIndex: this.rowIndex,
118
+ isFooter: this.isFooter,
119
+ }, this.$slots)
120
+ );
121
+ });
122
+ } else {
123
+ tds = this.columnsOrdered.map((column, columnIndex) => {
124
+ return h(ATableTd, {
125
+ column,
126
+ columnIndex,
127
+ row: this.row,
128
+ rowIndex: this.rowIndex,
129
+ isFooter: this.isFooter,
130
+ }, this.$slots);
131
+ });
132
+ }
133
+
134
+ const ACTIONS = this.isActionColumnVisible &&
135
+ h(ATableTdAction, {
136
+ row: this.row,
137
+ rowIndex: this.rowIndex,
138
+ isFooter: this.isFooter,
139
+ }, this.$slots);
140
+
141
+ const CHILDREN = this.isMobile ?
142
+ h("dl", {
143
+ class: "a_table_mobile__dl",
144
+ }, tds) :
145
+ tds;
146
+
113
147
  return h("div", this.rowAttributes, [
114
148
  this.isMultipleActionsActive && h("div", {
115
149
  scope: "row",
@@ -123,20 +157,18 @@ export default {
123
157
  "onUpdate:modelValue": this.toggleCheckbox,
124
158
  }),
125
159
  ]),
126
- this.columnsOrdered.map((column, columnIndex) => {
127
- return h(ATableTd, {
128
- column,
129
- columnIndex,
130
- row: this.row,
131
- rowIndex: this.rowIndex,
132
- isFooter: this.isFooter,
133
- }, this.$slots);
134
- }),
135
- this.isActionColumnVisible && h(ATableTdAction, {
136
- row: this.row,
137
- rowIndex: this.rowIndex,
138
- isFooter: this.isFooter,
139
- }, this.$slots),
160
+ CHILDREN,
161
+ this.isMobile ?
162
+ h("div", {
163
+ class: "a_table_mobile__actions_parent",
164
+ }, [
165
+ this.isBtnToggleAllColumnsVisible && h("button", {
166
+ class: "a_btn a_btn_link a_table_mobile__columns_btn_toggle",
167
+ onClick: this.toggleAllColumnsVisibleMobile,
168
+ }, this.textBtnToggleAllColumns),
169
+ ACTIONS,
170
+ ]) :
171
+ ACTIONS,
140
172
  ]);
141
173
  },
142
174
  };
@@ -0,0 +1,55 @@
1
+ import {
2
+ computed,
3
+ inject,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ export default function AttributesAPI(props) {
8
+ const rowIndex = toRef(props, "rowIndex");
9
+
10
+ const hasPreview = inject("hasPreview");
11
+ const isMobile = inject("isMobile");
12
+ const previewRightRowIndex = inject("previewRightRowIndex");
13
+ const previewRightRowIndexLast = inject("previewRightRowIndexLast");
14
+ const tableId = inject("tableId");
15
+
16
+ const rowId = computed(() => {
17
+ return `${ tableId.value }_${ rowIndex.value }`;
18
+ });
19
+
20
+ const isPreviewRightForCurrentRowOpen = computed(() => {
21
+ return rowIndex.value === previewRightRowIndex.value;
22
+ });
23
+
24
+ const isPreviewRightForCurrentRowWasOpen = computed(() => {
25
+ return !isPreviewRightForCurrentRowOpen.value &&
26
+ rowIndex.value === previewRightRowIndexLast.value;
27
+ });
28
+
29
+ const rowClass = computed(() => {
30
+ return ["a_table__row a_table__row_hover", {
31
+ a_table__row_focus: isPreviewRightForCurrentRowOpen.value,
32
+ a_table__row_focus_was: isPreviewRightForCurrentRowWasOpen.value,
33
+ }];
34
+ });
35
+
36
+ const roleLocal = computed(() => {
37
+ return isMobile.value ? "listitem" : "row";
38
+ });
39
+
40
+ const rowAttributes = computed(() => {
41
+ const ATTRIBUTES = {
42
+ id: rowId.value,
43
+ class: rowClass.value,
44
+ role: roleLocal.value,
45
+ };
46
+ if (hasPreview.value) {
47
+ ATTRIBUTES.tabindex = -1;
48
+ }
49
+ return ATTRIBUTES;
50
+ });
51
+
52
+ return {
53
+ rowAttributes,
54
+ };
55
+ }
@@ -0,0 +1,47 @@
1
+ import {
2
+ computed, inject,
3
+ ref, toRef,
4
+ } from "vue";
5
+
6
+ export default function MobileAPI(props) {
7
+ const allVisibleMobileColumns = toRef(props, "allVisibleMobileColumns");
8
+ const countVisibleMobileColumns = toRef(props, "countVisibleMobileColumns");
9
+
10
+ const isMobile = inject("isMobile");
11
+
12
+ const isAllColumnsVisibleMobile = ref(false);
13
+
14
+ const countInvisibleMobileColumns = computed(() => {
15
+ return allVisibleMobileColumns.value.length - countVisibleMobileColumns.value;
16
+ });
17
+
18
+ const isBtnToggleAllColumnsVisible = computed(() => {
19
+ return isMobile.value &&
20
+ (allVisibleMobileColumns.value.length > countVisibleMobileColumns.value);
21
+ });
22
+
23
+ const textOpenBtnToggleAllColumns = computed(() => {
24
+ return countInvisibleMobileColumns.value === 1 ?
25
+ `+ ${ countInvisibleMobileColumns.value } Feld` :
26
+ `+ ${ countInvisibleMobileColumns.value } Felder`;
27
+ });
28
+
29
+ const textBtnToggleAllColumns = computed(() => {
30
+ return isAllColumnsVisibleMobile.value ?
31
+ "Schließen" :
32
+ textOpenBtnToggleAllColumns.value;
33
+ });
34
+
35
+ const toggleAllColumnsVisibleMobile = $event => {
36
+ isAllColumnsVisibleMobile.value = !isAllColumnsVisibleMobile.value;
37
+ $event.stopPropagation();
38
+ };
39
+
40
+
41
+ return {
42
+ isAllColumnsVisibleMobile,
43
+ isBtnToggleAllColumnsVisible,
44
+ textBtnToggleAllColumns,
45
+ toggleAllColumnsVisibleMobile,
46
+ };
47
+ }
@@ -5,15 +5,25 @@ import {
5
5
  toRef,
6
6
  } from "vue";
7
7
 
8
- export default function DragAndDropChildAPI(props, { emit }, { classOver = "" }) {
8
+ export default function DragAndDropChildAPI(props, { emit }, {
9
+ classOverString = "",
10
+ }) {
9
11
  const column = toRef(props, "column");
10
12
  const columnIndex = toRef(props, "columnIndex");
13
+ const columnIndexDraggable = toRef(props, "columnIndexDraggable");
11
14
 
12
15
  const isLoadingOptions = inject("isLoadingOptions");
13
16
  const isColumnsDnd = inject("isColumnsDnd");
14
17
 
15
18
  const root = ref(null);
16
19
 
20
+ const classOver = computed(() => {
21
+ if (columnIndexDraggable.value > columnIndex.value) {
22
+ return classOverString;
23
+ }
24
+ return `${ classOverString }_right`;
25
+ });
26
+
17
27
  const dragstart = $event => {
18
28
  $event.target.style.opacity = "0.4";
19
29
  $event.dataTransfer.effectAllowed = "move";
@@ -24,13 +34,13 @@ export default function DragAndDropChildAPI(props, { emit }, { classOver = "" })
24
34
 
25
35
  const dragend = $event => {
26
36
  $event.target.style.opacity = "1";
27
- $event.target.classList.remove(classOver);
37
+ $event.target.classList.remove(classOver.value);
28
38
  emit("dragendParent");
29
39
  };
30
40
 
31
41
  const dragenter = () => {
32
- if (root.value && root.value) {
33
- root.value.classList.add(classOver);
42
+ if (root.value && root.value.classList) {
43
+ root.value.classList.add(classOver.value);
34
44
  }
35
45
  emit("dragenterParent", {
36
46
  columnIndex: columnIndex.value,
@@ -46,7 +56,7 @@ export default function DragAndDropChildAPI(props, { emit }, { classOver = "" })
46
56
 
47
57
  const dragleave = () => {
48
58
  if (root.value && root.value) {
49
- root.value.classList.remove(classOver);
59
+ root.value.classList.remove(classOver.value);
50
60
  }
51
61
  emit("dragleaveParent", {
52
62
  columnIndex: columnIndex.value,
@@ -11,6 +11,7 @@ import {
11
11
 
12
12
  export default function DragAndDropParentAPI({
13
13
  classOver = "",
14
+ classOverRight = "",
14
15
  classOverParent = "",
15
16
  }) {
16
17
  const root = ref(undefined);
@@ -53,6 +54,7 @@ export default function DragAndDropParentAPI({
53
54
  const CHILDREN = root.value.querySelectorAll(`.${ classOverParent }`);
54
55
  CHILDREN.forEach(child => {
55
56
  child.classList.remove(classOver);
57
+ child.classList.remove(classOverRight);
56
58
  });
57
59
  };
58
60
 
@@ -63,6 +65,7 @@ export default function DragAndDropParentAPI({
63
65
 
64
66
 
65
67
  return {
68
+ columnIndexDraggable,
66
69
  dragstart,
67
70
  dragenter,
68
71
  dragleave,
@@ -0,0 +1,26 @@
1
+ import {
2
+ onBeforeUnmount,
3
+ ref,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ export default function MobileAPI(props) {
8
+ const mobileWidth = toRef(props, "mobileWidth");
9
+
10
+ const isMobile = ref(false);
11
+
12
+ const checkMobileWidth = () => {
13
+ isMobile.value = window.innerWidth <= mobileWidth.value;
14
+ };
15
+
16
+ checkMobileWidth();
17
+ window.addEventListener("resize", checkMobileWidth);
18
+
19
+ onBeforeUnmount(() => {
20
+ window.removeEventListener("resize", checkMobileWidth);
21
+ });
22
+
23
+ return {
24
+ isMobile,
25
+ };
26
+ }
@@ -0,0 +1,27 @@
1
+ import {
2
+ computed,
3
+ ref,
4
+ } from "vue";
5
+
6
+ import {
7
+ filter,
8
+ } from "lodash-es";
9
+
10
+ export default function MobileColumnsAPI({
11
+ columnsOrdered = ref([]),
12
+ isMobile = ref(false),
13
+ modelColumnsVisibleLocal = ref({}),
14
+ }) {
15
+ const allVisibleMobileColumns = computed(() => {
16
+ if (!isMobile.value) {
17
+ return [];
18
+ }
19
+ return filter(columnsOrdered.value, column => {
20
+ return !!(column.isRender !== false && modelColumnsVisibleLocal.value[column.id]);
21
+ });
22
+ });
23
+
24
+ return {
25
+ allVisibleMobileColumns,
26
+ };
27
+ }
@@ -3,7 +3,7 @@ import {
3
3
  onBeforeUnmount,
4
4
  onMounted,
5
5
  ref,
6
- toRef,
6
+ toRef, watch,
7
7
  } from "vue";
8
8
 
9
9
  import {
@@ -14,6 +14,7 @@ import {
14
14
 
15
15
  export default function ScrollControlAPI(props, { emit }, {
16
16
  columnsOrdered = computed(() => []),
17
+ isMobile = ref(false),
17
18
  isMultipleActionsActive = ref(undefined),
18
19
  modelColumnsVisibleLocal = ref({}),
19
20
  }) {
@@ -84,7 +85,17 @@ export default function ScrollControlAPI(props, { emit }, {
84
85
  }
85
86
  };
86
87
 
88
+ const setAllDefaultForMobile = () => {
89
+ columnsScrollInvisible.value = [];
90
+ columnsVisibleAdditionalSpaceForOneGrow.value = 0;
91
+ indexFirstScrollInvisibleColumn.value = 1000;
92
+ };
93
+
87
94
  const checkVisibleColumns = () => {
95
+ if (isMobile.value) {
96
+ setAllDefaultForMobile();
97
+ return;
98
+ }
88
99
  const TABLE_WIDTH_WITHOUT_ACTIONS = tableWidth.value - columnsSpecialWidth.value;
89
100
 
90
101
  let columnsWidthInOrder = 0;
@@ -127,8 +138,19 @@ export default function ScrollControlAPI(props, { emit }, {
127
138
  }
128
139
  });
129
140
 
141
+ watch(isMobile, newValue => {
142
+ if (newValue) {
143
+ resizeOb.unobserve(aTableRef.value);
144
+ setAllDefaultForMobile();
145
+ } else {
146
+ resizeOb.observe(aTableRef.value);
147
+ }
148
+ });
149
+
130
150
  onMounted(() => {
131
- resizeOb.observe(aTableRef.value);
151
+ if (!isMobile.value) {
152
+ resizeOb.observe(aTableRef.value);
153
+ }
132
154
  });
133
155
  onBeforeUnmount(() => {
134
156
  resizeOb.unobserve(aTableRef.value);
@@ -0,0 +1,25 @@
1
+ import {
2
+ computed,
3
+ ref,
4
+ } from "vue";
5
+
6
+ export default function TableAttributesAPI({
7
+ isMobile = ref(false),
8
+ }) {
9
+ const tableRoleAttributes = computed(() => {
10
+ const ATTRIBUTES = {};
11
+ if (!isMobile.value) {
12
+ ATTRIBUTES.role = "table";
13
+ }
14
+ return ATTRIBUTES;
15
+ });
16
+
17
+ const tableChildRole = computed(() => {
18
+ return isMobile.value ? "list" : "rowgroup";
19
+ });
20
+
21
+ return {
22
+ tableChildRole,
23
+ tableRoleAttributes,
24
+ };
25
+ }
@@ -1,7 +1,7 @@
1
1
  .a_table__parent {
2
2
  --a_table_th_bg: #f1f4f7;
3
- --a_table_th_border_width: 0 0 3px 0;
4
- --a_table_th_border_color: #d0c9c0;
3
+ --a_table_th_border_bottom_width: 3px;
4
+ --a_table_th_border_bottom_color: #d0c9c0;
5
5
  --a_table_th_sorting_bg: #d0e3a4;
6
6
  --a_table_cell_padding_x: .5rem;
7
7
  --a_table_cell_padding_y: .5rem;
@@ -18,6 +18,8 @@
18
18
  --a_table_preview_right_header_bg: #f1f4f7;
19
19
  --a_table_preview_right_header_font_size: 1.5rem;
20
20
  --a_table_footer_border_top: 2px solid var(--a_color_gray_800);
21
+ --a_table_draggable_color: var(--a_color_primary);
22
+ --a_table_mobile_dt_dd_border_bottom: 1px solid var(--a_color_gray_200);
21
23
 
22
24
  width: 100%;
23
25
  overflow-x: hidden;
@@ -51,15 +53,19 @@
51
53
  word-wrap: break-word;
52
54
  word-break: break-word;
53
55
  hyphens: auto;
54
- .a_table__row_hover:hover &,
55
- .a_table__row_hover:focus-within & {
56
- background-color: var(--a_table_row_hover_bg);
57
- }
58
- .a_table__row.a_table__row_focus > & {
59
- background-color: var(--a_table_row_preview_focus_bg);
60
- }
61
- .a_table__row.a_table__row_focus_was > & {
62
- background-color: var(--a_table_row_preview_focus_was_bg);
56
+ }
57
+ .a_table__grandparent:not(.a_table_mobile) {
58
+ .a_table__cell {
59
+ .a_table__row_hover:hover &,
60
+ .a_table__row_hover:focus-within & {
61
+ background-color: var(--a_table_row_hover_bg);
62
+ }
63
+ .a_table__row.a_table__row_focus > & {
64
+ background-color: var(--a_table_row_preview_focus_bg);
65
+ }
66
+ .a_table__row.a_table__row_focus_was > & {
67
+ background-color: var(--a_table_row_preview_focus_was_bg);
68
+ }
63
69
  }
64
70
  }
65
71
  .a_table__cell__child {
@@ -92,16 +98,89 @@
92
98
  display: flex;
93
99
  align-items: center;
94
100
  background-color: var(--a_table_th_bg);
95
- border-style: solid;
96
- border-width: var(--a_table_th_border_width);
97
- border-color: var(--a_table_th_border_color);
101
+ border-bottom: var(--a_table_th_border_bottom_width) solid var(--a_table_th_border_bottom_color);
98
102
  }
99
103
  .a_table__th_draggable {
100
104
  cursor: move;
101
105
  }
102
106
  .a_table__th_over {
103
- border-left: 10px solid #666;
107
+ border-left: 6px solid var(--a_table_draggable_color);
108
+ position: relative;
109
+ &:before,
110
+ &:after {
111
+ content: "";
112
+ position: absolute;
113
+ left: -15px;
114
+ border: 12px solid transparent;
115
+ }
116
+ &:before {
117
+ top: 0;
118
+ border-top: 15px solid var(--a_table_draggable_color);
119
+ }
120
+ &:after {
121
+ bottom: calc(-1 * var(--a_table_th_border_bottom_width));
122
+ border-bottom: 15px solid var(--a_table_draggable_color);
123
+ }
124
+ }
125
+ .a_table__th_over_right {
126
+ border-right: 6px solid var(--a_table_draggable_color);
127
+ position: relative;
128
+ &:before,
129
+ &:after {
130
+ content: "";
131
+ position: absolute;
132
+ right: -15px;
133
+ border: 12px solid transparent;
134
+ }
135
+ &:before {
136
+ top: 0;
137
+ border-top: 15px solid var(--a_table_draggable_color);
138
+ }
139
+ &:after {
140
+ bottom: calc(-1 * var(--a_table_th_border_bottom_width));
141
+ border-bottom: 15px solid var(--a_table_draggable_color);
142
+ }
143
+ }
144
+
145
+ .a_table__th__dropdown__li_over {
146
+ border-top: 6px solid var(--a_table_draggable_color);
147
+ position: relative;
148
+ &:before,
149
+ &:after {
150
+ content: "";
151
+ position: absolute;
152
+ top: -15px;
153
+ border: 12px solid transparent;
154
+ }
155
+ &:before {
156
+ left: 0;
157
+ border-left: 15px solid var(--a_table_draggable_color);
158
+ }
159
+ &:after {
160
+ right: 0;
161
+ border-right: 15px solid var(--a_table_draggable_color);
162
+ }
163
+ }
164
+ .a_table__th__dropdown__li_over_right {
165
+ border-bottom: 6px solid var(--a_table_draggable_color);
166
+ position: relative;
167
+ &:before,
168
+ &:after {
169
+ content: "";
170
+ position: absolute;
171
+ bottom: -15px;
172
+ border: 12px solid transparent;
173
+ }
174
+ &:before {
175
+ left: 0;
176
+ border-left: 15px solid var(--a_table_draggable_color);
177
+ }
178
+ &:after {
179
+ right: 0;
180
+ border-right: 15px solid var(--a_table_draggable_color);
181
+ }
104
182
  }
183
+
105
184
  .a_table__th_sorting {
106
185
  background-color: var(--a_table_th_sorting_bg);
107
186
  }
@@ -172,6 +251,8 @@
172
251
  }
173
252
 
174
253
  .a_table__th__dropdown__ul {
254
+ --a_table_draggable_color: var(--a_color_primary);
255
+
175
256
  list-style: none;
176
257
  margin: 0;
177
258
  padding: 0;
@@ -190,9 +271,7 @@
190
271
  margin-left: 1rem;
191
272
  cursor: move;
192
273
  }
193
- .a_table__th__dropdown__li_over {
194
- border-left: 10px solid red;
195
- }
274
+
196
275
  .a_table__th__dropdown__search {
197
276
  padding-top: .75rem;
198
277
  }
@@ -322,3 +401,46 @@
322
401
  .a_pagination__count__button {
323
402
  padding: 0;
324
403
  }
404
+
405
+ .a_table_mobile {
406
+ .a_table__row {
407
+ flex-direction: column;
408
+ border-top: 1px solid;
409
+ border-top-color: inherit;
410
+ }
411
+ .a_table__td {
412
+ border-bottom: none;
413
+ }
414
+ }
415
+
416
+ .a_table_mobile__dl {
417
+ display: flex;
418
+ flex-wrap: wrap;
419
+ margin: 0;
420
+ dt, dd {
421
+ width: 50%;
422
+ border-bottom: var(--a_table_mobile_dt_dd_border_bottom);
423
+ display: flex;
424
+ align-items: center;
425
+ }
426
+ dt {
427
+ font-weight: bolder;
428
+ padding-right: 1rem;
429
+ white-space: normal;
430
+ word-wrap: break-word;
431
+ word-break: break-word;
432
+ hyphens: auto;
433
+ }
434
+ .a_table__td {
435
+ width: 100% !important;
436
+ min-width: 100% !important;
437
+ max-width: 100% !important;
438
+ }
439
+ }
440
+ .a_table_mobile__actions_parent {
441
+ display: flex;
442
+ align-items: center;
443
+ }
444
+ .a_table_mobile__columns_btn_toggle {
445
+ padding: 0;
446
+ }