@eturnity/eturnity_reusable_components 8.16.2--EPDM-14330.5 → 8.16.2--EPDM-14330.7

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 (103) hide show
  1. package/package.json +1 -1
  2. package/src/assets/svgIcons/ac_power.svg +4 -0
  3. package/src/assets/svgIcons/arrow_long_left.svg +3 -0
  4. package/src/assets/svgIcons/arrow_long_right.svg +3 -0
  5. package/src/assets/svgIcons/chassis_ground_symbol.svg +27 -0
  6. package/src/assets/svgIcons/dc_power.svg +8 -0
  7. package/src/assets/svgIcons/double_arrow_long.svg +4 -0
  8. package/src/assets/svgIcons/ed_ac.svg +3 -0
  9. package/src/assets/svgIcons/ed_acgrid.svg +4 -0
  10. package/src/assets/svgIcons/ed_arrow_both.svg +7 -0
  11. package/src/assets/svgIcons/ed_arrow_left.svg +7 -0
  12. package/src/assets/svgIcons/ed_arrow_right.svg +7 -0
  13. package/src/assets/svgIcons/ed_battery.svg +10 -0
  14. package/src/assets/svgIcons/ed_batteryacinverter.svg +16 -0
  15. package/src/assets/svgIcons/ed_batteryintegratedinverter.svg +19 -0
  16. package/src/assets/svgIcons/ed_cirquitbreaker.svg +4 -0
  17. package/src/assets/svgIcons/ed_cirquitbreaker_magnetic.svg +6 -0
  18. package/src/assets/svgIcons/ed_cirquitbreaker_thermal.svg +4 -0
  19. package/src/assets/svgIcons/ed_cirquitbreaker_thermal_magnetic.svg +5 -0
  20. package/src/assets/svgIcons/ed_consumption.svg +3 -0
  21. package/src/assets/svgIcons/ed_dc.svg +6 -0
  22. package/src/assets/svgIcons/ed_disconnector.svg +4 -0
  23. package/src/assets/svgIcons/ed_disconnector_fuse.svg +4 -0
  24. package/src/assets/svgIcons/ed_disconnector_fuse_switch.svg +4 -0
  25. package/src/assets/svgIcons/ed_disconnector_loadbreak switch.svg +4 -0
  26. package/src/assets/svgIcons/ed_disconnector_switch.svg +4 -0
  27. package/src/assets/svgIcons/ed_disconnector_switch_auto_release.svg +5 -0
  28. package/src/assets/svgIcons/ed_energymanagement_rectangle.svg +3 -0
  29. package/src/assets/svgIcons/ed_evcharger.svg +19 -0
  30. package/src/assets/svgIcons/ed_flexiblecomponent_circle.svg +3 -0
  31. package/src/assets/svgIcons/ed_flexiblecomponent_square.svg +3 -0
  32. package/src/assets/svgIcons/ed_fuse.svg +3 -0
  33. package/src/assets/svgIcons/ed_ground.svg +5 -0
  34. package/src/assets/svgIcons/ed_heatpump.svg +4 -0
  35. package/src/assets/svgIcons/ed_icon_battery.svg +9 -0
  36. package/src/assets/svgIcons/ed_icon_circle.svg +3 -0
  37. package/src/assets/svgIcons/ed_icon_heatpump.svg +3 -0
  38. package/src/assets/svgIcons/ed_icon_inverter.svg +8 -0
  39. package/src/assets/svgIcons/ed_icon_optimizer.svg +11 -0
  40. package/src/assets/svgIcons/ed_integratedbatteryinverter.svg +10 -0
  41. package/src/assets/svgIcons/ed_inverter-blank.svg +3 -0
  42. package/src/assets/svgIcons/ed_mainsconnection.svg +3 -0
  43. package/src/assets/svgIcons/ed_meter_arrowleft.svg +4 -0
  44. package/src/assets/svgIcons/ed_meter_arrowright.svg +4 -0
  45. package/src/assets/svgIcons/ed_meter_bidirectional.svg +5 -0
  46. package/src/assets/svgIcons/ed_networkandsystemprotection_double.svg +14 -0
  47. package/src/assets/svgIcons/ed_networkandsystemprotection_single.svg +7 -0
  48. package/src/assets/svgIcons/ed_pvpanel.svg +7 -0
  49. package/src/assets/svgIcons/ed_rcd.svg +5 -0
  50. package/src/assets/svgIcons/ed_rcd_simple.svg +3 -0
  51. package/src/assets/svgIcons/ed_spd.svg +6 -0
  52. package/src/assets/svgIcons/ed_stringwithoptimizer.svg +33 -0
  53. package/src/assets/svgIcons/ed_stringwithoutoptimizer.svg +17 -0
  54. package/src/assets/svgIcons/ed_transformer.svg +3 -0
  55. package/src/assets/svgIcons/filter.svg +3 -0
  56. package/src/assets/svgIcons/ground_symbol.svg +28 -0
  57. package/src/assets/svgIcons/move_left.svg +3 -0
  58. package/src/assets/svgIcons/move_right.svg +3 -0
  59. package/src/assets/svgIcons/rectangle.svg +3 -0
  60. package/src/assets/svgIcons/refresh.svg +3 -0
  61. package/src/assets/svgIcons/text_icon.svg +3 -0
  62. package/src/assets/theme.js +17 -1
  63. package/src/components/banner/infoBanner/InfoBanner.spec.js +29 -42
  64. package/src/components/barchart/BottomFields.vue +253 -0
  65. package/src/components/barchart/ChartControls.vue +113 -0
  66. package/src/components/barchart/SelectionBox.vue +150 -0
  67. package/src/components/barchart/composables/index.js +5 -0
  68. package/src/components/barchart/composables/useAxisCalculations.js +104 -0
  69. package/src/components/barchart/composables/useChartData.js +114 -0
  70. package/src/components/barchart/composables/useChartScroll.js +61 -0
  71. package/src/components/barchart/composables/useSelection.js +75 -0
  72. package/src/components/barchart/composables/useTooltip.js +100 -0
  73. package/src/components/barchart/index.vue +385 -0
  74. package/src/components/barchart/styles/bottomFields.js +66 -0
  75. package/src/components/barchart/styles/chart.js +272 -0
  76. package/src/components/barchart/styles/chartControls.js +59 -0
  77. package/src/components/buttons/buttonIcon/index.vue +35 -1
  78. package/src/components/buttons/splitButtons/index.vue +86 -0
  79. package/src/components/collapsableInfoText/index.vue +2 -2
  80. package/src/components/errorMessage/errorMessage.spec.js +34 -0
  81. package/src/components/errorMessage/errorMessage.stories.js +35 -0
  82. package/src/components/filter/filterSettings.vue +2 -0
  83. package/src/components/filterComponent/viewFilter.vue +589 -0
  84. package/src/components/filterComponent/viewSettings.vue +63 -2
  85. package/src/components/filterComponent/viewSort.vue +18 -5
  86. package/src/components/icon/index.vue +32 -9
  87. package/src/components/infoText/index.vue +2 -2
  88. package/src/components/infoText/infoText.spec.js +6 -1
  89. package/src/components/inputs/inputNumber/index.vue +14 -2
  90. package/src/components/inputs/searchInput/index.vue +19 -3
  91. package/src/components/inputs/select/index.vue +108 -19
  92. package/src/components/inputs/select/option/index.vue +5 -0
  93. package/src/components/modals/actionModal/actionModal.spec.js +52 -0
  94. package/src/components/modals/actionModal/actionModal.stories.js +53 -0
  95. package/src/components/modals/actionModal/index.vue +6 -6
  96. package/src/components/modals/infoModal/index.vue +49 -19
  97. package/src/components/modals/infoModal/infoModal.spec.js +55 -0
  98. package/src/components/modals/infoModal/infoModal.stories.js +47 -0
  99. package/src/components/modals/modal/index.vue +16 -5
  100. package/src/components/pageSubtitle/PageSubtitle.stories.js +0 -1
  101. package/src/helpers/isObjectEqual.js +22 -0
  102. package/src/helpers/translateLang.js +95 -24
  103. package/src/main.js +1 -0
@@ -0,0 +1,53 @@
1
+ import ActionModal from './index.vue'
2
+
3
+ export default {
4
+ title: 'Components/ActionModal',
5
+ component: ActionModal,
6
+ tags: ['autodocs'],
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ }
11
+
12
+ // import ActionModal from "@eturnity/eturnity_reusable_components/src/components/modals/ActionModal"
13
+ // This is a reusable modal component that can be used to display information to the user.
14
+ // To use:
15
+ // <ActionModal :isOpen="isOpen" @on-close="$emit('on-close-summary')" >
16
+ // <template #title>
17
+ // <h1>Header</h1>
18
+ // </template>
19
+ // <template #body>
20
+ // <p>Body</p>
21
+ // </template>
22
+ // <template #buttons>
23
+ // <button @click="closeModal">Close</button>
24
+ // </template>
25
+ // </ActionModal>
26
+
27
+ export const Default = {
28
+ args: {
29
+ isOpen: true,
30
+ },
31
+ render: (args) => ({
32
+ components: { ActionModal },
33
+ setup() {
34
+ return { args }
35
+ },
36
+ template: `
37
+ <ActionModal v-bind="args">
38
+ <template #title>Sample title</template>
39
+ <template #body>
40
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt commodo mollis. Fusce urna felis,
41
+ malesuada sed elementum et, fermentum ac massa. Integer in massa vel orci fermentum bibendum in ut ante.
42
+ Donec risus risus, luctus quis ex a, pulvinar placerat lacus. Sed pharetra augue a elit volutpat, eu dignissim
43
+ ex pretium. Aenean imperdiet, nulla in pharetra rutrum, mauris mauris tincidunt tellus, non tempus quam lorem
44
+ laoreet lectus.
45
+ </template>
46
+ <template #buttons>
47
+ <button @click="saveAction">Save</button>
48
+ <button @click="closeAction">Close</button>
49
+ </template>
50
+ </ActionModal>
51
+ `,
52
+ }),
53
+ }
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <Modal :is-open="isOpen" @on-close="closeModal">
2
+ <Modal data-test-id="actionModal" :is-open="isOpen" @on-close="closeModal">
3
3
  <ModalContainer>
4
- <ModalTitle v-if="$slots.title">
4
+ <ModalTitle v-if="$slots.title" data-test-id="modal_title">
5
5
  <slot name="title"></slot>
6
6
  </ModalTitle>
7
- <TextContainer v-if="$slots.body">
7
+ <TextContainer v-if="$slots.body" data-test-id="modal_body">
8
8
  <slot name="body"></slot>
9
9
  </TextContainer>
10
- <ButtonContainer v-if="$slots.buttons">
10
+ <ButtonContainer v-if="$slots.buttons" data-test-id="modal_buttons">
11
11
  <slot name="buttons"></slot>
12
12
  </ButtonContainer>
13
13
  </ModalContainer>
@@ -23,7 +23,7 @@
23
23
  `
24
24
  const ModalTitle = styled.div`
25
25
  color: ${(props) => props.theme.colors.black};
26
- font-family: ${(props) => props.theme.fonts.mainFont};
26
+ font-family: inherit;
27
27
  font-size: 18px;
28
28
  font-style: normal;
29
29
  font-weight: 700;
@@ -37,7 +37,7 @@
37
37
  `
38
38
  const TextContainer = styled.div`
39
39
  color: ${(props) => props.theme.colors.black};
40
- font-family: ${(props) => props.theme.fonts.mainFont};
40
+ font-family: inherit;
41
41
  font-size: 13px;
42
42
  font-style: normal;
43
43
  font-weight: 400;
@@ -1,48 +1,78 @@
1
1
  <template>
2
- <ActionModal :is-open="isOpen" @on-close="closeModal">
2
+ <RCModal data-test-id="infoModal" :is-open="isOpen" @on-close="closeModal">
3
3
  <ModalContainer>
4
- <template #title>
4
+ <ModalTitle v-if="$slots.title" data-test-id="modal_title">
5
5
  <slot name="title"></slot>
6
- </template>
7
- <template #body>
6
+ </ModalTitle>
7
+ <TextContainer v-if="$slots.body" data-test-id="modal_body">
8
8
  <slot name="body"></slot>
9
- </template>
10
- <template #buttons>
11
- <ButtonContainer>
12
- <RCMainButton
13
- min-width="150px"
14
- :text="$gettext('Got it')"
15
- type="primary"
16
- @click="closeModal"
17
- />
18
- </ButtonContainer>
19
- </template>
9
+ </TextContainer>
10
+ <ButtonContainer>
11
+ <RCMainButton
12
+ min-width="150px"
13
+ :text="buttonText"
14
+ type="primary"
15
+ @click="closeModal"
16
+ />
17
+ </ButtonContainer>
20
18
  </ModalContainer>
21
- </ActionModal>
19
+ </RCModal>
22
20
  </template>
23
21
  <script>
24
22
  import styled from 'vue3-styled-components'
25
- import ActionModal from '../actionModal'
23
+ import RCModal from '../modal'
26
24
  import RCMainButton from '../../buttons/mainButton'
25
+
27
26
  const ModalContainer = styled.div`
28
27
  width: 450px;
29
28
  min-height: 205px;
30
29
  padding: 40px 40px 30px 40px;
31
30
  `
31
+ const ModalTitle = styled.div`
32
+ color: ${(props) => props.theme.colors.black};
33
+ font-family: inherit;
34
+ font-size: 18px;
35
+ font-style: normal;
36
+ font-weight: 700;
37
+ line-height: 120%;
38
+ text-transform: uppercase;
39
+ `
32
40
  const ButtonContainer = styled.div`
33
41
  display: inline-flex;
34
42
  align-items: flex-start;
35
43
  gap: 20px;
36
44
  `
45
+ const TextContainer = styled.div`
46
+ color: ${(props) => props.theme.colors.black};
47
+ font-family: inherit;
48
+ font-size: 13px;
49
+ font-style: normal;
50
+ font-weight: 400;
51
+ line-height: normal;
52
+ padding: 30px 0px;
53
+ white-space: pre-wrap;
54
+ `
55
+
37
56
  export default {
38
57
  name: 'InfoModal',
39
58
  components: {
59
+ RCModal,
40
60
  ModalContainer,
61
+ ModalTitle,
41
62
  ButtonContainer,
42
- ActionModal,
63
+ TextContainer,
43
64
  RCMainButton,
44
65
  },
45
- props: ['isOpen'],
66
+ props: {
67
+ isOpen: {
68
+ type: Boolean,
69
+ required: true,
70
+ },
71
+ buttonText: {
72
+ type: String,
73
+ default: 'Got it',
74
+ },
75
+ },
46
76
  methods: {
47
77
  closeModal() {
48
78
  this.$emit('on-close')
@@ -0,0 +1,55 @@
1
+ /* eslint-disable */
2
+ import { mount } from '@vue/test-utils'
3
+ import InfoModal from '@/components/modals/infoModal'
4
+ import theme from '@/assets/theme'
5
+
6
+ jest.mock('@/components/icon/iconCache.mjs', () => ({
7
+ // need to mock this due to how jest handles import.meta
8
+ fetchIcon: jest.fn(() => Promise.resolve('')),
9
+ }))
10
+
11
+
12
+ describe('InfoModal Component', () => {
13
+ let wrapper
14
+
15
+ beforeEach(() => {
16
+ wrapper = mount(InfoModal, {
17
+ props: {
18
+ isOpen: true,
19
+ buttonText: 'Close',
20
+ },
21
+ slots: {
22
+ title: 'Sample title',
23
+ body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt commodo mollis. Fusce urna felis, malesuada sed elementum et, fermentum ac massa. Integer in massa vel orci fermentum bibendum in ut ante. Donec risus risus, luctus quis ex a, pulvinar placerat lacus. Sed pharetra augue a elit volutpat, eu dignissim ex pretium. Aenean imperdiet, nulla in pharetra rutrum, mauris mauris tincidunt tellus, non tempus quam lorem laoreet lectus.',
24
+ },
25
+ global: {
26
+ provide: {
27
+ theme,
28
+ },
29
+ },
30
+ })
31
+ })
32
+
33
+ test('renders InfoModal component with default props', () => {
34
+ expect(wrapper.find('[data-test-id="infoModal"]').exists()).toBe(true)
35
+
36
+ expect(wrapper.vm.isOpen).toBe(true)
37
+ expect(wrapper.vm.buttonText).toContain('Close')
38
+ })
39
+
40
+ test('info modal slots is display when user passed slots content', () => {
41
+ const modalTitleEl = wrapper.find('[data-test-id="modal_title"]')
42
+ expect(modalTitleEl.text()).toBe('Sample title')
43
+
44
+ const modalBodyEl = wrapper.find('[data-test-id="modal_body"]')
45
+ expect(modalBodyEl.text()).toContain('Lorem ipsum dolor sit amet')
46
+ })
47
+
48
+ test('info modal on-close event is emitted when modal close button is clicked', async () => {
49
+ const modalCloseButton = wrapper.find('.close')
50
+
51
+ modalCloseButton.trigger('click')
52
+ await wrapper.vm.$nextTick()
53
+ expect(wrapper.emitted('on-close')).toBeTruthy()
54
+ })
55
+ })
@@ -0,0 +1,47 @@
1
+ import InfoModal from './index.vue'
2
+
3
+ export default {
4
+ title: 'Components/InfoModal',
5
+ component: InfoModal,
6
+ tags: ['autodocs'],
7
+ parameters: {
8
+ layout: 'centered',
9
+ },
10
+ }
11
+
12
+ // import InfoModal from "@eturnity/eturnity_reusable_components/src/components/modals/infoModal"
13
+ // This is a reusable modal component that can be used to display information to the user.
14
+ // To use:
15
+ // <InfoModal :isOpen="isOpen" @on-close="$emit('on-close-summary')" >
16
+ // <template #title>
17
+ // <h1>Header</h1>
18
+ // </template>
19
+ // <template #body>
20
+ // <p>Body</p>
21
+ // </template>
22
+ // </InfoModal>
23
+
24
+ export const Default = {
25
+ args: {
26
+ isOpen: true,
27
+ buttonText: 'Close',
28
+ },
29
+ render: (args) => ({
30
+ components: { InfoModal },
31
+ setup() {
32
+ return { args }
33
+ },
34
+ template: `
35
+ <InfoModal v-bind="args">
36
+ <template #title>Sample title</template>
37
+ <template #body>
38
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt commodo mollis. Fusce urna felis,
39
+ malesuada sed elementum et, fermentum ac massa. Integer in massa vel orci fermentum bibendum in ut ante.
40
+ Donec risus risus, luctus quis ex a, pulvinar placerat lacus. Sed pharetra augue a elit volutpat, eu dignissim
41
+ ex pretium. Aenean imperdiet, nulla in pharetra rutrum, mauris mauris tincidunt tellus, non tempus quam lorem
42
+ laoreet lectus.
43
+ </template>
44
+ </InfoModal>
45
+ `,
46
+ }),
47
+ }
@@ -1,8 +1,10 @@
1
1
  <template>
2
2
  <PageWrapper
3
3
  v-if="isOpen"
4
+ ref="modalRef"
4
5
  :add-padding-top="addPaddingTop"
5
6
  :backdrop="backdrop"
7
+ class="rc-modal-wrapper"
6
8
  :is-open="isOpen"
7
9
  :position="position"
8
10
  >
@@ -36,6 +38,7 @@
36
38
  // <div>Data....</div>
37
39
  // </modal>
38
40
 
41
+ import { ref, provide } from 'vue'
39
42
  import styled from 'vue3-styled-components'
40
43
  import CloseButton from '../../buttons/closeButton'
41
44
  import Spinner from '../../spinner'
@@ -58,14 +61,14 @@
58
61
  props.backdrop == 'dark'
59
62
  ? 'rgba(0, 0, 0, 0.4)'
60
63
  : 'rgba(255, 255, 255, 0.9)'};
61
- z-index: 99999;
64
+ z-index: 9999999;
62
65
  overflow: auto;
63
66
  padding-top: ${(props) => (props.addPaddingTop ? '80px' : '0')};
64
67
 
65
- @media (max-width: 425px) {
66
- background: white;
67
- }
68
- `
68
+ @media (max-width: 425px) {
69
+ background: white;
70
+ }
71
+ `
69
72
 
70
73
  const modalContainerAttrs = { overflow: String, isLoading: Boolean }
71
74
  const ModalContainer = styled('div', modalContainerAttrs)`
@@ -163,6 +166,14 @@
163
166
  default: false,
164
167
  },
165
168
  },
169
+ setup() {
170
+ const modalRef = ref(null)
171
+ provide('modalRef', modalRef)
172
+
173
+ return {
174
+ modalRef,
175
+ }
176
+ },
166
177
  watch: {
167
178
  isOpen: {
168
179
  immediate: true,
@@ -16,7 +16,6 @@ export default {
16
16
  description: 'Text for tooltip',
17
17
  },
18
18
  },
19
- tags: ['autodocs'],
20
19
  }
21
20
 
22
21
  // To use:
@@ -0,0 +1,22 @@
1
+ import { toRaw } from 'vue'
2
+
3
+ export default function isObjectEqual(obj1, obj2) {
4
+ obj1 = toRaw(obj1)
5
+ obj2 = toRaw(obj2)
6
+ if (obj1 === obj2) return true
7
+ if (obj1 === null || obj2 === null) return false
8
+ if (typeof obj1 !== 'object' || typeof obj2 !== 'object') return false
9
+
10
+ const isArray1 = Array.isArray(obj1)
11
+ const isArray2 = Array.isArray(obj2)
12
+ if (isArray1 !== isArray2) return false
13
+
14
+ const keys1 = Object.keys(obj1)
15
+ if (keys1.length !== Object.keys(obj2).length) return false
16
+
17
+ return keys1.every(
18
+ (key) =>
19
+ Object.prototype.hasOwnProperty.call(obj2, key) &&
20
+ isObjectEqual(obj1[key], obj2[key])
21
+ )
22
+ }
@@ -1,3 +1,21 @@
1
+ import {
2
+ enUS,
3
+ enGB,
4
+ de,
5
+ fr,
6
+ it,
7
+ es,
8
+ da,
9
+ pl,
10
+ sv,
11
+ nb,
12
+ nl,
13
+ cs,
14
+ fi,
15
+ pt,
16
+ ca,
17
+ } from 'date-fns/locale'
18
+
1
19
  export const translateLang = (lang) => {
2
20
  // this is needed so that we use the correct keys for Phrase
3
21
  if (lang === 'en') {
@@ -55,30 +73,83 @@ export const translateLang = (lang) => {
55
73
  }
56
74
  }
57
75
 
76
+ export const getDateFormat = (lang) => {
77
+ const formatMap = {
78
+ 'en-us': 'MM/dd/yyyy',
79
+ 'en-gb': 'dd/MM/yyyy',
80
+ en: 'MM/dd/yyyy',
81
+ 'de-de': 'dd.MM.yyyy',
82
+ 'de-at': 'dd.MM.yyyy',
83
+ 'de-ch': 'dd.MM.yyyy',
84
+ 'de-lu': 'dd.MM.yyyy',
85
+ 'de-be': 'dd.MM.yyyy',
86
+ de: 'dd.MM.yyyy',
87
+ 'fr-fr': 'dd/MM/yyyy',
88
+ 'fr-be': 'dd/MM/yyyy',
89
+ 'fr-lu': 'dd/MM/yyyy',
90
+ 'fr-ch': 'dd/MM/yyyy',
91
+ fr: 'dd/MM/yyyy',
92
+ 'it-it': 'dd/MM/yyyy',
93
+ 'it-ch': 'dd/MM/yyyy',
94
+ it: 'dd/MM/yyyy',
95
+ 'da-dk': 'dd.MM.yyyy',
96
+ 'pl-pl': 'dd.MM.yyyy',
97
+ 'sv-se': 'yyyy-MM-dd',
98
+ 'no-no': 'dd.MM.yyyy',
99
+ 'nb-no': 'dd.MM.yyyy',
100
+ 'nl-nl': 'dd-MM-yyyy',
101
+ 'nl-be': 'dd-MM-yyyy',
102
+ cs: 'dd.MM.yyyy',
103
+ 'fi-fi': 'dd.MM.yyyy',
104
+ 'pt-pt': 'dd/MM/yyyy',
105
+ 'es-es': 'dd/MM/yyyy',
106
+ 'ca-es': 'dd/MM/yyyy',
107
+ }
108
+
109
+ return formatMap[lang.toLowerCase()] || 'MM/dd/yyyy' // Fallback to en-US format
110
+ }
111
+
58
112
  export const datePickerLang = (lang) => {
59
- if (
60
- lang === 'de-de' ||
61
- lang === 'de-ch' ||
62
- lang === 'de-lu' ||
63
- lang === 'de-be'
64
- ) {
65
- return 'de'
66
- } else if (
67
- lang === 'fr-fr' ||
68
- lang === 'fr-ch' ||
69
- lang === 'fr-lu' ||
70
- lang === 'fr-be'
71
- ) {
72
- return 'fr'
73
- } else if (lang === 'it-it' || lang === 'it-ch') {
74
- return 'it'
75
- } else if (lang === 'en-us' || lang === 'en-gb') {
76
- return 'en'
77
- } else if (lang === 'es-es' || lang === 'ca-es' || lang === 'pt-pt') {
78
- return 'es'
79
- } else {
80
- return lang
113
+ const localeMap = {
114
+ 'en-us': enUS,
115
+ 'en-gb': enGB,
116
+ en: enUS,
117
+ 'de-de': de,
118
+ 'de-at': de,
119
+ 'de-ch': de,
120
+ 'de-lu': de,
121
+ 'de-be': de,
122
+ de: de,
123
+ 'fr-fr': fr,
124
+ 'fr-be': fr,
125
+ 'fr-lu': fr,
126
+ 'fr-ch': fr,
127
+ fr: fr,
128
+ 'it-it': it,
129
+ 'it-ch': it,
130
+ it: it,
131
+ 'da-dk': da,
132
+ 'pl-pl': pl,
133
+ 'sv-se': sv,
134
+ 'no-no': nb,
135
+ 'nb-no': nb,
136
+ 'nl-nl': nl,
137
+ 'nl-be': nl,
138
+ cs: cs,
139
+ 'fi-fi': fi,
140
+ 'pt-pt': pt,
141
+ 'es-es': es,
142
+ 'ca-es': ca,
143
+ }
144
+
145
+ const normalizedLang = lang ? lang.toLowerCase() : 'en-us'
146
+ const locale = localeMap[normalizedLang] || enUS
147
+ if (!localeMap[normalizedLang]) {
148
+ console.warn(
149
+ `Unsupported language for datePickerLang: ${lang}, falling back to enUS`
150
+ )
81
151
  }
152
+ return locale
82
153
  }
83
154
 
84
155
  export const tinyLanguage = (lang) => {
@@ -123,6 +194,6 @@ export const langForLocaleString = () => {
123
194
  : localStorage.getItem('lang') === 'ca-es'
124
195
  ? 'es-es'
125
196
  : localStorage.getItem('lang')
126
- : 'en-US'
127
- return selectedLang !== 'null' ? selectedLang : 'en-US'
197
+ : 'en-us'
198
+ return selectedLang !== 'null' ? selectedLang : 'en-us'
128
199
  }
package/src/main.js CHANGED
@@ -3,5 +3,6 @@ import { createApp } from 'vue'
3
3
  import router from './router/dynamicRoutes'
4
4
 
5
5
  const app = createApp(App)
6
+
6
7
  app.use(router)
7
8
  app.mount('#app')