@vmz/ui 0.2.3 → 0.2.5
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.
- package/package.json +1 -1
- package/src/components/Accordion.vmz +46 -63
- package/src/components/Alert.vmz +35 -38
- package/src/components/AppShell.vmz +92 -75
- package/src/components/Autocomplete.vmz +91 -119
- package/src/components/Avatar.vmz +37 -8
- package/src/components/Badge.vmz +29 -23
- package/src/components/Breadcrumb.vmz +36 -34
- package/src/components/BulkActions.vmz +22 -28
- package/src/components/Button.vmz +139 -121
- package/src/components/Callout.vmz +33 -36
- package/src/components/Card.vmz +68 -51
- package/src/components/Checkbox.vmz +28 -47
- package/src/components/CodeBlock.vmz +31 -25
- package/src/components/Collapse.vmz +34 -16
- package/src/components/ConsoleShell.vmz +107 -110
- package/src/components/Content.vmz +8 -4
- package/src/components/DataTable.vmz +124 -150
- package/src/components/DatePicker.vmz +526 -521
- package/src/components/Dialog.vmz +408 -327
- package/src/components/Divider.vmz +38 -11
- package/src/components/Drawer.vmz +325 -318
- package/src/components/Dropdown.vmz +53 -19
- package/src/components/Empty.vmz +23 -21
- package/src/components/Field.vmz +77 -83
- package/src/components/FilterBar.vmz +8 -10
- package/src/components/Flex.vmz +21 -6
- package/src/components/Footer.vmz +9 -4
- package/src/components/Form.vmz +35 -46
- package/src/components/FormItem.vmz +44 -43
- package/src/components/Grid.vmz +22 -6
- package/src/components/Header.vmz +11 -4
- package/src/components/Icon.vmz +43 -44
- package/src/components/Layout.vmz +9 -4
- package/src/components/Link.vmz +17 -25
- package/src/components/List.vmz +62 -75
- package/src/components/Menu.vmz +182 -197
- package/src/components/Notification.vmz +35 -38
- package/src/components/Pagination.vmz +37 -47
- package/src/components/Popover.vmz +157 -171
- package/src/components/Progress.vmz +36 -10
- package/src/components/Prose.vmz +29 -31
- package/src/components/QueryForm.vmz +14 -22
- package/src/components/RadioGroup.vmz +70 -84
- package/src/components/Result.vmz +36 -38
- package/src/components/Segmented.vmz +43 -22
- package/src/components/Select.vmz +404 -411
- package/src/components/Sider.vmz +21 -4
- package/src/components/Skeleton.vmz +34 -42
- package/src/components/Space.vmz +24 -9
- package/src/components/Spinner.vmz +17 -23
- package/src/components/Steps.vmz +48 -51
- package/src/components/Switch.vmz +50 -60
- package/src/components/Table.vmz +81 -84
- package/src/components/Tabs.vmz +66 -88
- package/src/components/Tag.vmz +36 -11
- package/src/components/TextArea.vmz +73 -77
- package/src/components/Timeline.vmz +36 -32
- package/src/components/Toc.vmz +31 -37
- package/src/components/Tooltip.vmz +25 -35
- package/src/components/Tree.vmz +127 -144
- package/src/components/Typography.vmz +33 -7
- package/src/components/Upload.vmz +1135 -1057
|
@@ -1,89 +1,64 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
<td class="vmz-ui-datatable__check">
|
|
37
|
-
<input
|
|
38
|
-
type="checkbox"
|
|
39
|
-
class="vmz-ui-datatable__box"
|
|
40
|
-
:data-vmz-select="row.id"
|
|
41
|
-
:aria-label="row.selectLabel"
|
|
42
|
-
:checked="row.selected"
|
|
43
|
-
/>
|
|
44
|
-
</td>
|
|
45
|
-
<td v-for="cell in row.cells">{{ cell }}</td>
|
|
46
|
-
<td v-if="hasRowAction">
|
|
47
|
-
<button
|
|
48
|
-
type="button"
|
|
49
|
-
class="vmz-ui-datatable__row-action"
|
|
50
|
-
:data-vmz-row-action="row.id"
|
|
51
|
-
:disabled="rowActionDisabled"
|
|
52
|
-
>
|
|
53
|
-
{{ actionLabel }}
|
|
54
|
-
</button>
|
|
55
|
-
</td>
|
|
56
|
-
</tr>
|
|
57
|
-
</tbody>
|
|
58
|
-
</table>
|
|
2
|
+
<div data-vmz-ui="data-table" :data-sort-key="sortKey" :data-sort-dir="sortDir" :data-selected-count="selectedCount" class="vmz-ui-datatable-wrap">
|
|
3
|
+
<table class="vmz-ui-datatable">
|
|
4
|
+
<thead @click="onHeadClick">
|
|
5
|
+
<tr>
|
|
6
|
+
<th scope="col" class="vmz-ui-datatable__check">
|
|
7
|
+
<input type="checkbox" data-vmz-select-all="true" :aria-label="selectAllLabel" :checked="allSelected" class="vmz-ui-datatable__box" />
|
|
8
|
+
</th>
|
|
9
|
+
<th v-for="col in columns" :key="col.id" scope="col" :data-vmz-col="col.id">
|
|
10
|
+
<button type="button" :data-vmz-sort="col.id" class="vmz-ui-datatable__sort">
|
|
11
|
+
{{ col.title }}
|
|
12
|
+
</button>
|
|
13
|
+
</th>
|
|
14
|
+
<th v-if="hasRowAction" scope="col">
|
|
15
|
+
{{ actionTitle }}
|
|
16
|
+
</th>
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
<tbody @click="onBodyClick">
|
|
20
|
+
<tr v-for="row in rows" :key="row.id" :data-vmz-row="row.id" :data-selected="row.selectedAttr">
|
|
21
|
+
<td class="vmz-ui-datatable__check">
|
|
22
|
+
<input type="checkbox" :data-vmz-select="row.id" :aria-label="row.selectLabel" :checked="row.selected" class="vmz-ui-datatable__box" />
|
|
23
|
+
</td>
|
|
24
|
+
<td v-for="cell in row.cells">
|
|
25
|
+
{{ cell }}
|
|
26
|
+
</td>
|
|
27
|
+
<td v-if="hasRowAction">
|
|
28
|
+
<button type="button" :data-vmz-row-action="row.id" :disabled="rowActionDisabled" class="vmz-ui-datatable__row-action">
|
|
29
|
+
{{ actionLabel }}
|
|
30
|
+
</button>
|
|
31
|
+
</td>
|
|
32
|
+
</tr>
|
|
33
|
+
</tbody>
|
|
34
|
+
</table>
|
|
59
35
|
</div>
|
|
60
36
|
</template>
|
|
61
|
-
|
|
62
37
|
<style>
|
|
63
|
-
|
|
38
|
+
.vmz-ui-datatable-wrap {
|
|
64
39
|
max-height: 16rem;
|
|
65
40
|
overflow: auto;
|
|
66
41
|
border: 1px solid var(--vmz-line-default);
|
|
67
42
|
border-radius: var(--vmz-radius-md, 6px);
|
|
68
43
|
background: var(--vmz-surface-paper);
|
|
69
44
|
color: var(--vmz-text-ink);
|
|
70
|
-
|
|
45
|
+
}
|
|
71
46
|
|
|
72
|
-
|
|
47
|
+
.vmz-ui-datatable {
|
|
73
48
|
width: 100%;
|
|
74
49
|
border-collapse: collapse;
|
|
75
50
|
font: inherit;
|
|
76
|
-
|
|
51
|
+
}
|
|
77
52
|
|
|
78
|
-
|
|
79
|
-
|
|
53
|
+
.vmz-ui-datatable th,
|
|
54
|
+
.vmz-ui-datatable td {
|
|
80
55
|
padding: var(--vmz-density-compact-padding-y) var(--vmz-density-compact-padding-x);
|
|
81
56
|
text-align: left;
|
|
82
57
|
border-bottom: 1px solid var(--vmz-line-default);
|
|
83
58
|
vertical-align: middle;
|
|
84
|
-
|
|
59
|
+
}
|
|
85
60
|
|
|
86
|
-
|
|
61
|
+
.vmz-ui-datatable thead th {
|
|
87
62
|
position: sticky;
|
|
88
63
|
top: 0;
|
|
89
64
|
z-index: 1;
|
|
@@ -91,28 +66,28 @@
|
|
|
91
66
|
color: var(--vmz-action-primary-active);
|
|
92
67
|
background: var(--vmz-surface-mist);
|
|
93
68
|
box-shadow: 0 1px 0 var(--vmz-line-default);
|
|
94
|
-
|
|
69
|
+
}
|
|
95
70
|
|
|
96
|
-
|
|
71
|
+
.vmz-ui-datatable__check {
|
|
97
72
|
width: 2.25rem;
|
|
98
|
-
|
|
73
|
+
}
|
|
99
74
|
|
|
100
|
-
|
|
75
|
+
.vmz-ui-datatable__box {
|
|
101
76
|
width: 1rem;
|
|
102
77
|
height: 1rem;
|
|
103
78
|
accent-color: var(--vmz-action-primary-background);
|
|
104
79
|
outline: none;
|
|
105
|
-
|
|
80
|
+
}
|
|
106
81
|
|
|
107
|
-
|
|
82
|
+
.vmz-ui-datatable__box:focus-visible {
|
|
108
83
|
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
109
|
-
|
|
84
|
+
}
|
|
110
85
|
|
|
111
|
-
|
|
86
|
+
.vmz-ui-datatable tr[data-selected="true"] {
|
|
112
87
|
background: color-mix(in srgb, var(--vmz-action-primary-background) 12%, transparent);
|
|
113
|
-
|
|
88
|
+
}
|
|
114
89
|
|
|
115
|
-
|
|
90
|
+
.vmz-ui-datatable__sort {
|
|
116
91
|
font: inherit;
|
|
117
92
|
font-weight: 700;
|
|
118
93
|
padding: 0;
|
|
@@ -121,13 +96,13 @@
|
|
|
121
96
|
color: inherit;
|
|
122
97
|
cursor: pointer;
|
|
123
98
|
outline: none;
|
|
124
|
-
|
|
99
|
+
}
|
|
125
100
|
|
|
126
|
-
|
|
101
|
+
.vmz-ui-datatable__sort:focus-visible {
|
|
127
102
|
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
128
|
-
|
|
103
|
+
}
|
|
129
104
|
|
|
130
|
-
|
|
105
|
+
.vmz-ui-datatable__row-action {
|
|
131
106
|
font: inherit;
|
|
132
107
|
font-weight: 600;
|
|
133
108
|
padding: 0.3rem 0.55rem;
|
|
@@ -137,84 +112,83 @@
|
|
|
137
112
|
color: var(--vmz-action-primary-active);
|
|
138
113
|
cursor: pointer;
|
|
139
114
|
outline: none;
|
|
140
|
-
|
|
115
|
+
}
|
|
141
116
|
|
|
142
|
-
|
|
117
|
+
.vmz-ui-datatable__row-action:focus-visible {
|
|
143
118
|
box-shadow: 0 0 0 2px var(--vmz-focus-ring);
|
|
144
|
-
|
|
119
|
+
}
|
|
145
120
|
|
|
146
|
-
|
|
121
|
+
.vmz-ui-datatable__row-action:disabled {
|
|
147
122
|
opacity: 0.55;
|
|
148
123
|
cursor: not-allowed;
|
|
149
|
-
|
|
124
|
+
}
|
|
150
125
|
</style>
|
|
151
|
-
|
|
152
126
|
<script client>
|
|
153
127
|
/**
|
|
154
|
-
* VMZ UI — DataTable (ordinary Console table).
|
|
155
|
-
* Parent owns rows + selection + sort. Sticky header.
|
|
156
|
-
* Large-grid features live outside this package.
|
|
157
|
-
*/
|
|
128
|
+
* VMZ UI — DataTable (ordinary Console table).
|
|
129
|
+
* Parent owns rows + selection + sort. Sticky header.
|
|
130
|
+
* Large-grid features live outside this package.
|
|
131
|
+
*/
|
|
158
132
|
export default class DataTable {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
133
|
+
/** @type {{ id: string, title: string }[]} */
|
|
134
|
+
public columns: {
|
|
135
|
+
id: string;
|
|
136
|
+
title: string;
|
|
137
|
+
}[] = [];
|
|
138
|
+
/**
|
|
139
|
+
* @type {{
|
|
140
|
+
* id: string,
|
|
141
|
+
* cells: string[],
|
|
142
|
+
* selected: boolean,
|
|
143
|
+
* selectedAttr: string,
|
|
144
|
+
* selectLabel: string
|
|
145
|
+
* }[]}
|
|
146
|
+
*/
|
|
147
|
+
public rows: {
|
|
148
|
+
id: string;
|
|
149
|
+
cells: string[];
|
|
150
|
+
selected: boolean;
|
|
151
|
+
selectedAttr: string;
|
|
152
|
+
selectLabel: string;
|
|
153
|
+
}[] = [];
|
|
154
|
+
public hasRowAction: boolean = false;
|
|
155
|
+
public rowActionDisabled: boolean = false;
|
|
156
|
+
public actionTitle: string = "Action";
|
|
157
|
+
public actionLabel: string = "Open";
|
|
158
|
+
public sortKey: string = "";
|
|
159
|
+
public sortDir: string = "asc";
|
|
160
|
+
public selectedCount: string = "0";
|
|
161
|
+
public allSelected: boolean = false;
|
|
162
|
+
public selectAllLabel: string = "Select all rows";
|
|
163
|
+
public onRowAction: ((rowId: string) => void) | null = null;
|
|
164
|
+
public onSort: ((columnId: string) => void) | null = null;
|
|
165
|
+
public onToggleRow: ((rowId: string) => void) | null = null;
|
|
166
|
+
public onToggleAll: (() => void) | null = null;
|
|
167
|
+
onBodyClick(ev) {
|
|
168
|
+
const t = ev && ev.target;
|
|
169
|
+
if (!t || typeof t.closest !== "function") return;
|
|
170
|
+
const select = t.closest("[data-vmz-select]");
|
|
171
|
+
if (select) {
|
|
172
|
+
const id = select.getAttribute("data-vmz-select");
|
|
173
|
+
if (id && typeof this.onToggleRow === "function") this.onToggleRow(id);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const action = t.closest("[data-vmz-row-action]");
|
|
177
|
+
if (!action || action.disabled) return;
|
|
178
|
+
const id = action.getAttribute("data-vmz-row-action");
|
|
179
|
+
if (id && typeof this.onRowAction === "function") this.onRowAction(id);
|
|
180
|
+
}
|
|
181
|
+
onHeadClick(ev) {
|
|
182
|
+
const t = ev && ev.target;
|
|
183
|
+
if (!t || typeof t.closest !== "function") return;
|
|
184
|
+
if (t.closest("[data-vmz-select-all]")) {
|
|
185
|
+
if (typeof this.onToggleAll === "function") this.onToggleAll();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const sort = t.closest("[data-vmz-sort]");
|
|
189
|
+
if (!sort) return;
|
|
190
|
+
const id = sort.getAttribute("data-vmz-sort");
|
|
191
|
+
if (id && typeof this.onSort === "function") this.onSort(id);
|
|
192
|
+
}
|
|
219
193
|
}
|
|
220
194
|
</script>
|