bfg-common 1.0.42 → 1.0.44

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.
@@ -110,12 +110,17 @@ const hideMenu = (force?: boolean): void => {
110
110
  const windowClick = () => {
111
111
  hideMenu()
112
112
  }
113
+ const windowResize = () => {
114
+ hideMenu(true)
115
+ }
113
116
  onMounted(() => {
114
117
  collapsedBtnId.value = `collapsed-btn${useUniqueId()}`
115
118
  window.addEventListener('mousedown', windowClick)
119
+ window.addEventListener('resize', windowResize)
116
120
  })
117
121
  onUnmounted(() => {
118
122
  window.removeEventListener('mousedown', windowClick)
123
+ window.removeEventListener('resize', windowResize)
119
124
  })
120
125
  </script>
121
126
 
@@ -960,8 +960,8 @@ const onClickDiagram = (ev: MouseEvent): void => {
960
960
  </style>
961
961
  <style lang="scss">
962
962
  .diagram-main-actions__popup.navbar-dropdown-menu {
963
- transform: translate(-40px, -10px);
964
- width: 360px;
963
+ //transform: translate(-40px, -10px);
964
+ //width: 360px;
965
965
  .btn {
966
966
  border-radius: 3px;
967
967
  border-bottom: none;
@@ -1,163 +1,163 @@
1
- <template>
2
- <template v-if="!props.inPortlet">
3
- <div class="diagram-header">
4
- <div class="diagram-header-left">
5
- <atoms-the-icon
6
- name="angle"
7
- :class="[
8
- 'diagram-header__arrow-icon',
9
- {
10
- open: props.isShowDiagram,
11
- },
12
- ]"
13
- @click="onToggleDiagram"
14
- />
15
- <a>
16
- <span>
17
- {{ localization.standardSwitch }}:
18
- {{ props.diagramName }}
19
- </span>
20
- </a>
21
- </div>
22
- <div v-if="props.isShowDiagram" class="diagram-header__btn-container">
23
- <span class="vertical-separator"></span>
24
- <button
25
- id="add-networking-button"
26
- type="button"
27
- @click="onShowModal('add-networking')"
28
- >
29
- {{ localization.addNetworking }}
30
- </button>
31
- <button
32
- id="switch-edit-button"
33
- type="button"
34
- @click="onShowModal('switch-edit')"
35
- >
36
- {{ localization.edit }}
37
- </button>
38
- <button
39
- id="switch-manage-physical-adapters-button"
40
- type="button"
41
- @click="onShowModal('switch-manage-physical-adapters')"
42
- >
43
- {{ localization.managePhysicalAdapters }}
44
- </button>
45
- <div style="position: relative; transform: translate(62px, -11px)">
46
- <atoms-collapse-nav
47
- popup-class="diagram-main-actions__popup"
48
- :close-after-click="true"
49
- :items="switchMainNavigation"
50
- @change="onShowModal"
51
- />
52
- </div>
53
- </div>
54
- </div>
55
- <hr class="horizontal-separator" />
56
- </template>
57
- </template>
58
-
59
- <script setup lang="ts">
60
- import { UI_I_Localization } from '~/models/interfaces'
61
- import { UI_I_NavigationItem } from '~/components/common/diagramMain/models/interfaces'
62
- import { switchMainNavigationFunc } from '~/components/common/diagramMain/modals/config'
63
-
64
- const props = defineProps<{
65
- inPortlet: boolean
66
- isShowDiagram: boolean
67
- diagramName: string
68
- }>()
69
-
70
- const emits = defineEmits<{
71
- (event: 'toggle-diagram'): void
72
- (event: 'show-modal', modalName: string): void
73
- }>()
74
-
75
- const localization = computed<UI_I_Localization>(() => useLocal())
76
-
77
- const switchMainNavigation = computed<UI_I_NavigationItem[]>(() =>
78
- switchMainNavigationFunc(localization.value)
79
- )
80
-
81
- const onToggleDiagram = () => emits('toggle-diagram')
82
-
83
- const onShowModal = (modalName: string) => emits('show-modal', modalName)
84
- </script>
85
-
86
- <style scoped lang="scss">
87
- .diagram-header {
88
- display: flex;
89
- padding-left: 8px;
90
- a {
91
- color: #0072a3;
92
- cursor: pointer;
93
- font-weight: 700;
94
- user-select: none;
95
- line-height: 20px;
96
- span {
97
- font-weight: 700;
98
- }
99
- }
100
-
101
- &-left {
102
- display: flex;
103
- flex-wrap: nowrap;
104
- }
105
-
106
- &__arrow-icon {
107
- width: 16px;
108
- height: 16px;
109
- margin-right: 4px;
110
- transform: rotate(90deg);
111
- align-self: center;
112
- fill: var(--triger-icon-color);
113
- cursor: pointer;
114
- &.open {
115
- transform: rotate(180deg);
116
- }
117
- }
118
-
119
- &__btn-container {
120
- display: flex;
121
-
122
- button {
123
- font-size: 11px;
124
- height: 24px;
125
- border: none;
126
- background: none;
127
- margin-right: 0;
128
- cursor: pointer;
129
- display: inline-block;
130
- white-space: nowrap;
131
- text-align: center;
132
- text-transform: uppercase;
133
- color: #0072a3;
134
- line-height: 20px;
135
- max-height: 16.8px;
136
- padding: 0 14px;
137
- font-weight: 500;
138
- letter-spacing: 1px;
139
-
140
- &:hover {
141
- color: #004d8a;
142
- }
143
- }
144
- }
145
- }
146
-
147
- .horizontal-separator {
148
- margin: 5px 10px 10px;
149
- border-left: 0;
150
- border-right: 0;
151
- border-color: #ddd;
152
- box-sizing: content-box;
153
- height: 0;
154
- overflow: visible;
155
- border-top: 0px solid #eee;
156
- }
157
-
158
- .vertical-separator {
159
- border: 1px solid #ddd;
160
- border-left: none;
161
- margin: 0 3px 0 14px;
162
- }
163
- </style>
1
+ <template>
2
+ <template v-if="!props.inPortlet">
3
+ <div class="diagram-header">
4
+ <div class="diagram-header-left">
5
+ <atoms-the-icon
6
+ name="angle"
7
+ :class="[
8
+ 'diagram-header__arrow-icon',
9
+ {
10
+ open: props.isShowDiagram,
11
+ },
12
+ ]"
13
+ @click="onToggleDiagram"
14
+ />
15
+ <a>
16
+ <span>
17
+ {{ localization.standardSwitch }}:
18
+ {{ props.diagramName }}
19
+ </span>
20
+ </a>
21
+ </div>
22
+ <div v-if="props.isShowDiagram" class="diagram-header__btn-container">
23
+ <span class="vertical-separator"></span>
24
+ <button
25
+ id="add-networking-button"
26
+ type="button"
27
+ @click="onShowModal('add-networking')"
28
+ >
29
+ {{ localization.addNetworking }}
30
+ </button>
31
+ <button
32
+ id="switch-edit-button"
33
+ type="button"
34
+ @click="onShowModal('switch-edit')"
35
+ >
36
+ {{ localization.edit }}
37
+ </button>
38
+ <button
39
+ id="switch-manage-physical-adapters-button"
40
+ type="button"
41
+ @click="onShowModal('switch-manage-physical-adapters')"
42
+ >
43
+ {{ localization.managePhysicalAdapters }}
44
+ </button>
45
+ <div style="position: relative; transform: translate(62px, -11px)">
46
+ <atoms-collapse-nav
47
+ popup-class="diagram-main-actions__popup"
48
+ :close-after-click="true"
49
+ :items="switchMainNavigation"
50
+ @change="onShowModal"
51
+ />
52
+ </div>
53
+ </div>
54
+ </div>
55
+ <hr class="horizontal-separator" />
56
+ </template>
57
+ </template>
58
+
59
+ <script setup lang="ts">
60
+ import { UI_I_Localization } from '~/models/interfaces'
61
+ import { UI_I_NavigationItem } from '~/components/common/diagramMain/models/interfaces'
62
+ import { switchMainNavigationFunc } from '~/components/common/diagramMain/modals/config'
63
+
64
+ const props = defineProps<{
65
+ inPortlet: boolean
66
+ isShowDiagram: boolean
67
+ diagramName: string
68
+ }>()
69
+
70
+ const emits = defineEmits<{
71
+ (event: 'toggle-diagram'): void
72
+ (event: 'show-modal', modalName: string): void
73
+ }>()
74
+
75
+ const localization = computed<UI_I_Localization>(() => useLocal())
76
+
77
+ const switchMainNavigation = computed<UI_I_NavigationItem[]>(() =>
78
+ switchMainNavigationFunc(localization.value)
79
+ )
80
+
81
+ const onToggleDiagram = () => emits('toggle-diagram')
82
+
83
+ const onShowModal = (modalName: string) => emits('show-modal', modalName)
84
+ </script>
85
+
86
+ <style scoped lang="scss">
87
+ .diagram-header {
88
+ display: flex;
89
+ padding-left: 8px;
90
+ a {
91
+ color: #0072a3;
92
+ cursor: pointer;
93
+ font-weight: 700;
94
+ user-select: none;
95
+ line-height: 20px;
96
+ span {
97
+ font-weight: 700;
98
+ }
99
+ }
100
+
101
+ &-left {
102
+ display: flex;
103
+ flex-wrap: nowrap;
104
+ }
105
+
106
+ &__arrow-icon {
107
+ width: 16px;
108
+ height: 16px;
109
+ margin-right: 4px;
110
+ transform: rotate(90deg);
111
+ align-self: center;
112
+ fill: var(--triger-icon-color);
113
+ cursor: pointer;
114
+ &.open {
115
+ transform: rotate(180deg);
116
+ }
117
+ }
118
+
119
+ &__btn-container {
120
+ display: flex;
121
+
122
+ button {
123
+ font-size: 11px;
124
+ height: 24px;
125
+ border: none;
126
+ background: none;
127
+ margin-right: 0;
128
+ cursor: pointer;
129
+ display: inline-block;
130
+ white-space: nowrap;
131
+ text-align: center;
132
+ text-transform: uppercase;
133
+ color: #0072a3;
134
+ line-height: 20px;
135
+ max-height: 16.8px;
136
+ padding: 0 14px;
137
+ font-weight: 500;
138
+ letter-spacing: 1px;
139
+
140
+ &:hover {
141
+ color: #004d8a;
142
+ }
143
+ }
144
+ }
145
+ }
146
+
147
+ .horizontal-separator {
148
+ margin: 5px 10px 10px;
149
+ border-left: 0;
150
+ border-right: 0;
151
+ border-color: #ddd;
152
+ box-sizing: content-box;
153
+ height: 0;
154
+ overflow: visible;
155
+ border-top: 0px solid #eee;
156
+ }
157
+
158
+ .vertical-separator {
159
+ border: 1px solid #ddd;
160
+ border-left: none;
161
+ margin: 0 3px 0 14px;
162
+ }
163
+ </style>
@@ -1,141 +1,144 @@
1
- <template>
2
- <div :id="id" class="btn-group">
3
- <div v-for="(button, key) in props.actions" :key="button.type">
4
- <label v-if="button.uploaded">
5
- <span :class="[`btn btn-link ${props.size}`]">
6
- {{ button.text }}
7
- </span>
8
- <input
9
- :id="`select-file-button-${key}`"
10
- type="file"
11
- :disabled="button.disabled"
12
- :multiple="false"
13
- class="btn-group__file"
14
- @change="(event) => onSelectFiles(event, button.type)"
15
- />
16
- </label>
17
-
18
- <button
19
- v-else
20
- :id="`actions-button-${key}`"
21
- :class="[`btn btn-link ${props.size}`]"
22
- :disabled="button.disabled"
23
- @click="onClickButton(button.type)"
24
- >
25
- {{ button.text }}
26
- </button>
27
- </div>
28
- <atoms-collapse-nav
29
- v-show="collapsedItems.length"
30
- :test-id="`${props.testId}-item`"
31
- :items="collapsedItems"
32
- @change="onClickButton"
33
- @select-file="onSelectFiles"
34
- />
35
- </div>
36
- </template>
37
-
38
- <script lang="ts" setup>
39
- import { UI_I_Button } from '~/components/common/tools/models/interfaces'
40
- import { UI_I_CollapseNavItem } from '~/components/atoms/collapse/models/interfaces'
41
-
42
- const props = withDefaults(
43
- defineProps<{
44
- actions: UI_I_Button[]
45
- testId: string
46
- size?: 'btn-sm' | ''
47
- }>(),
48
- {
49
- size: 'btn-sm',
50
- }
51
- )
52
- const emits = defineEmits<{
53
- (event: 'click', value1: string, value2?: Event | null): void
54
- }>()
55
-
56
- const onClickButton = (type: string): void => {
57
- emits('click', type)
58
- }
59
-
60
- const onSelectFiles = (event: Event, type: string): void => {
61
- emits('click', type, event)
62
- }
63
-
64
- const visibleCount = ref(props.actions.length)
65
- const collapsedItems = computed<UI_I_CollapseNavItem[]>(() => {
66
- return props.actions
67
- .filter((_, index) => {
68
- return index >= visibleCount.value
69
- })
70
- .map((item) => {
71
- return {
72
- text: item.text,
73
- value: item.type,
74
- disabled: item.disabled,
75
- uploaded: item.uploaded,
76
- }
77
- })
78
- })
79
-
80
- const outputSize = (): void => {
81
- const el = document.getElementById(id.value)
82
- if (!el) return
83
-
84
- const elWidth = el.clientWidth
85
- const elItems = el.children
86
- const elItemsMarginLeft = parseInt(getComputedStyle(elItems[0]).marginLeft)
87
- const elItemsMarginRight = parseInt(getComputedStyle(elItems[0]).marginRight)
88
- const childrenMarginY = elItemsMarginLeft + elItemsMarginRight
89
-
90
- let childrenWidth = 0
91
- let count = 0
92
- for (let i = 0; i < elItems.length; i++) {
93
- childrenWidth += elItems[i].clientWidth + childrenMarginY
94
- const isWrap = elWidth < childrenWidth
95
-
96
- if (isWrap) break
97
- count++
98
- }
99
-
100
- visibleCount.value = count
101
- }
102
-
103
- const setResizeObserve = (): void => {
104
- const el = document.getElementById(id.value)
105
-
106
- if (!el) {
107
- setTimeout(setResizeObserve, 0)
108
- return
109
- }
110
-
111
- new ResizeObserver(outputSize).observe(el)
112
- }
113
- const id = ref<string>('')
114
- onMounted(() => {
115
- id.value = `tool-actions-${useUniqueId()}`
116
- setResizeObserve()
117
- })
118
- </script>
119
-
120
- <style lang="scss" scoped>
121
- .btn {
122
- &:disabled {
123
- color: var(--btn-link-disabled);
124
- }
125
- &-group {
126
- margin-top: 10px;
127
- box-shadow: none;
128
- position: relative;
129
- overflow: hidden;
130
- display: flex;
131
- flex-wrap: wrap;
132
- min-height: 25px;
133
- height: 25px;
134
- box-sizing: content-box;
135
-
136
- &__file {
137
- display: none;
138
- }
139
- }
140
- }
141
- </style>
1
+ <template>
2
+ <div :id="id" :class="['btn-group', { 'with-space': collapsedItems.length }]">
3
+ <div v-for="(button, key) in props.actions" :key="button.type">
4
+ <label v-if="button.uploaded">
5
+ <span :class="[`btn btn-link ${props.size}`]">
6
+ {{ button.text }}
7
+ </span>
8
+ <input
9
+ :id="`select-file-button-${key}`"
10
+ type="file"
11
+ :disabled="button.disabled"
12
+ :multiple="false"
13
+ class="btn-group__file"
14
+ @change="(event) => onSelectFiles(event, button.type)"
15
+ />
16
+ </label>
17
+
18
+ <button
19
+ v-else
20
+ :id="`actions-button-${key}`"
21
+ :class="[`btn btn-link ${props.size}`]"
22
+ :disabled="button.disabled"
23
+ @click="onClickButton(button.type)"
24
+ >
25
+ {{ button.text }}
26
+ </button>
27
+ </div>
28
+ <atoms-collapse-nav
29
+ v-show="collapsedItems.length"
30
+ :test-id="`${props.testId}-item`"
31
+ :items="collapsedItems"
32
+ @change="onClickButton"
33
+ @select-file="onSelectFiles"
34
+ />
35
+ </div>
36
+ </template>
37
+
38
+ <script lang="ts" setup>
39
+ import { UI_I_Button } from '~/components/common/tools/models/interfaces'
40
+ import { UI_I_CollapseNavItem } from '~/components/atoms/collapse/models/interfaces'
41
+
42
+ const props = withDefaults(
43
+ defineProps<{
44
+ actions: UI_I_Button[]
45
+ testId: string
46
+ size?: 'btn-sm' | ''
47
+ }>(),
48
+ {
49
+ size: 'btn-sm',
50
+ }
51
+ )
52
+ const emits = defineEmits<{
53
+ (event: 'click', value1: string, value2?: Event | null): void
54
+ }>()
55
+
56
+ const onClickButton = (type: string): void => {
57
+ emits('click', type)
58
+ }
59
+
60
+ const onSelectFiles = (event: Event, type: string): void => {
61
+ emits('click', type, event)
62
+ }
63
+
64
+ const visibleCount = ref(props.actions.length)
65
+ const collapsedItems = computed<UI_I_CollapseNavItem[]>(() => {
66
+ return props.actions
67
+ .filter((_, index) => {
68
+ return index >= visibleCount.value
69
+ })
70
+ .map((item) => {
71
+ return {
72
+ text: item.text,
73
+ value: item.type,
74
+ disabled: item.disabled,
75
+ uploaded: item.uploaded,
76
+ }
77
+ })
78
+ })
79
+
80
+ const outputSize = (): void => {
81
+ const el = document.getElementById(id.value)
82
+ if (!el) return
83
+
84
+ const elWidth = el.clientWidth
85
+ const elItems = el.children
86
+ const elItemsMarginLeft = parseInt(getComputedStyle(elItems[0]).marginLeft)
87
+ const elItemsMarginRight = parseInt(getComputedStyle(elItems[0]).marginRight)
88
+ const childrenMarginY = elItemsMarginLeft + elItemsMarginRight
89
+
90
+ let childrenWidth = 0
91
+ let count = 0
92
+ for (let i = 0; i < elItems.length; i++) {
93
+ childrenWidth += elItems[i].clientWidth + childrenMarginY
94
+ const isWrap = elWidth - 66 < childrenWidth
95
+
96
+ if (isWrap) break
97
+ count++
98
+ }
99
+
100
+ visibleCount.value = count
101
+ }
102
+
103
+ const setResizeObserve = (): void => {
104
+ const el = document.getElementById(id.value)
105
+
106
+ if (!el) {
107
+ setTimeout(setResizeObserve, 0)
108
+ return
109
+ }
110
+
111
+ new ResizeObserver(outputSize).observe(el)
112
+ }
113
+ const id = ref<string>('')
114
+ onMounted(() => {
115
+ id.value = `tool-actions-${useUniqueId()}`
116
+ setResizeObserve()
117
+ })
118
+ </script>
119
+
120
+ <style lang="scss" scoped>
121
+ .btn {
122
+ &:disabled {
123
+ color: var(--btn-link-disabled);
124
+ }
125
+ &-group {
126
+ margin-top: 10px;
127
+ box-shadow: none;
128
+ position: relative;
129
+ overflow: hidden;
130
+ display: flex;
131
+ flex-wrap: wrap;
132
+ min-height: 25px;
133
+ height: 25px;
134
+ box-sizing: content-box;
135
+
136
+ &__file {
137
+ display: none;
138
+ }
139
+ &.with-space {
140
+ padding-right: 66px;
141
+ }
142
+ }
143
+ }
144
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.0.42",
4
+ "version": "1.0.44",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",