aloha-vue 1.0.0

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.
Files changed (158) hide show
  1. package/.babelrc +10 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +183 -0
  4. package/LICENSE +21 -0
  5. package/README.md +2 -0
  6. package/build/webpack.common.js +104 -0
  7. package/build/webpack.dev.js +16 -0
  8. package/build/webpack.prod.js +20 -0
  9. package/dist/index.js +9 -0
  10. package/docs/App.js +52 -0
  11. package/docs/App.pug +10 -0
  12. package/docs/App.scss +1 -0
  13. package/docs/App.vue +3 -0
  14. package/docs/components/TheMenu/TheMenu.js +49 -0
  15. package/docs/components/TheMenu/TheMenu.pug +7 -0
  16. package/docs/components/TheMenu/TheMenu.scss +39 -0
  17. package/docs/components/TheMenu/TheMenu.vue +3 -0
  18. package/docs/components/TheMenuItem/TheMenuItem.js +29 -0
  19. package/docs/components/TheMenuItem/TheMenuItem.pug +26 -0
  20. package/docs/components/TheMenuItem/TheMenuItem.vue +2 -0
  21. package/docs/components/TheNavbar/TheNavbar.js +57 -0
  22. package/docs/components/TheNavbar/TheNavbar.pug +34 -0
  23. package/docs/components/TheNavbar/TheNavbar.vue +2 -0
  24. package/docs/i18n/de.json +4 -0
  25. package/docs/i18n/en.json +4 -0
  26. package/docs/i18n/hr.json +4 -0
  27. package/docs/i18n/ru.json +4 -0
  28. package/docs/main.js +30 -0
  29. package/docs/router/index.js +70 -0
  30. package/docs/static/styles.css +7725 -0
  31. package/docs/store/index.js +17 -0
  32. package/docs/styles/base.scss +11 -0
  33. package/docs/styles/bootstrap.lazy.scss +5 -0
  34. package/docs/styles/bulma.lazy.scss +1 -0
  35. package/docs/styles/foundation.lazy.scss +2 -0
  36. package/docs/styles/uikit.lazy.scss +3 -0
  37. package/docs/views/About.vue +5 -0
  38. package/docs/views/NotFound.vue +3 -0
  39. package/docs/views/PageAJson/PageAJson.js +18 -0
  40. package/docs/views/PageAJson/PageAJson.pug +10 -0
  41. package/docs/views/PageAJson/PageAJson.vue +2 -0
  42. package/docs/views/PageAccordion/PageAccordion.js +68 -0
  43. package/docs/views/PageAccordion/PageAccordion.pug +27 -0
  44. package/docs/views/PageAccordion/PageAccordion.vue +2 -0
  45. package/docs/views/PageCloak/PageCloak.js +8 -0
  46. package/docs/views/PageCloak/PageCloak.pug +6 -0
  47. package/docs/views/PageCloak/PageCloak.vue +2 -0
  48. package/docs/views/PageCollapse/PageCollapse.js +8 -0
  49. package/docs/views/PageCollapse/PageCollapse.pug +22 -0
  50. package/docs/views/PageCollapse/PageCollapse.vue +2 -0
  51. package/docs/views/PageInput/PageInput.js +22 -0
  52. package/docs/views/PageInput/PageInput.pug +25 -0
  53. package/docs/views/PageInput/PageInput.vue +2 -0
  54. package/docs/views/PageSpinner/PageSpinner.js +8 -0
  55. package/docs/views/PageSpinner/PageSpinner.pug +12 -0
  56. package/docs/views/PageSpinner/PageSpinner.vue +2 -0
  57. package/docs/views/PageStart/PageStart.js +39 -0
  58. package/docs/views/PageStart/PageStart.pug +19 -0
  59. package/docs/views/PageStart/PageStart.vue +2 -0
  60. package/docs/views/PageTable/PageTable.js +68 -0
  61. package/docs/views/PageTable/PageTable.pug +10 -0
  62. package/docs/views/PageTable/PageTable.vue +2 -0
  63. package/package.json +55 -0
  64. package/public/index.html +11 -0
  65. package/src/AAccordion/AAccordion.js +442 -0
  66. package/src/AAccordion/AAccordion.pug +27 -0
  67. package/src/AAccordion/AAccordion.vue +2 -0
  68. package/src/AAccordion/AAccordionItem/AAccordionItem.js +162 -0
  69. package/src/AAccordion/AAccordionItem/AAccordionItem.pug +76 -0
  70. package/src/AAccordion/AAccordionItem/AAccordionItem.vue +2 -0
  71. package/src/ACloak/ACloak.js +116 -0
  72. package/src/ACollapse/ACollapse.js +103 -0
  73. package/src/ACollapse/ACollapse.pug +25 -0
  74. package/src/ACollapse/ACollapse.vue +2 -0
  75. package/src/AFormElement/AFormElementBtnClear/AFormElementBtnClear.js +58 -0
  76. package/src/AIcon/AIcon.js +81 -0
  77. package/src/AIcon/Icons/Aloha.js +20 -0
  78. package/src/AIcon/Icons/ChevronDown.js +3 -0
  79. package/src/AIcon/Icons/ChevronLeft.js +1 -0
  80. package/src/AIcon/Icons/ChevronRight.js +3 -0
  81. package/src/AIcon/Icons/ChevronUp.js +3 -0
  82. package/src/AIcon/Icons/Close.js +16 -0
  83. package/src/AIcon/Icons/Cross.js +14 -0
  84. package/src/AIcon/Icons/Pause.js +14 -0
  85. package/src/AIcon/Icons/Play.js +3 -0
  86. package/src/AIcon/Icons/Repeat.js +9 -0
  87. package/src/AIcon/Icons/Reset.js +11 -0
  88. package/src/AIcon/Incscape-icons/Aloha.svg +349 -0
  89. package/src/AIcon/Incscape-icons/aloha-copy.svg +80 -0
  90. package/src/AIcon/Incscape-icons/chevron-bottom.svg +61 -0
  91. package/src/AIcon/Incscape-icons/chevron-left.svg +61 -0
  92. package/src/AIcon/Incscape-icons/chevron-right.svg +61 -0
  93. package/src/AIcon/Incscape-icons/chevron-up.svg +61 -0
  94. package/src/AIcon/Incscape-icons/close.svg +74 -0
  95. package/src/AIcon/Incscape-icons/cross.svg +73 -0
  96. package/src/AIcon/Incscape-icons/pause.svg +70 -0
  97. package/src/AIcon/Incscape-icons/play.svg +72 -0
  98. package/src/AIcon/Incscape-icons/repeat.svg +84 -0
  99. package/src/AIcon/Incscape-icons/reset.svg +86 -0
  100. package/src/AIcon/Incscape-icons/th-large-outline.svg +95 -0
  101. package/src/AIcon/Incscape-icons/th-large-rund-outline.svg +90 -0
  102. package/src/AIcon/Incscape-icons/th-large-rund.svg +94 -0
  103. package/src/AIcon/Incscape-icons/th-large.svg +97 -0
  104. package/src/AIcon/SVG-icons/aloha.svg +28 -0
  105. package/src/AIcon/SVG-icons/chevron-bottom.svg +11 -0
  106. package/src/AIcon/SVG-icons/chevron-left.svg +11 -0
  107. package/src/AIcon/SVG-icons/chevron-right.svg +11 -0
  108. package/src/AIcon/SVG-icons/chevron-up.svg +11 -0
  109. package/src/AIcon/SVG-icons/close.svg +23 -0
  110. package/src/AIcon/SVG-icons/cross.svg +22 -0
  111. package/src/AIcon/SVG-icons/pause.svg +20 -0
  112. package/src/AIcon/SVG-icons/play.svg +11 -0
  113. package/src/AIcon/SVG-icons/repeat.svg +17 -0
  114. package/src/AIcon/SVG-icons/reset.svg +19 -0
  115. package/src/AIcon/SVG-icons/th-large-outline.svg +45 -0
  116. package/src/AIcon/SVG-icons/th-large.svg +41 -0
  117. package/src/AInput/AInput.js +177 -0
  118. package/src/AJson/AJson.js +356 -0
  119. package/src/ALabel/ALabel.js +81 -0
  120. package/src/API/frameworksApi.js +20 -0
  121. package/src/ASlot/ASlot.js +4 -0
  122. package/src/ASlot/ASlot.pug +1 -0
  123. package/src/ASlot/ASlot.vue +2 -0
  124. package/src/ASpinner/ASpinner.js +76 -0
  125. package/src/ATable/ATable.js +180 -0
  126. package/src/ATable/ATableCountProPage/ATableCountProPage.js +56 -0
  127. package/src/ATable/ATableHeader/ATableHeader.js +45 -0
  128. package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +147 -0
  129. package/src/ATable/ATablePagination/ATablePagination.js +208 -0
  130. package/src/ATable/ATableTd/ATableTd.js +73 -0
  131. package/src/ATable/ATableTopPanel/ATableTopPanel.js +72 -0
  132. package/src/ATable/ATableTr/ATableTr.js +45 -0
  133. package/src/ATextarea/ATextarea.js +256 -0
  134. package/src/ATranslation/ATranslation.js +225 -0
  135. package/src/FormElements/AInputMixin.js +51 -0
  136. package/src/const/colors.js +10 -0
  137. package/src/const/frameworks.js +6 -0
  138. package/src/i18n/de.json +8 -0
  139. package/src/i18n/en.json +8 -0
  140. package/src/i18n/hr.json +8 -0
  141. package/src/i18n/ru.json +8 -0
  142. package/src/plugins/alohaPlugin.js +5 -0
  143. package/src/plugins/i18nPlugin.js +10 -0
  144. package/src/styles/components/ACloak.scss +12 -0
  145. package/src/styles/components/AFormElement/AFormElement.scss +21 -0
  146. package/src/styles/components/AFormElement/AInput.scss +0 -0
  147. package/src/styles/components/AFormElement/ATextarea.scss +6 -0
  148. package/src/styles/components/ASpinner.scss +24 -0
  149. package/src/styles/components/ATable.scss +0 -0
  150. package/src/styles/styles.scss +13 -0
  151. package/src/styles/utils/display.scss +30 -0
  152. package/src/styles/utils/flex.scss +50 -0
  153. package/src/styles/utils/paddingMargin.scss +28 -0
  154. package/src/styles/utils/utils.scss +19 -0
  155. package/src/styles/utils/widthHeight.scss +17 -0
  156. package/src/styles/variables.scss +96 -0
  157. package/src/utils/autosize.js +268 -0
  158. package/src/utils/utils.js +16 -0
@@ -0,0 +1,56 @@
1
+ import ATranslation from "../../ATranslation/ATranslation";
2
+
3
+ import {
4
+ h,
5
+ } from "vue";
6
+
7
+ export default {
8
+ name: "ATableCountProPage",
9
+ components: {
10
+ ATranslation,
11
+ },
12
+ props: {
13
+ countsPerPage: {
14
+ type: Array,
15
+ required: false,
16
+ default: () => ["10", "25", "50", "100"],
17
+ },
18
+ limit: {
19
+ type: Number,
20
+ required: true,
21
+ },
22
+ isLoading: {
23
+ type: Boolean,
24
+ required: true,
25
+ },
26
+ },
27
+ emits: ["update:limit"],
28
+ methods: {
29
+ emitValue(e) {
30
+ if (this.isLoading) {
31
+ return;
32
+ }
33
+ const VALUE = e.target.value;
34
+ this.$emit("update:limit", +VALUE);
35
+ },
36
+ },
37
+ render() {
38
+ return h("div", null, [
39
+ h(ATranslation, {
40
+ tag: "select",
41
+ value: this.limit,
42
+ "aria-label": "_ITEMS_PER_PAGE_",
43
+ disabled: this.isLoading,
44
+ onInput: this.emitValue,
45
+ }, {
46
+ default: () => this.countsPerPage.map(count => {
47
+ return h("option", {
48
+ value: count,
49
+ }, [
50
+ count,
51
+ ]);
52
+ }),
53
+ }),
54
+ ]);
55
+ },
56
+ };
@@ -0,0 +1,45 @@
1
+ import ATableHeaderTh from "../ATableHeaderTh/ATableHeaderTh";
2
+
3
+ import {
4
+ h,
5
+ } from "vue";
6
+
7
+ export default {
8
+ name: "ATableHeader",
9
+ components: {
10
+ ATableHeaderTh,
11
+ },
12
+ props: {
13
+ columns: {
14
+ type: Array,
15
+ required: true,
16
+ },
17
+ isLoading: {
18
+ type: Boolean,
19
+ required: true,
20
+ },
21
+ modelSort: {
22
+ type: String,
23
+ required: false,
24
+ },
25
+ modelColumnsMapping: {
26
+ type: Object,
27
+ required: true,
28
+ },
29
+ },
30
+ render() {
31
+ return h("thead", null, [
32
+ h("tr", null, [
33
+ this.columns.map(column => {
34
+ return h(ATableHeaderTh, {
35
+ column: column,
36
+ "is-loading": this.isLoading,
37
+ "model-sort": this.modelSort,
38
+ "model-columns-mapping": this.modelColumnsMapping,
39
+ "onChange-model-sort": this.$attrs["onChange-model-sort"],
40
+ });
41
+ }),
42
+ ]),
43
+ ]);
44
+ },
45
+ };
@@ -0,0 +1,147 @@
1
+ import AIcon from "../../AIcon/AIcon";
2
+ import ATranslation from "../../ATranslation/ATranslation";
3
+
4
+ import {
5
+ h,
6
+ } from "vue";
7
+
8
+ export default {
9
+ name: "ATableHeaderTh",
10
+ components: {
11
+ AIcon,
12
+ ATranslation,
13
+ },
14
+ props: {
15
+ column: {
16
+ type: Object,
17
+ required: true,
18
+ },
19
+ isLoading: {
20
+ type: Boolean,
21
+ required: true,
22
+ },
23
+ modelSort: {
24
+ type: String,
25
+ required: false,
26
+ },
27
+ modelColumnsMapping: {
28
+ type: Object,
29
+ required: true,
30
+ },
31
+ },
32
+ emits: [
33
+ "change-model-sort",
34
+ ],
35
+ computed: {
36
+ isVisible() {
37
+ return this.modelColumnsMapping[this.column.id];
38
+ },
39
+
40
+ attributesForTh() {
41
+ const ATTRIBUTES = {
42
+ ...this.ariaSort,
43
+ scope: "col",
44
+ };
45
+ if (!this.isVisible) {
46
+ ATTRIBUTES.style = {
47
+ display: "none",
48
+ };
49
+ }
50
+ return ATTRIBUTES;
51
+ },
52
+
53
+ ariaSort() {
54
+ if (this.isSortable) {
55
+ let ariaSort = "none";
56
+ if (this.isSortAscending) {
57
+ ariaSort = "ascending";
58
+ } else if (this.isSortDescending) {
59
+ ariaSort = "descending";
60
+ }
61
+ return {
62
+ "aria-sort": ariaSort,
63
+ };
64
+ }
65
+ return {};
66
+ },
67
+
68
+ sortId() {
69
+ return this.column.sortId;
70
+ },
71
+
72
+ isSortAscending() {
73
+ return this.modelSort === this.sortId;
74
+ },
75
+
76
+ isSortDescending() {
77
+ return this.modelSort === `-${ this.sortId }`;
78
+ },
79
+
80
+ componentLocal() {
81
+ if (this.isSortable) {
82
+ return "button";
83
+ }
84
+ return "span";
85
+ },
86
+
87
+ isSortable() {
88
+ return !!this.sortId;
89
+ },
90
+
91
+ attributesForButton() {
92
+ if (this.isSortable) {
93
+ return {
94
+ type: "button",
95
+ disabled: this.isLoading,
96
+ onClick: this.changeModelSortLocal,
97
+ };
98
+ }
99
+ },
100
+
101
+ iconsSortable() {
102
+ const ICONS = [];
103
+ if (this.isSortable) {
104
+ if (!this.isSortAscending) {
105
+ ICONS.push(this.iconSortDescending);
106
+ }
107
+ if (!this.isSortDescending) {
108
+ ICONS.push(this.iconSortAscending);
109
+ }
110
+ }
111
+ return ICONS;
112
+ },
113
+
114
+ iconSortDescending() {
115
+ return h(AIcon, {
116
+ icon: "ChevronUp",
117
+ });
118
+ },
119
+
120
+ iconSortAscending() {
121
+ return h(AIcon, {
122
+ icon: "ChevronDown",
123
+ });
124
+ },
125
+ },
126
+ methods: {
127
+ changeModelSortLocal() {
128
+ if (this.isLoading) {
129
+ return;
130
+ }
131
+ this.$emit("change-model-sort", {
132
+ sortId: this.sortId,
133
+ });
134
+ },
135
+ },
136
+ render() {
137
+ return h("th", this.attributesForTh, [
138
+ h(this.componentLocal, this.attributesForButton, [
139
+ h(ATranslation, {
140
+ text: this.column.label,
141
+ tag: "span",
142
+ }),
143
+ ...this.iconsSortable,
144
+ ]),
145
+ ]);
146
+ },
147
+ };
@@ -0,0 +1,208 @@
1
+ import AIcon from "../../AIcon/AIcon";
2
+ import ATranslation from "../../ATranslation/ATranslation";
3
+
4
+ import {
5
+ h,
6
+ } from "vue";
7
+ import {
8
+ ceil,
9
+ } from "lodash-es";
10
+
11
+ export default {
12
+ name: "ATablePagination",
13
+ components: {
14
+ AIcon,
15
+ ATranslation,
16
+ },
17
+ props: {
18
+ totalRowsCount: {
19
+ type: Number,
20
+ required: true,
21
+ },
22
+ offset: {
23
+ type: Number,
24
+ required: true,
25
+ },
26
+ limit: {
27
+ type: Number,
28
+ required: true,
29
+ },
30
+ isLoading: {
31
+ type: Boolean,
32
+ required: true,
33
+ },
34
+ },
35
+ emits: [
36
+ "update:offset",
37
+ ],
38
+ data() {
39
+ return {
40
+ countMaxItems: 5, // should odd be
41
+ maxItem: undefined,
42
+ };
43
+ },
44
+ computed: {
45
+ paginationItems() {
46
+ const PAGINATION_ITEMS = [];
47
+ let currentItemIndex = -1;
48
+ for (let i = this.countMaxItems - 1; i > -this.countMaxItems; i--) {
49
+ const NUMBER = this.currentItem - i;
50
+ if (NUMBER > 0 && NUMBER <= this.maxItems) {
51
+ PAGINATION_ITEMS.push(NUMBER);
52
+ }
53
+ if (i === 0) {
54
+ currentItemIndex = PAGINATION_ITEMS.length - 1;
55
+ }
56
+ }
57
+
58
+ const {
59
+ indexStart,
60
+ indexEnd,
61
+ } = this.getIndexStartAndEndForPagination({
62
+ currentItemIndex,
63
+ paginationLength: PAGINATION_ITEMS.length
64
+ });
65
+ return PAGINATION_ITEMS.slice(indexStart, indexEnd);
66
+ },
67
+
68
+ currentItem() {
69
+ return (this.offset / this.limit >> 0) + 1;
70
+ },
71
+
72
+ maxItems() {
73
+ return ceil(this.totalRowsCount / this.limit);
74
+ },
75
+
76
+ disabledButtonFirstPage() {
77
+ return this.isLoading || this.currentItem === 1;
78
+ },
79
+
80
+ disabledButtonLastPage() {
81
+ return this.isLoading || this.currentItem === this.maxItems;
82
+ },
83
+ },
84
+ methods: {
85
+ getIndexStartAndEndForPagination({ currentItemIndex, paginationLength }) {
86
+ let indexStart = -1;
87
+ let indexEnd = paginationLength + 1;
88
+ const MIN_INDEX = Math.floor(this.countMaxItems / 2);
89
+ const MAX_INDEX = (this.countMaxItems * 2 - 1);
90
+ if (currentItemIndex <= MIN_INDEX) {
91
+ indexStart = 0;
92
+ indexEnd = this.countMaxItems;
93
+ } else if (currentItemIndex >= (MAX_INDEX - (MIN_INDEX + 1))) {
94
+ indexStart = MAX_INDEX - this.countMaxItems;
95
+ indexEnd = MAX_INDEX;
96
+ } else {
97
+ indexStart = currentItemIndex - MIN_INDEX;
98
+ indexEnd = currentItemIndex + MIN_INDEX + 1;
99
+ }
100
+
101
+ if (indexEnd > paginationLength) {
102
+ const DIFF = indexEnd - paginationLength;
103
+ indexEnd = paginationLength + 1;
104
+ indexStart = indexStart - DIFF;
105
+ if (indexStart < 0) {
106
+ indexStart = 0;
107
+ }
108
+ }
109
+
110
+ return {
111
+ indexStart,
112
+ indexEnd,
113
+ };
114
+ },
115
+
116
+ updateOffset(item) {
117
+ if (this.isLoading || item === this.currentItem) {
118
+ return;
119
+ }
120
+ const OFFSET = (item - 1) * this.limit;
121
+ this.$emit("update:offset", OFFSET);
122
+ },
123
+
124
+ updateOffsetFirst() {
125
+ if (this.disabledButtonFirstPage) {
126
+ return;
127
+ }
128
+ this.$emit("update:offset", 0);
129
+ },
130
+
131
+ updateOffsetLast() {
132
+ if (this.disabledButtonLastPage) {
133
+ return;
134
+ }
135
+ this.$emit("update:offset", (this.maxItems - 1) * this.limit);
136
+ },
137
+ },
138
+ render() {
139
+ return h(ATranslation, {
140
+ tag: "nav",
141
+ role: "navigation",
142
+ "aria-label": "_PAGINATION_NAVIGATION_",
143
+ }, {
144
+ default: () => {
145
+ return [
146
+ h("ul", {
147
+ class: "pagination",
148
+ }, [
149
+ h("li", {
150
+ class: ["page-item", { disabled: this.disabledButtonFirstPage }]
151
+ }, [
152
+ h(ATranslation, {
153
+ tag: "a",
154
+ class: "page-link",
155
+ role: "button",
156
+ tabindex: 0,
157
+ "aria-label": "_PREVIOUS_",
158
+ onClick: this.updateOffsetFirst,
159
+ }, {
160
+ default: () => [
161
+ h("span", {
162
+ "aria-hidden": "true",
163
+ }, [
164
+ "«",
165
+ ]),
166
+ ],
167
+ }),
168
+ ]),
169
+ this.paginationItems.map(item => {
170
+ return h("li", {
171
+ class: ["page-item", { active: item === this.currentItem }],
172
+ }, [
173
+ h("a", {
174
+ class: "page-link",
175
+ role: "button",
176
+ tabindex: 0,
177
+ onClick: () => this.updateOffset(item),
178
+ }, [
179
+ item,
180
+ ]),
181
+ ]);
182
+ }),
183
+ h("li", {
184
+ class: ["page-item", { disabled: this.disabledButtonLastPage }]
185
+ }, [
186
+ h(ATranslation, {
187
+ tag: "a",
188
+ class: "page-link",
189
+ role: "button",
190
+ tabindex: 0,
191
+ "aria-label": "_NEXT_",
192
+ onClick: this.updateOffsetLast,
193
+ }, {
194
+ default: () => [
195
+ h("span", {
196
+ "aria-hidden": "true",
197
+ }, [
198
+ "»",
199
+ ]),
200
+ ],
201
+ }),
202
+ ]),
203
+ ]),
204
+ ];
205
+ },
206
+ });
207
+ },
208
+ };
@@ -0,0 +1,73 @@
1
+ import {
2
+ h,
3
+ } from "vue";
4
+ import {
5
+ get,
6
+ } from "lodash-es";
7
+
8
+ export default {
9
+ name: "ATableTd",
10
+ props: {
11
+ column: {
12
+ type: Object,
13
+ required: true,
14
+ },
15
+ columnIndex: {
16
+ type: Number,
17
+ required: true,
18
+ },
19
+ row: {
20
+ type: Object,
21
+ required: true,
22
+ },
23
+ rowIndex: {
24
+ type: Number,
25
+ required: true,
26
+ },
27
+ modelColumnsMapping: {
28
+ type: Object,
29
+ required: true,
30
+ },
31
+ },
32
+ computed: {
33
+ text() {
34
+ return get(this.row, this.column.path);
35
+ },
36
+
37
+ path() {
38
+ return this.column.path;
39
+ },
40
+
41
+ isSlot() {
42
+ return !!this.column.slot;
43
+ },
44
+
45
+ attributesForTd() {
46
+ const ATTRIBUTES = {};
47
+ if (!this.isVisible) {
48
+ ATTRIBUTES.style = {
49
+ display: "none",
50
+ };
51
+ }
52
+ return ATTRIBUTES;
53
+ },
54
+
55
+ isVisible() {
56
+ return this.modelColumnsMapping[this.column.id];
57
+ },
58
+ },
59
+ render() {
60
+ return h("td", this.attributesForTd, this.isSlot ?
61
+ this.$slots[this.column.slot]({
62
+ column: this.column,
63
+ "column-index": this.columnIndex,
64
+ row: this.row,
65
+ "row-index": this.rowIndex,
66
+ }) :
67
+ [
68
+ h("span", null, [
69
+ this.text,
70
+ ])
71
+ ]);
72
+ },
73
+ };
@@ -0,0 +1,72 @@
1
+ import ATranslation from "../../ATranslation/ATranslation";
2
+
3
+ import {
4
+ h,
5
+ } from "vue";
6
+ import {
7
+ cloneDeep,
8
+ } from "lodash-es";
9
+
10
+
11
+ export default {
12
+ name: "ATableTopPanel",
13
+ components: {
14
+ ATranslation,
15
+ },
16
+ props: {
17
+ columns: {
18
+ type: Array,
19
+ required: true,
20
+ },
21
+ isLoading: {
22
+ type: Boolean,
23
+ required: true,
24
+ },
25
+ modelColumns: {
26
+ type: Array,
27
+ required: true,
28
+ },
29
+ },
30
+ emits: [
31
+ "update:model-columns",
32
+ ],
33
+ methods: {
34
+ changeModelColumns(columnId) {
35
+ const MODEL_COLUMNS = cloneDeep(this.modelColumns);
36
+ const INDEX = MODEL_COLUMNS.indexOf(columnId);
37
+ if (INDEX !== -1) {
38
+ MODEL_COLUMNS.splice(INDEX, 1);
39
+ } else {
40
+ MODEL_COLUMNS.push(columnId);
41
+ }
42
+ this.$emit("update:model-columns", MODEL_COLUMNS);
43
+ },
44
+ },
45
+ render() {
46
+ return h("div", {
47
+ class: "a_table__top_panel",
48
+ }, [
49
+ h("div", {
50
+ class: "text-end",
51
+ }, [
52
+ h("div", {
53
+ class: "btn-group",
54
+ }, this.columns.map(column => {
55
+ // TODO: ASelect
56
+ return h("button", {
57
+ type: "button",
58
+ class: this.modelColumns.indexOf(column.id) !== -1 ?
59
+ "btn btn-secondary" :
60
+ "btn btn-outline-secondary",
61
+ onClick: () => this.changeModelColumns(column.id),
62
+ }, [
63
+ h(ATranslation, {
64
+ text: column.label,
65
+ tag: "span",
66
+ }),
67
+ ]);
68
+ })),
69
+ ]),
70
+ ]);
71
+ },
72
+ };
@@ -0,0 +1,45 @@
1
+ import ATableTd from "../ATableTd/ATableTd";
2
+
3
+ import {
4
+ h,
5
+ } from "vue";
6
+
7
+ export default {
8
+ name: "ATableTr",
9
+ components: {
10
+ ATableTd,
11
+ },
12
+ props: {
13
+ columns: {
14
+ type: Array,
15
+ required: true,
16
+ },
17
+ modelColumnsMapping: {
18
+ type: Object,
19
+ required: true,
20
+ },
21
+ isLoading: {
22
+ type: Boolean,
23
+ required: true,
24
+ },
25
+ row: {
26
+ type: Object,
27
+ required: true,
28
+ },
29
+ rowIndex: {
30
+ type: Number,
31
+ required: true,
32
+ },
33
+ },
34
+ render() {
35
+ return h("tr", null, this.columns.map((column, columnIndex) => {
36
+ return h(ATableTd, {
37
+ column,
38
+ columnIndex,
39
+ row: this.row,
40
+ rowIndex: this.rowIndex,
41
+ modelColumnsMapping: this.modelColumnsMapping,
42
+ }, this.$slots);
43
+ }));
44
+ },
45
+ };