|
6 | 6 | :applied-options="appliedOptions" |
7 | 7 | v-model:is-hovered="isHovered" |
8 | 8 | ) |
9 | | - q-card.network-list-card.rounded-borders.overflow-hidden( |
10 | | - flat |
11 | | - bordered |
12 | | - :class="styles.control.input" |
13 | | - ) |
14 | | - q-toolbar.network-list-toolbar.q-px-md |
15 | | - .row.items-center.no-wrap.full-width.q-py-xs |
16 | | - q-avatar.text-white.shadow-1( |
| 9 | + .network-list-field(:class="styles.control.input") |
| 10 | + .text-caption.text-weight-medium.text-grey-7.q-mb-xs {{ addFieldLabel }} |
| 11 | + .row.q-col-gutter-sm.items-start |
| 12 | + q-input.col( |
| 13 | + v-model="draft" |
| 14 | + dense |
| 15 | + :hide-bottom-space="localError === ''" |
| 16 | + outlined |
| 17 | + :placeholder="appliedOptions.placeholder || 'Saisir une adresse, un CIDR ou une plage…'" |
| 18 | + :disable="!canEdit" |
| 19 | + :readonly="isReadonly" |
| 20 | + :error="localError !== ''" |
| 21 | + :error-message="localError" |
| 22 | + @keyup.enter="addEntry" |
| 23 | + @update:model-value="localError = ''" |
| 24 | + :id="elementId + '-draft'" |
| 25 | + v-bind="quasarProps('q-input')" |
| 26 | + ) |
| 27 | + template(#prepend) |
| 28 | + q-icon(name="mdi-ip-network-outline" color="grey-6" size="sm") |
| 29 | + .col-auto |
| 30 | + q-btn.network-list-add-btn( |
17 | 31 | color="primary" |
18 | | - icon="mdi-lan" |
19 | | - rounded |
20 | | - size="36px" |
| 32 | + icon="mdi-plus" |
| 33 | + :label="addButtonLabel" |
| 34 | + no-caps |
| 35 | + padding="sm md" |
| 36 | + unelevated |
| 37 | + :disable="!canEdit || draftTrimmed === ''" |
| 38 | + @click="addEntry" |
21 | 39 | ) |
22 | | - .column.col.q-pl-sm.min-width-0 |
23 | | - q-toolbar-title.text-subtitle2.text-weight-medium {{ computedLabel }} |
24 | | - .text-caption.text-grey-6.q-mt-xs(v-if="items.length") {{ items.length }} règle{{ items.length > 1 ? 's' : '' }} |
25 | | - q-separator |
26 | | - q-card-section.q-pa-md |
27 | | - .network-list-empty.column.flex-center.text-center.q-pa-lg.rounded-borders( |
28 | | - v-if="items.length === 0" |
| 40 | + |
| 41 | + .network-list-empty.text-caption.text-grey-6.q-mt-sm(v-if="items.length === 0") |
| 42 | + q-icon.q-mr-xs(name="mdi-information-outline" size="16px") |
| 43 | + | {{ emptyMessage }} |
| 44 | + |
| 45 | + .network-list-chips.row.q-col-gutter-sm.q-mt-sm(v-else) |
| 46 | + .col-auto( |
| 47 | + v-for="(item, index) in items" |
| 48 | + :key="`${index}-${item}`" |
29 | 49 | ) |
30 | | - q-icon(name="mdi-shield-check-outline" color="grey-5" size="lg") |
31 | | - .text-body2.text-weight-medium.text-grey-7.q-mt-sm Aucune restriction réseau |
32 | | - .text-caption.text-grey-6.q-mt-xs.q-px-md {{ emptyMessage }} |
33 | | - .network-list-chips.q-mb-md(v-else) |
34 | | - .text-caption.text-grey-6.q-mb-sm Règles actives |
35 | | - .row.q-col-gutter-sm |
36 | | - .col-12( |
37 | | - v-for="(item, index) in items" |
38 | | - :key="`${index}-${item}`" |
39 | | - ) |
40 | | - .network-list-chip.row.items-center.no-wrap.full-width.rounded-borders.q-px-sm.q-py-xs |
41 | | - q-icon.q-mr-sm(name="mdi-ip-network" color="primary" size="xs") |
42 | | - span.network-list-chip-label.col.text-body2 {{ item }} |
43 | | - q-btn( |
44 | | - color="grey-7" |
45 | | - dense |
46 | | - flat |
47 | | - icon="mdi-close" |
48 | | - round |
49 | | - size="sm" |
50 | | - :disable="!canEdit" |
51 | | - :tabindex="-1" |
52 | | - @click="removeAt(index)" |
53 | | - ) |
54 | | - q-tooltip Supprimer cette entrée |
55 | | - q-separator.q-mb-md(v-if="items.length > 0") |
56 | | - .text-caption.text-weight-medium.text-grey-7.q-mb-xs {{ addFieldLabel }} |
57 | | - .row.q-col-gutter-sm.items-start |
58 | | - q-input.col( |
59 | | - v-model="draft" |
| 50 | + q-chip.network-list-chip( |
60 | 51 | dense |
61 | | - :hide-bottom-space="localError === ''" |
62 | | - outlined |
63 | | - :placeholder="appliedOptions.placeholder || 'Saisir une adresse, un CIDR ou une plage…'" |
| 52 | + removable |
64 | 53 | :disable="!canEdit" |
65 | | - :readonly="isReadonly" |
66 | | - :error="localError !== ''" |
67 | | - :error-message="localError" |
68 | | - @keyup.enter="addEntry" |
69 | | - @update:model-value="localError = ''" |
70 | | - :id="elementId + '-draft'" |
71 | | - v-bind="quasarProps('q-input')" |
| 54 | + :tabindex="-1" |
| 55 | + icon="mdi-ip-network" |
| 56 | + @remove="removeAt(index)" |
72 | 57 | ) |
73 | | - template(#prepend) |
74 | | - q-icon(name="mdi-plus-network-outline" color="grey-6" size="sm") |
75 | | - .col-auto |
76 | | - q-btn.network-list-add-btn( |
77 | | - color="primary" |
78 | | - icon="mdi-plus" |
79 | | - :label="addButtonLabel" |
80 | | - no-caps |
81 | | - padding="sm md" |
82 | | - unelevated |
83 | | - :disable="!canEdit || draftTrimmed === ''" |
84 | | - @click="addEntry" |
85 | | - ) |
86 | | - .text-caption.text-grey-6.q-mt-md.network-list-desc(v-if="control.description") {{ control.description }} |
87 | | - q-banner.network-list-banner-error.text-negative.q-mt-sm( |
88 | | - v-if="control.errors" |
89 | | - dense |
90 | | - inline-actions |
91 | | - rounded |
92 | | - ) |
93 | | - template(#avatar) |
94 | | - q-icon(name="mdi-alert-circle-outline" color="negative") |
95 | | - | {{ control.errors }} |
| 58 | + span.network-list-chip-label {{ item }} |
| 59 | + |
| 60 | + .text-caption.text-grey-6.q-mt-sm.network-list-desc(v-if="control.description") {{ control.description }} |
| 61 | + q-banner.network-list-banner-error.text-negative.q-mt-sm( |
| 62 | + v-if="control.errors" |
| 63 | + dense |
| 64 | + inline-actions |
| 65 | + rounded |
| 66 | + ) |
| 67 | + template(#avatar) |
| 68 | + q-icon(name="mdi-alert-circle-outline" color="negative") |
| 69 | + | {{ control.errors }} |
96 | 70 | </template> |
97 | 71 |
|
98 | 72 | <script lang="ts"> |
99 | 73 | import type { ControlElement } from '@jsonforms/core' |
100 | 74 | import { rendererProps, type RendererProps, useJsonFormsEnumControl } from '@jsonforms/vue' |
101 | | -import { QAvatar, QBanner, QBtn, QCard, QCardSection, QIcon, QInput, QSeparator, QToolbar, QToolbarTitle, QTooltip } from 'quasar' |
| 75 | +import { QBanner, QBtn, QChip, QIcon, QInput } from 'quasar' |
102 | 76 | import { computed, defineComponent, ref } from 'vue' |
103 | 77 | import { ControlWrapper } from '../common' |
104 | 78 | import { createEnumAdaptTarget } from '../composables' |
@@ -134,17 +108,11 @@ export default defineComponent({ |
134 | 108 | name: 'NetworkListControlRenderer', |
135 | 109 | components: { |
136 | 110 | ControlWrapper, |
137 | | - QAvatar, |
138 | 111 | QBanner, |
139 | | - QCard, |
140 | | - QCardSection, |
141 | | - QToolbar, |
142 | | - QToolbarTitle, |
143 | | - QSeparator, |
| 112 | + QChip, |
144 | 113 | QIcon, |
145 | 114 | QBtn, |
146 | 115 | QInput, |
147 | | - QTooltip, |
148 | 116 | }, |
149 | 117 | props: { |
150 | 118 | ...rendererProps<ControlElement>(), |
@@ -219,37 +187,12 @@ export default defineComponent({ |
219 | 187 | </script> |
220 | 188 |
|
221 | 189 | <style scoped lang="scss"> |
222 | | -.network-list-card { |
223 | | - transition: box-shadow 0.2s ease; |
224 | | -} |
225 | | -
|
226 | | -.network-list-toolbar { |
227 | | - min-height: 52px; |
228 | | - background: rgba(0, 0, 0, 0.02); |
229 | | -} |
230 | | -
|
231 | | -.body--dark .network-list-toolbar { |
232 | | - background: rgba(255, 255, 255, 0.04); |
233 | | -} |
234 | | -
|
235 | | -.network-list-empty { |
236 | | - border: 1px dashed rgba(0, 0, 0, 0.12); |
237 | | - background: rgba(0, 0, 0, 0.02); |
238 | | -} |
239 | | -
|
240 | | -.body--dark .network-list-empty { |
241 | | - border-color: rgba(255, 255, 255, 0.12); |
242 | | - background: rgba(255, 255, 255, 0.04); |
| 190 | +.network-list-field { |
| 191 | + width: 100%; |
243 | 192 | } |
244 | 193 |
|
245 | 194 | .network-list-chip { |
246 | | - border: 1px solid rgba(0, 0, 0, 0.08); |
247 | | - background: rgba(25, 118, 210, 0.06); |
248 | | -} |
249 | | -
|
250 | | -.body--dark .network-list-chip { |
251 | | - border-color: rgba(255, 255, 255, 0.1); |
252 | | - background: rgba(100, 181, 246, 0.08); |
| 195 | + max-width: 100%; |
253 | 196 | } |
254 | 197 |
|
255 | 198 | .network-list-chip-label { |
|
0 commit comments