litos-ui 0.17.5 → 0.18.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.
Files changed (163) hide show
  1. package/lib/animation-CTt9qgA7.js +4 -0
  2. package/lib/base-Dm0WS1pK.js +62 -0
  3. package/lib/base.js +111 -147
  4. package/lib/button/index.d.ts +8 -3
  5. package/lib/button/index.js +2 -137
  6. package/lib/button-CC5PmAb1.js +146 -0
  7. package/lib/calendar/index.d.ts +10 -5
  8. package/lib/calendar/index.js +2 -123
  9. package/lib/calendar-GpYHNmXG.js +149 -0
  10. package/lib/carousel/index.js +2 -280
  11. package/lib/carousel/item.js +2 -15
  12. package/lib/carousel-dT3FJPQo.js +272 -0
  13. package/lib/check/checkbox.js +2 -18
  14. package/lib/check/checkbox_group.js +6 -6
  15. package/lib/check/radio.js +2 -15
  16. package/lib/check/radio_group.js +9 -9
  17. package/lib/check-B0XraJvb.js +73 -0
  18. package/lib/check-CvGaONEx.js +117 -0
  19. package/lib/checkbox-DbWsmAaL.js +16 -0
  20. package/lib/collapse/index.d.ts +18 -11
  21. package/lib/collapse/index.js +2 -88
  22. package/lib/collapse/item.d.ts +28 -9
  23. package/lib/collapse/item.js +2 -115
  24. package/lib/collapse/types.d.ts +7 -0
  25. package/lib/collapse-C3IRHLeg.js +104 -0
  26. package/lib/color_picker/index.js +2 -42
  27. package/lib/color_picker-D0brKFm-.js +41 -0
  28. package/lib/date_picker/index.d.ts +23 -0
  29. package/lib/date_picker/index.js +3 -0
  30. package/lib/date_picker-DQGoiN8v.js +103 -0
  31. package/lib/date_picker_ori/index.js +2 -129
  32. package/lib/date_picker_ori-aRuSSi9D.js +122 -0
  33. package/lib/description_panel/index.js +2 -66
  34. package/lib/description_panel-BY2yljeC.js +57 -0
  35. package/lib/dialog/dialog_container.js +2 -131
  36. package/lib/dialog/index.js +67 -85
  37. package/lib/dialog_container-DcN87wj0.js +126 -0
  38. package/lib/esm-sVEoAVPu.js +244 -0
  39. package/lib/form/form_item.d.ts +1 -0
  40. package/lib/form/form_item.js +2 -136
  41. package/lib/form/index.js +2 -147
  42. package/lib/form-DdU0yK0k.js +154 -0
  43. package/lib/form_inner-DR9tyB_r.js +117 -0
  44. package/lib/form_item-Bv-YafZK.js +137 -0
  45. package/lib/icon/arrow_down.js +12 -12
  46. package/lib/icon/arrow_left.js +9 -9
  47. package/lib/icon/arrow_right.js +9 -9
  48. package/lib/icon/arrow_up.js +12 -12
  49. package/lib/icon/base.d.ts +16 -2
  50. package/lib/icon/base.js +2 -38
  51. package/lib/icon/calendar.d.ts +5 -0
  52. package/lib/icon/calendar.js +10 -0
  53. package/lib/icon/caret_bottom.js +9 -9
  54. package/lib/icon/caret_top.js +9 -9
  55. package/lib/icon/close.js +9 -9
  56. package/lib/icon/close_filled.js +12 -12
  57. package/lib/icon/d_arrow_left.js +12 -12
  58. package/lib/icon/d_arrow_right.js +12 -12
  59. package/lib/icon/font_icon.d.ts +2 -3
  60. package/lib/icon/font_icon.js +35 -39
  61. package/lib/icon/info.js +12 -12
  62. package/lib/icon/loading.js +9 -9
  63. package/lib/icon/moon.js +12 -12
  64. package/lib/icon/more.js +12 -12
  65. package/lib/icon/reduction.js +12 -12
  66. package/lib/icon/refresh.d.ts +5 -0
  67. package/lib/icon/refresh.js +10 -0
  68. package/lib/icon/refresh_left.js +12 -12
  69. package/lib/icon/refresh_right.js +9 -9
  70. package/lib/icon/search.js +9 -9
  71. package/lib/icon/select.js +12 -12
  72. package/lib/icon/sort.js +9 -9
  73. package/lib/icon/success.js +12 -12
  74. package/lib/icon/sun.js +12 -12
  75. package/lib/icon/theme_default.js +12 -12
  76. package/lib/icon/warn.js +12 -12
  77. package/lib/icon/zoom_in.js +12 -12
  78. package/lib/icon/zoom_out.js +12 -12
  79. package/lib/image/image_preview.js +2 -104
  80. package/lib/image/index.js +2 -176
  81. package/lib/image-COPKk8Jm.js +162 -0
  82. package/lib/image_preview-CYEup07F.js +92 -0
  83. package/lib/index.d.ts +5 -81
  84. package/lib/index.js +78 -169
  85. package/lib/input/index.d.ts +6 -2
  86. package/lib/input/index.js +188 -203
  87. package/lib/input-DjKxcxry.js +4 -0
  88. package/lib/input_inner-BKJg9n9A.js +4 -0
  89. package/lib/item-B7Elh5xE.js +14 -0
  90. package/lib/item-CvoJt3wp.js +60 -0
  91. package/lib/item-DRsOV_Tc.js +119 -0
  92. package/lib/list/index.js +2 -58
  93. package/lib/list-CU7vHS6s.js +51 -0
  94. package/lib/loading/index.d.ts +3 -2
  95. package/lib/loading/index.js +109 -127
  96. package/lib/mask/index.js +2 -105
  97. package/lib/mask-CEznzwji.js +112 -0
  98. package/lib/md_input/index.js +2 -60
  99. package/lib/md_input-DSQx5TMW.js +58 -0
  100. package/lib/menu/index.d.ts +30 -13
  101. package/lib/menu/index.js +2 -105
  102. package/lib/menu/types.d.ts +6 -0
  103. package/lib/menu/types.js +0 -0
  104. package/lib/menu-CzV6lOlw.js +224 -0
  105. package/lib/message/index.js +67 -60
  106. package/lib/modal/index.js +2 -196
  107. package/lib/modal/modal_box.js +87 -86
  108. package/lib/modal-DWyWrN-D.js +192 -0
  109. package/lib/page_header/index.js +2 -109
  110. package/lib/page_header-BJkEstRw.js +101 -0
  111. package/lib/pagination/index.js +2 -248
  112. package/lib/pagination-5t7AOeFV.js +210 -0
  113. package/lib/polygon/index.js +2 -27
  114. package/lib/polygon-C4Ow2lxi.js +20 -0
  115. package/lib/qrcode/index.d.ts +13 -4
  116. package/lib/qrcode/index.js +2 -57
  117. package/lib/qrcode-BKG2MibP.js +64 -0
  118. package/lib/radio-2mNSYujz.js +13 -0
  119. package/lib/select/index.js +3 -401
  120. package/lib/select-CAgggYh7.js +326 -0
  121. package/lib/select_ori/index.js +47 -50
  122. package/lib/space/index.js +2 -35
  123. package/lib/space-Bv-p0DL8.js +38 -0
  124. package/lib/switch/index.js +2 -50
  125. package/lib/switch-BaVBi5Ip.js +48 -0
  126. package/lib/tabbar/index.js +2 -109
  127. package/lib/tabbar/item.js +2 -58
  128. package/lib/tabbar-CI1xSj1G.js +96 -0
  129. package/lib/table/index.js +2 -269
  130. package/lib/table-DfL2hFqA.js +234 -0
  131. package/lib/tabs/index.js +38 -42
  132. package/lib/tag/index.js +2 -72
  133. package/lib/tag-72DwCkvq.js +76 -0
  134. package/lib/theme/index.js +2 -89
  135. package/lib/theme/theme_color.js +22 -26
  136. package/lib/theme-BRTI2-Yk.js +83 -0
  137. package/lib/utils/clickoutside.js +18 -18
  138. package/lib/utils/context_provide.js +21 -21
  139. package/lib/utils/event.js +13 -18
  140. package/lib/utils/index.js +55 -58
  141. package/lib/utils/popover.d.ts +4 -1
  142. package/lib/utils/popover.js +276 -352
  143. package/lib/utils/transition.js +33 -31
  144. package/package.json +14 -14
  145. package/styles/container.css +4 -0
  146. package/styles/datepicker.css +55 -0
  147. package/styles/popover.css +14 -1
  148. package/lib/animation-DttknHkX.js +0 -4
  149. package/lib/calendar/langs.js +0 -8
  150. package/lib/carousel/timer.js +0 -19
  151. package/lib/check/check.js +0 -118
  152. package/lib/check/index.js +0 -68
  153. package/lib/check-CksURvTv.js +0 -4
  154. package/lib/form/form_inner.js +0 -125
  155. package/lib/form/types.js +0 -1
  156. package/lib/index-CrMiSe0x.js +0 -249
  157. package/lib/index-DY6m9Wbe.js +0 -4
  158. package/lib/litos-ui.css +0 -1
  159. package/lib/menu/menu_item.d.ts +0 -6
  160. package/lib/menu/menu_item.js +0 -21
  161. package/lib/menu/sub_menu.d.ts +0 -15
  162. package/lib/menu/sub_menu.js +0 -83
  163. package/lib/table/types.js +0 -1
@@ -1,32 +1,34 @@
1
- import { $ as d, iterate as m, transition as r } from "ph-utils/dom";
2
- function g() {
3
- let n;
4
- const s = {
5
- attributes: !0,
6
- attributeFilter: ["l-transition-emit"]
7
- }, u = (e) => {
8
- for (let i of e)
9
- if (i.type === "attributes" && i.attributeName) {
10
- const t = i.target, b = t.getAttribute(i.attributeName) || "show", a = t.getAttribute("l-transition") || "l", c = t.getAttribute("l-transition-method") || "hide";
11
- b === "show" ? (t.style.removeProperty("display"), r(t, a, "enter")) : r(t, a, "leave", () => {
12
- c === "remove" ? t.remove() : t.style.display = "none";
13
- });
14
- }
15
- };
16
- function o(e) {
17
- e && e.length > 0 && (n == null && (n = new MutationObserver(u)), m(e, (i) => {
18
- const t = i.getAttribute("l-transition");
19
- t && (r(i, t, "enter"), n.observe(i, s));
20
- }));
21
- }
22
- function f(e) {
23
- e == null && (e = d("[l-transition]"), o(e));
24
- }
25
- function l() {
26
- n && (n.disconnect(), n = void 0);
27
- }
28
- return { destroy: l, add: o, init: f };
1
+ import { $ as e, iterate as t, transition as n } from "ph-utils/dom";
2
+ //#region src/components/utils/transition.ts
3
+ function r() {
4
+ let r, i = {
5
+ attributes: !0,
6
+ attributeFilter: ["l-transition-emit"]
7
+ }, a = (e) => {
8
+ for (let t of e) if (t.type === "attributes" && t.attributeName) {
9
+ let e = t.target, r = e.getAttribute(t.attributeName) || "show", i = e.getAttribute("l-transition") || "l", a = e.getAttribute("l-transition-method") || "hide";
10
+ i && (r === "show" ? (e.style.removeProperty("display"), n(e, i, "enter")) : n(e, i, "leave", () => {
11
+ a === "remove" ? e.remove() : e.style.display = "none";
12
+ }));
13
+ }
14
+ };
15
+ function o(e) {
16
+ e && e.length > 0 && (r ??= new MutationObserver(a), t(e, (e) => {
17
+ let t = e.getAttribute("l-transition");
18
+ t && (n(e, t, "enter"), r.observe(e, i));
19
+ }));
20
+ }
21
+ function s(t) {
22
+ t ?? (t = e("[l-transition]"), o(t));
23
+ }
24
+ function c() {
25
+ r &&= (r.disconnect(), void 0);
26
+ }
27
+ return {
28
+ destroy: c,
29
+ add: o,
30
+ init: s
31
+ };
29
32
  }
30
- export {
31
- g as createTransition
32
- };
33
+ //#endregion
34
+ export { r as createTransition };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litos-ui",
3
- "version": "0.17.5",
3
+ "version": "0.18.1",
4
4
  "description": "基于 Web Component 的 UI 组件库",
5
5
  "keywords": [
6
6
  "component library",
@@ -43,25 +43,25 @@
43
43
  "docs:build": "vitepress build docs",
44
44
  "docs:preview": "vitepress preview docs",
45
45
  "create": "node scripts/index.js create",
46
- "dts:build": "tsc -p tsconfig.build.json && node scripts/dts.js",
47
- "lib:build": "pnpm build && pnpm dts:build"
46
+ "dts:build": "tsc -p tsconfig.build.json",
47
+ "lib:build": "npm run build && npm run dts:build"
48
48
  },
49
49
  "dependencies": {
50
50
  "alien-signals": "^3.1.2",
51
51
  "iconify-icon": "^3.0.2",
52
- "ph-utils": "^0.17.2",
53
- "qrcode-generator-es": "^2.1.2",
54
- "shiki": "^3.23.0"
52
+ "ph-utils": "^0.19.0",
53
+ "qrcode-generator-es": "^2.1.3",
54
+ "shiki": "^4.0.2"
55
55
  },
56
56
  "devDependencies": {
57
- "@types/node": "^25.3.1",
58
- "less": "^4.5.1",
59
- "lightningcss": "^1.31.1",
60
- "oxfmt": "^0.35.0",
61
- "oxlint": "^1.50.0",
62
- "typescript": "^5.9.3",
63
- "vite": "^7.3.1",
64
- "vite-plugin-dts": "^4.5.4",
57
+ "@types/node": "^25.6.0",
58
+ "less": "^4.6.4",
59
+ "lightningcss": "^1.32.0",
60
+ "oxfmt": "^0.47.0",
61
+ "oxlint": "^1.62.0",
62
+ "typescript": "^6.0.3",
63
+ "vite": "^8.0.10",
65
64
  "vitepress": "^1.6.4"
66
65
  }
66
+
67
67
  }
@@ -23,6 +23,7 @@
23
23
  box-sizing: border-box;
24
24
  width: var(--l-aside-width);
25
25
  flex-shrink: 0;
26
+ min-width: 0;
26
27
  border-right: 1px solid #dedede;
27
28
  padding: 10px;
28
29
  }
@@ -35,12 +36,14 @@
35
36
  flex-shrink: 0;
36
37
  justify-content: space-between;
37
38
  height: var(--l-header-height);
39
+ min-height: 0;
38
40
  }
39
41
  .l-footer {
40
42
  padding: 10px;
41
43
  box-sizing: border-box;
42
44
  border-top: 1px solid #dedede;
43
45
  height: var(--l-footer-height);
46
+ min-height: 0;
44
47
  }
45
48
  .l-main {
46
49
  width: 100%;
@@ -49,4 +52,5 @@
49
52
  padding: 10px;
50
53
  flex-grow: 1;
51
54
  --webkit-overflow-scrolling: touch;
55
+ min-width: 0;
52
56
  }
@@ -0,0 +1,55 @@
1
+ .l-date-picker-panel {
2
+ border-radius: 5px;
3
+ width: 270px;
4
+ }
5
+
6
+ .l-date-picker--header {
7
+ display: flex;
8
+ padding: 0 8px;
9
+ color: rgba(0, 0, 0, 0.88);
10
+ border-bottom: 1px solid rgba(5, 5, 5, 0.06);
11
+ height: var(--l-date-picker-header-height, 40px);
12
+ }
13
+
14
+ .l-date-picker--footer {
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: flex-end;
18
+ padding: 8px;
19
+ border-top: 1px solid rgba(5, 5, 5, 0.06);
20
+ }
21
+
22
+ .l-date-picker-header-btn {
23
+ outline: none;
24
+ padding: 0;
25
+ width: 22px;
26
+ height: 100%;
27
+ display: inline-flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ color: var(--l-date-picker-button-color, inherit);
31
+ transition: color 0.3s;
32
+ flex-shrink: 0;
33
+ min-width: 0;
34
+ }
35
+
36
+ .l-date-picker-header-btn:hover {
37
+ --l-date-picker-button-color: var(--l-primary-color-light1, #3399ff);
38
+ }
39
+
40
+ .l-date-picker-header-btn:active {
41
+ --l-date-picker-button-color: var(--l-primary-color, #007bff);
42
+ }
43
+
44
+ .l-date-picker-year-month {
45
+ flex-grow: 1;
46
+ width: auto;
47
+ }
48
+
49
+ .l-date-picker--body {
50
+ padding: 4px 10px 8px 10px;
51
+ }
52
+
53
+ .l-date-picker--calendar {
54
+ height: 240px;
55
+ }
@@ -17,8 +17,9 @@
17
17
  display: none;
18
18
  z-index: 300;
19
19
  line-height: 1;
20
- padding: 10px;
20
+
21
21
  }
22
+
22
23
  .l-popover-arrow {
23
24
  position: absolute;
24
25
  background: var(--l-popover-background);
@@ -27,6 +28,7 @@
27
28
  transform: rotate(45deg);
28
29
  box-sizing: border-box;
29
30
  }
31
+
30
32
  /* tooltip */
31
33
  .l-popover.l-popover--tooltip {
32
34
  --l-popover-color: #fff;
@@ -41,15 +43,18 @@
41
43
  .l-popover--popconfirm {
42
44
  min-width: 150px;
43
45
  }
46
+
44
47
  .l-popover--popconfirm .l-popconfirm-container {
45
48
  display: flex;
46
49
  align-items: center;
47
50
  }
51
+
48
52
  .l-popover--popconfirm .l-popconfirm-icon-wrapper {
49
53
  margin-right: 10px;
50
54
  display: inline-flex;
51
55
  color: var(--l-warn-color, #f90);
52
56
  }
57
+
53
58
  .l-popover--popconfirm .l-popconfirm-footer {
54
59
  display: flex;
55
60
  align-items: center;
@@ -57,10 +62,18 @@
57
62
  margin-top: 7px;
58
63
  gap: 7px;
59
64
  }
65
+
60
66
  .l-popover--popconfirm .l-popconfirm-btn {
61
67
  height: 24px;
62
68
  }
69
+
63
70
  .l-popover--popconfirm .l-popconfirm-btn::part(default) {
64
71
  padding: 0 6px;
65
72
  font-size: 13px;
66
73
  }
74
+
75
+ .l-popover--tooltip,
76
+ .l-popover--popconfirm,
77
+ .l-popover--default {
78
+ padding: 10px;
79
+ }
@@ -1,4 +0,0 @@
1
- const a = "@keyframes l-rotate-frame{0%{transform:rotate3d(0,0,1,0)}to{transform:rotate3d(0,0,1,360deg)}}.l-rotate-anim{animation:l-rotate-frame 1.5s infinite linear}";
2
- export {
3
- a
4
- };
@@ -1,8 +0,0 @@
1
- const e = {
2
- "zh-CN": {
3
- weekdays: ["一", "二", "三", "四", "五", "六", "七"]
4
- }
5
- };
6
- export {
7
- e as langs
8
- };
@@ -1,19 +0,0 @@
1
- function o(a, l = 3e3) {
2
- let n = 0, t = !1, e = null;
3
- function u() {
4
- t || (t = !0, n = 0, e = requestAnimationFrame(r));
5
- }
6
- function f() {
7
- t = !1, e && (cancelAnimationFrame(e), e = null);
8
- }
9
- function r(i) {
10
- t && (n || (n = i), i - n >= l && (a(), n = i), e = requestAnimationFrame(r));
11
- }
12
- return {
13
- start: u,
14
- stop: f
15
- };
16
- }
17
- export {
18
- o as default
19
- };
@@ -1,118 +0,0 @@
1
- import { e as l } from "../index-CrMiSe0x.js";
2
- import d from "../form/form_inner.js";
3
- import { stopSignal as o, parseAttrValue as c } from "../utils/index.js";
4
- import { addClass as n, on as u, off as p, $$ as i, removeClass as r, toggleClass as k } from "ph-utils/dom";
5
- class f extends d {
6
- /** 是否选中 */
7
- _checked;
8
- _inputType;
9
- // input类型
10
- $input;
11
- _groupCtx;
12
- _groupCtxStop;
13
- setChecked(e) {
14
- this._checked = e, this.checkedChange();
15
- }
16
- getChecked() {
17
- return this._checked;
18
- }
19
- constructor() {
20
- super(), this._checked = !1, this._inputType = "radio", Object.defineProperty(this, "checked", {
21
- configurable: !0,
22
- enumerable: !0,
23
- get: this.getChecked,
24
- set: this.setChecked
25
- });
26
- }
27
- static get observedAttributes() {
28
- return ["checked", "label", "button", "indeterminate", ...d.observedAttributes];
29
- }
30
- connectedCallback() {
31
- super.connectedCallback(), this.getChecked() && this.setChecked(!0), this.isDisabled() && n(this, "is-disabled"), this._updateIndeterminate(), this.emitInject("check-context-request", (e) => {
32
- this._groupCtx = e;
33
- }), this._groupCtxStop = l(() => {
34
- if (this.value == null) return;
35
- const e = this._groupCtx ? this._groupCtx() : [];
36
- this.setChecked(e.includes(this.value));
37
- });
38
- }
39
- afterInit() {
40
- u(this, "click", this.#e);
41
- }
42
- beforeDestroy() {
43
- p(this, "click", this.#e), this._groupCtxStop = o(this._groupCtxStop);
44
- }
45
- render() {
46
- const e = document.createDocumentFragment(), s = i("input", {
47
- type: this._inputType,
48
- class: "l-check__input",
49
- name: this.getName(),
50
- value: this.value,
51
- checked: this.getChecked(),
52
- disabled: this.isDisabled() ? "disabled" : void 0
53
- });
54
- if (this.$input = s, e.appendChild(s), !this._state.button) {
55
- const a = i("span", { class: "l-check__inner" });
56
- e.appendChild(a);
57
- }
58
- const t = i("label", {
59
- class: "l-check__label",
60
- part: "label"
61
- }), h = i("slot", {
62
- textContent: this._state.label
63
- });
64
- return t.appendChild(h), e.appendChild(t), e;
65
- }
66
- attributeChange(e, s, t) {
67
- switch (e) {
68
- case "checked":
69
- const h = c(t, !1, "checked");
70
- this.setChecked(h);
71
- break;
72
- case "button":
73
- this._state[e] = c(t, !1, e);
74
- break;
75
- case "indeterminate":
76
- const a = c(t, !1, e);
77
- this._state.indeterminate = a, this._updateIndeterminate();
78
- break;
79
- case "label":
80
- this._state.label = t;
81
- break;
82
- }
83
- }
84
- checkedChange() {
85
- this.getChecked() ? n(this, "is-checked") : r(this, "is-checked"), this.$input && (this.$input.checked = this.getChecked());
86
- }
87
- disabledChange() {
88
- k(this, "is-disabled"), this.$input && (this.$input.disabled = this.isDisabled());
89
- }
90
- _updateIndeterminate() {
91
- this._state.indeterminate ? n(this, "is-indeterminate") : r(this, "is-indeterminate");
92
- }
93
- #e = () => {
94
- if (!this.isDisabled())
95
- if (this.value && this._groupCtx)
96
- this.emitChange();
97
- else {
98
- const e = this._inputType === "radio" ? !0 : !this.getChecked();
99
- this.setChecked(e), this.emitChange();
100
- }
101
- };
102
- emitChange() {
103
- this.emit("change", {
104
- detail: {
105
- value: this.value,
106
- name: this.getName(),
107
- checked: this.getChecked()
108
- },
109
- composed: !0,
110
- bubbles: !0
111
- });
112
- }
113
- _doChangeAction() {
114
- }
115
- }
116
- export {
117
- f as default
118
- };
@@ -1,68 +0,0 @@
1
- import h from "../form/form_inner.js";
2
- import { on as a, off as l, $$ as r } from "ph-utils/dom";
3
- import { unitNumberStr as u } from "../utils/index.js";
4
- import { s as c } from "../index-CrMiSe0x.js";
5
- const o = ":host{display:flex;align-items:center;gap:var(--l-check-gap, 0px)}";
6
- class f extends h {
7
- values;
8
- multiple;
9
- _state;
10
- setValue(e) {
11
- super.setValue(e), this.rendered && this.updateChecked();
12
- }
13
- constructor() {
14
- super(!1), this.multiple = !0, this.values = c([]), this._state = {};
15
- }
16
- static get observedAttributes() {
17
- return ["disabled", "value", "name", "inner-block", "gap"];
18
- }
19
- attributeChange(e, s, t) {
20
- e === "gap" && (this._state.gap = u(t));
21
- }
22
- updateDOM(e) {
23
- e.has("gap") && this._updateGap();
24
- }
25
- connectedCallback() {
26
- this.loadStyleText([o]), this.updateChecked(), super.connectedCallback(), this._updateGap();
27
- }
28
- afterInit() {
29
- a(this.root, "change", this.#e), a(this, "check-context-request", this._privide);
30
- }
31
- beforeDestroy() {
32
- l(this.root, "change", this.#e), l(this, "check-context-request", this._privide), this.values([]);
33
- }
34
- render() {
35
- return r("slot");
36
- }
37
- _privide = (e) => {
38
- const { context: s, callback: t } = e.detail;
39
- s === "check-context-request" && t(this.values);
40
- };
41
- _updateGap = () => {
42
- this._state.gap ? this.style.setProperty("--l-check-gap", this._state.gap) : this.style.removeProperty("--l-check-gap");
43
- };
44
- #e = (e) => {
45
- e.stopPropagation();
46
- const s = e.detail.value, t = this.values();
47
- let i = t.indexOf(s);
48
- this.multiple ? (i !== -1 ? t.splice(i, 1) : t.push(s), this.setAttribute("value", t.join("&"))) : i === -1 && this.setAttribute("value", s), this.emit("change", {
49
- detail: { value: this.multiple ? t : s },
50
- composed: !0
51
- });
52
- };
53
- updateChecked() {
54
- let e = [];
55
- if (this.value)
56
- if (this.multiple) {
57
- const s = this.value.split("&");
58
- e.push(...s.map((t) => decodeURIComponent(t)));
59
- } else
60
- e = [this.value];
61
- else
62
- e = [];
63
- this.values(e);
64
- }
65
- }
66
- export {
67
- f as default
68
- };
@@ -1,4 +0,0 @@
1
- const r = ":host{--l-check-size: 14px;display:inline-flex;align-items:center;position:relative;cursor:pointer;width:auto;outline:none;transition:color .3s,border-color .3s,background-color .3s}.l-check__input{margin:0;position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-check__inner{width:var(--l-check-size, 14px);height:var(--l-check-size, 14px);display:flex;justify-content:center;align-items:center;border-radius:3px;border:1px solid #dcddd9;box-sizing:border-box;transition:border-color .3s ease-in-out;position:relative;margin-right:5px;flex-shrink:0}.l-check__label{transition:color .3s;cursor:inherit;line-height:1}:host(.is-checked){color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color, #722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color, #e6e6e6)}:host([button]){height:var(--l-form-control-height, 32px);justify-content:center;padding:0 15px;border:1px solid #c0c4cc;border-left-width:0;margin-left:0;border-radius:inherit}:host([button]:first-child){border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}:host([button]:last-child){border-top-right-radius:3px;border-bottom-right-radius:3px}:host([button].is-checked){background-color:var(--l-primary-color, #722ed1);color:#fff;border-color:var(--l-primary-color, #722ed1);border-right-color:#fff}:host([button].is-checked:last-child){border-right-color:var(--l-primary-color, #722ed1)}";
2
- export {
3
- r as c
4
- };
@@ -1,125 +0,0 @@
1
- import o from "../base.js";
2
- import { parseAttrValue as a, stopSignal as i } from "../utils/index.js";
3
- import { getAttr as l } from "ph-utils/dom";
4
- import { e as n } from "../index-CrMiSe0x.js";
5
- class _ extends o {
6
- disabled = !1;
7
- _value = void 0;
8
- _resetValue;
9
- // 重置值(即初始化值)
10
- _firstPushValue = !0;
11
- // 初始化时是否推送数据到 Form
12
- _isReset = !1;
13
- // 是否是重置, 重置时不触发数据校验
14
- _name;
15
- formContext;
16
- formItemContext;
17
- formErrors;
18
- // 表单验证错误
19
- resetCtx;
20
- _signalStop;
21
- _errorSignalStop;
22
- _resetSignalStop;
23
- /**
24
- *
25
- * @param firstPushValue 是否第一次赋值 value 时, 推送数据到 Form, 默认: true
26
- * @param delegatesFocus 是否委托焦点, 默认: true
27
- */
28
- constructor(e = !0, t = !0) {
29
- super(!0, { delegatesFocus: t }), this._firstPushValue = e;
30
- }
31
- get name() {
32
- return this._name;
33
- }
34
- set name(e) {
35
- this._name = e;
36
- }
37
- get value() {
38
- return this._value;
39
- }
40
- set value(e) {
41
- this.setValue(e);
42
- }
43
- setValue(e) {
44
- this._value = e, this._resetValue == null && (this._resetValue = e), this.pushValueChange();
45
- }
46
- getValue() {
47
- return this._value;
48
- }
49
- static get observedAttributes() {
50
- return ["disabled", "value", "name", "inner-block"];
51
- }
52
- attributeChanged(e, t, s) {
53
- switch (e) {
54
- case "value":
55
- case "name":
56
- this[e] = s;
57
- break;
58
- case "disabled":
59
- this.disabled = a(s, !1, e);
60
- break;
61
- case "inner-block":
62
- const r = a(s, !1, e);
63
- this.innerBlockChange(r);
64
- break;
65
- default:
66
- this.attributeChange(e, t, s);
67
- break;
68
- }
69
- }
70
- attributeChange(e, t, s) {
71
- }
72
- connectedCallback() {
73
- this.emitInject("form-context-request", this.formInject), this.emitInject("form-item-context-request", this.formItemInject), super.connectedCallback(), this._signalStop = n(() => {
74
- const e = this.formItemContext ? this.formItemContext() : null, t = this.formContext ? this.formContext() : null;
75
- if (!this.name && e && e.prop && this.setAttribute("name", e.prop), !l(this, "inner-block")) {
76
- const r = e?.innerBlock || t?.innerBlock;
77
- r != null && this.innerBlockChange(r);
78
- }
79
- }), this._value == null && (this._resetValue = "", this._firstPushValue && this.pushValueChange()), this._errorSignalStop = n(() => {
80
- if (!this.name) return;
81
- const t = (this.formErrors ? this.formErrors() : {})[this.name];
82
- this.validResult(t);
83
- }), this._resetSignalStop = n(() => {
84
- (this.resetCtx ? this.resetCtx() : 0) > 0 && this.reset();
85
- });
86
- }
87
- disconnectedCallback() {
88
- super.disconnectedCallback(), this._signalStop = i(this._signalStop), this._errorSignalStop = i(this._errorSignalStop), this._resetSignalStop = i(this._resetSignalStop);
89
- }
90
- isDisabled() {
91
- return this.disabled;
92
- }
93
- getName() {
94
- return this.name;
95
- }
96
- disabledChange() {
97
- }
98
- innerBlockChange(e) {
99
- }
100
- validResult(e) {
101
- }
102
- formInject = (e, t, s) => {
103
- this.formContext = e, this.formErrors = t, this.resetCtx = s;
104
- };
105
- formItemInject = (e) => {
106
- this.formItemContext = e;
107
- };
108
- pushValueChange() {
109
- this.name && this.emit("form-value-change", {
110
- bubbles: !0,
111
- composed: !0,
112
- detail: {
113
- name: this.name,
114
- value: this._value,
115
- valid: !this._isReset
116
- }
117
- }), this._isReset = !1;
118
- }
119
- reset() {
120
- this._isReset = !0, this.value = this._resetValue || "";
121
- }
122
- }
123
- export {
124
- _ as default
125
- };
package/lib/form/types.js DELETED
@@ -1 +0,0 @@
1
-