litos-ui 0.18.0 → 0.18.2

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 (61) hide show
  1. package/README.md +49 -49
  2. package/lib/base.js +1 -1
  3. package/lib/button/index.d.ts +2 -1
  4. package/lib/button/index.js +1 -1
  5. package/lib/{button-CC5PmAb1.js → button-CBoYJ9Tt.js} +12 -6
  6. package/lib/calendar/index.js +1 -1
  7. package/lib/carousel/index.js +1 -1
  8. package/lib/carousel/item.js +1 -1
  9. package/lib/collapse/index.js +1 -1
  10. package/lib/collapse/item.js +1 -1
  11. package/lib/color_picker/index.js +1 -1
  12. package/lib/{color_picker-D0brKFm-.js → color_picker-DYN8DCng.js} +1 -1
  13. package/lib/description_panel/index.js +1 -1
  14. package/lib/image/image_preview.js +1 -1
  15. package/lib/image/index.js +1 -1
  16. package/lib/{image_preview-PzZzwo6m.js → image_preview-CYEup07F.js} +1 -1
  17. package/lib/index.d.ts +0 -82
  18. package/lib/index.js +21 -23
  19. package/lib/input/index.js +2 -2
  20. package/lib/input-UfukfZIy.js +4 -0
  21. package/lib/{item-DV842Aux.js → item-CvoJt3wp.js} +4 -1
  22. package/lib/mask/index.js +1 -1
  23. package/lib/menu/index.d.ts +30 -13
  24. package/lib/menu/index.js +1 -1
  25. package/lib/menu/types.d.ts +6 -0
  26. package/lib/menu/types.js +0 -0
  27. package/lib/menu-CzV6lOlw.js +224 -0
  28. package/lib/modal/modal_box.js +1 -1
  29. package/lib/page_header/index.js +1 -1
  30. package/lib/pagination/index.js +1 -1
  31. package/lib/qrcode/index.js +1 -1
  32. package/lib/select_ori/index.js +1 -1
  33. package/lib/space/index.js +1 -1
  34. package/lib/tabbar/index.js +1 -1
  35. package/lib/tabbar/item.js +1 -1
  36. package/lib/{tabbar-4_d2Fj1n.js → tabbar-CI1xSj1G.js} +8 -3
  37. package/lib/table/index.js +1 -1
  38. package/lib/tag/index.js +1 -1
  39. package/package.json +9 -9
  40. package/lib/input-DjKxcxry.js +0 -4
  41. package/lib/menu/menu_item.d.ts +0 -6
  42. package/lib/menu/menu_item.js +0 -2
  43. package/lib/menu/sub_menu.d.ts +0 -15
  44. package/lib/menu/sub_menu.js +0 -2
  45. package/lib/menu-DAtplYAH.js +0 -91
  46. package/lib/menu_item-BW1Tu11Q.js +0 -20
  47. package/lib/sub_menu-D1s8ABNu.js +0 -75
  48. /package/lib/{calendar-DeP6yZB0.js → calendar-GpYHNmXG.js} +0 -0
  49. /package/lib/{carousel-D4Fe3LEx.js → carousel-dT3FJPQo.js} +0 -0
  50. /package/lib/{collapse-CeKRZ-43.js → collapse-C3IRHLeg.js} +0 -0
  51. /package/lib/{description_panel-Df_8rVbX.js → description_panel-BY2yljeC.js} +0 -0
  52. /package/lib/{image-CeQVfS-v.js → image-COPKk8Jm.js} +0 -0
  53. /package/lib/{item-Cuw_ZPyn.js → item-B7Elh5xE.js} +0 -0
  54. /package/lib/{item-ZXLWFzSm.js → item-DRsOV_Tc.js} +0 -0
  55. /package/lib/{mask-BlV5QfTj.js → mask-CEznzwji.js} +0 -0
  56. /package/lib/{page_header-DdeRDN4U.js → page_header-BJkEstRw.js} +0 -0
  57. /package/lib/{pagination-BoPzSPjT.js → pagination-5t7AOeFV.js} +0 -0
  58. /package/lib/{qrcode-BFxsD_OP.js → qrcode-BKG2MibP.js} +0 -0
  59. /package/lib/{space-CpTmBfHP.js → space-Bv-p0DL8.js} +0 -0
  60. /package/lib/{table-Hifj8jAX.js → table-DfL2hFqA.js} +0 -0
  61. /package/lib/{tag-DPENZf_V.js → tag-72DwCkvq.js} +0 -0
package/README.md CHANGED
@@ -1,49 +1,49 @@
1
- # litos-ui
2
-
3
- 源自于希腊语中,表示“简洁、朴素”的形容词 "λιτός" (`litós`);所有组件均以 `l-` 为前缀,如 `l-button`、`l-input` 等。
4
-
5
- 采用原生 `Web Components` 作为技术栈,不依赖任何第三方库,可运行在现代浏览器上。跨平台、跨框架,可运行在 `React`、`Vue`、`Angular` 等框架中。
6
-
7
- ## 安装
8
-
9
- ```bash
10
- npm install litos-ui
11
- ```
12
-
13
- 如果需要自动使用一些服务组件,例如: `Message`、`ModalBox` 等且需要自动引入样式时,需要安装 `litosui-unplugin-resolver`、`unplugin-auto-import` 插件。
14
-
15
- ```js
16
- // vite.config.js
17
- import AutoImport from "unplugin-auto-import/vite";
18
- import LitosuiResolver from "litosui-unplugin-resolver";
19
-
20
- // https://vitejs.dev/config/
21
- export default defineConfig({
22
- plugins: [
23
- ...,
24
- AutoImport({
25
- resolvers: [LitosuiResolver()],
26
- dts: "src/auto-imports.d.ts",
27
- }),
28
- ],
29
- ...
30
- });
31
- ```
32
-
33
- ## 使用
34
-
35
- 引入相关组件并注册
36
-
37
- ```js
38
- import { Button, regist } from "litos-ui";
39
-
40
- regist([Button]); // <l-button></l-button>
41
- ```
42
-
43
- ## 文档
44
-
45
- [litos-ui 文档](https://dvshu.github.io/litos-ui/)
46
-
47
- ## 许可证
48
-
49
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
1
+ # litos-ui
2
+
3
+ 源自于希腊语中,表示“简洁、朴素”的形容词 "λιτός" (`litós`);所有组件均以 `l-` 为前缀,如 `l-button`、`l-input` 等。
4
+
5
+ 采用原生 `Web Components` 作为技术栈,不依赖任何第三方库,可运行在现代浏览器上。跨平台、跨框架,可运行在 `React`、`Vue`、`Angular` 等框架中。
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ npm install litos-ui
11
+ ```
12
+
13
+ 如果需要自动使用一些服务组件,例如: `Message`、`ModalBox` 等且需要自动引入样式时,需要安装 `litosui-unplugin-resolver`、`unplugin-auto-import` 插件。
14
+
15
+ ```js
16
+ // vite.config.js
17
+ import AutoImport from "unplugin-auto-import/vite";
18
+ import LitosuiResolver from "litosui-unplugin-resolver";
19
+
20
+ // https://vitejs.dev/config/
21
+ export default defineConfig({
22
+ plugins: [
23
+ ...,
24
+ AutoImport({
25
+ resolvers: [LitosuiResolver()],
26
+ dts: "src/auto-imports.d.ts",
27
+ }),
28
+ ],
29
+ ...
30
+ });
31
+ ```
32
+
33
+ ## 使用
34
+
35
+ 引入相关组件并注册
36
+
37
+ ```js
38
+ import { Button, regist } from "litos-ui";
39
+
40
+ regist([Button]); // <l-button></l-button>
41
+ ```
42
+
43
+ ## 文档
44
+
45
+ [litos-ui 文档](https://dvshu.github.io/litos-ui/)
46
+
47
+ ## 许可证
48
+
49
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
package/lib/base.js CHANGED
@@ -77,7 +77,7 @@ var t = class extends HTMLElement {
77
77
  let e = this.render_v2();
78
78
  this.appendToRootV2(e.template, e.style);
79
79
  }
80
- this.rendered = !0, this.initEvents(), this.afterInit();
80
+ this.rendered = !0, this.initEvents(), this.afterInit(), this._changedProperties.size > 0 && this.updateDOM(this._changedProperties);
81
81
  }
82
82
  disconnectedCallback() {
83
83
  this.cancelPending(), this.removeEvents(), this.beforeDestroy(), this.root.innerHTML = "", this.rendered = !1;
@@ -7,10 +7,11 @@ type ButtonState = {
7
7
  color?: string;
8
8
  height?: string;
9
9
  disabled: boolean;
10
- type: "normal" | "primary";
10
+ type: "normal" | "primary" | "normal-v2";
11
11
  shape: "default" | "round" | "circle";
12
12
  loadingText: string;
13
13
  size: "small" | "large" | "default";
14
+ boxShadow: "box-shadow-none" | "box-shadow";
14
15
  };
15
16
  export default class Button extends BaseComponent<ButtonState> {
16
17
  static baseName: string;
@@ -1,2 +1,2 @@
1
- import { t as e } from "../button-CC5PmAb1.js";
1
+ import { t as e } from "../button-CBoYJ9Tt.js";
2
2
  export { e as default };
@@ -4,7 +4,7 @@ import { t as i } from "./animation-CTt9qgA7.js";
4
4
  import { addClass as a, formatClass as o, formatStyle as s, off as c, on as l, removeClass as u, replaceClass as d } from "ph-utils/dom";
5
5
  import { adjust as f } from "ph-utils/color";
6
6
  //#region src/components/button/index.less?inline
7
- var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text-color:var(--l-btn-text-color);--l-btn-active-text-color:var(--l-btn-text-color);--l-btn-border-color:var(--l-primary-color,#722ed1);--l-btn-background:var(--l-btn-border-color);--l-btn-hover-border-color:var(--l-primary-color-light1,#9254de);--l-btn-hover-background:var(--l-btn-hover-border-color);--l-btn-active-border-color:var(--l-primary-color-dark1,#531dab);--l-btn-active-background:var(--l-btn-active-border-color);--l-btn-disabled-color:#c9c9c9;--l-btn-disabled-background:#fbfbfb;--l-btn-disabled-border-color:#e6e6e6;--l-btn-height:var(--l-form-control-height,32px);width:auto;height:var(--l-btn-height);text-indent:0;box-sizing:border-box;border-radius:var(--l-border-radius,3px);display:inline-flex}:host([block]){width:100%}:host(.l-btn-small){--l-btn-height:24px;--l-btn-padding:0 7px}:host(.l-btn-large){--l-border-radius:6px;--l-btn-height:40px;--l-btn-padding:0 15px;font-size:16px}.l-btn{cursor:pointer;box-sizing:border-box;vertical-align:middle;width:100%;padding:var(--l-btn-padding);border-radius:inherit;height:100%;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);justify-content:center;align-items:center;gap:var(--l-btn-gap,5px);line-height:1;font-size:inherit;outline:none;transition:border-color .3s,background-color .3s,color .3s;display:inline-flex;position:relative}.l-btn:hover{border-color:var(--l-btn-hover-border-color,var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn:active{border-color:var(--l-btn-active-border-color,var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal{--l-btn-text-color:auto;--l-btn-background:transparent;--l-btn-border-color:#d9d9d9;--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab);--l-btn-hover-background:#fff;--l-btn-active-background:#fff;--l-btn-hover-border-color:var(--l-btn-hover-text-color);--l-btn-active-border-color:var(--l-btn-active-text-color)}.l-btn-primary{--l-btn-background:var(--l-primary-color,#722ed1);--l-btn-hover-background:var(--l-primary-color-light1,#9254de);--l-btn-active-background:var(--l-primary-color-dark1,#531dab);--l-btn-disabled-border-color:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-background:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-color:#fff}.l-btn:disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn.l-btn-loading{cursor:default}.l-btn-text{--l-btn-background:transparent;--l-btn-border-color:transparent;--l-btn-hover-border-color:transparent;--l-btn-active-border-color:transparent;--l-btn-disabled-background:transparent;--l-btn-disabled-border-color:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-padding:5px}.l-btn-primary.l-btn-text{--l-btn-text-color:var(--l-primary-color,#722ed1);--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab)}.l-btn-ghost{--l-btn-text-color:var(--l-btn-border-color);--l-btn-background:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-hover-text-color:var(--l-btn-hover-border-color);--l-btn-active-text-color:var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-control-height,32px) / 2)}.l-btn-circle{width:var(--l-form-control-height,32px);border-radius:50%;padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background:#ffffff14;--l-btn-disabled-color:#ffffff4d;--l-btn-disabled-border-color:#ffffff4d}", m = class extends e {
7
+ var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text-color:var(--l-btn-text-color);--l-btn-active-text-color:var(--l-btn-text-color);--l-btn-border-color:var(--l-primary-color,#722ed1);--l-btn-background:var(--l-btn-border-color);--l-btn-hover-border-color:var(--l-primary-color-light1,#9254de);--l-btn-hover-background:var(--l-btn-hover-border-color);--l-btn-active-border-color:var(--l-primary-color-dark1,#531dab);--l-btn-active-background:var(--l-btn-active-border-color);--l-btn-disabled-color:#c9c9c9;--l-btn-disabled-background:#fbfbfb;--l-btn-disabled-border-color:#e6e6e6;--l-btn-height:var(--l-form-control-height,32px);width:auto;height:var(--l-btn-height);text-indent:0;box-sizing:border-box;border-radius:var(--l-border-radius,3px);display:inline-flex}:host([block]){width:100%}:host(.l-btn-small){--l-btn-height:24px;--l-btn-padding:0 7px}:host(.l-btn-large){--l-border-radius:6px;--l-btn-height:40px;--l-btn-padding:0 15px;font-size:16px}.l-btn{cursor:pointer;box-sizing:border-box;vertical-align:middle;width:100%;padding:var(--l-btn-padding);border-radius:inherit;height:100%;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);justify-content:center;align-items:center;gap:var(--l-btn-gap,5px);line-height:1;font-size:inherit;outline:none;transition:border-color .3s,background-color .3s,color .3s;display:inline-flex;position:relative}.l-btn:hover{border-color:var(--l-btn-hover-border-color,var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn-box-shadow:hover{box-shadow:0 4px 12px var(--l-primary-color-light4)}.l-btn:active{border-color:var(--l-btn-active-border-color,var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal,.l-btn-normal-v2{--l-btn-text-color:auto;--l-btn-background:transparent;--l-btn-border-color:#d9d9d9;--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab);--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-hover-border-color:var(--l-btn-hover-text-color);--l-btn-active-border-color:var(--l-btn-active-text-color)}.l-btn-normal-v2{--l-btn-hover-background:var(--l-primary-color-light5);--l-btn-active-background:var(--l-primary-color-light4)}.l-btn-primary{--l-btn-background:var(--l-primary-color,#722ed1);--l-btn-hover-background:var(--l-primary-color-light1,#9254de);--l-btn-active-background:var(--l-primary-color-dark1,#531dab);--l-btn-disabled-border-color:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-background:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-color:#fff}.l-btn:disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn.l-btn-loading{cursor:default}.l-btn-text{--l-btn-background:transparent;--l-btn-border-color:transparent;--l-btn-hover-border-color:transparent;--l-btn-active-border-color:transparent;--l-btn-disabled-background:transparent;--l-btn-disabled-border-color:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-padding:5px}.l-btn-primary.l-btn-text{--l-btn-text-color:var(--l-primary-color,#722ed1);--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab)}.l-btn-ghost{--l-btn-text-color:var(--l-btn-border-color);--l-btn-background:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-hover-text-color:var(--l-btn-hover-border-color);--l-btn-active-text-color:var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-control-height,32px) / 2)}.l-btn-circle{width:var(--l-form-control-height,32px);border-radius:50%;padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background:#ffffff14;--l-btn-disabled-color:#ffffff4d;--l-btn-disabled-border-color:#ffffff4d}", m = class extends e {
8
8
  static baseName = "button";
9
9
  $btn;
10
10
  constructor() {
@@ -17,7 +17,8 @@ var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text
17
17
  type: "normal",
18
18
  shape: "default",
19
19
  loadingText: "加载中……",
20
- size: "default"
20
+ size: "default",
21
+ boxShadow: "box-shadow-none"
21
22
  };
22
23
  }
23
24
  get disabled() {
@@ -44,7 +45,8 @@ var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text
44
45
  "type",
45
46
  "shape",
46
47
  "loading-text",
47
- "size"
48
+ "size",
49
+ "box-shadow"
48
50
  ];
49
51
  }
50
52
  attributeChanged(e, i, a) {
@@ -68,10 +70,14 @@ var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text
68
70
  case "loading-text":
69
71
  this._state[t(e)] = a;
70
72
  break;
73
+ case "box-shadow":
74
+ let i = n(a, !1, "box-shadow");
75
+ console.log(i), this._state.boxShadow = `box-shadow${i ? "" : "-none"}`;
76
+ break;
71
77
  }
72
78
  }
73
79
  updateDOM(e) {
74
- this.$btn && (e.has("loading") && this.setLoading(this._state.loading), e.has("disabled") && this.setDisabled(this.disabled), e.has("color") && this._state.color && (this.$btn.style.cssText = this.applyColor(this._state.color, this._state.text, this._state.ghost)), e.has("type") && d(this.$btn, 1, `l-btn-${this._state.type || "normal"}`), e.has("size") && d(this.$btn, 2, `l-btn-${this._state.size || "default"}`), e.has("shape") && d(this.$btn, 3, `l-btn-${this._state.shape || "default"}`)), e.has("height") && this._updateHeight();
80
+ this.$btn && (e.has("loading") && this.setLoading(this._state.loading), e.has("disabled") && this.setDisabled(this.disabled), e.has("color") && this._state.color && (this.$btn.style.cssText = this.applyColor(this._state.color, this._state.text, this._state.ghost)), e.has("type") && d(this.$btn, 1, `l-btn-${this._state.type || "normal"}`), e.has("shape") && d(this.$btn, 2, `l-btn-${this._state.shape || "default"}`), e.has("box-shadow") && d(this.$btn, 3, `l-btn-${this._state.boxShadow}`)), e.has("height") && this._updateHeight();
75
81
  }
76
82
  connectedCallback() {
77
83
  this.className = `l-btn-${this._state.size || "default"} ${this.className}`, super.connectedCallback(), this.isFormButton() && l(this, "click", this._handleClick), this._updateHeight();
@@ -87,7 +93,7 @@ var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text
87
93
  return this._state.htmlType;
88
94
  }
89
95
  render_v2() {
90
- return {
96
+ return this._changedProperties.clear(), {
91
97
  style: [i, p],
92
98
  template: this.render()
93
99
  };
@@ -97,8 +103,8 @@ var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text
97
103
  e.className = o([
98
104
  "l-btn",
99
105
  `l-btn-${this._state.type}`,
100
- `l-btn-${this._state.size}`,
101
106
  `l-btn-${this._state.shape}`,
107
+ `l-btn-${this._state.boxShadow}`,
102
108
  r ? "l-btn-ghost" : "",
103
109
  n ? "l-btn-text" : "",
104
110
  t ? "l-btn-loading" : ""
@@ -1,2 +1,2 @@
1
- import { t as e } from "../calendar-DeP6yZB0.js";
1
+ import { t as e } from "../calendar-GpYHNmXG.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../carousel-D4Fe3LEx.js";
1
+ import { t as e } from "../carousel-dT3FJPQo.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../item-Cuw_ZPyn.js";
1
+ import { t as e } from "../item-B7Elh5xE.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../collapse-CeKRZ-43.js";
1
+ import { t as e } from "../collapse-C3IRHLeg.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../item-ZXLWFzSm.js";
1
+ import { t as e } from "../item-DRsOV_Tc.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../color_picker-D0brKFm-.js";
1
+ import { t as e } from "../color_picker-DYN8DCng.js";
2
2
  export { e as default };
@@ -1,6 +1,6 @@
1
1
  import { initAttr as e, setAttrs as t } from "./utils/index.js";
2
2
  import { t as n } from "./form_inner-DR9tyB_r.js";
3
- import { t as r } from "./input-DjKxcxry.js";
3
+ import { t as r } from "./input-UfukfZIy.js";
4
4
  import { $one as i, off as a, on as o } from "ph-utils/dom";
5
5
  //#region src/components/color_picker/index.less?inline
6
6
  var s = ":host{--l-input-width:60px}", c = class extends n {
@@ -1,2 +1,2 @@
1
- import { t as e } from "../description_panel-Df_8rVbX.js";
1
+ import { t as e } from "../description_panel-BY2yljeC.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../image_preview-PzZzwo6m.js";
1
+ import { t as e } from "../image_preview-CYEup07F.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../image-CeQVfS-v.js";
1
+ import { t as e } from "../image-COPKk8Jm.js";
2
2
  export { e as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./mask-BlV5QfTj.js";
1
+ import { t as e } from "./mask-CEznzwji.js";
2
2
  import { $$ as t, $one as n, off as r, on as i } from "ph-utils/dom";
3
3
  //#region src/components/image/image_preview.less?inline
4
4
  var a = ".l-image-preview--container{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:relative}.l-image-preview__btn,.l-image-preview-operations{background-color:#606666;justify-content:center;align-items:center;display:flex}.l-image-preview__btn{z-index:1;opacity:.8;cursor:pointer;color:#fff;background-color:#606666;border:none;border-radius:50%;outline:none;justify-content:center;align-items:center;width:40px;height:40px;font-size:20px;transition:color .3s ease-in-out;display:flex;position:absolute}.l-image-preview__btn:hover{color:var(--l-primary-color,#4998f6)}.l-image-preview__close{top:30px;right:30px}.l-image-preview__prev,.l-image-preview__next{top:50%;transform:translateY(-50%)}.l-image-preview__prev{left:30px}.l-image-preview__next{right:30px}.l-image-preview-footer{z-index:1;flex-direction:column;align-items:center;display:flex;position:absolute;bottom:30px;left:50%;transform:translate(-50%)}.l-image-preview-progress{color:#fff;margin-bottom:10px}.l-image-preview-operations{cursor:default;border-radius:20px;padding:0 25px}.l-image-preview-operations .l-image-preview__btn{width:40px;position:static}.l-image-preview-img{vertical-align:middle;transform-origin:50%;user-select:none;z-index:0;max-width:calc(100vw - 40px);max-height:calc(100vh - 200px);transition:transform .25s}", o = class extends e {
package/lib/index.d.ts CHANGED
@@ -59,8 +59,6 @@ export { default as TabbarItem } from "./tabbar/item";
59
59
  export { default as Theme } from "./theme";
60
60
  export { default as ThemeColor } from "./theme/theme_color";
61
61
  export { default as Menu } from "./menu";
62
- export { default as MenuItem } from "./menu/menu_item";
63
- export { default as SubMenu } from "./menu/sub_menu";
64
62
  export { default as Carousel } from "./carousel";
65
63
  export { default as CarouselItem } from "./carousel/item";
66
64
  export { default as Qrcode } from "./qrcode";
@@ -78,83 +76,3 @@ export { default as Table } from "./table";
78
76
  export type { Column } from "./table/types";
79
77
  export { default as Space } from "./space";
80
78
  export { default as Calendar } from "./calendar";
81
-
82
- declare global {
83
- interface HTMLElementTagNameMap {
84
- "l-base-component": import("./base").default
85
- "l-dialog": import("./dialog").default
86
- "l-dialog-container": import("./dialog/dialog_container").default
87
- "l-loading": import("./loading").default
88
- "l-tabs": import("./tabs").default
89
- "l-modal": import("./modal").default
90
- "l-base-icon": import("./icon/base").default
91
- "l-arrow-down-icon": import("./icon/arrow_down").default
92
- "l-arrow-left-icon": import("./icon/arrow_left").default
93
- "l-arrow-right-icon": import("./icon/arrow_right").default
94
- "l-arrow-up-icon": import("./icon/arrow_up").default
95
- "l-caret-top-icon": import("./icon/caret_top").default
96
- "l-caret-bottom-icon": import("./icon/caret_bottom").default
97
- "l-font-icon": import("./icon/font_icon").default
98
- "l-loading-icon": import("./icon/loading").default
99
- "l-search-icon": import("./icon/search").default
100
- "l-sun-icon": import("./icon/sun").default
101
- "l-moon-icon": import("./icon/moon").default
102
- "l-reduction-icon": import("./icon/reduction").default
103
- "l-refresh-left-icon": import("./icon/refresh_left").default
104
- "l-refresh-right-icon": import("./icon/refresh_right").default
105
- "l-sort-icon": import("./icon/sort").default
106
- "l-theme-default-icon": import("./icon/theme_default").default
107
- "l-close-icon": import("./icon/close").default
108
- "l-info-icon": import("./icon/info").default
109
- "l-success-icon": import("./icon/success").default
110
- "l-warn-icon": import("./icon/warn").default
111
- "l-close-filled-icon": import("./icon/close_filled").default
112
- "l-more-icon": import("./icon/more").default
113
- "l-d-arrow-left-icon": import("./icon/d_arrow_left").default
114
- "l-d-arrow-right-icon": import("./icon/d_arrow_right").default
115
- "l-zoom-in-icon": import("./icon/zoom_in").default
116
- "l-zoom-out-icon": import("./icon/zoom_out").default
117
- "l-select-icon": import("./icon/select").default
118
- "l-calendar-icon": import("./icon/calendar").default
119
- "l-refresh-icon": import("./icon/refresh").default
120
- "l-form": import("./form").default
121
- "l-form-item": import("./form/form_item").default
122
- "l-radio-group": import("./check/radio_group").default
123
- "l-radio": import("./check/radio").default
124
- "l-checkbox": import("./check/checkbox").default
125
- "l-checkbox-group": import("./check/checkbox_group").default
126
- "l-button": import("./button").default
127
- "l-input": import("./input").default
128
- "l-select-ori": import("./select_ori").default
129
- "l-switch": import("./switch").default
130
- "l-md-input": import("./md_input").default
131
- "l-select": import("./select").default
132
- "l-date-picker": import("./date_picker").default
133
- "l-date-picker-ori": import("./date_picker_ori").default
134
- "l-color-picker": import("./color_picker").default
135
- "l-list": import("./list").default
136
- "l-polygon": import("./polygon").default
137
- "l-tabbar": import("./tabbar").default
138
- "l-tabbar-item": import("./tabbar/item").default
139
- "l-theme": import("./theme").default
140
- "l-theme-color": import("./theme/theme_color").default
141
- "l-menu": import("./menu").default
142
- "l-menu-item": import("./menu/menu_item").default
143
- "l-sub-menu": import("./menu/sub_menu").default
144
- "l-carousel": import("./carousel").default
145
- "l-carousel-item": import("./carousel/item").default
146
- "l-qrcode": import("./qrcode").default
147
- "l-description-panel": import("./description_panel").default
148
- "l-pagination": import("./pagination").default
149
- "l-mask": import("./mask").default
150
- "l-page-header": import("./page_header").default
151
- "l-tag": import("./tag").default
152
- "l-collapse": import("./collapse").default
153
- "l-collapse-item": import("./collapse/item").default
154
- "l-image": import("./image").default
155
- "l-image-preview": import("./image/image_preview").default
156
- "l-table": import("./table").default
157
- "l-space": import("./space").default
158
- "l-calendar": import("./calendar").default
159
- }
160
- }
package/lib/index.js CHANGED
@@ -43,7 +43,7 @@ import Z from "./check/radio_group.js";
43
43
  import { t as Q } from "./radio-2mNSYujz.js";
44
44
  import { t as $ } from "./checkbox-DbWsmAaL.js";
45
45
  import ee from "./check/checkbox_group.js";
46
- import { t as te } from "./button-CC5PmAb1.js";
46
+ import { t as te } from "./button-CBoYJ9Tt.js";
47
47
  import ne from "./input/index.js";
48
48
  import re from "./select_ori/index.js";
49
49
  import { t as ie } from "./switch-BaVBi5Ip.js";
@@ -52,29 +52,27 @@ import { t as oe } from "./select-CAgggYh7.js";
52
52
  import { Popover as se, autoUpdate as ce, createPopoverObserver as le, getOverflowAncestors as ue, popconfirmProps as de, updatePosition as fe } from "./utils/popover.js";
53
53
  import { t as pe } from "./date_picker-DQGoiN8v.js";
54
54
  import { t as me } from "./date_picker_ori-aRuSSi9D.js";
55
- import { t as he } from "./color_picker-D0brKFm-.js";
55
+ import { t as he } from "./color_picker-DYN8DCng.js";
56
56
  import { t as ge } from "./list-CU7vHS6s.js";
57
57
  import { t as _e } from "./polygon-C4Ow2lxi.js";
58
- import { t as ve } from "./tabbar-4_d2Fj1n.js";
59
- import { t as ye } from "./item-DV842Aux.js";
58
+ import { t as ve } from "./tabbar-CI1xSj1G.js";
59
+ import { t as ye } from "./item-CvoJt3wp.js";
60
60
  import { t as be } from "./theme-BRTI2-Yk.js";
61
61
  import xe from "./theme/theme_color.js";
62
- import { t as Se } from "./menu-DAtplYAH.js";
63
- import { t as Ce } from "./menu_item-BW1Tu11Q.js";
64
- import { t as we } from "./sub_menu-D1s8ABNu.js";
65
- import { t as Te } from "./carousel-D4Fe3LEx.js";
66
- import { t as Ee } from "./item-Cuw_ZPyn.js";
67
- import { t as De } from "./qrcode-BFxsD_OP.js";
68
- import { t as Oe } from "./description_panel-Df_8rVbX.js";
69
- import { t as ke } from "./pagination-BoPzSPjT.js";
70
- import { t as Ae } from "./mask-BlV5QfTj.js";
71
- import { t as je } from "./page_header-DdeRDN4U.js";
72
- import { t as Me } from "./tag-DPENZf_V.js";
73
- import { t as Ne } from "./collapse-CeKRZ-43.js";
74
- import { t as Pe } from "./item-ZXLWFzSm.js";
75
- import { t as Fe } from "./image-CeQVfS-v.js";
76
- import { t as Ie } from "./image_preview-PzZzwo6m.js";
77
- import { t as Le } from "./table-Hifj8jAX.js";
78
- import { t as Re } from "./space-CpTmBfHP.js";
79
- import { t as ze } from "./calendar-DeP6yZB0.js";
80
- export { w as ArrowDownIcon, T as ArrowLeftIcon, E as ArrowRightIcon, D as ArrowUpIcon, e as BaseComponent, p as BaseIcon, te as Button, ze as Calendar, q as CalendarIcon, k as CaretBottomIcon, O as CaretTopIcon, Te as Carousel, Ee as CarouselItem, $ as Checkbox, ee as CheckboxGroup, m as CloseFilledIcon, B as CloseIcon, Ne as Collapse, Pe as CollapseItem, he as ColorPicker, H as DArrowLeftIcon, U as DArrowRightIcon, pe as DatePicker, me as DatePickerOri, Oe as DescriptionPanel, y as Dialog, b as DialogContainer, A as FontIcon, Y as Form, X as FormItem, Fe as Image, Ie as ImagePreview, _ as InfoIcon, ne as Input, ge as List, x as Loading, j as LoadingIcon, Ae as Mask, ae as MdInput, Se as Menu, Ce as MenuItem, v as Message, C as Modal, P as MoonIcon, V as MoreIcon, je as PageHeader, ke as Pagination, _e as Polygon, se as Popover, De as Qrcode, Q as Radio, Z as RadioGroup, F as ReductionIcon, J as RefreshIcon, I as RefreshLeftIcon, L as RefreshRightIcon, M as SearchIcon, oe as Select, K as SelectIcon, re as SelectOri, R as SortIcon, Re as Space, we as SubMenu, h as SuccessIcon, N as SunIcon, ie as Switch, ve as Tabbar, ye as TabbarItem, Le as Table, S as Tabs, Me as Tag, be as Theme, xe as ThemeColor, z as ThemeDefaultIcon, g as WarnIcon, W as ZoomInIcon, G as ZoomOutIcon, f as addClickOutside, ce as autoUpdate, le as createPopoverObserver, ue as getOverflowAncestors, t as initAttr, n as kebabToCamel, r as parseAttrValue, de as popconfirmProps, i as regist, d as removeClickOutside, a as setAttrs, o as stopSignal, s as tagAttr, c as tagAttrs, l as unitNumberStr, fe as updatePosition, u as useId };
62
+ import { t as Se } from "./menu-CzV6lOlw.js";
63
+ import { t as Ce } from "./carousel-dT3FJPQo.js";
64
+ import { t as we } from "./item-B7Elh5xE.js";
65
+ import { t as Te } from "./qrcode-BKG2MibP.js";
66
+ import { t as Ee } from "./description_panel-BY2yljeC.js";
67
+ import { t as De } from "./pagination-5t7AOeFV.js";
68
+ import { t as Oe } from "./mask-CEznzwji.js";
69
+ import { t as ke } from "./page_header-BJkEstRw.js";
70
+ import { t as Ae } from "./tag-72DwCkvq.js";
71
+ import { t as je } from "./collapse-C3IRHLeg.js";
72
+ import { t as Me } from "./item-DRsOV_Tc.js";
73
+ import { t as Ne } from "./image-COPKk8Jm.js";
74
+ import { t as Pe } from "./image_preview-CYEup07F.js";
75
+ import { t as Fe } from "./table-DfL2hFqA.js";
76
+ import { t as Ie } from "./space-Bv-p0DL8.js";
77
+ import { t as Le } from "./calendar-GpYHNmXG.js";
78
+ export { w as ArrowDownIcon, T as ArrowLeftIcon, E as ArrowRightIcon, D as ArrowUpIcon, e as BaseComponent, p as BaseIcon, te as Button, Le as Calendar, q as CalendarIcon, k as CaretBottomIcon, O as CaretTopIcon, Ce as Carousel, we as CarouselItem, $ as Checkbox, ee as CheckboxGroup, m as CloseFilledIcon, B as CloseIcon, je as Collapse, Me as CollapseItem, he as ColorPicker, H as DArrowLeftIcon, U as DArrowRightIcon, pe as DatePicker, me as DatePickerOri, Ee as DescriptionPanel, y as Dialog, b as DialogContainer, A as FontIcon, Y as Form, X as FormItem, Ne as Image, Pe as ImagePreview, _ as InfoIcon, ne as Input, ge as List, x as Loading, j as LoadingIcon, Oe as Mask, ae as MdInput, Se as Menu, v as Message, C as Modal, P as MoonIcon, V as MoreIcon, ke as PageHeader, De as Pagination, _e as Polygon, se as Popover, Te as Qrcode, Q as Radio, Z as RadioGroup, F as ReductionIcon, J as RefreshIcon, I as RefreshLeftIcon, L as RefreshRightIcon, M as SearchIcon, oe as Select, K as SelectIcon, re as SelectOri, R as SortIcon, Ie as Space, h as SuccessIcon, N as SunIcon, ie as Switch, ve as Tabbar, ye as TabbarItem, Fe as Table, S as Tabs, Ae as Tag, be as Theme, xe as ThemeColor, z as ThemeDefaultIcon, g as WarnIcon, W as ZoomInIcon, G as ZoomOutIcon, f as addClickOutside, ce as autoUpdate, le as createPopoverObserver, ue as getOverflowAncestors, t as initAttr, n as kebabToCamel, r as parseAttrValue, de as popconfirmProps, i as regist, d as removeClickOutside, a as setAttrs, o as stopSignal, s as tagAttr, c as tagAttrs, l as unitNumberStr, fe as updatePosition, u as useId };
@@ -1,6 +1,6 @@
1
1
  import { parseAttrValue as e, unitNumberStr as t } from "../utils/index.js";
2
2
  import { t as n } from "../form_inner-DR9tyB_r.js";
3
- import { t as r } from "../input-DjKxcxry.js";
3
+ import { t as r } from "../input-UfukfZIy.js";
4
4
  import { t as i } from "../input_inner-BKJg9n9A.js";
5
5
  import { $ as a, $$ as o, $one as s, addClass as c, formatStyle as l, off as u, on as d, removeClass as f } from "ph-utils/dom";
6
6
  //#region src/components/input/index.ts
@@ -42,7 +42,7 @@ var p = class extends n {
42
42
  ];
43
43
  }
44
44
  afterInit() {
45
- this.$inner = s(".l-input__inner", this.root), d(this.$inner, "input", this._input), d(this.$inner, "change", this.#n), this.style.cssText = l(this._getStyleObj()) + this.getAttr("style", ""), this._updateError(this._state.error != null);
45
+ this.$inner = s(".l-input__inner", this.root), d(this.$inner, "input", this._input), d(this.$inner, "change", this.#n), this.style.cssText = l(this._getStyleObj()) + this.getAttr("style", "");
46
46
  }
47
47
  beforeDestroy() {
48
48
  u(this.$inner, "input", this._input);
@@ -0,0 +1,4 @@
1
+ //#region src/components/input/index.less?inline
2
+ var e = ":host{--l-input-border-color:var(--l-border-color,#dedede);width:var(--l-input-width,170px);height:var(--l-form-control-height,32px);border:1px solid var(--l-input-border-color,#dedede);border-radius:var(--l-border-radius,3px);vertical-align:middle;box-sizing:border-box;background-color:#0000;align-items:center;padding:0 7px;transition:border-color .3s,box-shadow .3s;display:inline-flex}:host(:focus){--l-input-border-color:var(--l-primary-color,#722ed1);box-shadow:0 0 0 3px var(--l-primary-color-light5)}:host(.is-block){width:100%}:host(.is-disabled){background-color:var(--l-disabled-color,#f5f7fa)}:host(.is-error){--l-input-border-color:var(--l-error-color)}:host(.is-error:focus){box-shadow:0 0 0 3px var(--l-error-color-light5)}.l-input__prefix,.l-input__suffix{color:#a8abb2;flex-shrink:0;font-size:14px;display:inline-flex}.l-input__prefix{margin-right:5px}.l-input__suffix{margin-left:5px}.l-clearable{cursor:pointer}.l-clearable:hover{color:#999}";
3
+ //#endregion
4
+ export { e as t };
@@ -21,7 +21,10 @@ var o = ":host{color:#666;cursor:pointer;flex-direction:column;flex-grow:var(--l
21
21
  e.gap && i(this, "l-item--gap"), e.type === "card" && i(this, "l-item--card"), super.connectedCallback();
22
22
  }
23
23
  attributeChangedCallback(e, n, r) {
24
- e === "icon" || e === "only-icon" ? (this[e] = t(r, !1, "icon"), this.#e()) : this[e] = r;
24
+ if (e === "icon" || e === "only-icon") {
25
+ let n = t(r, !1, "icon");
26
+ this[e] = n, this.#e();
27
+ } else this[e] = r;
25
28
  }
26
29
  #e() {
27
30
  if (!this.rendered) return;
package/lib/mask/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../mask-BlV5QfTj.js";
1
+ import { t as e } from "../mask-CEznzwji.js";
2
2
  export { e as default };
@@ -1,31 +1,48 @@
1
1
  import BaseComponent from "../base";
2
- export default class Menu extends BaseComponent {
3
- #private;
4
- static baseName: string;
2
+ import type { MenuItem } from "./types";
3
+ type MenuState = {
4
+ /** 是否手风琴模式, 只有一个子菜单展开 */
5
+ accordion?: boolean;
5
6
  /** 当前选中的菜单项 key 数组, 用 , 分割 */
6
7
  selectedIndex: string;
7
- /** 水平/垂直菜单 */
8
- orientation: "horizontal" | "vertical";
9
- /** 主题 */
10
- theme: "light" | "dark";
8
+ };
9
+ export default class Menu extends BaseComponent<MenuState> {
10
+ #private;
11
+ static baseName: string;
11
12
  /** 是否手风琴模式, 只有一个子菜单展开 */
12
13
  accordion: boolean;
13
- connectedCallback(): void;
14
+ private _items;
15
+ private _menuEl?;
16
+ private _activeKeys;
17
+ constructor();
14
18
  static get observedAttributes(): string[];
15
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
19
+ protected attributeChanged(name: string, oldValue: string, newValue: string): void;
16
20
  afterInit(): void;
17
21
  beforeDestroy(): void;
18
- render(): HTMLElement;
22
+ render_v2(): {
23
+ template?: string | HTMLElement | DocumentFragment;
24
+ style?: string | string[];
25
+ };
26
+ _handleClick: (e: Event) => void;
19
27
  /**
20
28
  * 展开与提供的 keys 对应的子菜单。
21
29
  *
22
- * 此方法会在当前上下文中选择所有带有 `l-sub-menu` 标签和 `key` 属性的元素,
23
- * 并对其进行迭代。如果子菜单的 `key` 属性与提供的 keys 中的任意一个匹配,
24
- * 则通过将其 `collapse` 属性设置为 "off" 来展开子菜单,并将该 key 添加到 `#selectedKeys` 集合中。
30
+ * 遍历当前组件内所有子菜单,如果子菜单的 key 在提供的 keys 中,
31
+ * 则展开该子菜单;如果 collapseOther 为 true,则折叠不在 keys 中的子菜单。
25
32
  *
26
33
  * @param keys - 表示要展开的子菜单的 key 的字符串数组。
27
34
  * @param collapseOther - 可选参数,默认为 false。是否折叠其他子菜单。
28
35
  */
29
36
  expandSubmenus(keys: string[], collapseOther?: boolean): void;
30
37
  updateSelectedKeys(key: string): void;
38
+ private _toggleSubMenu;
39
+ private _onTransitionEnd;
40
+ set items(menuItems: MenuItem[]);
41
+ get items(): MenuItem[];
42
+ private _renderItems;
43
+ private _renderItem;
44
+ private _renderMenuItem;
45
+ private _renderSubMenu;
46
+ private _renderTitle;
31
47
  }
48
+ export {};
package/lib/menu/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../menu-DAtplYAH.js";
1
+ import { t as e } from "../menu-CzV6lOlw.js";
2
2
  export { e as default };
@@ -0,0 +1,6 @@
1
+ export type MenuItem = {
2
+ key: string;
3
+ label: string | ((item: MenuItem) => HTMLElement);
4
+ icon?: (item: MenuItem) => HTMLElement;
5
+ children?: MenuItem[];
6
+ };
File without changes
@@ -0,0 +1,224 @@
1
+ import e from "./base.js";
2
+ import { parseAttrValue as t } from "./utils/index.js";
3
+ import { $ as n, $$ as r, $one as i, iterate as a, off as o, on as s } from "ph-utils/dom";
4
+ //#region src/components/menu/index.less?inline
5
+ var c = ":host{--l-menu-width:240px;--l-menu-height:auto;--l-menu-level:0;--l-menu-item-height:40px;--l-menu-item-padding-x:10px;--l-menu-item-indent:15px;--l-menu-item-radius:0;--l-menu-item-hover-background:var(--l-primary-color-light5,#f9f0ff);--l-menu-item-active-color:var(--l-primary-color,#722ed1);--l-menu-item-active-background:var(--l-primary-color-light5,#f9f0ff);--l-menu-border-color:var(--l-border-color,#dedede);--l-menu-border-width:1px;--l-menu-arrow-color:var(--l-info-color,#8c8c8c);width:var(--l-menu-width);height:var(--l-menu-height);box-sizing:border-box;display:block}.l-menu{min-width:0;color:inherit;box-sizing:border-box;border-right:var(--l-menu-border-width) solid var(--l-menu-border-color);font-size:14px;transition:height .3s,width .3s;display:block;position:relative;overflow:hidden}.l-menu .l-menu{--l-menu-border-color:transparent}.l-menu-item,.l-submenu-title{padding:0 var(--l-menu-item-padding-x) 0 calc(var(--l-menu-item-padding-x) + var(--l-menu-level) * var(--l-menu-item-indent));height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;border-radius:var(--l-menu-item-radius);border-right:2px solid #0000;align-items:center;gap:6px;transition:color .3s,background-color .3s,border-color .3s,transform .2s;display:flex;position:relative;overflow:hidden}.l-menu-item:hover,.l-submenu-title:hover{background-color:var(--l-menu-item-hover-background)}.l-menu-item.active{background-color:var(--l-menu-item-active-background);color:var(--l-menu-item-active-color);font-weight:500}.l-menu-icon-wrap{flex:none;align-items:center;font-size:14px;line-height:1;display:inline-flex}.l-menu-submenu{width:100%;display:block;overflow:hidden}.l-submenu-arrow-icon{color:var(--l-menu-arrow-color);transition:transform .3s;position:absolute;top:50%;right:10px;transform:translateY(-50%)rotate(90deg)}.l-menu-submenu.collapsed .l-submenu-arrow-icon{transform:translateY(-50%)rotate(0)}.l-menu--collapsed{display:none}.l-menu--hide{visibility:hidden;pointer-events:none;position:absolute}.l-menu-submenu.active .l-submenu-title{color:var(--l-menu-item-active-color)}@media (prefers-reduced-motion:reduce){.l-menu,.l-menu-item,.l-submenu-title,.l-submenu-arrow-icon{transition:none!important}}", l = 350, u = class extends e {
6
+ static baseName = "menu";
7
+ accordion = !1;
8
+ _items;
9
+ _menuEl;
10
+ _activeKeys;
11
+ #e;
12
+ #t;
13
+ #n;
14
+ constructor() {
15
+ super(), this._items = [], this._activeKeys = /* @__PURE__ */ new Set(), this.#n = /* @__PURE__ */ new Map(), this.#e = /* @__PURE__ */ new Map(), this.#t = /* @__PURE__ */ new Map(), this.version = 2, this._state = { selectedIndex: "" };
16
+ }
17
+ static get observedAttributes() {
18
+ return ["selected-index", "accordion"];
19
+ }
20
+ attributeChanged(e, n, r) {
21
+ switch (e) {
22
+ case "selected-index":
23
+ this._state.selectedIndex = r || "", this.rendered && this.updateSelectedKeys(this._state.selectedIndex);
24
+ break;
25
+ case "accordion":
26
+ this.accordion = t(r, !1, "accordion"), this._state.accordion = this.accordion;
27
+ break;
28
+ }
29
+ }
30
+ afterInit() {
31
+ this.classList.add("l-menu", "l-menu--vertical"), s(this.root, "click", this._handleClick), s(this.root, "transitionend", this._onTransitionEnd), this._menuEl = i(".l-menu", this.root);
32
+ }
33
+ beforeDestroy() {
34
+ o(this.root, "click", this._handleClick), o(this.root, "transitionend", this._onTransitionEnd), this.#n.forEach((e) => clearTimeout(e)), this.#n.clear(), this.#e.forEach((e) => cancelAnimationFrame(e)), this.#e.clear(), this.#t.clear(), this._menuEl = void 0;
35
+ }
36
+ render_v2() {
37
+ return {
38
+ style: c,
39
+ template: r("div", { class: "l-menu" })
40
+ };
41
+ }
42
+ _handleClick = (e) => {
43
+ let { type: t, key: n, keyPaths: r, target: i } = this.#r(e.target);
44
+ if (i) if (t === 2) {
45
+ let e = i.hasAttribute("expanded");
46
+ this._toggleSubMenu(i, !e), !e && this.accordion && this.#o(i);
47
+ } else t === 1 && (this.#i(r), this.updateSelectedKeys(n), this.emit("select", { detail: {
48
+ key: n,
49
+ keyPaths: r
50
+ } }));
51
+ };
52
+ #r(e, t) {
53
+ let n = 0, r = "", i, a = [];
54
+ do {
55
+ if (!e) break;
56
+ let o = e.getAttribute("index");
57
+ if (o && (r ||= o, a.unshift(o), t && t(e, o)), n === 0) {
58
+ let t = e.getAttribute("menu-role");
59
+ t && (n = Number(t), i = e);
60
+ }
61
+ e = e.parentElement;
62
+ } while (n >= 0);
63
+ return {
64
+ type: n,
65
+ key: r,
66
+ keyPaths: a,
67
+ target: i
68
+ };
69
+ }
70
+ expandSubmenus(e, t = !1) {
71
+ let r = n(".l-menu-submenu[index]", this.root), i = new Set(e);
72
+ a(r, (e) => {
73
+ let n = e.getAttribute("index") || "";
74
+ i.has(n) ? this._toggleSubMenu(e, !0) : t && this._toggleSubMenu(e, !1);
75
+ });
76
+ }
77
+ updateSelectedKeys(e) {
78
+ this._state.selectedIndex = e;
79
+ let t = e ? i(`.l-menu-item[index="${e}"]`, this.root) : null;
80
+ if (t) {
81
+ let e = this.#r(t, (e) => {
82
+ e.classList.add("active"), e.getAttribute("menu-role") === "2" && this._toggleSubMenu(e, !0);
83
+ });
84
+ this.#i(e.keyPaths);
85
+ } else this.#i([]);
86
+ }
87
+ #i(e) {
88
+ let t = n(".l-menu [index].active", this.root), r = new Set(e);
89
+ a(t, (e) => {
90
+ let t = e.getAttribute("index") || "";
91
+ r.has(t) || this.#r(e, (e, t) => {
92
+ r.has(t) || e.classList.remove("active");
93
+ });
94
+ });
95
+ }
96
+ _toggleSubMenu(e, t) {
97
+ let n = e.getAttribute("index") || "", r = i(".l-menu", e);
98
+ if (r && t !== e.hasAttribute("expanded")) {
99
+ if (this.#a(n), this.#t.set(n, { expand: t }), t) {
100
+ e.setAttribute("expanded", ""), e.classList.remove("collapsed"), r.classList.add("l-menu--hide"), r.classList.remove("l-menu--collapsed"), r.style.removeProperty("height");
101
+ let t = requestAnimationFrame(() => {
102
+ this.#e.delete(n);
103
+ let t = r.getBoundingClientRect();
104
+ r.style.height = "0", r.classList.remove("l-menu--hide"), requestAnimationFrame(() => {
105
+ e.hasAttribute("expanded") && (r.style.height = `${t.height}px`);
106
+ });
107
+ });
108
+ this.#e.set(n, t);
109
+ } else {
110
+ e.removeAttribute("expanded");
111
+ let t = r.getBoundingClientRect();
112
+ r.style.height = `${t.height}px`, e.classList.add("collapsed");
113
+ let i = requestAnimationFrame(() => {
114
+ this.#e.delete(n), e.hasAttribute("expanded") || (r.style.height = "0");
115
+ });
116
+ this.#e.set(n, i);
117
+ }
118
+ this.#n.set(n, window.setTimeout(() => {
119
+ this.#n.delete(n), this._onTransitionEnd({
120
+ target: r,
121
+ propertyName: "height"
122
+ });
123
+ }, l));
124
+ }
125
+ }
126
+ #a(e) {
127
+ let t = this.#n.get(e);
128
+ t && (clearTimeout(t), this.#n.delete(e));
129
+ let n = this.#e.get(e);
130
+ n && (cancelAnimationFrame(n), this.#e.delete(e));
131
+ }
132
+ #o(e) {
133
+ let t = e.parentElement;
134
+ t && a(n(".l-menu-submenu[expanded]", t), (t) => {
135
+ t !== e && this._toggleSubMenu(t, !1);
136
+ });
137
+ }
138
+ _onTransitionEnd = (e) => {
139
+ if (e.propertyName !== "height") return;
140
+ let t = e.target;
141
+ if (!t.classList.contains("l-menu")) return;
142
+ let n = t.closest(".l-menu-submenu");
143
+ if (!n) return;
144
+ let r = n.getAttribute("index") || "", i = this.#n.get(r);
145
+ i && (clearTimeout(i), this.#n.delete(r));
146
+ let a = this.#t.get(r);
147
+ if (a && a.expand !== n.hasAttribute("expanded")) {
148
+ this.#t.delete(r);
149
+ return;
150
+ }
151
+ this.#t.delete(r), t.style.removeProperty("height"), n.hasAttribute("expanded") || t.classList.add("l-menu--collapsed");
152
+ };
153
+ set items(e) {
154
+ this._items = e, this._menuEl && this._menuEl.replaceChildren(this._renderItems());
155
+ }
156
+ get items() {
157
+ return this._items;
158
+ }
159
+ _renderItems() {
160
+ this._state.selectedIndex ? this._activeKeys = new Set(this.#s(this._items, this._state.selectedIndex)) : this._activeKeys = /* @__PURE__ */ new Set();
161
+ let e = document.createDocumentFragment();
162
+ for (let t = 0, n = this._items.length; t < n; t++) e.appendChild(this._renderItem(this._items[t], 0));
163
+ return e;
164
+ }
165
+ _renderItem(e, t = 0) {
166
+ return e.children && e.children.length > 0 ? this._renderSubMenu(e, t) : this._renderMenuItem(e);
167
+ }
168
+ _renderMenuItem(e) {
169
+ let t = r("div", {
170
+ class: ["l-menu-item", this._activeKeys.has(e.key) ? "active" : ""],
171
+ index: e.key,
172
+ "menu-role": "1"
173
+ });
174
+ if (e.icon) {
175
+ let n = e.icon(e);
176
+ n.setAttribute("slot", "icon");
177
+ let i = r("span", { class: "l-menu-icon-wrap" });
178
+ i.appendChild(n), t.appendChild(i);
179
+ }
180
+ return t.appendChild(this._renderTitle(e)), t;
181
+ }
182
+ _renderSubMenu(e, t) {
183
+ let n = this._activeKeys.has(e.key), i = r("div", {
184
+ index: e.key,
185
+ class: ["l-menu-submenu", n ? "active" : void 0],
186
+ "menu-role": "2"
187
+ });
188
+ n && i.setAttribute("expanded", ""), i.setAttribute("data-level", String(t));
189
+ let a = r("div", { class: "l-submenu-title" });
190
+ if (e.icon) {
191
+ let t = e.icon(e), n = r("span", { class: "l-menu-icon-wrap" });
192
+ n.appendChild(t), a.appendChild(n);
193
+ }
194
+ a.appendChild(this._renderTitle(e));
195
+ let o = r("l-arrow-right-icon", { class: "l-submenu-arrow-icon" });
196
+ if (a.appendChild(o), i.appendChild(a), e.children) {
197
+ let a = r("div", { class: ["l-menu", n ? void 0 : "l-menu--collapsed"] });
198
+ a.style.setProperty("--l-menu-level", String(t + 1));
199
+ for (let n = 0, r = e.children.length; n < r; n++) a.appendChild(this._renderItem(e.children[n], t + 1));
200
+ i.appendChild(a);
201
+ }
202
+ return i;
203
+ }
204
+ _renderTitle(e) {
205
+ let t;
206
+ return t = typeof e.label == "string" ? r("span", { textContent: e.label }) : e.label(e), t;
207
+ }
208
+ #s(e, t) {
209
+ let n = (e, r) => {
210
+ for (let i of e) {
211
+ let e = [...r, i.key];
212
+ if (t === i.key) return e;
213
+ if (i.children) {
214
+ let t = n(i.children, e);
215
+ if (t.length > 0) return t;
216
+ }
217
+ }
218
+ return [];
219
+ };
220
+ return n(e, []);
221
+ }
222
+ };
223
+ //#endregion
224
+ export { u as t };
@@ -3,7 +3,7 @@ import t from "../icon/info.js";
3
3
  import { t as n } from "../modal-DWyWrN-D.js";
4
4
  import r from "../icon/close.js";
5
5
  import { t as i } from "../form_item-Bv-YafZK.js";
6
- import { t as a } from "../button-CC5PmAb1.js";
6
+ import { t as a } from "../button-CBoYJ9Tt.js";
7
7
  import o from "../input/index.js";
8
8
  import { $$ as s, $one as c, on as l } from "ph-utils/dom";
9
9
  //#region src/components/modal/modal_box.ts
@@ -1,2 +1,2 @@
1
- import { t as e } from "../page_header-DdeRDN4U.js";
1
+ import { t as e } from "../page_header-BJkEstRw.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../pagination-BoPzSPjT.js";
1
+ import { t as e } from "../pagination-5t7AOeFV.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../qrcode-BFxsD_OP.js";
1
+ import { t as e } from "../qrcode-BKG2MibP.js";
2
2
  export { e as default };
@@ -1,6 +1,6 @@
1
1
  import { tagAttrs as e } from "../utils/index.js";
2
2
  import { t } from "../form_inner-DR9tyB_r.js";
3
- import { t as n } from "../input-DjKxcxry.js";
3
+ import { t as n } from "../input-UfukfZIy.js";
4
4
  import { $one as r, off as i, on as a } from "ph-utils/dom";
5
5
  //#region src/components/select_ori/index.ts
6
6
  var o = class extends t {
@@ -1,2 +1,2 @@
1
- import { t as e } from "../space-CpTmBfHP.js";
1
+ import { t as e } from "../space-Bv-p0DL8.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../tabbar-4_d2Fj1n.js";
1
+ import { t as e } from "../tabbar-CI1xSj1G.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../item-DV842Aux.js";
1
+ import { t as e } from "../item-CvoJt3wp.js";
2
2
  export { e as default };
@@ -27,14 +27,19 @@ var p = ":host{--l-tabbar-hover-color:var(--l-primary-color-light1,#9254de);--l-
27
27
  ];
28
28
  }
29
29
  attributeChangedCallback(e, n, i) {
30
- if (e === "name") this.name = t(i, void 0), this._updateActive(), this._updateLine();
31
- else if (e === "type") {
30
+ if (e === "name") {
31
+ let e = t(i, void 0);
32
+ this.name = e, this._updateActive(), this._updateLine();
33
+ } else if (e === "type") {
32
34
  let e = t(i, "nav");
33
35
  if (e !== this.type && (l(this, `l-tabbar--${this.type}`), this.type = e, l(this, `l-tabbar--${e}`), e === "card")) {
34
36
  let e = r(".l-tabbar-card-border", this.root);
35
37
  e || (e = a("div", { class: "l-tabbar-card-border" }), this.root.appendChild(e));
36
38
  }
37
- } else this[e] = t(i, void 0), this.#e();
39
+ } else {
40
+ let n = t(i, void 0);
41
+ this[e] = n, this.#e();
42
+ }
38
43
  }
39
44
  render() {
40
45
  let e = document.createDocumentFragment();
@@ -1,2 +1,2 @@
1
- import { t as e } from "../table-Hifj8jAX.js";
1
+ import { t as e } from "../table-DfL2hFqA.js";
2
2
  export { e as default };
package/lib/tag/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../tag-DPENZf_V.js";
1
+ import { t as e } from "../tag-72DwCkvq.js";
2
2
  export { e as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litos-ui",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "基于 Web Component 的 UI 组件库",
5
5
  "keywords": [
6
6
  "component library",
@@ -43,24 +43,24 @@
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.18.0",
53
- "qrcode-generator-es": "^2.1.2",
52
+ "ph-utils": "^0.19.0",
53
+ "qrcode-generator-es": "^2.1.3",
54
54
  "shiki": "^4.0.2"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "^25.6.0",
58
58
  "less": "^4.6.4",
59
59
  "lightningcss": "^1.32.0",
60
- "oxfmt": "^0.45.0",
61
- "oxlint": "^1.60.0",
62
- "typescript": "^6.0.2",
63
- "vite": "^8.0.8",
60
+ "oxfmt": "^0.47.0",
61
+ "oxlint": "^1.62.0",
62
+ "typescript": "^6.0.3",
63
+ "vite": "^8.0.10",
64
64
  "vitepress": "^1.6.4"
65
65
  }
66
66
  }
@@ -1,4 +0,0 @@
1
- //#region src/components/input/index.less?inline
2
- var e = ":host{--l-input-border-color:var(--l-border-color,#dedede);width:var(--l-input-width,170px);height:var(--l-form-control-height,32px);border:1px solid var(--l-input-border-color,#dedede);border-radius:var(--l-border-radius,3px);vertical-align:middle;box-sizing:border-box;background-color:#0000;align-items:center;padding:0 7px;transition:border-color .3s;display:inline-flex}:host(:focus){--l-input-border-color:var(--l-primary-color,#722ed1)}:host(.is-block){width:100%}:host(.is-disabled){background-color:var(--l-disabled-color,#f5f7fa)}:host(.is-error){--l-input-border-color:#ed3f13}.l-input__prefix,.l-input__suffix{color:#a8abb2;flex-shrink:0;font-size:14px;display:inline-flex}.l-input__prefix{margin-right:5px}.l-input__suffix{margin-left:5px}.l-clearable{cursor:pointer}.l-clearable:hover{color:#999}";
3
- //#endregion
4
- export { e as t };
@@ -1,6 +0,0 @@
1
- import BaseComponent from "../base";
2
- export default class Menu extends BaseComponent {
3
- static baseName: string;
4
- connectedCallback(): void;
5
- render(): DocumentFragment;
6
- }
@@ -1,2 +0,0 @@
1
- import { t as e } from "../menu_item-BW1Tu11Q.js";
2
- export { e as default };
@@ -1,15 +0,0 @@
1
- import BaseComponent from "../base";
2
- export default class SubMenu extends BaseComponent {
3
- #private;
4
- static baseName: string;
5
- /** 默认折叠子菜单 */
6
- expanded: boolean;
7
- /** 是否激活状态, 通常是下面的子菜单项被选中 */
8
- active: boolean;
9
- connectedCallback(): void;
10
- afterInit(): void;
11
- beforeDestroy(): void;
12
- static get observedAttributes(): string[];
13
- attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
14
- render(): DocumentFragment;
15
- }
@@ -1,2 +0,0 @@
1
- import { t as e } from "../sub_menu-D1s8ABNu.js";
2
- export { e as default };
@@ -1,91 +0,0 @@
1
- import e from "./base.js";
2
- import { initAttr as t, parseAttrValue as n } from "./utils/index.js";
3
- import { $ as r, $$ as i, $one as a, iterate as o, off as s, on as c } from "ph-utils/dom";
4
- //#region src/components/menu/index.less?inline
5
- var l = ":host{--l-menu-width:240px;--l-menu-height:auto;--l-menu-color:#333;--l-menu-background:#fff;--l-menu-level:0;--l-menu-item-height:40px;--l-menu-active-color:var(--l-primary-color,#722ed1);--l-menu-active-background:var(--l-primary-color-light5,#f9f0ff);width:var(--l-menu-width);height:var(--l-menu-height);color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;border-right:1px solid var(--l-border-color,#dedede);font-size:14px;transition:height .3s,width .3s;display:block;position:relative;overflow:hidden}", u = class extends e {
6
- static baseName = "menu";
7
- selectedIndex = "";
8
- orientation = "vertical";
9
- theme = "light";
10
- accordion = !1;
11
- connectedCallback() {
12
- t(this), this.classList.add("l-menu", `l-menu--${this.orientation}`, `l-menu-${this.theme}`), this.loadStyleText(l), super.connectedCallback();
13
- }
14
- static get observedAttributes() {
15
- return [
16
- "selected-index",
17
- "orientation",
18
- "accordion"
19
- ];
20
- }
21
- attributeChangedCallback(e, t, r) {
22
- if (e === "accordion") {
23
- let e = n(r, !1, "accordion");
24
- e !== this.accordion && (this.accordion = e);
25
- }
26
- if (this.rendered) {
27
- if (e === "selected-index") this.selectedIndex !== r && this.updateSelectedKeys(r);
28
- else if (e === "orientation") {
29
- let e = this.classList;
30
- e.remove(`l-menu--${t}`), e.add(`l-menu--${r}`);
31
- }
32
- }
33
- }
34
- afterInit() {
35
- c(this, "click", this.#e), this.updateSelectedKeys(this.selectedIndex);
36
- }
37
- beforeDestroy() {
38
- s(this, "click", this.#e);
39
- }
40
- render() {
41
- return i("slot");
42
- }
43
- #e = (e) => {
44
- let { type: t, key: n, keyPaths: r, target: i } = this.#t(e.target);
45
- i && (t === 2 ? i.hasAttribute("expanded") ? i.removeAttribute("expanded") : (i.setAttribute("expanded", ""), this.accordion && this.expandSubmenus(r, !0)) : t === 1 && (this.#n(r), this.updateSelectedKeys(n), this.emit("select", { detail: {
46
- key: n,
47
- keyPaths: r
48
- } })));
49
- };
50
- #t(e, t) {
51
- let n = 0, r = "", i, a = [];
52
- do {
53
- let o = e.tagName;
54
- if (["L-MENU", "BODY"].includes(o)) break;
55
- let s = e.getAttribute("index");
56
- s && (r ||= s, a.unshift(s), t && t(e, s)), n === 0 && (o === "L-MENU-ITEM" ? (n = 1, i = e) : o === "L-SUB-MENU" && (i = e, n = 2)), e = e.parentElement;
57
- } while (n >= 0);
58
- return {
59
- type: n,
60
- key: r,
61
- keyPaths: a,
62
- target: i
63
- };
64
- }
65
- expandSubmenus(e, t = !1) {
66
- o(r("l-sub-menu[index]", this), (n) => {
67
- let r = n.getAttribute("index") || "";
68
- e.includes(r) ? n.setAttribute("expanded", "") : t && n.removeAttribute("expanded");
69
- });
70
- }
71
- updateSelectedKeys(e) {
72
- this.selectedIndex = e;
73
- let t = a(`l-menu-item[index="${e}"]`, this);
74
- if (t) {
75
- let e = this.#t(t, (e) => {
76
- e.setAttribute("active", ""), e.setAttribute("expanded", "");
77
- });
78
- this.#n(e.keyPaths);
79
- }
80
- }
81
- #n(e) {
82
- o(r("l-menu-item[active]", this), (t) => {
83
- let n = t.getAttribute("index") || "";
84
- e.includes(n) || this.#t(t, (t, n) => {
85
- e.includes(n) || (t.removeAttribute("expanded"), t.removeAttribute("active"));
86
- });
87
- });
88
- }
89
- };
90
- //#endregion
91
- export { u as t };
@@ -1,20 +0,0 @@
1
- import e from "./base.js";
2
- import { initAttr as t } from "./utils/index.js";
3
- import { $$ as n, $one as r } from "ph-utils/dom";
4
- //#region src/components/menu/menu_item.less?inline
5
- var i = ":host{padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;border-right:2px solid #0000;align-items:center;transition:color .3s,background-color .3s,border-color .3s;display:flex;position:relative;overflow:hidden}:host(:hover){background-color:var(--l-primary-color-light5)}:host([active]){background-color:var(--l-menu-active-background);color:var(--l-menu-active-color)}.l-menu-icon-wrap{margin-right:5px;font-size:14px;display:inline-flex}", a = class extends e {
6
- static baseName = "menu-item";
7
- connectedCallback() {
8
- this.loadStyleText(i), t(this), super.connectedCallback();
9
- }
10
- render() {
11
- let e = document.createDocumentFragment();
12
- if (r("[slot=\"icon\"]", this)) {
13
- let t = n("span", { class: "l-menu-icon-wrap" });
14
- t.appendChild(n("slot", { name: "icon" })), e.appendChild(t);
15
- }
16
- return e.appendChild(n("slot")), e;
17
- }
18
- };
19
- //#endregion
20
- export { a as t };
@@ -1,75 +0,0 @@
1
- import e from "./base.js";
2
- import { initAttr as t, parseAttrValue as n } from "./utils/index.js";
3
- import { $$ as r, $one as i, addClass as a, off as o, on as s, removeClass as c, toggleClass as l } from "ph-utils/dom";
4
- //#region src/components/menu/sub_menu.less?inline
5
- var u = ":host{width:100%;display:block;overflow:hidden}.l-submenu-title{padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;text-overflow:ellipsis;border-right:2px solid #0000;align-items:center;transition:color .3s,background-color .3s,border-color .3s;display:flex;position:relative;overflow:hidden}.l-submenu-title:hover{background-color:var(--l-primary-color-light5)}.l-menu{--l-menu-level:1;width:var(--l-menu-width);height:var(--l-menu-height);color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;border-right:1px solid var(--l-border-color,#dedede);font-size:14px;transition:height .3s,width .3s;display:block;position:relative;overflow:hidden}.l-menu-icon-wrap{margin-right:5px;font-size:14px;display:inline-flex}.l-submenu-arrow-icon{color:var(--l-info-color);transition:transform .3s;position:absolute;top:50%;right:10px;transform:translateY(-50%)rotate(90deg)}:host(.collapsed) .l-submenu-arrow-icon{transform:translateY(-50%)rotate(0)}.l-menu--collapsed{display:none}.l-menu--hide{visibility:hidden;position:absolute}:host(.is-active) .l-submenu-title{color:var(--l-primary-color)}", d = class extends e {
6
- static baseName = "sub-menu";
7
- expanded = !1;
8
- active = !1;
9
- #e;
10
- connectedCallback() {
11
- this.loadStyleText(u), t(this), this.expanded || a(this, "collapsed"), this.active && a(this, "is-active"), super.connectedCallback();
12
- }
13
- afterInit() {
14
- s(i(".l-menu", this.root), "transitionend", this.#t);
15
- }
16
- beforeDestroy() {
17
- o(i(".l-menu", this.root), "transitionend", this.#t), this.#e && clearTimeout(this.#e);
18
- }
19
- static get observedAttributes() {
20
- return ["expanded", "active"];
21
- }
22
- attributeChangedCallback(e, t, r) {
23
- if (this.rendered) {
24
- if (e === "expanded") {
25
- let e = n(r, !1, "expanded");
26
- if (this.expanded !== e) {
27
- this.expanded = e;
28
- let t = i(".l-menu", this.root);
29
- if (this.expanded) c(this, "collapsed"), a(t, "l-menu--hide"), c(t, "l-menu--collapsed"), requestAnimationFrame(() => {
30
- let e = t.getBoundingClientRect();
31
- t.style.height = "0", c(t, "l-menu--hide"), requestAnimationFrame(() => {
32
- t.style.height = `${e.height}px`;
33
- });
34
- });
35
- else {
36
- let e = t.getBoundingClientRect();
37
- t.style.height = `${e.height}px`, a(this, "collapsed"), requestAnimationFrame(() => {
38
- t.style.height = "0";
39
- });
40
- }
41
- this.#e = setTimeout(() => {
42
- this.#t({
43
- target: t,
44
- propertyName: "height"
45
- });
46
- }, 350);
47
- }
48
- } else if (e === "active") {
49
- let e = n(r, !1, "active");
50
- e !== this.active && (this.active = e, l(this, "is-active"));
51
- }
52
- }
53
- }
54
- render() {
55
- let e = document.createDocumentFragment(), t = r("div", { class: "l-submenu-title" });
56
- if (i("[slot=\"icon\"]", this)) {
57
- let e = r("span", { class: "l-menu-icon-wrap" });
58
- e.appendChild(r("slot", { name: "icon" })), t.appendChild(e);
59
- }
60
- t.appendChild(r("slot", { name: "title" }));
61
- let n = r("l-arrow-right-icon", { class: "l-submenu-arrow-icon" });
62
- t.appendChild(n), e.appendChild(t);
63
- let a = r("div", { class: ["l-menu", this.expanded ? void 0 : "l-menu--collapsed"] });
64
- return a.appendChild(r("slot")), e.appendChild(a), e;
65
- }
66
- #t = (e) => {
67
- if (!this.expanded && e.propertyName === "height") {
68
- this.#e && clearTimeout(this.#e);
69
- let t = e.target;
70
- t.style.removeProperty("height"), a(t, "l-menu--collapsed");
71
- }
72
- };
73
- };
74
- //#endregion
75
- export { d as t };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes