litos-ui 0.15.6 → 0.15.8

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 (84) hide show
  1. package/lib/button/index.d.ts +4 -0
  2. package/lib/button/index.js +88 -61
  3. package/lib/check/check.js +6 -7
  4. package/lib/check/checkbox.js +1 -1
  5. package/lib/check/radio.js +10 -6
  6. package/lib/{check-BlDsQQo0.js → check-A86JxUfd.js} +1 -1
  7. package/lib/collapse/index.d.ts +19 -0
  8. package/lib/collapse/index.js +88 -0
  9. package/lib/collapse/item.d.ts +15 -0
  10. package/lib/collapse/item.js +115 -0
  11. package/lib/color_picker/index.js +1 -1
  12. package/lib/date_picker/index.js +1 -1
  13. package/lib/description_panel/index.d.ts +4 -4
  14. package/lib/description_panel/index.js +59 -11
  15. package/lib/dialog/dialog_container.js +1 -1
  16. package/lib/form/form_inner.d.ts +5 -1
  17. package/lib/form/form_inner.js +33 -27
  18. package/lib/form/form_item.js +9 -9
  19. package/lib/icon/d_arrow_left.d.ts +6 -0
  20. package/lib/icon/d_arrow_left.js +13 -0
  21. package/lib/icon/d_arrow_right.d.ts +6 -0
  22. package/lib/icon/d_arrow_right.js +13 -0
  23. package/lib/icon/more.d.ts +6 -0
  24. package/lib/icon/more.js +13 -0
  25. package/lib/icon/select.d.ts +6 -0
  26. package/lib/icon/select.js +13 -0
  27. package/lib/icon/zoom_in.d.ts +6 -0
  28. package/lib/icon/zoom_in.js +13 -0
  29. package/lib/icon/zoom_out.d.ts +6 -0
  30. package/lib/icon/zoom_out.js +13 -0
  31. package/lib/image/image_preview.d.ts +24 -0
  32. package/lib/image/image_preview.js +104 -0
  33. package/lib/image/index.d.ts +50 -0
  34. package/lib/image/index.js +176 -0
  35. package/lib/index-D4II9KsF.js +4 -0
  36. package/lib/index.d.ts +36 -4
  37. package/lib/index.js +157 -120
  38. package/lib/input/index.d.ts +5 -0
  39. package/lib/input/index.js +93 -71
  40. package/lib/litos-ui.css +1 -1
  41. package/lib/mask/index.d.ts +23 -0
  42. package/lib/mask/index.js +110 -0
  43. package/lib/md_input/index.js +11 -11
  44. package/lib/message/index.js +2 -2
  45. package/lib/modal/index.d.ts +1 -1
  46. package/lib/modal/index.js +7 -7
  47. package/lib/modal/modal_box.js +10 -10
  48. package/lib/page_header/index.d.ts +20 -0
  49. package/lib/page_header/index.js +109 -0
  50. package/lib/pagination/index.d.ts +27 -0
  51. package/lib/pagination/index.js +248 -0
  52. package/lib/qrcode/index.js +4 -4
  53. package/lib/select/index.d.ts +79 -0
  54. package/lib/select/index.js +406 -0
  55. package/lib/select_ori/index.js +1 -1
  56. package/lib/switch/index.js +4 -4
  57. package/lib/tabbar/index.d.ts +3 -1
  58. package/lib/tabbar/index.js +14 -8
  59. package/lib/tabbar/item.js +1 -1
  60. package/lib/table/index.d.ts +63 -0
  61. package/lib/table/index.js +260 -0
  62. package/lib/table/types.d.ts +36 -0
  63. package/lib/tabs/index.d.ts +7 -0
  64. package/lib/tabs/index.js +43 -0
  65. package/lib/tag/index.d.ts +16 -0
  66. package/lib/tag/index.js +80 -0
  67. package/lib/theme/index.js +6 -6
  68. package/lib/utils/index.d.ts +6 -28
  69. package/lib/utils/index.js +61 -86
  70. package/lib/utils/popover.d.ts +137 -0
  71. package/lib/utils/popover.js +354 -0
  72. package/lib/utils/transition.js +26 -50
  73. package/package.json +71 -71
  74. package/styles/popover.css +66 -0
  75. package/styles/reset.css +1 -1
  76. package/styles/select.css +37 -0
  77. package/styles/tabs.css +13 -0
  78. package/styles/vars.css +2 -1
  79. package/lib/index-dwS1N2uN.js +0 -4
  80. package/lib/popconfirm/index.d.ts +0 -7
  81. package/lib/popconfirm/index.js +0 -30
  82. package/lib/popover/index.d.ts +0 -34
  83. package/lib/popover/index.js +0 -150
  84. /package/lib/{menu/base.js → table/types.js} +0 -0
@@ -1,23 +1,71 @@
1
- import a from "../base.js";
2
- const l = ":host{--l-desc-panel-min-height: 100px;--l-desc-panel-font-size: 12px;--l-desc-panel-textindent: calc(var(--l-desc-panel-font-size) * 2);display:block;max-height:var(--l-desc-panel-max-height, max-content);color:#1f2937;font-size:var(--l-desc-panel-font-size);position:relative;transition:all .15s linear}";
3
- class o extends a {
1
+ import i from "../base.js";
2
+ import { kebabToCamel as r, parseAttrValue as c } from "../utils/index.js";
3
+ import { $one as n, on as p, shouldEventNext as d, hasClass as h, removeClass as g, addClass as f } from "ph-utils/dom";
4
+ const b = ":host{--l-desc-panel-min-height: 100px;--l-desc-panel-font-size: 14px;--l-desc-panel-textindent: calc(var(--l-desc-panel-font-size) * 2);display:block;max-height:var(--l-desc-panel-max-height, max-content);color:#1f2937;font-size:var(--l-desc-panel-font-size);position:relative;transition:all .15s linear;text-indent:var(--l-desc-panel-textindent);box-sizing:border-box}.content{box-sizing:border-box;border:1px solid transparent}.l-desc-panel-operator{width:100%;padding-top:0;padding-bottom:0;background:transparent;z-index:2;display:flex;justify-content:center;box-sizing:border-box}.l-desc-panel-btnmore{font-size:var(--nt-desc-panel-font-size)}.l-desc-panel-btnmore:before{content:attr(data-text)}.l-desc-panel-arrow{transition:transform .3s ease-in-out;transform:rotate3d(0,0,1,180deg)}:host(.collapse){max-height:var(--l-desc-panel-min-height);overflow-y:hidden}:host(.collapse) .l-desc-panel-operator{position:absolute;left:0;bottom:0;padding-top:65px;background:linear-gradient(-180deg,#fff0,#fff 80%)}:host(.collapse) .l-desc-panel-arrow{transform:rotateX(0)}";
5
+ class y extends i {
4
6
  static baseName = "description-panel";
5
7
  /** 内容折叠后的高度, 默认: 100px */
6
- collapseHeight = "100px";
7
- /** 字体大小, 默认: 12px */
8
- fontSize = "12px";
8
+ collapseHeight = 100;
9
9
  static get observedAttributes() {
10
- return ["collapse-height", "font-size"];
10
+ return ["collapse-height"];
11
11
  }
12
- attributeChangedCallback(e, s, t) {
13
- this[e] = t;
12
+ attributeChangedCallback(e, t, a) {
13
+ e = r(e);
14
+ const o = c(a, this[e]);
15
+ if (o !== this[e])
16
+ switch (this[e] = o, e) {
17
+ case "collapseHeight":
18
+ this.collapseHeight !== 100 ? this.style.setProperty(
19
+ "--l-desc-panel-min-height",
20
+ `${this.collapseHeight}px`
21
+ ) : this.style.removeProperty("--l-desc-panel-min-height");
22
+ break;
23
+ }
14
24
  }
15
25
  connectedCallback() {
16
- this.loadStyleText(l), super.connectedCallback();
26
+ this.loadStyleText(b), super.connectedCallback();
17
27
  }
18
28
  render() {
29
+ return [
30
+ '<div class="content"><slot></slot></div>',
31
+ '<div class="l-desc-panel-operator">',
32
+ '<l-button type="primary" data-action="collapse" class="l-desc-panel-btnmore" text>',
33
+ "<span>查看更多</span>",
34
+ '<l-arrow-down-icon class="l-desc-panel-arrow"></l-arrow-down-icon>',
35
+ "</l-button></div>"
36
+ ].join("");
19
37
  }
38
+ afterInit() {
39
+ this.classList.add("collapse");
40
+ const e = n(".content", this.root);
41
+ let t = n(".l-desc-panel-operator", this.root);
42
+ if (e) {
43
+ let a = e.getBoundingClientRect().height;
44
+ a <= this.collapseHeight && t && (t.remove(), t = null);
45
+ let o = 0;
46
+ if (t) {
47
+ const s = t.getBoundingClientRect().height, l = getComputedStyle(t).getPropertyValue("padding-top");
48
+ o = s - parseInt(l);
49
+ }
50
+ this.style.setProperty(
51
+ "--l-desc-panel-max-height",
52
+ `${a + o}px`
53
+ );
54
+ }
55
+ t && p(t, "click", this.#e);
56
+ }
57
+ #e = (e) => {
58
+ const [t, a, o] = d(
59
+ e,
60
+ "data-action",
61
+ e.currentTarget
62
+ );
63
+ if (t) {
64
+ const s = n("span", o);
65
+ h(this, "collapse") ? (g(this, "collapse"), s && (s.textContent = "收起")) : (f(this, "collapse"), s && (s.textContent = "查看更多"));
66
+ }
67
+ };
20
68
  }
21
69
  export {
22
- o as default
70
+ y as default
23
71
  };
@@ -1,7 +1,7 @@
1
1
  import p from "../base.js";
2
2
  import { $ as d, iterate as c, on as r, off as h, shouldEventNext as g, $one as f, $$ as e, formatClass as u } from "ph-utils/dom";
3
3
  import { initAttr as x } from "../utils/index.js";
4
- const C = ":host{display:block;position:relative}:host(.l-container-close-outside){padding-top:10px;padding-right:10px}.l-dialog-main{box-shadow:0 0 8px #0000001a;border-radius:5px;background-color:#fff}.l-dialog-header{padding:10px;font-size:16px;border-bottom:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-dialog-footer{padding:10px;border-top:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-dialog-container{padding:15px 10px;font-size:14px}.l-btn-dialog-close{--l-form-edit-height: auto;position:absolute}.l-dialog-close1{right:5px;top:6px}.l-dialog-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-dialog-close2{right:0;top:0}.l-dialog-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}";
4
+ const C = ":host{display:block;position:relative}:host(.l-container-close-outside){padding-top:10px;padding-right:10px}.l-dialog-main{box-shadow:0 0 8px #0000001a;border-radius:5px;background-color:#fff}.l-dialog-header{padding:10px;font-size:16px;border-bottom:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-dialog-footer{padding:10px;border-top:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-dialog-container{padding:15px 10px;font-size:14px}.l-btn-dialog-close{--l-form-control-height: auto;position:absolute}.l-dialog-close1{right:5px;top:6px}.l-dialog-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-dialog-close2{right:0;top:0}.l-dialog-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}";
5
5
  class k extends p {
6
6
  static baseName = "dialog-container";
7
7
  /** 是否显示标题栏 */
@@ -7,11 +7,15 @@ export default class FormInner extends BaseComponent {
7
7
  _resetValue?: any;
8
8
  protected _firstPushValue: boolean;
9
9
  private _reseting;
10
+ private _name?;
10
11
  /**
11
12
  *
12
13
  * @param firstPushValue 是否第一次赋值 value 时, 推送数据到 Form, 默认: true
14
+ * @param delegatesFocus 是否委托焦点, 默认: true
13
15
  */
14
- constructor(firstPushValue?: boolean);
16
+ constructor(firstPushValue?: boolean, delegatesFocus?: boolean);
17
+ get name(): string | undefined;
18
+ set name(value: string | undefined);
15
19
  get value(): any;
16
20
  set value(value: any);
17
21
  setValue(value: any): void;
@@ -1,8 +1,7 @@
1
- import o from "../base.js";
2
- import { parseAttrValue as d } from "../utils/index.js";
3
- import { add as l, remove as u, emit as f } from "../utils/event.js";
4
- import { getAttr as m } from "ph-utils/dom";
5
- class _ extends o {
1
+ import n from "../base.js";
2
+ import { parseAttrValue as m } from "../utils/index.js";
3
+ import { add as l, remove as u, emit as d } from "../utils/event.js";
4
+ class b extends n {
6
5
  disabled = !1;
7
6
  formAttrs = {};
8
7
  formItemAttrs = {};
@@ -10,12 +9,20 @@ class _ extends o {
10
9
  _resetValue;
11
10
  _firstPushValue = !0;
12
11
  _reseting = !1;
12
+ _name;
13
13
  /**
14
14
  *
15
15
  * @param firstPushValue 是否第一次赋值 value 时, 推送数据到 Form, 默认: true
16
+ * @param delegatesFocus 是否委托焦点, 默认: true
16
17
  */
17
- constructor(t = !0) {
18
- super(!0, { delegatesFocus: !0 }), this._firstPushValue = t;
18
+ constructor(t = !0, e = !0) {
19
+ super(!0, { delegatesFocus: e }), this._firstPushValue = t;
20
+ }
21
+ get name() {
22
+ return this._name;
23
+ }
24
+ set name(t) {
25
+ this._name = t;
19
26
  }
20
27
  get value() {
21
28
  return this._value;
@@ -30,15 +37,15 @@ class _ extends o {
30
37
  return this._value;
31
38
  }
32
39
  static get observedAttributes() {
33
- return ["disabled", "value"];
40
+ return ["disabled", "value", "name"];
34
41
  }
35
- attributeChangedCallback(t, r, e) {
42
+ attributeChangedCallback(t, e, s) {
36
43
  if (t === "disabled") {
37
- const i = d(e, !1, t);
44
+ const i = m(s, !1, t);
38
45
  i !== this.disabled && (this.disabled = i, this.disabledChange());
39
- } else t === "value" ? this.value = e : this.attributeChange(t, r, e);
46
+ } else t === "value" || t === "name" ? this.value = s : this.attributeChange(t, e, s);
40
47
  }
41
- attributeChange(t, r, e) {
48
+ attributeChange(t, e, s) {
42
49
  }
43
50
  connectedCallback() {
44
51
  const t = this._getForm();
@@ -59,44 +66,43 @@ class _ extends o {
59
66
  return this.disabled === !0 || this.formItemAttrs.disabled === !0 ? !0 : this.formAttrs.disabled || !1;
60
67
  }
61
68
  getName() {
62
- const t = m(this, "name");
63
- return t || this.formItemAttrs.name;
69
+ return this.name ? this.name : this.formItemAttrs.name;
64
70
  }
65
71
  _getForm() {
66
- let t = this.parentElement, r = {}, e = {};
72
+ let t = this.parentElement, e = {}, s = {};
67
73
  for (; t != null; ) {
68
74
  const i = t.tagName;
69
75
  if (i === "L-FORM") {
70
76
  const a = t.sharedAttrs;
71
- for (let s = 0; s < a.length; s++) {
72
- const h = a[s];
73
- r[h] = t[h];
77
+ for (let r = 0; r < a.length; r++) {
78
+ const h = a[r];
79
+ e[h] = t[h];
74
80
  }
75
81
  break;
76
82
  }
77
83
  if (i === "BODY") break;
78
84
  if (i === "L-FORM-ITEM") {
79
85
  const a = t.sharedAttrs;
80
- for (let s = 0; s < a.length; s++) {
81
- const h = a[s];
82
- e[h] = t[h];
86
+ for (let r = 0; r < a.length; r++) {
87
+ const h = a[r];
88
+ s[h] = t[h];
83
89
  }
84
90
  }
85
91
  t = t.parentElement;
86
92
  }
87
93
  return t = null, {
88
- formAttr: r,
89
- formItemAttr: e
94
+ formAttr: e,
95
+ formItemAttr: s
90
96
  };
91
97
  }
92
- _formAttributeChanged = (t, r, e) => {
93
- e === this.formAttrs.formId ? this.formAttrs[t] = r : this.formItemAttrs[t] = r, t === "disabled" && this.disabledChange();
98
+ _formAttributeChanged = (t, e, s) => {
99
+ s === this.formAttrs.formId ? this.formAttrs[t] = e : this.formItemAttrs[t] = e, t === "disabled" && this.disabledChange();
94
100
  };
95
101
  disabledChange() {
96
102
  }
97
103
  pushValueChange() {
98
104
  const t = this.getName();
99
- this.formAttrs.id && t && f(
105
+ this.formAttrs.id && t && d(
100
106
  this.formAttrs.id,
101
107
  "valueChange",
102
108
  t,
@@ -112,5 +118,5 @@ class _ extends o {
112
118
  }
113
119
  }
114
120
  export {
115
- _ as default
121
+ b as default
116
122
  };
@@ -1,9 +1,9 @@
1
- import { $$ as i, $one as s, addClass as n, removeClass as d } from "ph-utils/dom";
1
+ import { $$ as i, $one as o, addClass as n, removeClass as d } from "ph-utils/dom";
2
2
  import { parseAttrValue as h, initAttr as m } from "../utils/index.js";
3
3
  import f from "../base.js";
4
- import { emit as o, add as c, clear as p, remove as b } from "../utils/event.js";
4
+ import { emit as s, add as c, clear as p, remove as b } from "../utils/event.js";
5
5
  import { random as a } from "ph-utils";
6
- const u = ':host{display:var(--l-form-item-display, flex);font-size:14px}.l-form-item__label{text-align:var(--l-form-label-align, right);display:inline-block;width:var(--l-form-label-width, auto);height:var(--l-form-edit-height, 32px);line-height:var(--l-form-edit-height, 32px);color:#606266;padding:0 10px 0 0;box-sizing:border-box}.l-form-item__label:empty{display:var(--l-form-label-empty-display, inline-block)}:host(.is-required) .l-form-item__label:before{content:"*";margin-right:4px;color:var(--l-warn-color, #f56c6c);vertical-align:middle}.l-form-item__content{flex:1;position:relative;display:flex;align-items:center}.l-form-item__error{font-size:12px;line-height:1;position:absolute;top:100%;left:0;color:var(--nt-error-color, #ed3f13);padding-top:3px}:host(.l-form-item--left){--l-form-label-align: left}:host(.l-form-item--top){--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}';
6
+ const u = ':host{display:var(--l-form-item-display, flex);font-size:14px}.l-form-item__label{text-align:var(--l-form-label-align, right);display:inline-block;width:var(--l-form-label-width, auto);height:var(--l-form-control-height, 32px);line-height:var(--l-form-control-height, 32px);color:#606266;padding:0 10px 0 0;box-sizing:border-box}.l-form-item__label:empty{display:var(--l-form-label-empty-display, inline-block)}:host(.is-required) .l-form-item__label:before{content:"*";margin-right:4px;color:var(--l-warn-color, #f56c6c);vertical-align:middle}.l-form-item__content{flex:1;position:relative;display:flex;align-items:center}.l-form-item__error{font-size:12px;line-height:1;position:absolute;top:100%;left:0;color:var(--nt-error-color, #ed3f13);padding-top:3px}:host(.l-form-item--left){--l-form-label-align: left}:host(.l-form-item--top){--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}';
7
7
  class I extends f {
8
8
  static baseName = "form-item";
9
9
  disabled = !1;
@@ -39,7 +39,7 @@ class I extends f {
39
39
  this.label = r, this._updateLabel();
40
40
  else if (e === "disabled") {
41
41
  const l = h(r, !1, e);
42
- l !== this.disabled && (o(this.id, "attributeChanged", e, l, this.id), this.disabled = l);
42
+ l !== this.disabled && (s(this.id, "attributeChanged", e, l, this.id), this.disabled = l);
43
43
  }
44
44
  }
45
45
  connectedCallback() {
@@ -52,7 +52,7 @@ class I extends f {
52
52
  message: this.validity,
53
53
  rules: e
54
54
  };
55
- o(this.formId, "ruleChange", t), c(this.formId, "validateChange", this._validateChange);
55
+ s(this.formId, "ruleChange", t), c(this.formId, "validateChange", this._validateChange);
56
56
  }
57
57
  }
58
58
  disconnectedCallback() {
@@ -60,7 +60,7 @@ class I extends f {
60
60
  }
61
61
  setRules(e) {
62
62
  const t = { ...e, key: this.name };
63
- t.required != null && this.required && (t.required = !0), this.formId && o(this.formId, "ruleChange", t);
63
+ t.required != null && this.required && (t.required = !0), this.formId && s(this.formId, "ruleChange", t);
64
64
  }
65
65
  setError(e) {
66
66
  this.error = e;
@@ -85,19 +85,19 @@ class I extends f {
85
85
  };
86
86
  _updateError() {
87
87
  if (!this.rendered) return;
88
- let e = s(".l-form-item__error", this.root);
88
+ let e = o(".l-form-item__error", this.root);
89
89
  if (e)
90
90
  this.error ? e.textContent = this.error : e.remove();
91
91
  else if (this.error) {
92
92
  e = document.createElement("div"), e.className = "l-form-item__error", e.textContent = this.error;
93
- const t = s(".l-form-item__content", this.root);
93
+ const t = o(".l-form-item__content", this.root);
94
94
  t && t.appendChild(e);
95
95
  }
96
96
  this.error ? n(this, "is-error") : d(this, "is-error");
97
97
  }
98
98
  _updateLabel() {
99
99
  if (!this.rendered) return;
100
- let e = s(".l-form-item__label", this.root);
100
+ let e = o(".l-form-item__label", this.root);
101
101
  e == null ? this.label != null && (e = document.createElement("div"), e.className = "l-form-item__label", e.textContent = this.label, this.root.prepend(e)) : this.label != null ? e.textContent = this.label : e.remove();
102
102
  }
103
103
  _getFormId() {
@@ -0,0 +1,6 @@
1
+ import BaseIcon from "./base";
2
+ export default class Moon extends BaseIcon {
3
+ static baseName: string;
4
+ constructor();
5
+ renderChildren(): string;
6
+ }
@@ -0,0 +1,13 @@
1
+ import a from "./base.js";
2
+ class t extends a {
3
+ static baseName = "d-arrow-left-icon";
4
+ constructor() {
5
+ super(), this.viewBox = "0 0 1024 1024";
6
+ }
7
+ renderChildren() {
8
+ return '<path d="M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"></path>';
9
+ }
10
+ }
11
+ export {
12
+ t as default
13
+ };
@@ -0,0 +1,6 @@
1
+ import BaseIcon from "./base";
2
+ export default class Moon extends BaseIcon {
3
+ static baseName: string;
4
+ constructor();
5
+ renderChildren(): string;
6
+ }
@@ -0,0 +1,13 @@
1
+ import a from "./base.js";
2
+ class t extends a {
3
+ static baseName = "d-arrow-right-icon";
4
+ constructor() {
5
+ super(), this.viewBox = "0 0 1024 1024";
6
+ }
7
+ renderChildren() {
8
+ return '<path d="M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"></path>';
9
+ }
10
+ }
11
+ export {
12
+ t as default
13
+ };
@@ -0,0 +1,6 @@
1
+ import BaseIcon from "./base";
2
+ export default class Moon extends BaseIcon {
3
+ static baseName: string;
4
+ constructor();
5
+ renderChildren(): string;
6
+ }
@@ -0,0 +1,13 @@
1
+ import e from "./base.js";
2
+ class t extends e {
3
+ static baseName = "more-icon";
4
+ constructor() {
5
+ super(), this.viewBox = "0 0 1024 1024";
6
+ }
7
+ renderChildren() {
8
+ return '<path d="M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"></path>';
9
+ }
10
+ }
11
+ export {
12
+ t as default
13
+ };
@@ -0,0 +1,6 @@
1
+ import BaseIcon from "./base";
2
+ export default class Select extends BaseIcon {
3
+ static baseName: string;
4
+ connectedCallback(): void;
5
+ renderChildren(): string;
6
+ }
@@ -0,0 +1,13 @@
1
+ import e from "./base.js";
2
+ class t extends e {
3
+ static baseName = "select-icon";
4
+ connectedCallback() {
5
+ super.connectedCallback();
6
+ }
7
+ renderChildren() {
8
+ return '<path fill="currentColor" d="M77.248 415.04a64 64 0 0 1 90.496 0l226.304 226.304L846.528 188.8a64 64 0 1 1 90.56 90.496l-543.04 543.04-316.8-316.8a64 64 0 0 1 0-90.496z"></path>';
9
+ }
10
+ }
11
+ export {
12
+ t as default
13
+ };
@@ -0,0 +1,6 @@
1
+ import BaseIcon from "./base";
2
+ export default class ZoomIn extends BaseIcon {
3
+ static baseName: string;
4
+ connectedCallback(): void;
5
+ renderChildren(): string;
6
+ }
@@ -0,0 +1,13 @@
1
+ import a from "./base.js";
2
+ class o extends a {
3
+ static baseName = "zoom-in-icon";
4
+ connectedCallback() {
5
+ super.connectedCallback();
6
+ }
7
+ renderChildren() {
8
+ return '<path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"></path>';
9
+ }
10
+ }
11
+ export {
12
+ o as default
13
+ };
@@ -0,0 +1,6 @@
1
+ import BaseIcon from "./base";
2
+ export default class ZoomOut extends BaseIcon {
3
+ static baseName: string;
4
+ connectedCallback(): void;
5
+ renderChildren(): string;
6
+ }
@@ -0,0 +1,13 @@
1
+ import a from "./base.js";
2
+ class t extends a {
3
+ static baseName = "zoom-out-icon";
4
+ connectedCallback() {
5
+ super.connectedCallback();
6
+ }
7
+ renderChildren() {
8
+ return '<path fill="currentColor" d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"></path>';
9
+ }
10
+ }
11
+ export {
12
+ t as default
13
+ };
@@ -0,0 +1,24 @@
1
+ import Mask from "../mask";
2
+ export default class ImagePreview extends Mask {
3
+ static baseName: string;
4
+ urlList: string[];
5
+ currentIndex: number;
6
+ private _scale;
7
+ private _rotate;
8
+ setImages(urlList: string[]): void;
9
+ setCurrentIndex(index: number): void;
10
+ static customAttributes: string[];
11
+ connectedCallback(): void;
12
+ contentRender(): string | HTMLElement | DocumentFragment;
13
+ _generateBtnString(name: string, iconName: string): string;
14
+ _getProgress(): string;
15
+ _getTransformStyleValue(): string;
16
+ private _updateImgAttr;
17
+ private _updateProgress;
18
+ private _resetTransform;
19
+ onAction(action: string): boolean;
20
+ private _handleWhell;
21
+ afterOpened(): void;
22
+ private _transformScale;
23
+ afterClosed(): void;
24
+ }
@@ -0,0 +1,104 @@
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
+ };
@@ -0,0 +1,50 @@
1
+ import BaseComponent from "../base";
2
+ export default class ImageHTML extends BaseComponent {
3
+ static baseName: string;
4
+ alt?: string;
5
+ private _src;
6
+ /** eager - 立即加载图像, lazy - 懒加载 */
7
+ private _loading;
8
+ fit?: "fill" | "contain" | "cover" | "none" | "scale-down";
9
+ width?: string;
10
+ height?: string;
11
+ fallback?: string;
12
+ customFallback?: boolean;
13
+ /** 是否加载错误 */
14
+ isError?: boolean;
15
+ /** 是否禁用图片预览 */
16
+ previewDisabled?: boolean;
17
+ private _previewEl?;
18
+ private _previewImageList?;
19
+ private _previewIndex?;
20
+ private _placeholder?;
21
+ private _imageInner?;
22
+ get src(): string;
23
+ set src(value: string);
24
+ get loading(): "lazy" | "eager";
25
+ set loading(value: "lazy" | "eager");
26
+ get placeholder(): string | undefined;
27
+ set placeholder(value: string);
28
+ get previewImageList(): string[] | undefined;
29
+ set previewImageList(value: string[]);
30
+ get previewIndex(): number | undefined;
31
+ set previewIndex(value: number);
32
+ setPreviewImageList(imageList: string[] | undefined): void;
33
+ setPreviewIndex(index: number): void;
34
+ connectedCallback(): void;
35
+ static get observedAttributes(): string[];
36
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
37
+ render(): HTMLElement;
38
+ private _updateSize;
39
+ afterInit(): void;
40
+ beforeDestroy(): void;
41
+ setIsError(isError?: boolean): void;
42
+ openPreview(): void;
43
+ closePreview(): void;
44
+ private _onError;
45
+ private _onLoad;
46
+ private _onPreviewClosed;
47
+ private _onTap;
48
+ private _clearTmpImg;
49
+ private _loadActualImage;
50
+ }