@7365admin1/layer-common 3.2.2-staging.124 → 3.2.2-staging.125

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,16 +1,11 @@
1
1
  <template>
2
- <v-card width="100%">
3
- <v-toolbar>
4
- <v-row no-gutters class="fill-height px-6" align="center">
5
- <span class="font-weight-bold text-h5">Create Role</span>
6
- <v-spacer />
7
- <v-btn icon density="comfortable" @click="cancel">
8
- <v-icon>mdi-close</v-icon>
9
- </v-btn>
10
- </v-row>
11
- </v-toolbar>
12
-
13
- <v-card-text style="max-height: 75vh; overflow-y: auto">
2
+ <v-card width="100%" class="screen-modal role-create">
3
+ <div class="role-create__head">
4
+ <v-card-title>Create Role</v-card-title>
5
+ <AppButton variant="icon" icon="mdi-close" aria-label="Close" @click="cancel" />
6
+ </div>
7
+
8
+ <div class="screen-modal__body role-create__body filter-field">
14
9
  <v-form v-model="validForm" :disabled="disable">
15
10
  <v-row no-gutters>
16
11
  <v-col cols="12" class="mt-2">
@@ -42,31 +37,30 @@
42
37
  </v-col>
43
38
 
44
39
  <v-col cols="12" class="mt-3">
45
- <div class="d-flex align-center ga-4 text-caption">
40
+ <div class="role-create__legend">
46
41
  <span class="d-flex align-center ga-2">
47
- <v-icon color="amber-darken-2" size="14">mdi-circle</v-icon>
42
+ <v-icon class="role-create__dot--both" size="14">mdi-circle</v-icon>
48
43
  Web and Mobile
49
44
  </span>
50
45
  <span class="d-flex align-center ga-2">
51
- <v-icon color="blue-darken-2" size="14">mdi-circle</v-icon>
46
+ <v-icon class="role-create__dot--web" size="14">mdi-circle</v-icon>
52
47
  Web only
53
48
  </span>
54
49
  </div>
55
50
  </v-col>
56
51
 
57
52
  <v-col cols="12" class="mt-2">
58
- <v-btn
59
- size="small"
60
- variant="tonal"
61
- class="text-none mb-2"
53
+ <AppButton
54
+ variant="ghost"
55
+ class="mb-2"
62
56
  @click="() => toggleSelectAll(!isAllSelected)"
63
57
  >
64
58
  {{ isAllSelected ? "Unselect All" : "Select All" }}
65
- </v-btn>
59
+ </AppButton>
66
60
  </v-col>
67
61
 
68
62
  <v-col cols="12" class="mt-3">
69
- <v-card variant="outlined" border="thin" rounded="lg">
63
+ <div class="role-create__list">
70
64
  <template
71
65
  v-for="(actions, resourceKey, resourceIndex) in safePermissions"
72
66
  :key="resourceKey"
@@ -76,19 +70,15 @@
76
70
  <!-- Category row -->
77
71
  <v-list-item density="compact" :ripple="false">
78
72
  <template #prepend>
79
- <v-chip
73
+ <StatusChip
80
74
  class="mr-3"
81
- size="small"
82
- label
83
- :color="resourceColor(String(resourceKey))"
84
- >
85
- {{ selectedActionCount(String(resourceKey)) }}
86
- </v-chip>
75
+ :dot="false"
76
+ :tone="isWebOnly(String(resourceKey)) ? 'info' : 'warn'"
77
+ :label="String(selectedActionCount(String(resourceKey)))"
78
+ />
87
79
  </template>
88
80
  <v-list-item-title>
89
- <span
90
- class="text-capitalize text-subtitle-2 font-weight-medium"
91
- >
81
+ <span class="text-capitalize role-create__row-title">
92
82
  {{ formatResourceLabel(String(resourceKey)) }}
93
83
  </span>
94
84
  </v-list-item-title>
@@ -98,7 +88,7 @@
98
88
  @update:model-value="
99
89
  toggleCategory(String(resourceKey), $event)
100
90
  "
101
- color="green"
91
+ color="accent"
102
92
  density="compact"
103
93
  hide-details
104
94
  inset
@@ -128,72 +118,41 @@
128
118
  $event
129
119
  )
130
120
  "
131
- color="primary"
121
+ color="accent"
132
122
  density="compact"
133
123
  class="mr-2"
134
124
  />
135
125
  </template>
136
126
  <v-list-item-title
137
- class="text-subtitle-2 font-weight-medium text-capitalize"
127
+ class="text-capitalize role-create__row-title"
138
128
  >
139
129
  {{ String(actionKey).replace(/-/g, " ") }}
140
130
  </v-list-item-title>
141
- <v-list-item-subtitle class="text-caption">
131
+ <v-list-item-subtitle class="role-create__row-sub">
142
132
  {{ action.description }}
143
133
  </v-list-item-subtitle>
144
134
  </v-list-item>
145
135
  </template>
146
136
  </template>
147
137
  </template>
148
- </v-card>
138
+ </div>
149
139
  </v-col>
150
140
 
151
141
  <v-col cols="12" class="my-2">
152
142
  <v-row no-gutters>
153
143
  <v-col cols="12" class="text-center">
154
- <span
155
- class="text-none text-subtitle-2 font-weight-medium text-error"
156
- >
157
- {{ message }}
158
- </span>
144
+ <span class="role-create__error">{{ message }}</span>
159
145
  </v-col>
160
146
  </v-row>
161
147
  </v-col>
162
148
  </v-row>
163
149
  </v-form>
164
- </v-card-text>
165
-
166
- <v-toolbar class="pa-0" density="compact">
167
- <v-row no-gutters>
168
- <v-col cols="6" class="pa-0">
169
- <v-btn
170
- block
171
- variant="text"
172
- class="text-none"
173
- size="large"
174
- height="48"
175
- @click="cancel"
176
- >
177
- {{ props.cancelText }}
178
- </v-btn>
179
- </v-col>
180
-
181
- <v-col cols="6" class="pa-0">
182
- <v-btn
183
- block
184
- variant="flat"
185
- color="black"
186
- class="text-none font-weight-bold rounded-0"
187
- height="48"
188
- :disabled="!validForm"
189
- :loading="disable"
190
- @click="submit"
191
- >
192
- Submit
193
- </v-btn>
194
- </v-col>
195
- </v-row>
196
- </v-toolbar>
150
+ </div>
151
+
152
+ <div class="role-create__footer">
153
+ <AppButton variant="ghost" @click="cancel">{{ props.cancelText }}</AppButton>
154
+ <AppButton :disabled="!validForm || disable" @click="submit">Submit</AppButton>
155
+ </div>
197
156
  </v-card>
198
157
  </template>
199
158
 
@@ -259,10 +218,8 @@ function formatResourceLabel(key: string): string {
259
218
  return props.webOnlyResources.includes(key) ? `${label} (Web Only)` : label;
260
219
  }
261
220
 
262
- function resourceColor(resource: string) {
263
- return props.webOnlyResources.includes(resource)
264
- ? "blue-darken-2"
265
- : "amber-darken-2";
221
+ function isWebOnly(resource: string) {
222
+ return props.webOnlyResources.includes(resource);
266
223
  }
267
224
 
268
225
  function isCategoryEnabled(resource: string) {
@@ -406,3 +363,72 @@ const isAllSelected = computed(() => {
406
363
  );
407
364
  });
408
365
  </script>
366
+
367
+ <style scoped>
368
+ .role-create__head {
369
+ display: flex;
370
+ align-items: center;
371
+ justify-content: space-between;
372
+ padding-right: 12px;
373
+ }
374
+
375
+ .role-create__body {
376
+ padding: 0 20px;
377
+ max-height: calc(100vh - 160px);
378
+ }
379
+
380
+ .role-create__legend {
381
+ display: flex;
382
+ align-items: center;
383
+ gap: 16px;
384
+ font-size: var(--fs-breadcrumb);
385
+ color: var(--text2);
386
+ }
387
+
388
+ /* Were `amber-darken-2` / `blue-darken-2` - fixed Vuetify hues that do not
389
+ follow the theme, and the same two the count chip used. Design tones now,
390
+ and the dot and the chip read the same `isWebOnly`, so they cannot drift. */
391
+ .role-create__dot--both {
392
+ color: var(--warn);
393
+ }
394
+
395
+ .role-create__dot--web {
396
+ color: var(--info);
397
+ }
398
+
399
+ /* Was a `variant="outlined"` v-card inside the card - a card on a card. It is
400
+ the list frame, so it takes the design's border and radius and no second
401
+ surface. */
402
+ .role-create__list {
403
+ border: 1px solid var(--border);
404
+ border-radius: var(--r-card);
405
+ overflow: hidden;
406
+ }
407
+
408
+ .role-create__row-title {
409
+ font-size: var(--fs-cell);
410
+ font-weight: var(--fw-cell);
411
+ color: var(--text);
412
+ }
413
+
414
+ .role-create__row-sub {
415
+ font-size: var(--fs-breadcrumb) !important;
416
+ color: var(--text2);
417
+ }
418
+
419
+ .role-create__error {
420
+ font-size: var(--fs-cell);
421
+ font-weight: 600;
422
+ color: var(--err);
423
+ }
424
+
425
+ /* The design's dialog footer. Deliberately not the shared
426
+ `.screen-modal__footer` - that class is on the batch-D branch (#1150), not
427
+ on this base, and a second copy in `screens.css` would collide with it. */
428
+ .role-create__footer {
429
+ display: flex;
430
+ justify-content: flex-end;
431
+ gap: 8px;
432
+ padding: 16px 20px 20px;
433
+ }
434
+ </style>
@@ -1,36 +1,31 @@
1
1
  <template>
2
- <v-card width="100%">
3
- <v-toolbar>
4
- <v-row no-gutters class="fill-height px-6" align="center">
5
- <span class="font-weight-bold text-h5">
6
- {{ props.name }}
7
- </span>
8
- </v-row>
9
- </v-toolbar>
10
- <v-card-text style="max-height: 100vh; overflow-y: auto" class="pb-0">
2
+ <v-card width="100%" class="screen-modal role-perm">
3
+ <div class="role-perm__head">
4
+ <v-card-title>{{ props.name }}</v-card-title>
5
+ </div>
6
+ <div class="screen-modal__body role-perm__body">
11
7
  <v-form v-model="validForm" :disabled="disable">
12
8
  <v-row no-gutters>
13
9
  <v-col cols="12" class="mt-4">
14
- <div class="d-flex align-center ga-4 text-caption mb-3">
10
+ <div class="role-perm__legend">
15
11
  <span class="d-flex align-center ga-2">
16
- <v-icon color="amber-darken-2" size="14">mdi-circle</v-icon>
12
+ <v-icon class="role-perm__dot--both" size="14">mdi-circle</v-icon>
17
13
  Web and Mobile
18
14
  </span>
19
15
  <span class="d-flex align-center ga-2">
20
- <v-icon color="blue-darken-2" size="14">mdi-circle</v-icon>
16
+ <v-icon class="role-perm__dot--web" size="14">mdi-circle</v-icon>
21
17
  Web only
22
18
  </span>
23
19
  </div>
24
- <v-btn
20
+ <AppButton
25
21
  v-if="edit"
26
- size="small"
27
- variant="tonal"
28
- class="text-none mb-2"
22
+ variant="ghost"
23
+ class="mb-2"
29
24
  @click="toggleSelectAll(!isAllSelected)"
30
25
  >
31
26
  {{ isAllSelected ? "Unselect All" : "Select All" }}
32
- </v-btn>
33
- <v-card variant="outlined" border="thin" rounded="lg">
27
+ </AppButton>
28
+ <div class="role-perm__list">
34
29
  <template
35
30
  v-for="(actions, resourceKey, resourceIndex) in safePermissions"
36
31
  :key="resourceKey"
@@ -38,25 +33,21 @@
38
33
  <v-divider v-if="resourceIndex > 0" />
39
34
  <v-list-item density="compact" :ripple="false">
40
35
  <template #prepend>
41
- <v-chip
36
+ <StatusChip
42
37
  class="mr-3"
43
- size="small"
44
- label
45
- :color="resourceColor(String(resourceKey))"
46
- >
47
- {{ selectedActionCount(String(resourceKey)) }}
48
- </v-chip>
38
+ :dot="false"
39
+ :tone="isWebOnly(String(resourceKey)) ? 'info' : 'warn'"
40
+ :label="String(selectedActionCount(String(resourceKey)))"
41
+ />
49
42
  </template>
50
- <v-list-item-title
51
- class="text-capitalize text-subtitle-2 font-weight-medium"
52
- >
43
+ <v-list-item-title class="text-capitalize role-perm__row-title">
53
44
  {{ formatResourceLabel(String(resourceKey)) }}
54
45
  </v-list-item-title>
55
46
  <template #append>
56
47
  <v-switch
57
48
  :model-value="isCategoryEnabled(String(resourceKey))"
58
49
  :disabled="!edit"
59
- color="green"
50
+ color="accent"
60
51
  density="compact"
61
52
  hide-details
62
53
  inset
@@ -81,7 +72,7 @@
81
72
  )
82
73
  "
83
74
  :disabled="!edit"
84
- color="primary"
75
+ color="accent"
85
76
  density="compact"
86
77
  class="mr-2"
87
78
  @update:model-value="
@@ -93,20 +84,18 @@
93
84
  "
94
85
  />
95
86
  </template>
96
- <v-list-item-title
97
- class="text-subtitle-2 font-weight-medium text-capitalize"
98
- >
87
+ <v-list-item-title class="text-capitalize role-perm__row-title">
99
88
  {{ String(actionKey).replace(/-/g, " ") }}
100
89
  </v-list-item-title>
101
- <v-list-item-subtitle class="text-caption">
90
+ <v-list-item-subtitle class="role-perm__row-sub">
102
91
  {{ action.description }}
103
92
  </v-list-item-subtitle>
104
93
  </v-list-item>
105
94
  </template>
106
95
  </template>
107
96
  </template>
108
- </v-card>
109
- <div v-if="errorMessages" class="text-caption text-error mt-2">
97
+ </div>
98
+ <div v-if="errorMessages" class="role-perm__error mt-2">
110
99
  {{ errorMessages }}
111
100
  </div>
112
101
  </v-col>
@@ -114,11 +103,7 @@
114
103
  <v-col v-if="edit" cols="12" class="my-2">
115
104
  <v-row no-gutters>
116
105
  <v-col cols="12" class="text-center">
117
- <span
118
- class="text-none text-subtitle-2 font-weight-medium text-error"
119
- >
120
- {{ message }}
121
- </span>
106
+ <span class="role-perm__error">{{ message }}</span>
122
107
  </v-col>
123
108
  </v-row>
124
109
  </v-col>
@@ -126,74 +111,23 @@
126
111
  <v-col cols="12" class="my-2">
127
112
  <v-row no-gutters>
128
113
  <v-col cols="12" class="text-center">
129
- <span
130
- class="text-none text-subtitle-2 font-weight-medium text-error"
131
- >
132
- {{ message }}
133
- </span>
114
+ <span class="role-perm__error">{{ message }}</span>
134
115
  </v-col>
135
116
  </v-row>
136
117
  </v-col>
137
118
  </v-row>
138
119
  </v-form>
139
- </v-card-text>
140
-
141
- <v-toolbar>
142
- <v-row class="px-6">
143
- <v-col v-if="!edit" cols="6">
144
- <v-btn
145
- block
146
- variant="text"
147
- class="text-none"
148
- size="large"
149
- @click="emit('cancel')"
150
- >
151
- Close
152
- </v-btn>
153
- </v-col>
154
-
155
- <v-col v-else cols="6">
156
- <v-btn
157
- block
158
- variant="text"
159
- class="text-none"
160
- size="large"
161
- @click="edit = false"
162
- >
163
- Cancel
164
- </v-btn>
165
- </v-col>
166
-
167
- <v-col v-if="!edit" cols="6">
168
- <v-btn
169
- block
170
- variant="flat"
171
- color="black"
172
- class="text-none"
173
- size="large"
174
- :disabled="disable"
175
- @click="edit = true"
176
- >
177
- Edit
178
- </v-btn>
179
- </v-col>
180
-
181
- <v-col v-else cols="6">
182
- <v-btn
183
- block
184
- variant="flat"
185
- color="black"
186
- class="text-none"
187
- size="large"
188
- :disabled="Boolean(errorMessages) || disable"
189
- :loading="disable"
190
- @click="submit()"
191
- >
192
- Submit
193
- </v-btn>
194
- </v-col>
195
- </v-row>
196
- </v-toolbar>
120
+ </div>
121
+
122
+ <div class="role-perm__footer">
123
+ <AppButton v-if="!edit" variant="ghost" @click="emit('cancel')">Close</AppButton>
124
+ <AppButton v-else variant="ghost" @click="edit = false">Cancel</AppButton>
125
+
126
+ <AppButton v-if="!edit" :disabled="disable" @click="edit = true">Edit</AppButton>
127
+ <AppButton v-else :disabled="Boolean(errorMessages) || disable" @click="submit()">
128
+ Submit
129
+ </AppButton>
130
+ </div>
197
131
  </v-card>
198
132
  </template>
199
133
 
@@ -242,10 +176,8 @@ function formatResourceLabel(key: string) {
242
176
  return props.webOnlyResources.includes(key) ? `${label} (Web Only)` : label;
243
177
  }
244
178
 
245
- function resourceColor(resource: string) {
246
- return props.webOnlyResources.includes(resource)
247
- ? "blue-darken-2"
248
- : "amber-darken-2";
179
+ function isWebOnly(resource: string) {
180
+ return props.webOnlyResources.includes(resource);
249
181
  }
250
182
 
251
183
  function selectedActionCount(resource: string) {
@@ -357,3 +289,74 @@ async function submit() {
357
289
  }
358
290
  }
359
291
  </script>
292
+
293
+ <style scoped>
294
+ .role-perm__head {
295
+ display: flex;
296
+ align-items: center;
297
+ justify-content: space-between;
298
+ padding-right: 12px;
299
+ }
300
+
301
+ .role-perm__body {
302
+ padding: 0 20px;
303
+ max-height: calc(100vh - 160px);
304
+ }
305
+
306
+ .role-perm__legend {
307
+ display: flex;
308
+ align-items: center;
309
+ gap: 16px;
310
+ margin-bottom: 12px;
311
+ font-size: var(--fs-breadcrumb);
312
+ color: var(--text2);
313
+ }
314
+
315
+ /* The two legend dots carried `amber-darken-2` and `blue-darken-2` - fixed
316
+ Vuetify hues that do not follow the theme, and the same two hues the count
317
+ chip beside each row used. Both are the design's tones now, and the chip and
318
+ the dot stay in step because they read the same `isWebOnly`. */
319
+ .role-perm__dot--both {
320
+ color: var(--warn);
321
+ }
322
+
323
+ .role-perm__dot--web {
324
+ color: var(--info);
325
+ }
326
+
327
+ /* Was a `variant="outlined"` v-card, i.e. a card inside a card. It is the list
328
+ frame, so it takes the design's card border and radius without laying a
329
+ second surface over the first. */
330
+ .role-perm__list {
331
+ border: 1px solid var(--border);
332
+ border-radius: var(--r-card);
333
+ overflow: hidden;
334
+ }
335
+
336
+ .role-perm__row-title {
337
+ font-size: var(--fs-cell) !important;
338
+ font-weight: var(--fw-cell) !important;
339
+ color: var(--text);
340
+ }
341
+
342
+ .role-perm__row-sub {
343
+ font-size: var(--fs-breadcrumb) !important;
344
+ color: var(--text2);
345
+ }
346
+
347
+ .role-perm__error {
348
+ font-size: var(--fs-cell);
349
+ font-weight: 600;
350
+ color: var(--err);
351
+ }
352
+
353
+ /* The design's dialog footer. Deliberately not the shared
354
+ `.screen-modal__footer` - that class is on the batch-D branch (#1150), not
355
+ on this base, and a second copy in `screens.css` would collide with it. */
356
+ .role-perm__footer {
357
+ display: flex;
358
+ justify-content: flex-end;
359
+ gap: 8px;
360
+ padding: 16px 20px 20px;
361
+ }
362
+ </style>