@vmz/ui 0.1.24 → 0.1.26
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/Autocomplete.vmz +9 -3
- package/src/components/Button.vmz +26 -1
- package/src/components/Checkbox.vmz +4 -2
- package/src/components/CodeBlock.vmz +1 -1
- package/src/components/DataTable.vmz +2 -2
- package/src/components/DatePicker.vmz +10 -6
- package/src/components/Dialog.vmz +5 -3
- package/src/components/Drawer.vmz +5 -3
- package/src/components/Field.vmz +5 -1
- package/src/components/Form.vmz +4 -2
- package/src/components/List.vmz +2 -2
- package/src/components/Menu.vmz +4 -4
- package/src/components/Pagination.vmz +2 -2
- package/src/components/Popover.vmz +4 -3
- package/src/components/QueryForm.vmz +2 -1
- package/src/components/RadioGroup.vmz +2 -1
- package/src/components/Segmented.vmz +1 -0
- package/src/components/Select.vmz +13 -11
- package/src/components/Switch.vmz +3 -2
- package/src/components/Table.vmz +2 -2
- package/src/components/Tabs.vmz +2 -2
- package/src/components/TextArea.vmz +5 -1
- package/src/components/Tree.vmz +2 -2
- package/src/components/Upload.vmz +7 -7
package/package.json
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
:aria-describedby="describedBy"
|
|
20
20
|
:value="value"
|
|
21
21
|
:disabled="disabled"
|
|
22
|
-
@input="
|
|
23
|
-
:onKeyDown="onKeyDown"
|
|
22
|
+
@input="this.onDomInput"
|
|
23
|
+
:onKeyDown="this.onKeyDown"
|
|
24
24
|
/>
|
|
25
25
|
<ul
|
|
26
26
|
v-if="listOpen"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
class="vmz-ui-autocomplete__list"
|
|
29
29
|
role="listbox"
|
|
30
30
|
data-vmz-autocomplete="list"
|
|
31
|
-
@click="onListClick"
|
|
31
|
+
@click="this.onListClick"
|
|
32
32
|
>
|
|
33
33
|
<li
|
|
34
34
|
v-for="opt in options"
|
|
@@ -157,6 +157,10 @@ export default class Autocomplete {
|
|
|
157
157
|
public onInput: ((e: Event) => void) | null = null;
|
|
158
158
|
public onSelect: ((value: string) => void) | null = null;
|
|
159
159
|
public onClose: (() => void) | null = null;
|
|
160
|
+
onDomInput(e: Event) {
|
|
161
|
+
this.emit("input", e);
|
|
162
|
+
if (typeof this.onInput === "function") this.onInput(e);
|
|
163
|
+
}
|
|
160
164
|
onListClick(ev) {
|
|
161
165
|
if (this.disabled) return;
|
|
162
166
|
const t = ev && ev.target;
|
|
@@ -165,11 +169,13 @@ export default class Autocomplete {
|
|
|
165
169
|
if (!opt) return;
|
|
166
170
|
const next = opt.getAttribute("data-vmz-option") || "";
|
|
167
171
|
if (!next) return;
|
|
172
|
+
this.emit("select", next);
|
|
168
173
|
if (typeof this.onSelect === "function") this.onSelect(next);
|
|
169
174
|
}
|
|
170
175
|
onKeyDown(ev) {
|
|
171
176
|
if (!ev || ev.key !== "Escape") return;
|
|
172
177
|
ev.preventDefault();
|
|
178
|
+
this.emit("close");
|
|
173
179
|
if (typeof this.onClose === "function") this.onClose();
|
|
174
180
|
}
|
|
175
181
|
}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<a
|
|
3
|
+
v-if="href"
|
|
4
|
+
class="vmz-ui-btn"
|
|
5
|
+
data-vmz-ui="button"
|
|
6
|
+
data-vmz-motion="control"
|
|
7
|
+
data-vmz-motion-token="motion.control"
|
|
8
|
+
:data-variant="variant"
|
|
9
|
+
:data-size="size"
|
|
10
|
+
:data-block="block ? 'true' : 'false'"
|
|
11
|
+
:href="href"
|
|
12
|
+
:target="target"
|
|
13
|
+
:rel="rel"
|
|
14
|
+
@click="this.onDomClick"
|
|
15
|
+
>
|
|
16
|
+
<span v-if="loading" class="vmz-ui-btn__spinner" aria-hidden="true"></span>
|
|
17
|
+
<slot />
|
|
18
|
+
</a>
|
|
2
19
|
<button
|
|
20
|
+
v-else
|
|
3
21
|
:type="type"
|
|
4
22
|
class="vmz-ui-btn"
|
|
5
23
|
data-vmz-ui="button"
|
|
@@ -11,7 +29,7 @@
|
|
|
11
29
|
:data-loading="loading ? 'true' : 'false'"
|
|
12
30
|
:disabled="disabled"
|
|
13
31
|
:aria-busy="loading ? 'true' : 'false'"
|
|
14
|
-
@click="
|
|
32
|
+
@click="this.onDomClick"
|
|
15
33
|
>
|
|
16
34
|
<span v-if="loading" class="vmz-ui-btn__spinner" aria-hidden="true"></span>
|
|
17
35
|
<slot />
|
|
@@ -144,6 +162,13 @@ export default class Button {
|
|
|
144
162
|
public loading: boolean = false;
|
|
145
163
|
public block: boolean = false;
|
|
146
164
|
public size: string = "middle";
|
|
165
|
+
public href: string = "";
|
|
166
|
+
public target: string = "";
|
|
167
|
+
public rel: string = "";
|
|
147
168
|
public onClick: ((e: Event) => void) | null = null;
|
|
169
|
+
onDomClick(e: Event) {
|
|
170
|
+
this.emit("click", e);
|
|
171
|
+
if (typeof this.onClick === "function") this.onClick(e);
|
|
172
|
+
}
|
|
148
173
|
}
|
|
149
174
|
</script>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:checked="checked"
|
|
8
8
|
:disabled="disabled"
|
|
9
9
|
:aria-describedby="describedBy"
|
|
10
|
-
@click="onToggle"
|
|
10
|
+
@click="this.onToggle"
|
|
11
11
|
/>
|
|
12
12
|
<span class="vmz-ui-checkbox__label">{{ label }}</span>
|
|
13
13
|
</label>
|
|
@@ -64,8 +64,10 @@ export default class Checkbox {
|
|
|
64
64
|
if (this.disabled) return;
|
|
65
65
|
if (ev && typeof ev.preventDefault === "function") ev.preventDefault();
|
|
66
66
|
const next = !this.checked;
|
|
67
|
+
const payload = { target: { checked: next } };
|
|
68
|
+
this.emit("change", payload);
|
|
67
69
|
if (typeof this.onChange === "function") {
|
|
68
|
-
this.onChange(
|
|
70
|
+
this.onChange(payload);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<figure class="vmz-ui-code-block" data-vmz-ui="code-block">
|
|
3
3
|
<div class="vmz-ui-code-block__bar">
|
|
4
4
|
<figcaption v-if="caption" class="vmz-ui-code-block__caption">{{ caption }}</figcaption>
|
|
5
|
-
<Button type="button" variant="ghost" @click="onCopy">{{ copyLabel }}</Button>
|
|
5
|
+
<Button type="button" variant="ghost" @click="this.onCopy">{{ copyLabel }}</Button>
|
|
6
6
|
</div>
|
|
7
7
|
<pre class="vmz-ui-code-block__pre"><code class="vmz-ui-code-block__code">{{ code }}</code></pre>
|
|
8
8
|
</figure>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:data-selected-count="selectedCount"
|
|
8
8
|
>
|
|
9
9
|
<table class="vmz-ui-datatable">
|
|
10
|
-
<thead @click="onHeadClick">
|
|
10
|
+
<thead @click="this.onHeadClick">
|
|
11
11
|
<tr>
|
|
12
12
|
<th scope="col" class="vmz-ui-datatable__check">
|
|
13
13
|
<input
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<th v-if="hasRowAction" scope="col">{{ actionTitle }}</th>
|
|
27
27
|
</tr>
|
|
28
28
|
</thead>
|
|
29
|
-
<tbody @click="onBodyClick">
|
|
29
|
+
<tbody @click="this.onBodyClick">
|
|
30
30
|
<tr
|
|
31
31
|
v-for="row in rows"
|
|
32
32
|
:key="row.id"
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
:aria-controls="panelId"
|
|
17
17
|
:aria-invalid="error ? 'true' : 'false'"
|
|
18
18
|
:aria-describedby="describedBy"
|
|
19
|
-
@click="toggle"
|
|
20
|
-
:onKeyDown="onTriggerKeyDown"
|
|
19
|
+
@click="this.toggle"
|
|
20
|
+
:onKeyDown="this.onTriggerKeyDown"
|
|
21
21
|
>
|
|
22
22
|
<span class="vmz-ui-date-picker__value" data-vmz-date="value">{{ displayLabel }}</span>
|
|
23
23
|
<span class="vmz-ui-date-picker__chev" aria-hidden="true"></span>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
data-vmz-overlay-owner="date-picker"
|
|
35
35
|
data-vmz-focus="enter"
|
|
36
36
|
data-vmz-date="panel"
|
|
37
|
-
:onKeyDown="onPanelKeyDown"
|
|
37
|
+
:onKeyDown="this.onPanelKeyDown"
|
|
38
38
|
>
|
|
39
39
|
<div class="vmz-ui-date-picker__monthbar">
|
|
40
40
|
<button
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
class="vmz-ui-date-picker__nav"
|
|
43
43
|
data-vmz-date="prev"
|
|
44
44
|
aria-label="Previous month"
|
|
45
|
-
@click="prevMonth"
|
|
45
|
+
@click="this.prevMonth"
|
|
46
46
|
>‹</button>
|
|
47
47
|
<p class="vmz-ui-date-picker__month" data-vmz-date="month">{{ monthLabel }}</p>
|
|
48
48
|
<button
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
class="vmz-ui-date-picker__nav"
|
|
51
51
|
data-vmz-date="next"
|
|
52
52
|
aria-label="Next month"
|
|
53
|
-
@click="nextMonth"
|
|
53
|
+
@click="this.nextMonth"
|
|
54
54
|
>›</button>
|
|
55
55
|
</div>
|
|
56
56
|
<div class="vmz-ui-date-picker__weekdays" aria-hidden="true">
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
:aria-selected="day.selected ? 'true' : 'false'"
|
|
73
73
|
:aria-disabled="day.disabled ? 'true' : 'false'"
|
|
74
74
|
:disabled="day.disabled"
|
|
75
|
-
@click="onDayClick"
|
|
75
|
+
@click="this.onDayClick"
|
|
76
76
|
>{{ day.label }}</button>
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
@@ -431,6 +431,8 @@ export default class DatePicker {
|
|
|
431
431
|
start,
|
|
432
432
|
end
|
|
433
433
|
} };
|
|
434
|
+
this.emit("change", ev);
|
|
435
|
+
this.emit("input", ev);
|
|
434
436
|
if (typeof this.onChange === "function") this.onChange(ev);
|
|
435
437
|
if (typeof this.onInput === "function") this.onInput(ev);
|
|
436
438
|
return;
|
|
@@ -442,6 +444,8 @@ export default class DatePicker {
|
|
|
442
444
|
start: iso,
|
|
443
445
|
end: iso
|
|
444
446
|
} };
|
|
447
|
+
this.emit("change", ev);
|
|
448
|
+
this.emit("input", ev);
|
|
445
449
|
if (typeof this.onChange === "function") this.onChange(ev);
|
|
446
450
|
if (typeof this.onInput === "function") this.onInput(ev);
|
|
447
451
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
class="vmz-ui-dialog__backdrop"
|
|
17
17
|
data-vmz-overlay-layer="backdrop"
|
|
18
18
|
aria-label="Dismiss dialog"
|
|
19
|
-
@click="dismiss"
|
|
19
|
+
@click="this.dismiss"
|
|
20
20
|
></button>
|
|
21
21
|
<div
|
|
22
22
|
class="vmz-ui-dialog__panel"
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
data-vmz-focus="enter"
|
|
29
29
|
data-vmz-motion="overlay-enter"
|
|
30
30
|
data-vmz-motion-token="motion.overlay"
|
|
31
|
-
:onKeyDown="onPanelKeyDown"
|
|
31
|
+
:onKeyDown="this.onPanelKeyDown"
|
|
32
32
|
>
|
|
33
33
|
<h2 :id="titleId" class="vmz-ui-dialog__title">{{ title }}</h2>
|
|
34
34
|
<div class="vmz-ui-dialog__body">
|
|
35
35
|
<slot />
|
|
36
36
|
</div>
|
|
37
37
|
<div class="vmz-ui-dialog__actions">
|
|
38
|
-
<button type="button" class="vmz-ui-dialog__close" data-vmz-focus="close" @click="dismiss">
|
|
38
|
+
<button type="button" class="vmz-ui-dialog__close" data-vmz-focus="close" @click="this.dismiss">
|
|
39
39
|
Close
|
|
40
40
|
</button>
|
|
41
41
|
</div>
|
|
@@ -265,10 +265,12 @@ export default class Dialog {
|
|
|
265
265
|
// Stale exit after interrupt/re-enter must not call onClose.
|
|
266
266
|
if (!this._exiting || exitGen !== this._motionGen) return;
|
|
267
267
|
this._exiting = false;
|
|
268
|
+
this.emit("close");
|
|
268
269
|
if (typeof this.onClose === "function") this.onClose();
|
|
269
270
|
}, ms);
|
|
270
271
|
return;
|
|
271
272
|
}
|
|
273
|
+
this.emit("close");
|
|
272
274
|
if (typeof this.onClose === "function") this.onClose();
|
|
273
275
|
}
|
|
274
276
|
_cancelExit(reason) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
class="vmz-ui-drawer__backdrop"
|
|
17
17
|
data-vmz-overlay-layer="backdrop"
|
|
18
18
|
aria-label="Dismiss drawer"
|
|
19
|
-
@click="dismiss"
|
|
19
|
+
@click="this.dismiss"
|
|
20
20
|
></button>
|
|
21
21
|
<div
|
|
22
22
|
class="vmz-ui-drawer__panel"
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
data-vmz-focus="enter"
|
|
29
29
|
data-vmz-motion="overlay-enter"
|
|
30
30
|
data-vmz-motion-token="motion.overlay"
|
|
31
|
-
:onKeyDown="onPanelKeyDown"
|
|
31
|
+
:onKeyDown="this.onPanelKeyDown"
|
|
32
32
|
>
|
|
33
33
|
<h2 :id="titleId" class="vmz-ui-drawer__title">{{ title }}</h2>
|
|
34
34
|
<div class="vmz-ui-drawer__body">
|
|
35
35
|
<slot />
|
|
36
36
|
</div>
|
|
37
37
|
<div class="vmz-ui-drawer__actions">
|
|
38
|
-
<button type="button" class="vmz-ui-drawer__close" data-vmz-focus="close" @click="dismiss">
|
|
38
|
+
<button type="button" class="vmz-ui-drawer__close" data-vmz-focus="close" @click="this.dismiss">
|
|
39
39
|
Close
|
|
40
40
|
</button>
|
|
41
41
|
</div>
|
|
@@ -267,10 +267,12 @@ export default class Drawer {
|
|
|
267
267
|
this._exitTimer = null;
|
|
268
268
|
if (!this._exiting || exitGen !== this._motionGen) return;
|
|
269
269
|
this._exiting = false;
|
|
270
|
+
this.emit("close");
|
|
270
271
|
if (typeof this.onClose === "function") this.onClose();
|
|
271
272
|
}, ms);
|
|
272
273
|
return;
|
|
273
274
|
}
|
|
275
|
+
this.emit("close");
|
|
274
276
|
if (typeof this.onClose === "function") this.onClose();
|
|
275
277
|
}
|
|
276
278
|
_cancelExit(reason) {
|
package/src/components/Field.vmz
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
:disabled="disabled"
|
|
13
13
|
:aria-invalid="error ? 'true' : 'false'"
|
|
14
14
|
:aria-describedby="describedBy"
|
|
15
|
-
@input="
|
|
15
|
+
@input="this.onDomInput"
|
|
16
16
|
/>
|
|
17
17
|
<p v-if="description" :id="descriptionId" class="vmz-ui-field__description">{{ description }}</p>
|
|
18
18
|
<p v-if="error" :id="errorId" class="vmz-ui-field__error" role="alert">{{ error }}</p>
|
|
@@ -113,5 +113,9 @@ export default class Field {
|
|
|
113
113
|
public errorId: string = "vmz-field-err";
|
|
114
114
|
public describedBy: string = "";
|
|
115
115
|
public onInput: ((e: Event) => void) | null = null;
|
|
116
|
+
onDomInput(e: Event) {
|
|
117
|
+
this.emit("input", e);
|
|
118
|
+
if (typeof this.onInput === "function") this.onInput(e);
|
|
119
|
+
}
|
|
116
120
|
}
|
|
117
121
|
</script>
|
package/src/components/Form.vmz
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
data-novalidate="true"
|
|
7
7
|
:aria-label="label"
|
|
8
8
|
:aria-describedby="describedBy"
|
|
9
|
-
@submit="onSubmitGuard"
|
|
10
|
-
|
|
9
|
+
@submit="this.onSubmitGuard"
|
|
10
|
+
@reset="this.onResetGuard"
|
|
11
11
|
>
|
|
12
12
|
<div v-if="errorSummary" :id="summaryId" class="vmz-ui-form__summary" role="alert" data-vmz-form="summary">
|
|
13
13
|
{{ errorSummary }}
|
|
@@ -59,11 +59,13 @@ export default class Form {
|
|
|
59
59
|
onSubmitGuard(ev) {
|
|
60
60
|
if (ev && typeof ev.preventDefault === "function") ev.preventDefault();
|
|
61
61
|
if (this.disabled) return;
|
|
62
|
+
this.emit("submit");
|
|
62
63
|
if (typeof this.onSubmit === "function") this.onSubmit();
|
|
63
64
|
}
|
|
64
65
|
onResetGuard(ev) {
|
|
65
66
|
if (ev && typeof ev.preventDefault === "function") ev.preventDefault();
|
|
66
67
|
if (this.disabled) return;
|
|
68
|
+
this.emit("reset");
|
|
67
69
|
if (typeof this.onReset === "function") this.onReset();
|
|
68
70
|
}
|
|
69
71
|
}
|
package/src/components/List.vmz
CHANGED
package/src/components/Menu.vmz
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
aria-haspopup="menu"
|
|
8
8
|
:aria-expanded="open ? 'true' : 'false'"
|
|
9
9
|
:aria-controls="menuId"
|
|
10
|
-
@click="toggle"
|
|
11
|
-
:onKeyDown="onTriggerKeyDown"
|
|
10
|
+
@click="this.toggle"
|
|
11
|
+
:onKeyDown="this.onTriggerKeyDown"
|
|
12
12
|
>
|
|
13
13
|
{{ label }}
|
|
14
14
|
</button>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
data-vmz-overlay-owner="menu"
|
|
22
22
|
data-vmz-focus="enter"
|
|
23
23
|
tabindex="-1"
|
|
24
|
-
:onKeyDown="onMenuKeyDown"
|
|
24
|
+
:onKeyDown="this.onMenuKeyDown"
|
|
25
25
|
>
|
|
26
26
|
<button
|
|
27
27
|
v-for="item in items"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
class="vmz-ui-menu__item"
|
|
31
31
|
role="menuitem"
|
|
32
32
|
:data-vmz-menu-item="item.id"
|
|
33
|
-
@click="onItemClick"
|
|
33
|
+
@click="this.onItemClick"
|
|
34
34
|
>
|
|
35
35
|
{{ item.title }}
|
|
36
36
|
</button>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
type="button"
|
|
5
5
|
class="vmz-ui-pagination__btn"
|
|
6
6
|
:disabled="prevDisabled"
|
|
7
|
-
@click="onPrevClick"
|
|
7
|
+
@click="this.onPrevClick"
|
|
8
8
|
>
|
|
9
9
|
Previous
|
|
10
10
|
</button>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
type="button"
|
|
14
14
|
class="vmz-ui-pagination__btn"
|
|
15
15
|
:disabled="nextDisabled"
|
|
16
|
-
@click="onNextClick"
|
|
16
|
+
@click="this.onNextClick"
|
|
17
17
|
>
|
|
18
18
|
Next
|
|
19
19
|
</button>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
class="vmz-ui-popover__backdrop"
|
|
17
17
|
data-vmz-overlay-layer="backdrop"
|
|
18
18
|
aria-label="Dismiss popover"
|
|
19
|
-
@click="dismiss"
|
|
19
|
+
@click="this.dismiss"
|
|
20
20
|
></button>
|
|
21
21
|
<div
|
|
22
22
|
class="vmz-ui-popover__panel"
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
tabindex="-1"
|
|
27
27
|
data-vmz-overlay-layer="panel"
|
|
28
28
|
data-vmz-focus="enter"
|
|
29
|
-
:onKeyDown="onPanelKeyDown"
|
|
29
|
+
:onKeyDown="this.onPanelKeyDown"
|
|
30
30
|
>
|
|
31
31
|
<h2 :id="titleId" class="vmz-ui-popover__title">{{ title }}</h2>
|
|
32
32
|
<div class="vmz-ui-popover__body">
|
|
33
33
|
<slot />
|
|
34
34
|
</div>
|
|
35
35
|
<div class="vmz-ui-popover__actions">
|
|
36
|
-
<button type="button" class="vmz-ui-popover__close" data-vmz-focus="close" @click="dismiss">
|
|
36
|
+
<button type="button" class="vmz-ui-popover__close" data-vmz-focus="close" @click="this.dismiss">
|
|
37
37
|
Close
|
|
38
38
|
</button>
|
|
39
39
|
</div>
|
|
@@ -162,6 +162,7 @@ export default class Popover {
|
|
|
162
162
|
this._restoreFocus = null;
|
|
163
163
|
}
|
|
164
164
|
dismiss() {
|
|
165
|
+
this.emit("close");
|
|
165
166
|
if (typeof this.onClose === "function") this.onClose();
|
|
166
167
|
}
|
|
167
168
|
_stackValue() {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
data-vmz-ui="query-form"
|
|
5
5
|
data-dense="true"
|
|
6
6
|
:aria-label="label"
|
|
7
|
-
@submit="onSubmitGuard"
|
|
7
|
+
@submit="this.onSubmitGuard"
|
|
8
8
|
>
|
|
9
9
|
<slot />
|
|
10
10
|
</form>
|
|
@@ -32,6 +32,7 @@ export default class QueryForm {
|
|
|
32
32
|
public onSubmit: (() => void) | null = null;
|
|
33
33
|
onSubmitGuard(ev) {
|
|
34
34
|
if (ev && typeof ev.preventDefault === "function") ev.preventDefault();
|
|
35
|
+
this.emit("submit");
|
|
35
36
|
if (typeof this.onSubmit === "function") this.onSubmit();
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:disabled="disabled"
|
|
8
8
|
>
|
|
9
9
|
<legend class="vmz-ui-radio-group__legend">{{ label }}</legend>
|
|
10
|
-
<div class="vmz-ui-radio-group__list" role="radiogroup" :aria-label="label" @click="onListClick">
|
|
10
|
+
<div class="vmz-ui-radio-group__list" role="radiogroup" :aria-label="label" @click="this.onListClick">
|
|
11
11
|
<label
|
|
12
12
|
v-for="item in items"
|
|
13
13
|
:key="item.value"
|
|
@@ -131,6 +131,7 @@ export default class RadioGroup {
|
|
|
131
131
|
if (!input) return;
|
|
132
132
|
const next = input.getAttribute("data-vmz-radio") || input.value || "";
|
|
133
133
|
if (!next || next === this.value) return;
|
|
134
|
+
this.emit("change", next);
|
|
134
135
|
if (typeof this.onChange === "function") this.onChange(next);
|
|
135
136
|
}
|
|
136
137
|
}
|
|
@@ -23,6 +23,7 @@ export default class Segmented {
|
|
|
23
23
|
public options: Array<{ value: string; label: string }> = [];
|
|
24
24
|
public onChange: ((value: string) => void) | null = null;
|
|
25
25
|
onPick(next: string) {
|
|
26
|
+
this.emit('change', next);
|
|
26
27
|
if (typeof this.onChange === 'function') this.onChange(next);
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
:aria-invalid="error ? 'true' : 'false'"
|
|
20
20
|
:aria-describedby="describedBy"
|
|
21
21
|
:aria-multiselectable="isMultiple ? 'true' : 'false'"
|
|
22
|
-
@click="toggle"
|
|
23
|
-
:onKeyDown="onTriggerKeyDown"
|
|
22
|
+
@click="this.toggle"
|
|
23
|
+
:onKeyDown="this.onTriggerKeyDown"
|
|
24
24
|
>
|
|
25
25
|
<span class="vmz-ui-select__value">{{ displayLabel }}</span>
|
|
26
26
|
<span class="vmz-ui-select__chev" aria-hidden="true"></span>
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
:value="searchQuery"
|
|
42
42
|
:placeholder="searchPlaceholder"
|
|
43
43
|
:aria-label="searchPlaceholder"
|
|
44
|
-
@input="onSearchInput"
|
|
45
|
-
:onKeyDown="onSearchKeyDown"
|
|
44
|
+
@input="this.onSearchInput"
|
|
45
|
+
:onKeyDown="this.onSearchKeyDown"
|
|
46
46
|
/>
|
|
47
47
|
</div>
|
|
48
48
|
<ul
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
role="listbox"
|
|
51
51
|
:aria-multiselectable="isMultiple ? 'true' : 'false'"
|
|
52
52
|
tabindex="-1"
|
|
53
|
-
:onKeyDown="onListKeyDown"
|
|
53
|
+
:onKeyDown="this.onListKeyDown"
|
|
54
54
|
>
|
|
55
55
|
<li v-if="showEmpty" class="vmz-ui-select__empty" role="presentation">{{ emptyText }}</li>
|
|
56
56
|
<li v-for="opt in visibleOptions" :key="opt.value" role="presentation">
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
role="option"
|
|
61
61
|
:data-vmz-option="opt.value"
|
|
62
62
|
:aria-selected="opt.selected ? 'true' : 'false'"
|
|
63
|
-
@click="onOptionClick"
|
|
63
|
+
@click="this.onOptionClick"
|
|
64
64
|
>{{ opt.label }}</button>
|
|
65
65
|
</li>
|
|
66
66
|
</ul>
|
|
67
67
|
<div v-if="isMultiple" class="vmz-ui-select__footer">
|
|
68
|
-
<button type="button" class="vmz-ui-select__done" data-vmz-select="done" @click="close">Done</button>
|
|
68
|
+
<button type="button" class="vmz-ui-select__done" data-vmz-select="done" @click="this.close">Done</button>
|
|
69
69
|
</div>
|
|
70
70
|
</div>
|
|
71
71
|
<p v-if="description" :id="descriptionId" class="vmz-ui-select__description">{{ description }}</p>
|
|
@@ -387,11 +387,13 @@ export default class Select {
|
|
|
387
387
|
this._rebuildVisible();
|
|
388
388
|
}
|
|
389
389
|
_emit(nextValue: string, nextValues: string[]) {
|
|
390
|
+
const payload = { target: {
|
|
391
|
+
value: nextValue,
|
|
392
|
+
values: nextValues
|
|
393
|
+
} };
|
|
394
|
+
this.emit("change", payload);
|
|
390
395
|
if (typeof this.onChange === "function") {
|
|
391
|
-
this.onChange(
|
|
392
|
-
value: nextValue,
|
|
393
|
-
values: nextValues
|
|
394
|
-
} });
|
|
396
|
+
this.onChange(payload);
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
399
|
/** Parent-owned prop writes (bindComponentProp) — keep derived label/options in sync. */
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
:aria-checked="checked"
|
|
9
9
|
:aria-describedby="describedBy"
|
|
10
10
|
:disabled="disabled"
|
|
11
|
-
@click="toggle"
|
|
12
|
-
:onKeyDown="onKeyDown"
|
|
11
|
+
@click="this.toggle"
|
|
12
|
+
:onKeyDown="this.onKeyDown"
|
|
13
13
|
>
|
|
14
14
|
<span class="vmz-ui-switch__thumb" aria-hidden="true"></span>
|
|
15
15
|
</button>
|
|
@@ -94,6 +94,7 @@ export default class Switch {
|
|
|
94
94
|
toggle() {
|
|
95
95
|
if (this.disabled) return;
|
|
96
96
|
const next = !this.checked;
|
|
97
|
+
this.emit("change", next);
|
|
97
98
|
if (typeof this.onChange === "function") this.onChange(next);
|
|
98
99
|
}
|
|
99
100
|
onKeyDown(ev) {
|
package/src/components/Table.vmz
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="vmz-ui-table-wrap" data-vmz-ui="table" :data-sort-key="sortKey" :data-sort-dir="sortDir">
|
|
3
3
|
<table class="vmz-ui-table">
|
|
4
|
-
<thead @click="onHeadClick">
|
|
4
|
+
<thead @click="this.onHeadClick">
|
|
5
5
|
<tr>
|
|
6
6
|
<th v-for="col in columns" :key="col.id" scope="col" :data-vmz-col="col.id">
|
|
7
7
|
<button type="button" class="vmz-ui-table__sort" :data-vmz-sort="col.id">
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<th v-if="hasRowAction" scope="col">{{ actionTitle }}</th>
|
|
12
12
|
</tr>
|
|
13
13
|
</thead>
|
|
14
|
-
<tbody @click="onBodyClick">
|
|
14
|
+
<tbody @click="this.onBodyClick">
|
|
15
15
|
<tr v-for="row in rows" :key="row.id" :data-vmz-row="row.id">
|
|
16
16
|
<td v-for="cell in row.cells">{{ cell }}</td>
|
|
17
17
|
<td v-if="hasRowAction">
|
package/src/components/Tabs.vmz
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
:readonly="readonly"
|
|
11
11
|
:aria-invalid="error ? 'true' : 'false'"
|
|
12
12
|
:aria-describedby="describedBy"
|
|
13
|
-
@input="
|
|
13
|
+
@input="this.onDomInput"
|
|
14
14
|
></textarea>
|
|
15
15
|
<p v-if="description" :id="descriptionId" class="vmz-ui-textarea__description">{{ description }}</p>
|
|
16
16
|
<p v-if="error" :id="errorId" class="vmz-ui-textarea__error" role="alert">{{ error }}</p>
|
|
@@ -114,5 +114,9 @@ export default class TextArea {
|
|
|
114
114
|
public errorId: string = "vmz-textarea-err";
|
|
115
115
|
public describedBy: string = "";
|
|
116
116
|
public onInput: ((e: Event) => void) | null = null;
|
|
117
|
+
onDomInput(e: Event) {
|
|
118
|
+
this.emit("input", e);
|
|
119
|
+
if (typeof this.onInput === "function") this.onInput(e);
|
|
120
|
+
}
|
|
117
121
|
}
|
|
118
122
|
</script>
|
package/src/components/Tree.vmz
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
:data-invalid="invalidAttr"
|
|
11
11
|
:data-vmz-upload-status="status"
|
|
12
12
|
:data-progress="progress"
|
|
13
|
-
:onDragEnter="onDragEnter"
|
|
14
|
-
:onDragOver="onDragOver"
|
|
15
|
-
:onDragLeave="onDragLeave"
|
|
16
|
-
:onDrop="onDrop"
|
|
13
|
+
:onDragEnter="this.onDragEnter"
|
|
14
|
+
:onDragOver="this.onDragOver"
|
|
15
|
+
:onDragLeave="this.onDragLeave"
|
|
16
|
+
:onDrop="this.onDrop"
|
|
17
17
|
>
|
|
18
18
|
<label v-if="label" class="vmz-ui-upload__label" :for="controlId">{{ label }}</label>
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
:aria-invalid="error ? 'true' : 'false'"
|
|
29
29
|
:aria-describedby="describedBy"
|
|
30
30
|
:data-vmz-upload-directory="directoryAttr"
|
|
31
|
-
@change="onPick"
|
|
31
|
+
@change="this.onPick"
|
|
32
32
|
/>
|
|
33
33
|
<p class="vmz-ui-upload__hint" data-vmz-upload="hint">{{ zoneHint }}</p>
|
|
34
34
|
</div>
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
<p v-if="resultText" class="vmz-ui-upload__result" data-vmz-upload="result">{{ resultText }}</p>
|
|
59
59
|
|
|
60
60
|
<div v-if="showActions" class="vmz-ui-upload__actions" data-vmz-upload="actions">
|
|
61
|
-
<button v-if="canCancel" type="button" class="vmz-ui-upload__cancel" data-vmz-upload="cancel" @click="onCancelClick">
|
|
61
|
+
<button v-if="canCancel" type="button" class="vmz-ui-upload__cancel" data-vmz-upload="cancel" @click="this.onCancelClick">
|
|
62
62
|
{{ cancelLabel }}
|
|
63
63
|
</button>
|
|
64
|
-
<button v-if="canResume" type="button" class="vmz-ui-upload__resume" data-vmz-upload="resume" @click="onResumeClick">
|
|
64
|
+
<button v-if="canResume" type="button" class="vmz-ui-upload__resume" data-vmz-upload="resume" @click="this.onResumeClick">
|
|
65
65
|
{{ resumeLabel }}
|
|
66
66
|
</button>
|
|
67
67
|
</div>
|