bfg-common 1.4.365 → 1.4.367

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 (42) hide show
  1. package/assets/img/icons/icons-sprite-dark-1.svg +407 -407
  2. package/assets/img/icons/icons-sprite-dark-2.svg +343 -343
  3. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  4. package/assets/img/icons/icons-sprite-dark-4.svg +255 -255
  5. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  6. package/assets/img/icons/icons-sprite-dark-6.svg +94 -94
  7. package/assets/img/icons/icons-sprite-light-1.svg +407 -407
  8. package/assets/img/icons/icons-sprite-light-2.svg +343 -343
  9. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  10. package/assets/img/icons/icons-sprite-light-4.svg +255 -255
  11. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  12. package/assets/img/icons/icons-sprite-light-6.svg +94 -94
  13. package/assets/localization/local_en.json +1 -1
  14. package/components/atoms/TheIcon3.vue +50 -50
  15. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  16. package/components/atoms/stack/StackBlock.vue +185 -185
  17. package/components/common/context/lib/models/interfaces.ts +30 -30
  18. package/components/common/context/recursion/Recursion.vue +86 -86
  19. package/components/common/context/recursion/RecursionNew.vue +199 -199
  20. package/components/common/context/recursion/RecursionOld.vue +213 -213
  21. package/components/common/modals/confirmation/Confirmation.vue +65 -65
  22. package/components/common/vm/actions/add/Add.vue +617 -617
  23. package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
  24. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +2 -2
  25. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/lib/config/options.ts +20 -20
  26. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +403 -403
  27. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Hv.vue +99 -99
  28. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/{location/Location.vue → Location.vue} +173 -172
  29. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +2 -2
  30. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +201 -201
  31. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +85 -85
  32. package/components/common/vm/actions/common/select/storage/Storage.vue +198 -202
  33. package/components/common/vm/actions/editSettings/EditSettings.vue +1 -1
  34. package/composables/productNameLocal.ts +30 -30
  35. package/package.json +1 -1
  36. package/plugins/date.ts +181 -181
  37. package/plugins/recursion.ts +311 -311
  38. package/public/spice-console/lib/images/bitmap.js +203 -203
  39. package/public/spice-console/network/spicechannel.js +383 -383
  40. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/StorageModalOld.vue +0 -52
  41. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/storageModalNew/StorageModalNew.vue +0 -175
  42. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/storageModalNew/lib/config/table.ts +0 -167
package/plugins/date.ts CHANGED
@@ -1,181 +1,181 @@
1
- import { defineNuxtPlugin } from '#app'
2
- import { format } from 'date-fns'
3
- import * as localizations from 'date-fns/locale'
4
- import type { UI_T_DateFormat } from '~/lib/models/plugins/date/types'
5
- import type { UI_I_Dateformat } from '~/lib/models/plugins/date/interfaces'
6
-
7
- export default defineNuxtPlugin(() => {
8
- // Проверяем переданое является датой
9
- const isDate = (date: string | number) => {
10
- return new Date(date).toString() !== 'Invalid Date'
11
- }
12
-
13
- // Проверяем формат времени браузера равно 24h
14
- const isBrowserLocale24h = () =>
15
- !new Intl.DateTimeFormat(undefined, { hour: 'numeric' })
16
- .format(0)
17
- .match(/AM/)
18
-
19
- // Получаем переводы для даты
20
- const getDateLocalization = (lang?: string) => {
21
- const currentLanguage = lang || useLocalStorage('lang') || 'en_US'
22
- const { be, enUS, hy, kk, ru, zhCN } = localizations
23
- let localization
24
-
25
- switch (currentLanguage) {
26
- case 'be_BY':
27
- localization = be
28
- break
29
- case 'en_US':
30
- localization = enUS
31
- break
32
- case 'hy_AM':
33
- localization = hy
34
- break
35
- case 'kk_KZ':
36
- localization = kk
37
- break
38
- case 'ru_RU':
39
- localization = ru
40
- break
41
- case 'zh_CHS':
42
- localization = zhCN
43
- break
44
- }
45
-
46
- return localization
47
- }
48
-
49
- // Получаем формат даты
50
- const getDateFormat = (lang?: string): UI_T_DateFormat => {
51
- const currentLanguage = lang || useLocalStorage('lang') || 'en_US'
52
- const dateFormats: UI_I_Dateformat = {
53
- be_BY: 'yyyy-MM-dd',
54
- en_US: 'MM-dd-yyyy',
55
- hy_AM: 'yyyy-MM-dd',
56
- kk_KZ: 'dd/MM/yyyy',
57
- ru_RU: 'dd/MM/yyyy',
58
- zh_CHS: 'yyyy-MM-dd',
59
- }
60
-
61
- const dateFormat = ref(dateFormats[currentLanguage])
62
-
63
- window.addEventListener('timeFormatStorageChanged', function handler() {
64
- dateFormat.value = dateFormats[lang || useLocalStorage('lang') || 'en_US'] // TODO нужно проверить когда будем работать без useLocalStorage
65
-
66
- window.removeEventListener('timeFormatStorageChanged', handler)
67
- })
68
-
69
- return dateFormat.value
70
- }
71
-
72
- // Получаем формат времени
73
- const getTimeFormat = (hasSeconds: boolean, timeFormat?: string) => {
74
- let appTimeFormat = timeFormat || useLocalStorage('timeFormat') || 'DEFAULT'
75
- let timeFormatLocal = ''
76
-
77
- if (appTimeFormat === 'DEFAULT') {
78
- const isBrowserTimeFormat24 = isBrowserLocale24h()
79
-
80
- appTimeFormat = isBrowserTimeFormat24 ? '24H' : appTimeFormat
81
- }
82
-
83
- if (appTimeFormat === '24H') {
84
- timeFormatLocal = 'HH:mm'
85
- } else {
86
- timeFormatLocal = 'h:mm aa'
87
- }
88
-
89
- hasSeconds && (timeFormatLocal = timeFormatLocal.replace(':mm', ':mm:ss'))
90
-
91
- return timeFormatLocal
92
- }
93
-
94
- // Форматирование даты из английского в стандартный
95
- const enFormatToStandardFormat = (date: string): string => {
96
- const splitDate = date.split('-')
97
- return [splitDate[2], splitDate[0], splitDate[1]].join('/')
98
- }
99
- const getUnixByDate = (dateTime: string, lang?: string): number => {
100
- const currentFormat: UI_T_DateFormat = getDateFormat(lang)
101
-
102
- const [date, time] = dateTime.split(' ')
103
-
104
- let standardDate = ''
105
- switch (currentFormat) {
106
- case 'dd/MM/yyyy':
107
- standardDate = date.split('/').reverse().join('/')
108
- break
109
- case 'yyyy-MM-dd':
110
- standardDate = date.replaceAll('-', '/')
111
- break
112
- case 'MM-dd-yyyy':
113
- standardDate = enFormatToStandardFormat(date)
114
- break
115
- }
116
-
117
- const standard = time ? standardDate + ' ' + time : standardDate
118
- return new Date(standard).getTime()
119
- }
120
-
121
- // Форматирование даты без временим
122
- const formattedDate = (
123
- date: number | string | Date,
124
- formatDate = '',
125
- lang?: string
126
- ) => {
127
- const formatDateLocal = formatDate || getDateFormat(lang)
128
-
129
- return format(new Date(date), formatDateLocal, {
130
- locale: getDateLocalization(lang),
131
- })
132
- }
133
- // Форматирование временим
134
- const formattedTime = (
135
- date: number | string | Date,
136
- formatDate = '',
137
- hasSeconds = false,
138
- timeFormat?: string
139
- ) => {
140
- const formatDateLocal = formatDate || getTimeFormat(hasSeconds, timeFormat)
141
-
142
- return format(new Date(date), formatDateLocal)
143
- }
144
-
145
- // Форматирование даты с временим
146
- const formattedDatetime = (
147
- date: number | string | Date,
148
- formatDate = '',
149
- hasSeconds = false,
150
- lang?: string,
151
- timeFormat?: string
152
- ) => {
153
- const formatDateLocal = ref(formatDate || getDateFormat(lang))
154
- const formatDatetime = ref(
155
- formatDateLocal.value + ' ' + getTimeFormat(hasSeconds, timeFormat)
156
- )
157
-
158
- window.addEventListener('timeFormatStorageChanged', function handler() {
159
- formatDatetime.value =
160
- formatDateLocal.value + ' ' + getTimeFormat(hasSeconds, timeFormat)
161
-
162
- window.removeEventListener('timeFormatStorageChanged', handler)
163
- })
164
-
165
- return format(new Date(date), formatDatetime.value, {
166
- locale: getDateLocalization(lang),
167
- })
168
- }
169
-
170
- return {
171
- provide: {
172
- isDate,
173
- getTimeFormat,
174
- getDateFormat,
175
- formattedTime,
176
- formattedDate,
177
- formattedDatetime,
178
- getUnixByDate,
179
- },
180
- }
181
- })
1
+ import { defineNuxtPlugin } from '#app'
2
+ import { format } from 'date-fns'
3
+ import * as localizations from 'date-fns/locale'
4
+ import type { UI_T_DateFormat } from '~/lib/models/plugins/date/types'
5
+ import type { UI_I_Dateformat } from '~/lib/models/plugins/date/interfaces'
6
+
7
+ export default defineNuxtPlugin(() => {
8
+ // Проверяем переданое является датой
9
+ const isDate = (date: string | number) => {
10
+ return new Date(date).toString() !== 'Invalid Date'
11
+ }
12
+
13
+ // Проверяем формат времени браузера равно 24h
14
+ const isBrowserLocale24h = () =>
15
+ !new Intl.DateTimeFormat(undefined, { hour: 'numeric' })
16
+ .format(0)
17
+ .match(/AM/)
18
+
19
+ // Получаем переводы для даты
20
+ const getDateLocalization = (lang?: string) => {
21
+ const currentLanguage = lang || useLocalStorage('lang') || 'en_US'
22
+ const { be, enUS, hy, kk, ru, zhCN } = localizations
23
+ let localization
24
+
25
+ switch (currentLanguage) {
26
+ case 'be_BY':
27
+ localization = be
28
+ break
29
+ case 'en_US':
30
+ localization = enUS
31
+ break
32
+ case 'hy_AM':
33
+ localization = hy
34
+ break
35
+ case 'kk_KZ':
36
+ localization = kk
37
+ break
38
+ case 'ru_RU':
39
+ localization = ru
40
+ break
41
+ case 'zh_CHS':
42
+ localization = zhCN
43
+ break
44
+ }
45
+
46
+ return localization
47
+ }
48
+
49
+ // Получаем формат даты
50
+ const getDateFormat = (lang?: string): UI_T_DateFormat => {
51
+ const currentLanguage = lang || useLocalStorage('lang') || 'en_US'
52
+ const dateFormats: UI_I_Dateformat = {
53
+ be_BY: 'yyyy-MM-dd',
54
+ en_US: 'MM-dd-yyyy',
55
+ hy_AM: 'yyyy-MM-dd',
56
+ kk_KZ: 'dd/MM/yyyy',
57
+ ru_RU: 'dd/MM/yyyy',
58
+ zh_CHS: 'yyyy-MM-dd',
59
+ }
60
+
61
+ const dateFormat = ref(dateFormats[currentLanguage])
62
+
63
+ window.addEventListener('timeFormatStorageChanged', function handler() {
64
+ dateFormat.value = dateFormats[lang || useLocalStorage('lang') || 'en_US'] // TODO нужно проверить когда будем работать без useLocalStorage
65
+
66
+ window.removeEventListener('timeFormatStorageChanged', handler)
67
+ })
68
+
69
+ return dateFormat.value
70
+ }
71
+
72
+ // Получаем формат времени
73
+ const getTimeFormat = (hasSeconds: boolean, timeFormat?: string) => {
74
+ let appTimeFormat = timeFormat || useLocalStorage('timeFormat') || 'DEFAULT'
75
+ let timeFormatLocal = ''
76
+
77
+ if (appTimeFormat === 'DEFAULT') {
78
+ const isBrowserTimeFormat24 = isBrowserLocale24h()
79
+
80
+ appTimeFormat = isBrowserTimeFormat24 ? '24H' : appTimeFormat
81
+ }
82
+
83
+ if (appTimeFormat === '24H') {
84
+ timeFormatLocal = 'HH:mm'
85
+ } else {
86
+ timeFormatLocal = 'h:mm aa'
87
+ }
88
+
89
+ hasSeconds && (timeFormatLocal = timeFormatLocal.replace(':mm', ':mm:ss'))
90
+
91
+ return timeFormatLocal
92
+ }
93
+
94
+ // Форматирование даты из английского в стандартный
95
+ const enFormatToStandardFormat = (date: string): string => {
96
+ const splitDate = date.split('-')
97
+ return [splitDate[2], splitDate[0], splitDate[1]].join('/')
98
+ }
99
+ const getUnixByDate = (dateTime: string, lang?: string): number => {
100
+ const currentFormat: UI_T_DateFormat = getDateFormat(lang)
101
+
102
+ const [date, time] = dateTime.split(' ')
103
+
104
+ let standardDate = ''
105
+ switch (currentFormat) {
106
+ case 'dd/MM/yyyy':
107
+ standardDate = date.split('/').reverse().join('/')
108
+ break
109
+ case 'yyyy-MM-dd':
110
+ standardDate = date.replaceAll('-', '/')
111
+ break
112
+ case 'MM-dd-yyyy':
113
+ standardDate = enFormatToStandardFormat(date)
114
+ break
115
+ }
116
+
117
+ const standard = time ? standardDate + ' ' + time : standardDate
118
+ return new Date(standard).getTime()
119
+ }
120
+
121
+ // Форматирование даты без временим
122
+ const formattedDate = (
123
+ date: number | string | Date,
124
+ formatDate = '',
125
+ lang?: string
126
+ ) => {
127
+ const formatDateLocal = formatDate || getDateFormat(lang)
128
+
129
+ return format(new Date(date), formatDateLocal, {
130
+ locale: getDateLocalization(lang),
131
+ })
132
+ }
133
+ // Форматирование временим
134
+ const formattedTime = (
135
+ date: number | string | Date,
136
+ formatDate = '',
137
+ hasSeconds = false,
138
+ timeFormat?: string
139
+ ) => {
140
+ const formatDateLocal = formatDate || getTimeFormat(hasSeconds, timeFormat)
141
+
142
+ return format(new Date(date), formatDateLocal)
143
+ }
144
+
145
+ // Форматирование даты с временим
146
+ const formattedDatetime = (
147
+ date: number | string | Date,
148
+ formatDate = '',
149
+ hasSeconds = false,
150
+ lang?: string,
151
+ timeFormat?: string
152
+ ) => {
153
+ const formatDateLocal = ref(formatDate || getDateFormat(lang))
154
+ const formatDatetime = ref(
155
+ formatDateLocal.value + ' ' + getTimeFormat(hasSeconds, timeFormat)
156
+ )
157
+
158
+ window.addEventListener('timeFormatStorageChanged', function handler() {
159
+ formatDatetime.value =
160
+ formatDateLocal.value + ' ' + getTimeFormat(hasSeconds, timeFormat)
161
+
162
+ window.removeEventListener('timeFormatStorageChanged', handler)
163
+ })
164
+
165
+ return format(new Date(date), formatDatetime.value, {
166
+ locale: getDateLocalization(lang),
167
+ })
168
+ }
169
+
170
+ return {
171
+ provide: {
172
+ isDate,
173
+ getTimeFormat,
174
+ getDateFormat,
175
+ formattedTime,
176
+ formattedDate,
177
+ formattedDatetime,
178
+ getUnixByDate,
179
+ },
180
+ }
181
+ })