aloha-vue 1.0.258 → 1.0.259

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.258",
4
+ "version": "1.0.259",
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"
@@ -3,6 +3,8 @@ import {
3
3
  toRef,
4
4
  } from "vue";
5
5
 
6
+ import ADropdownGlobalAPI from "../../compositionAPI/ADropdownGlobalAPI";
7
+
6
8
  import AKeysCode from "../../const/AKeysCode";
7
9
  import {
8
10
  forEach,
@@ -24,6 +26,11 @@ export default function ToggleAPI(props, {
24
26
  const buttonWidth = ref(undefined);
25
27
  const statusEventPressArrows = ref(false);
26
28
 
29
+ const {
30
+ closeDropdownGlobal,
31
+ openDropdownGlobal,
32
+ } = ADropdownGlobalAPI();
33
+
27
34
  const pressArrows = ({ down }) => {
28
35
  const ELEMENTS = dropdownRef.value.querySelectorAll(elementsForArrows.value);
29
36
  if (ELEMENTS.length === 0) {
@@ -108,6 +115,7 @@ export default function ToggleAPI(props, {
108
115
  setTimeout(() => {
109
116
  setFocusToFirstElement();
110
117
  });
118
+ openDropdownGlobal();
111
119
  });
112
120
  statusExpanded.value = true;
113
121
  };
@@ -139,6 +147,7 @@ export default function ToggleAPI(props, {
139
147
  destroyEventPressArrows();
140
148
  destroyPopover();
141
149
  statusExpanded.value = false;
150
+ closeDropdownGlobal();
142
151
  }
143
152
 
144
153
  function onClickEvent($event) {
@@ -99,12 +99,14 @@ export default {
99
99
  isHideWithoutActionAndSlot: true,
100
100
  actions: this.actionsDropdown,
101
101
  useActionClass: this.useDropdownActionClass,
102
+ disabled: this.disabled,
102
103
  ...this.dropdownAttributes,
103
104
  }, this.$slots),
104
105
  ]),
105
106
  this.isDropdownActionsAfterGroup && h(ADropdown, {
106
107
  isHideWithoutActionAndSlot: true,
107
108
  actions: this.actionsDropdown,
109
+ disabled: this.disabled,
108
110
  useActionClass: this.useDropdownActionClass,
109
111
  ...this.dropdownAttributes,
110
112
  }, this.$slots),
@@ -16,13 +16,14 @@ import ATablePreviewRight from "./ATablePreviewRight/ATablePreviewRight";
16
16
  import ATableTopPanel from "./ATableTopPanel/ATableTopPanel";
17
17
  import ATableTr from "./ATableTr/ATableTr";
18
18
 
19
+ import AMobileAPI from "../compositionAPI/AMobileAPI";
19
20
  import LimitOffsetAPI from "./compositionAPI/LimitOffsetAPI";
20
- import MobileAPI from "./compositionAPI/MobileAPI";
21
21
  import MobileColumnsAPI from "./compositionAPI/MobileColumnsAPI";
22
22
  import MultipleActionAPI from "./compositionAPI/MultipleActionAPI";
23
23
  import PreviewAPI from "./compositionAPI/PreviewAPI";
24
24
  import RowsAPI from "./compositionAPI/RowsAPI";
25
25
  import ScrollControlAPI from "./compositionAPI/ScrollControlAPI";
26
+ import StickyAPI from "./compositionAPI/StickyAPI";
26
27
  import TableAttributesAPI from "./compositionAPI/TableAttributesAPI";
27
28
  import TableColumnsAPI from "./compositionAPI/TableColumnsAPI";
28
29
  import TableColumnsVisibleAPI from "./compositionAPI/TableColumnsVisibleAPI";
@@ -164,12 +165,6 @@ export default {
164
165
  required: false,
165
166
  default: 10,
166
167
  },
167
- mobileWidth: {
168
- type: Number,
169
- required: false,
170
- default: 768,
171
- validator: value => value >= 0,
172
- },
173
168
  modelColumnsOrdering: {
174
169
  type: Array,
175
170
  required: false,
@@ -226,6 +221,11 @@ export default {
226
221
  required: false,
227
222
  default: () => [],
228
223
  },
224
+ rowActionsSticky: {
225
+ type: Boolean,
226
+ required: false,
227
+ default: true,
228
+ },
229
229
  rowActionsClass: {
230
230
  type: [String, Object],
231
231
  required: false,
@@ -325,7 +325,7 @@ export default {
325
325
 
326
326
  const {
327
327
  isMobile,
328
- } = MobileAPI(props);
328
+ } = AMobileAPI();
329
329
 
330
330
  const {
331
331
  hasRows,
@@ -351,6 +351,13 @@ export default {
351
351
  modelColumnsVisibleLocal,
352
352
  });
353
353
 
354
+ const {
355
+ isRowActionsStickyLocal,
356
+ } = StickyAPI(props, {
357
+ isMobile,
358
+ modelIsTableWithoutScroll,
359
+ });
360
+
354
361
  const {
355
362
  areAllRowsSelected,
356
363
  areAllVisibleRowsSelected,
@@ -473,65 +480,61 @@ export default {
473
480
 
474
481
  return {
475
482
  allVisibleMobileColumns,
483
+ areAllRowsSelected,
484
+ areAllVisibleRowsSelected,
485
+ areSomeRowsSelected,
476
486
  aTableRef,
487
+ changeLimit,
477
488
  changeModelColumnsVisible,
489
+ changeOffset,
478
490
  checkVisibleColumns,
491
+ closeFilterValue,
492
+ closeMultipleActionsActive,
493
+ closePreview,
494
+ closePreviewAll,
479
495
  columnsOrdered,
496
+ dataKeyByKeyIdPerFilter,
497
+ filtersGroup,
498
+ filtersKeyById,
499
+ filtersVisible,
500
+ filtersVisibleAll,
501
+ hasFilters,
502
+ hasRows,
480
503
  hasViews,
481
504
  initModelColumnsVisibleLocal,
482
505
  isMobile,
506
+ isMultipleActionsActive,
507
+ isPreviewRightOpen,
508
+ isRowActionsStickyLocal,
483
509
  isViewTableVisible,
510
+ limit,
484
511
  modelColumnsOrderingLocal,
485
512
  modelColumnsVisibleLocal,
513
+ modelFiltersLocal,
486
514
  modelIsTableWithoutScroll,
487
- onUpdateModelFilters,
488
- tableChildRole,
489
- tableGrandparentRef,
490
- tableRoleAttributes,
491
- updateViewCurrent,
492
- viewCurrent,
493
-
494
- closePreview,
495
- closePreviewAll,
496
- isPreviewRightOpen,
515
+ modelSort,
497
516
  mousedownResizePreviewRight,
498
517
  mousemoveResizePreviewRight,
499
518
  mouseupResizePreviewRight,
519
+ offset,
520
+ onUpdateModelFilters,
500
521
  previewDownRowIndexes,
501
522
  previewRightRowIndex,
502
- togglePreviewResize,
503
-
504
- hasRows,
505
- limit,
506
- modelSort,
507
- offset,
508
523
  rowsLocal,
509
524
  rowsLocalLength,
510
-
511
- areAllRowsSelected,
512
- areAllVisibleRowsSelected,
513
- areSomeRowsSelected,
514
- closeMultipleActionsActive,
515
- isMultipleActionsActive,
516
525
  selectedRows,
517
526
  selectedRowsIndexes,
518
527
  setEmptySelectedRowsIndexes,
519
528
  setSelectedRowsIndexes,
529
+ startSearch,
530
+ tableChildRole,
531
+ tableGrandparentRef,
532
+ tableRoleAttributes,
520
533
  toggleBtnAllRows,
521
534
  toggleMultipleActionsActive,
522
-
523
- changeOffset,
524
- changeLimit,
525
-
526
- closeFilterValue,
527
- dataKeyByKeyIdPerFilter,
528
- filtersGroup,
529
- filtersKeyById,
530
- filtersVisible,
531
- filtersVisibleAll,
532
- hasFilters,
533
- modelFiltersLocal,
534
- startSearch,
535
+ togglePreviewResize,
536
+ updateViewCurrent,
537
+ viewCurrent,
535
538
  };
536
539
  },
537
540
  data() {
@@ -692,6 +695,8 @@ export default {
692
695
  areAllRowsSelected: this.areAllRowsSelected,
693
696
  areAllVisibleRowsSelected: this.areAllVisibleRowsSelected,
694
697
  areSomeRowsSelected: this.areSomeRowsSelected,
698
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
699
+ rowsLocalLength: this.rowsLocalLength,
695
700
  modelSort: this.modelSort,
696
701
  onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
697
702
  }),
@@ -705,6 +710,7 @@ export default {
705
710
  countVisibleMobileColumns: this.countVisibleMobileColumns,
706
711
  row,
707
712
  rowIndex,
713
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
708
714
  selectedRowsIndexes: this.selectedRowsIndexes,
709
715
  rowActionsClass: this.rowActionsClass,
710
716
  onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
@@ -732,6 +738,7 @@ export default {
732
738
  countVisibleMobileColumns: this.countVisibleMobileColumns,
733
739
  row,
734
740
  rowIndex,
741
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
735
742
  rowActionsClass: this.rowActionsClass,
736
743
  selectedRowsIndexes: this.selectedRowsIndexes,
737
744
  onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
@@ -6,6 +6,7 @@ import AOneCheckbox from "../../ui/AOneCheckbox/AOneCheckbox";
6
6
  import ATableHeaderTh from "../ATableHeaderTh/ATableHeaderTh";
7
7
  import ATableHeaderThAction from "../ATableHeaderThAction/ATableHeaderThAction";
8
8
 
9
+ import CheckboxAPI from "./compositionAPI/CheckboxAPI";
9
10
  import DragAndDropParentAPI from "../compositionAPI/DragAndDropParentAPI";
10
11
 
11
12
  export default {
@@ -27,10 +28,18 @@ export default {
27
28
  type: Boolean,
28
29
  required: true,
29
30
  },
31
+ isRowActionsStickyLocal: {
32
+ type: Boolean,
33
+ required: true,
34
+ },
30
35
  modelSort: {
31
36
  type: String,
32
37
  required: false,
33
38
  },
39
+ rowsLocalLength: {
40
+ type: Number,
41
+ required: true,
42
+ },
34
43
  },
35
44
  emits: [
36
45
  "setSelectedRowsIndexes",
@@ -42,7 +51,7 @@ export default {
42
51
  "isMobile",
43
52
  "isMultipleActionsActive",
44
53
  ],
45
- setup(props, { emit }) {
54
+ setup(props, context) {
46
55
  const {
47
56
  columnIndexDraggable,
48
57
  dragstart,
@@ -58,20 +67,25 @@ export default {
58
67
  classOverParent: "a_table__th"
59
68
  });
60
69
 
61
- const toggleCheckbox = () => {
62
- emit("setSelectedRowsIndexes", { isAll: true });
63
- };
70
+ const {
71
+ isCheckboxDisabled,
72
+ isCheckboxIndeterminate,
73
+ modelValueCheckboxLocal,
74
+ toggleCheckbox,
75
+ } = CheckboxAPI(props, context);
64
76
 
65
77
  return {
66
78
  columnIndexDraggable,
67
- dragstart,
79
+ dragend,
68
80
  dragenter,
69
81
  dragleave,
70
- dragend,
82
+ dragstart,
71
83
  drop,
84
+ isCheckboxDisabled,
85
+ isCheckboxIndeterminate,
72
86
  isDragstart,
87
+ modelValueCheckboxLocal,
73
88
  root,
74
-
75
89
  toggleCheckbox,
76
90
  };
77
91
  },
@@ -99,9 +113,12 @@ export default {
99
113
  }, [
100
114
  h(AOneCheckbox, {
101
115
  isWidthAuto: true,
102
- modelValue: this.areAllVisibleRowsSelected || this.areAllRowsSelected,
103
- indeterminate: this.areSomeRowsSelected && !(this.areAllVisibleRowsSelected || this.areAllRowsSelected),
104
- disabled: this.areAllRowsSelected,
116
+ modelValue: this.modelValueCheckboxLocal,
117
+ indeterminate: this.isCheckboxIndeterminate,
118
+ disabled: this.isCheckboxDisabled,
119
+ label: "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_",
120
+ labelClass: "a_sr_only",
121
+ isLabelTitle: true,
105
122
  "onUpdate:modelValue": this.toggleCheckbox,
106
123
  }),
107
124
  ]),
@@ -118,7 +135,9 @@ export default {
118
135
  onDragendParent: this.dragend,
119
136
  });
120
137
  }),
121
- this.isActionColumnVisible && h(ATableHeaderThAction),
138
+ this.isActionColumnVisible && h(ATableHeaderThAction, {
139
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
140
+ }),
122
141
  ]),
123
142
  ]);
124
143
  },
@@ -0,0 +1,41 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function CheckboxAPI(props, { emit }) {
7
+ const areAllRowsSelected = toRef(props, "areAllRowsSelected");
8
+ const areAllVisibleRowsSelected = toRef(props, "areAllVisibleRowsSelected");
9
+ const areSomeRowsSelected = toRef(props, "areSomeRowsSelected");
10
+ const rowsLocalLength = toRef(props, "rowsLocalLength");
11
+
12
+ const isCheckboxDisabled = computed(() => {
13
+ return !!(rowsLocalLength.value === 0 ||
14
+ areAllRowsSelected.value);
15
+ });
16
+
17
+ const isCheckboxIndeterminate = computed(() => {
18
+ return areSomeRowsSelected.value &&
19
+ !(areAllVisibleRowsSelected.value ||
20
+ areAllRowsSelected.value);
21
+ });
22
+
23
+ const modelValueCheckboxLocal = computed(() => {
24
+ return areAllVisibleRowsSelected.value ||
25
+ areAllRowsSelected.value;
26
+ });
27
+
28
+ const toggleCheckbox = () => {
29
+ if (isCheckboxDisabled.value) {
30
+ return;
31
+ }
32
+ emit("setSelectedRowsIndexes", { isAll: true });
33
+ };
34
+
35
+ return {
36
+ isCheckboxDisabled,
37
+ isCheckboxIndeterminate,
38
+ modelValueCheckboxLocal,
39
+ toggleCheckbox,
40
+ };
41
+ }
@@ -32,6 +32,12 @@ export default {
32
32
  "isLoadingTable",
33
33
  "modelIsTableWithoutScroll",
34
34
  ],
35
+ props: {
36
+ isRowActionsStickyLocal: {
37
+ type: Boolean,
38
+ required: true,
39
+ },
40
+ },
35
41
  setup() {
36
42
  const {
37
43
  columnIndexDraggable,
@@ -67,11 +73,6 @@ export default {
67
73
  updateSearchColumnModel,
68
74
  };
69
75
  },
70
- computed: {
71
- stylesThAction() {
72
- return `width: ${ this.columnActionsWidthLocal }px; min-width: ${ this.columnActionsWidthLocal }px; max-width: ${ this.columnActionsWidthLocal }px;`;
73
- },
74
- },
75
76
  methods: {
76
77
  selectAllColumns() {
77
78
  const MODEL_COLUMNS_VISIBLE = {};
@@ -96,9 +97,13 @@ export default {
96
97
  },
97
98
  render() {
98
99
  return h("div", {
99
- class: "a_table__th a_table__cell a_table__cell_action",
100
+ class: [
101
+ "a_table__th a_table__cell a_table__cell_action",
102
+ {
103
+ a_table__cell_action_sticky: this.isRowActionsStickyLocal,
104
+ },
105
+ ],
100
106
  scope: "col",
101
- // style: this.stylesThAction,
102
107
  role: "columnheader",
103
108
  }, [
104
109
  h("span", {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  computed,
3
- h, inject,
3
+ h,
4
+ inject,
4
5
  resolveComponent,
5
6
  withDirectives,
6
7
  } from "vue";
@@ -29,6 +29,10 @@ export default {
29
29
  type: Boolean,
30
30
  required: false,
31
31
  },
32
+ isRowActionsStickyLocal: {
33
+ type: Boolean,
34
+ required: true,
35
+ },
32
36
  rowActionsClass: {
33
37
  type: [String, Object],
34
38
  required: false,
@@ -70,16 +74,16 @@ export default {
70
74
  countColumnsScrollInvisible() {
71
75
  return this.columnsScrollInvisible.length;
72
76
  },
73
-
74
- stylesTdAction() {
75
- return `width: ${ this.columnActionsWidthLocal }px; min-width: ${ this.columnActionsWidthLocal }px; max-width: ${ this.columnActionsWidthLocal }px;`;
76
- },
77
77
  },
78
78
  render() {
79
79
  return h("div", {
80
80
  role: "cell",
81
- class: "a_table__td a_table__cell a_table__cell_action",
82
- // style: this.stylesTdAction,
81
+ class: [
82
+ "a_table__td a_table__cell a_table__cell_action",
83
+ {
84
+ a_table__cell_action_sticky: this.isRowActionsStickyLocal,
85
+ },
86
+ ],
83
87
  }, [
84
88
  h("div", {
85
89
  class: [
@@ -133,6 +133,7 @@ export default {
133
133
 
134
134
  const {
135
135
  isBtnMultipleActionDisabled,
136
+ isBtnSelectAllRowsDisabled,
136
137
  textMultipleBtnAllRowsTranslate,
137
138
  textMultipleSelectedTranslateExtra,
138
139
  toggleBtnAllRows,
@@ -147,6 +148,7 @@ export default {
147
148
  currentMultipleActions,
148
149
  filterCurrency,
149
150
  isBtnMultipleActionDisabled,
151
+ isBtnSelectAllRowsDisabled,
150
152
  multipleActionsFiltered,
151
153
  onCancelMultipleActions,
152
154
  onOpenModalMultipleActions,
@@ -271,14 +273,15 @@ export default {
271
273
  text: "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_",
272
274
  extra: this.textMultipleSelectedTranslateExtra,
273
275
  }),
274
- this.currentMultipleActions.isAllRowsSelected && h(AButton, {
276
+ this.currentMultipleActions.isAllRowsSelected &&
277
+ h(AButton, {
275
278
  class: "a_btn a_btn_secondary a_table__multiple_panel__btn_all_rows",
276
279
  type: "button",
277
280
  text: this.textMultipleBtnAllRowsTranslate,
278
281
  extraTranslate: {
279
282
  countAllRows: this.countAllRows,
280
283
  },
281
- disabled: this.isLoadingMultipleActions,
284
+ disabled: this.isBtnSelectAllRowsDisabled,
282
285
  loading: this.isLoadingMultipleActions,
283
286
  onClick: this.toggleBtnAllRows,
284
287
  }),
@@ -4,10 +4,11 @@ import {
4
4
  } from "vue";
5
5
 
6
6
  export default function MultipleAPI(props, { emit }) {
7
- const selectedRows = toRef(props, "selectedRows");
8
- const countAllRows = toRef(props, "countAllRows");
9
- const areSomeRowsSelected = toRef(props, "areSomeRowsSelected");
10
7
  const areAllRowsSelected = toRef(props, "areAllRowsSelected");
8
+ const areSomeRowsSelected = toRef(props, "areSomeRowsSelected");
9
+ const countAllRows = toRef(props, "countAllRows");
10
+ const isLoadingMultipleActions = toRef(props, "isLoadingMultipleActions");
11
+ const selectedRows = toRef(props, "selectedRows");
11
12
 
12
13
  const countSelectedRows = computed(() => {
13
14
  return areAllRowsSelected.value ?
@@ -28,7 +29,15 @@ export default function MultipleAPI(props, { emit }) {
28
29
  "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_";
29
30
  });
30
31
 
32
+ const isBtnSelectAllRowsDisabled = computed(() => {
33
+ return !!(isLoadingMultipleActions.value ||
34
+ countAllRows.value === 0);
35
+ });
36
+
31
37
  const toggleBtnAllRows = () => {
38
+ if (isBtnSelectAllRowsDisabled.value) {
39
+ return;
40
+ }
32
41
  emit("toggleBtnAllRows");
33
42
  };
34
43
 
@@ -38,8 +47,9 @@ export default function MultipleAPI(props, { emit }) {
38
47
 
39
48
  return {
40
49
  isBtnMultipleActionDisabled,
41
- textMultipleSelectedTranslateExtra,
50
+ isBtnSelectAllRowsDisabled,
42
51
  textMultipleBtnAllRowsTranslate,
52
+ textMultipleSelectedTranslateExtra,
43
53
  toggleBtnAllRows,
44
54
  };
45
55
  }
@@ -1,7 +1,5 @@
1
1
  import {
2
- computed,
3
2
  h,
4
- inject, toRef,
5
3
  } from "vue";
6
4
 
7
5
  import ATableTd from "../ATableTd/ATableTd";
@@ -9,12 +7,11 @@ import ATableTdAction from "../ATableTdAction/ATableTdAction";
9
7
  import AOneCheckbox from "../../ui/AOneCheckbox/AOneCheckbox";
10
8
 
11
9
  import AttributesAPI from "./compositionAPI/AttributesAPI";
10
+ import CheckboxAPI from "./compositionAPI/CheckboxAPI";
12
11
  import MobileAPI from "./compositionAPI/MobileAPI";
13
12
 
14
13
  import {
15
14
  forEach,
16
- get,
17
- isFunction,
18
15
  } from "lodash-es";
19
16
 
20
17
  export default {
@@ -44,6 +41,10 @@ export default {
44
41
  type: Object,
45
42
  required: true,
46
43
  },
44
+ isRowActionsStickyLocal: {
45
+ type: Boolean,
46
+ required: true,
47
+ },
47
48
  isFooter: {
48
49
  type: Boolean,
49
50
  required: false,
@@ -57,28 +58,7 @@ export default {
57
58
  emits: [
58
59
  "setSelectedRowsIndexes",
59
60
  ],
60
- setup(props) {
61
- const row = toRef(props, "row");
62
- const rowIndex = toRef(props, "rowIndex");
63
- const areAllRowsSelected = toRef(props, "areAllRowsSelected");
64
- const currentMultipleActions = inject("currentMultipleActions");
65
- const isMultipleActionsActive = inject("isMultipleActionsActive");
66
-
67
- const isCheckboxDisabled = computed(() => {
68
- if (isMultipleActionsActive.value) {
69
- if (isFunction(get(currentMultipleActions.value, "isHiddenCallback"))) {
70
- return currentMultipleActions.value.isHiddenCallback({
71
- row: row.value,
72
- rowIndex: rowIndex.value,
73
- });
74
- }
75
- if (areAllRowsSelected.value) {
76
- return true;
77
- }
78
- }
79
- return false;
80
- });
81
-
61
+ setup(props, context) {
82
62
  const {
83
63
  rowAttributes,
84
64
  } = AttributesAPI(props);
@@ -90,31 +70,29 @@ export default {
90
70
  toggleAllColumnsVisibleMobile,
91
71
  } = MobileAPI(props);
92
72
 
73
+ const {
74
+ isCheckboxDisabled,
75
+ isRowSelected,
76
+ toggleCheckbox,
77
+ } = CheckboxAPI(props, context);
78
+
93
79
  return {
94
80
  isAllColumnsVisibleMobile,
95
81
  isBtnToggleAllColumnsVisible,
96
82
  isCheckboxDisabled,
97
- isMultipleActionsActive,
83
+ isRowSelected,
98
84
  rowAttributes,
99
85
  textBtnToggleAllColumns,
100
86
  toggleAllColumnsVisibleMobile,
87
+ toggleCheckbox,
101
88
  };
102
89
  },
103
90
  inject: [
104
91
  "columnsOrdered",
105
92
  "isActionColumnVisible",
93
+ "isMultipleActionsActive",
106
94
  "isMobile",
107
95
  ],
108
- computed: {
109
- isRowSelected() {
110
- return !!this.selectedRowsIndexes[this.rowIndex] || this.areAllRowsSelected;
111
- },
112
- },
113
- methods: {
114
- toggleCheckbox() {
115
- this.$emit("setSelectedRowsIndexes", { rowIndex: this.rowIndex });
116
- },
117
- },
118
96
  render() {
119
97
  let tds = [];
120
98
  if (this.isMobile && !this.isAllColumnsVisibleMobile) {
@@ -150,6 +128,7 @@ export default {
150
128
  rowIndex: this.rowIndex,
151
129
  isFooter: this.isFooter,
152
130
  rowActionsClass: this.rowActionsClass,
131
+ isRowActionsStickyLocal: this.isRowActionsStickyLocal,
153
132
  }, this.$slots);
154
133
 
155
134
  const CHILDREN = this.isMobile ?
@@ -168,6 +147,9 @@ export default {
168
147
  isWidthAuto: true,
169
148
  modelValue: this.isRowSelected,
170
149
  disabled: this.isCheckboxDisabled,
150
+ label: "_TABLE_SELECT_THIS_ROW_",
151
+ labelClass: "a_sr_only",
152
+ isLabelTitle: true,
171
153
  "onUpdate:modelValue": this.toggleCheckbox,
172
154
  }),
173
155
  ]),
@@ -0,0 +1,52 @@
1
+ import {
2
+ computed,
3
+ inject,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ import {
8
+ get,
9
+ isFunction,
10
+ } from "lodash-es";
11
+
12
+ export default function CheckboxAPI(props, { emit }) {
13
+ const areAllRowsSelected = toRef(props, "areAllRowsSelected");
14
+ const row = toRef(props, "row");
15
+ const rowIndex = toRef(props, "rowIndex");
16
+ const selectedRowsIndexes = toRef(props, "selectedRowsIndexes");
17
+
18
+ const currentMultipleActions = inject("currentMultipleActions");
19
+ const isMultipleActionsActive = inject("isMultipleActionsActive");
20
+
21
+ const isRowSelected = computed(() => {
22
+ return !!selectedRowsIndexes.value[rowIndex.value] || areAllRowsSelected.value;
23
+ });
24
+
25
+ const isCheckboxDisabled = computed(() => {
26
+ if (isMultipleActionsActive.value) {
27
+ if (isFunction(get(currentMultipleActions.value, "isHiddenCallback"))) {
28
+ return currentMultipleActions.value.isHiddenCallback({
29
+ row: row.value,
30
+ rowIndex: rowIndex.value,
31
+ });
32
+ }
33
+ if (areAllRowsSelected.value) {
34
+ return true;
35
+ }
36
+ }
37
+ return false;
38
+ });
39
+
40
+ const toggleCheckbox = () => {
41
+ if (isCheckboxDisabled.value) {
42
+ return;
43
+ }
44
+ emit("setSelectedRowsIndexes", { rowIndex: rowIndex.value });
45
+ };
46
+
47
+ return {
48
+ isCheckboxDisabled,
49
+ isRowSelected,
50
+ toggleCheckbox,
51
+ };
52
+ }
@@ -67,7 +67,8 @@ export default function MultipleActionAPI({
67
67
  });
68
68
 
69
69
  const areAllVisibleRowsSelected = computed(() => {
70
- return rowsLocalLength.value === selectedRowsIndexesLength.value;
70
+ return rowsLocalLength.value > 0 &&
71
+ rowsLocalLength.value === selectedRowsIndexesLength.value;
71
72
  });
72
73
 
73
74
  const areSomeRowsSelected = computed(() => {
@@ -4,6 +4,7 @@ import {
4
4
  toRef,
5
5
  } from "vue";
6
6
 
7
+ import ADropdownGlobalAPI from "../../compositionAPI/ADropdownGlobalAPI";
7
8
  import PreviewRightResizeAPI from "./PreviewRightResizeAPI";
8
9
 
9
10
  import {
@@ -19,6 +20,10 @@ export default function PreviewAPI(props, context, {
19
20
  tableGrandparentRef = ref({}),
20
21
  rowsLocal = computed(() => []),
21
22
  }) {
23
+ const {
24
+ isDropdownGlobalOpen,
25
+ } = ADropdownGlobalAPI();
26
+
22
27
  const {
23
28
  addEventListenerWindowResize,
24
29
  mousedownResizePreviewRight,
@@ -135,6 +140,10 @@ export default function PreviewAPI(props, context, {
135
140
  };
136
141
 
137
142
  const onTogglePreview = ({ rowIndex }) => {
143
+ console.log("isDropdownGlobalOpen", isDropdownGlobalOpen.value);
144
+ if (isDropdownGlobalOpen.value) {
145
+ return;
146
+ }
138
147
  if (isPreviewRight.value) {
139
148
  onTogglePreviewRight({ rowIndex });
140
149
  }
@@ -0,0 +1,20 @@
1
+ import {
2
+ computed,
3
+ ref,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ export default function StickyAPI(props, {
8
+ isMobile = ref(undefined),
9
+ modelIsTableWithoutScroll = ref(undefined),
10
+ }) {
11
+ const rowActionsSticky = toRef(props, "rowActionsSticky");
12
+
13
+ const isRowActionsStickyLocal = computed(() => {
14
+ return !!(!isMobile.value && rowActionsSticky.value && !modelIsTableWithoutScroll.value);
15
+ });
16
+
17
+ return {
18
+ isRowActionsStickyLocal,
19
+ };
20
+ }
@@ -0,0 +1,20 @@
1
+ import {
2
+ ref,
3
+ } from "vue";
4
+
5
+ const isDropdownGlobalOpen = ref(false);
6
+ export default function ADropdownGlobalAPI() {
7
+ const openDropdownGlobal = () => {
8
+ isDropdownGlobalOpen.value = true;
9
+ };
10
+
11
+ const closeDropdownGlobal = () => {
12
+ isDropdownGlobalOpen.value = false;
13
+ };
14
+
15
+ return {
16
+ closeDropdownGlobal,
17
+ isDropdownGlobalOpen,
18
+ openDropdownGlobal,
19
+ };
20
+ }
package/src/i18n/de.json CHANGED
@@ -8,9 +8,11 @@
8
8
  "_PREVIOUS_": "Vorherige",
9
9
  "_REMOVE_FIELD_CONTENT_": "Feldinhalt entfernen",
10
10
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Alle Zeilen abwählen ({{ countAllRows }})",
11
- "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Alle Zeilen auswählen ({{ countAllRows }})",
12
11
  "_TABLE_MULTIPLE_CANCEL_": "Mehrfachaktion abbrechen",
13
12
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "{{ countSelectedRows }} von {{ countAllRows }} ausgewählt",
13
+ "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Alle Zeilen auswählen ({{ countAllRows }})",
14
+ "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Alle sichtbaren, möglichen Zeilen auswählen",
15
+ "_TABLE_SELECT_THIS_ROW_": "Die Zeile auswählen",
14
16
  "_WIZARD_NEXT_": "Nächste",
15
17
  "_WIZARD_PREVIOUS_": "Vorherige",
16
18
  "_WIZARD_STEPS_PROGRESSBAR_TEXT_{{stepActive}}_{{stepsCount}}_{{stepActiveLabel}}_": "Schritt {{ stepActive }} von {{ stepsCount }}: {{ stepActiveLabel }}"
package/src/i18n/en.json CHANGED
@@ -8,9 +8,11 @@
8
8
  "_PREVIOUS_": "Previous",
9
9
  "_REMOVE_FIELD_CONTENT_": "Remove field content",
10
10
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Deselect all rows ({{ countAllRows }})",
11
- "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Select all rows ({{ countAllRows }})",
12
11
  "_TABLE_MULTIPLE_CANCEL_": "Cancel multiple action",
13
12
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "{{ countSelectedRows }} of {{ countAllRows }} selected",
13
+ "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Select all rows ({{ countAllRows }})",
14
+ "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Select all visible, possible rows",
15
+ "_TABLE_SELECT_THIS_ROW_": "Select this row",
14
16
  "_WIZARD_NEXT_": "Next",
15
17
  "_WIZARD_PREVIOUS_": "Previous",
16
18
  "_WIZARD_STEPS_PROGRESSBAR_TEXT_{{stepActive}}_{{stepsCount}}_{{stepActiveLabel}}_": "Step {{ stepActive }} of {{ stepsCount }}: {{ stepActiveLabel }}"
package/src/i18n/hr.json CHANGED
@@ -8,9 +8,11 @@
8
8
  "_PREVIOUS_": "Prethodni",
9
9
  "_REMOVE_FIELD_CONTENT_": "Izbrišite sadržaj polja",
10
10
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Poništite odabir svih redaka ({{ countAllRows }})",
11
- "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Odaberite svih redaka ({{ countAllRows }})",
12
11
  "_TABLE_MULTIPLE_CANCEL_": "Otkaži višestruku radnju",
13
12
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "{{ countSelectedRows }} od {{ countAllRows }} odabrana",
13
+ "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Odaberite svih redaka ({{ countAllRows }})",
14
+ "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Odaberite sve vidljive, moguće retke",
15
+ "_TABLE_SELECT_THIS_ROW_": "Odaberite ovu liniju",
14
16
  "_WIZARD_NEXT_": "Sljedeći",
15
17
  "_WIZARD_PREVIOUS_": "Prethodno",
16
18
  "_WIZARD_STEPS_PROGRESSBAR_TEXT_{{stepActive}}_{{stepsCount}}_{{stepActiveLabel}}_": "Korak {{ stepActive }} od {{ stepsCount }}: {{ stepActiveLabel }}"
package/src/i18n/ru.json CHANGED
@@ -8,9 +8,11 @@
8
8
  "_PREVIOUS_": "Предыдущий",
9
9
  "_REMOVE_FIELD_CONTENT_": "Удалить содержимое поля",
10
10
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Отменить выбор всех строк ({{ countAllRows }})",
11
- "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Выделить все строки ({{ countAllRows }})",
12
11
  "_TABLE_MULTIPLE_CANCEL_": "Отменить",
13
12
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "выбрано {{ countSelectedRows }} из {{ countAllRows }}",
13
+ "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Выделить все строки ({{ countAllRows }})",
14
+ "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Выбрать все видимые, возможные строки",
15
+ "_TABLE_SELECT_THIS_ROW_": "Выбрать эту строку",
14
16
  "_WIZARD_NEXT_": "Следующий",
15
17
  "_WIZARD_PREVIOUS_": "Предыдущий",
16
18
  "_WIZARD_STEPS_PROGRESSBAR_TEXT_{{stepActive}}_{{stepsCount}}_{{stepActiveLabel}}_": "Шаг {{ stepActive }} из {{ stepsCount }}: {{ stepActiveLabel }}"
@@ -35,7 +35,7 @@
35
35
  overflow-x: auto;
36
36
  }
37
37
  .a_table {
38
- --a_table_bg: transparent;
38
+ --a_table_bg: var(--a_color_white);
39
39
  display: block;
40
40
  width: 100%;
41
41
  caption-side: bottom;
@@ -241,6 +241,10 @@
241
241
  justify-content: flex-end;
242
242
  }
243
243
  }
244
+ .a_table__cell_action_sticky {
245
+ position: sticky;
246
+ right: 0;
247
+ }
244
248
  .a_table__th__dropdown_item {
245
249
  display: flex;
246
250
  justify-content: space-between;
@@ -1,14 +1,13 @@
1
1
  import {
2
2
  h,
3
- withDirectives,
4
3
  } from "vue";
5
4
 
6
5
  import AErrorsText from "../AErrorsText/AErrorsText";
7
-
8
- import ASafeHtml from "../../directives/ASafeHtml";
6
+ import ATranslation from "../../ATranslation/ATranslation";
9
7
 
10
8
  import UiMixinProps from "../mixins/UiMixinProps";
11
9
 
10
+ import LabelAPI from "./compositionAPI/LabelAPI";
12
11
  import TrueFalseValueAPI from "./compositionAPI/TrueFalseValueAPI";
13
12
  import UiAPI from "../compositionApi/UiAPI";
14
13
  import UiStyleHideAPI from "../compositionApi/UiStyleHideAPI";
@@ -20,27 +19,31 @@ export default {
20
19
  UiMixinProps,
21
20
  ],
22
21
  props: {
23
- modelValue: {
22
+ falseValue: {
24
23
  type: [Boolean, String, Number],
25
24
  required: false,
25
+ default: undefined,
26
26
  },
27
- isWidthAuto: {
27
+ indeterminate: {
28
28
  type: Boolean,
29
29
  required: false,
30
30
  },
31
- indeterminate: {
31
+ isLabelTitle: {
32
32
  type: Boolean,
33
33
  required: false,
34
34
  },
35
- trueValue: {
35
+ isWidthAuto: {
36
+ type: Boolean,
37
+ required: false,
38
+ },
39
+ modelValue: {
36
40
  type: [Boolean, String, Number],
37
41
  required: false,
38
- default: true,
39
42
  },
40
- falseValue: {
43
+ trueValue: {
41
44
  type: [Boolean, String, Number],
42
45
  required: false,
43
- default: undefined,
46
+ default: true,
44
47
  },
45
48
  },
46
49
  setup(props, context) {
@@ -67,20 +70,23 @@ export default {
67
70
  changeModel,
68
71
  });
69
72
 
70
- return {
71
- componentStyleHide,
73
+ const {
74
+ hasLabel,
75
+ } = LabelAPI(props);
72
76
 
77
+ return {
73
78
  ariaDescribedbyLocal,
79
+ componentStyleHide,
74
80
  errorsId,
81
+ hasLabel,
75
82
  helpTextId,
76
83
  htmlIdLocal,
77
- isErrors,
78
-
79
84
  isChecked,
85
+ isErrors,
86
+ onBlur,
80
87
  onClick,
81
88
  onFocus,
82
89
  onKeydown,
83
- onBlur,
84
90
  };
85
91
  },
86
92
  render() {
@@ -117,27 +123,39 @@ export default {
117
123
  }),
118
124
  h("label", {
119
125
  for: this.htmlIdLocal,
120
- class: ["a_custom_control_label", {
121
- a_custom_control_label_width_auto: this.isWidthAuto,
122
- }],
126
+ class: [
127
+ "a_custom_control_label",
128
+ {
129
+ a_custom_control_label_width_auto: this.isWidthAuto,
130
+ },
131
+ ],
123
132
  }, [
124
- this.label && h("span", {
125
- class: "a_custom_control_label__text",
133
+ this.hasLabel && h("span", {
134
+ class: [
135
+ "a_custom_control_label__text",
136
+ this.labelClass,
137
+ ],
126
138
  }, [
127
- withDirectives(h("span"), [
128
- [ASafeHtml, this.label],
129
- ]),
139
+ h(ATranslation, {
140
+ tag: "span",
141
+ html: this.label,
142
+ }),
130
143
  this.required && h("span", null, "*"),
131
144
  ]),
145
+ (this.isLabelTitle && this.hasLabel) && h(ATranslation, {
146
+ class: "a_position_absolute_all",
147
+ ariaHidden: true,
148
+ tag: "span",
149
+ title: this.label,
150
+ }),
132
151
  ]),
133
152
  ]),
134
153
  ]),
135
- this.helpText && withDirectives(h("div", {
136
- id: this.helpTextId,
154
+ this.helpText && h(ATranslation, {
155
+ tag: "div",
137
156
  class: "a_form_element__help_text",
138
- }), [
139
- [ASafeHtml, this.helpText],
140
- ]),
157
+ html: this.helpText,
158
+ }),
141
159
  this.isErrors && h(AErrorsText, {
142
160
  id: this.errorsId,
143
161
  errors: this.errors,
@@ -0,0 +1,20 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ import {
7
+ isNil,
8
+ } from "lodash-es";
9
+
10
+ export default function LabelAPI(props) {
11
+ const label = toRef(props, "label");
12
+
13
+ const hasLabel = computed(() => {
14
+ return !isNil(label.value);
15
+ });
16
+
17
+ return {
18
+ hasLabel,
19
+ };
20
+ }
@@ -32,7 +32,7 @@ export default {
32
32
  required: false,
33
33
  },
34
34
  label: {
35
- type: String,
35
+ type: [String, Number],
36
36
  required: false,
37
37
  default: undefined,
38
38
  },
@@ -1,26 +0,0 @@
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
- }