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,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-BY2yljeC.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 };
@@ -1,86 +1,68 @@
1
- import { $one as C, hasClass as v, addClass as s, getAttr as a, on as c, off as f, removeClass as $ } from "ph-utils/dom";
2
- const D = (g) => {
3
- let t, l, i;
4
- function w(e) {
5
- e.code === "Escape" && (e.preventDefault(), n());
6
- }
7
- function h(e) {
8
- t.isSameNode(e.target) && i && i.maskClosable && n();
9
- }
10
- function p(e) {
11
- const o = e.detail.action;
12
- i.onAction != null && i.onAction(o, n);
13
- }
14
- function u(e) {
15
- if (!i) {
16
- let o = {
17
- escClose: !0,
18
- verticalAlign: "top",
19
- maskClosable: !0,
20
- showClose: 1,
21
- ...e
22
- };
23
- if (t = C(e.el), t) {
24
- v(t, "l-dialog") || s(t, "l-dialog"), l = C("l-dialog-container", t);
25
- const r = a(t, "vertical-align");
26
- o.verticalAlign = r || "top", s(t, `l-dialog--vertical-${o.verticalAlign}`);
27
- const m = a(t, "translate") || o.translate;
28
- m && t.style.setProperty(
29
- "--l-dialog-translate",
30
- `translate3d(${m})`
31
- );
32
- const A = a(t, "width") || o.width;
33
- A && t.style.setProperty("--l-dialog-width", A);
34
- const d = a(t, "show-close", 1);
35
- d === 2 && s(t, "l-dialog-close-outside"), l && l.setAttribute("show-close", `${d}`), o.showClose = d, c(t, "keydown", w), c(t, "click", h), l && c(l, "dialogAction", p);
36
- }
37
- i = o;
38
- }
39
- }
40
- function b() {
41
- t && (t.showModal(), s(t, "l-dialog--open"), s(document.body, "l-body--dialog-open"));
42
- }
43
- function n() {
44
- t && v(t, "l-dialog--open") && (c(
45
- t,
46
- "transitionend",
47
- () => {
48
- t.close(), $(document.body, "l-body--dialog-open");
49
- },
50
- { once: !0 }
51
- ), $(t, "l-dialog--open"));
52
- }
53
- function P() {
54
- t && (n(), f(t, "keydown", w), f(t, "click", h), l && f(l, "dialogAction", p), l = void 0, t = void 0);
55
- }
56
- function y(e, o) {
57
- if (i && (i[e] = o, t))
58
- if (e === "verticalAlign") {
59
- const r = t.className.replace(
60
- /l-dialog--vertical-\w+/g,
61
- function() {
62
- return `l-dialog--vertical-${o || "top"}`;
63
- }
64
- );
65
- t.className = r;
66
- } else e === "translate" ? o ? t.style.setProperty(
67
- "--l-dialog-translate",
68
- `translate3d(${o})`
69
- ) : t.style.removeProperty("--l-dialog-translate") : e === "width" ? o ? t.style.setProperty("--l-dialog-width", o) : t.style.removeProperty("--l-dialog-width") : e === "showClose" && l && l.setAttribute("show-close", `${o}`);
70
- }
71
- function k(e) {
72
- for (const o in e)
73
- y(o, e[o]);
74
- }
75
- return g != null && u(g), {
76
- init: u,
77
- open: b,
78
- close: n,
79
- destroy: P,
80
- setProp: y,
81
- setProps: k
82
- };
83
- };
84
- export {
85
- D as default
1
+ import { $one as e, addClass as t, getAttr as n, hasClass as r, off as i, on as a, removeClass as o } from "ph-utils/dom";
2
+ //#region src/components/dialog/index.ts
3
+ var s = (s) => {
4
+ let c, l, u;
5
+ function d(e) {
6
+ e.code === "Escape" && (e.preventDefault(), g());
7
+ }
8
+ function f(e) {
9
+ c.isSameNode(e.target) && u && u.maskClosable && g();
10
+ }
11
+ function p(e) {
12
+ let t = e.detail.action;
13
+ u.onAction != null && u.onAction(t, g);
14
+ }
15
+ function m(i) {
16
+ if (!u) {
17
+ let o = {
18
+ escClose: !0,
19
+ verticalAlign: "top",
20
+ maskClosable: !0,
21
+ showClose: 1,
22
+ ...i
23
+ };
24
+ if (c = e(i.el), c) {
25
+ r(c, "l-dialog") || t(c, "l-dialog"), l = e("l-dialog-container", c), o.verticalAlign = n(c, "vertical-align") || "top", t(c, `l-dialog--vertical-${o.verticalAlign}`);
26
+ let i = n(c, "translate") || o.translate;
27
+ i && c.style.setProperty("--l-dialog-translate", `translate3d(${i})`);
28
+ let s = n(c, "width") || o.width;
29
+ s && c.style.setProperty("--l-dialog-width", s);
30
+ let u = n(c, "show-close", 1);
31
+ u === 2 && t(c, "l-dialog-close-outside"), l && l.setAttribute("show-close", `${u}`), o.showClose = u, a(c, "keydown", d), a(c, "click", f), l && a(l, "dialogAction", p);
32
+ }
33
+ u = o;
34
+ }
35
+ }
36
+ function h() {
37
+ c && (c.showModal(), t(c, "l-dialog--open"), t(document.body, "l-body--dialog-open"));
38
+ }
39
+ function g() {
40
+ c && r(c, "l-dialog--open") && (a(c, "transitionend", () => {
41
+ c.close(), o(document.body, "l-body--dialog-open");
42
+ }, { once: !0 }), o(c, "l-dialog--open"));
43
+ }
44
+ function _() {
45
+ c &&= (g(), i(c, "keydown", d), i(c, "click", f), l && i(l, "dialogAction", p), l = void 0, void 0);
46
+ }
47
+ function v(e, t) {
48
+ if (u && (u[e] = t, c)) if (e === "verticalAlign") {
49
+ let e = c.className.replace(/l-dialog--vertical-\w+/g, function() {
50
+ return `l-dialog--vertical-${t || "top"}`;
51
+ });
52
+ c.className = e;
53
+ } else e === "translate" ? t ? c.style.setProperty("--l-dialog-translate", `translate3d(${t})`) : c.style.removeProperty("--l-dialog-translate") : e === "width" ? t ? c.style.setProperty("--l-dialog-width", t) : c.style.removeProperty("--l-dialog-width") : e === "showClose" && l && l.setAttribute("show-close", `${t}`);
54
+ }
55
+ function y(e) {
56
+ for (let t in e) v(t, e[t]);
57
+ }
58
+ return s != null && m(s), {
59
+ init: m,
60
+ open: h,
61
+ close: g,
62
+ destroy: _,
63
+ setProp: v,
64
+ setProps: y
65
+ };
86
66
  };
67
+ //#endregion
68
+ export { s as default };