litos-ui 0.23.1 → 0.24.0
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/lib/base.d.ts +3 -2
- package/lib/base.js +11 -8
- package/lib/button/index.d.ts +21 -5
- package/lib/button/index.js +115 -62
- package/lib/button/index.less_inline.js +2 -3
- package/lib/button/style.js +1 -2
- package/lib/calendar/index.js +22 -24
- package/lib/calendar/index.less_inline.js +1 -2
- package/lib/calendar/langs.js +1 -2
- package/lib/card/index.js +8 -9
- package/lib/card/index.less_inline.js +1 -2
- package/lib/carousel/index.js +10 -11
- package/lib/carousel/index.less_inline.js +1 -2
- package/lib/carousel/item.js +1 -2
- package/lib/carousel/item.less_inline.js +1 -2
- package/lib/carousel/timer.js +1 -2
- package/lib/check/check.d.ts +40 -8
- package/lib/check/check.js +200 -65
- package/lib/check/check.less_inline.js +2 -3
- package/lib/check/checkbox.js +2 -3
- package/lib/check/checkbox.less_inline.js +2 -3
- package/lib/check/checkbox_group.js +1 -2
- package/lib/check/index.d.ts +28 -8
- package/lib/check/index.js +151 -46
- package/lib/check/index.less_inline.js +1 -2
- package/lib/check/radio.js +2 -3
- package/lib/check/radio.less_inline.js +1 -2
- package/lib/check/radio_group.js +2 -3
- package/lib/collapse/index.d.ts +12 -4
- package/lib/collapse/index.js +80 -46
- package/lib/collapse/index.less_inline.js +2 -3
- package/lib/collapse/item.d.ts +35 -9
- package/lib/collapse/item.js +219 -57
- package/lib/collapse/item.less_inline.js +2 -3
- package/lib/collapse/types.d.ts +17 -3
- package/lib/color_picker/index.d.ts +4 -2
- package/lib/color_picker/index.js +26 -17
- package/lib/color_picker/index.less_inline.js +1 -2
- package/lib/date_picker/index.d.ts +5 -1
- package/lib/date_picker/index.js +39 -23
- package/lib/date_picker/index.less_inline.js +1 -2
- package/lib/date_picker_ori/index.d.ts +7 -2
- package/lib/date_picker_ori/index.js +123 -47
- package/lib/date_picker_ori/index.less_inline.js +1 -2
- package/lib/description_panel/index.js +2 -10
- package/lib/description_panel/index.less_inline.js +1 -2
- package/lib/dialog/dialog_box.js +28 -29
- package/lib/dialog/dialog_container.css_inline.js +1 -2
- package/lib/dialog/dialog_container.js +13 -14
- package/lib/dialog/dialog_container_style.js +1 -2
- package/lib/dialog/index.js +1 -2
- package/lib/dropdown/index.d.ts +39 -0
- package/lib/dropdown/index.js +98 -0
- package/lib/entries/base.js +1 -2
- package/lib/entries/button.js +5 -6
- package/lib/entries/calendar.js +5 -6
- package/lib/entries/card.js +5 -6
- package/lib/entries/carousel-item.js +5 -6
- package/lib/entries/carousel.js +5 -6
- package/lib/entries/checkbox-group.js +5 -6
- package/lib/entries/checkbox.js +5 -6
- package/lib/entries/collapse-item.d.ts +0 -1
- package/lib/entries/collapse-item.js +6 -6
- package/lib/entries/collapse.d.ts +0 -1
- package/lib/entries/collapse.js +11 -6
- package/lib/entries/color-picker.js +5 -6
- package/lib/entries/date-picker-ori.js +5 -6
- package/lib/entries/date-picker.js +5 -6
- package/lib/entries/description-panel.js +5 -6
- package/lib/entries/dialog-box.js +1 -2
- package/lib/entries/dialog-container.js +5 -6
- package/lib/entries/dialog.js +1 -2
- package/lib/entries/dropdown.d.ts +2 -0
- package/lib/entries/dropdown.js +1 -0
- package/lib/entries/form-item.js +5 -6
- package/lib/entries/form.js +5 -6
- package/lib/entries/icon-arrow-down.js +5 -6
- package/lib/entries/icon-arrow-left.js +5 -6
- package/lib/entries/icon-arrow-right.js +5 -6
- package/lib/entries/icon-arrow-up.js +5 -6
- package/lib/entries/icon-base.js +5 -6
- package/lib/entries/icon-calendar.js +5 -6
- package/lib/entries/icon-caret-bottom.js +5 -6
- package/lib/entries/icon-caret-top.js +5 -6
- package/lib/entries/icon-close-filled.js +5 -6
- package/lib/entries/icon-close.js +5 -6
- package/lib/entries/icon-copy.js +5 -6
- package/lib/entries/icon-d-arrow-left.js +5 -6
- package/lib/entries/icon-d-arrow-right.js +5 -6
- package/lib/entries/icon-delete.js +5 -6
- package/lib/entries/icon-eye-outline.js +5 -6
- package/lib/entries/icon-font-icon.js +5 -6
- package/lib/entries/icon-info.js +5 -6
- package/lib/entries/icon-loading.js +5 -6
- package/lib/entries/icon-minus.js +5 -6
- package/lib/entries/icon-moon.js +5 -6
- package/lib/entries/icon-more.js +5 -6
- package/lib/entries/icon-picture.js +5 -6
- package/lib/entries/icon-plus.js +5 -6
- package/lib/entries/icon-reduction.js +5 -6
- package/lib/entries/icon-refresh-left.js +5 -6
- package/lib/entries/icon-refresh-right.js +5 -6
- package/lib/entries/icon-refresh.js +5 -6
- package/lib/entries/icon-search.js +5 -6
- package/lib/entries/icon-select.js +5 -6
- package/lib/entries/icon-sort.js +5 -6
- package/lib/entries/icon-success.js +5 -6
- package/lib/entries/icon-sun.js +5 -6
- package/lib/entries/icon-theme-default.js +5 -6
- package/lib/entries/icon-warn.js +5 -6
- package/lib/entries/icon-zoom-in.js +5 -6
- package/lib/entries/icon-zoom-out.js +5 -6
- package/lib/entries/image-preview.js +5 -6
- package/lib/entries/image.js +5 -6
- package/lib/entries/input-number.js +5 -6
- package/lib/entries/input.js +5 -6
- package/lib/entries/list.js +5 -6
- package/lib/entries/loading.js +1 -2
- package/lib/entries/mask.js +5 -6
- package/lib/entries/md-input.js +5 -6
- package/lib/entries/menu.js +5 -6
- package/lib/entries/message.js +1 -2
- package/lib/entries/modal-box.js +1 -2
- package/lib/entries/modal.js +5 -6
- package/lib/entries/notification-box.js +1 -2
- package/lib/entries/notification.js +1 -2
- package/lib/entries/page-header.js +5 -6
- package/lib/entries/pagination.js +5 -6
- package/lib/entries/polygon.js +5 -6
- package/lib/entries/popconfirm.js +1 -2
- package/lib/entries/popover.js +1 -2
- package/lib/entries/qrcode.js +5 -6
- package/lib/entries/radio-group.js +5 -6
- package/lib/entries/radio.js +5 -6
- package/lib/entries/select-ori.js +5 -6
- package/lib/entries/select.js +5 -6
- package/lib/entries/space.js +5 -6
- package/lib/entries/switch.js +5 -6
- package/lib/entries/tabbar-item.js +5 -6
- package/lib/entries/tabbar.js +5 -6
- package/lib/entries/table.js +5 -6
- package/lib/entries/tabs.js +1 -2
- package/lib/entries/tag.js +5 -6
- package/lib/entries/theme-color.js +5 -6
- package/lib/entries/theme.js +5 -6
- package/lib/entries/transition.js +1 -2
- package/lib/entries/upload.js +5 -6
- package/lib/entries/utils.js +1 -3
- package/lib/form/accessibility.d.ts +15 -0
- package/lib/form/accessibility.js +56 -0
- package/lib/form/autocomplete.d.ts +21 -0
- package/lib/form/autocomplete.js +59 -0
- package/lib/form/context.d.ts +157 -0
- package/lib/form/context.js +88 -0
- package/lib/form/form_inner.d.ts +99 -24
- package/lib/form/form_inner.js +424 -72
- package/lib/form/form_item.d.ts +35 -11
- package/lib/form/form_item.js +210 -78
- package/lib/form/form_item.less_inline.js +2 -3
- package/lib/form/form_item_style.d.ts +3 -0
- package/lib/form/form_item_style.js +7 -0
- package/lib/form/index.d.ts +69 -15
- package/lib/form/index.js +501 -101
- package/lib/form/index.less_inline.js +1 -2
- package/lib/form/owner.d.ts +78 -0
- package/lib/form/owner.js +138 -0
- package/lib/form/style.d.ts +3 -0
- package/lib/form/style.js +7 -0
- package/lib/icon/arrow_down.js +1 -2
- package/lib/icon/arrow_left.js +1 -2
- package/lib/icon/arrow_right.js +1 -2
- package/lib/icon/arrow_up.js +1 -2
- package/lib/icon/base.js +1 -2
- package/lib/icon/calendar.js +1 -2
- package/lib/icon/caret_bottom.js +1 -2
- package/lib/icon/caret_top.js +1 -2
- package/lib/icon/close.js +1 -2
- package/lib/icon/close_filled.js +1 -2
- package/lib/icon/copy.js +1 -2
- package/lib/icon/d_arrow_left.js +1 -2
- package/lib/icon/d_arrow_right.js +1 -2
- package/lib/icon/delete.js +1 -2
- package/lib/icon/eye_outline.js +1 -2
- package/lib/icon/font_icon.js +1 -2
- package/lib/icon/icon_style.js +1 -2
- package/lib/icon/index.less_inline.js +1 -2
- package/lib/icon/info.js +1 -2
- package/lib/icon/loading.js +1 -2
- package/lib/icon/minus.js +1 -2
- package/lib/icon/moon.js +1 -2
- package/lib/icon/more.js +1 -2
- package/lib/icon/picture.js +1 -2
- package/lib/icon/plus.js +1 -2
- package/lib/icon/reduction.js +1 -2
- package/lib/icon/refresh.js +1 -2
- package/lib/icon/refresh_left.js +1 -2
- package/lib/icon/refresh_right.js +1 -2
- package/lib/icon/search.js +1 -2
- package/lib/icon/select.js +1 -2
- package/lib/icon/sort.js +1 -2
- package/lib/icon/success.js +1 -2
- package/lib/icon/sun.js +1 -2
- package/lib/icon/theme_default.js +1 -2
- package/lib/icon/warn.js +1 -2
- package/lib/icon/zoom_in.js +1 -2
- package/lib/icon/zoom_out.js +1 -2
- package/lib/image/image_preview.js +1 -2
- package/lib/image/image_preview.less_inline.js +1 -2
- package/lib/image/index.js +1 -2
- package/lib/image/index.less_inline.js +1 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +91 -91
- package/lib/input/index.d.ts +14 -0
- package/lib/input/index.js +126 -31
- package/lib/input/index.less_inline.js +2 -3
- package/lib/input/input_inner.less_inline.js +1 -2
- package/lib/input/style.d.ts +1 -0
- package/lib/input/style.js +5 -7
- package/lib/input_number/index.d.ts +7 -0
- package/lib/input_number/index.js +70 -48
- package/lib/input_number/index.less_inline.js +1 -2
- package/lib/input_number/style.js +1 -2
- package/lib/list/index.js +4 -5
- package/lib/list/index.less_inline.js +1 -2
- package/lib/loading/index.js +1 -2
- package/lib/mask/index.js +2 -7
- package/lib/mask/index.less_inline.js +1 -2
- package/lib/md_input/index.d.ts +11 -2
- package/lib/md_input/index.js +63 -27
- package/lib/md_input/index.less_inline.js +2 -3
- package/lib/menu/index.js +2 -7
- package/lib/menu/index.less_inline.js +1 -2
- package/lib/message/index.js +1 -2
- package/lib/modal/index.js +15 -16
- package/lib/modal/index.less_inline.js +1 -2
- package/lib/modal/modal_box.js +24 -25
- package/lib/notification/index.js +15 -29
- package/lib/notification/index.less_inline.js +1 -2
- package/lib/notification/notification_box.js +2 -3
- package/lib/notification/placement.js +1 -2
- package/lib/notification/style.js +1 -2
- package/lib/page_header/index.js +1 -2
- package/lib/page_header/index.less_inline.js +1 -2
- package/lib/pagination/index.js +2 -7
- package/lib/pagination/index.less_inline.js +1 -2
- package/lib/polygon/index.js +1 -2
- package/lib/polygon/index.less_inline.js +1 -2
- package/lib/qrcode/index.js +1 -2
- package/lib/qrcode/index.less_inline.js +1 -2
- package/lib/select/index.d.ts +19 -2
- package/lib/select/index.js +128 -74
- package/lib/select/index.less_inline.js +1 -2
- package/lib/select_ori/index.d.ts +9 -1
- package/lib/select_ori/index.js +36 -24
- package/lib/select_ori/index.less_inline.js +1 -2
- package/lib/space/index.js +1 -2
- package/lib/space/index.less_inline.js +1 -2
- package/lib/styles/animation/index.css_inline.js +1 -2
- package/lib/styles/animation/index.js +1 -2
- package/lib/styles/mask/index.css_inline.js +1 -2
- package/lib/styles/mask/index.js +1 -2
- package/lib/switch/index.d.ts +6 -0
- package/lib/switch/index.js +31 -16
- package/lib/switch/index.less_inline.js +1 -2
- package/lib/tabbar/index.js +1 -2
- package/lib/tabbar/index.less_inline.js +1 -2
- package/lib/tabbar/item.js +1 -2
- package/lib/tabbar/item.less_inline.js +1 -2
- package/lib/table/index.js +1 -2
- package/lib/table/index.less_inline.js +1 -2
- package/lib/tabs/index.js +1 -2
- package/lib/tag/index.d.ts +11 -3
- package/lib/tag/index.js +25 -24
- package/lib/tag/index.less_inline.js +2 -3
- package/lib/theme/appearance.d.ts +5 -0
- package/lib/theme/appearance.js +34 -0
- package/lib/theme/index.js +83 -39
- package/lib/theme/index.less_inline.js +1 -2
- package/lib/theme/theme_color.js +1 -2
- package/lib/upload/index.js +28 -41
- package/lib/upload/index.less_inline.js +2 -3
- package/lib/upload/style.js +1 -2
- package/lib/utils/clickoutside.js +1 -2
- package/lib/utils/event.js +1 -2
- package/lib/utils/index.d.ts +27 -6
- package/lib/utils/index.js +26 -6
- package/lib/utils/popover.js +7 -16
- package/lib/utils/transition.js +1 -2
- package/package.json +16 -13
- package/styles/dark.css +10 -2
- package/styles/dropdown.css +46 -0
- package/styles/reset.css +0 -1
- package/styles/select.css +5 -0
- package/styles/themes/apple.css +47 -0
- package/styles/{theme-coral.css → themes/coral.css} +5 -3
- package/styles/themes/deep-sea-blue.css +12 -0
- package/styles/themes/gamboge.css +15 -0
- package/styles/{theme-jade.css → themes/jade.css} +5 -3
- package/styles/themes/lotus-seed.css +12 -0
- package/styles/{theme-tangerine.css → themes/tangerine.css} +5 -3
- package/styles/themes.css +8 -0
- package/styles/vars.css +8 -2
- package/types/preact.d.ts +42 -0
- package/lib/form/types.d.ts +0 -7
- package/lib/utils/context_provide.d.ts +0 -10
- package/lib/utils/context_provide.js +0 -22
- package/lib/utils/locale.d.ts +0 -6
- package/lib/utils/locale.js +0 -34
- package/lib/utils/signal_types.d.ts +0 -5
package/lib/polygon/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import e from "../base.js";
|
|
|
2
2
|
import { initAttr as t } from "../utils/index.js";
|
|
3
3
|
import n from "./index.less_inline.js";
|
|
4
4
|
import { formatClass as r, formatStyle as i } from "utilane/browser";
|
|
5
|
-
|
|
5
|
+
// src/components/polygon/index.ts
|
|
6
6
|
var a = class extends e {
|
|
7
7
|
static baseName = "polygon";
|
|
8
8
|
shape = "triangle-top";
|
|
@@ -17,5 +17,4 @@ var a = class extends e {
|
|
|
17
17
|
return `<div part="default" class="${r(["l-polygon", this.shape ? `l-polygon-${this.shape}` : ""])}" style="${i([this.background ? `--l-polygen-background: ${this.background}` : ""])}"></div>`;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { a as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/polygon/index.less?inline
|
|
2
2
|
var e = ".l-polygon{--l-polygen-size:10px;--l-polygen-width:var(--l-polygen-size);--l-polygen-height:var(--l-polygen-size);--l-polygen-background:#666;width:var(--l-polygen-width);height:var(--l-polygen-height);background:var(--l-polygen-background);transition:background .3s ease-in-out;display:inline-block}.l-polygon-triangle-top{clip-path:polygon(calc(var(--l-polygen-width) / 2) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}.l-polygon-triangle-top-left{clip-path:polygon(0 0, var(--l-polygen-width) 0, 0 var(--l-polygen-height))}.l-polygon-triangle-top-right{clip-path:polygon(0 0, var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-right{clip-path:polygon(0 0, var(--l-polygen-width) calc(var(--l-polygen-height) / 2), 0 var(--l-polygen-height))}.l-polygon-triangle-left{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 calc(var(--l-polygen-height) / 2))}.l-polygon-triangle-bottom{clip-path:polygon(0 0, var(--l-polygen-width) 0, calc(var(--l-polygen-width) / 2) var(--l-polygen-height))}.l-polygon-triangle-bottom-left{clip-path:polygon(0 0, 0 var(--l-polygen-height), var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-bottom-right{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as default };
|
package/lib/qrcode/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import e from "../base.js";
|
|
|
2
2
|
import t from "./index.less_inline.js";
|
|
3
3
|
import { $one as n } from "utilane/browser";
|
|
4
4
|
import { QRCodeRender as r, renderToCanvas as i } from "qrcode-generator-es";
|
|
5
|
-
|
|
5
|
+
// src/components/qrcode/index.ts
|
|
6
6
|
var a = class extends e {
|
|
7
7
|
static baseName = "qrcode";
|
|
8
8
|
_qrcode;
|
|
@@ -61,5 +61,4 @@ var a = class extends e {
|
|
|
61
61
|
return "<canvas class='renderer-el'></canvas>";
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
//#endregion
|
|
65
64
|
export { a as default };
|
package/lib/select/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import FormInner from "../form/form_inner";
|
|
2
2
|
export type SelectOption = {
|
|
3
3
|
class?: string;
|
|
4
|
+
disabled?: boolean;
|
|
4
5
|
render?: (option: SelectOption, isSelect: boolean, selectedValues?: any | any[]) => HTMLElement | DocumentFragment;
|
|
5
6
|
label?: string;
|
|
6
7
|
value?: any;
|
|
@@ -43,6 +44,9 @@ export default class Select extends FormInner<SelectState> {
|
|
|
43
44
|
/** 下拉弹窗主体 */
|
|
44
45
|
private _popover?;
|
|
45
46
|
private _searchEl?;
|
|
47
|
+
private editingSearch;
|
|
48
|
+
private emptyOptionDefault;
|
|
49
|
+
private reflectingEmptyOptionDefault;
|
|
46
50
|
constructor();
|
|
47
51
|
setInputHandler(handler: (match: string) => void): void;
|
|
48
52
|
setFilter(filter: (match: string, option: SelectOption) => boolean): void;
|
|
@@ -50,7 +54,20 @@ export default class Select extends FormInner<SelectState> {
|
|
|
50
54
|
set loading(loading: boolean | undefined);
|
|
51
55
|
setLoading(loading: boolean): void;
|
|
52
56
|
setExpanded(value: boolean): void;
|
|
53
|
-
|
|
57
|
+
protected get intrinsicDefaultValue(): string | string[];
|
|
58
|
+
get defaultValue(): any;
|
|
59
|
+
set defaultValue(value: any);
|
|
60
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
61
|
+
protected parseDefaultValue(value: string | null): string | string[];
|
|
62
|
+
protected formatDefaultValue(value: any): string;
|
|
63
|
+
private normalizeValue;
|
|
64
|
+
setValue(value: any): void;
|
|
65
|
+
protected get nativeValueMissing(): boolean;
|
|
66
|
+
private get hasObjectValue();
|
|
67
|
+
protected get nativeSubmissionError(): string | undefined;
|
|
68
|
+
protected get nativeConstraintValues(): readonly unknown[];
|
|
69
|
+
protected get formStateRestorationEnabled(): boolean;
|
|
70
|
+
protected serializeFormValue(): string | FormData | null;
|
|
54
71
|
private _updateSelectedLabels;
|
|
55
72
|
static get observedAttributes(): string[];
|
|
56
73
|
protected attributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
@@ -59,7 +76,6 @@ export default class Select extends FormInner<SelectState> {
|
|
|
59
76
|
set options(opts: SelectOption[] | undefined);
|
|
60
77
|
setOptions(options: SelectOption[] | undefined): void;
|
|
61
78
|
private _isOptionSelect;
|
|
62
|
-
private _updateOptionSelect;
|
|
63
79
|
private _renderOption;
|
|
64
80
|
private _calculateOffset;
|
|
65
81
|
isEmpty(): boolean;
|
|
@@ -69,6 +85,7 @@ export default class Select extends FormInner<SelectState> {
|
|
|
69
85
|
private _togglePopover;
|
|
70
86
|
private _updatePopoverContent;
|
|
71
87
|
private _onRootTap;
|
|
88
|
+
private _commitSelection;
|
|
72
89
|
private _onTap;
|
|
73
90
|
private _onSearchBlur;
|
|
74
91
|
private _onSearchInput;
|
package/lib/select/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "../utils/index.js";
|
|
2
|
-
import r from "
|
|
3
|
-
import i from "
|
|
2
|
+
import r from "./index.less_inline.js";
|
|
3
|
+
import i from "../form/form_inner.js";
|
|
4
4
|
import { Popover as a } from "../utils/popover.js";
|
|
5
5
|
import { $ as o, $$ as s, $one as c, debounce as l, iterate as u, off as d, on as f, shouldEventNext as p } from "utilane/browser";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// src/components/select/index.ts
|
|
7
|
+
function m(e) {
|
|
8
|
+
return typeof e == "object" && !!e;
|
|
9
|
+
}
|
|
10
|
+
var h = class extends i {
|
|
8
11
|
static baseName = "select";
|
|
9
12
|
selectedLabels = [];
|
|
10
13
|
filter;
|
|
@@ -13,8 +16,11 @@ var m = class extends r {
|
|
|
13
16
|
inputHandler;
|
|
14
17
|
_popover;
|
|
15
18
|
_searchEl;
|
|
19
|
+
editingSearch = !1;
|
|
20
|
+
emptyOptionDefault = !1;
|
|
21
|
+
reflectingEmptyOptionDefault = !1;
|
|
16
22
|
constructor() {
|
|
17
|
-
super(!
|
|
23
|
+
super(!1), this.version = 2, this._state = {
|
|
18
24
|
filterable: !1,
|
|
19
25
|
placeholder: "请选择",
|
|
20
26
|
emptyText: "暂无数据",
|
|
@@ -46,19 +52,73 @@ var m = class extends r {
|
|
|
46
52
|
setExpanded(e) {
|
|
47
53
|
this._state.expanded = e, e ? (this.classList.add("l-select--expand"), this._searchEl && this._searchEl.focus()) : this.classList.remove("l-select--expand");
|
|
48
54
|
}
|
|
55
|
+
get intrinsicDefaultValue() {
|
|
56
|
+
return this._state.multiple ? [] : "";
|
|
57
|
+
}
|
|
58
|
+
get defaultValue() {
|
|
59
|
+
return this._state.multiple && this.emptyOptionDefault ? [""] : super.defaultValue;
|
|
60
|
+
}
|
|
61
|
+
set defaultValue(e) {
|
|
62
|
+
this.reflectingEmptyOptionDefault = Array.isArray(e) && e.length === 1 && e[0] === "";
|
|
63
|
+
try {
|
|
64
|
+
super.defaultValue = e;
|
|
65
|
+
} finally {
|
|
66
|
+
this.reflectingEmptyOptionDefault = !1;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
attributeChangedCallback(e, t, n) {
|
|
70
|
+
if (e === "value") {
|
|
71
|
+
let e = this.emptyOptionDefault;
|
|
72
|
+
this.emptyOptionDefault = n === "" && this.reflectingEmptyOptionDefault, this.reflectingEmptyOptionDefault = !1, t === n && e !== this.emptyOptionDefault && this.applyDefaultValue();
|
|
73
|
+
}
|
|
74
|
+
super.attributeChangedCallback(e, t, n);
|
|
75
|
+
}
|
|
76
|
+
parseDefaultValue(e) {
|
|
77
|
+
return e === null ? this.intrinsicDefaultValue : this.normalizeValue(e);
|
|
78
|
+
}
|
|
79
|
+
formatDefaultValue(e) {
|
|
80
|
+
return Array.isArray(e) ? e.join(",") : String(e ?? "");
|
|
81
|
+
}
|
|
82
|
+
normalizeValue(e) {
|
|
83
|
+
return this._state.multiple ? e == null || e === "" ? [] : Array.isArray(e) ? [...e] : typeof e == "string" ? e.split(",") : [e] : Array.isArray(e) ? e[0] ?? "" : e;
|
|
84
|
+
}
|
|
49
85
|
setValue(e) {
|
|
50
|
-
|
|
51
|
-
|
|
86
|
+
super.setValue(this.normalizeValue(e)), this._updateSelectedLabels(), this._reRenderLabels(), this.isEmpty() && this._toggleClearable(!0), this._updatePopoverContent(), this.syncNativeValue();
|
|
87
|
+
}
|
|
88
|
+
get nativeValueMissing() {
|
|
89
|
+
return this.isEmpty();
|
|
90
|
+
}
|
|
91
|
+
get hasObjectValue() {
|
|
92
|
+
let e = this.getValue();
|
|
93
|
+
return this._state.multiple && Array.isArray(e) ? e.some(m) : m(e);
|
|
94
|
+
}
|
|
95
|
+
get nativeSubmissionError() {
|
|
96
|
+
if (this.name && this.hasObjectValue && this.serializeFormValue() === null) return "对象选项无法作为表单值提交,请使用选项标识。";
|
|
97
|
+
}
|
|
98
|
+
get nativeConstraintValues() {
|
|
99
|
+
return this.hasObjectValue ? [] : super.nativeConstraintValues;
|
|
100
|
+
}
|
|
101
|
+
get formStateRestorationEnabled() {
|
|
102
|
+
return !this.hasObjectValue;
|
|
103
|
+
}
|
|
104
|
+
serializeFormValue() {
|
|
105
|
+
if (this.hasObjectValue) return null;
|
|
106
|
+
let e = this.getValue();
|
|
107
|
+
if (!this._state.multiple) return e == null ? null : String(e);
|
|
108
|
+
let t = new FormData();
|
|
109
|
+
if (this.name) for (let n of Array.isArray(e) ? e : e == null || e === "" ? [] : [e]) t.append(this.name, String(n ?? ""));
|
|
110
|
+
return t;
|
|
52
111
|
}
|
|
53
112
|
_updateSelectedLabels() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
113
|
+
let { labelField: e, valueField: t, multiple: n } = this._state, r = this._backOptions ?? this._options, i = this.value, a = i == null ? [] : n ? i : [i];
|
|
114
|
+
this.selectedLabels = a.flatMap((i) => {
|
|
115
|
+
let a = r?.find((e) => e[t] === i);
|
|
116
|
+
return !a && !n && i === "" ? [] : [String(a?.[e] ?? i ?? "")];
|
|
117
|
+
});
|
|
59
118
|
}
|
|
60
119
|
static get observedAttributes() {
|
|
61
|
-
return [
|
|
120
|
+
return [.../* @__PURE__ */ new Set([
|
|
121
|
+
...i.observedAttributes,
|
|
62
122
|
"disabled",
|
|
63
123
|
"value",
|
|
64
124
|
"multiple",
|
|
@@ -72,7 +132,7 @@ var m = class extends r {
|
|
|
72
132
|
"clearable",
|
|
73
133
|
"remote",
|
|
74
134
|
"empty-text"
|
|
75
|
-
];
|
|
135
|
+
])];
|
|
76
136
|
}
|
|
77
137
|
attributeChange(r, i, a) {
|
|
78
138
|
switch (r) {
|
|
@@ -81,7 +141,7 @@ var m = class extends r {
|
|
|
81
141
|
break;
|
|
82
142
|
case "label-field":
|
|
83
143
|
case "value-field":
|
|
84
|
-
this._state[e(r)] = a;
|
|
144
|
+
this._state[e(r)] = a ?? r.replace("-field", "");
|
|
85
145
|
break;
|
|
86
146
|
case "empty-text":
|
|
87
147
|
this._state.emptyText = a ?? "暂无数据";
|
|
@@ -90,6 +150,8 @@ var m = class extends r {
|
|
|
90
150
|
this._state.placeholder = a ?? "请选择";
|
|
91
151
|
break;
|
|
92
152
|
case "multiple":
|
|
153
|
+
this._state.multiple = t(a, !1, r), this.dirtyValue ? this.setValue(this.value ?? this.intrinsicDefaultValue) : this.applyDefaultValue();
|
|
154
|
+
break;
|
|
93
155
|
case "clearable":
|
|
94
156
|
case "filterable":
|
|
95
157
|
case "collapse-tags":
|
|
@@ -100,7 +162,11 @@ var m = class extends r {
|
|
|
100
162
|
}
|
|
101
163
|
}
|
|
102
164
|
updateDOM(e) {
|
|
103
|
-
e.has("width") && (this._state.width ? this.style.setProperty("--l-select-width", this._state.width) : this.style.removeProperty("--l-select-width")), e.has("placeholder") && this._reRenderLabels(), (e.has("label-field") || e.has("value-field")
|
|
165
|
+
e.has("width") && (this._state.width ? this.style.setProperty("--l-select-width", this._state.width) : this.style.removeProperty("--l-select-width")), e.has("placeholder") && this._reRenderLabels(), (e.has("label-field") || e.has("value-field")) && (this._updateSelectedLabels(), this._reRenderLabels()), [
|
|
166
|
+
"label-field",
|
|
167
|
+
"value-field",
|
|
168
|
+
"empty-text"
|
|
169
|
+
].some((t) => e.has(t)) && this._updatePopoverContent();
|
|
104
170
|
}
|
|
105
171
|
get options() {
|
|
106
172
|
return this._options;
|
|
@@ -109,16 +175,12 @@ var m = class extends r {
|
|
|
109
175
|
this.setOptions(e);
|
|
110
176
|
}
|
|
111
177
|
setOptions(e) {
|
|
112
|
-
this._options = e, this._backOptions = [...e || []], this.
|
|
178
|
+
this._options = e, this._backOptions = [...e || []], this._updateSelectedLabels(), this._reRenderLabels(this._state.remote && this.editingSearch), this._updatePopoverContent();
|
|
113
179
|
}
|
|
114
180
|
_isOptionSelect(e) {
|
|
115
181
|
let t = !1;
|
|
116
182
|
return e != null && this.value != null && (t = this._state.multiple ? this.value.includes(e) : e === this.value), t;
|
|
117
183
|
}
|
|
118
|
-
_updateOptionSelect(e, t) {
|
|
119
|
-
let n = c(".l-select-icon", e);
|
|
120
|
-
t ? (e.classList.add("l-select-option--selected"), n || (n = s("l-select-icon", { class: "l-select-icon" }), e.appendChild(n))) : (e.classList.remove("l-select-option--selected"), n && n.remove());
|
|
121
|
-
}
|
|
122
184
|
_renderOption() {
|
|
123
185
|
let e = [];
|
|
124
186
|
if (this._options) {
|
|
@@ -131,8 +193,13 @@ var m = class extends r {
|
|
|
131
193
|
})];
|
|
132
194
|
a && o.push(s("l-select-icon", { class: "l-select-icon" }));
|
|
133
195
|
let c = s("li", {
|
|
134
|
-
class: [
|
|
135
|
-
|
|
196
|
+
class: [
|
|
197
|
+
"l-select-option",
|
|
198
|
+
a ? "l-select-option--selected" : void 0,
|
|
199
|
+
t.disabled ? "l-select-option--disabled" : void 0
|
|
200
|
+
],
|
|
201
|
+
"aria-disabled": t.disabled ? "true" : void 0,
|
|
202
|
+
"data-action": t.disabled ? void 0 : `${n}`
|
|
136
203
|
}, o);
|
|
137
204
|
e.push(c.outerHTML);
|
|
138
205
|
}
|
|
@@ -174,7 +241,7 @@ var m = class extends r {
|
|
|
174
241
|
this._toggleClearable(!0);
|
|
175
242
|
};
|
|
176
243
|
_togglePopover() {
|
|
177
|
-
if (this._popover) {
|
|
244
|
+
if (!this.isDisabled() && this._popover) {
|
|
178
245
|
if (this._popover.isShow()) {
|
|
179
246
|
this._popover.hide();
|
|
180
247
|
return;
|
|
@@ -186,18 +253,23 @@ var m = class extends r {
|
|
|
186
253
|
this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
187
254
|
}
|
|
188
255
|
_onRootTap = (e) => {
|
|
256
|
+
if (this.isDisabled()) return;
|
|
189
257
|
e.stopPropagation();
|
|
190
258
|
let [t, n, r] = p(e, "data-action", e.currentTarget);
|
|
191
259
|
if (t) {
|
|
192
|
-
if (n === "clear") this.
|
|
260
|
+
if (n === "clear") this.isEmpty() || this._commitSelection(this._state.multiple ? [] : ""), this._toggleClearable(!0);
|
|
193
261
|
else {
|
|
194
|
-
let e = Number(n);
|
|
195
|
-
|
|
262
|
+
let e = Number(n), t = this.value;
|
|
263
|
+
Array.isArray(t) && Number.isInteger(e) && e >= 0 && e < t.length && (this._commitSelection(t.filter((t, n) => n !== e)), this._searchEl?.focus());
|
|
196
264
|
}
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
this._togglePopover();
|
|
265
|
+
} else this._togglePopover();
|
|
200
266
|
};
|
|
267
|
+
_commitSelection(e) {
|
|
268
|
+
this.setValue(e), this.validateInput(), this.emit("change", { detail: {
|
|
269
|
+
value: Array.isArray(this.value) ? [...this.value] : this.value,
|
|
270
|
+
labels: [...this.selectedLabels]
|
|
271
|
+
} });
|
|
272
|
+
}
|
|
201
273
|
_onTap = () => {
|
|
202
274
|
this._togglePopover();
|
|
203
275
|
};
|
|
@@ -206,16 +278,13 @@ var m = class extends r {
|
|
|
206
278
|
};
|
|
207
279
|
_onSearchInput = (e) => {
|
|
208
280
|
if (this.inputHandler && this._state.filterable) {
|
|
281
|
+
this.editingSearch = !0;
|
|
209
282
|
let t = e.target.value;
|
|
210
283
|
this.inputHandler(t);
|
|
211
284
|
}
|
|
212
285
|
};
|
|
213
286
|
_handleFilte = (e) => {
|
|
214
|
-
|
|
215
|
-
this.emit("search", { detail: { value: e } });
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
this._options = this._filteOption(e), this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
287
|
+
this._state.remote ? this.emit("search", { detail: { value: e } }) : (this._options = this._filteOption(e), this._popover && this._state.expanded && this._popover.updatePopoverContent());
|
|
219
288
|
};
|
|
220
289
|
_filteOption(e) {
|
|
221
290
|
let t = [];
|
|
@@ -244,48 +313,34 @@ var m = class extends r {
|
|
|
244
313
|
onOutsideTap: (e, t, n) => {
|
|
245
314
|
!n && !t && this._popover?.hide();
|
|
246
315
|
},
|
|
247
|
-
onPopoverAction: (e
|
|
248
|
-
if (e
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
} else s = i, c = [a];
|
|
257
|
-
this._value != s && this.emit("change", { detail: {
|
|
258
|
-
value: s,
|
|
259
|
-
labels: c
|
|
260
|
-
} }), this._value = s, this.selectedLabels = c;
|
|
261
|
-
let l = this._isOptionSelect(i);
|
|
262
|
-
if (!this._state.multiple) {
|
|
263
|
-
let e = o(".l-select-option--selected", t.parentElement);
|
|
264
|
-
u(e, (e) => {
|
|
265
|
-
this._updateOptionSelect(e, !1);
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
this._updateOptionSelect(t, l), this._reRenderLabels(), !this._state.multiple && this._popover && this._popover.hide(), this._searchEl && this._state.multiple && this._searchEl.focus();
|
|
269
|
-
}
|
|
316
|
+
onPopoverAction: (e) => {
|
|
317
|
+
if (this.isDisabled() || e === "") return;
|
|
318
|
+
let t = this._options?.[Number(e)];
|
|
319
|
+
if (!t || t.disabled) return;
|
|
320
|
+
let n = t[this._state.valueField];
|
|
321
|
+
if (this._state.multiple) {
|
|
322
|
+
let e = this.value, t = e.includes(n) ? e.filter((e) => e !== n) : [...e, n];
|
|
323
|
+
this._commitSelection(t), this._searchEl?.focus();
|
|
324
|
+
} else this.value !== (n ?? "") && this._commitSelection(n), this._popover?.hide();
|
|
270
325
|
}
|
|
271
326
|
});
|
|
272
327
|
}
|
|
273
328
|
beforeDestroy() {
|
|
274
|
-
if (d(this, "mouseenter", this._onMouseEnter), d(this, "mouseleave", this._onMouseLeave), d(this.root, "click", this._onRootTap), d(this, "click", this._onTap), this.
|
|
329
|
+
if (d(this, "mouseenter", this._onMouseEnter), d(this, "mouseleave", this._onMouseLeave), d(this.root, "click", this._onRootTap), d(this, "click", this._onTap), this._popover &&= (this._popover.destroy(), void 0), this._searchEl) {
|
|
275
330
|
if (d(this._searchEl, "blur", this._onSearchBlur), d(this._searchEl, "input", this._onSearchInput), this.inputHandler) {
|
|
276
331
|
try {
|
|
277
332
|
this.inputHandler.cancel();
|
|
278
333
|
} catch {}
|
|
279
334
|
this.inputHandler = void 0;
|
|
280
335
|
}
|
|
281
|
-
this._searchEl = void 0;
|
|
336
|
+
this._searchEl = void 0, this.editingSearch = !1;
|
|
282
337
|
}
|
|
283
338
|
this.filter = void 0;
|
|
284
339
|
}
|
|
285
340
|
render_v2() {
|
|
286
341
|
return {
|
|
287
342
|
template: this.render(),
|
|
288
|
-
style: [
|
|
343
|
+
style: [r]
|
|
289
344
|
};
|
|
290
345
|
}
|
|
291
346
|
render() {
|
|
@@ -305,7 +360,7 @@ var m = class extends r {
|
|
|
305
360
|
disabledChange() {
|
|
306
361
|
if (!this.rendered) return;
|
|
307
362
|
let e = this.isDisabled();
|
|
308
|
-
this._popover && this._popover.setOption("disabled", e), e ? this.classList.add("l-select--disabled") : this.classList.remove("l-select--disabled"), this._searchEl && (this._searchEl.disabled = e);
|
|
363
|
+
this._popover && this._popover.setOption("disabled", e), e ? (this._popover?.hide(), this.classList.add("l-select--disabled")) : this.classList.remove("l-select--disabled"), this._searchEl && (this._searchEl.disabled = e);
|
|
309
364
|
}
|
|
310
365
|
_renderTag(e, t = 0, n = !0) {
|
|
311
366
|
let r = s("l-tag", {
|
|
@@ -324,22 +379,22 @@ var m = class extends r {
|
|
|
324
379
|
}
|
|
325
380
|
return r;
|
|
326
381
|
}
|
|
327
|
-
_reRenderLabels() {
|
|
328
|
-
let
|
|
329
|
-
if (
|
|
330
|
-
let
|
|
331
|
-
|
|
382
|
+
_reRenderLabels(e = !1) {
|
|
383
|
+
let t = c(".l-select-main", this.root);
|
|
384
|
+
if (t) {
|
|
385
|
+
let e = o(".l-selected-item", t);
|
|
386
|
+
e.length > 0 && u(e, (e) => {
|
|
332
387
|
e && e != this._searchEl && e.remove();
|
|
333
388
|
});
|
|
334
389
|
let n = this._renderSelectedLabels();
|
|
335
|
-
this._searchEl ?
|
|
390
|
+
this._searchEl ? t.insertBefore(n, this._searchEl) : t.appendChild(n);
|
|
336
391
|
}
|
|
337
|
-
this._updateSearchValue();
|
|
392
|
+
this._updateSearchValue(e);
|
|
338
393
|
}
|
|
339
|
-
_updateSearchValue() {
|
|
394
|
+
_updateSearchValue(e = !1) {
|
|
340
395
|
if (this._searchEl) {
|
|
341
|
-
let
|
|
342
|
-
this.selectedLabels.length > 0 && (this._state.multiple ?
|
|
396
|
+
let t = this._state.placeholder, n = "";
|
|
397
|
+
this.selectedLabels.length > 0 && (this._state.multiple ? t = "" : (t = this.selectedLabels[0], n = this.selectedLabels[0])), this._searchEl.placeholder = t, e || (this._searchEl.value = n, this.editingSearch = !1);
|
|
343
398
|
}
|
|
344
399
|
}
|
|
345
400
|
_renderSelectedLabels() {
|
|
@@ -358,5 +413,4 @@ var m = class extends r {
|
|
|
358
413
|
return e;
|
|
359
414
|
}
|
|
360
415
|
};
|
|
361
|
-
|
|
362
|
-
export { m as default };
|
|
416
|
+
export { h as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/select/index.less?inline
|
|
2
2
|
var e = ":host{--l-select-width:100%;min-height:var(--l-form-control-height,32px);width:var(--l-select-width);border:1px solid var(--l-border-color,#d9d9d9);cursor:pointer;box-sizing:border-box;border-radius:4px;justify-content:space-between;align-items:center;gap:5px;padding:4px 10px;font-size:14px;line-height:1;transition:border-color .3s;display:inline-flex;position:relative}:host(:hover){border-color:silver}:host(.l-select--disabled){background-color:var(--l-disabled-color,#f5f7fa);cursor:not-allowed}:host(.l-select--expand),:host(.l-select--active){border-color:var(--l-primary-color,#722ed1)}:host(.l-select--expand) .l-select-arrow{transform:rotate(180deg)}:host(.l-select--loading) .l-select-arrow{opacity:.2}:host(.l-select--clearable) .l-select-arrow{opacity:0}.l-select-main{box-sizing:border-box;flex-flow:wrap;flex-grow:1;gap:5px;display:flex;overflow:hidden}.l-selected-item{flex-shrink:0}.l-select-placeholder{flex-grow:1}.l-select-placeholder,.l-select-arrow{color:#a8abb2}.l-select-filter{background-color:#0000;border:none;outline:none;flex-grow:1;flex-shrink:0;width:0;min-width:15px;max-width:100%}.l-select-filter::placeholder{color:#a8abb2}.l-select-arrow{flex-shrink:0;transition:transform .3s,opacity .3s;transform:rotate(0)}.l-select-tag-close{box-sizing:border-box;cursor:pointer;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;margin-left:3px;font-size:12px;transition:color .3s,background-color .3s;display:inline-flex}.l-select-tag-close:hover{color:#fff;background-color:#999}.l-select-clear,.l-select-loading{position:absolute;top:50%;right:10px;transform:translateY(-50%)}.l-select-loading{color:var(--l-primary-color,#722ed1);z-index:2;animation:1.5s linear infinite l-select-loading}.l-select-clear{color:#afafaf;z-index:1}@keyframes l-select-loading{0%{transform:translateY(-50%)rotate(0)}to{transform:translateY(-50%)rotate(360deg)}}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as default };
|
|
@@ -2,11 +2,18 @@ import FormInner from "../form/form_inner";
|
|
|
2
2
|
type Option = {
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
|
+
defaultSelected?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
5
7
|
};
|
|
6
8
|
export default class SelectOri extends FormInner {
|
|
7
9
|
static baseName: string;
|
|
10
|
+
static get observedAttributes(): string[];
|
|
8
11
|
private $select?;
|
|
12
|
+
private optionsMarkup?;
|
|
13
|
+
private requestedValue;
|
|
9
14
|
constructor();
|
|
15
|
+
protected get intrinsicDefaultValue(): string;
|
|
16
|
+
protected serializeFormValue(): string | null;
|
|
10
17
|
connectedCallback(): void;
|
|
11
18
|
disconnectedCallback(): void;
|
|
12
19
|
render_v2(): {
|
|
@@ -15,9 +22,10 @@ export default class SelectOri extends FormInner {
|
|
|
15
22
|
};
|
|
16
23
|
render(): string;
|
|
17
24
|
protected disabledChange(): void;
|
|
25
|
+
private createOption;
|
|
26
|
+
private syncOptionsValue;
|
|
18
27
|
setOptions(options: Option[]): void;
|
|
19
28
|
appendOptions(options: Option[]): void;
|
|
20
|
-
reset(): void;
|
|
21
29
|
setValue(value: any): void;
|
|
22
30
|
private _handleChange;
|
|
23
31
|
}
|
package/lib/select_ori/index.js
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "../
|
|
1
|
+
import e from "../form/form_inner.js";
|
|
2
|
+
import { tagAttrs as t } from "../utils/index.js";
|
|
3
3
|
import n from "../input/input_inner.less_inline.js";
|
|
4
4
|
import r from "./index.less_inline.js";
|
|
5
5
|
import { $one as i, off as a, on as o } from "utilane/browser";
|
|
6
|
-
|
|
7
|
-
var s = class extends
|
|
6
|
+
// src/components/select_ori/index.ts
|
|
7
|
+
var s = class extends e {
|
|
8
8
|
static baseName = "select-ori";
|
|
9
|
+
static get observedAttributes() {
|
|
10
|
+
return [...new Set(e.observedAttributes)];
|
|
11
|
+
}
|
|
9
12
|
$select;
|
|
13
|
+
optionsMarkup;
|
|
14
|
+
requestedValue = "";
|
|
10
15
|
constructor() {
|
|
11
16
|
super(), this.version = 2;
|
|
12
17
|
}
|
|
18
|
+
get intrinsicDefaultValue() {
|
|
19
|
+
let e = document.createElement("select");
|
|
20
|
+
return e.innerHTML = this.$select?.innerHTML ?? this.optionsMarkup ?? this.innerHTML, e.value;
|
|
21
|
+
}
|
|
22
|
+
serializeFormValue() {
|
|
23
|
+
let e = this.$select?.selectedOptions[0];
|
|
24
|
+
return !e || e.disabled || e.closest("optgroup")?.disabled ? null : e.value;
|
|
25
|
+
}
|
|
13
26
|
connectedCallback() {
|
|
14
|
-
super.connectedCallback(), this.$select = i("select", this.root), this.
|
|
27
|
+
super.connectedCallback(), this.$select = i("select", this.root), this.syncOptionsValue(), o(this.$select, "change", this._handleChange);
|
|
15
28
|
}
|
|
16
29
|
disconnectedCallback() {
|
|
17
|
-
super.disconnectedCallback(), this.$select && a(this.$select, "change", this._handleChange), this.$select = void 0;
|
|
30
|
+
this.optionsMarkup = this.$select?.innerHTML ?? this.optionsMarkup, super.disconnectedCallback(), this.$select && a(this.$select, "change", this._handleChange), this.$select = void 0;
|
|
18
31
|
}
|
|
19
32
|
render_v2() {
|
|
20
33
|
return {
|
|
@@ -23,36 +36,35 @@ var s = class extends t {
|
|
|
23
36
|
};
|
|
24
37
|
}
|
|
25
38
|
render() {
|
|
26
|
-
let
|
|
27
|
-
return `<select class="l-input__inner"${
|
|
39
|
+
let e = this.optionsMarkup ?? this.innerHTML.trim();
|
|
40
|
+
return `<select class="l-input__inner"${t([["disabled", this.isDisabled()]])}>${e}</select>`;
|
|
28
41
|
}
|
|
29
42
|
disabledChange() {
|
|
30
43
|
this.$select && (this.$select.disabled = this.isDisabled());
|
|
31
44
|
}
|
|
45
|
+
createOption(e) {
|
|
46
|
+
let t = document.createElement("option");
|
|
47
|
+
return t.value = e.value, t.textContent = e.label, t.defaultSelected = e.defaultSelected ?? !1, t.disabled = e.disabled ?? !1, t;
|
|
48
|
+
}
|
|
49
|
+
syncOptionsValue() {
|
|
50
|
+
this.$select && (this.dirtyValue ? this.setValue(this.requestedValue) : this.applyDefaultValue());
|
|
51
|
+
}
|
|
32
52
|
setOptions(e) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.$select.innerHTML = t.join("");
|
|
53
|
+
let t = this.$select ?? this.ownerDocument.createElement("select");
|
|
54
|
+
t.replaceChildren(...e.map((e) => this.createOption(e))), this.optionsMarkup = t.innerHTML, this.syncOptionsValue();
|
|
36
55
|
}
|
|
37
56
|
appendOptions(e) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (let n = 0, r = e.length; n < r; n++) {
|
|
41
|
-
let r = e[n], i = document.createElement("option");
|
|
42
|
-
i.value = r.value, i.innerHTML = r.label, t.appendChild(i);
|
|
43
|
-
}
|
|
44
|
-
this.$select.appendChild(t);
|
|
45
|
-
}
|
|
46
|
-
reset() {
|
|
47
|
-
super.reset(), this.$select && (this.$select.value = this.value);
|
|
57
|
+
let t = this.$select ?? this.ownerDocument.createElement("select");
|
|
58
|
+
this.$select || (t.innerHTML = this.optionsMarkup ?? this.innerHTML), t.append(...e.map((e) => this.createOption(e))), this.optionsMarkup = t.innerHTML, this.syncOptionsValue();
|
|
48
59
|
}
|
|
49
60
|
setValue(e) {
|
|
50
|
-
|
|
61
|
+
let t = String(e ?? "");
|
|
62
|
+
this.requestedValue = t, this.$select && (this.$select.value = t), super.setValue(this.$select?.value ?? t);
|
|
51
63
|
}
|
|
52
64
|
_handleChange = (e) => {
|
|
65
|
+
e.stopPropagation();
|
|
53
66
|
let t = e.target.value;
|
|
54
|
-
super.setValue(t), this.emit("change", { detail: t });
|
|
67
|
+
this.requestedValue = t, super.setValue(t), this.validateInput(), this.emit("change", { detail: t });
|
|
55
68
|
};
|
|
56
69
|
};
|
|
57
|
-
//#endregion
|
|
58
70
|
export { s as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/select_ori/index.less?inline
|
|
2
2
|
var e = ":host{height:var(--l-form-control-height,32px);display:inline-flex}.l-input__inner{border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);transition:border-color .3s}.l-input__inner:hover{border-color:var(--l-primary-color-light1,#c6c6c6)}.l-input__inner:focus{border-color:var(--l-primary-color,#1890ff);box-shadow:0 0 0 3px var(--l-primary-color-light5)}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as default };
|
package/lib/space/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import e from "../base.js";
|
|
|
2
2
|
import { kebabToCamel as t, parseAttrValue as n } from "../utils/index.js";
|
|
3
3
|
import r from "./index.less_inline.js";
|
|
4
4
|
import { isNumeric as i } from "utilane";
|
|
5
|
-
|
|
5
|
+
// src/components/space/index.ts
|
|
6
6
|
var a = class extends e {
|
|
7
7
|
static baseName = "space";
|
|
8
8
|
connectedCallback() {
|
|
@@ -36,5 +36,4 @@ var a = class extends e {
|
|
|
36
36
|
return "<slot></slot>";
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
//#endregion
|
|
40
39
|
export { a as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/space/index.less?inline
|
|
2
2
|
var e = ":host{box-sizing:border-box;display:var(--l-space-display,flex);align-items:var(--l-space-align,center);justify-content:var(--l-space-justify,flex-start);gap:var(--l-space-gap,10px);flex-wrap:var(--l-space-wrap,nowrap);flex-direction:var(--l-space-direction,row)}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/styles/animation/index.css?inline
|
|
2
2
|
var e = "@keyframes l-rotate-frame{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.l-rotate-anim{animation:1.5s linear infinite l-rotate-frame}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as default };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import e from "./index.css_inline.js";
|
|
2
|
-
|
|
2
|
+
// src/components/styles/animation/index.ts
|
|
3
3
|
var t = /* @__PURE__ */ (() => {
|
|
4
4
|
let t = new CSSStyleSheet();
|
|
5
5
|
return t.replaceSync(e), t;
|
|
6
6
|
})();
|
|
7
|
-
//#endregion
|
|
8
7
|
export { t as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/styles/mask/index.css?inline
|
|
2
2
|
var e = ".l-mask{z-index:var(--l-mask-zindex,100);opacity:1;background-color:#0009;transition:opacity .3s;position:fixed;inset:0}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as default };
|
package/lib/styles/mask/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import e from "./index.css_inline.js";
|
|
2
|
-
|
|
2
|
+
// src/components/styles/mask/index.ts
|
|
3
3
|
var t = /* @__PURE__ */ (() => {
|
|
4
4
|
let t = new CSSStyleSheet();
|
|
5
5
|
return t.replaceSync(e), t;
|
|
6
6
|
})();
|
|
7
|
-
//#endregion
|
|
8
7
|
export { t as default };
|