vueless 0.0.378 → 0.0.379

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": "vueless",
3
- "version": "0.0.378",
3
+ "version": "0.0.379",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -1,6 +1,7 @@
1
1
  import useUI from "../composables/useUI.js";
2
2
  import { cva } from "../utils/utilUI.js";
3
3
  import { computed, watchEffect } from "vue";
4
+ import { merge } from "lodash-es";
4
5
 
5
6
  import defaultConfig from "./config.js";
6
7
  import { POSITION } from "../composables/useAutoPosition.js";
@@ -46,39 +47,12 @@ export default function useAttrs(props, { isShownCalendar, isTop, isRight }) {
46
47
  }
47
48
 
48
49
  if (key === "calendar") {
49
- // This watcher rewrites default calendar locales with datepicker range locales
50
- // Watcher will not rewrite custom calendar locales
50
+ /* Merging DatePicker's i18n translations into Calendar's i18n translations. */
51
51
  watchEffect(() => {
52
- if (!attrs[`${key}Attrs`].value.config) {
53
- attrs[`${key}Attrs`].value.config = {};
54
- }
55
-
56
- if (attrs[`${key}Attrs`].value.config.i18n || !props.config.i18n) {
57
- return;
58
- }
59
-
60
- attrs[`${key}Attrs`].value.config.i18n = {
61
- ...config.value.i18n,
62
- weekdays: {
63
- shorthand: { ...config.value.i18n.weekdays.shorthand },
64
- longhand: { ...config.value.i18n.weekdays.longhand },
65
- },
66
- months: {
67
- shorthand: { ...config.value.i18n.months.shorthand },
68
- longhand: { ...config.value.i18n.months.longhand },
69
- },
70
- };
71
-
72
- if (props.config.i18n.weekdays.userFormat) {
73
- attrs[`${key}Attrs`].value.config.i18n.userFormat = {
74
- ...config.value.i18n.weekdays.userFormat,
75
- };
76
- }
52
+ const calendarConfig = attrs[`${key}Attrs`].value.config || {};
77
53
 
78
- if (props.config.i18n.months.userFormat) {
79
- attrs[`${key}Attrs`].value.config.i18n.userFormat = {
80
- ...config.value.i18n.months.userFormat,
81
- };
54
+ if (!calendarConfig.i18n || props.config.i18n) {
55
+ attrs[`${key}Attrs`].value.config.i18n = merge(calendarConfig.i18n, config.value.i18n);
82
56
  }
83
57
  });
84
58
  }
@@ -2,6 +2,7 @@ import useUI from "../composables/useUI.js";
2
2
  import { cx, cva } from "../utils/utilUI.js";
3
3
 
4
4
  import { computed, watchEffect } from "vue";
5
+ import { merge } from "lodash-es";
5
6
 
6
7
  import defaultConfig from "./config.js";
7
8
  import { POSITION } from "../composables/useAutoPosition.js";
@@ -85,39 +86,12 @@ export default function useAttrs(props, { isShownMenu, isTop, isRight, isPeriod
85
86
  }
86
87
 
87
88
  if (key === "calendar") {
88
- // This watcher rewrites default calendar locales with datepicker range locales
89
- // Watcher will not rewrite custom calendar locales
89
+ /* Merging DatePickerRange's i18n translations into Calendar's i18n translations. */
90
90
  watchEffect(() => {
91
- if (!attrs[`${key}Attrs`].value.config) {
92
- attrs[`${key}Attrs`].value.config = {};
93
- }
94
-
95
- if (attrs[`${key}Attrs`].value.config.i18n || !props.config.i18n) {
96
- return;
97
- }
98
-
99
- attrs[`${key}Attrs`].value.config.i18n = {
100
- ...config.value.i18n,
101
- weekdays: {
102
- shorthand: { ...config.value.i18n.weekdays.shorthand },
103
- longhand: { ...config.value.i18n.weekdays.longhand },
104
- },
105
- months: {
106
- shorthand: { ...config.value.i18n.months.shorthand },
107
- longhand: { ...config.value.i18n.months.longhand },
108
- },
109
- };
110
-
111
- if (props.config.i18n.weekdays.userFormat) {
112
- attrs[`${key}Attrs`].value.config.i18n.userFormat = {
113
- ...config.value.i18n.weekdays.userFormat,
114
- };
115
- }
91
+ const calendarConfig = attrs[`${key}Attrs`].value.config || {};
116
92
 
117
- if (props.config.i18n.months.userFormat) {
118
- attrs[`${key}Attrs`].value.config.i18n.userFormat = {
119
- ...config.value.i18n.months.userFormat,
120
- };
93
+ if (!calendarConfig.i18n || props.config.i18n) {
94
+ attrs[`${key}Attrs`].value.config.i18n = merge(calendarConfig.i18n, config.value.i18n);
121
95
  }
122
96
  });
123
97
  }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.378",
4
+ "version": "0.0.379",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",