aloha-vue 2.3.0 → 2.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Aloha-vue is a JavaScript library that provides a wide range of accessible components and directives for Vue.js. Accessibility is of paramount importance to us, and we have designed all our components to meet accessibility compliance criteria. This library is a valuable tool for frontend developers and has already been used in three projects, including two large-scale ones",
5
5
  "keywords": [
6
6
  "accessibility compliance criteria",
package/scss/_base.scss CHANGED
@@ -22,6 +22,7 @@
22
22
  .a_search_highlight {
23
23
  color: red;
24
24
  background-color: inherit;
25
+ padding: 0;
25
26
  }
26
27
  .a_popup_container,
27
28
  .a_select_container {
@@ -52,3 +53,11 @@
52
53
  * + .a_dropdown__caret {
53
54
  margin-left: 0.5rem;
54
55
  }
56
+
57
+ .a_code_content {
58
+ overflow: auto;
59
+ max-height: 200px;
60
+ white-space: pre;
61
+ font-family: monospace;
62
+ width: 100%;
63
+ }
@@ -67,8 +67,14 @@ export default function AFiltersAPI() {
67
67
  return _filterFileSize(value, { units, sourceUnits, digits });
68
68
  };
69
69
 
70
- const filterJson = (value, { replacer, space = 2 } = {}) => {
71
- return _filterJson(value, { replacer, space });
70
+ const filterJson = (value, {
71
+ replacer,
72
+ space = 2,
73
+ isHtml = false,
74
+ jsonClass = "a_code_content",
75
+ tag = "pre",
76
+ } = {}) => {
77
+ return _filterJson(value, { replacer, space, isHtml, jsonClass, tag });
72
78
  };
73
79
 
74
80
  const filterKeyValue = value => {
@@ -49,11 +49,11 @@ export function isCurrentPopupOpen({ id }) {
49
49
  return !!popupOpenIds.value[id];
50
50
  }
51
51
 
52
- function openPopup({ id }) {
52
+ export function openPopup({ id }) {
53
53
  popupOpenIds.value[id] = true;
54
54
  }
55
55
 
56
- function closePopup({ id }) {
56
+ export function closePopup({ id }) {
57
57
  if (id in popupOpenIds.value) {
58
58
  delete popupOpenIds.value[id];
59
59
  }
@@ -28,4 +28,47 @@ describe("filterJson", () => {
28
28
 
29
29
  expect(filterJson(circularReference)).toBe("");
30
30
  });
31
+
32
+ it("returns formatted HTML output when isHtml is true", () => {
33
+ const value = { key: "value" };
34
+ const expectedOutput = `<pre class="a_code_content">${ JSON.stringify(value, null, 2) }</pre>`;
35
+
36
+ expect(filterJson(value, { isHtml: true })).toBe(expectedOutput);
37
+ });
38
+
39
+ it("returns formatted HTML output with custom class", () => {
40
+ const value = { key: "value" };
41
+ const expectedOutput = `<pre class="custom_class">${ JSON.stringify(value, null, 2) }</pre>`;
42
+
43
+ expect(filterJson(value, { isHtml: true, jsonClass: "custom_class" })).toBe(expectedOutput);
44
+ });
45
+
46
+ it("returns formatted HTML output with custom tag", () => {
47
+ const value = { key: "value" };
48
+ const expectedOutput = `<div class="a_code_content">${ JSON.stringify(value, null, 2) }</div>`;
49
+
50
+ expect(filterJson(value, { isHtml: true, tag: "div" })).toBe(expectedOutput);
51
+ });
52
+
53
+ it("returns formatted HTML output with custom tag and class", () => {
54
+ const value = { key: "value" };
55
+ const expectedOutput = `<span class="custom_class">${ JSON.stringify(value, null, 2) }</span>`;
56
+
57
+ expect(filterJson(value, { isHtml: true, tag: "span", jsonClass: "custom_class" })).toBe(expectedOutput);
58
+ });
59
+
60
+ it("returns correctly formatted JSON when using a replacer function", () => {
61
+ const value = { key1: "value1", key2: "value2" };
62
+ const replacer = (key, val) => (key === "key1" ? undefined : val);
63
+ const expectedOutput = JSON.stringify(value, replacer, 2);
64
+
65
+ expect(filterJson(value, { replacer })).toBe(expectedOutput);
66
+ });
67
+
68
+ it("returns correctly formatted JSON with a custom space indentation", () => {
69
+ const value = { key: "value" };
70
+ const expectedOutput = JSON.stringify(value, null, 4);
71
+
72
+ expect(filterJson(value, { space: 4 })).toBe(expectedOutput);
73
+ });
31
74
  });
@@ -1,24 +1,39 @@
1
- import {
2
- isNil,
3
- } from "lodash-es";
4
-
5
- /**
6
- * Converts a JavaScript value to a formatted JSON string.
7
- *
8
- * @param {*} value - The value to be converted to JSON
9
- * @param {Object} [options] - Optional parameters
10
- * @param {Function} [options.replacer] - A function that alters the behavior of the stringification process
11
- * @param {number} [options.space=2] - The number of spaces used for indentation in the resulting string
12
- *
13
- * @returns {string} The JSON string representation of the value; an empty string if the value is undefined or null, or an error occurred during the stringification process.
14
- */
15
- export default function(value, { replacer, space = 2 } = {}) {
16
- if (isNil(value)) {
17
- return "";
18
- }
19
- try {
20
- return JSON.stringify(value, replacer, space);
21
- } catch (e) {
22
- return "";
23
- }
24
- }
1
+ import {
2
+ isNil,
3
+ } from "lodash-es";
4
+
5
+ /**
6
+ * Converts a JavaScript value to a formatted JSON string.
7
+ *
8
+ * @param {*} value - The value to be converted to JSON.
9
+ * @param {Object} [options] - Optional parameters.
10
+ * @param {Function} [options.replacer] - A function that alters the behavior of the stringification process.
11
+ * @param {number} [options.space=2] - The number of spaces used for indentation in the resulting string.
12
+ * @param {boolean} [options.isHtml=false] - Determines if the output should be formatted as HTML.
13
+ * When set to false, the output is returned as a plain text string.
14
+ * @param {string} [options.jsonClass="a_code_content"] - The CSS class to be applied when `isHtml` is true.
15
+ * @param {string} [options.tag="pre"] - The HTML tag to wrap the formatted JSON string when `isHtml` is true.
16
+ *
17
+ * @returns {string} The JSON string representation of the value.
18
+ * Returns an empty string if the value is `undefined` or `null`,
19
+ * or if an error occurred during the stringification process.
20
+ */
21
+ export default function(value, { replacer, space = 2, isHtml = false, jsonClass = "a_code_content", tag = "pre" } = {}) {
22
+ if (isNil(value)) {
23
+ return "";
24
+ }
25
+
26
+ try {
27
+ const RESULT_STRING = JSON.stringify(value, replacer, space);
28
+ if (isHtml) {
29
+ const CLASS = jsonClass ?
30
+ ` class="${ jsonClass }"` :
31
+ "";
32
+ return `<${ tag }${ CLASS }>${ RESULT_STRING }</${ tag }>`;
33
+ }
34
+
35
+ return RESULT_STRING;
36
+ } catch (e) {
37
+ return "";
38
+ }
39
+ }
@@ -33,6 +33,7 @@ import ACloakI18n from "../ACloak/i18n/ACloakI18n";
33
33
  import ARequiredI18n from "../ui/ARequired/i18n/ARequiredI18n";
34
34
  import AInputNumberI18n from "../ui/AInputNumber/i18n/AInputNumberI18n";
35
35
  import AInputCurrencyI18n from "../ui/AInputCurrency/i18n/AInputCurrencyI18n";
36
+ import ARouterLinkConfigI18n from "../ui/ARouterLinkConfig/i18n/ARouterLinkConfigI18n";
36
37
 
37
38
  export const ar = {
38
39
  ...arJson,
@@ -62,6 +63,7 @@ export const ar = {
62
63
  ...ARequiredI18n.ar,
63
64
  ...AInputNumberI18n.ar,
64
65
  ...AInputCurrencyI18n.ar,
66
+ ...ARouterLinkConfigI18n.ar,
65
67
  };
66
68
  export const de = {
67
69
  ...deJson,
@@ -91,6 +93,7 @@ export const de = {
91
93
  ...ARequiredI18n.de,
92
94
  ...AInputNumberI18n.de,
93
95
  ...AInputCurrencyI18n.de,
96
+ ...ARouterLinkConfigI18n.de,
94
97
  };
95
98
  export const en = {
96
99
  ...enJson,
@@ -120,6 +123,7 @@ export const en = {
120
123
  ...ARequiredI18n.en,
121
124
  ...AInputNumberI18n.en,
122
125
  ...AInputCurrencyI18n.en,
126
+ ...ARouterLinkConfigI18n.en,
123
127
  };
124
128
  export const es = {
125
129
  ...esJson,
@@ -149,6 +153,7 @@ export const es = {
149
153
  ...ARequiredI18n.es,
150
154
  ...AInputNumberI18n.es,
151
155
  ...AInputCurrencyI18n.es,
156
+ ...ARouterLinkConfigI18n.es,
152
157
  };
153
158
  export const fr = {
154
159
  ...frJson,
@@ -178,6 +183,7 @@ export const fr = {
178
183
  ...ARequiredI18n.fr,
179
184
  ...AInputNumberI18n.fr,
180
185
  ...AInputCurrencyI18n.fr,
186
+ ...ARouterLinkConfigI18n.fr,
181
187
  };
182
188
  export const hr = {
183
189
  ...hrJson,
@@ -207,6 +213,7 @@ export const hr = {
207
213
  ...ARequiredI18n.hr,
208
214
  ...AInputNumberI18n.hr,
209
215
  ...AInputCurrencyI18n.hr,
216
+ ...ARouterLinkConfigI18n.hr,
210
217
  };
211
218
  export const it = {
212
219
  ...itJson,
@@ -236,6 +243,7 @@ export const it = {
236
243
  ...ARequiredI18n.it,
237
244
  ...AInputNumberI18n.it,
238
245
  ...AInputCurrencyI18n.it,
246
+ ...ARouterLinkConfigI18n.it,
239
247
  };
240
248
  export const ru = {
241
249
  ...ruJson,
@@ -265,6 +273,7 @@ export const ru = {
265
273
  ...ARequiredI18n.ru,
266
274
  ...AInputNumberI18n.ru,
267
275
  ...AInputCurrencyI18n.ru,
276
+ ...ARouterLinkConfigI18n.ru,
268
277
  };
269
278
 
270
279
  export default {
package/src/index.js CHANGED
@@ -50,6 +50,7 @@ export { default as ARadio } from "./ui/ARadio/ARadio";
50
50
  export { default as ARate } from "./ARate/ARate";
51
51
  export { default as ARequired } from "./ui/ARequired/ARequired";
52
52
  export { default as AResizer } from "./AResizer/AResizer";
53
+ export { default as ARouterLinkConfig } from "./ui/ARouterLinkConfig/ARouterLinkConfig";
53
54
  export { default as AScale } from "./AScale/AScale";
54
55
  export { default as ASelect } from "./ui/ASelect/ASelect";
55
56
  export { default as AShowMore } from "./AShowMore/AShowMore";
@@ -107,6 +108,13 @@ export {
107
108
  default as APageTabTitleAPI,
108
109
  setBaseTitle as APageTabTitleAPI_setBaseTitle,
109
110
  } from "./compositionAPI/APageTabTitleAPI";
111
+ export {
112
+ default as APopupAPI,
113
+ closePopup as APopupAPI_closePopup,
114
+ isCurrentPopupOpen as APopupAPI_isCurrentPopupOpen,
115
+ openPopup as APopupAPI_openPopup,
116
+ togglePopup as APopupAPI_togglePopup,
117
+ } from "./compositionAPI/APopupAPI";
110
118
  export { default as UiAPI } from "./ui/compositionApi/UiAPI";
111
119
  export { default as UIExcludeRenderAttributesAPI } from "./ui/compositionApi/UIExcludeRenderAttributesAPI";
112
120
  export { default as UiStyleHideAPI } from "./ui/compositionApi/UiStyleHideAPI";
@@ -131,6 +139,7 @@ export { default as AlohaPlugin } from "./plugins/alohaPlugin";
131
139
  export { default as AMobilePlugin } from "./plugins/AMobilePlugin";
132
140
  export { default as AModalPlugin } from "./plugins/AModalPlugin";
133
141
  export { default as APageTabTitlePlugin } from "./plugins/APageTabTitlePlugin";
142
+ export { default as ARouterLinkConfigPlugin } from "./plugins/ARouterLinkConfigPlugin";
134
143
  export { default as ASelectPlugin } from "./plugins/ASelectPlugin";
135
144
  export { default as ASpinnerPlugin } from "./plugins/ASpinnerPlugin";
136
145
  export { default as ATablePlugin } from "./plugins/ATablePlugin";
@@ -214,32 +223,33 @@ export {
214
223
  it as i18nIT,
215
224
  ru as i18nRU,
216
225
  } from "./i18n/allLanguages";
226
+ export { default as ACheckboxI18n } from "./ui/ACheckbox/i18n/ACheckboxI18n";
217
227
  export { default as ACloakI18n } from "./ACloak/i18n/ACloakI18n";
228
+ export { default as ADatepickerRangeI18n } from "./ui/ADatepickerRange/i18n/ADatepickerRangeI18n";
218
229
  export { default as ADisclosureI18n } from "./ADisclosure/i18n/ADisclosureI18n";
230
+ export { default as AFieldsetI18n } from "./ui/AFieldset/i18n/AFieldsetI18n";
219
231
  export { default as AFiltersI18n } from "./AFilters/i18n/AFiltersI18n";
232
+ export { default as AInputCurrencyI18n } from "./ui/AInputCurrency/i18n/AInputCurrencyI18n";
233
+ export { default as AInputI18n } from "./ui/AInput/i18n/AInputI18n";
234
+ export { default as AInputNumberI18n } from "./ui/AInputNumber/i18n/AInputNumberI18n";
235
+ export { default as AInputNumberRangeI18n } from "./ui/AInputNumberRange/i18n/AInputNumberRangeI18n";
236
+ export { default as AJsonI18n } from "./ui/AJson/i18n/AJsonI18n";
220
237
  export { default as ALinkCopyI18n } from "./ALinkCopy/i18n/ALinkCopyI18n";
221
238
  export { default as ALoadingI18n } from "./ALoading/i18n/ALoadingI18n";
222
239
  export { default as AMenu2I18n } from "./AMenu/i18n/AMenu2I18n";
223
240
  export { default as AModalI18n } from "./AModal/i18n/AModalI18n";
224
241
  export { default as APaginationI18n } from "./APagination/i18n/APaginationI18n";
242
+ export { default as ARadioI18n } from "./ui/ARadio/i18n/ARadioI18n";
243
+ export { default as ARequiredI18n } from "./ui/ARequired/i18n/ARequiredI18n";
244
+ export { default as ARouterLinkConfigI18n } from "./ui/ARouterLinkConfig/i18n/ARouterLinkConfigI18n";
245
+ export { default as ASelectI18n } from "./ui/ASelect/i18n/ASelectI18n";
225
246
  export { default as AShowMoreI18n } from "./AShowMore/i18n/AShowMoreI18n";
226
247
  export { default as ASpinnerI18n } from "./ASpinner/i18n/ASpinnerI18n";
248
+ export { default as ASwitchI18n } from "./ui/ASwitch/i18n/ASwitchI18n";
227
249
  export { default as ATableI18n } from "./ATable/i18n/ATableI18n";
228
250
  export { default as AVerticalScrollI18n } from "./AVerticalScroll/i18n/AVerticalScrollI18n";
229
251
  export { default as AWizardI18n } from "./AWizard/i18n/AWizardI18n";
230
252
  export { default as Filters18n } from "./filters/i18n/Filters18n";
231
- export { default as ACheckboxI18n } from "./ui/ACheckbox/i18n/ACheckboxI18n";
232
- export { default as ADatepickerRangeI18n } from "./ui/ADatepickerRange/i18n/ADatepickerRangeI18n";
233
- export { default as AFieldsetI18n } from "./ui/AFieldset/i18n/AFieldsetI18n";
234
- export { default as AInputI18n } from "./ui/AInput/i18n/AInputI18n";
235
- export { default as AInputCurrencyI18n } from "./ui/AInputCurrency/i18n/AInputCurrencyI18n";
236
- export { default as AInputNumberI18n } from "./ui/AInputNumber/i18n/AInputNumberI18n";
237
- export { default as AInputNumberRangeI18n } from "./ui/AInputNumberRange/i18n/AInputNumberRangeI18n";
238
- export { default as AJsonI18n } from "./ui/AJson/i18n/AJsonI18n";
239
- export { default as ARadioI18n } from "./ui/ARadio/i18n/ARadioI18n";
240
- export { default as ARequiredI18n } from "./ui/ARequired/i18n/ARequiredI18n";
241
- export { default as ASelectI18n } from "./ui/ASelect/i18n/ASelectI18n";
242
- export { default as ASwitchI18n } from "./ui/ASwitch/i18n/ASwitchI18n";
243
253
  export {
244
254
  getTranslatedText,
245
255
  isPlaceholderTranslate,
@@ -0,0 +1,77 @@
1
+ import {
2
+ forEach,
3
+ } from "lodash-es";
4
+
5
+ export const routerLinkConfigPluginOptions = {
6
+ propsDefault: {
7
+ classColumn: "a_column a_column_12",
8
+ classColumns: "a_columns a_columns_count_12 a_columns_gap_y_1",
9
+ helpTextParam: "_A_ROUTER_LINK_CONFIG_HELP_TEXT_PARAM_",
10
+ helpTextRoute: "_A_ROUTER_LINK_CONFIG_HELP_TEXT_ROUTE_",
11
+ helpTextQuery: "_A_ROUTER_LINK_CONFIG_HELP_TEXT_QUERY_",
12
+ helpTextTarget: "_A_ROUTER_LINK_CONFIG_HELP_TEXT_TARGET_",
13
+ keyIdRoute: "name",
14
+ keyLabelRoute: "path",
15
+ labelParam: "_A_ROUTER_LINK_CONFIG_LABEL_PARAM_",
16
+ labelQuery: "_A_ROUTER_LINK_CONFIG_LABEL_QUERY_",
17
+ labelRoute: "_A_ROUTER_LINK_CONFIG_LABEL_ROUTE_",
18
+ labelTarget: "_A_ROUTER_LINK_CONFIG_LABEL_TARGET_",
19
+ routes: [],
20
+ sortOrderRoute: "asc",
21
+ targets: [
22
+ {
23
+ id: "_blank",
24
+ label: "_A_TARGET_BLANK_",
25
+ },
26
+ {
27
+ id: "_self",
28
+ label: "_A_TARGET_SELF_",
29
+ },
30
+ {
31
+ id: "_parent",
32
+ label: "_A_TARGET_PARENT_",
33
+ },
34
+ {
35
+ id: "_top",
36
+ label: "_A_TARGET_TOP_",
37
+ },
38
+ ],
39
+ },
40
+ };
41
+
42
+ function setRoutes({ routes = [], excludedPathRoutes = [] }) {
43
+ const ROUTES = [];
44
+ const EXCLUDED_PATH_ROUTES_MAP = {};
45
+ if (excludedPathRoutes.length) {
46
+ forEach(excludedPathRoutes, path => {
47
+ EXCLUDED_PATH_ROUTES_MAP[path] = true;
48
+ });
49
+ }
50
+ forEach(routes, route => {
51
+ const PATH = route.path;
52
+ if (route.name &&
53
+ !EXCLUDED_PATH_ROUTES_MAP[PATH]) {
54
+ ROUTES.push({
55
+ path: route.path,
56
+ name: route.name,
57
+ meta: route.meta,
58
+ });
59
+ }
60
+ });
61
+
62
+ return ROUTES;
63
+ }
64
+
65
+
66
+ export default {
67
+ install: (app, {
68
+ propsDefault = {},
69
+ excludedPathRoutes = [],
70
+ } = {}) => {
71
+ routerLinkConfigPluginOptions.propsDefault = {
72
+ ...routerLinkConfigPluginOptions.propsDefault,
73
+ ...propsDefault,
74
+ routes: setRoutes({ routes: propsDefault.routes, excludedPathRoutes }),
75
+ };
76
+ },
77
+ };