litos-ui 0.20.1 → 0.21.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/dialog/dialog_box.js +1 -1
- package/lib/dialog/dialog_container.d.ts +1 -1
- package/lib/dialog/dialog_container.js +156 -2
- package/lib/dialog/dialog_container_style.d.ts +2 -0
- package/lib/dialog/dialog_container_style.js +2 -0
- package/lib/dialog_container_style-C1s0aBf7.js +5 -0
- package/lib/icon/arrow_down.js +1 -1
- package/lib/icon/arrow_left.js +1 -1
- package/lib/icon/arrow_right.js +1 -1
- package/lib/icon/arrow_up.js +1 -1
- package/lib/icon/base.d.ts +2 -1
- package/lib/icon/base.js +63 -2
- package/lib/icon/calendar.js +1 -1
- package/lib/icon/caret_bottom.js +1 -1
- package/lib/icon/caret_top.js +1 -1
- package/lib/icon/close.js +1 -1
- package/lib/icon/close_filled.js +1 -1
- package/lib/icon/copy.d.ts +6 -0
- package/lib/icon/copy.js +13 -0
- package/lib/icon/d_arrow_left.js +1 -1
- package/lib/icon/d_arrow_right.js +1 -1
- package/lib/icon/font_icon.js +1 -1
- package/lib/icon/icon_style.d.ts +2 -0
- package/lib/icon/icon_style.js +2 -0
- package/lib/icon/info.js +1 -1
- package/lib/icon/loading.js +1 -1
- package/lib/icon/moon.js +1 -1
- package/lib/icon/more.js +1 -1
- package/lib/icon/reduction.js +1 -1
- package/lib/icon/refresh.js +1 -1
- package/lib/icon/refresh_left.js +1 -1
- package/lib/icon/refresh_right.js +1 -1
- package/lib/icon/search.js +1 -1
- package/lib/icon/select.js +1 -1
- package/lib/icon/sort.js +1 -1
- package/lib/icon/success.js +1 -1
- package/lib/icon/sun.js +1 -1
- package/lib/icon/theme_default.js +1 -1
- package/lib/icon/warn.js +1 -1
- package/lib/icon/zoom_in.js +1 -1
- package/lib/icon/zoom_out.js +1 -1
- package/lib/icon_style-J7iiDS_a.js +5 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +66 -63
- package/lib/input_number/index.d.ts +59 -0
- package/lib/input_number/index.js +203 -0
- package/lib/input_number/style.d.ts +2 -0
- package/lib/input_number/style.js +2 -0
- package/lib/modal/modal_box.d.ts +22 -0
- package/lib/style-C5wUmE2b.js +5 -0
- package/package.json +1 -1
- package/lib/base-Dyj1rzaK.js +0 -61
- package/lib/dialog_container-BNPQ9n0V.js +0 -145
package/lib/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { initAttr as t, kebabToCamel as n, parseAttrValue as r, regist as i, setAttrs as a, stopSignal as o, tagAttr as s, tagAttrs as c, unitNumberStr as l, useId as u } from "./utils/index.js";
|
|
3
3
|
import { remove as d, set as f } from "./utils/clickoutside.js";
|
|
4
|
-
import
|
|
4
|
+
import p from "./icon/base.js";
|
|
5
5
|
import m from "./icon/close_filled.js";
|
|
6
6
|
import h from "./icon/success.js";
|
|
7
7
|
import g from "./icon/warn.js";
|
|
8
8
|
import _ from "./icon/info.js";
|
|
9
9
|
import v from "./message/index.js";
|
|
10
10
|
import y from "./dialog/index.js";
|
|
11
|
-
import
|
|
11
|
+
import b from "./dialog/dialog_container.js";
|
|
12
12
|
import x from "./button/index.js";
|
|
13
13
|
import S from "./icon/close.js";
|
|
14
14
|
import { t as C } from "./form_item-BqPMRABd.js";
|
|
@@ -17,64 +17,67 @@ import T from "./dialog/dialog_box.js";
|
|
|
17
17
|
import E from "./loading/index.js";
|
|
18
18
|
import D from "./tabs/index.js";
|
|
19
19
|
import { t as O } from "./modal-Cwi3qlEf.js";
|
|
20
|
-
import k from "./
|
|
21
|
-
import A from "./icon/
|
|
22
|
-
import j from "./icon/
|
|
23
|
-
import M from "./icon/
|
|
24
|
-
import N from "./icon/
|
|
25
|
-
import P from "./icon/
|
|
26
|
-
import F from "./icon/
|
|
27
|
-
import I from "./icon/
|
|
28
|
-
import L from "./icon/
|
|
29
|
-
import R from "./icon/
|
|
30
|
-
import z from "./icon/
|
|
31
|
-
import B from "./icon/
|
|
32
|
-
import V from "./icon/
|
|
33
|
-
import H from "./icon/
|
|
34
|
-
import U from "./icon/
|
|
35
|
-
import W from "./icon/
|
|
36
|
-
import G from "./icon/
|
|
37
|
-
import K from "./icon/
|
|
38
|
-
import q from "./icon/
|
|
39
|
-
import J from "./icon/
|
|
40
|
-
import Y from "./icon/
|
|
41
|
-
import X from "./icon/
|
|
42
|
-
import Z from "./icon/
|
|
43
|
-
import Q from "./icon/
|
|
44
|
-
import
|
|
45
|
-
import ee from "./
|
|
46
|
-
import { t as te } from "./
|
|
47
|
-
import
|
|
48
|
-
import re from "./
|
|
49
|
-
import { t as ie } from "./
|
|
50
|
-
import
|
|
51
|
-
import
|
|
52
|
-
import { t as se } from "./
|
|
53
|
-
import {
|
|
54
|
-
import { t as
|
|
55
|
-
import { t as
|
|
56
|
-
import {
|
|
57
|
-
import { t as _e } from "./
|
|
58
|
-
import { t as ve } from "./
|
|
59
|
-
import { t as ye } from "./
|
|
60
|
-
import { t as be } from "./
|
|
61
|
-
import { t as xe } from "./
|
|
62
|
-
import Se from "./
|
|
63
|
-
import { t as Ce } from "./
|
|
64
|
-
import { t as we } from "./
|
|
65
|
-
import
|
|
66
|
-
import { t as Ee } from "./
|
|
67
|
-
import { t as De } from "./
|
|
68
|
-
import { t as Oe } from "./
|
|
69
|
-
import { t as ke } from "./
|
|
70
|
-
import { t as Ae } from "./
|
|
71
|
-
import { t as je } from "./
|
|
72
|
-
import { t as Me } from "./
|
|
73
|
-
import { t as Ne } from "./
|
|
74
|
-
import { t as Pe } from "./
|
|
75
|
-
import { t as Fe } from "./
|
|
76
|
-
import { t as Ie } from "./
|
|
77
|
-
import { t as Le } from "./
|
|
78
|
-
import { t as Re } from "./
|
|
79
|
-
import { t as ze } from "./
|
|
80
|
-
|
|
20
|
+
import k from "./modal/modal_box.js";
|
|
21
|
+
import A from "./icon/arrow_down.js";
|
|
22
|
+
import j from "./icon/arrow_left.js";
|
|
23
|
+
import M from "./icon/arrow_right.js";
|
|
24
|
+
import N from "./icon/arrow_up.js";
|
|
25
|
+
import P from "./icon/caret_top.js";
|
|
26
|
+
import F from "./icon/caret_bottom.js";
|
|
27
|
+
import I from "./icon/font_icon.js";
|
|
28
|
+
import L from "./icon/loading.js";
|
|
29
|
+
import R from "./icon/search.js";
|
|
30
|
+
import z from "./icon/sun.js";
|
|
31
|
+
import B from "./icon/moon.js";
|
|
32
|
+
import V from "./icon/reduction.js";
|
|
33
|
+
import H from "./icon/refresh_left.js";
|
|
34
|
+
import U from "./icon/refresh_right.js";
|
|
35
|
+
import W from "./icon/sort.js";
|
|
36
|
+
import G from "./icon/theme_default.js";
|
|
37
|
+
import K from "./icon/more.js";
|
|
38
|
+
import q from "./icon/d_arrow_left.js";
|
|
39
|
+
import J from "./icon/d_arrow_right.js";
|
|
40
|
+
import Y from "./icon/zoom_in.js";
|
|
41
|
+
import X from "./icon/zoom_out.js";
|
|
42
|
+
import Z from "./icon/select.js";
|
|
43
|
+
import Q from "./icon/calendar.js";
|
|
44
|
+
import $ from "./icon/refresh.js";
|
|
45
|
+
import ee from "./icon/copy.js";
|
|
46
|
+
import { t as te } from "./form-DJxvBiLy.js";
|
|
47
|
+
import ne from "./check/radio_group.js";
|
|
48
|
+
import { t as re } from "./radio-C9NPQWGI.js";
|
|
49
|
+
import { t as ie } from "./checkbox-DhGHJXwI.js";
|
|
50
|
+
import ae from "./check/checkbox_group.js";
|
|
51
|
+
import oe from "./input_number/index.js";
|
|
52
|
+
import { t as se } from "./select_ori-C7sUZxen.js";
|
|
53
|
+
import { t as ce } from "./switch-wh2-ivty.js";
|
|
54
|
+
import { t as le } from "./md_input-BX3bujz8.js";
|
|
55
|
+
import { t as ue } from "./select-BZMDj5VE.js";
|
|
56
|
+
import { Popover as de, autoUpdate as fe, createPopoverObserver as pe, getOverflowAncestors as me, popconfirmProps as he, updatePosition as ge } from "./utils/popover.js";
|
|
57
|
+
import { t as _e } from "./date_picker-BDN2PAz5.js";
|
|
58
|
+
import { t as ve } from "./date_picker_ori-BXFs1eET.js";
|
|
59
|
+
import { t as ye } from "./color_picker-0a-IGZY9.js";
|
|
60
|
+
import { t as be } from "./list-MG8PRzos.js";
|
|
61
|
+
import { t as xe } from "./polygon-DhhovlrG.js";
|
|
62
|
+
import { t as Se } from "./tabbar-CBXK-_AV.js";
|
|
63
|
+
import { t as Ce } from "./item-D_ZOPXuE.js";
|
|
64
|
+
import { t as we } from "./theme-CLbBS-in.js";
|
|
65
|
+
import Te from "./theme/theme_color.js";
|
|
66
|
+
import { t as Ee } from "./menu-DKscK5mw.js";
|
|
67
|
+
import { t as De } from "./carousel-DvkZ1YXq.js";
|
|
68
|
+
import { t as Oe } from "./item-CQ2Sknbz.js";
|
|
69
|
+
import { t as ke } from "./qrcode-Dip8uLSA.js";
|
|
70
|
+
import { t as Ae } from "./description_panel--AKXBzLL.js";
|
|
71
|
+
import { t as je } from "./pagination-aRbGd3Rf.js";
|
|
72
|
+
import { t as Me } from "./mask-Bx-yNIJv.js";
|
|
73
|
+
import { t as Ne } from "./page_header-ujV3pncE.js";
|
|
74
|
+
import { t as Pe } from "./tag-Di1z9PoZ.js";
|
|
75
|
+
import { t as Fe } from "./collapse-B6-Rn05A.js";
|
|
76
|
+
import { t as Ie } from "./item-DI6mQXtB.js";
|
|
77
|
+
import { t as Le } from "./image-CVQai6NX.js";
|
|
78
|
+
import { t as Re } from "./image_preview-DfQAKSJH.js";
|
|
79
|
+
import { t as ze } from "./table-BQxMD2Ae.js";
|
|
80
|
+
import { t as Be } from "./space-CKuTk0YB.js";
|
|
81
|
+
import { t as Ve } from "./card-3DM-lJQV.js";
|
|
82
|
+
import { t as He } from "./calendar-CvlUsN6w.js";
|
|
83
|
+
export { A as ArrowDownIcon, j as ArrowLeftIcon, M as ArrowRightIcon, N as ArrowUpIcon, e as BaseComponent, p as BaseIcon, x as Button, He as Calendar, Q as CalendarIcon, Ve as Card, F as CaretBottomIcon, P as CaretTopIcon, De as Carousel, Oe as CarouselItem, ie as Checkbox, ae as CheckboxGroup, m as CloseFilledIcon, S as CloseIcon, Fe as Collapse, Ie as CollapseItem, ye as ColorPicker, ee as CopyIcon, q as DArrowLeftIcon, J as DArrowRightIcon, _e as DatePicker, ve as DatePickerOri, Ae as DescriptionPanel, y as Dialog, T as DialogBox, b as DialogContainer, I as FontIcon, te as Form, C as FormItem, Le as Image, Re as ImagePreview, _ as InfoIcon, w as Input, oe as InputNumber, be as List, E as Loading, L as LoadingIcon, Me as Mask, le as MdInput, Ee as Menu, v as Message, O as Modal, k as ModalBox, B as MoonIcon, K as MoreIcon, Ne as PageHeader, je as Pagination, xe as Polygon, de as Popover, ke as Qrcode, re as Radio, ne as RadioGroup, V as ReductionIcon, $ as RefreshIcon, H as RefreshLeftIcon, U as RefreshRightIcon, R as SearchIcon, ue as Select, Z as SelectIcon, se as SelectOri, W as SortIcon, Be as Space, h as SuccessIcon, z as SunIcon, ce as Switch, Se as Tabbar, Ce as TabbarItem, ze as Table, D as Tabs, Pe as Tag, we as Theme, Te as ThemeColor, G as ThemeDefaultIcon, g as WarnIcon, Y as ZoomInIcon, X as ZoomOutIcon, f as addClickOutside, fe as autoUpdate, pe as createPopoverObserver, me as getOverflowAncestors, t as initAttr, n as kebabToCamel, r as parseAttrValue, he as popconfirmProps, i as regist, d as removeClickOutside, a as setAttrs, o as stopSignal, s as tagAttr, c as tagAttrs, l as unitNumberStr, ge as updatePosition, u as useId };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import FormInner from "../form/form_inner";
|
|
2
|
+
interface InputNumberState {
|
|
3
|
+
/** 最小值 */
|
|
4
|
+
min?: number;
|
|
5
|
+
/** 最大值 */
|
|
6
|
+
max?: number;
|
|
7
|
+
/** 步长 */
|
|
8
|
+
step: number;
|
|
9
|
+
/** 小数精度 */
|
|
10
|
+
precision?: number;
|
|
11
|
+
/** 占位符 */
|
|
12
|
+
placeholder: string;
|
|
13
|
+
/** 尺寸 */
|
|
14
|
+
size: "small" | "default" | "large";
|
|
15
|
+
/** 宽度 */
|
|
16
|
+
width?: string;
|
|
17
|
+
/** 是否禁用步进按钮 */
|
|
18
|
+
controlsDisabled: boolean;
|
|
19
|
+
}
|
|
20
|
+
export default class InputNumber extends FormInner<InputNumberState> {
|
|
21
|
+
static baseName: string;
|
|
22
|
+
$input?: HTMLInputElement;
|
|
23
|
+
$minusBtn?: HTMLButtonElement;
|
|
24
|
+
$plusBtn?: HTMLButtonElement;
|
|
25
|
+
constructor();
|
|
26
|
+
static get observedAttributes(): string[];
|
|
27
|
+
protected attributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
28
|
+
protected updateDOM(changedProps: Set<string>): void;
|
|
29
|
+
render_v2(): {
|
|
30
|
+
template: DocumentFragment;
|
|
31
|
+
styleSheets: CSSStyleSheet[];
|
|
32
|
+
};
|
|
33
|
+
render(): DocumentFragment;
|
|
34
|
+
afterInit(): void;
|
|
35
|
+
beforeDestroy(): void;
|
|
36
|
+
set value(value: any);
|
|
37
|
+
get value(): any;
|
|
38
|
+
disabledChange(): void;
|
|
39
|
+
focus(): void;
|
|
40
|
+
/** 将值限制在 min/max 范围内并格式化精度 */
|
|
41
|
+
private _clamp;
|
|
42
|
+
private _formatValue;
|
|
43
|
+
private _getCurrentNum;
|
|
44
|
+
private _commitValue;
|
|
45
|
+
private _handleInput;
|
|
46
|
+
private _handleChange;
|
|
47
|
+
private _handleBlur;
|
|
48
|
+
private _handleKeydown;
|
|
49
|
+
private _handleMinus;
|
|
50
|
+
private _handlePlus;
|
|
51
|
+
private _stepUp;
|
|
52
|
+
private _stepDown;
|
|
53
|
+
private _updateBtnState;
|
|
54
|
+
private _updateWidth;
|
|
55
|
+
private _updateControls;
|
|
56
|
+
protected innerBlockChange(innerBlock: boolean): void;
|
|
57
|
+
protected validResult(msg?: string): void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { parseAttrValue as e, unitNumberStr as t } from "../utils/index.js";
|
|
2
|
+
import { t as n } from "../form_inner-Cnwb6f_Q.js";
|
|
3
|
+
import { t as r } from "../style-C5wUmE2b.js";
|
|
4
|
+
import { $$ as i, $one as a, addClass as o, off as s, on as c, removeClass as l } from "ph-utils/browser";
|
|
5
|
+
//#region src/components/input_number/index.ts
|
|
6
|
+
var u = class extends n {
|
|
7
|
+
static baseName = "input-number";
|
|
8
|
+
$input;
|
|
9
|
+
$minusBtn;
|
|
10
|
+
$plusBtn;
|
|
11
|
+
constructor() {
|
|
12
|
+
super(), this.version = 2, this._state = {
|
|
13
|
+
step: 1,
|
|
14
|
+
placeholder: "",
|
|
15
|
+
size: "default",
|
|
16
|
+
controlsDisabled: !1
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
static get observedAttributes() {
|
|
20
|
+
return [
|
|
21
|
+
"disabled",
|
|
22
|
+
"value",
|
|
23
|
+
"name",
|
|
24
|
+
"inner-block",
|
|
25
|
+
"min",
|
|
26
|
+
"max",
|
|
27
|
+
"step",
|
|
28
|
+
"precision",
|
|
29
|
+
"placeholder",
|
|
30
|
+
"size",
|
|
31
|
+
"width",
|
|
32
|
+
"controls-disabled"
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
attributeChange(n, r, i) {
|
|
36
|
+
switch (n) {
|
|
37
|
+
case "min":
|
|
38
|
+
case "max":
|
|
39
|
+
case "precision":
|
|
40
|
+
let r = Number(i);
|
|
41
|
+
this._state[n] = Number.isFinite(r) ? r : void 0;
|
|
42
|
+
break;
|
|
43
|
+
case "step":
|
|
44
|
+
let a = Number(i);
|
|
45
|
+
this._state.step = Number.isFinite(a) ? a : 1;
|
|
46
|
+
break;
|
|
47
|
+
case "placeholder":
|
|
48
|
+
case "size":
|
|
49
|
+
this._state[n] = i.trim();
|
|
50
|
+
break;
|
|
51
|
+
case "width":
|
|
52
|
+
this._state.width = t(i);
|
|
53
|
+
break;
|
|
54
|
+
case "controls-disabled": this._state.controlsDisabled = e(i, !1, "controls-disabled");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
updateDOM(e) {
|
|
58
|
+
e.has("placeholder") && this.$input && (this.$input.placeholder = this._state.placeholder), e.has("width") && this._updateWidth(), e.has("controls-disabled") && this._updateControls(), (e.has("step") || e.has("min") || e.has("max")) && this._updateBtnState();
|
|
59
|
+
}
|
|
60
|
+
render_v2() {
|
|
61
|
+
return {
|
|
62
|
+
template: this.render(),
|
|
63
|
+
styleSheets: [r]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
let e = document.createDocumentFragment(), t = i("button", {
|
|
68
|
+
class: "l-input-number__btn l-input-number__minus",
|
|
69
|
+
type: "button",
|
|
70
|
+
part: "minus"
|
|
71
|
+
});
|
|
72
|
+
t.innerHTML = "<svg viewBox=\"0 0 1024 1024\" width=\"12\" height=\"12\" fill=\"currentColor\"><path d=\"M128 512h768a25.6 25.6 0 1 1 0 51.2H128a25.6 25.6 0 1 1 0-51.2z\"></path></svg>", t.disabled = this.isDisabled(), e.appendChild(t);
|
|
73
|
+
let n = i("input", {
|
|
74
|
+
class: "l-input-number__inner",
|
|
75
|
+
value: this._formatValue(this.value),
|
|
76
|
+
name: this.getName(),
|
|
77
|
+
placeholder: this._state.placeholder,
|
|
78
|
+
part: "default",
|
|
79
|
+
type: "text",
|
|
80
|
+
inputmode: this._state.precision == null ? "numeric" : "decimal",
|
|
81
|
+
disabled: this.isDisabled() ? !0 : void 0
|
|
82
|
+
});
|
|
83
|
+
e.appendChild(n);
|
|
84
|
+
let r = i("button", {
|
|
85
|
+
class: "l-input-number__btn l-input-number__plus",
|
|
86
|
+
type: "button",
|
|
87
|
+
part: "plus"
|
|
88
|
+
});
|
|
89
|
+
return r.innerHTML = "<svg viewBox=\"0 0 1024 1024\" width=\"12\" height=\"12\" fill=\"currentColor\"><path d=\"M512 128a25.6 25.6 0 0 1 25.6 25.6v332.8h332.8a25.6 25.6 0 1 1 0 51.2H537.6v332.8a25.6 25.6 0 1 1-51.2 0V537.6H153.6a25.6 25.6 0 1 1 0-51.2h332.8V153.6A25.6 25.6 0 0 1 512 128z\"></path></svg>", r.disabled = this.isDisabled(), e.appendChild(r), e;
|
|
90
|
+
}
|
|
91
|
+
afterInit() {
|
|
92
|
+
this.$input = a(".l-input-number__inner", this.root), this.$minusBtn = a(".l-input-number__minus", this.root), this.$plusBtn = a(".l-input-number__plus", this.root), c(this.$input, "input", this._handleInput), c(this.$input, "change", this._handleChange), c(this.$input, "blur", this._handleBlur), c(this.$input, "keydown", this._handleKeydown), c(this.$minusBtn, "click", this._handleMinus), c(this.$plusBtn, "click", this._handlePlus), this._updateWidth(), this._updateBtnState(), this._updateControls(), this.className = `l-input-number--${this._state.size || "default"} ${this.className}`;
|
|
93
|
+
}
|
|
94
|
+
beforeDestroy() {
|
|
95
|
+
this.$input && (s(this.$input, "input", this._handleInput), s(this.$input, "change", this._handleChange), s(this.$input, "blur", this._handleBlur), s(this.$input, "keydown", this._handleKeydown)), this.$minusBtn && s(this.$minusBtn, "click", this._handleMinus), this.$plusBtn && s(this.$plusBtn, "click", this._handlePlus), this.$input = void 0, this.$minusBtn = void 0, this.$plusBtn = void 0;
|
|
96
|
+
}
|
|
97
|
+
set value(e) {
|
|
98
|
+
this.setValue(e), this.$input && (this.$input.value = this._formatValue(e)), this._updateBtnState();
|
|
99
|
+
}
|
|
100
|
+
get value() {
|
|
101
|
+
return this.getValue();
|
|
102
|
+
}
|
|
103
|
+
disabledChange() {
|
|
104
|
+
this.isDisabled() ? o(this, "is-disabled") : l(this, "is-disabled"), this.$input && (this.$input.disabled = this.isDisabled()), this.$minusBtn && (this.$minusBtn.disabled = this.isDisabled()), this.$plusBtn && (this.$plusBtn.disabled = this.isDisabled());
|
|
105
|
+
}
|
|
106
|
+
focus() {
|
|
107
|
+
this.$input?.focus();
|
|
108
|
+
}
|
|
109
|
+
_clamp(e) {
|
|
110
|
+
let { min: t, max: n, precision: r } = this._state;
|
|
111
|
+
return t != null && e < t && (e = t), n != null && e > n && (e = n), r != null && (e = parseFloat(e.toFixed(r))), e;
|
|
112
|
+
}
|
|
113
|
+
_formatValue(e) {
|
|
114
|
+
if (e == null || e === "") return "";
|
|
115
|
+
let t = Number(e);
|
|
116
|
+
if (isNaN(t)) return "";
|
|
117
|
+
let { precision: n } = this._state;
|
|
118
|
+
return n == null ? String(t) : t.toFixed(n);
|
|
119
|
+
}
|
|
120
|
+
_getCurrentNum() {
|
|
121
|
+
let e = this.$input?.value ?? this.value;
|
|
122
|
+
if (e == null || e === "") return 0;
|
|
123
|
+
let t = Number(e);
|
|
124
|
+
return isNaN(t) ? 0 : t;
|
|
125
|
+
}
|
|
126
|
+
_commitValue(e) {
|
|
127
|
+
let t = this._clamp(e);
|
|
128
|
+
this.value = t, this.$input && (this.$input.value = this._formatValue(t)), this.emit("input", {
|
|
129
|
+
bubbles: !0,
|
|
130
|
+
detail: {
|
|
131
|
+
value: t,
|
|
132
|
+
name: this.getName()
|
|
133
|
+
}
|
|
134
|
+
}), this._updateBtnState();
|
|
135
|
+
}
|
|
136
|
+
_handleInput = (e) => {
|
|
137
|
+
let t = e.target.value;
|
|
138
|
+
if (t === "-" || t === "." || t === "-.") return;
|
|
139
|
+
let n = Number(t);
|
|
140
|
+
Number.isFinite(n) && (this.setValue(n), this.emit("input", {
|
|
141
|
+
bubbles: !0,
|
|
142
|
+
detail: {
|
|
143
|
+
value: n,
|
|
144
|
+
name: this.getName()
|
|
145
|
+
}
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
_handleChange = (e) => {
|
|
149
|
+
let t = e.target, n = Number(t.value);
|
|
150
|
+
if (Number.isFinite(n)) {
|
|
151
|
+
let e = this._clamp(n);
|
|
152
|
+
this.value = e, this.$input && (this.$input.value = this._formatValue(e)), this.emit("change", { detail: {
|
|
153
|
+
value: e,
|
|
154
|
+
name: this.getName()
|
|
155
|
+
} });
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
_handleBlur = () => {
|
|
159
|
+
if (this.$input) {
|
|
160
|
+
let e = this.$input.value, t = parseFloat(e);
|
|
161
|
+
if (Number.isFinite(t)) {
|
|
162
|
+
let e = this._clamp(t);
|
|
163
|
+
this.value = e, this.$input.value = this._formatValue(e);
|
|
164
|
+
} else this.value = void 0, this.$input.value = "";
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
_handleKeydown = (e) => {
|
|
168
|
+
let t = e;
|
|
169
|
+
this.isDisabled() || (t.key === "ArrowUp" ? (t.preventDefault(), this._stepUp()) : t.key === "ArrowDown" && (t.preventDefault(), this._stepDown()));
|
|
170
|
+
};
|
|
171
|
+
_handleMinus = () => {
|
|
172
|
+
this.isDisabled() || (this._stepDown(), this.focus());
|
|
173
|
+
};
|
|
174
|
+
_handlePlus = () => {
|
|
175
|
+
this.isDisabled() || (this._stepUp(), this.focus());
|
|
176
|
+
};
|
|
177
|
+
_stepUp() {
|
|
178
|
+
let e = this._getCurrentNum();
|
|
179
|
+
this._commitValue(e + this._state.step);
|
|
180
|
+
}
|
|
181
|
+
_stepDown() {
|
|
182
|
+
let e = this._getCurrentNum();
|
|
183
|
+
this._commitValue(e - this._state.step);
|
|
184
|
+
}
|
|
185
|
+
_updateBtnState() {
|
|
186
|
+
let e = this._getCurrentNum(), { min: t, max: n } = this._state;
|
|
187
|
+
this.$minusBtn && t != null && (this.$minusBtn.disabled = this.isDisabled() || e <= t), this.$plusBtn && n != null && (this.$plusBtn.disabled = this.isDisabled() || e >= n);
|
|
188
|
+
}
|
|
189
|
+
_updateWidth() {
|
|
190
|
+
this._state.width ? this.style.setProperty("--l-input-number-width", this._state.width) : this.style.removeProperty("--l-input-number-width");
|
|
191
|
+
}
|
|
192
|
+
_updateControls() {
|
|
193
|
+
this._state.controlsDisabled ? (o(this, "l-input-number--no-controls"), this.$minusBtn && (this.$minusBtn.style.display = "none"), this.$plusBtn && (this.$plusBtn.style.display = "none")) : (l(this, "l-input-number--no-controls"), this.$minusBtn && (this.$minusBtn.style.display = ""), this.$plusBtn && (this.$plusBtn.style.display = ""));
|
|
194
|
+
}
|
|
195
|
+
innerBlockChange(e) {
|
|
196
|
+
e ? o(this, "is-block") : l(this, "is-block");
|
|
197
|
+
}
|
|
198
|
+
validResult(e) {
|
|
199
|
+
e == null ? l(this, "is-error") : o(this, "is-error");
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
//#endregion
|
|
203
|
+
export { u as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type AlertOptions = {
|
|
2
|
+
/** 是否显示取消按钮 */
|
|
3
|
+
showCancel?: boolean;
|
|
4
|
+
/** 右上角关闭按钮, 1-显示在框内,2-显示在框角, 0-不显示, 默认: 0 */
|
|
5
|
+
close?: number;
|
|
6
|
+
/** 点击蒙层是否允许关闭, 默认: false */
|
|
7
|
+
maskClosable?: boolean;
|
|
8
|
+
/** 显示图标 */
|
|
9
|
+
icon?: () => HTMLElement;
|
|
10
|
+
};
|
|
11
|
+
type PromptOptions = AlertOptions & {
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
};
|
|
14
|
+
declare function alert(content: string, title?: string, option?: AlertOptions): Promise<boolean>;
|
|
15
|
+
declare function confirm(content: string, title?: string, option?: AlertOptions): Promise<string | boolean>;
|
|
16
|
+
declare function prompt(label: string, title?: string, option?: PromptOptions): Promise<string | boolean>;
|
|
17
|
+
declare const _default: {
|
|
18
|
+
alert: typeof alert;
|
|
19
|
+
confirm: typeof confirm;
|
|
20
|
+
prompt: typeof prompt;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/components/input_number/index.less?inline
|
|
2
|
+
var e = ":host{--l-input-number-border-color:var(--l-border-color,#d9d9d9);--l-input-number-btn-color:#606266;--l-input-number-btn-hover-color:var(--l-primary-color,#722ed1);--l-input-number-btn-disabled-color:#c0c4cc;--l-input-number-bg:#fff;--l-input-number-btn-bg:#f5f7fa;--l-input-number-btn-hover-bg:var(--l-primary-color-light5,#f3e8ff);--l-input-number-width:170px;width:var(--l-input-number-width);height:var(--l-form-control-height,32px);border:1px solid var(--l-input-number-border-color);border-radius:var(--l-border-radius,3px);box-sizing:border-box;vertical-align:middle;background-color:var(--l-input-number-bg);align-items:center;transition:border-color .3s,box-shadow .3s;display:inline-flex;overflow:hidden}:host(:focus-within){--l-input-number-border-color:var(--l-primary-color,#722ed1);box-shadow:0 0 0 3px var(--l-primary-color-light5)}:host(.is-block){width:100%}:host(.is-disabled){background-color:var(--l-disabled-color,#f5f7fa);cursor:not-allowed}:host(.is-disabled) .l-input-number__btn{color:var(--l-input-number-btn-disabled-color);cursor:not-allowed}:host(.is-disabled) .l-input-number__btn:hover{background-color:var(--l-input-number-btn-bg)}:host(.is-error){--l-input-number-border-color:var(--l-error-color)}:host(.is-error:focus-within){box-shadow:0 0 0 3px var(--l-error-color-light5)}:host(.l-input-number--small){--l-form-control-height:24px;font-size:12px}:host(.l-input-number--large){--l-form-control-height:40px;--l-border-radius:6px;font-size:16px}.l-input-number__btn{background:var(--l-input-number-btn-bg);width:32px;height:100%;color:var(--l-input-number-btn-color);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:inherit;border:none;outline:none;flex-shrink:0;justify-content:center;align-items:center;padding:0;transition:background-color .25s,color .25s;display:inline-flex}.l-input-number__btn:hover:not(:disabled){background:var(--l-input-number-btn-hover-bg);color:var(--l-input-number-btn-hover-color)}.l-input-number__btn:active:not(:disabled){background:var(--l-primary-color-light4,#e2d3fa);color:var(--l-primary-color-dark1,#531dab)}.l-input-number__btn:disabled{color:var(--l-input-number-btn-disabled-color);cursor:not-allowed}:host(.l-input-number--no-controls) .l-input-number__inner{text-align:left}.l-input-number__inner{text-align:center;width:100%;height:100%;font-size:inherit;color:var(--l-input-number-btn-color);box-sizing:border-box;-moz-appearance:textfield;background:0 0;border:none;outline:none;flex:1;padding:0 8px}.l-input-number__inner::-webkit-outer-spin-button,.l-input-number__inner::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.l-input-number__inner::placeholder{color:#c0c4cc}html.dark :host{--l-input-number-bg:#ffffff0f;--l-input-number-btn-bg:#ffffff14;--l-input-number-btn-color:#ffffffa6;--l-input-number-btn-hover-bg:var(--l-primary-color-light5);--l-input-number-btn-disabled-color:#ffffff40}html.dark :host(.is-disabled){background-color:#ffffff14}html.dark .l-input-number__inner::placeholder{color:#ffffff4d}", t = new CSSStyleSheet();
|
|
3
|
+
t.replaceSync(e);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { t };
|
package/package.json
CHANGED
package/lib/base-Dyj1rzaK.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
import { unitNumberStr as t } from "./utils/index.js";
|
|
3
|
-
//#region src/components/icon/index.less?inline
|
|
4
|
-
var n = ":host{display:inline-flex}.l-icon{fill:currentColor;vertical-align:middle;width:1em;height:1em;color:var(--l-icon-color,inherit);font-size:var(--l-icon-size,inherit);display:inline-block}", r = class extends e {
|
|
5
|
-
static baseName = "base-icon";
|
|
6
|
-
useLink;
|
|
7
|
-
viewBox;
|
|
8
|
-
constructor() {
|
|
9
|
-
super(), this.useLink = !1, this.viewBox = "0 0 1024 1024", this.version = 2, this._state = {};
|
|
10
|
-
}
|
|
11
|
-
static get observedAttributes() {
|
|
12
|
-
return ["color", "size"];
|
|
13
|
-
}
|
|
14
|
-
attributeChanged(e, n, r) {
|
|
15
|
-
switch (e) {
|
|
16
|
-
case "color":
|
|
17
|
-
this._state.color = r;
|
|
18
|
-
break;
|
|
19
|
-
case "size": this._state.size = t(r);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
connectedCallback() {
|
|
23
|
-
super.connectedCallback(), this._updateColor(), this._updateSize();
|
|
24
|
-
}
|
|
25
|
-
updateDOM(e) {
|
|
26
|
-
console.log("up"), e.has("color") && this._updateColor(), e.has("size") && this._updateSize();
|
|
27
|
-
}
|
|
28
|
-
_updateSize() {
|
|
29
|
-
this._state.size ? this.style.setProperty("--l-icon-size", this._state.size) : this.style.removeProperty("--l-icon-size");
|
|
30
|
-
}
|
|
31
|
-
_updateColor() {
|
|
32
|
-
this._state.color ? this.style.setProperty("--l-icon-color", this._state.color) : this.style.removeProperty("--l-icon-color");
|
|
33
|
-
}
|
|
34
|
-
render_v2() {
|
|
35
|
-
let e = this.createEl("svg");
|
|
36
|
-
e.classList.add("l-icon"), this.useLink || e.setAttribute("viewBox", this.viewBox);
|
|
37
|
-
let t = this.renderChildren();
|
|
38
|
-
if (typeof t == "string") {
|
|
39
|
-
if (t === "") {
|
|
40
|
-
let t = this.children, n = [];
|
|
41
|
-
for (let e = 0, r = t.length; e < r; e++) {
|
|
42
|
-
let r = t[e];
|
|
43
|
-
n.push(r.outerHTML);
|
|
44
|
-
}
|
|
45
|
-
e.innerHTML = n.join("");
|
|
46
|
-
} else e.innerHTML = t;
|
|
47
|
-
} else e.append(t);
|
|
48
|
-
return {
|
|
49
|
-
template: e,
|
|
50
|
-
style: n
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
renderChildren() {
|
|
54
|
-
return "";
|
|
55
|
-
}
|
|
56
|
-
createEl(e) {
|
|
57
|
-
return document.createElementNS("http://www.w3.org/2000/svg", e);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
//#endregion
|
|
61
|
-
export { r as t };
|