bfg-common 1.5.755 → 1.5.757

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.
@@ -19,7 +19,7 @@
19
19
  <ui-skeleton-item width="96" height="20" class="ml-auto" />
20
20
  </div>
21
21
  <div class="right-content grid p-4">
22
- <div class="flex justify-between gap-4 flex-wrap top-container">
22
+ <div class="flex justify-between gap-4 pr-4 flex-wrap top-container">
23
23
  <ui-skeleton-item width="80" height="20" />
24
24
  <div class="actions-block flex">
25
25
  <ui-skeleton-item width="20" height="20" />
@@ -29,7 +29,13 @@
29
29
  <ui-skeleton-item width="20" height="20" />
30
30
  </div>
31
31
  </div>
32
- <div class="details-block flex flex-col my-6">
32
+ <div
33
+ ref="detailsScrollBlock"
34
+ :class="[
35
+ 'details-block flex flex-col my-6',
36
+ { 'has-scroll': hasScroll },
37
+ ]"
38
+ >
33
39
  <div
34
40
  v-for="index in detailsItemsCount"
35
41
  :key="index"
@@ -45,7 +51,19 @@
45
51
  </template>
46
52
 
47
53
  <script setup lang="ts">
54
+ import { useTemplateRef } from 'vue'
55
+ import { useElementSize } from '@vueuse/core'
56
+
48
57
  const detailsItemsCount = ref<number>(3)
58
+
59
+ const detailsElement = useTemplateRef<HTMLDivElement>('detailsScrollBlock')
60
+ const { height } = useElementSize(detailsElement)
61
+
62
+ const hasScroll = computed<boolean>(
63
+ () =>
64
+ height.value &&
65
+ detailsElement.value?.scrollHeight > detailsElement.value?.clientHeight
66
+ )
49
67
  </script>
50
68
 
51
69
  <style>
@@ -84,6 +102,8 @@ const detailsItemsCount = ref<number>(3)
84
102
  }
85
103
  }
86
104
  .right-content {
105
+ padding-right: 0;
106
+
87
107
  .top-container {
88
108
  .actions-block {
89
109
  grid-column-gap: 10px;
@@ -98,6 +118,10 @@ const detailsItemsCount = ref<number>(3)
98
118
  grid-row-gap: 10px;
99
119
  overflow: auto;
100
120
 
121
+ &:not(.has-scroll) {
122
+ padding-right: 16px;
123
+ }
124
+
101
125
  .details-block-item {
102
126
  background-color: var(--backups-right-skeleton-item-bg-color);
103
127
  border-radius: 6px;
@@ -48,6 +48,7 @@ const description = computed<string>(() => {
48
48
 
49
49
  const modalTexts = computed<UI_I_ModalTexts>(() => {
50
50
  return {
51
+ button1: localization.value.common.cancel,
51
52
  button2: props.isAll
52
53
  ? localization.value.common.deleteAll
53
54
  : localization.value.common.delete,
@@ -227,6 +227,7 @@
227
227
  </template>
228
228
 
229
229
  <script setup lang="ts">
230
+ import { useTemplateRef } from 'vue'
230
231
  import { useElementSize } from '@vueuse/core'
231
232
  import type { UI_I_InfoBlock } from '~/node_modules/bfg-uikit/components/ui/infoBlock/models/interfaces'
232
233
  import type { UI_I_Localization } from '~/lib/models/interfaces'
@@ -268,19 +269,14 @@ const onSelectContextMenuItem = (actionType: UI_T_SnapshotActionType): void => {
268
269
  emits('show-modal', actionType)
269
270
  }
270
271
 
271
- const detailsScrollBlock = ref<HTMLElement | null>(null)
272
- const { height } = useElementSize(detailsScrollBlock)
273
- const hasScroll = ref<boolean>(false)
274
- const checkScroll = (): void => {
275
- const element = detailsScrollBlock.value
276
- if (element) {
277
- hasScroll.value = element.scrollHeight > element.clientHeight
278
- }
279
- }
272
+ const detailsElement = useTemplateRef<HTMLDivElement>('detailsScrollBlock')
273
+ const { height } = useElementSize(detailsElement)
280
274
 
281
- watch(height, () => {
282
- checkScroll()
283
- })
275
+ const hasScroll = computed<boolean>(
276
+ () =>
277
+ height.value &&
278
+ detailsElement.value?.scrollHeight > detailsElement.value?.clientHeight
279
+ )
284
280
  </script>
285
281
 
286
282
  <style>
@@ -19,7 +19,7 @@
19
19
  <ui-skeleton-item width="96" height="20" class="ml-auto" />
20
20
  </div>
21
21
  <div class="right-content grid p-4">
22
- <div class="flex justify-between gap-4 flex-wrap top-container">
22
+ <div class="flex justify-between gap-4 pr-4 flex-wrap top-container">
23
23
  <ui-skeleton-item width="80" height="20" />
24
24
  <div class="actions-block flex">
25
25
  <ui-skeleton-item width="20" height="20" />
@@ -29,7 +29,13 @@
29
29
  <ui-skeleton-item width="20" height="20" />
30
30
  </div>
31
31
  </div>
32
- <div class="details-block flex flex-col my-6">
32
+ <div
33
+ ref="detailsScrollBlock"
34
+ :class="[
35
+ 'details-block flex flex-col my-6',
36
+ { 'has-scroll': hasScroll },
37
+ ]"
38
+ >
33
39
  <div
34
40
  v-for="index in detailsItemsCount"
35
41
  :key="index"
@@ -45,7 +51,19 @@
45
51
  </template>
46
52
 
47
53
  <script setup lang="ts">
54
+ import { useTemplateRef } from 'vue'
55
+ import { useElementSize } from '@vueuse/core'
56
+
48
57
  const detailsItemsCount = ref<number>(6)
58
+
59
+ const detailsElement = useTemplateRef<HTMLDivElement>('detailsScrollBlock')
60
+ const { height } = useElementSize(detailsElement)
61
+
62
+ const hasScroll = computed<boolean>(
63
+ () =>
64
+ height.value &&
65
+ detailsElement.value?.scrollHeight > detailsElement.value?.clientHeight
66
+ )
49
67
  </script>
50
68
 
51
69
  <style>
@@ -84,6 +102,8 @@ const detailsItemsCount = ref<number>(6)
84
102
  }
85
103
  }
86
104
  .right-content {
105
+ padding-right: 0;
106
+
87
107
  .top-container {
88
108
  .actions-block {
89
109
  grid-column-gap: 10px;
@@ -98,6 +118,10 @@ const detailsItemsCount = ref<number>(6)
98
118
  grid-row-gap: 10px;
99
119
  overflow: auto;
100
120
 
121
+ &:not(.has-scroll) {
122
+ padding-right: 16px;
123
+ }
124
+
101
125
  .details-block-item {
102
126
  background-color: var(--snapshots-right-skeleton-item-bg-color);
103
127
  border-radius: 6px;
@@ -251,10 +251,12 @@ const globalPermissions = computed<any>(
251
251
 
252
252
  // Step's content data (connectionType)
253
253
  const connectionType = ref<string>(
254
- !globalPermissions.value['Networks.CreateSysx'] &&
255
- !globalPermissions.value['Networks.CreatePortGroup']
254
+ globalPermissions.value === undefined
255
+ ? '0'
256
+ : !globalPermissions.value?.['Networks.CreateSysx'] &&
257
+ !globalPermissions.value?.['Networks.CreatePortGroup']
256
258
  ? '2'
257
- : !globalPermissions.value['Networks.CreateSysx']
259
+ : !globalPermissions.value?.['Networks.CreateSysx']
258
260
  ? '1'
259
261
  : '0'
260
262
  )
@@ -291,7 +293,7 @@ const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
291
293
  // Step's content data and changers (targetDevice)
292
294
  const targetDevice = ref<UI_I_TargetDevice>(
293
295
  useDeepCopy(
294
- targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
296
+ targetDeviceInitialFunc(globalPermissions.value?.['Networks.UpdateSwitch'])
295
297
  )
296
298
  )
297
299
  const mtuFromSwitch = ref<number>(1500)
@@ -385,7 +387,8 @@ watch(
385
387
  : (targetDevice.value.selected = '0')
386
388
  newCT === '1' && (targetDevice.value.selected = '1')
387
389
  newCT === '2' &&
388
- (globalPermissions.value['Networks.UpdateSwitch']
390
+ (globalPermissions.value === undefined ||
391
+ globalPermissions.value?.['Networks.UpdateSwitch']
389
392
  ? (targetDevice.value.selected = '2')
390
393
  : (targetDevice.value.selected = '3'))
391
394
  }
@@ -515,7 +518,7 @@ const reset = (): void => {
515
518
  wizard.reset()
516
519
  connectionTypeLocal.value = '0'
517
520
  targetDevice.value = useDeepCopy(
518
- targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
521
+ targetDeviceInitialFunc(globalPermissions.value?.['Networks.UpdateSwitch'])
519
522
  )
520
523
  connectionSettings.value = useDeepCopy(connectionSettingsInitial)
521
524
  portProperties.value = useDeepCopy(portPropertiesInitial)
@@ -25,7 +25,8 @@ export const servicesInitial: UI_I_Services = {
25
25
  export const targetDeviceInitialFunc = (
26
26
  updateSwitchPermission: boolean
27
27
  ): UI_I_TargetDevice => ({
28
- selected: updateSwitchPermission ? '1' : '3',
28
+ selected:
29
+ updateSwitchPermission === undefined || updateSwitchPermission ? '1' : '3',
29
30
  network: '',
30
31
  switch: '',
31
32
  standardSwitch: '',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.755",
4
+ "version": "1.5.757",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
package/plugins/time.ts CHANGED
@@ -1,58 +1,58 @@
1
- import { defineNuxtPlugin } from '#app'
2
- import type { UI_T_LangValue } from '~/lib/models/types'
3
- export default defineNuxtPlugin(() => {
4
- const time = function (): any {
5
- const self: any = {}
6
- self.millisecondsToHour = function (ms: number): number {
7
- return ~~(ms / 1000 / 60 / 60 / 24)
8
- }
9
- self.formatTime = (
10
- seconds: number,
11
- lang: UI_T_LangValue = 'ru_RU'
12
- ): string => {
13
- const units = {
14
- en_US: { s: 's', m: 'm', h: 'h' },
15
- ru_RU: { s: 'с', m: 'м', h: 'ч' },
16
- hy_AM: { s: 'վ', m: 'ր', h: 'ժ' },
17
- be_BY: { s: 'с', m: 'хв', h: 'г' },
18
- kk_KZ: { s: 'сек', m: 'мин', h: 'сағ' },
19
- zh_CHS: { s: '秒', m: '分', h: '时' },
20
- BROWSER: { s: 's', m: 'm', h: 'h' },
21
- }
22
-
23
- const unit = units[lang] || units.en_US
24
-
25
- if (seconds < 60) {
26
- return `${seconds}${unit.s}`
27
- }
28
-
29
- const hours = Math.floor(seconds / 3600)
30
- const minutes = Math.floor((seconds % 3600) / 60)
31
- const secs = seconds % 60
32
-
33
- let result = ''
34
-
35
- if (hours > 0) {
36
- result += `${hours}${unit.h} `
37
- }
38
-
39
- if (minutes > 0) {
40
- result += `${minutes}${unit.m} `
41
- }
42
-
43
- if (secs > 0) {
44
- result += `${secs}${unit.s}`
45
- }
46
-
47
- return result.trim()
48
- }
49
-
50
- return self
51
- }.call({})
52
-
53
- return {
54
- provide: {
55
- time,
56
- },
57
- }
58
- })
1
+ import { defineNuxtPlugin } from '#app'
2
+ import type { UI_T_LangValue } from '~/lib/models/types'
3
+ export default defineNuxtPlugin(() => {
4
+ const time = function (): any {
5
+ const self: any = {}
6
+ self.millisecondsToHour = function (ms: number): number {
7
+ return ~~(ms / 1000 / 60 / 60 / 24)
8
+ }
9
+ self.formatTime = (
10
+ seconds: number,
11
+ lang: UI_T_LangValue = 'ru_RU'
12
+ ): string => {
13
+ const units = {
14
+ en_US: { s: 's', m: 'm', h: 'h' },
15
+ ru_RU: { s: 'с', m: 'м', h: 'ч' },
16
+ hy_AM: { s: 'վ', m: 'ր', h: 'ժ' },
17
+ be_BY: { s: 'с', m: 'хв', h: 'г' },
18
+ kk_KZ: { s: 'сек', m: 'мин', h: 'сағ' },
19
+ zh_CHS: { s: '秒', m: '分', h: '时' },
20
+ BROWSER: { s: 's', m: 'm', h: 'h' },
21
+ }
22
+
23
+ const unit = units[lang] || units.en_US
24
+
25
+ if (seconds < 60) {
26
+ return `${seconds}${unit.s}`
27
+ }
28
+
29
+ const hours = Math.floor(seconds / 3600)
30
+ const minutes = Math.floor((seconds % 3600) / 60)
31
+ const secs = seconds % 60
32
+
33
+ let result = ''
34
+
35
+ if (hours > 0) {
36
+ result += `${hours}${unit.h} `
37
+ }
38
+
39
+ if (minutes > 0) {
40
+ result += `${minutes}${unit.m} `
41
+ }
42
+
43
+ if (secs > 0) {
44
+ result += `${secs}${unit.s}`
45
+ }
46
+
47
+ return result.trim()
48
+ }
49
+
50
+ return self
51
+ }.call({})
52
+
53
+ return {
54
+ provide: {
55
+ time,
56
+ },
57
+ }
58
+ })