@haiyue/ui 0.2.2 → 0.3.1
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/CHANGELOG.md +42 -0
- package/README.md +523 -4
- package/dist/adapters/web/controls.js +48 -8
- package/dist/adapters/web/renderer.js +9 -11
- package/dist/adapters/web/styles.d.ts +2 -3
- package/dist/adapters/web/styles.js +26 -23
- package/dist/alert.d.ts +39 -0
- package/dist/alert.js +144 -0
- package/dist/anchor.d.ts +62 -0
- package/dist/anchor.js +293 -0
- package/dist/auto-complete.d.ts +83 -0
- package/dist/auto-complete.js +267 -0
- package/dist/avatar.d.ts +45 -0
- package/dist/avatar.js +135 -0
- package/dist/badge.js +5 -5
- package/dist/border-beam.js +3 -2
- package/dist/breadcrumb.js +5 -5
- package/dist/button-group.js +8 -8
- package/dist/button.js +10 -10
- package/dist/card.d.ts +29 -0
- package/dist/card.js +101 -0
- package/dist/carousel.js +6 -6
- package/dist/cascader.js +19 -13
- package/dist/checkbox.d.ts +12 -0
- package/dist/checkbox.js +22 -6
- package/dist/collapse.js +6 -6
- package/dist/context-menu.js +3 -4
- package/dist/core/actions.js +7 -8
- package/dist/core/data.d.ts +1 -1
- package/dist/core/data.js +44 -10
- package/dist/core/platform-view.js +8 -2
- package/dist/core/selection.js +4 -4
- package/dist/core/semantics.d.ts +26 -0
- package/dist/core/semantics.js +8 -0
- package/dist/core/text.js +3 -3
- package/dist/core/validation.d.ts +3 -1
- package/dist/core/validation.js +23 -5
- package/dist/date-picker.js +19 -13
- package/dist/descriptions.d.ts +44 -0
- package/dist/descriptions.js +169 -0
- package/dist/dialog.d.ts +4 -0
- package/dist/dialog.js +48 -27
- package/dist/divider.js +2 -2
- package/dist/draggable.js +5 -3
- package/dist/drawer.js +16 -24
- package/dist/dropdown.js +3 -4
- package/dist/empty.d.ts +20 -0
- package/dist/empty.js +58 -0
- package/dist/expandable.js +4 -4
- package/dist/form-item.d.ts +60 -0
- package/dist/form-item.js +212 -0
- package/dist/form.d.ts +41 -0
- package/dist/form.js +154 -0
- package/dist/history-controls.js +5 -5
- package/dist/image-preview.d.ts +22 -0
- package/dist/image-preview.js +38 -0
- package/dist/image.d.ts +52 -0
- package/dist/image.js +152 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +72 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +32 -18
- package/dist/internal/anchored-popup.d.ts +19 -0
- package/dist/internal/anchored-popup.js +89 -0
- package/dist/internal/focus.d.ts +2 -0
- package/dist/internal/focus.js +31 -0
- package/dist/internal/form-control.d.ts +22 -0
- package/dist/internal/form-control.js +52 -0
- package/dist/internal/image-viewer.d.ts +51 -0
- package/dist/internal/image-viewer.js +210 -0
- package/dist/internal/keyboard.d.ts +2 -0
- package/dist/internal/keyboard.js +12 -0
- package/dist/internal/numbers.d.ts +2 -0
- package/dist/internal/numbers.js +8 -0
- package/dist/internal/pagination.d.ts +35 -0
- package/dist/internal/pagination.js +169 -0
- package/dist/internal/popover-base.d.ts +87 -0
- package/dist/internal/popover-base.js +365 -0
- package/dist/internal/presentation.d.ts +2 -0
- package/dist/internal/presentation.js +28 -0
- package/dist/mentions.d.ts +115 -0
- package/dist/mentions.js +485 -0
- package/dist/menu-shared.d.ts +1 -1
- package/dist/menu-shared.js +3 -3
- package/dist/menu.d.ts +63 -0
- package/dist/menu.js +339 -0
- package/dist/modal.js +11 -40
- package/dist/notification.js +11 -10
- package/dist/pagination.d.ts +34 -0
- package/dist/pagination.js +73 -0
- package/dist/popconfirm.d.ts +6 -0
- package/dist/popconfirm.js +7 -0
- package/dist/popover.d.ts +6 -0
- package/dist/popover.js +7 -0
- package/dist/portable/page.js +25 -14
- package/dist/progress.d.ts +30 -0
- package/dist/progress.js +102 -0
- package/dist/qr-code.js +3 -3
- package/dist/radio.d.ts +10 -0
- package/dist/radio.js +18 -5
- package/dist/range.js +7 -7
- package/dist/rate.js +3 -3
- package/dist/resizable.js +8 -5
- package/dist/result.d.ts +22 -0
- package/dist/result.js +88 -0
- package/dist/ribbon.d.ts +19 -0
- package/dist/ribbon.js +106 -0
- package/dist/segmented.d.ts +39 -0
- package/dist/segmented.js +192 -0
- package/dist/select.d.ts +12 -0
- package/dist/select.js +31 -13
- package/dist/skeleton.js +10 -10
- package/dist/spin.d.ts +26 -0
- package/dist/spin.js +80 -0
- package/dist/steps.js +13 -13
- package/dist/switch.d.ts +44 -0
- package/dist/switch.js +104 -0
- package/dist/table.d.ts +3 -3
- package/dist/table.js +110 -128
- package/dist/tabs.js +7 -7
- package/dist/tag.js +8 -8
- package/dist/time-picker.js +16 -10
- package/dist/timeline.js +12 -12
- package/dist/toast.js +12 -11
- package/dist/tooltip.d.ts +6 -0
- package/dist/tooltip.js +107 -6
- package/dist/tour.js +26 -17
- package/dist/tree-model.d.ts +2 -0
- package/dist/tree-model.js +32 -11
- package/dist/tree-node.js +2 -2
- package/dist/tree-select.d.ts +94 -0
- package/dist/tree-select.js +398 -0
- package/dist/tree.d.ts +0 -2
- package/dist/tree.js +14 -29
- package/dist/upload.d.ts +108 -0
- package/dist/upload.js +358 -0
- package/dist/virtual-keyboard.d.ts +1 -0
- package/dist/virtual-keyboard.js +72 -41
- package/dist/virtual-list.d.ts +1 -0
- package/dist/virtual-list.js +25 -8
- package/dist/virtual-mouse.js +7 -6
- package/dist/watermark.js +2 -1
- package/package.json +82 -1
- package/themes/haiyue-dark.css +51 -0
- package/themes/haiyue-light.css +51 -0
package/dist/steps.js
CHANGED
|
@@ -37,24 +37,24 @@ export class HYSteps extends HTMLElement {
|
|
|
37
37
|
const root = this.attachShadow({ mode: 'open' });
|
|
38
38
|
const style = document.createElement('style');
|
|
39
39
|
style.textContent = `
|
|
40
|
-
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: 12px/1.
|
|
40
|
+
:host { display: block; min-width: 0; color: var(--hy-text-color, #eef3ff); font: var(--hy-font-size-sm, 12px)/calc(var(--hy-line-height-snug, 1.4) + 0.05) var(--hy-font-family, system-ui, sans-serif); }
|
|
41
41
|
.steps { display: flex; width: 100%; margin: 0; padding: 0; list-style: none; }
|
|
42
42
|
.item { position: relative; flex: 1 1 0; min-width: 0; text-align: center; }
|
|
43
|
-
.step { display: flex; width: 100%; min-width: 0; flex-direction: column; align-items: center; padding: 0 10px; border: 0; color: inherit; background: transparent; font: inherit; text-align: center; }
|
|
43
|
+
.step { display: flex; width: 100%; min-width: 0; flex-direction: column; align-items: center; padding: 0 var(--hy-space-5, 10px); border: 0; color: inherit; background: transparent; font: inherit; text-align: center; }
|
|
44
44
|
button.step { cursor: pointer; }
|
|
45
45
|
button.step:hover .icon { transform: scale(1.08); }
|
|
46
46
|
button.step:focus-visible { outline: none; }
|
|
47
47
|
button.step:focus-visible .icon { box-shadow: 0 0 0 3px var(--hy-focus-ring-color, rgba(121, 168, 255, .22)); }
|
|
48
48
|
button.step:disabled { cursor: not-allowed; opacity: .45; }
|
|
49
49
|
.head { position: relative; z-index: 1; display: grid; place-items: center; }
|
|
50
|
-
.icon { display: grid; width: var(--hy-steps-icon-size, 30px); height: var(--hy-steps-icon-size, 30px); box-sizing: border-box; place-items: center; border: 1px solid var(--_step-color, var(--hy-muted-color, #788697)); border-radius: 50%; color: var(--_step-color, var(--hy-muted-color, #788697)); background: var(--hy-surface-color, #111722); font-weight:
|
|
50
|
+
.icon { display: grid; width: var(--hy-steps-icon-size, 30px); height: var(--hy-steps-icon-size, 30px); box-sizing: border-box; place-items: center; border: 1px solid var(--_step-color, var(--hy-muted-color, #788697)); border-radius: 50%; color: var(--_step-color, var(--hy-muted-color, #788697)); background: var(--hy-surface-color, #111722); font-weight: calc(var(--hy-font-weight-semibold, 600) + 50); transition: transform 120ms ease, box-shadow 120ms ease; }
|
|
51
51
|
.tail { position: absolute; z-index: 0; top: calc(var(--hy-steps-icon-size, 30px) / 2); right: calc(-50% + var(--hy-steps-icon-size, 30px) / 2 + 10px); left: calc(50% + var(--hy-steps-icon-size, 30px) / 2 + 10px); height: var(--hy-steps-line-width, 1px); background: var(--hy-steps-line-color, var(--hy-border-color, #3d4654)); }
|
|
52
52
|
.item:last-child .tail { display: none; }
|
|
53
|
-
.body { min-width: 0; margin-top:
|
|
54
|
-
.title-row { display: flex; min-width: 0; justify-content: center; gap: 6px; }
|
|
55
|
-
.title { overflow: hidden; color: var(--hy-secondary-text-color, #aebbd0); font-weight:
|
|
56
|
-
.subtitle { flex: 0 0 auto; color: var(--hy-muted-color, #788697); font-size: 10px; }
|
|
57
|
-
.description { max-width: 30ch; margin: 4px auto 0; color: var(--hy-muted-color, #788697); font-size:
|
|
53
|
+
.body { min-width: 0; margin-top: calc(var(--hy-space-4, 8px) + 1px); }
|
|
54
|
+
.title-row { display: flex; min-width: 0; justify-content: center; gap: var(--hy-space-3, 6px); }
|
|
55
|
+
.title { overflow: hidden; color: var(--hy-secondary-text-color, #aebbd0); font-weight: calc(var(--hy-font-weight-semibold, 600) + 50); text-overflow: ellipsis; white-space: nowrap; }
|
|
56
|
+
.subtitle { flex: 0 0 auto; color: var(--hy-muted-color, #788697); font-size: var(--hy-font-size-xs, 10px); }
|
|
57
|
+
.description { max-width: 30ch; margin: var(--hy-space-2, 4px) auto 0; color: var(--hy-muted-color, #788697); font-size: calc(var(--hy-font-size-xs, 10px) + 1px); }
|
|
58
58
|
.status-finish { --_step-color: var(--hy-success-color, #4ade80); }
|
|
59
59
|
.status-process { --_step-color: var(--hy-accent-color, #79a8ff); }
|
|
60
60
|
.status-error { --_step-color: var(--hy-error-color, #fb7185); }
|
|
@@ -63,15 +63,15 @@ export class HYSteps extends HTMLElement {
|
|
|
63
63
|
.status-error .icon { color: var(--hy-selected-text-color, #fff); background: var(--_step-color); }
|
|
64
64
|
.status-process .title, .status-finish .title, .status-error .title { color: var(--hy-text-color, #eef3ff); }
|
|
65
65
|
:host([size="small"]) { --hy-steps-icon-size: 22px; }
|
|
66
|
-
:host([size="small"]) .step { padding-inline:
|
|
67
|
-
:host([size="small"]) .body { margin-top: 6px; }
|
|
66
|
+
:host([size="small"]) .step { padding-inline: calc(var(--hy-space-3, 6px) + 1px); }
|
|
67
|
+
:host([size="small"]) .body { margin-top: var(--hy-space-3, 6px); }
|
|
68
68
|
:host([direction="vertical"]) .steps { flex-direction: column; }
|
|
69
69
|
:host([direction="vertical"]) .item { flex: none; min-height: var(--hy-steps-vertical-item-height, 78px); text-align: left; }
|
|
70
|
-
:host([direction="vertical"]) .step { display: grid; grid-template-columns: var(--hy-steps-icon-size, 30px) minmax(0, 1fr); align-items: start; gap: 12px; padding: 0 0 20px; text-align: left; }
|
|
70
|
+
:host([direction="vertical"]) .step { display: grid; grid-template-columns: var(--hy-steps-icon-size, 30px) minmax(0, 1fr); align-items: start; gap: var(--hy-space-6, 12px); padding: 0 0 var(--hy-space-10, 20px); text-align: left; }
|
|
71
71
|
:host([direction="vertical"]) .head { grid-column: 1; grid-row: 1; }
|
|
72
|
-
:host([direction="vertical"]) .body { grid-column: 2; grid-row: 1; margin-top: 4px; }
|
|
72
|
+
:host([direction="vertical"]) .body { grid-column: 2; grid-row: 1; margin-top: var(--hy-space-2, 4px); }
|
|
73
73
|
:host([direction="vertical"]) .title-row { justify-content: flex-start; }
|
|
74
|
-
:host([direction="vertical"]) .description { margin: 4px 0 0; }
|
|
74
|
+
:host([direction="vertical"]) .description { margin: var(--hy-space-2, 4px) 0 0; }
|
|
75
75
|
:host([direction="vertical"]) .tail { top: calc(var(--hy-steps-icon-size, 30px) + 5px); bottom: 5px; left: calc(var(--hy-steps-icon-size, 30px) / 2); width: var(--hy-steps-line-width, 1px); height: auto; }
|
|
76
76
|
@media (prefers-reduced-motion: reduce) { .icon { transition: none; } }
|
|
77
77
|
`;
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface HYSwitchChangeDetail {
|
|
2
|
+
checked: boolean;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export type HYSwitchSize = 'small' | 'default';
|
|
6
|
+
export declare class HYSwitch extends HTMLElement {
|
|
7
|
+
static readonly formAssociated = true;
|
|
8
|
+
private readonly _input;
|
|
9
|
+
private readonly _text;
|
|
10
|
+
private readonly _labelSlot;
|
|
11
|
+
private readonly _formControl;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
13
|
+
constructor();
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
attributeChangedCallback(): void;
|
|
17
|
+
get checked(): boolean;
|
|
18
|
+
set checked(value: boolean);
|
|
19
|
+
get disabled(): boolean;
|
|
20
|
+
set disabled(value: boolean);
|
|
21
|
+
get loading(): boolean;
|
|
22
|
+
set loading(value: boolean);
|
|
23
|
+
get value(): string;
|
|
24
|
+
set value(value: string);
|
|
25
|
+
get name(): string;
|
|
26
|
+
set name(value: string);
|
|
27
|
+
get label(): string;
|
|
28
|
+
set label(value: string);
|
|
29
|
+
get size(): HYSwitchSize;
|
|
30
|
+
set size(value: HYSwitchSize);
|
|
31
|
+
get form(): HTMLFormElement | null;
|
|
32
|
+
checkValidity(): boolean;
|
|
33
|
+
reportValidity(): boolean;
|
|
34
|
+
setCustomValidity(message: string): void;
|
|
35
|
+
formDisabledCallback(disabled: boolean): void;
|
|
36
|
+
formResetCallback(): void;
|
|
37
|
+
formStateRestoreCallback(state: string | File | FormData | null): void;
|
|
38
|
+
focus(options?: FocusOptions): void;
|
|
39
|
+
click(): void;
|
|
40
|
+
private _sync;
|
|
41
|
+
private _onChange;
|
|
42
|
+
private _onKeydown;
|
|
43
|
+
}
|
|
44
|
+
export declare function defineSwitchComponents(): void;
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { HYFormControl } from './internal/form-control.js';
|
|
2
|
+
export class HYSwitch extends HTMLElement {
|
|
3
|
+
static formAssociated = true;
|
|
4
|
+
_input = document.createElement('input');
|
|
5
|
+
_text = document.createElement('span');
|
|
6
|
+
_labelSlot = document.createElement('slot');
|
|
7
|
+
_formControl = new HYFormControl(this, this._input);
|
|
8
|
+
static get observedAttributes() { return ['checked', 'disabled', 'loading', 'required', 'name', 'value', 'label', 'aria-label', 'checked-text', 'unchecked-text', 'size']; }
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
const root = this.attachShadow({ mode: 'open' });
|
|
12
|
+
const style = document.createElement('style');
|
|
13
|
+
style.textContent = `
|
|
14
|
+
:host { display: inline-block; color: var(--hy-text-color, #d8e2f2); font: var(--hy-font-size-sm, 12px)/1.5 var(--hy-font-family, system-ui, sans-serif); }
|
|
15
|
+
label { display: inline-flex; align-items: center; gap: var(--hy-space-4, 8px); cursor: pointer; }
|
|
16
|
+
input { position: absolute; width: 1px; height: 1px; opacity: 0; clip-path: inset(50%); }
|
|
17
|
+
.track { position: relative; display: inline-flex; align-items: center; box-sizing: border-box; min-width: 38px; height: 22px; padding: 0 7px 0 24px; border-radius: 999px; background: var(--hy-switch-off-bg, var(--hy-disabled-text-color, #65738a)); color: var(--hy-selected-text-color, #fff); transition: background 120ms; }
|
|
18
|
+
.thumb { position: absolute; inset-inline-start: 3px; top: 3px; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%; background: var(--hy-switch-thumb-color, var(--hy-selected-text-color, #fff)); transition: inset-inline-start 120ms; }
|
|
19
|
+
.state { font-size: 11px; white-space: nowrap; }
|
|
20
|
+
input:checked + .track { padding-inline: 7px 24px; background: var(--hy-switch-on-bg, var(--hy-accent-strong-color, #554cc6)); }
|
|
21
|
+
input:checked + .track .thumb { inset-inline-start: calc(100% - 19px); }
|
|
22
|
+
input:focus-visible + .track { outline: 2px solid var(--hy-focus-border-color, #79a8ff); outline-offset: 2px; }
|
|
23
|
+
input:disabled ~ * { opacity: .55; cursor: not-allowed; }
|
|
24
|
+
:host([size="small"]) .track { min-width: 30px; height: 18px; padding-inline: 20px 5px; }
|
|
25
|
+
:host([size="small"]) .thumb { width: 12px; height: 12px; }
|
|
26
|
+
:host([size="small"]) input:checked + .track { padding-inline: 5px 20px; }
|
|
27
|
+
:host([size="small"]) input:checked + .track .thumb { inset-inline-start: calc(100% - 15px); }
|
|
28
|
+
:host([loading]) .thumb::after { content: ''; position: absolute; inset: 3px; border: 2px solid var(--hy-border-color, #65738a); border-top-color: transparent; border-radius: 50%; animation: hy-switch-spin .8s linear infinite; }
|
|
29
|
+
@keyframes hy-switch-spin { to { transform: rotate(360deg); } }
|
|
30
|
+
@media (prefers-reduced-motion: reduce) { .track, .thumb { transition: none; } :host([loading]) .thumb::after { animation: none; } }
|
|
31
|
+
`;
|
|
32
|
+
const label = document.createElement('label');
|
|
33
|
+
label.part.add('label');
|
|
34
|
+
const track = document.createElement('span');
|
|
35
|
+
track.className = 'track';
|
|
36
|
+
track.part.add('track');
|
|
37
|
+
track.setAttribute('aria-hidden', 'true');
|
|
38
|
+
const thumb = document.createElement('span');
|
|
39
|
+
thumb.className = 'thumb';
|
|
40
|
+
thumb.part.add('thumb');
|
|
41
|
+
this._text.className = 'state';
|
|
42
|
+
this._text.part.add('state');
|
|
43
|
+
this._input.type = 'checkbox';
|
|
44
|
+
this._input.setAttribute('role', 'switch');
|
|
45
|
+
this._input.part.add('input');
|
|
46
|
+
track.append(thumb, this._text);
|
|
47
|
+
label.append(this._input, track, this._labelSlot);
|
|
48
|
+
root.append(style, label);
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() { this._input.addEventListener('change', this._onChange); this._input.addEventListener('keydown', this._onKeydown); this._sync(); this._formControl.connect(); }
|
|
51
|
+
disconnectedCallback() { this._input.removeEventListener('change', this._onChange); this._input.removeEventListener('keydown', this._onKeydown); }
|
|
52
|
+
attributeChangedCallback() { this._sync(); }
|
|
53
|
+
get checked() { return this.hasAttribute('checked'); }
|
|
54
|
+
set checked(value) { this.toggleAttribute('checked', Boolean(value)); }
|
|
55
|
+
get disabled() { return this.hasAttribute('disabled'); }
|
|
56
|
+
set disabled(value) { this.toggleAttribute('disabled', Boolean(value)); }
|
|
57
|
+
get loading() { return this.hasAttribute('loading'); }
|
|
58
|
+
set loading(value) { this.toggleAttribute('loading', Boolean(value)); }
|
|
59
|
+
get value() { return this.getAttribute('value') ?? 'on'; }
|
|
60
|
+
set value(value) { this.setAttribute('value', String(value)); }
|
|
61
|
+
get name() { return this.getAttribute('name') ?? ''; }
|
|
62
|
+
set name(value) { this.setAttribute('name', value); }
|
|
63
|
+
get label() { return this.getAttribute('label') ?? ''; }
|
|
64
|
+
set label(value) { this.setAttribute('label', value); }
|
|
65
|
+
get size() { return this.getAttribute('size') === 'small' ? 'small' : 'default'; }
|
|
66
|
+
set size(value) { this.setAttribute('size', value); }
|
|
67
|
+
get form() { return this._formControl.internals.form; }
|
|
68
|
+
checkValidity() { return this._formControl.internals.checkValidity(); }
|
|
69
|
+
reportValidity() { return this._formControl.internals.reportValidity(); }
|
|
70
|
+
setCustomValidity(message) { this._formControl.setCustomValidity(message); }
|
|
71
|
+
formDisabledCallback(disabled) { this._formControl.disabled = disabled; this._sync(); }
|
|
72
|
+
formResetCallback() { this._formControl.reset(); }
|
|
73
|
+
formStateRestoreCallback(state) { this._formControl.restore(state); }
|
|
74
|
+
focus(options) { this._input.focus(options); }
|
|
75
|
+
click() { this._input.click(); }
|
|
76
|
+
_sync() {
|
|
77
|
+
this._input.checked = this.checked;
|
|
78
|
+
this._input.disabled = this.disabled || this.loading || this._formControl.disabled;
|
|
79
|
+
this._input.required = this.hasAttribute('required');
|
|
80
|
+
this._input.value = this.value;
|
|
81
|
+
this._input.setAttribute('aria-checked', String(this.checked));
|
|
82
|
+
this._input.setAttribute('aria-busy', String(this.loading));
|
|
83
|
+
const name = this.getAttribute('aria-label') ?? this.label;
|
|
84
|
+
if (name)
|
|
85
|
+
this._input.setAttribute('aria-label', name);
|
|
86
|
+
else
|
|
87
|
+
this._input.removeAttribute('aria-label');
|
|
88
|
+
this._labelSlot.textContent = this.label;
|
|
89
|
+
this._text.textContent = this.getAttribute(this.checked ? 'checked-text' : 'unchecked-text') ?? '';
|
|
90
|
+
this._formControl.sync();
|
|
91
|
+
}
|
|
92
|
+
_onChange = () => {
|
|
93
|
+
this.checked = this._input.checked;
|
|
94
|
+
this.dispatchEvent(new CustomEvent('checked-change', { detail: { checked: this.checked, value: this.value }, bubbles: true, composed: true }));
|
|
95
|
+
this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
|
|
96
|
+
};
|
|
97
|
+
_onKeydown = (event) => { if (event.key === 'Enter' && !event.isComposing) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
this._input.click();
|
|
100
|
+
} };
|
|
101
|
+
}
|
|
102
|
+
export function defineSwitchComponents() { if (!customElements.get('hy-switch'))
|
|
103
|
+
customElements.define('hy-switch', HYSwitch); }
|
|
104
|
+
//# sourceMappingURL=switch.js.map
|
package/dist/table.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class HYTable<T extends object = Record<string, unknown>> extends
|
|
|
59
59
|
static get observedAttributes(): string[];
|
|
60
60
|
constructor();
|
|
61
61
|
connectedCallback(): void;
|
|
62
|
-
attributeChangedCallback(): void;
|
|
62
|
+
attributeChangedCallback(name?: string): void;
|
|
63
63
|
get columns(): readonly HYTableColumn<T>[];
|
|
64
64
|
set columns(value: readonly HYTableColumn<T>[]);
|
|
65
65
|
get dataSource(): readonly T[];
|
|
@@ -87,15 +87,15 @@ export declare class HYTable<T extends object = Record<string, unknown>> extends
|
|
|
87
87
|
setFilter(key: string, value: string): void;
|
|
88
88
|
clearFilters(): void;
|
|
89
89
|
private _syncAttributes;
|
|
90
|
+
private _update;
|
|
90
91
|
private _render;
|
|
92
|
+
private _syncHeaderState;
|
|
91
93
|
private _renderHeader;
|
|
92
94
|
private _createFilterMenu;
|
|
93
95
|
private _updateFilterFromControl;
|
|
94
96
|
private _renderBodyAndPagination;
|
|
95
97
|
private _createRow;
|
|
96
98
|
private _renderPagination;
|
|
97
|
-
private _pageButton;
|
|
98
|
-
private _pageNumbers;
|
|
99
99
|
private _processedRecords;
|
|
100
100
|
private _visibleRecords;
|
|
101
101
|
private _clampPage;
|