bfg-common 1.5.172 → 1.5.174

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.
@@ -1,184 +1,180 @@
1
- <template>
2
- <div class="chart-options-actions">
3
- <ui-select
4
- v-model="localSelectedChartOptionLocal"
5
- :items="props.chartOptions"
6
- :label="localization.common.options"
7
- :margin-between-trigger="4"
8
- select-width="100%"
9
- show-text
10
- test-id="chart-options-select"
11
- />
12
- <ui-input
13
- v-model="newChartName"
14
- :placeholder="localization.common.name"
15
- :label="localization.common.name"
16
- :error="newChartNameError"
17
- test-id="chart-name"
18
- type="text"
19
- input-style="rounded"
20
- />
21
- <ui-button
22
- test-id="save-option-name"
23
- type="primary"
24
- variant="text"
25
- size="sm"
26
- is-without-sizes
27
- @click="onSaveNewName"
28
- >
29
- <template #icon>
30
- <ui-icon name="check" width="18" height="18"></ui-icon>
31
- </template>
32
- <span>{{ localization.common.save }}</span>
33
- </ui-button>
34
- <span class="seperator-name-actions"></span>
35
- <ui-button
36
- :disabled="!props.isDisabledDeleteAction"
37
- test-id="delete-option-name"
38
- type="primary"
39
- variant="text"
40
- size="md"
41
- is-without-sizes
42
- @click="emits('delete-action')"
43
- >
44
- <template #icon>
45
- <ui-icon name="delete" width="18" height="18"></ui-icon>
46
- </template>
47
- <span>{{ localization.common.delete }}</span>
48
- </ui-button>
49
- </div>
50
-
51
- <common-modals-confirmation
52
- v-if="isConfirmModalLocal"
53
- :headline="localization.inventoryMonitor.deleteConfirmationChartOption"
54
- :description="confirmModalDesc"
55
- :modal-texts="modalTexts"
56
- @hide-modal="isConfirmModalLocal = false"
57
- @confirm="onApplyDelete"
58
- />
59
- </template>
60
-
61
- <script setup lang="ts">
62
- import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
63
- import type { UI_I_Localization } from '~/lib/models/interfaces'
64
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
65
-
66
- const localSelectedChartOptionLocal = defineModel<string>(
67
- 'localSelectedChartOption',
68
- {
69
- required: true,
70
- }
71
- )
72
- const isConfirmModalLocal = defineModel<boolean>('isConfirmModal', {
73
- required: true,
74
- })
75
-
76
- const props = defineProps<{
77
- chartOptions: UI_I_OptionItem[]
78
- isDisabledDeleteAction: boolean
79
- }>()
80
-
81
- const emits = defineEmits<{
82
- (event: 'save-options', value: string): void
83
- (event: 'delete-action'): void
84
- (event: 'apply-delete'): void
85
- }>()
86
-
87
- const localization = computed<UI_I_Localization>(() => useLocal())
88
-
89
- const modalTexts = computed<UI_I_ModalTexts>(() => {
90
- return {
91
- button1: localization.value.common.cancel,
92
- button2: localization.value.common.delete,
93
- }
94
- })
95
-
96
- const newChartName = ref<string>('')
97
- watch(localSelectedChartOptionLocal, (newValue) => {
98
- newChartName.value = props.isDisabledDeleteAction ? newValue : ''
99
- })
100
-
101
- const newChartNameError = ref<string>('')
102
-
103
- const onSaveNewName = (): void => {
104
- if (
105
- localSelectedChartOptionLocal.value === 'select_options' &&
106
- !newChartName.value
107
- ) {
108
- newChartNameError.value = localization.value.common.fieldRequired
109
- } else if (
110
- !['select_options', 'default'].includes(
111
- localSelectedChartOptionLocal.value
112
- ) &&
113
- !newChartName.value
114
- ) {
115
- newChartNameError.value = localization.value.common.fieldRequired
116
- } else {
117
- if (newChartName.value) {
118
- newChartNameError.value = ''
119
- emits('save-options', newChartName.value)
120
- }
121
- }
122
- }
123
- watch(
124
- localSelectedChartOptionLocal,
125
- (newValue) => {
126
- if (newValue === 'select_options' && !newChartName.value)
127
- newChartNameError.value = localization.value.common.fieldRequired
128
- },
129
- { immediate: true }
130
- )
131
-
132
- const onApplyDelete = (): void => {
133
- emits('apply-delete')
134
- newChartName.value = ''
135
- }
136
-
137
- const confirmModalDesc = computed<string>(() =>
138
- localization.value.inventoryMonitor.deleteConfirmationChartOptionDesc.replace(
139
- '{0}',
140
- localSelectedChartOptionLocal.value
141
- )
142
- )
143
- </script>
144
-
145
- <style>
146
- :root {
147
- --chart-options-name-actions-seperate-border-color: #e9ebeda3;
148
- --chart-options-name-actions-delete-disabled-text-color: #bdc3c7;
149
- }
150
- :root.dark-theme {
151
- --chart-options-name-actions-seperate-border-color: #e9ebed1f;
152
- --chart-options-name-actions-delete-disabled-text-color: rgba(
153
- 189,
154
- 195,
155
- 199,
156
- 0.72
157
- );
158
- }
159
- </style>
160
- <style scoped lang="scss">
161
- .chart-options-actions {
162
- display: grid;
163
- grid-template-columns: 2fr 2fr max-content max-content max-content;
164
- align-items: center;
165
- grid-gap: 16px;
166
- padding-right: 32px;
167
-
168
- & > :nth-child(2) {
169
- height: 36px;
170
- }
171
- .seperator-name-actions {
172
- width: 1px;
173
- background-color: var(--chart-options-name-actions-seperate-border-color);
174
- height: 24px;
175
- }
176
- #delete-option-name {
177
- color: #ea3223;
178
-
179
- &:disabled {
180
- color: var(--chart-options-name-actions-delete-disabled-text-color);
181
- }
182
- }
183
- }
184
- </style>
1
+ <template>
2
+ <div class="chart-options-actions">
3
+ <ui-select
4
+ v-model="localSelectedChartOptionLocal"
5
+ :items="props.chartOptions"
6
+ :label="localization.common.options"
7
+ :margin-between-trigger="4"
8
+ select-width="100%"
9
+ show-text
10
+ test-id="chart-options-select"
11
+ />
12
+ <ui-input
13
+ v-model="newChartName"
14
+ :placeholder="localization.common.name"
15
+ :label="localization.common.name"
16
+ :error="newChartNameError"
17
+ test-id="chart-name"
18
+ type="text"
19
+ input-style="rounded"
20
+ />
21
+ <ui-button
22
+ test-id="save-option-name"
23
+ type="primary"
24
+ variant="text"
25
+ size="sm"
26
+ is-without-sizes
27
+ @click="onSaveNewName"
28
+ >
29
+ <template #icon>
30
+ <ui-icon name="check" width="18" height="18"></ui-icon>
31
+ </template>
32
+ <span>{{ localization.common.save }}</span>
33
+ </ui-button>
34
+ <span class="seperator-name-actions"></span>
35
+ <ui-button
36
+ :disabled="!props.isDisabledDeleteAction"
37
+ test-id="delete-option-name"
38
+ type="primary"
39
+ variant="text"
40
+ size="md"
41
+ is-without-sizes
42
+ @click="emits('delete-action')"
43
+ >
44
+ <template #icon>
45
+ <ui-icon name="delete" width="18" height="18"></ui-icon>
46
+ </template>
47
+ <span>{{ localization.common.delete }}</span>
48
+ </ui-button>
49
+ </div>
50
+
51
+ <common-modals-confirmation
52
+ v-if="isConfirmModalLocal"
53
+ :headline="localization.inventoryMonitor.deleteConfirmationChartOption"
54
+ :description="confirmModalDesc"
55
+ :modal-texts="modalTexts"
56
+ @hide-modal="isConfirmModalLocal = false"
57
+ @confirm="onApplyDelete"
58
+ />
59
+ </template>
60
+
61
+ <script setup lang="ts">
62
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
63
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
64
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
65
+
66
+ const localSelectedChartOptionLocal = defineModel<string>(
67
+ 'localSelectedChartOption',
68
+ {
69
+ required: true,
70
+ }
71
+ )
72
+ const isConfirmModalLocal = defineModel<boolean>('isConfirmModal', {
73
+ required: true,
74
+ })
75
+
76
+ const props = defineProps<{
77
+ chartOptions: UI_I_OptionItem[]
78
+ isDisabledDeleteAction: boolean
79
+ }>()
80
+
81
+ const emits = defineEmits<{
82
+ (event: 'save-options', value: string): void
83
+ (event: 'delete-action'): void
84
+ (event: 'apply-delete'): void
85
+ }>()
86
+
87
+ const localization = computed<UI_I_Localization>(() => useLocal())
88
+
89
+ const modalTexts = computed<UI_I_ModalTexts>(() => {
90
+ return {
91
+ button1: localization.value.common.cancel,
92
+ button2: localization.value.common.delete,
93
+ }
94
+ })
95
+
96
+ const newChartName = ref<string>('')
97
+ watch(localSelectedChartOptionLocal, (newValue) => {
98
+ newChartName.value = props.isDisabledDeleteAction ? newValue : ''
99
+ })
100
+
101
+ const newChartNameError = ref<string>('')
102
+
103
+ const onSaveNewName = (): void => {
104
+ if (
105
+ localSelectedChartOptionLocal.value === 'select_options' &&
106
+ !newChartName.value
107
+ ) {
108
+ newChartNameError.value = localization.value.common.fieldRequired
109
+ } else if (
110
+ !['select_options', 'default'].includes(
111
+ localSelectedChartOptionLocal.value
112
+ ) &&
113
+ !newChartName.value
114
+ ) {
115
+ newChartNameError.value = localization.value.common.fieldRequired
116
+ } else {
117
+ if (newChartName.value) {
118
+ newChartNameError.value = ''
119
+ emits('save-options', newChartName.value)
120
+ }
121
+ }
122
+ }
123
+ watch(localSelectedChartOptionLocal, (newValue) => {
124
+ if (newValue === 'select_options' && !newChartName.value)
125
+ newChartNameError.value = localization.value.common.fieldRequired
126
+ })
127
+
128
+ const onApplyDelete = (): void => {
129
+ emits('apply-delete')
130
+ newChartName.value = ''
131
+ }
132
+
133
+ const confirmModalDesc = computed<string>(() =>
134
+ localization.value.inventoryMonitor.deleteConfirmationChartOptionDesc.replace(
135
+ '{0}',
136
+ localSelectedChartOptionLocal.value
137
+ )
138
+ )
139
+ </script>
140
+
141
+ <style>
142
+ :root {
143
+ --chart-options-name-actions-seperate-border-color: #e9ebeda3;
144
+ --chart-options-name-actions-delete-disabled-text-color: #bdc3c7;
145
+ }
146
+ :root.dark-theme {
147
+ --chart-options-name-actions-seperate-border-color: #e9ebed1f;
148
+ --chart-options-name-actions-delete-disabled-text-color: rgba(
149
+ 189,
150
+ 195,
151
+ 199,
152
+ 0.72
153
+ );
154
+ }
155
+ </style>
156
+ <style scoped lang="scss">
157
+ .chart-options-actions {
158
+ display: grid;
159
+ grid-template-columns: 2fr 2fr max-content max-content max-content;
160
+ align-items: center;
161
+ grid-gap: 16px;
162
+ padding-right: 32px;
163
+
164
+ & > :nth-child(2) {
165
+ height: 36px;
166
+ }
167
+ .seperator-name-actions {
168
+ width: 1px;
169
+ background-color: var(--chart-options-name-actions-seperate-border-color);
170
+ height: 24px;
171
+ }
172
+ #delete-option-name {
173
+ color: #ea3223;
174
+
175
+ &:disabled {
176
+ color: var(--chart-options-name-actions-delete-disabled-text-color);
177
+ }
178
+ }
179
+ }
180
+ </style>