litos-ui 0.17.5 → 0.18.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.
Files changed (161) hide show
  1. package/README.md +49 -49
  2. package/lib/animation-CTt9qgA7.js +4 -0
  3. package/lib/base-Dm0WS1pK.js +62 -0
  4. package/lib/base.js +111 -147
  5. package/lib/button/index.d.ts +8 -3
  6. package/lib/button/index.js +2 -137
  7. package/lib/button-CC5PmAb1.js +146 -0
  8. package/lib/calendar/index.d.ts +10 -5
  9. package/lib/calendar/index.js +2 -123
  10. package/lib/calendar-DeP6yZB0.js +149 -0
  11. package/lib/carousel/index.js +2 -280
  12. package/lib/carousel/item.js +2 -15
  13. package/lib/carousel-D4Fe3LEx.js +272 -0
  14. package/lib/check/checkbox.js +2 -18
  15. package/lib/check/checkbox_group.js +6 -6
  16. package/lib/check/radio.js +2 -15
  17. package/lib/check/radio_group.js +9 -9
  18. package/lib/check-B0XraJvb.js +73 -0
  19. package/lib/check-CvGaONEx.js +117 -0
  20. package/lib/checkbox-DbWsmAaL.js +16 -0
  21. package/lib/collapse/index.d.ts +18 -11
  22. package/lib/collapse/index.js +2 -88
  23. package/lib/collapse/item.d.ts +28 -9
  24. package/lib/collapse/item.js +2 -115
  25. package/lib/collapse/types.d.ts +7 -0
  26. package/lib/collapse-CeKRZ-43.js +104 -0
  27. package/lib/color_picker/index.js +2 -42
  28. package/lib/color_picker-D0brKFm-.js +41 -0
  29. package/lib/date_picker/index.d.ts +23 -0
  30. package/lib/date_picker/index.js +3 -0
  31. package/lib/date_picker-DQGoiN8v.js +103 -0
  32. package/lib/date_picker_ori/index.js +2 -129
  33. package/lib/date_picker_ori-aRuSSi9D.js +122 -0
  34. package/lib/description_panel/index.js +2 -66
  35. package/lib/description_panel-Df_8rVbX.js +57 -0
  36. package/lib/dialog/dialog_container.js +2 -131
  37. package/lib/dialog/index.js +67 -85
  38. package/lib/dialog_container-DcN87wj0.js +126 -0
  39. package/lib/esm-sVEoAVPu.js +244 -0
  40. package/lib/form/form_item.d.ts +1 -0
  41. package/lib/form/form_item.js +2 -136
  42. package/lib/form/index.js +2 -147
  43. package/lib/form-DdU0yK0k.js +154 -0
  44. package/lib/form_inner-DR9tyB_r.js +117 -0
  45. package/lib/form_item-Bv-YafZK.js +137 -0
  46. package/lib/icon/arrow_down.js +12 -12
  47. package/lib/icon/arrow_left.js +9 -9
  48. package/lib/icon/arrow_right.js +9 -9
  49. package/lib/icon/arrow_up.js +12 -12
  50. package/lib/icon/base.d.ts +16 -2
  51. package/lib/icon/base.js +2 -38
  52. package/lib/icon/calendar.d.ts +5 -0
  53. package/lib/icon/calendar.js +10 -0
  54. package/lib/icon/caret_bottom.js +9 -9
  55. package/lib/icon/caret_top.js +9 -9
  56. package/lib/icon/close.js +9 -9
  57. package/lib/icon/close_filled.js +12 -12
  58. package/lib/icon/d_arrow_left.js +12 -12
  59. package/lib/icon/d_arrow_right.js +12 -12
  60. package/lib/icon/font_icon.d.ts +2 -3
  61. package/lib/icon/font_icon.js +35 -39
  62. package/lib/icon/info.js +12 -12
  63. package/lib/icon/loading.js +9 -9
  64. package/lib/icon/moon.js +12 -12
  65. package/lib/icon/more.js +12 -12
  66. package/lib/icon/reduction.js +12 -12
  67. package/lib/icon/refresh.d.ts +5 -0
  68. package/lib/icon/refresh.js +10 -0
  69. package/lib/icon/refresh_left.js +12 -12
  70. package/lib/icon/refresh_right.js +9 -9
  71. package/lib/icon/search.js +9 -9
  72. package/lib/icon/select.js +12 -12
  73. package/lib/icon/sort.js +9 -9
  74. package/lib/icon/success.js +12 -12
  75. package/lib/icon/sun.js +12 -12
  76. package/lib/icon/theme_default.js +12 -12
  77. package/lib/icon/warn.js +12 -12
  78. package/lib/icon/zoom_in.js +12 -12
  79. package/lib/icon/zoom_out.js +12 -12
  80. package/lib/image/image_preview.js +2 -104
  81. package/lib/image/index.js +2 -176
  82. package/lib/image-CeQVfS-v.js +162 -0
  83. package/lib/image_preview-PzZzwo6m.js +92 -0
  84. package/lib/index.d.ts +10 -4
  85. package/lib/index.js +80 -169
  86. package/lib/input/index.d.ts +6 -2
  87. package/lib/input/index.js +188 -203
  88. package/lib/input-DjKxcxry.js +4 -0
  89. package/lib/input_inner-BKJg9n9A.js +4 -0
  90. package/lib/item-Cuw_ZPyn.js +14 -0
  91. package/lib/item-DV842Aux.js +57 -0
  92. package/lib/item-ZXLWFzSm.js +119 -0
  93. package/lib/list/index.js +2 -58
  94. package/lib/list-CU7vHS6s.js +51 -0
  95. package/lib/loading/index.d.ts +3 -2
  96. package/lib/loading/index.js +109 -127
  97. package/lib/mask/index.js +2 -105
  98. package/lib/mask-BlV5QfTj.js +112 -0
  99. package/lib/md_input/index.js +2 -60
  100. package/lib/md_input-DSQx5TMW.js +58 -0
  101. package/lib/menu/index.js +2 -105
  102. package/lib/menu/menu_item.js +2 -21
  103. package/lib/menu/sub_menu.js +2 -83
  104. package/lib/menu-DAtplYAH.js +91 -0
  105. package/lib/menu_item-BW1Tu11Q.js +20 -0
  106. package/lib/message/index.js +67 -60
  107. package/lib/modal/index.js +2 -196
  108. package/lib/modal/modal_box.js +87 -86
  109. package/lib/modal-DWyWrN-D.js +192 -0
  110. package/lib/page_header/index.js +2 -109
  111. package/lib/page_header-DdeRDN4U.js +101 -0
  112. package/lib/pagination/index.js +2 -248
  113. package/lib/pagination-BoPzSPjT.js +210 -0
  114. package/lib/polygon/index.js +2 -27
  115. package/lib/polygon-C4Ow2lxi.js +20 -0
  116. package/lib/qrcode/index.d.ts +13 -4
  117. package/lib/qrcode/index.js +2 -57
  118. package/lib/qrcode-BFxsD_OP.js +64 -0
  119. package/lib/radio-2mNSYujz.js +13 -0
  120. package/lib/select/index.js +3 -401
  121. package/lib/select-CAgggYh7.js +326 -0
  122. package/lib/select_ori/index.js +47 -50
  123. package/lib/space/index.js +2 -35
  124. package/lib/space-CpTmBfHP.js +38 -0
  125. package/lib/sub_menu-D1s8ABNu.js +75 -0
  126. package/lib/switch/index.js +2 -50
  127. package/lib/switch-BaVBi5Ip.js +48 -0
  128. package/lib/tabbar/index.js +2 -109
  129. package/lib/tabbar/item.js +2 -58
  130. package/lib/tabbar-4_d2Fj1n.js +91 -0
  131. package/lib/table/index.js +2 -269
  132. package/lib/table-Hifj8jAX.js +234 -0
  133. package/lib/tabs/index.js +38 -42
  134. package/lib/tag/index.js +2 -72
  135. package/lib/tag-DPENZf_V.js +76 -0
  136. package/lib/theme/index.js +2 -89
  137. package/lib/theme/theme_color.js +22 -26
  138. package/lib/theme-BRTI2-Yk.js +83 -0
  139. package/lib/utils/clickoutside.js +18 -18
  140. package/lib/utils/context_provide.js +21 -21
  141. package/lib/utils/event.js +13 -18
  142. package/lib/utils/index.js +55 -58
  143. package/lib/utils/popover.d.ts +4 -1
  144. package/lib/utils/popover.js +276 -352
  145. package/lib/utils/transition.js +33 -31
  146. package/package.json +10 -11
  147. package/styles/container.css +4 -0
  148. package/styles/datepicker.css +55 -0
  149. package/styles/popover.css +14 -1
  150. package/lib/animation-DttknHkX.js +0 -4
  151. package/lib/calendar/langs.js +0 -8
  152. package/lib/carousel/timer.js +0 -19
  153. package/lib/check/check.js +0 -118
  154. package/lib/check/index.js +0 -68
  155. package/lib/check-CksURvTv.js +0 -4
  156. package/lib/form/form_inner.js +0 -125
  157. package/lib/form/types.js +0 -1
  158. package/lib/index-CrMiSe0x.js +0 -249
  159. package/lib/index-DY6m9Wbe.js +0 -4
  160. package/lib/litos-ui.css +0 -1
  161. package/lib/table/types.js +0 -1
@@ -0,0 +1,41 @@
1
+ import { initAttr as e, setAttrs as t } from "./utils/index.js";
2
+ import { t as n } from "./form_inner-DR9tyB_r.js";
3
+ import { t as r } from "./input-DjKxcxry.js";
4
+ import { $one as i, off as a, on as o } from "ph-utils/dom";
5
+ //#region src/components/color_picker/index.less?inline
6
+ var s = ":host{--l-input-width:60px}", c = class extends n {
7
+ static baseName = "color-picker";
8
+ $picker;
9
+ _value = "#000000";
10
+ constructor() {
11
+ super(), e(this);
12
+ }
13
+ setValue(e) {
14
+ super.setValue(e), this.$picker && (this.$picker.value = e);
15
+ }
16
+ connectedCallback() {
17
+ this.loadStyleText([r, s]), super.connectedCallback(), this.$picker = i("input", this.root), o(this.$picker, "change", this._handleChange);
18
+ }
19
+ disconnectedCallback() {
20
+ super.disconnectedCallback(), this.$picker &&= (a(this.$picker, "change", this._handleChange), void 0);
21
+ }
22
+ render() {
23
+ let e = document.createElement("input");
24
+ return t(e, [
25
+ ["value", this.value],
26
+ ["disabled", this.isDisabled()],
27
+ ["name", this.getName()],
28
+ ["type", "color"],
29
+ ["class", "l-input l-color-picker"]
30
+ ]), e;
31
+ }
32
+ disabledChange() {
33
+ this.$picker && (this.$picker.disabled = this.isDisabled());
34
+ }
35
+ _handleChange = (e) => {
36
+ let t = e.target.value;
37
+ super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
38
+ };
39
+ };
40
+ //#endregion
41
+ export { c as t };
@@ -0,0 +1,23 @@
1
+ import FormInner from "../form/form_inner";
2
+ type DatePickerState = {
3
+ width?: string;
4
+ };
5
+ export default class DatePicker extends FormInner<DatePickerState> {
6
+ static baseName: string;
7
+ private _popover;
8
+ constructor();
9
+ afterInit(): void;
10
+ beforeDestroy(): void;
11
+ static get observedAttributes(): string[];
12
+ attributeChange(name: string, oldValue: string, newValue: string): void;
13
+ protected updateDOM(changedProps: Set<string>): void;
14
+ render_v2(): {
15
+ template?: string | HTMLElement | DocumentFragment;
16
+ style?: string | string[];
17
+ };
18
+ private _popoverContentRender;
19
+ private _updateWidth;
20
+ private _handleTap;
21
+ private _onOuterTap;
22
+ }
23
+ export {};
@@ -0,0 +1,3 @@
1
+ import "../utils/popover.js";
2
+ import { t as e } from "../date_picker-DQGoiN8v.js";
3
+ export { e as default };
@@ -0,0 +1,103 @@
1
+ import { unitNumberStr as e } from "./utils/index.js";
2
+ import { t } from "./form_inner-DR9tyB_r.js";
3
+ import { t as n } from "./input_inner-BKJg9n9A.js";
4
+ import { Popover as r } from "./utils/popover.js";
5
+ import { $$ as i, on as a } from "ph-utils/dom";
6
+ //#region src/components/date_picker/index.less?inline
7
+ var o = ":host{height:var(--l-form-control-height,32px);border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);width:var(--l-date-picker-width,140px);align-items:center;gap:8px;padding:0 8px;transition:border-color .3s;display:inline-flex}:host(:hover){border-color:var(--l-primary-color-light2,#66b3ff)}.icon{color:#00000059;flex-shrink:0;min-width:0}", s = class extends t {
8
+ static baseName = "date-picker";
9
+ _popover;
10
+ constructor() {
11
+ super(), this.version = 2, this._state = {}, this._popover = new r({
12
+ trigger: "manual",
13
+ reference: this,
14
+ placement: "bottom-start",
15
+ arrow: !1,
16
+ offset: 5,
17
+ theme: "date-picker",
18
+ contentRender: this._popoverContentRender,
19
+ onOutsideTap: this._onOuterTap
20
+ });
21
+ }
22
+ afterInit() {
23
+ this._updateWidth(), a(this, "click", this._handleTap);
24
+ }
25
+ beforeDestroy() {
26
+ this._popover.destroy(), a(this, "off", this._handleTap), this._popover = void 0;
27
+ }
28
+ static get observedAttributes() {
29
+ return ["width"];
30
+ }
31
+ attributeChange(t, n, r) {
32
+ switch (t) {
33
+ case "width":
34
+ this._state.width = e(r);
35
+ break;
36
+ }
37
+ }
38
+ updateDOM(e) {
39
+ e.has("width") && this._updateWidth();
40
+ }
41
+ render_v2() {
42
+ let e = document.createDocumentFragment(), t = i("input", {
43
+ class: "l-input__inner",
44
+ placeholder: "请选择日期"
45
+ });
46
+ e.appendChild(t);
47
+ let r = i("l-calendar-icon", { class: "icon" });
48
+ return e.appendChild(r), {
49
+ style: [o, n],
50
+ template: e
51
+ };
52
+ }
53
+ _popoverContentRender() {
54
+ let e = i("div", { class: "l-date-picker-panel" }), t = i("div", { class: "l-date-picker--header" }), n = i("button", {
55
+ type: "button",
56
+ "aria-label": "上一年",
57
+ class: "l-date-picker-header-btn",
58
+ innerHTML: "<l-d-arrow-left-icon></l-d-arrow-left-icon>"
59
+ });
60
+ t.appendChild(n);
61
+ let r = i("button", {
62
+ type: "button",
63
+ "aria-label": "上一月",
64
+ class: "l-date-picker-header-btn",
65
+ innerHTML: "<l-arrow-left-icon></l-arrow-left-icon>"
66
+ });
67
+ t.appendChild(r);
68
+ let a = i("button", {
69
+ class: "l-date-picker-header-btn l-date-picker-year-month",
70
+ textContent: "2026-04"
71
+ });
72
+ t.appendChild(a);
73
+ let o = i("button", {
74
+ type: "button",
75
+ "aria-label": "下一年",
76
+ class: "l-date-picker-header-btn",
77
+ innerHTML: "<l-arrow-right-icon></l-arrow-right-icon>"
78
+ });
79
+ t.appendChild(o);
80
+ let s = i("button", {
81
+ type: "button",
82
+ "aria-label": "下一月",
83
+ class: "l-date-picker-header-btn",
84
+ innerHTML: "<l-d-arrow-right-icon></l-d-arrow-right-icon>"
85
+ });
86
+ t.appendChild(s), e.appendChild(t);
87
+ let c = i("l-calendar", { class: "l-date-picker--calendar" }), l = i("div", { class: "l-date-picker--body" });
88
+ l.appendChild(c), e.appendChild(l);
89
+ let u = i("div", { class: "l-date-picker--footer" }), d = i("l-button", { textContent: "此刻" });
90
+ return u.appendChild(d), e.appendChild(u), e;
91
+ }
92
+ _updateWidth() {
93
+ this._state.width ? this.style.setProperty("--l-date-picker-width", this._state.width) : this.style.removeProperty("--l-date-picker-width");
94
+ }
95
+ _handleTap = () => {
96
+ this._popover.isShow() || this._popover.show(this);
97
+ };
98
+ _onOuterTap = (e, t, n) => {
99
+ t || n || this._popover.hide();
100
+ };
101
+ };
102
+ //#endregion
103
+ export { s as t };
@@ -1,129 +1,2 @@
1
- import h from "../form/form_inner.js";
2
- import { iterate as n, $ as o, on as a, off as r, $$ as l } from "ph-utils/dom";
3
- import { parse as c } from "ph-utils/date";
4
- import { unitNumberStr as p, parseAttrValue as d, kebabToCamel as u } from "../utils/index.js";
5
- const m = ":host{display:inline-flex;align-items:center;width:var(--l-date-picker-width, auto)}.l-date-inner{height:var(--l-form-control-height, 32px);border-radius:3px;outline:none;border:1px solid var(--l-border-color, #dedede);cursor:text;padding:0 5px;flex-grow:1;transition:border-color .3s}.l-date-inner:hover{border-color:var(--l-primary-color-light1, #9254de)}.l-date-inner:focus{border-color:var(--l-primary-color, #722ed1)}.l-date-range-divider{margin:0 10px}";
6
- class w extends h {
7
- static baseName = "date-picker-ori";
8
- #t;
9
- #e;
10
- #i;
11
- // 至上一次触发change后,是否有更改
12
- #s;
13
- _state;
14
- constructor() {
15
- super(), this._state = {
16
- range: !1,
17
- delay: 300,
18
- type: "date",
19
- allowEmpty: !0
20
- }, this.#e = [], this.#s = !1;
21
- }
22
- setValue(t) {
23
- super.setValue(t), this.#e = t.split(","), this.rendered && n(this.#t, (i, e) => {
24
- i.value = this.#e[e];
25
- });
26
- }
27
- static get observedAttributes() {
28
- return [
29
- ...h.observedAttributes,
30
- "range",
31
- "delay",
32
- "type",
33
- "width",
34
- "min",
35
- "max",
36
- "allow-empty"
37
- ];
38
- }
39
- connectedCallback() {
40
- this.loadStyleText(m), this._updateWidth(), super.connectedCallback();
41
- }
42
- afterInit() {
43
- this.#t = o(".l-date-inner", this.root), a(this.#t, "change", this.#h), this._state.range && (a(this.#t, "focus", this.#d), a(this.#t, "blur", this.#n));
44
- }
45
- beforeDestroy() {
46
- r(this.#t, "change", this.#h), this._state.range && (r(this.#t, "focus", this.#d), r(this.#t, "blur", this.#n)), this.#a();
47
- }
48
- attributeChange(t, i, e) {
49
- switch (t) {
50
- case "type":
51
- case "min":
52
- case "max":
53
- this._state[t] = e;
54
- break;
55
- case "range":
56
- case "allow-empty":
57
- this._state[u(t)] = d(e, !1, t);
58
- break;
59
- case "delay":
60
- this._state.delay = d(e, 300);
61
- break;
62
- case "width":
63
- this._state.width = p(e);
64
- break;
65
- }
66
- }
67
- updateDOM(t) {
68
- t.has("width") && this._updateWidth();
69
- }
70
- _updateWidth() {
71
- this._state.width ? this.style.setProperty("--l-date-picker-width", this._state.width) : this.style.removeProperty("--l-date-picker-width");
72
- }
73
- render() {
74
- const t = document.createDocumentFragment();
75
- if (t.appendChild(this.#r(0)), this._state.range) {
76
- const i = l("span", {
77
- class: "l-date-range-divider",
78
- textContent: "-"
79
- });
80
- t.appendChild(i), t.appendChild(this.#r(1));
81
- }
82
- return t;
83
- }
84
- #r(t = 0) {
85
- return l("input", {
86
- type: this._state.type,
87
- class: `l-date-inner l-date-inner${t}`,
88
- name: this.getName(),
89
- value: this.#e[t],
90
- "l-datepicker": `${t}`,
91
- disabled: this.isDisabled() ? !0 : void 0,
92
- min: this._state.min,
93
- max: this._state.max
94
- });
95
- }
96
- #h = (t) => {
97
- const i = t.target, e = Number(i.getAttribute("l-datepicker"));
98
- let s = i.value;
99
- !s && !this._state.allowEmpty && (s = this._resetValue || "", s = s.split(",")[e], i.value = s), this.#e[e] = s, this.#e.join(",") !== this._value && (this.setValue(this.#e.join(",")), this.#s = !0), e === 0 && this.#t.length > 1 ? this.#t[1].min = s : e === 1 && (this.#t[0].max = s), this._state.range ? this.#l() : this.#o();
100
- };
101
- #a() {
102
- this.#i !== -1 && (clearTimeout(this.#i), this.#i = -1);
103
- }
104
- #l() {
105
- this.#s && (this.#a(), this.#i = setTimeout(() => {
106
- this.#o(), this.#s = !1;
107
- }, this._state.delay));
108
- }
109
- #d = () => {
110
- this.#a();
111
- };
112
- #n = () => {
113
- this.#l();
114
- };
115
- #o() {
116
- this.dispatchEvent(
117
- new CustomEvent("change", {
118
- detail: {
119
- value: this.getValue(),
120
- dateStr: this.#e,
121
- dates: this.#e.map((t) => c(t))
122
- }
123
- })
124
- );
125
- }
126
- }
127
- export {
128
- w as default
129
- };
1
+ import { t as e } from "../date_picker_ori-aRuSSi9D.js";
2
+ export { e as default };
@@ -0,0 +1,122 @@
1
+ import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "./utils/index.js";
2
+ import { t as r } from "./form_inner-DR9tyB_r.js";
3
+ import { $ as i, $$ as a, iterate as o, off as s, on as c } from "ph-utils/dom";
4
+ import { parse as l } from "ph-utils/date";
5
+ //#region src/components/date_picker_ori/index.less?inline
6
+ var u = ":host{width:var(--l-date-picker-width,auto);align-items:center;display:inline-flex}.l-date-inner{height:var(--l-form-control-height,32px);border:1px solid var(--l-border-color,#dedede);cursor:text;border-radius:3px;outline:none;flex-grow:1;padding:0 5px;transition:border-color .3s}.l-date-inner:hover{border-color:var(--l-primary-color-light1,#9254de)}.l-date-inner:focus{border-color:var(--l-primary-color,#722ed1)}.l-date-range-divider{margin:0 10px}", d = class extends r {
7
+ static baseName = "date-picker-ori";
8
+ #e;
9
+ #t;
10
+ #n;
11
+ #r;
12
+ _state;
13
+ constructor() {
14
+ super(), this._state = {
15
+ range: !1,
16
+ delay: 300,
17
+ type: "date",
18
+ allowEmpty: !0
19
+ }, this.#t = [], this.#r = !1;
20
+ }
21
+ setValue(e) {
22
+ super.setValue(e), this.#t = e.split(","), this.rendered && o(this.#e, (e, t) => {
23
+ e.value = this.#t[t];
24
+ });
25
+ }
26
+ static get observedAttributes() {
27
+ return [
28
+ ...r.observedAttributes,
29
+ "range",
30
+ "delay",
31
+ "type",
32
+ "width",
33
+ "min",
34
+ "max",
35
+ "allow-empty"
36
+ ];
37
+ }
38
+ connectedCallback() {
39
+ this.loadStyleText(u), this._updateWidth(), super.connectedCallback();
40
+ }
41
+ afterInit() {
42
+ this.#e = i(".l-date-inner", this.root), c(this.#e, "change", this.#a), this._state.range && (c(this.#e, "focus", this.#c), c(this.#e, "blur", this.#l));
43
+ }
44
+ beforeDestroy() {
45
+ s(this.#e, "change", this.#a), this._state.range && (s(this.#e, "focus", this.#c), s(this.#e, "blur", this.#l)), this.#o();
46
+ }
47
+ attributeChange(r, i, a) {
48
+ switch (r) {
49
+ case "type":
50
+ case "min":
51
+ case "max":
52
+ this._state[r] = a;
53
+ break;
54
+ case "range":
55
+ case "allow-empty":
56
+ this._state[e(r)] = t(a, !1, r);
57
+ break;
58
+ case "delay":
59
+ this._state.delay = t(a, 300);
60
+ break;
61
+ case "width":
62
+ this._state.width = n(a);
63
+ break;
64
+ }
65
+ }
66
+ updateDOM(e) {
67
+ e.has("width") && this._updateWidth();
68
+ }
69
+ _updateWidth() {
70
+ this._state.width ? this.style.setProperty("--l-date-picker-width", this._state.width) : this.style.removeProperty("--l-date-picker-width");
71
+ }
72
+ render() {
73
+ let e = document.createDocumentFragment();
74
+ if (e.appendChild(this.#i(0)), this._state.range) {
75
+ let t = a("span", {
76
+ class: "l-date-range-divider",
77
+ textContent: "-"
78
+ });
79
+ e.appendChild(t), e.appendChild(this.#i(1));
80
+ }
81
+ return e;
82
+ }
83
+ #i(e = 0) {
84
+ return a("input", {
85
+ type: this._state.type,
86
+ class: `l-date-inner l-date-inner${e}`,
87
+ name: this.getName(),
88
+ value: this.#t[e],
89
+ "l-datepicker": `${e}`,
90
+ disabled: this.isDisabled() ? !0 : void 0,
91
+ min: this._state.min,
92
+ max: this._state.max
93
+ });
94
+ }
95
+ #a = (e) => {
96
+ let t = e.target, n = Number(t.getAttribute("l-datepicker")), r = t.value;
97
+ !r && !this._state.allowEmpty && (r = this._resetValue || "", r = r.split(",")[n], t.value = r), this.#t[n] = r, this.#t.join(",") !== this._value && (this.setValue(this.#t.join(",")), this.#r = !0), n === 0 && this.#e.length > 1 ? this.#e[1].min = r : n === 1 && (this.#e[0].max = r), this._state.range ? this.#s() : this.#u();
98
+ };
99
+ #o() {
100
+ this.#n !== -1 && (clearTimeout(this.#n), this.#n = -1);
101
+ }
102
+ #s() {
103
+ this.#r && (this.#o(), this.#n = setTimeout(() => {
104
+ this.#u(), this.#r = !1;
105
+ }, this._state.delay));
106
+ }
107
+ #c = () => {
108
+ this.#o();
109
+ };
110
+ #l = () => {
111
+ this.#s();
112
+ };
113
+ #u() {
114
+ this.dispatchEvent(new CustomEvent("change", { detail: {
115
+ value: this.getValue(),
116
+ dateStr: this.#t,
117
+ dates: this.#t.map((e) => l(e))
118
+ } }));
119
+ }
120
+ };
121
+ //#endregion
122
+ export { d as t };
@@ -1,66 +1,2 @@
1
- import i from "../base.js";
2
- import { kebabToCamel as r, parseAttrValue as c } from "../utils/index.js";
3
- import { $one as n, on as p, shouldEventNext as d, hasClass as h, removeClass as g, addClass as f } from "ph-utils/dom";
4
- const b = ":host{--l-desc-panel-min-height: 100px;--l-desc-panel-font-size: 14px;--l-desc-panel-textindent: calc(var(--l-desc-panel-font-size) * 2);display:block;max-height:var(--l-desc-panel-max-height, max-content);color:#1f2937;font-size:var(--l-desc-panel-font-size);position:relative;transition:all .15s linear;text-indent:var(--l-desc-panel-textindent);box-sizing:border-box}.content{box-sizing:border-box;border:1px solid transparent}.l-desc-panel-operator{width:100%;padding-top:0;padding-bottom:0;background:transparent;z-index:2;display:flex;justify-content:center;box-sizing:border-box}.l-desc-panel-btnmore{font-size:var(--nt-desc-panel-font-size)}.l-desc-panel-btnmore:before{content:attr(data-text)}.l-desc-panel-arrow{transition:transform .3s ease-in-out;transform:rotate3d(0,0,1,180deg)}:host(.collapse){max-height:var(--l-desc-panel-min-height);overflow-y:hidden}:host(.collapse) .l-desc-panel-operator{position:absolute;left:0;bottom:0;padding-top:65px;background:linear-gradient(-180deg,#fff0,#fff 80%)}:host(.collapse) .l-desc-panel-arrow{transform:rotateX(0)}";
5
- class y extends i {
6
- static baseName = "description-panel";
7
- /** 内容折叠后的高度, 默认: 100px */
8
- collapseHeight = 100;
9
- static get observedAttributes() {
10
- return ["collapse-height"];
11
- }
12
- attributeChangedCallback(e, t, a) {
13
- e = r(e);
14
- const o = c(a, this[e]);
15
- o !== this[e] && (this[e] = o, e === "collapseHeight" && (this.collapseHeight !== 100 ? this.style.setProperty(
16
- "--l-desc-panel-min-height",
17
- `${this.collapseHeight}px`
18
- ) : this.style.removeProperty("--l-desc-panel-min-height")));
19
- }
20
- connectedCallback() {
21
- this.loadStyleText(b), super.connectedCallback();
22
- }
23
- render() {
24
- return [
25
- '<div class="content"><slot></slot></div>',
26
- '<div class="l-desc-panel-operator">',
27
- '<l-button type="primary" data-action="collapse" class="l-desc-panel-btnmore" text>',
28
- "<span>查看更多</span>",
29
- '<l-arrow-down-icon class="l-desc-panel-arrow"></l-arrow-down-icon>',
30
- "</l-button></div>"
31
- ].join("");
32
- }
33
- afterInit() {
34
- this.classList.add("collapse");
35
- const e = n(".content", this.root);
36
- let t = n(".l-desc-panel-operator", this.root);
37
- if (e) {
38
- let a = e.getBoundingClientRect().height;
39
- a <= this.collapseHeight && t && (t.remove(), t = null);
40
- let o = 0;
41
- if (t) {
42
- const s = t.getBoundingClientRect().height, l = getComputedStyle(t).getPropertyValue("padding-top");
43
- o = s - parseInt(l);
44
- }
45
- this.style.setProperty(
46
- "--l-desc-panel-max-height",
47
- `${a + o}px`
48
- );
49
- }
50
- t && p(t, "click", this.#e);
51
- }
52
- #e = (e) => {
53
- const [t, a, o] = d(
54
- e,
55
- "data-action",
56
- e.currentTarget
57
- );
58
- if (t) {
59
- const s = n("span", o);
60
- h(this, "collapse") ? (g(this, "collapse"), s && (s.textContent = "收起")) : (f(this, "collapse"), s && (s.textContent = "查看更多"));
61
- }
62
- };
63
- }
64
- export {
65
- y as default
66
- };
1
+ import { t as e } from "../description_panel-Df_8rVbX.js";
2
+ export { e as default };
@@ -0,0 +1,57 @@
1
+ import e from "./base.js";
2
+ import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
3
+ import { $one as r, addClass as i, hasClass as a, on as o, removeClass as s, shouldEventNext as c } from "ph-utils/dom";
4
+ //#region src/components/description_panel/index.less?inline
5
+ var l = ":host{--l-desc-panel-min-height:100px;--l-desc-panel-font-size:14px;--l-desc-panel-textindent:calc(var(--l-desc-panel-font-size) * 2);max-height:var(--l-desc-panel-max-height,max-content);color:#1f2937;font-size:var(--l-desc-panel-font-size);text-indent:var(--l-desc-panel-textindent);box-sizing:border-box;transition:all .15s linear;display:block;position:relative}.content{box-sizing:border-box;border:1px solid #0000}.l-desc-panel-operator{z-index:2;box-sizing:border-box;background:0 0;justify-content:center;width:100%;padding-top:0;padding-bottom:0;display:flex}.l-desc-panel-btnmore{font-size:var(--nt-desc-panel-font-size)}.l-desc-panel-btnmore:before{content:attr(data-text)}.l-desc-panel-arrow{transition:transform .3s ease-in-out;transform:rotate(180deg)}:host(.collapse){max-height:var(--l-desc-panel-min-height);overflow-y:hidden}:host(.collapse) .l-desc-panel-operator{background:linear-gradient(-180deg,#fff0 0%,#fff 80%);padding-top:65px;position:absolute;bottom:0;left:0}:host(.collapse) .l-desc-panel-arrow{transform:rotateX(0)}", u = class extends e {
6
+ static baseName = "description-panel";
7
+ collapseHeight = 100;
8
+ static get observedAttributes() {
9
+ return ["collapse-height"];
10
+ }
11
+ attributeChangedCallback(e, r, i) {
12
+ e = t(e);
13
+ let a = n(i, this[e]);
14
+ if (a !== this[e]) switch (this[e] = a, e) {
15
+ case "collapseHeight":
16
+ this.collapseHeight === 100 ? this.style.removeProperty("--l-desc-panel-min-height") : this.style.setProperty("--l-desc-panel-min-height", `${this.collapseHeight}px`);
17
+ break;
18
+ }
19
+ }
20
+ connectedCallback() {
21
+ this.loadStyleText(l), super.connectedCallback();
22
+ }
23
+ render() {
24
+ return [
25
+ "<div class=\"content\"><slot></slot></div>",
26
+ "<div class=\"l-desc-panel-operator\">",
27
+ "<l-button type=\"primary\" data-action=\"collapse\" class=\"l-desc-panel-btnmore\" text>",
28
+ "<span>查看更多</span>",
29
+ "<l-arrow-down-icon class=\"l-desc-panel-arrow\"></l-arrow-down-icon>",
30
+ "</l-button></div>"
31
+ ].join("");
32
+ }
33
+ afterInit() {
34
+ this.classList.add("collapse");
35
+ let e = r(".content", this.root), t = r(".l-desc-panel-operator", this.root);
36
+ if (e) {
37
+ let n = e.getBoundingClientRect().height;
38
+ n <= this.collapseHeight && (t &&= (t.remove(), null));
39
+ let r = 0;
40
+ if (t) {
41
+ let e = t.getBoundingClientRect().height, n = getComputedStyle(t).getPropertyValue("padding-top");
42
+ r = e - parseInt(n);
43
+ }
44
+ this.style.setProperty("--l-desc-panel-max-height", `${n + r}px`);
45
+ }
46
+ t && o(t, "click", this.#e);
47
+ }
48
+ #e = (e) => {
49
+ let [t, n, o] = c(e, "data-action", e.currentTarget);
50
+ if (t) {
51
+ let e = r("span", o);
52
+ a(this, "collapse") ? (s(this, "collapse"), e && (e.textContent = "收起")) : (i(this, "collapse"), e && (e.textContent = "查看更多"));
53
+ }
54
+ };
55
+ };
56
+ //#endregion
57
+ export { u as t };
@@ -1,131 +1,2 @@
1
- import p from "../base.js";
2
- import { $ as c, iterate as d, on as r, off as h, shouldEventNext as g, $one as b, $$ as s, formatClass as f } from "ph-utils/dom";
3
- const C = ":host{display:block;position:relative}:host(.l-container-close-outside){padding-top:10px;padding-right:10px}.l-dialog-main{box-shadow:0 0 8px #0000001a;border-radius:5px;background-color:#fff}.l-dialog-header{padding:10px;font-size:16px;border-bottom:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-dialog-footer{padding:10px;border-top:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-dialog-container{padding:15px 10px;font-size:14px}.l-btn-dialog-close{--l-form-control-height: auto;position:absolute}.l-dialog-close1{right:5px;top:6px}.l-dialog-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-dialog-close2{right:0;top:0}.l-dialog-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}";
4
- class m extends p {
5
- static baseName = "dialog-container";
6
- constructor() {
7
- super(), this.version = 2, this._state = {
8
- showHeader: !0,
9
- showFooter: !0,
10
- showCancel: !0,
11
- cancelText: "取消",
12
- showOk: !0,
13
- okText: "确定",
14
- showClose: 1
15
- };
16
- }
17
- afterInit() {
18
- this._state.showClose === 2 && this.classList.add("l-container-close-outside");
19
- const t = c("[data-action]", this.root);
20
- d(t, (o) => {
21
- r(o, "click", this.#t);
22
- });
23
- }
24
- beforeDestroy() {
25
- const t = c("[data-action]", this.root);
26
- d(t, (o) => {
27
- h(o, "click", this.#t);
28
- });
29
- }
30
- #t(t) {
31
- const [o, e] = g(t, "data-action");
32
- o && this.dispatchEvent(
33
- new CustomEvent("dialogAction", {
34
- detail: { action: e },
35
- composed: !0
36
- })
37
- );
38
- }
39
- static get observedAttributes() {
40
- return [
41
- "show-header",
42
- "header",
43
- "show-footer",
44
- "show-cancel",
45
- "cancel-text",
46
- "show-ok",
47
- "ok-text",
48
- "show-close",
49
- "container-class"
50
- ];
51
- }
52
- attributeChanged(t, o, e) {
53
- switch (t) {
54
- case "show-header":
55
- this._state.showHeader = e !== null, this.connectedCallback();
56
- break;
57
- case "header":
58
- this._state.header = e || void 0, this.connectedCallback();
59
- break;
60
- case "show-footer":
61
- this._state.showFooter = e !== null, this.connectedCallback();
62
- break;
63
- case "show-cancel":
64
- this._state.showCancel = e !== null, this.connectedCallback();
65
- break;
66
- case "cancel-text":
67
- this._state.cancelText = e || "取消", this.connectedCallback();
68
- break;
69
- case "show-ok":
70
- this._state.showOk = e !== null, this.connectedCallback();
71
- break;
72
- case "ok-text":
73
- this._state.okText = e || "确定", this.connectedCallback();
74
- break;
75
- case "show-close":
76
- this._state.showClose = Number(e), this._state.showClose === 2 ? this.classList.add("l-container-close-outside") : this.classList.remove("l-container-close-outside");
77
- let a = b(".l-btn-dialog-close", this.root);
78
- this._state.showClose === 0 && a ? (h(a, "click", this.#t), a.remove()) : a ? a.className = this.#e() : (a = this.#o(), r(a, "click", this.#t), this.root.appendChild(a));
79
- break;
80
- case "container-class":
81
- this._state.containerClass = e || void 0, this.connectedCallback();
82
- break;
83
- }
84
- }
85
- #e() {
86
- return `l-btn-dialog-close l-dialog-close${this._state.showClose}`;
87
- }
88
- #o() {
89
- const t = s("l-button", {
90
- shape: "circle",
91
- type: "normal",
92
- class: this.#e(),
93
- "data-action": "close"
94
- }), o = s("l-close-icon");
95
- return t.appendChild(o), t;
96
- }
97
- render_v2() {
98
- return {
99
- style: C,
100
- template: this.render()
101
- };
102
- }
103
- render() {
104
- const t = document.createDocumentFragment();
105
- this._state.showClose !== 0 && t.appendChild(this.#o());
106
- const o = s("div", { class: "l-dialog-main" });
107
- if (this._state.showHeader) {
108
- const l = s("header", { class: "l-dialog-header" }), i = s("slot", { name: "header" });
109
- i.textContent = this._state.header || "", l.appendChild(i), o.appendChild(l);
110
- }
111
- const e = s("div", {
112
- class: f(["l-dialog-container", this._state.containerClass])
113
- }), a = s("slot");
114
- if (e.appendChild(a), o.appendChild(e), this._state.showFooter) {
115
- const l = s("div", { class: "l-dialog-footer" }), i = s("slot", { name: "footer" });
116
- if (this._state.showCancel) {
117
- const n = s("l-button", { "data-action": "cancel" });
118
- n.textContent = this._state.cancelText, i.appendChild(n);
119
- }
120
- if (this._state.showOk) {
121
- const n = s("l-button", { type: "primary", "data-action": "ok" });
122
- n.textContent = this._state.okText, i.appendChild(n);
123
- }
124
- l.appendChild(i), o.appendChild(l);
125
- }
126
- return t.appendChild(o), t;
127
- }
128
- }
129
- export {
130
- m as default
131
- };
1
+ import { t as e } from "../dialog_container-DcN87wj0.js";
2
+ export { e as default };