@pequity/squirrel 11.0.1 → 11.0.3
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/dist/cjs/chunks/index.js +374 -216
- package/dist/cjs/chunks/p-btn.js +1 -1
- package/dist/cjs/dateLocale.js +1221 -280
- package/dist/cjs/index.js +19 -8
- package/dist/cjs/inputClasses.js +3 -3
- package/dist/es/chunks/index.js +374 -216
- package/dist/es/chunks/p-btn.js +2 -2
- package/dist/es/dateLocale.js +1221 -280
- package/dist/es/index.js +48 -37
- package/dist/es/inputClasses.js +4 -4
- package/dist/squirrel/components/p-link/p-link.vue.d.ts +2 -2
- package/dist/squirrel/components/p-pagination-info/p-pagination-info.vue.d.ts +2 -2
- package/dist/squirrel/components/p-table/p-table.vue.d.ts +3 -1
- package/dist/squirrel/components/p-table-header-cell/p-table-header-cell.vue.d.ts +2 -2
- package/package.json +31 -31
- package/squirrel/components/p-btn/p-btn.spec.js +15 -5
- package/squirrel/components/p-drawer/p-drawer.spec.js +16 -11
- package/squirrel/components/p-dropdown/p-dropdown.spec.js +15 -10
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +44 -27
- package/squirrel/components/p-pagination/p-pagination.spec.js +22 -30
- package/squirrel/components/p-select-btn/p-select-btn.spec.js +35 -27
- package/squirrel/components/p-select-list/p-select-list.spec.js +44 -27
- package/squirrel/components/p-select-pill/p-select-pill.spec.js +7 -6
- package/squirrel/components/p-table/p-table.spec.js +50 -43
- package/squirrel/components/p-tabs-pills/p-tabs-pills.spec.js +10 -8
- package/squirrel/locales/de-DE.json +47 -0
- package/squirrel/locales/es-ES.json +47 -0
- package/squirrel/plugin/index.spec.ts +32 -12
- package/squirrel/plugin/index.ts +6 -2
- package/squirrel/utils/dateLocale.spec.ts +9 -5
- package/squirrel/utils/dateLocale.ts +7 -3
- /package/squirrel/locales/{fr-CA.json → fr-FR.json} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"squirrel": {
|
|
3
|
+
"close": "Cerrar",
|
|
4
|
+
"action_bar_clear_all": "Borrar todo",
|
|
5
|
+
"select_list_items": "{count} elemento | {count} elementos",
|
|
6
|
+
"select_list_select_all": "Seleccionar todo",
|
|
7
|
+
"select_list_select_all_filtered": "Seleccionar todo (filtrado)",
|
|
8
|
+
"select_list_clear_all": "Borrar todo",
|
|
9
|
+
"select_list_no_items_found": "No se encontraron elementos",
|
|
10
|
+
"dropdown_select_aria_label": "Selección desplegable",
|
|
11
|
+
"dropdown_select_remove_item": "Eliminar elemento",
|
|
12
|
+
"dropdown_select_clear_selection": "Borrar selección",
|
|
13
|
+
"dropdown_select_all_options_selected": "Todas las opciones seleccionadas",
|
|
14
|
+
"dropdown_select_options": "opción | opciones",
|
|
15
|
+
"dropdown_select_selected": "seleccionado",
|
|
16
|
+
"dropdown_select_items": "@:squirrel.select_list_items",
|
|
17
|
+
"dropdown_select_select_all": "@:squirrel.select_list_select_all",
|
|
18
|
+
"dropdown_select_select_all_filtered": "@:squirrel.select_list_select_all_filtered",
|
|
19
|
+
"dropdown_select_clear_all": "@:squirrel.select_list_clear_all",
|
|
20
|
+
"dropdown_select_add": "Agregar",
|
|
21
|
+
"dropdown_select_no_items_found_type_to_add": "No se encontraron elementos. Escriba para agregar",
|
|
22
|
+
"dropdown_select_no_items_found": "@:squirrel.select_list_no_items_found",
|
|
23
|
+
"file_upload_dropzone": "zona de carga",
|
|
24
|
+
"file_upload_drag_or_select": "Arrastre o {select}",
|
|
25
|
+
"file_upload_drop": "Soltar {fileWord}",
|
|
26
|
+
"file_upload_max": "Máx. {count}",
|
|
27
|
+
"file_upload_one": "Uno",
|
|
28
|
+
"file_upload_files": "archivo | archivos",
|
|
29
|
+
"file_upload_select": "seleccionar {fileWord}",
|
|
30
|
+
"file_upload_with_size_less_than": "con tamaño menor que {maxSize} | con tamaño menor que {maxSize} cada uno",
|
|
31
|
+
"file_upload_max_files_exceeded": "Solo puede cargar un máximo de {count} {fileWord}.",
|
|
32
|
+
"file_upload_files_not_allowed": "Los archivos {extension} no están permitidos.",
|
|
33
|
+
"file_upload_file_size_exceeded": "El tamaño del archivo {fileName} excede {maxSize}.",
|
|
34
|
+
"input_search_press_enter_to_search": "Presione Enter para buscar",
|
|
35
|
+
"input_search_clear_search_input": "Borrar entrada de búsqueda",
|
|
36
|
+
"pagination_go_to_previous_page": "ir a la página anterior",
|
|
37
|
+
"pagination_go_to_page": "ir a la página {page}",
|
|
38
|
+
"pagination_go_to_next_page": "ir a la página siguiente",
|
|
39
|
+
"pagination_info_showing_results": "Mostrando {from} a {to} de {count} resultados",
|
|
40
|
+
"pagination_info_no_results_found": "No se encontraron resultados",
|
|
41
|
+
"table_sort_sort": "ORDENAR",
|
|
42
|
+
"table_sort_clear": "Borrar",
|
|
43
|
+
"table_sort_sort_ascending": "Ordenar ascendente",
|
|
44
|
+
"table_sort_sort_descending": "Ordenar descendente",
|
|
45
|
+
"tabs_pills_aria_label": "Pestañas de píldoras"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import deDE from '@squirrel/locales/de-DE.json';
|
|
1
2
|
import enUS from '@squirrel/locales/en-US.json';
|
|
2
|
-
import
|
|
3
|
+
import esES from '@squirrel/locales/es-ES.json';
|
|
4
|
+
import frFR from '@squirrel/locales/fr-FR.json';
|
|
3
5
|
import { SquirrelPlugin } from '@squirrel/plugin/index';
|
|
4
6
|
import { type App, createApp, nextTick, ref } from 'vue';
|
|
5
7
|
|
|
@@ -56,20 +58,38 @@ describe('SquirrelPlugin', () => {
|
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
it('should merge fr-CA messages when locale is fr-CA', async () => {
|
|
59
|
-
mockI18n = createMockI18n('fr-
|
|
61
|
+
mockI18n = createMockI18n('fr-FR', { 'fr-FR': {} });
|
|
60
62
|
app.use(SquirrelPlugin, mockI18n);
|
|
61
63
|
|
|
62
64
|
await nextTick();
|
|
63
65
|
|
|
64
|
-
expect(mockI18n.global.mergeLocaleMessage).toHaveBeenCalledWith('fr-
|
|
66
|
+
expect(mockI18n.global.mergeLocaleMessage).toHaveBeenCalledWith('fr-FR', frFR);
|
|
65
67
|
});
|
|
66
68
|
|
|
67
|
-
it('should
|
|
69
|
+
it('should merge de-DE messages when locale is de-DE', async () => {
|
|
70
|
+
mockI18n = createMockI18n('de-DE', { 'de-DE': {} });
|
|
71
|
+
app.use(SquirrelPlugin, mockI18n);
|
|
72
|
+
|
|
73
|
+
await nextTick();
|
|
74
|
+
|
|
75
|
+
expect(mockI18n.global.mergeLocaleMessage).toHaveBeenCalledWith('de-DE', deDE);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should merge es-ES messages when locale is es-ES', async () => {
|
|
68
79
|
mockI18n = createMockI18n('es-ES', { 'es-ES': {} });
|
|
69
80
|
app.use(SquirrelPlugin, mockI18n);
|
|
70
81
|
|
|
71
82
|
await nextTick();
|
|
72
83
|
|
|
84
|
+
expect(mockI18n.global.mergeLocaleMessage).toHaveBeenCalledWith('es-ES', esES);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should not merge messages for unsupported locales', async () => {
|
|
88
|
+
mockI18n = createMockI18n('pt-BR', { 'pt-BR': {} });
|
|
89
|
+
app.use(SquirrelPlugin, mockI18n);
|
|
90
|
+
|
|
91
|
+
await nextTick();
|
|
92
|
+
|
|
73
93
|
expect(mockI18n.global.mergeLocaleMessage).not.toHaveBeenCalled();
|
|
74
94
|
});
|
|
75
95
|
|
|
@@ -86,7 +106,7 @@ describe('SquirrelPlugin', () => {
|
|
|
86
106
|
|
|
87
107
|
it('should react to locale changes', async () => {
|
|
88
108
|
// Only have en-US available initially, so watcher doesn't get unwatched
|
|
89
|
-
mockI18n = createMockI18n('en-US', { 'en-US': {}, 'fr-
|
|
109
|
+
mockI18n = createMockI18n('en-US', { 'en-US': {}, 'fr-FR': {} });
|
|
90
110
|
mockI18n.global.availableLocales = ['en-US']; // Only one locale available
|
|
91
111
|
app.use(SquirrelPlugin, mockI18n);
|
|
92
112
|
|
|
@@ -97,17 +117,17 @@ describe('SquirrelPlugin', () => {
|
|
|
97
117
|
mockI18n.global.mergeLocaleMessage.mockClear();
|
|
98
118
|
|
|
99
119
|
// Add fr-CA to available locales and change to it
|
|
100
|
-
mockI18n.global.availableLocales.push('fr-
|
|
101
|
-
mockI18n.global.locale.value = 'fr-
|
|
120
|
+
mockI18n.global.availableLocales.push('fr-FR');
|
|
121
|
+
mockI18n.global.locale.value = 'fr-FR';
|
|
102
122
|
await nextTick();
|
|
103
123
|
|
|
104
|
-
expect(mockI18n.global.mergeLocaleMessage).toHaveBeenCalledWith('fr-
|
|
124
|
+
expect(mockI18n.global.mergeLocaleMessage).toHaveBeenCalledWith('fr-FR', frFR);
|
|
105
125
|
});
|
|
106
126
|
|
|
107
127
|
it('should stop watching when all Squirrel locales are available', async () => {
|
|
108
|
-
// Create mock with
|
|
109
|
-
mockI18n = createMockI18n('en-US', { 'en-US': {}, 'fr-
|
|
110
|
-
mockI18n.global.availableLocales = ['en-US', 'fr-
|
|
128
|
+
// Create mock with all locales available initially
|
|
129
|
+
mockI18n = createMockI18n('en-US', { 'de-DE': {}, 'en-US': {}, 'es-ES': {}, 'fr-FR': {} });
|
|
130
|
+
mockI18n.global.availableLocales = ['de-DE', 'en-US', 'es-ES', 'fr-FR'];
|
|
111
131
|
|
|
112
132
|
app.use(SquirrelPlugin, mockI18n);
|
|
113
133
|
|
|
@@ -120,7 +140,7 @@ describe('SquirrelPlugin', () => {
|
|
|
120
140
|
mockI18n.global.mergeLocaleMessage.mockClear();
|
|
121
141
|
|
|
122
142
|
// Change locale after unwatching should not trigger more merges
|
|
123
|
-
mockI18n.global.locale.value = 'fr-
|
|
143
|
+
mockI18n.global.locale.value = 'fr-FR';
|
|
124
144
|
await nextTick();
|
|
125
145
|
|
|
126
146
|
// Should not merge again since watcher was stopped
|
package/squirrel/plugin/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import deDE from '@squirrel/locales/de-DE.json';
|
|
1
2
|
import enUS from '@squirrel/locales/en-US.json';
|
|
2
|
-
import
|
|
3
|
+
import esES from '@squirrel/locales/es-ES.json';
|
|
4
|
+
import frFR from '@squirrel/locales/fr-FR.json';
|
|
3
5
|
import { type App, nextTick, type Plugin, watchEffect } from 'vue';
|
|
4
6
|
|
|
5
7
|
type I18nInstance = {
|
|
@@ -12,8 +14,10 @@ type I18nInstance = {
|
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
const squirrelMessages = {
|
|
17
|
+
'de-DE': deDE,
|
|
15
18
|
'en-US': enUS,
|
|
16
|
-
'
|
|
19
|
+
'es-ES': esES,
|
|
20
|
+
'fr-FR': frFR,
|
|
17
21
|
} as const;
|
|
18
22
|
|
|
19
23
|
type SquirrelLocale = keyof typeof squirrelMessages;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { getDateFnsLocale } from '@squirrel/utils/dateLocale';
|
|
2
|
-
import { enUS,
|
|
2
|
+
import { de, enUS, es, fr } from 'date-fns/locale';
|
|
3
3
|
|
|
4
4
|
describe('getDateFnsLocale', () => {
|
|
5
5
|
it('should return correct locale for valid codes', () => {
|
|
6
|
-
expect(getDateFnsLocale('
|
|
6
|
+
expect(getDateFnsLocale('de-DE')).toBe(de);
|
|
7
7
|
expect(getDateFnsLocale('en-US')).toBe(enUS);
|
|
8
|
+
expect(getDateFnsLocale('es-ES')).toBe(es);
|
|
9
|
+
expect(getDateFnsLocale('fr-FR')).toBe(fr);
|
|
8
10
|
});
|
|
9
11
|
|
|
10
12
|
it('should return enUS as fallback for invalid locale codes', () => {
|
|
11
|
-
expect(getDateFnsLocale('fr-
|
|
13
|
+
expect(getDateFnsLocale('fr-CA')).toBe(enUS);
|
|
12
14
|
expect(getDateFnsLocale('invalid')).toBe(enUS);
|
|
13
15
|
expect(getDateFnsLocale('')).toBe(enUS);
|
|
14
16
|
});
|
|
15
17
|
|
|
16
18
|
it('should be case-sensitive', () => {
|
|
17
|
-
expect(getDateFnsLocale('
|
|
18
|
-
expect(getDateFnsLocale('
|
|
19
|
+
expect(getDateFnsLocale('DE-DE')).toBe(enUS);
|
|
20
|
+
expect(getDateFnsLocale('de-de')).toBe(enUS);
|
|
21
|
+
expect(getDateFnsLocale('FR-FR')).toBe(enUS);
|
|
22
|
+
expect(getDateFnsLocale('fr-fr')).toBe(enUS);
|
|
19
23
|
});
|
|
20
24
|
});
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import type { Locale } from 'date-fns';
|
|
2
|
+
import { de } from 'date-fns/locale/de';
|
|
2
3
|
import { enUS } from 'date-fns/locale/en-US';
|
|
3
|
-
import {
|
|
4
|
+
import { es } from 'date-fns/locale/es';
|
|
5
|
+
import { fr } from 'date-fns/locale/fr';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Maps vue-i18n locale codes to date-fns Locale objects.
|
|
7
9
|
*
|
|
8
|
-
* @param localeCode - The locale code from vue-i18n (e.g., 'en-US', 'fr-
|
|
10
|
+
* @param localeCode - The locale code from vue-i18n (e.g., 'en-US', 'de-DE', 'es-ES', 'fr-FR')
|
|
9
11
|
* @returns The corresponding date-fns Locale object
|
|
10
12
|
*/
|
|
11
13
|
const localeMap = {
|
|
12
|
-
'
|
|
14
|
+
'de-DE': de,
|
|
13
15
|
'en-US': enUS,
|
|
16
|
+
'es-ES': es,
|
|
17
|
+
'fr-FR': fr,
|
|
14
18
|
} as const;
|
|
15
19
|
|
|
16
20
|
const isValidLocaleCode = (code: string): code is keyof typeof localeMap => code in localeMap;
|
|
File without changes
|