aloha-vue 1.0.313 → 1.0.314

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.313",
4
+ "version": "1.0.314",
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"
@@ -7,6 +7,7 @@ import ASpinner from "../ASpinner/ASpinner";
7
7
  import ATranslation from "../ATranslation/ATranslation";
8
8
 
9
9
  import ClickAPI from "./comositionAPI/ClickAPI";
10
+ import IconsAPI from "./comositionAPI/IconsAPI";
10
11
  import LoadingAPI from "./comositionAPI/LoadingAPI";
11
12
  import TextAPI from "./comositionAPI/TextAPI";
12
13
  import TitleAPI from "./comositionAPI/TitleAPI";
@@ -82,12 +83,12 @@ export default {
82
83
  validator: value => ["right", "left"].indexOf(value) !== -1,
83
84
  },
84
85
  iconLeft: {
85
- type: String,
86
+ type: [String, Object],
86
87
  required: false,
87
88
  default: undefined,
88
89
  },
89
90
  iconRight: {
90
- type: String,
91
+ type: [String, Object],
91
92
  required: false,
92
93
  default: undefined,
93
94
  },
@@ -107,12 +108,12 @@ export default {
107
108
  default: undefined,
108
109
  },
109
110
  text: {
110
- type: [String, Number],
111
+ type: [String, Number, Object],
111
112
  required: false,
112
113
  default: undefined,
113
114
  },
114
115
  textScreenReader: {
115
- type: String,
116
+ type: [String, Number, Object],
116
117
  required: false,
117
118
  default: undefined,
118
119
  },
@@ -163,9 +164,16 @@ export default {
163
164
  isLoadingRight,
164
165
  } = LoadingAPI(props);
165
166
 
167
+ const {
168
+ iconLeftCurrentDevice,
169
+ iconRightCurrentDevice,
170
+ } = IconsAPI(props);
171
+
166
172
  const {
167
173
  isTextScreenReaderVisible,
168
174
  isTextVisible,
175
+ textForCurrentDevice,
176
+ textScreenReaderForCurrentDevice,
169
177
  } = TextAPI(props);
170
178
 
171
179
  const {
@@ -173,12 +181,16 @@ export default {
173
181
  } = ClickAPI(props, context);
174
182
 
175
183
  return {
184
+ iconLeftCurrentDevice,
185
+ iconRightCurrentDevice,
176
186
  isLoadingLeft,
177
187
  isLoadingRight,
178
188
  isTextScreenReaderVisible,
179
189
  isTextVisible,
180
190
  isTitleVisible,
181
191
  onClick,
192
+ textForCurrentDevice,
193
+ textScreenReaderForCurrentDevice,
182
194
  };
183
195
  },
184
196
  render() {
@@ -210,7 +222,7 @@ export default {
210
222
  this.isTextScreenReaderVisible && h(ATranslation, {
211
223
  class: "a_sr_only aloha_btn__hidden",
212
224
  tag: "span",
213
- html: this.textScreenReader,
225
+ html: this.textScreenReaderForCurrentDevice,
214
226
  extra: this.extraTranslate,
215
227
  }),
216
228
  this.isLoadingLeft && h(ASpinner, {
@@ -219,8 +231,8 @@ export default {
219
231
  this.loadingClass,
220
232
  ],
221
233
  }),
222
- this.iconLeft && h(AIcon, {
223
- icon: this.iconLeft,
234
+ this.iconLeftCurrentDevice && h(AIcon, {
235
+ icon: this.iconLeftCurrentDevice,
224
236
  iconTag: this.iconTag,
225
237
  class: [
226
238
  "aloha_btn__icon_left",
@@ -232,12 +244,12 @@ export default {
232
244
  this.isTextVisible && h(ATranslation, {
233
245
  tag: "span",
234
246
  class: this.textClass,
235
- html: this.text,
247
+ html: this.textForCurrentDevice,
236
248
  extra: this.extraTranslate,
237
249
  ariaHidden: this.textAriaHidden,
238
250
  }),
239
- this.iconRight && h(AIcon, {
240
- icon: this.iconRight,
251
+ this.iconRightCurrentDevice && h(AIcon, {
252
+ icon: this.iconRightCurrentDevice,
241
253
  iconTag: this.iconTag,
242
254
  class: [
243
255
  "aloha_btn__icon_right",
@@ -0,0 +1,44 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ import AMobileAPI from "../../compositionAPI/AMobileAPI";
7
+
8
+ import {
9
+ isPlainObject,
10
+ } from "lodash-es";
11
+
12
+ export default function IconsAPI(props) {
13
+ const iconLeft = toRef(props, "iconLeft");
14
+ const iconRight = toRef(props, "iconRight");
15
+
16
+ const {
17
+ isMobileWidth,
18
+ } = AMobileAPI();
19
+
20
+ const iconLeftCurrentDevice = computed(() => {
21
+ if (isPlainObject(iconLeft.value)) {
22
+ if (isMobileWidth.value) {
23
+ return iconLeft.value.mobile;
24
+ }
25
+ return iconLeft.value.desktop;
26
+ }
27
+ return iconLeft.value;
28
+ });
29
+
30
+ const iconRightCurrentDevice = computed(() => {
31
+ if (isPlainObject(iconRight.value)) {
32
+ if (isMobileWidth.value) {
33
+ return iconRight.value.mobile;
34
+ }
35
+ return iconRight.value.desktop;
36
+ }
37
+ return iconRight.value;
38
+ });
39
+
40
+ return {
41
+ iconLeftCurrentDevice,
42
+ iconRightCurrentDevice,
43
+ };
44
+ }
@@ -3,7 +3,10 @@ import {
3
3
  toRef,
4
4
  } from "vue";
5
5
 
6
+ import AMobileAPI from "../../compositionAPI/AMobileAPI";
7
+
6
8
  import {
9
+ isPlainObject,
7
10
  isUndefined,
8
11
  } from "lodash-es";
9
12
 
@@ -11,16 +14,42 @@ export default function TextAPI(props) {
11
14
  const text = toRef(props, "text");
12
15
  const textScreenReader = toRef(props, "textScreenReader");
13
16
 
17
+ const {
18
+ isMobileWidth,
19
+ } = AMobileAPI();
20
+
21
+ const textForCurrentDevice = computed(() => {
22
+ if (isPlainObject(text.value)) {
23
+ if (isMobileWidth.value) {
24
+ return text.value.mobile;
25
+ }
26
+ return text.value.desktop;
27
+ }
28
+ return text.value;
29
+ });
30
+
31
+ const textScreenReaderForCurrentDevice = computed(() => {
32
+ if (isPlainObject(textScreenReader.value)) {
33
+ if (isMobileWidth.value) {
34
+ return textScreenReader.value.mobile;
35
+ }
36
+ return textScreenReader.value.desktop;
37
+ }
38
+ return textScreenReader.value;
39
+ });
40
+
14
41
  const isTextVisible = computed(() => {
15
- return !isUndefined(text.value);
42
+ return !isUndefined(textForCurrentDevice.value);
16
43
  });
17
44
 
18
45
  const isTextScreenReaderVisible = computed(() => {
19
- return !isUndefined(textScreenReader.value);
46
+ return !isUndefined(textScreenReaderForCurrentDevice.value);
20
47
  });
21
48
 
22
49
  return {
23
50
  isTextScreenReaderVisible,
24
51
  isTextVisible,
52
+ textForCurrentDevice,
53
+ textScreenReaderForCurrentDevice,
25
54
  };
26
55
  }
@@ -10,7 +10,8 @@ import {
10
10
  } from "../../utils/actions";
11
11
  import {
12
12
  cloneDeep,
13
- forEach, last,
13
+ forEach,
14
+ last,
14
15
  } from "lodash-es";
15
16
 
16
17
  export default function ActionsAPI(props) {
@@ -20,7 +21,7 @@ export default function ActionsAPI(props) {
20
21
  const minDropdownActions = toRef(props, "minDropdownActions");
21
22
 
22
23
  const {
23
- isMobile,
24
+ isMobileWidth,
24
25
  } = AMobileAPI();
25
26
 
26
27
  const actionsAllFiltered = computed(() => {
@@ -30,7 +31,7 @@ export default function ActionsAPI(props) {
30
31
  });
31
32
 
32
33
  const currentIndexFirstDropdownAction = computed(() => {
33
- return isMobile.value ? indexFirstDropdownActionMobile.value : indexFirstDropdownAction.value;
34
+ return isMobileWidth.value ? indexFirstDropdownActionMobile.value : indexFirstDropdownAction.value;
34
35
  });
35
36
 
36
37
  const hasMoreEqualActionsThenParameter = ({ actions = [], minCountActions = 0 }) => {
@@ -7,6 +7,7 @@ import AIcon from "../AIcon/AIcon";
7
7
  import ASpinner from "../ASpinner/ASpinner";
8
8
  import ATranslation from "../ATranslation/ATranslation";
9
9
 
10
+ import IconsAPI from "../AButton/comositionAPI/IconsAPI";
10
11
  import LoadingAPI from "../AButton/comositionAPI/LoadingAPI";
11
12
  import TextAPI from "../AButton/comositionAPI/TextAPI";
12
13
  import TitleAPI from "../AButton/comositionAPI/TitleAPI";
@@ -146,17 +147,28 @@ export default {
146
147
  isLoadingRight,
147
148
  } = LoadingAPI(props);
148
149
 
150
+ const {
151
+ iconLeftCurrentDevice,
152
+ iconRightCurrentDevice,
153
+ } = IconsAPI(props);
154
+
149
155
  const {
150
156
  isTextScreenReaderVisible,
151
157
  isTextVisible,
158
+ textForCurrentDevice,
159
+ textScreenReaderForCurrentDevice,
152
160
  } = TextAPI(props);
153
161
 
154
162
  return {
163
+ iconLeftCurrentDevice,
164
+ iconRightCurrentDevice,
155
165
  isLoadingLeft,
156
166
  isLoadingRight,
157
167
  isTextScreenReaderVisible,
158
168
  isTextVisible,
159
169
  isTitleVisible,
170
+ textForCurrentDevice,
171
+ textScreenReaderForCurrentDevice,
160
172
  };
161
173
  },
162
174
  render() {
@@ -169,7 +181,7 @@ export default {
169
181
  this.isTextScreenReaderVisible && h(ATranslation, {
170
182
  class: "a_sr_only aloha_link__hidden",
171
183
  tag: "span",
172
- html: this.textScreenReader,
184
+ html: this.textScreenReaderForCurrentDevice,
173
185
  extra: this.extraTranslate,
174
186
  }),
175
187
  this.isLoadingLeft && h(ASpinner, {
@@ -178,8 +190,8 @@ export default {
178
190
  this.loadingClass,
179
191
  ],
180
192
  }),
181
- this.iconLeft && h(AIcon, {
182
- icon: this.iconLeft,
193
+ this.iconLeftCurrentDevice && h(AIcon, {
194
+ icon: this.iconLeftCurrentDevice,
183
195
  iconTag: this.iconTag,
184
196
  class: [
185
197
  "aloha_link__icon_left",
@@ -191,12 +203,12 @@ export default {
191
203
  this.isTextVisible && h(ATranslation, {
192
204
  tag: "span",
193
205
  class: this.textClass,
194
- html: this.text,
206
+ html: this.textForCurrentDevice,
195
207
  extra: this.extraTranslate,
196
208
  ariaHidden: this.textAriaHidden,
197
209
  }),
198
- this.iconRight && h(AIcon, {
199
- icon: this.iconRight,
210
+ this.iconRightCurrentDevice && h(AIcon, {
211
+ icon: this.iconRightCurrentDevice,
200
212
  iconTag: this.iconTag,
201
213
  class: [
202
214
  "aloha_link__icon_right",
@@ -359,7 +359,7 @@ export default {
359
359
  } = TableColumnsVisibleAPI();
360
360
 
361
361
  const {
362
- isMobile,
362
+ isMobileWidth: isMobile,
363
363
  } = AMobileAPI();
364
364
 
365
365
  const {
@@ -107,7 +107,12 @@ export default {
107
107
  class: "a_btn a_btn_primary a_text_nowrap",
108
108
  iconLeft: "Search",
109
109
  type: "submit",
110
- text: "_SUCHE_STARTEN_",
110
+ text: {
111
+ desktop: "_SUCHE_STARTEN_",
112
+ },
113
+ textScreenReader: {
114
+ mobile: "_SUCHE_STARTEN_",
115
+ },
111
116
  prevent: true,
112
117
  stop: true,
113
118
  disabled: this.isLoadingTable,
@@ -2,15 +2,15 @@ import {
2
2
  ref,
3
3
  } from "vue";
4
4
 
5
- export const isMobile = ref(undefined);
5
+ export const isMobileWidth = ref(undefined);
6
6
 
7
- export function setIsMobile(isMobileLocal) {
8
- isMobile.value = isMobileLocal;
7
+ export function setIsMobileWidth(isMobileWidthLocal) {
8
+ isMobileWidth.value = isMobileWidthLocal;
9
9
  }
10
10
 
11
11
  export default function AMobileAPI() {
12
12
  return {
13
- isMobile,
14
- setIsMobile,
13
+ isMobileWidth,
14
+ setIsMobileWidth,
15
15
  };
16
16
  }
@@ -1,21 +1,21 @@
1
1
  import {
2
- isMobile,
3
- setIsMobile,
2
+ isMobileWidth,
3
+ setIsMobileWidth,
4
4
  } from "../compositionAPI/AMobileAPI";
5
5
 
6
6
  export default {
7
7
  install: (app, {
8
8
  breakpoint,
9
9
  } = {}) => {
10
- setIsMobile(window.innerWidth <= breakpoint);
10
+ setIsMobileWidth(window.innerWidth <= breakpoint);
11
11
  const resizeWindow = () => {
12
12
  if (window.innerWidth > breakpoint) {
13
- if (isMobile.value) {
14
- setIsMobile(false);
13
+ if (isMobileWidth.value) {
14
+ setIsMobileWidth(false);
15
15
  }
16
16
  } else {
17
- if (!isMobile.value) {
18
- setIsMobile(true);
17
+ if (!isMobileWidth.value) {
18
+ setIsMobileWidth(true);
19
19
  }
20
20
  }
21
21
  };