aloha-vue 1.0.281 → 1.0.283

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.281",
4
+ "version": "1.0.283",
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"
@@ -144,7 +144,12 @@ export default {
144
144
  sortingSequenceNumberClass: {
145
145
  type: [String, Object],
146
146
  required: false,
147
- default: "a_badge a_pill_rounded",
147
+ default: "a_badge",
148
+ },
149
+ showFirstSortingSequenceNumber: {
150
+ type: Boolean,
151
+ required: false,
152
+ default: true,
148
153
  },
149
154
  sortingMultiColumnKey: {
150
155
  type: String,
@@ -293,6 +298,14 @@ export default {
293
298
  required: false,
294
299
  default: 0,
295
300
  },
301
+ perPageView: {
302
+ type: Object,
303
+ required: false,
304
+ default: () => ({
305
+ desktop: "inline",
306
+ mobile: "select",
307
+ }),
308
+ },
296
309
  },
297
310
  emits: [
298
311
  "changeColumnsOrdering",
@@ -718,6 +731,7 @@ export default {
718
731
  modelSort: this.modelSortLocal,
719
732
  isSortingMultiColumn: this.isSortingMultiColumn,
720
733
  sortingSequenceNumberClass: this.sortingSequenceNumberClass,
734
+ showFirstSortingSequenceNumber: this.showFirstSortingSequenceNumber,
721
735
  onSetSelectedRowsIndexes: this.setSelectedRowsIndexes,
722
736
  }),
723
737
  h("div", {
@@ -795,6 +809,8 @@ export default {
795
809
  offset: this.offset,
796
810
  rowsLength: this.rowsLocal.length,
797
811
  hasRows: this.hasRows,
812
+ perPageView: this.perPageView,
813
+ isMobile: this.isMobile,
798
814
  "onUpdate:limit": this.changeLimit,
799
815
  }),
800
816
  h(ATablePagination, {
@@ -2,117 +2,127 @@ import {
2
2
  h,
3
3
  } from "vue";
4
4
 
5
+ import AButton from "../../AButton/AButton";
6
+ import ASelect from "../../ui/ASelect/ASelect";
5
7
  import ATranslation from "../../ATranslation/ATranslation";
6
8
 
7
- import AFiltersAPI from "../../compositionAPI/AFiltersAPI";
8
-
9
+ import LimitAPI from "./compositionAPI/LimitAPI";
10
+ import MainAPI from "./compositionAPI/MainAPI";
11
+ import ViewAPI from "./compositionAPI/ViewAPI";
9
12
 
10
13
  export default {
11
14
  name: "ATableCountProPage",
12
- components: {
13
- ATranslation,
14
- },
15
15
  props: {
16
16
  countAllRows: {
17
17
  type: Number,
18
18
  required: true,
19
19
  },
20
- limitsPerPage: {
21
- type: Array,
20
+ hasRows: {
21
+ type: Boolean,
22
22
  required: true,
23
23
  },
24
+ isLoadingTable: {
25
+ type: Boolean,
26
+ required: true,
27
+ },
28
+ isMobile: {
29
+ type: Boolean,
30
+ required: false,
31
+ },
24
32
  limit: {
25
33
  type: Number,
26
34
  required: true,
27
35
  },
28
- isLoadingTable: {
29
- type: Boolean,
36
+ limitsPerPage: {
37
+ type: Array,
30
38
  required: true,
31
39
  },
32
40
  offset: {
33
41
  type: Number,
34
42
  required: true,
35
43
  },
36
- rowsLength: {
37
- type: Number,
44
+ perPageView: {
45
+ type: Object,
38
46
  required: true,
39
47
  },
40
- hasRows: {
41
- type: Boolean,
48
+ rowsLength: {
49
+ type: Number,
42
50
  required: true,
43
51
  },
44
52
  },
45
53
  emits: ["update:limit"],
46
- setup() {
54
+ setup(props, context) {
47
55
  const {
48
- filterCurrency,
49
- } = AFiltersAPI();
50
-
51
- return {
52
- filterCurrency,
53
- };
54
- },
55
- computed: {
56
- extraForTranslate() {
57
- return {
58
- start: this.startFormatted,
59
- current: this.currentFormatted,
60
- count: this.countFormatted,
61
- };
62
- },
63
-
64
- startFormatted() {
65
- return this.filterCurrency(+this.offset + 1, { suffix: "", digits: 0 });
66
- },
56
+ changeLimit,
57
+ changeLimitFromSelect,
58
+ limitString,
59
+ } = LimitAPI(props, context);
67
60
 
68
- currentFormatted() {
69
- return this.filterCurrency(+this.offset + this.rowsLength, { suffix: "", digits: 0 });
70
- },
61
+ const {
62
+ extraForTranslate,
63
+ } = MainAPI(props);
71
64
 
72
- countFormatted() {
73
- return this.filterCurrency(this.countAllRows, { suffix: "", digits: 0 });
74
- },
65
+ const {
66
+ currentView,
67
+ } = ViewAPI(props);
75
68
 
76
- countText() {
77
- return `${ this.startFormatted } - ${ this.currentFormatted } von ${ this.countFormatted }`;
78
- },
79
- },
80
- methods: {
81
- changeLimit(limit) {
82
- if (this.isLoadingTable) {
83
- return;
84
- }
85
- this.$emit("update:limit", +limit);
86
- },
69
+ return {
70
+ changeLimit,
71
+ changeLimitFromSelect,
72
+ currentView,
73
+ extraForTranslate,
74
+ limitString,
75
+ };
87
76
  },
88
77
  render() {
89
78
  if (this.hasRows) {
90
79
  return h("div", {
91
80
  class: "a_pagination__counts",
92
- }, [
93
- h("span", {
94
- class: "a_pagination__count_from_to"
95
- }, this.countText),
96
- h("span", {
97
- class: "a_pagination__count__text"
98
- }, "Pro Seite:"),
99
- h("div", {
100
- class: "a_pagination__count",
101
- }, [
102
- this.limitsPerPage.map(count => {
103
- return h("div", {
104
- class: "a_pagination__count__item",
105
- }, [
106
- h("button", {
107
- type: "button",
108
- class: "a_btn a_btn_link a_pagination__count__button",
109
- disabled: +count === this.limit || this.isLoadingTable,
110
- onClick: () => this.changeLimit(count),
111
- }, count),
112
- ]);
81
+ }, this.currentView === "inline" ?
82
+ [
83
+ h(ATranslation, {
84
+ class: "a_pagination__count_from_to",
85
+ html: "_TABLE_COUNT_PER_PAGE_{{start}}_{{current}}_{{count}}_",
86
+ extra: this.extraForTranslate,
87
+ }),
88
+ h(ATranslation, {
89
+ tag: "span",
90
+ class: "a_pagination__count__text",
91
+ html: "_TABLE_PER_PAGE_",
92
+ }),
93
+ h("div", {
94
+ class: "a_pagination__count",
95
+ }, [
96
+ this.limitsPerPage.map(count => {
97
+ return h("div", {
98
+ class: "a_pagination__count__item",
99
+ }, [
100
+ h(AButton, {
101
+ type: "button",
102
+ class: "a_btn a_btn_link a_pagination__count__button",
103
+ disabled: +count === this.limit || this.isLoadingTable,
104
+ text: count,
105
+ onClick: () => this.changeLimit(count),
106
+ }),
107
+ ]);
108
+ }),
109
+ ]),
110
+ ] :
111
+ [
112
+ h(ATranslation, {
113
+ class: "a_pagination__count_from_to",
114
+ html: "_TABLE_COUNT_PER_PAGE_{{start}}_{{current}}_{{count}}_",
115
+ extra: this.extraForTranslate,
116
+ }),
117
+ h(ASelect, {
118
+ label: "_TABLE_PER_PAGE_",
119
+ data: this.limitsPerPage,
120
+ isDataSimpleArray: true,
121
+ isDeselect: false,
122
+ modelValue: this.limitString,
123
+ change: this.changeLimitFromSelect
113
124
  }),
114
- ]),
115
- ]);
125
+ ]);
116
126
  }
117
127
  return "";
118
128
  },
@@ -0,0 +1,30 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function LimitAPI(props, { emit }) {
7
+ const isLoadingTable = toRef(props, "isLoadingTable");
8
+ const limit = toRef(props, "limit");
9
+
10
+ const limitString = computed(() => {
11
+ return `${ limit.value }`;
12
+ });
13
+
14
+ const changeLimit = limit => {
15
+ if (isLoadingTable.value) {
16
+ return;
17
+ }
18
+ emit("update:limit", +limit);
19
+ };
20
+
21
+ const changeLimitFromSelect = ({ model }) => {
22
+ changeLimit(model);
23
+ };
24
+
25
+ return {
26
+ changeLimit,
27
+ changeLimitFromSelect,
28
+ limitString,
29
+ };
30
+ }
@@ -0,0 +1,40 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ import AFiltersAPI from "../../../compositionAPI/AFiltersAPI";
7
+
8
+ export default function MainAPI(props) {
9
+ const offset = toRef(props, "offset");
10
+ const rowsLength = toRef(props, "rowsLength");
11
+ const countAllRows = toRef(props, "countAllRows");
12
+
13
+ const {
14
+ filterCurrency,
15
+ } = AFiltersAPI();
16
+
17
+ const startFormatted = computed(() => {
18
+ return filterCurrency(+offset.value + 1, { suffix: "", digits: 0 });
19
+ });
20
+
21
+ const currentFormatted = computed(() => {
22
+ return filterCurrency(+offset.value + rowsLength.value, { suffix: "", digits: 0 });
23
+ });
24
+
25
+ const countFormatted = computed(() => {
26
+ return filterCurrency(countAllRows.value, { suffix: "", digits: 0 });
27
+ });
28
+
29
+ const extraForTranslate = computed(() => {
30
+ return {
31
+ start: startFormatted.value,
32
+ current: currentFormatted.value,
33
+ count: countFormatted.value,
34
+ };
35
+ });
36
+
37
+ return {
38
+ extraForTranslate,
39
+ };
40
+ }
@@ -0,0 +1,20 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function ViewAPI(props) {
7
+ const perPageView = toRef(props, "perPageView");
8
+ const isMobile = toRef(props, "isMobile");
9
+
10
+ const currentView = computed(() => {
11
+ if (isMobile.value) {
12
+ return perPageView.value.mobile || "select";
13
+ }
14
+ return perPageView.value.desktop || "inline";
15
+ });
16
+
17
+ return {
18
+ currentView,
19
+ };
20
+ }
@@ -32,6 +32,10 @@ export default {
32
32
  type: Boolean,
33
33
  required: true,
34
34
  },
35
+ isSortingMultiColumn: {
36
+ type: Boolean,
37
+ required: false,
38
+ },
35
39
  modelSort: {
36
40
  type: Array,
37
41
  required: true,
@@ -40,12 +44,12 @@ export default {
40
44
  type: Number,
41
45
  required: true,
42
46
  },
43
- sortingSequenceNumberClass: {
44
- type: [String, Object],
47
+ showFirstSortingSequenceNumber: {
48
+ type: Boolean,
45
49
  required: false,
46
50
  },
47
- isSortingMultiColumn: {
48
- type: Boolean,
51
+ sortingSequenceNumberClass: {
52
+ type: [String, Object],
49
53
  required: false,
50
54
  },
51
55
  },
@@ -141,6 +145,7 @@ export default {
141
145
  modelSort: this.modelSort,
142
146
  sortingSequenceNumberClass: this.sortingSequenceNumberClass,
143
147
  isSortingMultiColumn: this.isSortingMultiColumn,
148
+ showFirstSortingSequenceNumber: this.showFirstSortingSequenceNumber,
144
149
  onDragstartParent: this.dragstart,
145
150
  onDragenterParent: this.dragenter,
146
151
  onDragleaveParent: this.dragleave,
@@ -30,16 +30,20 @@ export default {
30
30
  required: false,
31
31
  default: -1,
32
32
  },
33
+ isSortingMultiColumn: {
34
+ type: Boolean,
35
+ required: false,
36
+ },
33
37
  modelSort: {
34
38
  type: Array,
35
39
  required: false,
36
40
  },
37
- sortingSequenceNumberClass: {
38
- type: [String, Object],
41
+ showFirstSortingSequenceNumber: {
42
+ type: Boolean,
39
43
  required: false,
40
44
  },
41
- isSortingMultiColumn: {
42
- type: Boolean,
45
+ sortingSequenceNumberClass: {
46
+ type: [String, Object],
43
47
  required: false,
44
48
  },
45
49
  },
@@ -10,6 +10,7 @@ export default function SortAPI(props) {
10
10
  const column = toRef(props, "column");
11
11
  const isSortingMultiColumn = toRef(props, "isSortingMultiColumn");
12
12
  const modelSort = toRef(props, "modelSort");
13
+ const showFirstSortingSequenceNumber = toRef(props, "showFirstSortingSequenceNumber");
13
14
 
14
15
  const changeModelSort = inject("changeModelSort");
15
16
  const isLoadingTable = inject("isLoadingTable");
@@ -120,6 +121,10 @@ export default function SortAPI(props) {
120
121
  !isSorting.value) {
121
122
  return undefined;
122
123
  }
124
+ if (modelSort.value.length <= 1 &&
125
+ !showFirstSortingSequenceNumber.value) {
126
+ return undefined;
127
+ }
123
128
  if (modelSortIndexAscending.value !== -1) {
124
129
  return modelSortIndexAscending.value + 1;
125
130
  }
package/src/i18n/de.json CHANGED
@@ -8,11 +8,13 @@
8
8
  "_PREVIOUS_": "Vorherige",
9
9
  "_REMOVE_FIELD_CONTENT_": "Feldinhalt entfernen",
10
10
  "_SELECT_TEXT_EMPTY_": "[Keine Auswahl]",
11
+ "_TABLE_COUNT_PER_PAGE_{{start}}_{{current}}_{{count}}_": "{{ start }} - {{ current }} von {{ count }}",
11
12
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Alle Zeilen abwählen ({{ countAllRows }})",
12
13
  "_TABLE_DESELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Alle ausgewählten Zeilen abwählen",
13
14
  "_TABLE_DESELECT_THIS_ROW_": "Die Zeile abwählen",
14
15
  "_TABLE_MULTIPLE_CANCEL_": "Mehrfachaktion abbrechen",
15
16
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "{{ countSelectedRows }} von {{ countAllRows }} ausgewählt",
17
+ "_TABLE_PER_PAGE_": "Pro Seite:",
16
18
  "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Alle Zeilen auswählen ({{ countAllRows }})",
17
19
  "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Alle sichtbaren, relevanten Zeilen auswählen",
18
20
  "_TABLE_SELECT_THIS_ROW_": "Die Zeile auswählen",
package/src/i18n/en.json CHANGED
@@ -8,11 +8,13 @@
8
8
  "_PREVIOUS_": "Previous",
9
9
  "_REMOVE_FIELD_CONTENT_": "Remove field content",
10
10
  "_SELECT_TEXT_EMPTY_": "[No selection]",
11
+ "_TABLE_COUNT_PER_PAGE_{{start}}_{{current}}_{{count}}_": "{{ start }} - {{ current }} of {{ count }}",
11
12
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Deselect all rows ({{ countAllRows }})",
12
13
  "_TABLE_DESELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Deselect all selected rows",
13
14
  "_TABLE_DESELECT_THIS_ROW_": "Deselect row",
14
15
  "_TABLE_MULTIPLE_CANCEL_": "Cancel multiple action",
15
16
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "{{ countSelectedRows }} of {{ countAllRows }} selected",
17
+ "_TABLE_PER_PAGE_": "Per page:",
16
18
  "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Select all rows ({{ countAllRows }})",
17
19
  "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Select all visible, possible rows",
18
20
  "_TABLE_SELECT_THIS_ROW_": "Select this row",
package/src/i18n/hr.json CHANGED
@@ -8,11 +8,13 @@
8
8
  "_PREVIOUS_": "Prethodni",
9
9
  "_REMOVE_FIELD_CONTENT_": "Izbrišite sadržaj polja",
10
10
  "_SELECT_TEXT_EMPTY_": "[Bez odabira]",
11
+ "_TABLE_COUNT_PER_PAGE_{{start}}_{{current}}_{{count}}_": "{{ start }} - {{ current }} od {{ count }}",
11
12
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Poništite odabir svih redaka ({{ countAllRows }})",
12
13
  "_TABLE_DESELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Poništi odabir svih odabranih redaka",
13
14
  "_TABLE_DESELECT_THIS_ROW_": "Poništite odabir retka",
14
15
  "_TABLE_MULTIPLE_CANCEL_": "Otkaži višestruku radnju",
15
16
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "{{ countSelectedRows }} od {{ countAllRows }} odabrana",
17
+ "_TABLE_PER_PAGE_": "Po stranici:",
16
18
  "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Odaberite svih redaka ({{ countAllRows }})",
17
19
  "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Odaberite sve vidljive, moguće retke",
18
20
  "_TABLE_SELECT_THIS_ROW_": "Odaberite ovu liniju",
package/src/i18n/ru.json CHANGED
@@ -8,11 +8,13 @@
8
8
  "_PREVIOUS_": "Предыдущий",
9
9
  "_REMOVE_FIELD_CONTENT_": "Удалить содержимое поля",
10
10
  "_SELECT_TEXT_EMPTY_": "[Нет элементов]",
11
+ "_TABLE_COUNT_PER_PAGE_{{start}}_{{current}}_{{count}}_": "{{ start }} - {{ current }} из {{ count }}",
11
12
  "_TABLE_DESELECT_ALL_ROWS_{{countAllRows}}_": "Отменить выбор всех строк ({{ countAllRows }})",
12
13
  "_TABLE_DESELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Отменить выбор всех выбранных строк",
13
14
  "_TABLE_DESELECT_THIS_ROW_": "Отменить выбор строки",
14
15
  "_TABLE_MULTIPLE_CANCEL_": "Отменить",
15
16
  "_TABLE_MULTIPLE_ITEMS_SELECTED_{{countSelectedRows}}_{{countAllRows}}_": "выбрано {{ countSelectedRows }} из {{ countAllRows }}",
17
+ "_TABLE_PER_PAGE_": "На странице:",
16
18
  "_TABLE_SELECT_ALL_ROWS_{{countAllRows}}_": "Выделить все строки ({{ countAllRows }})",
17
19
  "_TABLE_SELECT_ALL_VISIBLE_POSSIBLE_ROWS_": "Выбрать все видимые, возможные строки",
18
20
  "_TABLE_SELECT_THIS_ROW_": "Выбрать эту строку",
@@ -441,6 +441,10 @@
441
441
  .a_pagination__counts {
442
442
  display: flex;
443
443
  flex: 20;
444
+ align-items: center;
445
+ .ui_select {
446
+ --a_select_min_width: 100px;
447
+ }
444
448
  }
445
449
  .a_pagination__count_from_to {
446
450
  margin-right: 1rem;
@@ -10,7 +10,7 @@
10
10
 
11
11
  .a_select_toggle {
12
12
  position: relative;
13
- min-width: 200px;
13
+ min-width: var(--a_select_min_width);
14
14
  text-align: left;
15
15
  }
16
16
  .a_select_toggle_closeable {