litos-ui 0.13.0 → 0.14.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/lib/base.d.ts +1 -1
- package/lib/base.js +3 -3
- package/lib/button/index.d.ts +4 -1
- package/lib/button/index.js +28 -13
- package/lib/carousel/index.d.ts +20 -0
- package/lib/carousel/index.js +280 -0
- package/lib/carousel/item.d.ts +6 -0
- package/lib/carousel/item.js +15 -0
- package/lib/carousel/timer.d.ts +5 -0
- package/lib/carousel/timer.js +19 -0
- package/lib/check/check.d.ts +22 -0
- package/lib/check/check.js +81 -0
- package/lib/check/checkbox.d.ts +7 -0
- package/lib/check/checkbox.js +25 -0
- package/lib/check/checkbox_group.d.ts +9 -0
- package/lib/check/checkbox_group.js +33 -0
- package/lib/check/index.d.ts +12 -0
- package/lib/check/index.js +35 -0
- package/lib/check/radio.d.ts +6 -0
- package/lib/check/radio.js +19 -0
- package/lib/check/radio_group.d.ts +6 -0
- package/lib/check/radio_group.js +24 -0
- package/lib/check-BlDsQQo0.js +4 -0
- package/lib/color_picker/index.d.ts +1 -1
- package/lib/color_picker/index.js +5 -5
- package/lib/form/form_inner.d.ts +1 -8
- package/lib/form/form_inner.js +31 -39
- package/lib/form/form_item.d.ts +1 -1
- package/lib/form/form_item.js +30 -37
- package/lib/form/index.js +5 -5
- package/lib/icon/close_filled.d.ts +1 -1
- package/lib/index.d.ts +12 -4
- package/lib/index.js +80 -72
- package/lib/input/index.js +10 -10
- package/lib/list/index.d.ts +1 -2
- package/lib/list/index.js +17 -17
- package/lib/md_input/index.js +9 -9
- package/lib/menu/index.d.ts +2 -0
- package/lib/menu/index.js +47 -42
- package/lib/menu/sub_menu.d.ts +4 -2
- package/lib/menu/sub_menu.js +59 -41
- package/lib/select_ori/index.d.ts +1 -1
- package/lib/select_ori/index.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +49 -49
- package/lib/utils/transition.js +3 -2
- package/package.json +1 -1
- package/lib/checkbox/index.d.ts +0 -17
- package/lib/checkbox/index.js +0 -135
- package/lib/radio/index.d.ts +0 -28
- package/lib/radio/index.js +0 -122
package/lib/radio/index.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { initAttr as $, parseAttrValue as x, tagAttr as s } from "../utils/index.js";
|
|
2
|
-
import y from "../form/form_inner.js";
|
|
3
|
-
import { $one as a, hasClass as u, addClass as n, $ as c, iterate as h, getAttr as C, removeClass as b, formatClass as A, on as E, off as I } from "ph-utils/dom";
|
|
4
|
-
import { random as p } from "ph-utils";
|
|
5
|
-
const w = ':host{display:flex;align-items:center}.l-radio{--l-radio-size: 16px;--l-radio-label-color: #333;--l-radio-disabled-color: #e6e6e6;--l-radio-disabled-label-color: var(--l-disabled-color, #c0c4cc);--l-radio-checked-color: var(--l-primary-color, #722ed1);--l-radio-item-margin: 10px;display:inline-flex;align-items:center;position:relative;cursor:pointer}.l-radio__label{transition:color .3s ease-in-out;margin-left:5px}.l-radio__input{position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-radio__inner{display:flex;justify-content:center;align-items:center;width:var(--l-radio-size);height:var(--l-radio-size);border:1px solid #dcddd9;border-radius:50%;box-sizing:border-box;transition:border-color .3s ease-in-out}.l-radio__inner:before{content:"";display:block;width:60%;height:60%;background-color:transparent;border-radius:50%;transition:background-color .3s ease-in-out}.l-radio.is-checked .l-radio__inner{border-color:var(--l-primary-color, #722ed1)}.l-radio.is-checked .l-radio__inner:before{background-color:var(--l-primary-color, #722ed1)}.l-radio.is-checked .l-radio__label{color:var(--l-primary-color, #722ed1)}.l-radio--disabled{cursor:not-allowed}.l-radio--disabledd .l-radio__inner{border-color:var(--l-radio-disabled-color)}.l-radio--disabled .l-radio__label{color:var(--l-radio-disabled-label-color)}.l-radio:not(:first-child){margin-left:var(--l-radio-item-margin)}.l-radio--button .l-radio__label{display:inline-flex;height:var(--l-form-edit-height, 32px);justify-content:center;align-items:center;padding:0 15px;border:1px solid #c0c4cc;border-left-width:0;margin-left:0}.l-radio--button:not(:first-of-type){margin-left:0}.l-radio--button:first-of-type .l-radio__label{border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}.l-radio--button:last-of-type .l-radio__label{border-top-right-radius:3px;border-bottom-right-radius:3px}.is-checked.l-radio--button .l-radio__label{background-color:var(--l-radio-checked-color);color:#fff;border-color:var(--l-radio-checked-color)}';
|
|
6
|
-
class T extends y {
|
|
7
|
-
static baseName = "radio";
|
|
8
|
-
type;
|
|
9
|
-
label;
|
|
10
|
-
checked = !1;
|
|
11
|
-
_ignoreInitAttrs = [];
|
|
12
|
-
setItems(e) {
|
|
13
|
-
this._removeEvents(), this.root.innerHTML = this._renderItems(e), this._initEvents();
|
|
14
|
-
}
|
|
15
|
-
constructor() {
|
|
16
|
-
super(!1);
|
|
17
|
-
}
|
|
18
|
-
connectedCallback() {
|
|
19
|
-
$(this), this.loadStyleText(w), super.connectedCallback(), this._initEvents();
|
|
20
|
-
}
|
|
21
|
-
disconnectedCallback() {
|
|
22
|
-
super.disconnectedCallback(), this._removeEvents();
|
|
23
|
-
}
|
|
24
|
-
attributeChange(e, o, t) {
|
|
25
|
-
if (e === "checked") {
|
|
26
|
-
const i = x(t, !1, e);
|
|
27
|
-
this.checked = i, this.value = i;
|
|
28
|
-
const r = a(".l-radio", this.root);
|
|
29
|
-
if (r && !u(r, "is-checked")) {
|
|
30
|
-
n(r, "is-checked");
|
|
31
|
-
const l = a("input", r);
|
|
32
|
-
l && (l.checked = !0);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
render() {
|
|
37
|
-
this.getName() || (this.name = `la${p(3)}_${p(6)}`);
|
|
38
|
-
const e = [], o = a('[slot="label"]', this), t = c("[radio-value]", this);
|
|
39
|
-
return o != null || this.label ? (this.value = this._isChecked(), o ? e.push(
|
|
40
|
-
this._renderItem("slot", void 0, this._isChecked(), "label")
|
|
41
|
-
) : e.push(
|
|
42
|
-
this._renderItem(
|
|
43
|
-
this.label,
|
|
44
|
-
void 0,
|
|
45
|
-
this._isChecked(),
|
|
46
|
-
"label"
|
|
47
|
-
)
|
|
48
|
-
)) : t.length > 0 && (h(t, (i) => {
|
|
49
|
-
const r = i.cloneNode(!0), l = C(i, "radio-value");
|
|
50
|
-
e.push(
|
|
51
|
-
this._renderItem(r.outerHTML, l, this.value === l)
|
|
52
|
-
);
|
|
53
|
-
}), this.pushValueChange()), e.join("");
|
|
54
|
-
}
|
|
55
|
-
setValue(e) {
|
|
56
|
-
super.setValue(e);
|
|
57
|
-
let o = "";
|
|
58
|
-
typeof e != "boolean" && (o = `[l-value="${e}"]`);
|
|
59
|
-
const t = a(".is-checked", this.root);
|
|
60
|
-
t && b(t, "is-checked");
|
|
61
|
-
const i = a(`label${o}`, this.root);
|
|
62
|
-
if (i) {
|
|
63
|
-
const r = a("input", i);
|
|
64
|
-
typeof e == "boolean" ? (e ? n(i, "is-checked") : b(i, "is-checked"), r.checked = e) : (n(i, "is-checked"), r.checked = !0);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
_renderItems(e) {
|
|
68
|
-
const o = [];
|
|
69
|
-
for (let t = 0, i = e.length; t < i; t++) {
|
|
70
|
-
const r = e[t];
|
|
71
|
-
o.push(
|
|
72
|
-
this._renderItem(
|
|
73
|
-
r.label,
|
|
74
|
-
r.value,
|
|
75
|
-
this.value === r.value,
|
|
76
|
-
r.labelPart
|
|
77
|
-
)
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
return o.join("");
|
|
81
|
-
}
|
|
82
|
-
_renderItem(e, o, t = !1, i = void 0) {
|
|
83
|
-
const r = A({
|
|
84
|
-
"l-radio": !0,
|
|
85
|
-
"l-radio--disabled": this.isDisabled(),
|
|
86
|
-
"l-radio--button": this.type === "button",
|
|
87
|
-
"is-checked": t
|
|
88
|
-
}), l = s("disabled", this.isDisabled()), f = s("checked", t), m = s("value", o), _ = `${s("name", this.getName())}${m}${l}${f}`, v = s("part", i), g = s("l-value", o), d = [
|
|
89
|
-
`<label class="${r}"${g}>`,
|
|
90
|
-
`<input type="radio" class="l-radio__input"${_} />`
|
|
91
|
-
];
|
|
92
|
-
this.type !== "button" && d.push('<span class="l-radio__inner"></span>');
|
|
93
|
-
let k = e === "slot" ? '<slot name="label"></slot>' : e;
|
|
94
|
-
return d.push(
|
|
95
|
-
`<div class="l-radio__label"${v}>${k}</div>`
|
|
96
|
-
), d.push("</label>"), d.join("");
|
|
97
|
-
}
|
|
98
|
-
_isChecked() {
|
|
99
|
-
return this.checked;
|
|
100
|
-
}
|
|
101
|
-
_initEvents() {
|
|
102
|
-
h(c("input", this.root), (e) => {
|
|
103
|
-
E(e, "change", this._radioChange);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
_removeEvents() {
|
|
107
|
-
h(c("input", this.root), (e) => {
|
|
108
|
-
I(e, "change", this._radioChange);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
_radioChange = (e) => {
|
|
112
|
-
const o = e.target;
|
|
113
|
-
let t = o.parentElement;
|
|
114
|
-
for (; t != null && !u(t, "l-radio"); )
|
|
115
|
-
t = t.parentElement;
|
|
116
|
-
const i = a(".is-checked", this.root);
|
|
117
|
-
i && b(i, "is-checked"), this.value = o.value, t && n(t, "is-checked"), this.dispatchEvent(new CustomEvent("change"));
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
export {
|
|
121
|
-
T as default
|
|
122
|
-
};
|