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,104 +1,2 @@
1
- import s from "../mask/index.js";
2
- import { $$ as n, $one as r, on as a, off as o } from "ph-utils/dom";
3
- const l = ".l-image-preview--container{position:relative;width:100%;height:100%;display:flex;justify-content:center;align-items:center}.l-image-preview__btn,.l-image-preview-operations{display:flex;justify-content:center;align-items:center;background-color:#606666}.l-image-preview__btn{z-index:1;position:absolute;border-radius:50%;opacity:.8;cursor:pointer;background-color:#606666;color:#fff;width:40px;height:40px;font-size:20px;display:flex;justify-content:center;align-items:center;transition:color .3s ease-in-out;outline:none;border:none}.l-image-preview__btn:hover{color:var(--l-primary-color, #4998f6)}.l-image-preview__close{right:30px;top: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{position:absolute;bottom:30px;left:50%;transform:translate(-50%);display:flex;align-items:center;flex-direction:column;z-index:1}.l-image-preview-progress{color:#fff;margin-bottom:10px}.l-image-preview-operations{cursor:default;padding:0 25px;border-radius:20px}.l-image-preview-operations .l-image-preview__btn{position:static;width:40px}.l-image-preview-img{max-width:calc(100vw - 40px);max-height:calc(100vh - 200px);vertical-align:middle;transform-origin:center center;transition:transform .25s;user-select:none;z-index:0}";
4
- class p extends s {
5
- static baseName = "image-preview";
6
- urlList = [];
7
- currentIndex = 0;
8
- // 缩放
9
- _scale = 1;
10
- // 旋转
11
- _rotate = 0;
12
- setImages(e) {
13
- this.urlList = e;
14
- }
15
- setCurrentIndex(e) {
16
- this.currentIndex = e;
17
- }
18
- static customAttributes = ["current-index"];
19
- connectedCallback() {
20
- this.loadStyleText(l), super.connectedCallback();
21
- }
22
- contentRender() {
23
- const e = [this._generateBtnString("close", "close")];
24
- this.urlList.length > 1 && (e.push(this._generateBtnString("prev", "arrow-left")), e.push(this._generateBtnString("next", "arrow-right"))), e.push('<div class="l-image-preview-footer">'), e.push(
25
- `<div class="l-image-preview-progress">${this._getProgress()}</div>`
26
- ), e.push(
27
- '<div data-action="operations" class="l-image-preview-operations">'
28
- ), e.push(this._generateBtnString("zoom-in", "zoom-in")), e.push(this._generateBtnString("zoom-out", "zoom-out")), e.push(this._generateBtnString("reduction", "reduction")), e.push(this._generateBtnString("refresh-left", "refresh-left")), e.push(this._generateBtnString("refresh-right", "refresh-right")), e.push("</div></div>");
29
- const t = this.urlList[this.currentIndex], i = this._getTransformStyleValue();
30
- return e.push(
31
- `<img src="${t}" data-action="previewer" class="l-image-preview-img" style="transform: ${i};" />`
32
- ), n("div", {
33
- class: "l-image-preview--container",
34
- innerHTML: e.join("")
35
- });
36
- }
37
- _generateBtnString(e, t) {
38
- return `<button aria-label="${e}" data-action="${e}" class="l-image-preview__btn l-image-preview__${e}"><l-${t}-icon></l-${t}-icon></button>`;
39
- }
40
- _getProgress() {
41
- return `${this.currentIndex + 1}&nbsp;/&nbsp;${this.urlList.length}`;
42
- }
43
- _getTransformStyleValue() {
44
- return `scale3d(${this._scale}, ${this._scale}, 1) rotate3d(0, 0, 1, ${this._rotate}deg)`;
45
- }
46
- _updateImgAttr() {
47
- const e = r(".l-image-preview-img", this.root);
48
- e && (e.src = this.urlList[this.currentIndex], e.style.transform = this._getTransformStyleValue());
49
- }
50
- _updateProgress() {
51
- const e = r(
52
- ".l-image-preview-progress",
53
- this.root
54
- );
55
- e && (e.innerHTML = this._getProgress());
56
- }
57
- _resetTransform() {
58
- this._scale = 1, this._rotate = 0, this._updateImgAttr();
59
- }
60
- onAction(e) {
61
- switch (e) {
62
- case "close":
63
- this.open = !1;
64
- break;
65
- case "prev":
66
- this.currentIndex === 0 ? this.currentIndex = this.urlList.length - 1 : this.currentIndex--, this._resetTransform(), this._updateProgress();
67
- break;
68
- case "next":
69
- this.currentIndex === this.urlList.length - 1 ? this.currentIndex = 0 : this.currentIndex++, this._resetTransform(), this._updateProgress();
70
- break;
71
- case "zoom-in":
72
- this._transformScale("in");
73
- break;
74
- case "zoom-out":
75
- this._transformScale("out");
76
- break;
77
- case "reduction":
78
- this._resetTransform();
79
- break;
80
- case "refresh-left":
81
- this._rotate -= 90, this._updateImgAttr();
82
- break;
83
- case "refresh-right":
84
- this._rotate += 90, this._updateImgAttr();
85
- break;
86
- }
87
- return !0;
88
- }
89
- _handleWhell = (e) => {
90
- e.deltaY > 0 ? this._transformScale("out") : this._transformScale("in");
91
- };
92
- afterOpened() {
93
- a(document, "wheel", this._handleWhell, { passive: !0 });
94
- }
95
- _transformScale(e) {
96
- e === "in" ? this._scale < 3 && (this._scale += 0.25) : this._scale > 0.25 && (this._scale -= 0.25), this._updateImgAttr();
97
- }
98
- afterClosed() {
99
- o(document, "wheel", this._handleWhell);
100
- }
101
- }
102
- export {
103
- p as default
104
- };
1
+ import { t as e } from "../image_preview-CYEup07F.js";
2
+ export { e as default };
@@ -1,176 +1,2 @@
1
- import o from "../base.js";
2
- import { kebabToCamel as n, parseAttrValue as d } from "../utils/index.js";
3
- import { $$ as l, formatClass as c, $one as h, on as s, off as r, addClass as g, removeClass as p, shouldEventNext as m } from "ph-utils/dom";
4
- const f = ":host{vertical-align:middle;display:inline-flex;box-sizing:border-box;width:auto;height:auto}.l-image-inner{vertical-align:middle;width:100%;height:100%;object-fit:var(--l-image-fit, fill)}.l-image-inner--preview{cursor:pointer}.l-image-hide{display:none}.l-image-fallback{width:100%;height:100%;display:inline-flex;justify-content:center;align-items:center;background-color:#0000001a}";
5
- class b extends o {
6
- static baseName = "image";
7
- alt;
8
- _src = "";
9
- /** eager - 立即加载图像, lazy - 懒加载 */
10
- _loading = "eager";
11
- fit;
12
- width;
13
- height;
14
- fallback;
15
- customFallback = !1;
16
- /** 是否加载错误 */
17
- isError = !1;
18
- /** 是否禁用图片预览 */
19
- previewDisabled = !1;
20
- _previewEl;
21
- _previewImageList;
22
- _previewIndex = 0;
23
- _placeholder;
24
- _imageInner;
25
- get src() {
26
- return this._src;
27
- }
28
- set src(e) {
29
- this._src = e, this._loadActualImage();
30
- }
31
- get loading() {
32
- return this._loading;
33
- }
34
- set loading(e) {
35
- this._loading = e;
36
- }
37
- get placeholder() {
38
- return this._placeholder;
39
- }
40
- set placeholder(e) {
41
- this._placeholder = e;
42
- }
43
- get previewImageList() {
44
- return this._previewImageList;
45
- }
46
- set previewImageList(e) {
47
- this.setPreviewImageList(e);
48
- }
49
- get previewIndex() {
50
- return this._previewIndex;
51
- }
52
- set previewIndex(e) {
53
- this.setPreviewIndex(e);
54
- }
55
- setPreviewImageList(e) {
56
- this._previewImageList = e;
57
- }
58
- setPreviewIndex(e) {
59
- this._previewIndex = e;
60
- }
61
- connectedCallback() {
62
- this.loadStyleText(f), super.connectedCallback();
63
- }
64
- static get observedAttributes() {
65
- return [
66
- "src",
67
- "loading",
68
- "fit",
69
- "width",
70
- "height",
71
- "placeholder",
72
- "preview-disabled",
73
- "preview-image-list",
74
- "preview-index",
75
- "fallback",
76
- "custom-fallback"
77
- ];
78
- }
79
- attributeChangedCallback(e, i, a) {
80
- e = n(e);
81
- const t = d(
82
- a,
83
- this[e],
84
- e
85
- );
86
- switch (t !== this[e] && (e === "previewImageList" ? this.setPreviewImageList(
87
- t ? t.split(",") : void 0
88
- ) : this[e] = t), e) {
89
- case "width":
90
- case "height":
91
- this.rendered && this._updateSize();
92
- break;
93
- }
94
- }
95
- render() {
96
- const e = this.alt || this.getAttribute("alt"), i = this.placeholder || this.src;
97
- return l("img", {
98
- class: c([
99
- "l-image-inner",
100
- this.previewDisabled ? void 0 : "l-image-inner--preview"
101
- ]),
102
- alt: e,
103
- loading: this.loading,
104
- src: i,
105
- part: "inner",
106
- "l-action": "inner"
107
- });
108
- }
109
- _updateSize() {
110
- this.width ? this.style.setProperty("width", this.width) : this.style.removeProperty("width"), this.height ? this.style.setProperty("height", this.height) : this.style.removeProperty("height");
111
- }
112
- afterInit() {
113
- this.fit && this.fit !== "fill" && this.style.setProperty("--l-image-fit", this.fit), this._updateSize(), this._imageInner = h(".l-image-inner", this.root), s(this._imageInner, "click", this._onTap), s(this._imageInner, "error", this._onError), s(this._imageInner, "load", this._onLoad), this._loadActualImage();
114
- }
115
- beforeDestroy() {
116
- this._imageInner && (r(this._imageInner, "click", this._onTap), r(this._imageInner, "error", this._onError), r(this._imageInner, "load", this._onLoad));
117
- }
118
- setIsError(e = !1) {
119
- if (this.isError !== e)
120
- if (this.isError = e, e) {
121
- if (!this.customFallback) {
122
- this.fallback && this._imageInner && (this._imageInner.src = this.fallback);
123
- return;
124
- }
125
- this._imageInner && g(this._imageInner, "l-image-hide");
126
- let i = h(".l-image-fallback", this.root);
127
- this.fallback || (i = l("div", {
128
- class: "l-image-fallback",
129
- part: "fallback",
130
- innerHTML: "<slot name='fallback'></slot>"
131
- }), this.root.appendChild(i));
132
- } else {
133
- this._imageInner && p(this._imageInner, "l-image-hide");
134
- const i = h(".l-image-fallback", this.root);
135
- i && i.remove();
136
- }
137
- }
138
- openPreview() {
139
- if (!this._previewEl) {
140
- const e = l("l-image-preview");
141
- e.setImages(this.previewImageList || [this.src]), e.setCurrentIndex(this.previewIndex || 0), e.setAttribute("open", "on"), this._previewEl = e, document.body.appendChild(e), s(this._previewEl, "closed", this._onPreviewClosed);
142
- }
143
- }
144
- closePreview() {
145
- this._previewEl && (r(this._previewEl, "closed", this._onPreviewClosed), this._previewEl.remove(), this._previewEl = void 0);
146
- }
147
- _onError = () => {
148
- this.setIsError(!0);
149
- };
150
- _onLoad = () => {
151
- this.setIsError(!1);
152
- };
153
- _onPreviewClosed = () => {
154
- this.closePreview();
155
- };
156
- _onTap = (e) => {
157
- const [i, a] = m(e, "l-action", this.root);
158
- i && a === "inner" && !this.previewDisabled && !this.isError && this.openPreview();
159
- };
160
- _clearTmpImg(e) {
161
- e && (e.onload = null, e.onerror = null, e = void 0);
162
- }
163
- _loadActualImage() {
164
- if (this.placeholder && this.rendered) {
165
- let e = new Image();
166
- e.src = this.src, e.onload = () => {
167
- this._imageInner && (this._imageInner.src = this.src), this._clearTmpImg(e);
168
- }, e.onerror = () => {
169
- this.setIsError(!0), this._clearTmpImg(e);
170
- };
171
- }
172
- }
173
- }
174
- export {
175
- b as default
176
- };
1
+ import { t as e } from "../image-COPKk8Jm.js";
2
+ export { e as default };
@@ -0,0 +1,162 @@
1
+ import e from "./base.js";
2
+ import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
3
+ import { $$ as r, $one as i, addClass as a, formatClass as o, off as s, on as c, removeClass as l, shouldEventNext as u } from "ph-utils/dom";
4
+ //#region src/components/image/index.less?inline
5
+ var d = ":host{vertical-align:middle;box-sizing:border-box;width:auto;height:auto;display:inline-flex}.l-image-inner{vertical-align:middle;object-fit:var(--l-image-fit,fill);width:100%;height:100%}.l-image-inner--preview{cursor:pointer}.l-image-hide{display:none}.l-image-fallback{background-color:#0000001a;justify-content:center;align-items:center;width:100%;height:100%;display:inline-flex}", f = class extends e {
6
+ static baseName = "image";
7
+ alt;
8
+ _src = "";
9
+ _loading = "eager";
10
+ fit;
11
+ width;
12
+ height;
13
+ fallback;
14
+ customFallback = !1;
15
+ isError = !1;
16
+ previewDisabled = !1;
17
+ _previewEl;
18
+ _previewImageList;
19
+ _previewIndex = 0;
20
+ _placeholder;
21
+ _imageInner;
22
+ get src() {
23
+ return this._src;
24
+ }
25
+ set src(e) {
26
+ this._src = e, this._loadActualImage();
27
+ }
28
+ get loading() {
29
+ return this._loading;
30
+ }
31
+ set loading(e) {
32
+ this._loading = e;
33
+ }
34
+ get placeholder() {
35
+ return this._placeholder;
36
+ }
37
+ set placeholder(e) {
38
+ this._placeholder = e;
39
+ }
40
+ get previewImageList() {
41
+ return this._previewImageList;
42
+ }
43
+ set previewImageList(e) {
44
+ this.setPreviewImageList(e);
45
+ }
46
+ get previewIndex() {
47
+ return this._previewIndex;
48
+ }
49
+ set previewIndex(e) {
50
+ this.setPreviewIndex(e);
51
+ }
52
+ setPreviewImageList(e) {
53
+ this._previewImageList = e;
54
+ }
55
+ setPreviewIndex(e) {
56
+ this._previewIndex = e;
57
+ }
58
+ connectedCallback() {
59
+ this.loadStyleText(d), super.connectedCallback();
60
+ }
61
+ static get observedAttributes() {
62
+ return [
63
+ "src",
64
+ "loading",
65
+ "fit",
66
+ "width",
67
+ "height",
68
+ "placeholder",
69
+ "preview-disabled",
70
+ "preview-image-list",
71
+ "preview-index",
72
+ "fallback",
73
+ "custom-fallback"
74
+ ];
75
+ }
76
+ attributeChangedCallback(e, r, i) {
77
+ e = t(e);
78
+ let a = n(i, this[e], e);
79
+ switch (a !== this[e] && (e === "previewImageList" ? this.setPreviewImageList(a ? a.split(",") : void 0) : this[e] = a), e) {
80
+ case "width":
81
+ case "height":
82
+ this.rendered && this._updateSize();
83
+ break;
84
+ }
85
+ }
86
+ render() {
87
+ let e = this.alt || this.getAttribute("alt"), t = this.placeholder || this.src;
88
+ return r("img", {
89
+ class: o(["l-image-inner", this.previewDisabled ? void 0 : "l-image-inner--preview"]),
90
+ alt: e,
91
+ loading: this.loading,
92
+ src: t,
93
+ part: "inner",
94
+ "l-action": "inner"
95
+ });
96
+ }
97
+ _updateSize() {
98
+ this.width ? this.style.setProperty("width", this.width) : this.style.removeProperty("width"), this.height ? this.style.setProperty("height", this.height) : this.style.removeProperty("height");
99
+ }
100
+ afterInit() {
101
+ this.fit && this.fit !== "fill" && this.style.setProperty("--l-image-fit", this.fit), this._updateSize(), this._imageInner = i(".l-image-inner", this.root), c(this._imageInner, "click", this._onTap), c(this._imageInner, "error", this._onError), c(this._imageInner, "load", this._onLoad), this._loadActualImage();
102
+ }
103
+ beforeDestroy() {
104
+ this._imageInner && (s(this._imageInner, "click", this._onTap), s(this._imageInner, "error", this._onError), s(this._imageInner, "load", this._onLoad));
105
+ }
106
+ setIsError(e = !1) {
107
+ if (this.isError !== e) if (this.isError = e, e) {
108
+ if (!this.customFallback) {
109
+ this.fallback && this._imageInner && (this._imageInner.src = this.fallback);
110
+ return;
111
+ }
112
+ this._imageInner && a(this._imageInner, "l-image-hide");
113
+ let e = i(".l-image-fallback", this.root);
114
+ this.fallback || (e = r("div", {
115
+ class: "l-image-fallback",
116
+ part: "fallback",
117
+ innerHTML: "<slot name='fallback'></slot>"
118
+ }), this.root.appendChild(e));
119
+ } else {
120
+ this._imageInner && l(this._imageInner, "l-image-hide");
121
+ let e = i(".l-image-fallback", this.root);
122
+ e && e.remove();
123
+ }
124
+ }
125
+ openPreview() {
126
+ if (!this._previewEl) {
127
+ let e = r("l-image-preview");
128
+ e.setImages(this.previewImageList || [this.src]), e.setCurrentIndex(this.previewIndex || 0), e.setAttribute("open", "on"), this._previewEl = e, document.body.appendChild(e), c(this._previewEl, "closed", this._onPreviewClosed);
129
+ }
130
+ }
131
+ closePreview() {
132
+ this._previewEl &&= (s(this._previewEl, "closed", this._onPreviewClosed), this._previewEl.remove(), void 0);
133
+ }
134
+ _onError = () => {
135
+ this.setIsError(!0);
136
+ };
137
+ _onLoad = () => {
138
+ this.setIsError(!1);
139
+ };
140
+ _onPreviewClosed = () => {
141
+ this.closePreview();
142
+ };
143
+ _onTap = (e) => {
144
+ let [t, n] = u(e, "l-action", this.root);
145
+ t && n === "inner" && !this.previewDisabled && !this.isError && this.openPreview();
146
+ };
147
+ _clearTmpImg(e) {
148
+ e &&= (e.onload = null, e.onerror = null, void 0);
149
+ }
150
+ _loadActualImage() {
151
+ if (this.placeholder && this.rendered) {
152
+ let e = new Image();
153
+ e.src = this.src, e.onload = () => {
154
+ this._imageInner && (this._imageInner.src = this.src), this._clearTmpImg(e);
155
+ }, e.onerror = () => {
156
+ this.setIsError(!0), this._clearTmpImg(e);
157
+ };
158
+ }
159
+ }
160
+ };
161
+ //#endregion
162
+ export { f as t };
@@ -0,0 +1,92 @@
1
+ import { t as e } from "./mask-CEznzwji.js";
2
+ import { $$ as t, $one as n, off as r, on as i } from "ph-utils/dom";
3
+ //#region src/components/image/image_preview.less?inline
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 {
5
+ static baseName = "image-preview";
6
+ urlList = [];
7
+ currentIndex = 0;
8
+ _scale = 1;
9
+ _rotate = 0;
10
+ setImages(e) {
11
+ this.urlList = e;
12
+ }
13
+ setCurrentIndex(e) {
14
+ this.currentIndex = e;
15
+ }
16
+ static customAttributes = ["current-index"];
17
+ connectedCallback() {
18
+ this.loadStyleText(a), super.connectedCallback();
19
+ }
20
+ contentRender() {
21
+ let e = [this._generateBtnString("close", "close")];
22
+ this.urlList.length > 1 && (e.push(this._generateBtnString("prev", "arrow-left")), e.push(this._generateBtnString("next", "arrow-right"))), e.push("<div class=\"l-image-preview-footer\">"), e.push(`<div class="l-image-preview-progress">${this._getProgress()}</div>`), e.push("<div data-action=\"operations\" class=\"l-image-preview-operations\">"), e.push(this._generateBtnString("zoom-in", "zoom-in")), e.push(this._generateBtnString("zoom-out", "zoom-out")), e.push(this._generateBtnString("reduction", "reduction")), e.push(this._generateBtnString("refresh-left", "refresh-left")), e.push(this._generateBtnString("refresh-right", "refresh-right")), e.push("</div></div>");
23
+ let n = this.urlList[this.currentIndex], r = this._getTransformStyleValue();
24
+ return e.push(`<img src="${n}" data-action="previewer" class="l-image-preview-img" style="transform: ${r};" />`), t("div", {
25
+ class: "l-image-preview--container",
26
+ innerHTML: e.join("")
27
+ });
28
+ }
29
+ _generateBtnString(e, t) {
30
+ return `<button aria-label="${e}" data-action="${e}" class="l-image-preview__btn l-image-preview__${e}"><l-${t}-icon></l-${t}-icon></button>`;
31
+ }
32
+ _getProgress() {
33
+ return `${this.currentIndex + 1}&nbsp;/&nbsp;${this.urlList.length}`;
34
+ }
35
+ _getTransformStyleValue() {
36
+ return `scale3d(${this._scale}, ${this._scale}, 1) rotate3d(0, 0, 1, ${this._rotate}deg)`;
37
+ }
38
+ _updateImgAttr() {
39
+ let e = n(".l-image-preview-img", this.root);
40
+ e && (e.src = this.urlList[this.currentIndex], e.style.transform = this._getTransformStyleValue());
41
+ }
42
+ _updateProgress() {
43
+ let e = n(".l-image-preview-progress", this.root);
44
+ e && (e.innerHTML = this._getProgress());
45
+ }
46
+ _resetTransform() {
47
+ this._scale = 1, this._rotate = 0, this._updateImgAttr();
48
+ }
49
+ onAction(e) {
50
+ switch (e) {
51
+ case "close":
52
+ this.open = !1;
53
+ break;
54
+ case "prev":
55
+ this.currentIndex === 0 ? this.currentIndex = this.urlList.length - 1 : this.currentIndex--, this._resetTransform(), this._updateProgress();
56
+ break;
57
+ case "next":
58
+ this.currentIndex === this.urlList.length - 1 ? this.currentIndex = 0 : this.currentIndex++, this._resetTransform(), this._updateProgress();
59
+ break;
60
+ case "zoom-in":
61
+ this._transformScale("in");
62
+ break;
63
+ case "zoom-out":
64
+ this._transformScale("out");
65
+ break;
66
+ case "reduction":
67
+ this._resetTransform();
68
+ break;
69
+ case "refresh-left":
70
+ this._rotate -= 90, this._updateImgAttr();
71
+ break;
72
+ case "refresh-right":
73
+ this._rotate += 90, this._updateImgAttr();
74
+ break;
75
+ }
76
+ return !0;
77
+ }
78
+ _handleWhell = (e) => {
79
+ e.deltaY > 0 ? this._transformScale("out") : this._transformScale("in");
80
+ };
81
+ afterOpened() {
82
+ i(document, "wheel", this._handleWhell, { passive: !0 });
83
+ }
84
+ _transformScale(e) {
85
+ e === "in" ? this._scale < 3 && (this._scale += .25) : this._scale > .25 && (this._scale -= .25), this._updateImgAttr();
86
+ }
87
+ afterClosed() {
88
+ r(document, "wheel", this._handleWhell);
89
+ }
90
+ };
91
+ //#endregion
92
+ export { o as t };
package/lib/index.d.ts CHANGED
@@ -35,6 +35,8 @@ export { default as DArrowRightIcon } from "./icon/d_arrow_right";
35
35
  export { default as ZoomInIcon } from "./icon/zoom_in";
36
36
  export { default as ZoomOutIcon } from "./icon/zoom_out";
37
37
  export { default as SelectIcon } from "./icon/select";
38
+ export { default as CalendarIcon } from "./icon/calendar";
39
+ export { default as RefreshIcon } from "./icon/refresh";
38
40
  export { default as Form } from "./form";
39
41
  export { default as FormItem } from "./form/form_item";
40
42
  export { default as RadioGroup } from "./check/radio_group";
@@ -47,17 +49,16 @@ export { default as SelectOri } from "./select_ori";
47
49
  export { default as Switch } from "./switch";
48
50
  export { default as MdInput } from "./md_input";
49
51
  export { default as Select } from "./select";
52
+ export { default as DatePicker } from "./date_picker";
53
+ export { default as DatePickerOri } from "./date_picker_ori";
54
+ export { default as ColorPicker } from "./color_picker";
50
55
  export { default as List } from "./list";
51
56
  export { default as Polygon } from "./polygon";
52
- export { default as ColorPicker } from "./color_picker";
53
57
  export { default as Tabbar } from "./tabbar";
54
58
  export { default as TabbarItem } from "./tabbar/item";
55
59
  export { default as Theme } from "./theme";
56
60
  export { default as ThemeColor } from "./theme/theme_color";
57
- export { default as DatePicker } from "./date_picker_ori";
58
61
  export { default as Menu } from "./menu";
59
- export { default as MenuItem } from "./menu/menu_item";
60
- export { default as SubMenu } from "./menu/sub_menu";
61
62
  export { default as Carousel } from "./carousel";
62
63
  export { default as CarouselItem } from "./carousel/item";
63
64
  export { default as Qrcode } from "./qrcode";
@@ -75,80 +76,3 @@ export { default as Table } from "./table";
75
76
  export type { Column } from "./table/types";
76
77
  export { default as Space } from "./space";
77
78
  export { default as Calendar } from "./calendar";
78
-
79
- declare global {
80
- interface HTMLElementTagNameMap {
81
- "l-base-component": import("./base").default
82
- "l-dialog": import("./dialog").default
83
- "l-dialog-container": import("./dialog/dialog_container").default
84
- "l-loading": import("./loading").default
85
- "l-tabs": import("./tabs").default
86
- "l-modal": import("./modal").default
87
- "l-base-icon": import("./icon/base").default
88
- "l-arrow-down-icon": import("./icon/arrow_down").default
89
- "l-arrow-left-icon": import("./icon/arrow_left").default
90
- "l-arrow-right-icon": import("./icon/arrow_right").default
91
- "l-arrow-up-icon": import("./icon/arrow_up").default
92
- "l-caret-top-icon": import("./icon/caret_top").default
93
- "l-caret-bottom-icon": import("./icon/caret_bottom").default
94
- "l-font-icon": import("./icon/font_icon").default
95
- "l-loading-icon": import("./icon/loading").default
96
- "l-search-icon": import("./icon/search").default
97
- "l-sun-icon": import("./icon/sun").default
98
- "l-moon-icon": import("./icon/moon").default
99
- "l-reduction-icon": import("./icon/reduction").default
100
- "l-refresh-left-icon": import("./icon/refresh_left").default
101
- "l-refresh-right-icon": import("./icon/refresh_right").default
102
- "l-sort-icon": import("./icon/sort").default
103
- "l-theme-default-icon": import("./icon/theme_default").default
104
- "l-close-icon": import("./icon/close").default
105
- "l-info-icon": import("./icon/info").default
106
- "l-success-icon": import("./icon/success").default
107
- "l-warn-icon": import("./icon/warn").default
108
- "l-close-filled-icon": import("./icon/close_filled").default
109
- "l-more-icon": import("./icon/more").default
110
- "l-d-arrow-left-icon": import("./icon/d_arrow_left").default
111
- "l-d-arrow-right-icon": import("./icon/d_arrow_right").default
112
- "l-zoom-in-icon": import("./icon/zoom_in").default
113
- "l-zoom-out-icon": import("./icon/zoom_out").default
114
- "l-select-icon": import("./icon/select").default
115
- "l-form": import("./form").default
116
- "l-form-item": import("./form/form_item").default
117
- "l-radio-group": import("./check/radio_group").default
118
- "l-radio": import("./check/radio").default
119
- "l-checkbox": import("./check/checkbox").default
120
- "l-checkbox-group": import("./check/checkbox_group").default
121
- "l-button": import("./button").default
122
- "l-input": import("./input").default
123
- "l-select-ori": import("./select_ori").default
124
- "l-switch": import("./switch").default
125
- "l-md-input": import("./md_input").default
126
- "l-select": import("./select").default
127
- "l-list": import("./list").default
128
- "l-polygon": import("./polygon").default
129
- "l-color-picker": import("./color_picker").default
130
- "l-tabbar": import("./tabbar").default
131
- "l-tabbar-item": import("./tabbar/item").default
132
- "l-theme": import("./theme").default
133
- "l-theme-color": import("./theme/theme_color").default
134
- "l-date-picker": import("./date_picker_ori").default
135
- "l-menu": import("./menu").default
136
- "l-menu-item": import("./menu/menu_item").default
137
- "l-sub-menu": import("./menu/sub_menu").default
138
- "l-carousel": import("./carousel").default
139
- "l-carousel-item": import("./carousel/item").default
140
- "l-qrcode": import("./qrcode").default
141
- "l-description-panel": import("./description_panel").default
142
- "l-pagination": import("./pagination").default
143
- "l-mask": import("./mask").default
144
- "l-page-header": import("./page_header").default
145
- "l-tag": import("./tag").default
146
- "l-collapse": import("./collapse").default
147
- "l-collapse-item": import("./collapse/item").default
148
- "l-image": import("./image").default
149
- "l-image-preview": import("./image/image_preview").default
150
- "l-table": import("./table").default
151
- "l-space": import("./space").default
152
- "l-calendar": import("./calendar").default
153
- }
154
- }