bfg-common 1.4.247 → 1.4.248

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 (37) 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 +83 -83
  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 +83 -83
  13. package/components/atoms/TheIcon3.vue +50 -50
  14. package/components/atoms/modal/bySteps/BySteps.vue +253 -253
  15. package/components/atoms/stack/StackBlock.vue +185 -185
  16. package/components/common/browse/blocks/Title.vue +91 -91
  17. package/components/common/browse/blocks/info/Date.vue +21 -21
  18. package/components/common/context/lib/models/interfaces.ts +30 -30
  19. package/components/common/context/recursion/Recursion.vue +86 -86
  20. package/components/common/context/recursion/RecursionNew.vue +199 -199
  21. package/components/common/context/recursion/RecursionOld.vue +213 -213
  22. package/components/common/diagramMain/network/Contents.vue +16 -8
  23. package/components/common/vm/actions/add/Add.vue +617 -617
  24. package/components/common/vm/actions/clone/lib/config/steps.ts +129 -129
  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/vmoptions/bootOptions/order/Order.vue +201 -201
  29. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/streamingMode/StreamingMode.vue +85 -85
  30. package/components/common/wizards/network/add/lib/config/steps.ts +464 -464
  31. package/composables/productNameLocal.ts +30 -30
  32. package/package.json +2 -2
  33. package/plugins/date.ts +181 -181
  34. package/plugins/recursion.ts +311 -311
  35. package/public/spice-console/lib/images/bitmap.js +203 -203
  36. package/public/spice-console/network/spicechannel.js +383 -383
  37. package/store/tasks/mappers/recentTasks.ts +45 -45
@@ -1,30 +1,30 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type { UI_T_LanguageKey } from '~/lib/models/types'
3
-
4
- export function productNameLocal(
5
- localization: UI_I_Localization
6
- ): UI_I_Localization {
7
- const config = useRuntimeConfig()
8
-
9
- const productName =
10
- config.public.LOCALIZATION_CODE === 'ru'
11
- ? config.public.PRODUCT_NAME_RU
12
- : config.public.PRODUCT_NAME_EN
13
-
14
- return replaceProductNameRecursion(localization, productName)
15
- }
16
-
17
- const replaceProductNameRecursion = (
18
- localization: UI_I_Localization,
19
- productName: any
20
- ): UI_I_Localization => {
21
- for (const key of Object.keys(localization)) {
22
- let item = localization[key as UI_T_LanguageKey]
23
-
24
- for (const key2 of Object.keys(item)) {
25
- item[key2] = item[key2].replaceAll('{productName}', productName)
26
- }
27
- }
28
-
29
- return localization
30
- }
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_T_LanguageKey } from '~/lib/models/types'
3
+
4
+ export function productNameLocal(
5
+ localization: UI_I_Localization
6
+ ): UI_I_Localization {
7
+ const config = useRuntimeConfig()
8
+
9
+ const productName =
10
+ config.public.LOCALIZATION_CODE === 'ru'
11
+ ? config.public.PRODUCT_NAME_RU
12
+ : config.public.PRODUCT_NAME_EN
13
+
14
+ return replaceProductNameRecursion(localization, productName)
15
+ }
16
+
17
+ const replaceProductNameRecursion = (
18
+ localization: UI_I_Localization,
19
+ productName: any
20
+ ): UI_I_Localization => {
21
+ for (const key of Object.keys(localization)) {
22
+ let item = localization[key as UI_T_LanguageKey]
23
+
24
+ for (const key2 of Object.keys(item)) {
25
+ item[key2] = item[key2].replaceAll('{productName}', productName)
26
+ }
27
+ }
28
+
29
+ return localization
30
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.247",
4
+ "version": "1.4.248",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -35,7 +35,7 @@
35
35
  "@vueuse/components": "^10.1.2",
36
36
  "date-fns": "^2.29.3",
37
37
  "bfg-nuxt-3-graph": "1.0.15",
38
- "bfg-uikit": "1.0.106",
38
+ "bfg-uikit": "1.0.135",
39
39
  "html2canvas": "^1.4.1",
40
40
  "prettier-eslint": "^15.0.1"
41
41
  }
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
+ })