@vmz/ui 0.3.7 → 0.3.9
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/README.md +2 -0
- package/contracts/token-requirements.v0.json +58 -1
- package/package.json +5 -2
- package/presets/web-surface.v0.json +14 -12
- package/src/components/Accordion.vmz +49 -16
- package/src/components/Alert.vmz +125 -28
- package/src/components/AppShell.vmz +121 -56
- package/src/components/Autocomplete.vmz +136 -29
- package/src/components/Avatar.vmz +20 -12
- package/src/components/Badge.vmz +18 -26
- package/src/components/Breadcrumb.vmz +28 -14
- package/src/components/BulkActions.vmz +13 -8
- package/src/components/Button.vmz +68 -44
- package/src/components/Callout.vmz +128 -27
- package/src/components/Card.vmz +67 -46
- package/src/components/Checkbox.vmz +81 -5
- package/src/components/CodeBlock.vmz +59 -27
- package/src/components/Collapse.vmz +64 -11
- package/src/components/ConsoleShell.vmz +249 -69
- package/src/components/Content.vmz +15 -1
- package/src/components/DataTable.vmz +123 -23
- package/src/components/DatePicker.vmz +171 -79
- package/src/components/Descriptions.vmz +90 -0
- package/src/components/Dialog.vmz +133 -50
- package/src/components/Divider.vmz +8 -1
- package/src/components/Drawer.vmz +131 -40
- package/src/components/Dropdown.vmz +147 -49
- package/src/components/Empty.vmz +56 -14
- package/src/components/Field.vmz +78 -23
- package/src/components/FilterBar.vmz +34 -4
- package/src/components/Flex.vmz +3 -1
- package/src/components/Footer.vmz +6 -3
- package/src/components/Form.vmz +41 -0
- package/src/components/FormItem.vmz +2 -3
- package/src/components/Grid.vmz +6 -3
- package/src/components/Header.vmz +193 -6
- package/src/components/Layout.vmz +3 -1
- package/src/components/Link.vmz +20 -9
- package/src/components/List.vmz +35 -13
- package/src/components/Menu.vmz +198 -25
- package/src/components/Message.vmz +167 -0
- package/src/components/Notification.vmz +132 -37
- package/src/components/Pagination.vmz +186 -20
- package/src/components/Popconfirm.vmz +287 -0
- package/src/components/Popover.vmz +152 -34
- package/src/components/Progress.vmz +16 -5
- package/src/components/Prose.vmz +131 -32
- package/src/components/QueryForm.vmz +31 -9
- package/src/components/RadioGroup.vmz +91 -11
- package/src/components/Result.vmz +60 -27
- package/src/components/Segmented.vmz +46 -11
- package/src/components/Select.vmz +174 -87
- package/src/components/Sider.vmz +120 -7
- package/src/components/Skeleton.vmz +9 -7
- package/src/components/Space.vmz +9 -3
- package/src/components/Spinner.vmz +5 -4
- package/src/components/Steps.vmz +40 -25
- package/src/components/Switch.vmz +48 -15
- package/src/components/Table.vmz +130 -25
- package/src/components/Tabs.vmz +28 -13
- package/src/components/Tag.vmz +29 -12
- package/src/components/TextArea.vmz +32 -25
- package/src/components/Timeline.vmz +65 -30
- package/src/components/Toc.vmz +45 -29
- package/src/components/Tooltip.vmz +70 -21
- package/src/components/Tree.vmz +48 -25
- package/src/components/Typography.vmz +23 -8
- package/src/components/Upload.vmz +191 -96
|
@@ -6,9 +6,16 @@
|
|
|
6
6
|
<th scope="col" class="vmz-ui-datatable__check">
|
|
7
7
|
<input type="checkbox" data-vmz-select-all="true" :aria-label="selectAllLabel" :checked="allSelected" class="vmz-ui-datatable__box" />
|
|
8
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
|
-
|
|
9
|
+
<th v-for="col in columns" :key="col.id" scope="col" :data-vmz-col="col.id" :data-align="columnAlign(col)" :aria-sort="sortAria(col.id)">
|
|
10
|
+
<button type="button" :data-vmz-sort="col.id" :data-active="col.id === sortKey ? 'true' : 'false'" class="vmz-ui-datatable__sort">
|
|
11
|
+
<span class="vmz-ui-datatable__title">
|
|
12
|
+
{{ col.title }}
|
|
13
|
+
</span>
|
|
14
|
+
<span class="vmz-ui-datatable__sort-icon">
|
|
15
|
+
<Icon v-if="col.id === sortKey && sortDir === 'asc'" name="action.sort-asc" size="sm" decorative />
|
|
16
|
+
<Icon v-else-if="col.id === sortKey && sortDir === 'desc'" name="action.sort-desc" size="sm" decorative />
|
|
17
|
+
<Icon v-else name="action.sort" size="sm" decorative />
|
|
18
|
+
</span>
|
|
12
19
|
</button>
|
|
13
20
|
</th>
|
|
14
21
|
<th v-if="hasRowAction" scope="col">
|
|
@@ -21,7 +28,7 @@
|
|
|
21
28
|
<td class="vmz-ui-datatable__check">
|
|
22
29
|
<input type="checkbox" :data-vmz-select="row.id" :aria-label="row.selectLabel" :checked="row.selected" class="vmz-ui-datatable__box" />
|
|
23
30
|
</td>
|
|
24
|
-
<td v-for="cell in row.cells">
|
|
31
|
+
<td v-for="(cell, index) in row.cells" :key="index" :data-align="cellAlign(index, cell)">
|
|
25
32
|
{{ cell }}
|
|
26
33
|
</td>
|
|
27
34
|
<td v-if="hasRowAction">
|
|
@@ -37,9 +44,10 @@
|
|
|
37
44
|
<style>
|
|
38
45
|
.vmz-ui-datatable-wrap {
|
|
39
46
|
max-height: 16rem;
|
|
47
|
+
margin-bottom: 1rem;
|
|
40
48
|
overflow: auto;
|
|
41
49
|
border: 1px solid var(--vmz-line-default);
|
|
42
|
-
border-radius: var(--vmz-radius-
|
|
50
|
+
border-radius: var(--vmz-radius-lg, 8px);
|
|
43
51
|
background: var(--vmz-surface-paper);
|
|
44
52
|
color: var(--vmz-text-ink);
|
|
45
53
|
}
|
|
@@ -48,35 +56,70 @@
|
|
|
48
56
|
width: 100%;
|
|
49
57
|
border-collapse: collapse;
|
|
50
58
|
font: inherit;
|
|
59
|
+
font-size: 0.875rem;
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
.vmz-ui-datatable th,
|
|
54
63
|
.vmz-ui-datatable td {
|
|
55
|
-
|
|
64
|
+
height: 3rem;
|
|
65
|
+
padding: 0 1rem;
|
|
56
66
|
text-align: left;
|
|
57
|
-
border-bottom: 1px solid var(--vmz-line-default);
|
|
58
67
|
vertical-align: middle;
|
|
68
|
+
border: 0;
|
|
69
|
+
border-bottom: 1px solid var(--vmz-line-subtle);
|
|
70
|
+
white-space: nowrap;
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
.vmz-ui-datatable thead th {
|
|
62
74
|
position: sticky;
|
|
63
75
|
top: 0;
|
|
64
76
|
z-index: 1;
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
height: 2.75rem;
|
|
78
|
+
font-size: 0.75rem;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
color: var(--vmz-text-tertiary);
|
|
67
81
|
background: var(--vmz-surface-mist);
|
|
68
|
-
|
|
82
|
+
border-bottom: 0;
|
|
83
|
+
box-shadow: inset 0 -1px 0 var(--vmz-line-subtle);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.vmz-ui-datatable td[data-align="right"],
|
|
87
|
+
.vmz-ui-datatable th[data-align="right"] {
|
|
88
|
+
text-align: right;
|
|
89
|
+
font-variant-numeric: tabular-nums;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.vmz-ui-datatable td[data-align="center"],
|
|
93
|
+
.vmz-ui-datatable th[data-align="center"] {
|
|
94
|
+
text-align: center;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.vmz-ui-datatable tbody tr {
|
|
98
|
+
transition: background-color var(--vmz-motion-control-duration, 150ms)
|
|
99
|
+
var(--vmz-motion-control-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
69
100
|
}
|
|
70
101
|
|
|
71
|
-
.vmz-ui-
|
|
72
|
-
|
|
102
|
+
.vmz-ui-datatable tbody tr:hover {
|
|
103
|
+
background: var(--vmz-surface-fill);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.vmz-ui-datatable tbody tr:last-child td {
|
|
107
|
+
border-bottom: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.vmz-ui-datatable th.vmz-ui-datatable__check,
|
|
111
|
+
.vmz-ui-datatable td.vmz-ui-datatable__check {
|
|
112
|
+
width: 3rem;
|
|
113
|
+
padding-right: 0;
|
|
73
114
|
}
|
|
74
115
|
|
|
75
116
|
.vmz-ui-datatable__box {
|
|
76
117
|
width: 1rem;
|
|
77
118
|
height: 1rem;
|
|
119
|
+
margin: 0;
|
|
78
120
|
accent-color: var(--vmz-action-primary-background);
|
|
79
121
|
outline: none;
|
|
122
|
+
cursor: pointer;
|
|
80
123
|
}
|
|
81
124
|
|
|
82
125
|
.vmz-ui-datatable__box:focus-visible {
|
|
@@ -84,34 +127,75 @@
|
|
|
84
127
|
}
|
|
85
128
|
|
|
86
129
|
.vmz-ui-datatable tr[data-selected="true"] {
|
|
87
|
-
background:
|
|
130
|
+
background: var(--vmz-action-primary-soft);
|
|
88
131
|
}
|
|
89
132
|
|
|
90
133
|
.vmz-ui-datatable__sort {
|
|
91
|
-
|
|
92
|
-
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: flex-start;
|
|
137
|
+
gap: 0.25rem;
|
|
138
|
+
width: 100%;
|
|
93
139
|
padding: 0;
|
|
94
140
|
border: 0;
|
|
95
141
|
background: transparent;
|
|
96
142
|
color: inherit;
|
|
143
|
+
font: inherit;
|
|
144
|
+
font-size: 0.75rem;
|
|
145
|
+
font-weight: 600;
|
|
97
146
|
cursor: pointer;
|
|
98
147
|
outline: none;
|
|
148
|
+
border-radius: var(--vmz-radius-xs, 2px);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.vmz-ui-datatable th[data-align="right"] .vmz-ui-datatable__sort {
|
|
152
|
+
justify-content: flex-end;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.vmz-ui-datatable th[data-align="center"] .vmz-ui-datatable__sort {
|
|
156
|
+
justify-content: center;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.vmz-ui-datatable__sort:hover {
|
|
160
|
+
color: var(--vmz-action-primary-background);
|
|
99
161
|
}
|
|
100
162
|
|
|
101
163
|
.vmz-ui-datatable__sort:focus-visible {
|
|
102
164
|
box-shadow: 0 0 0 3px var(--vmz-focus-ring);
|
|
103
165
|
}
|
|
104
166
|
|
|
167
|
+
.vmz-ui-datatable__sort-icon {
|
|
168
|
+
display: inline-flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
color: var(--vmz-text-tertiary);
|
|
171
|
+
font-size: 0.875rem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.vmz-ui-datatable__sort:hover .vmz-ui-datatable__sort-icon,
|
|
175
|
+
.vmz-ui-datatable__sort[data-active="true"] .vmz-ui-datatable__sort-icon {
|
|
176
|
+
color: var(--vmz-action-primary-background);
|
|
177
|
+
}
|
|
178
|
+
|
|
105
179
|
.vmz-ui-datatable__row-action {
|
|
180
|
+
height: 2rem;
|
|
181
|
+
padding: 0 0.5rem;
|
|
106
182
|
font: inherit;
|
|
107
|
-
font-
|
|
108
|
-
|
|
109
|
-
border:
|
|
183
|
+
font-size: 0.875rem;
|
|
184
|
+
font-weight: 500;
|
|
185
|
+
border: 0;
|
|
110
186
|
border-radius: var(--vmz-radius-md, 6px);
|
|
111
187
|
background: transparent;
|
|
112
|
-
color: var(--vmz-action-primary-
|
|
188
|
+
color: var(--vmz-action-primary-background);
|
|
113
189
|
cursor: pointer;
|
|
114
190
|
outline: none;
|
|
191
|
+
transition:
|
|
192
|
+
color var(--vmz-motion-control-duration, 150ms) var(--vmz-motion-control-easing, cubic-bezier(0.4, 0, 0.2, 1)),
|
|
193
|
+
background-color var(--vmz-motion-control-duration, 150ms) var(--vmz-motion-control-easing, cubic-bezier(0.4, 0, 0.2, 1));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.vmz-ui-datatable__row-action:hover:not(:disabled) {
|
|
197
|
+
background: var(--vmz-action-primary-soft);
|
|
198
|
+
color: var(--vmz-action-primary-hover);
|
|
115
199
|
}
|
|
116
200
|
|
|
117
201
|
.vmz-ui-datatable__row-action:focus-visible {
|
|
@@ -121,6 +205,7 @@
|
|
|
121
205
|
.vmz-ui-datatable__row-action:disabled {
|
|
122
206
|
opacity: 0.55;
|
|
123
207
|
cursor: not-allowed;
|
|
208
|
+
color: var(--vmz-text-tertiary);
|
|
124
209
|
}
|
|
125
210
|
</style>
|
|
126
211
|
<script client>
|
|
@@ -130,10 +215,11 @@
|
|
|
130
215
|
* Large-grid features live outside this package.
|
|
131
216
|
*/
|
|
132
217
|
export default class DataTable {
|
|
133
|
-
/** @type {{ id: string, title: string }[]} */
|
|
218
|
+
/** @type {{ id: string, title: string, align?: string }[]} */
|
|
134
219
|
public columns: {
|
|
135
220
|
id: string;
|
|
136
221
|
title: string;
|
|
222
|
+
align?: string;
|
|
137
223
|
}[] = [];
|
|
138
224
|
/**
|
|
139
225
|
* @type {{
|
|
@@ -153,17 +239,31 @@ export default class DataTable {
|
|
|
153
239
|
}[] = [];
|
|
154
240
|
public hasRowAction: boolean = false;
|
|
155
241
|
public rowActionDisabled: boolean = false;
|
|
156
|
-
public actionTitle: string = "
|
|
157
|
-
public actionLabel: string = "
|
|
242
|
+
public actionTitle: string = "";
|
|
243
|
+
public actionLabel: string = "";
|
|
158
244
|
public sortKey: string = "";
|
|
159
245
|
public sortDir: string = "asc";
|
|
160
246
|
public selectedCount: string = "0";
|
|
161
247
|
public allSelected: boolean = false;
|
|
162
|
-
public selectAllLabel: string = "
|
|
248
|
+
public selectAllLabel: string = "";
|
|
163
249
|
public onRowAction: ((rowId: string) => void) | null = null;
|
|
164
250
|
public onSort: ((columnId: string) => void) | null = null;
|
|
165
251
|
public onToggleRow: ((rowId: string) => void) | null = null;
|
|
166
252
|
public onToggleAll: (() => void) | null = null;
|
|
253
|
+
columnAlign(col) {
|
|
254
|
+
return col && col.align ? col.align : "left";
|
|
255
|
+
}
|
|
256
|
+
cellAlign(index, cell) {
|
|
257
|
+
const col = (this.columns || [])[index];
|
|
258
|
+
if (col && col.align) return col.align;
|
|
259
|
+
const text = String(cell == null ? "" : cell).trim();
|
|
260
|
+
if (!text) return "left";
|
|
261
|
+
return /^[-+]?[\d.,%]+$/.test(text) ? "right" : "left";
|
|
262
|
+
}
|
|
263
|
+
sortAria(id) {
|
|
264
|
+
if (id !== this.sortKey) return null;
|
|
265
|
+
return this.sortDir === "desc" ? "descending" : "ascending";
|
|
266
|
+
}
|
|
167
267
|
onBodyClick(ev) {
|
|
168
268
|
const t = ev && ev.target;
|
|
169
269
|
if (!t || typeof t.closest !== "function") return;
|