easy-component-ui 1.0.3 → 2.0.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 (176) hide show
  1. package/.github/workflows/publish.yml +28 -0
  2. package/components/Base.js +1 -90
  3. package/components/ea-alert/index.js +1 -298
  4. package/components/ea-alert/src/style/stylesheet.js +1 -0
  5. package/components/ea-aside/index.js +1 -0
  6. package/components/ea-avatar/index.js +1 -277
  7. package/components/ea-avatar/src/assets/defaultAvatar.js +1 -0
  8. package/components/ea-avatar/src/assets/errorAvatar.js +1 -0
  9. package/components/ea-avatar/src/assets/iconAndTextAvatar.js +1 -0
  10. package/components/ea-avatar/src/style/stylesheet.js +1 -0
  11. package/components/ea-backtop/index.js +1 -232
  12. package/components/ea-backtop/src/style/stylesheet.js +1 -0
  13. package/components/ea-badge/index.js +1 -160
  14. package/components/ea-badge/src/style/stylesheet.js +1 -0
  15. package/components/ea-breadcrumb/index.js +1 -0
  16. package/components/ea-breadcrumb/src/style/stylesheet.js +1 -0
  17. package/components/ea-breadcrumb-item/index.js +1 -0
  18. package/components/ea-breadcrumb-item/src/style/style.js +1 -0
  19. package/components/ea-button/index.js +1 -584
  20. package/components/ea-button/src/components/ButtonComm.js +1 -0
  21. package/components/ea-button/src/components/HrefComm.js +1 -0
  22. package/components/ea-button/src/style/stylesheet.js +1 -0
  23. package/components/ea-button-group/index.js +1 -459
  24. package/components/ea-button-group/src/style/stylesheet.js +1 -0
  25. package/components/ea-calendar/index.js +1 -409
  26. package/components/ea-calendar/src/style/stylesheet.js +1 -0
  27. package/components/ea-calendar/src/utils/createChangerElement.js +1 -0
  28. package/components/ea-calendar/src/utils/createThead.js +1 -0
  29. package/components/ea-calendar/src/utils/getDate.js +1 -0
  30. package/components/ea-calendar/src/utils/getUserWeekStart.js +1 -0
  31. package/components/ea-card/index.js +1 -77
  32. package/components/ea-card/src/style/stylesheet.js +1 -0
  33. package/components/ea-carousel/index.js +1 -434
  34. package/components/ea-carousel/src/style/stylesheet.js +1 -0
  35. package/components/ea-carousel/src/utils/handleIndexOverflow.js +1 -0
  36. package/components/ea-carousel-item/index.js +1 -0
  37. package/components/ea-carousel-item/src/style/stylesheet.js +1 -0
  38. package/components/ea-checkbox/index.js +1 -314
  39. package/components/ea-checkbox/src/style/stylesheet.js +1 -0
  40. package/components/ea-checkbox-group/index.js +1 -107
  41. package/components/ea-checkbox-group/src/style/stylesheet.js +1 -0
  42. package/components/ea-collapse/index.js +1 -293
  43. package/components/ea-collapse-item/index.js +1 -0
  44. package/components/ea-collapse-item/src/style/stylesheet.js +1 -0
  45. package/components/ea-container/index.js +1 -0
  46. package/components/ea-date-picker/index.js +1 -0
  47. package/components/ea-date-picker/src/style/stylesheet.js +1 -0
  48. package/components/ea-descriptions/index.js +1 -240
  49. package/components/ea-descriptions/src/components/contentTemplate.js +1 -0
  50. package/components/ea-descriptions/src/components/getTdTemplate_border.js +1 -0
  51. package/components/ea-descriptions/src/components/getTdTemplate_direction.js +1 -0
  52. package/components/ea-descriptions/src/components/getThTemplate_direction.js +1 -0
  53. package/components/ea-descriptions/src/components/getThTemplate_normal.js +1 -0
  54. package/components/ea-descriptions/src/style/stylesheet.js +1 -0
  55. package/components/ea-descriptions-item/index.js +1 -110
  56. package/components/ea-descriptions-item/src/stylesheet.js +1 -0
  57. package/components/ea-drawer/index.js +1 -0
  58. package/components/ea-drawer/src/style/stylesheet.js +1 -0
  59. package/components/ea-empty/index.js +1 -141
  60. package/components/ea-empty/src/assets/emptyStatusSVG.js +1 -0
  61. package/components/ea-empty/src/style/stylesheet.js +1 -0
  62. package/components/ea-footer/index.js +1 -0
  63. package/components/ea-form/index.js +1 -0
  64. package/components/ea-form-item/index.js +1 -0
  65. package/components/ea-form-item/src/style/stylesheet.js +1 -0
  66. package/components/ea-header/index.js +1 -0
  67. package/components/ea-icon/config.json +1029 -1017
  68. package/components/ea-icon/css/animation.css +85 -85
  69. package/components/ea-icon/css/fontello.css +226 -224
  70. package/components/ea-icon/font/fontello.eot +0 -0
  71. package/components/ea-icon/font/fontello.svg +350 -683
  72. package/components/ea-icon/font/fontello.ttf +0 -0
  73. package/components/ea-icon/font/fontello.woff +0 -0
  74. package/components/ea-icon/font/fontello.woff2 +0 -0
  75. package/components/ea-icon/index.js +1 -47
  76. package/components/ea-image/index.js +1 -412
  77. package/components/ea-image/src/assets/errorImage.js +1 -0
  78. package/components/ea-image/src/style/stylesheet.js +1 -0
  79. package/components/ea-image/src/utils/createPreviewTools.js +1 -0
  80. package/components/ea-infinite-scroll/index.js +1 -170
  81. package/components/ea-infinite-scroll-item/index.js +1 -0
  82. package/components/ea-input/index.js +1 -765
  83. package/components/ea-input/src/components/createFixIcon.js +1 -0
  84. package/components/ea-input/src/components/createSuggestionBoard.js +1 -0
  85. package/components/ea-input/src/components/createWordLimitElement.js +1 -0
  86. package/components/ea-input/src/style/stylesheet.js +1 -0
  87. package/components/ea-input/src/utils/dispatchEvent.js +1 -0
  88. package/components/ea-input/src/utils/handleSearchResult.js +1 -0
  89. package/components/ea-input/src/utils/handleSuggestionBoardTrigger.js +1 -0
  90. package/components/ea-input-number/index.js +1 -458
  91. package/components/ea-input-number/src/style/stylesheet.js +1 -0
  92. package/components/ea-input-number/src/utils/handleCustomEvent.js +1 -0
  93. package/components/ea-link/index.js +1 -200
  94. package/components/ea-link/src/style/stylesheet.js +1 -0
  95. package/components/ea-loading/index.js +1 -218
  96. package/components/ea-loading/src/style/stylesheet.js +1 -0
  97. package/components/ea-main/index.js +1 -0
  98. package/components/ea-menu/index.js +1 -0
  99. package/components/ea-menu/src/style/stylesheet.js +1 -0
  100. package/components/ea-menu/src/utils/handleMenuItemEvent.js +1 -0
  101. package/components/ea-menu-item/index.js +1 -0
  102. package/components/ea-menu-item/src/style/stylesheet.js +1 -0
  103. package/components/ea-menu-item-group/index.js +1 -0
  104. package/components/ea-menu-item-group/src/style/stylesheet.js +1 -0
  105. package/components/ea-message/index.js +1 -233
  106. package/components/ea-message/src/style/stylesheet.js +1 -0
  107. package/components/ea-message/src/utils/MessageClass.js +1 -0
  108. package/components/ea-message-box/index.js +1 -202
  109. package/components/ea-message-box/src/style/stylesheet.js +1 -0
  110. package/components/ea-message-box/src/utils/EaMessageBoxClass.js +1 -0
  111. package/components/ea-option/index.js +1 -0
  112. package/components/ea-option/src/style/stylesheet.js +1 -0
  113. package/components/ea-option-gropu/index.js +1 -0
  114. package/components/ea-page-header/index.js +1 -0
  115. package/components/ea-page-header/src/style/stylesheet.js +1 -0
  116. package/components/ea-pagination/index.js +1 -444
  117. package/components/ea-pagination/src/components/getMoreItem.js +1 -0
  118. package/components/ea-pagination/src/components/getPageItem.js +1 -0
  119. package/components/ea-pagination/src/components/getShowTotalItem.js +1 -0
  120. package/components/ea-pagination/src/style/stylesheet.js +1 -0
  121. package/components/ea-pane/index.js +1 -0
  122. package/components/ea-pane/src/stylesheet.js +1 -0
  123. package/components/ea-progress/index.js +1 -333
  124. package/components/ea-progress/src/components/SVGComm.js +1 -0
  125. package/components/ea-progress/src/style/stylesheet.js +1 -0
  126. package/components/ea-radio/index.js +1 -287
  127. package/components/ea-radio/src/style/stylesheet.js +1 -0
  128. package/components/ea-radio-group/index.js +1 -59
  129. package/components/ea-rate/index.js +1 -326
  130. package/components/ea-rate/src/components/rateComm.js +1 -0
  131. package/components/ea-rate/src/style/stylesheet.js +1 -0
  132. package/components/ea-result/index.js +1 -167
  133. package/components/ea-result/src/style/stylesheet.js +1 -0
  134. package/components/ea-select/index.js +1 -34
  135. package/components/ea-select/src/style/stylesheet.js +1 -0
  136. package/components/ea-skeleton/index.js +1 -341
  137. package/components/ea-skeleton/src/style/stylesheet.js +1 -0
  138. package/components/ea-skeleton/src/utils/createSkeletonElement.js +1 -0
  139. package/components/ea-skeleton-item/index.js +1 -0
  140. package/components/ea-skeleton-item/src/assets/imageSVG.js +1 -0
  141. package/components/ea-skeleton-item/src/style/stylesheet.js +1 -0
  142. package/components/ea-step/index.js +1 -0
  143. package/components/ea-step/src/style/stylesheet.js +1 -0
  144. package/components/ea-steps/index.js +1 -0
  145. package/components/ea-steps/src/style/stylesheet.js +1 -0
  146. package/components/ea-submenu/index.js +1 -0
  147. package/components/ea-submenu/src/style/stylesheet.js +1 -0
  148. package/components/ea-switch/index.js +1 -301
  149. package/components/ea-switch/src/style/stylesheet.js +1 -0
  150. package/components/ea-tab/index.js +1 -0
  151. package/components/ea-tab/src/style/stylesheet.js +1 -0
  152. package/components/ea-table/index.js +1 -0
  153. package/components/ea-table/src/style/stylesheet.js +1 -0
  154. package/components/ea-table-column/index.js +1 -0
  155. package/components/ea-tabs/index.js +1 -0
  156. package/components/ea-tabs/src/style/stylesheet.js +1 -0
  157. package/components/ea-tag/index.js +1 -212
  158. package/components/ea-tag/src/style/stylesheet.js +1 -0
  159. package/components/ea-textarea/index.js +1 -333
  160. package/components/ea-textarea/src/style/stylesheet.js +1 -0
  161. package/components/ea-time-picker/index.js +1 -0
  162. package/components/ea-time-picker/src/style/stylesheet.js +1 -0
  163. package/components/ea-timeline/index.js +1 -334
  164. package/components/ea-timeline/style/stylesheet.js +1 -0
  165. package/components/ea-timeline-item/index.js +1 -0
  166. package/components/ea-timeline-item/src/style/stylesheet.js +1 -0
  167. package/package.json +11 -11
  168. package/utils/Validator.js +1 -0
  169. package/utils/createElement.js +1 -30
  170. package/utils/handleDefaultAttrIsTrue.js +1 -0
  171. package/utils/handleTemplate.js +1 -19
  172. package/utils/setStyle.js +1 -8
  173. package/utils/timeout.js +1 -0
  174. package/components/ea-message/MessageClass.js +0 -71
  175. package/components/ea-message-box/EaMessageBoxClass.js +0 -48
  176. package/components/ea-ui-base-style.css +0 -0
@@ -1,200 +1 @@
1
- // @ts-nocheck
2
- import Base from '../Base.js'
3
- import "../ea-icon/index.js"
4
-
5
- const stylesheet = `
6
- .__ea-link {
7
- text-decoration: none;
8
- color: #606266;
9
- cursor: pointer;
10
- }
11
- .__ea-link:hover {
12
- color: #797b80;
13
- }
14
- .__ea-link.underline:hover {
15
- text-decoration: underline;
16
- }
17
- .__ea-link.primary {
18
- color: #409eff;
19
- }
20
- .__ea-link.primary:hover {
21
- color: #73b8ff;
22
- }
23
- .__ea-link.success {
24
- color: #67c23a;
25
- }
26
- .__ea-link.success:hover {
27
- color: #85cf60;
28
- }
29
- .__ea-link.info {
30
- color: #909399;
31
- }
32
- .__ea-link.info:hover {
33
- color: #abadb1;
34
- }
35
- .__ea-link.warning {
36
- color: #e6a23c;
37
- }
38
- .__ea-link.warning:hover {
39
- color: #ecb869;
40
- }
41
- .__ea-link.danger {
42
- color: #f56c6c;
43
- }
44
- .__ea-link.danger:hover {
45
- color: #f89c9c;
46
- }
47
- .__ea-link.disabled {
48
- color: #c0c4cc;
49
- pointer-events: none;
50
- }
51
- .__ea-link.disabled:hover {
52
- color: #dcdee3;
53
- }
54
- `;
55
-
56
- export class EaLink extends Base {
57
- constructor() {
58
- super();
59
-
60
-
61
- const shadowRoot = this.attachShadow({ mode: 'open' });
62
- let dom = document.createElement('a');;
63
-
64
- const slot = document.createElement('slot');
65
- dom.className = "__ea-link";
66
- dom.appendChild(slot);
67
-
68
- this.dom = dom;
69
-
70
- this.build(shadowRoot, stylesheet);
71
- this.setIconFile(new URL('../ea-icon/index.css', import.meta.url).href);
72
-
73
- shadowRoot.appendChild(dom);
74
- }
75
-
76
- static get observedAttributes() {
77
- return ['disabled'];
78
- }
79
-
80
- get LINK_TYPE() {
81
- return ['primary', 'success', 'info', 'warning', 'danger'];
82
- }
83
-
84
- // ------- href链接 -------
85
- // #region
86
- get href() {
87
- return this.getAttribute('href');
88
- }
89
-
90
- set href(value) {
91
- if (value !== null) this.dom.href = value;
92
- }
93
- // #endregion
94
- // ------- end -------
95
-
96
- // ------- type类型 -------
97
- // #region
98
- get type() {
99
- return this.getAttribute('type');
100
- }
101
-
102
- set type(value) {
103
- if (value === null) return;
104
-
105
- for (let i = 0; i < this.LINK_TYPE.length; i++) {
106
- if (value === this.LINK_TYPE[i]) {
107
- this.dom.classList.add(value);
108
- break;
109
- }
110
- }
111
- }
112
- // #endregion
113
- // ------- end -------
114
-
115
- // ------- disabled禁用状态 -------
116
- // #region
117
- get disabled() {
118
- return this.getAttribute('disabled') === "" || this.getAttribute('disabled') === 'true';
119
- }
120
-
121
- set disabled(value) {
122
- if (!value) return;
123
-
124
- if (value) {
125
- this.dom.classList.add('disabled');
126
- } else {
127
- this.dom.classList.remove('disabled');
128
- }
129
- }
130
- // #endregion
131
- // ------- end -------
132
-
133
- // ------- underline下划线 -------
134
- // #region
135
- get underline() {
136
- return this.getAttribute('underline') === "" || this.getAttribute('underline') === 'true';
137
- }
138
-
139
- set underline(value) {
140
- if (!value) return;
141
-
142
- if (value) {
143
- this.dom.classList.add('underline');
144
- } else {
145
- this.dom.classList.remove('underline');
146
- }
147
- }
148
- // #endregion
149
- // ------- end -------
150
-
151
- // ------- icon图标 -------
152
- // #region
153
- get icon() {
154
- return this.getAttribute('icon');
155
- }
156
-
157
- set icon(value) {
158
- if (value === null || value === "") return;
159
-
160
- const icon = document.createElement('i');
161
- icon.className = value;
162
- this.dom.insertBefore(icon, this.dom.firstChild);
163
- }
164
- // #endregion
165
- // ------- end -------
166
-
167
- init() {
168
- // 设置链接
169
- this.href = this.href;
170
-
171
- // 设置类型
172
- this.type = this.type;
173
-
174
- // 禁用状态
175
- this.disabled = this.disabled;
176
-
177
- // 设置下划线
178
- this.underline = this.underline;
179
-
180
- // 图标
181
- this.icon = this.icon;
182
- }
183
-
184
- connectedCallback() {
185
- this.init();
186
- }
187
-
188
- attributeChangedCallback(name, oldVal, newVal) {
189
- switch (name) {
190
- case 'disabled':
191
- this.disabled = newVal === "" || newVal === 'true' || newVal === true;
192
- break;
193
- default: break;
194
- }
195
- }
196
- }
197
-
198
- if (!window.customElements.get("ea-link")) {
199
- window.customElements.define("ea-link", EaLink);
200
- }
1
+ import Base from"../Base.js";import"../ea-icon/index.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaLink extends Base{#t;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-link" part="container">\n <slot></slot>\n </div>\n ',this.#t=t.querySelector(".ea-link"),this.build(t,stylesheet)}get LINK_TYPE(){return["primary","success","info","warning","danger"]}get href(){return this.getAttribute("href")}set href(t){t&&(this.setAttribute("href",t),this.#t.href=t)}get type(){const t=this.getAttribute("type");return this.LINK_TYPE.includes(t)?t:null}set type(t){t&&this.LINK_TYPE.includes(t)&&this.#t.classList.add(t)}get disabled(){return this.getAttrBoolean("disabled")}set disabled(t){this.setAttribute("disabled",t),this.#t.classList.toggle("disabled",t),this.style.cursor=t?"not-allowed":"pointer"}get underline(){return this.getAttrBoolean("underline")}set underline(t){this.#t.classList.toggle("underline",t)}get icon(){return this.getAttribute("icon")}set icon(t){if(!t)return;const e=document.createElement("ea-icon");e.icon=t,this.#t.insertBefore(e,this.#t.firstChild)}connectedCallback(){this.style.display="inline-block",this.href=this.href,this.type=this.type,this.disabled=this.disabled,this.underline=this.underline,this.icon=this.icon}}window.customElements.get("ea-link")||window.customElements.define("ea-link",EaLink);
@@ -0,0 +1 @@
1
+ export const stylesheet="\n.ea-link {\n text-decoration: none;\n color: #606266;\n cursor: pointer;\n}\n.ea-link:hover {\n color: #797b80;\n}\n.ea-link.underline:hover {\n text-decoration: underline;\n}\n.ea-link.primary {\n color: #409eff;\n}\n.ea-link.primary:hover {\n color: #73b8ff;\n}\n.ea-link.success {\n color: #67c23a;\n}\n.ea-link.success:hover {\n color: #85cf60;\n}\n.ea-link.info {\n color: #909399;\n}\n.ea-link.info:hover {\n color: #abadb1;\n}\n.ea-link.warning {\n color: #e6a23c;\n}\n.ea-link.warning:hover {\n color: #ecb869;\n}\n.ea-link.danger {\n color: #f56c6c;\n}\n.ea-link.danger:hover {\n color: #f89c9c;\n}\n.ea-link.disabled {\n color: #c0c4cc;\n pointer-events: none;\n}\n.ea-link.disabled:hover {\n color: #dcdee3;\n}\n";
@@ -1,218 +1 @@
1
- // @ts-nocheck
2
- import { createElement, createSlotElement } from '../../utils/createElement.js';
3
- import Base from '../Base.js';
4
- import "../ea-icon/index.js"
5
-
6
- const stylesheet = `
7
- .ea-loading_wrap {
8
- position: relative;
9
- }
10
- .ea-loading_wrap i {
11
- opacity: 0;
12
- transition: opacity 0.2s;
13
- color: #409eff;
14
- }
15
- .ea-loading_wrap .ea-loading_text {
16
- color: #409eff;
17
- margin-left: 0.5rem;
18
- }
19
- .ea-loading_wrap.ea-loading_wrap--fullscreen {
20
- position: fixed;
21
- left: 0;
22
- top: 0;
23
- z-index: 999;
24
- width: 100%;
25
- height: 100%;
26
- overflow: hidden;
27
- }
28
- .ea-loading_wrap.ea-loading_wrap--loading .ea-loading_mask {
29
- position: absolute;
30
- top: 0;
31
- left: 0;
32
- display: flex;
33
- justify-content: center;
34
- align-items: center;
35
- width: 100%;
36
- height: 100%;
37
- background-color: hsla(0, 0%, 100%, 0.9);
38
- z-index: 1;
39
- transition: background-color 0.2s;
40
- }
41
- .ea-loading_wrap.ea-loading_wrap--loading .ea-loading_mask i {
42
- opacity: 1;
43
- font-size: 2rem;
44
- }
45
- `;
46
-
47
- export class EaLoading extends Base {
48
- #wrap;
49
-
50
- #loadingWrap;
51
-
52
- #spinner;
53
- constructor() {
54
- super();
55
-
56
- const shadowRoot = this.attachShadow({ mode: 'open' });
57
- const wrap = document.createElement('div');
58
- wrap.className = 'ea-loading_wrap';
59
-
60
- const spinner = createElement('i', 'ea-loading_spinner animate-spin');
61
- const loading = createElement('div', 'ea-loading', spinner);
62
- const loadingWrap = createElement('div', 'ea-loading_mask', loading);
63
- wrap.appendChild(loadingWrap);
64
-
65
- const slot = createSlotElement('')
66
- wrap.appendChild(slot);
67
-
68
- this.#wrap = wrap;
69
- this.#loadingWrap = loadingWrap;
70
- this.#spinner = spinner;
71
-
72
- this.build(shadowRoot, stylesheet);
73
- this.setIconFile(new URL('../ea-icon/index.css', import.meta.url).href);
74
-
75
- this.shadowRoot.appendChild(wrap);
76
- }
77
-
78
- // ------- loading 加载状态 -------
79
- // #region
80
- get loading() {
81
- return this.getAttrBoolean('loading') || false;
82
- }
83
-
84
- set loading(flag) {
85
- this.toggleAttr('loading', flag);
86
-
87
- if (flag) {
88
- this.#wrap.classList.add('ea-loading_wrap--loading');
89
- this.#loadingWrap.style.display = "flex";
90
- } else {
91
- this.#wrap.classList.remove('ea-loading_wrap--loading');
92
- this.#loadingWrap.style.display = "none";
93
- }
94
-
95
- this.handleFullscreen(this.fullscreen, flag, this.lock);
96
- }
97
- // #endregion
98
- // ------- end -------
99
-
100
- // ------- spinner 加载图标 -------
101
- // #region
102
- get spinner() {
103
- return this.getAttribute('spinner') || "icon-spin6";
104
- }
105
-
106
- set spinner(val) {
107
- this.setAttribute('spinner', val);
108
-
109
- this.#spinner.className = `ea-loading_spinner animate-spin ${val}`;
110
- }
111
- // #endregion
112
- // ------- end -------
113
-
114
- // ------- spinner-size 加载图标大小 -------
115
- // #region
116
- get spinnerSize() {
117
- return this.getAttrNumber('spinner-size') || 16;
118
- }
119
-
120
- set spinnerSize(val) {
121
- this.setAttribute('spinner-size', val);
122
-
123
- this.#spinner.style.fontSize = `${val}px`;
124
- }
125
- // #endregion
126
- // ------- end -------
127
-
128
- // ------- background 背景颜色 -------
129
- // #region
130
- get background() {
131
- return this.getAttribute('background') || "hsla(0, 0%, 100%, 0.9)";
132
- }
133
-
134
- set background(val) {
135
- this.setAttribute('background', val);
136
-
137
- this.#loadingWrap.style.backgroundColor = val;
138
- }
139
- // #endregion
140
- // ------- end -------
141
-
142
- // ------- text 文本 -------
143
- // #region
144
- get text() {
145
- return this.getAttribute('text') || "";
146
- }
147
-
148
- set text(val) {
149
- this.setAttribute('text', val);
150
- }
151
- // #endregion
152
- // ------- end -------
153
-
154
- // ------- fullscreen 全屏 -------
155
- // #region
156
- get fullscreen() {
157
- return this.getAttrBoolean('fullscreen') || false;
158
- }
159
-
160
- set fullscreen(val) {
161
- this.setAttribute('fullscreen', val);
162
- }
163
- // #endregion
164
- // ------- end -------
165
-
166
- // ------- lock 全屏是否锁定 -------
167
- // #region
168
- get lock() {
169
- return this.getAttrBoolean('lock') || false;
170
- }
171
-
172
- set lock(val) {
173
- this.setAttribute('lock', val);
174
- }
175
- // #endregion
176
- // ------- end -------
177
-
178
- initTextElement(text) {
179
- const el = createElement('div', 'ea-loading_text');
180
- el.innerHTML = text;
181
- this.#loadingWrap.appendChild(el);
182
- }
183
-
184
- handleFullscreen(isFullscreen, isLoading, isLock) {
185
- if (isFullscreen) {
186
- this.#wrap.classList.toggle('ea-loading_wrap--fullscreen', isLoading);
187
- this.#wrap.style.display = isLoading ? 'block' : 'none';
188
-
189
- if (isLock) document.body.style.overflow = isLoading ? 'hidden' : 'auto';
190
- }
191
- }
192
-
193
- init() {
194
- const that = this;
195
-
196
- this.fullscreen = this.fullscreen;
197
-
198
-
199
-
200
- this.loading = this.loading;
201
-
202
- this.spinnerSize = this.spinnerSize;
203
-
204
- this.spinner = this.spinner;
205
-
206
- this.background = this.background;
207
-
208
- if (this.text) this.initTextElement(this.text);
209
- }
210
-
211
- connectedCallback() {
212
- this.init();
213
- }
214
- }
215
-
216
- if (!customElements.get('ea-loading')) {
217
- customElements.define('ea-loading', EaLoading);
218
- }
1
+ import Base from"../Base.js";import"../ea-icon/index.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaLoading extends Base{#e;#t;#s;constructor(){super();const e=this.attachShadow({mode:"open"});e.innerHTML='\n <div class="ea-loading_wrap" part="container">\n <div class="ea-loading_mask" part="mask-mask">\n <ea-icon icon="icon-spin6 animate-spin" class="ea-loading_spinner" part="icon"></ea-icon>\n </div>\n <slot></slot>\n </div>\n ',this.#e=e.querySelector(".ea-loading_wrap"),this.#t=e.querySelector(".ea-loading_mask"),this.#s=e.querySelector(".ea-loading_spinner"),this.build(e,stylesheet)}get loading(){return this.getAttrBoolean("loading")||!1}set loading(e){this.setAttribute("loading",e),this.#e.classList.toggle("ea-loading_wrap--loading",e),this.#n(this.fullscreen,e,this.lock)}get spinner(){return this.getAttribute("spinner")||"icon-spin6"}set spinner(e){this.setAttribute("spinner",e),this.#s.icon=`${e} animate-spin`}get spinnerSize(){return this.getAttrNumber("spinner-size")||16}set spinnerSize(e){this.setAttribute("spinner-size",e),this.#s.style.fontSize=`${e}px`}get background(){return this.getAttribute("background")||"hsla(0, 0%, 100%, 0.9)"}set background(e){this.setAttribute("background",e),this.#t.style.backgroundColor=e}get text(){return this.getAttribute("text")||""}set text(e){e&&this.setAttribute("text",e)}get fullscreen(){return this.getAttrBoolean("fullscreen")||!1}set fullscreen(e){e&&this.setAttribute("fullscreen",e)}get lock(){return this.getAttrBoolean("lock")||!1}set lock(e){e&&this.setAttribute("lock",e)}#n(e,t,s){e&&(this.#e.classList.toggle("ea-loading_wrap--fullscreen",t),s&&(document.body.style.overflow=t?"hidden":"auto"))}connectedCallback(){if(this.fullscreen=this.fullscreen,this.loading=this.loading,this.spinnerSize=this.spinnerSize,this.spinner=this.spinner,this.background=this.background,this.text){const e=document.createElement("div");e.className="ea-loading_text",e.innerHTML=this.text,this.#t.appendChild(e)}}}customElements.get("ea-loading")||customElements.define("ea-loading",EaLoading);
@@ -0,0 +1 @@
1
+ export const stylesheet="\n.ea-loading_wrap {\n position: relative;\n}\n.ea-loading_wrap .ea-loading_mask {\n position: absolute;\n top: 0;\n left: 0;\n display: none;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n background-color: hsla(0, 0%, 100%, 0.9);\n z-index: 1;\n transition: background-color 0.2s;\n}\n.ea-loading_wrap .ea-loading_spinner,\n.ea-loading_wrap .ea-loading_text {\n color: #409eff;\n}\n.ea-loading_wrap .ea-loading_spinner {\n font-size: 2rem;\n}\n.ea-loading_wrap .ea-loading_text {\n margin-left: 0.5rem;\n}\n.ea-loading_wrap.ea-loading_wrap--fullscreen {\n position: fixed;\n left: 0;\n top: 0;\n z-index: 3000;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n.ea-loading_wrap.ea-loading_wrap--loading .ea-loading_mask {\n display: flex;\n}\n";
@@ -0,0 +1 @@
1
+ import Base from"../Base.js";import"../ea-icon/index.js";const stylesheet="\n.ea-main_wrap {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n padding: 0 20px;\n overflow: auto;\n color: #333;\n}\n";export class EaMain extends Base{constructor(){super();const n=this.attachShadow({mode:"open"});n.innerHTML='\n <main class="ea-main_wrap" part="container">\n <slot></slot>\n </main>\n ',this.build(n,stylesheet)}}customElements.get("ea-main")||customElements.define("ea-main",EaMain);
@@ -0,0 +1 @@
1
+ import{timeout}from"../../utils/timeout.js";import{handleMenuItemEvent}from"./src/utils/handleMenuItemEvent.js";import{stylesheet}from"./src/style/stylesheet.js";import Base from"../Base.js";import"../ea-icon/index.js";import"../ea-menu-item/index.js";import"../ea-submenu/index.js";import"../ea-menu-item-group/index.js";export class EaMenu extends Base{#t;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-menu_wrap" part="container">\n <slot></slot>\n </div>\n ',this.#t=t.querySelector(".ea-menu_wrap"),this.build(t,stylesheet)}get mode(){return this.getAttribute("mode")||"vertical"}set mode(t){this.setAttribute("mode",t),this.#t.classList.toggle("is-vertical","vertical"===t),this.querySelectorAll("ea-submenu").forEach((e=>{e.mode=t}))}get backgroundColor(){return this.getAttribute("background-color")||"#fff"}set backgroundColor(t){this.setAttribute("background-color",t),this.#t.style.backgroundColor=t}get textColor(){return this.getAttribute("text-color")||"#303133"}set textColor(t){this.setAttribute("text-color",t)}get activeTextColor(){return this.getAttribute("active-text-color")||"#409eff"}set activeTextColor(t){this.setAttribute("active-text-color",t)}get collapse(){return this.getAttrBoolean("collapse")}set collapse(t){this.toggleAttr("collapse",t),this.querySelectorAll("ea-menu-item-group").forEach((e=>{"vertical"===this.mode&&(e.collapse=!t)}))}connectedCallback(){this.mode=this.mode,this.collapse=!0,this.backgroundColor=this.backgroundColor,this.textColor=this.textColor,this.activeTextColor=this.activeTextColor;const t=this.querySelectorAll("ea-menu-item"),e=this.querySelectorAll("ea-submenu"),o=this.querySelectorAll("ea-menu-item-group");handleMenuItemEvent.call(this,t,e,o);const r=(t,e)=>{t.backgroundColor=this.backgroundColor,t.textColor=this.textColor,t.activeTextColor=this.activeTextColor};t.forEach(r),e.forEach(r),o.forEach(r)}}customElements.get("ea-menu")||customElements.define("ea-menu",EaMenu);
@@ -0,0 +1 @@
1
+ export const stylesheet="\n.ea-menu_wrap {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 20px;\n}\n.ea-menu_wrap.is-vertical {\n flex-direction: column;\n align-items: flex-start;\n border-right: 1px solid #e6e6e6;\n overflow: auto;\n}\n.ea-menu_wrap.is-vertical ::slotted(ea-menu-item),\n.ea-menu_wrap.is-vertical ::slotted(ea-submenu) {\n width: 100%;\n}\n.ea-menu_wrap.is-vertical ::slotted(ea-submenu) {\n width: 100%;\n}\n";
@@ -0,0 +1 @@
1
+ const callback=e=>{e.actived=!1};function cancelItemActived(e,t,c){e.forEach(callback),t.forEach(callback),c.forEach(callback)}export function handleMenuItemEvent(e,t,c){e.forEach(((a,n)=>{a.itemIndex=n,a.addEventListener("item-selected",(l=>{const i=l.detail.title;cancelItemActived(e,t,c),a.actived=!0,this.dispatchEvent(new CustomEvent("select",{detail:{index:n,title:i}}))}))}))}
@@ -0,0 +1 @@
1
+ import Base from"../Base.js";import"../ea-icon/index.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaMenuItem extends Base{#t;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-menu-item_wrap" part="container">\n <slot></slot>\n </div>\n ',this.#t=t.querySelector(".ea-menu-item_wrap"),this.build(t,stylesheet)}get actived(){return this.getAttrBoolean("actived")}set actived(t){this.setAttribute("actived",t),this.isSubItem?this.#t.classList.toggle("is-sub-actived",t):this.#t.classList.toggle("is-actived",t)}get isSubItem(){return this.getAttrBoolean("is-sub-item")}set isSubItem(t){t&&this.setAttribute("is-sub-item",t)}get backgroundColor(){return this.getAttribute("background-color")||"#fff"}set backgroundColor(t){this.setAttribute("background-color",t),this.#t.style.setProperty("--normal-bgc",t)}get textColor(){return this.getAttribute("text-color")||"#303133"}set textColor(t){this.setAttribute("text-color",t),this.#t.style.setProperty("--normal-text-color",t)}get activeTextColor(){return this.getAttribute("active-text-color")||"#409eff"}set activeTextColor(t){this.setAttribute("active-text-color",t),this.#t.style.setProperty("--actived-text-color",t)}get disabled(){return this.getAttrBoolean("disabled")}set disabled(t){this.setAttribute("disabled",t),this.#t.classList.toggle("is-disabled",t)}connectedCallback(){this.actived=this.actived,this.disabled=this.disabled,this.#t.addEventListener("click",(()=>{this.dispatchEvent(new CustomEvent("item-selected",{detail:{index:this.index,title:this.textContent}}))}))}}customElements.get("ea-menu-item")||customElements.define("ea-menu-item",EaMenuItem);
@@ -0,0 +1 @@
1
+ export const stylesheet="\n.ea-menu-item_wrap {\n --normal-bgc: #fff;\n --normal-text-color: #303133;\n --actived-text-color: #409eff;\n --actived-bgc: #fff;\n box-sizing: border-box;\n padding: 0 20px;\n border-bottom: 2px solid;\n border-color: transparent;\n height: 60px;\n line-height: 60px;\n font-size: 14px;\n color: var(--normal-text-color);\n background-color: var(--normal-bgc);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n cursor: pointer;\n transition: border-color 0.3s, background-color 0.3s, color 0.3s;\n}\n.ea-menu-item_wrap.is-actived {\n color: var(--actived-text-color);\n border-color: var(--actived-text-color);\n}\n.ea-menu-item_wrap.is-actived ::slotted(a) {\n color: var(--actived-text-color);\n}\n.ea-menu-item_wrap.is-sub-actived {\n color: var(--actived-text-color);\n}\n.ea-menu-item_wrap.is-sub-actived ::slotted(a) {\n color: var(--actived-text-color);\n}\n.ea-menu-item_wrap.is-disabled {\n color: #c0c4cc;\n pointer-events: none;\n cursor: not-allowed;\n}\n.ea-menu-item_wrap.is-disabled ::slotted(a) {\n color: #c0c4cc;\n}\n.ea-menu-item_wrap ::slotted(a) {\n color: var(--normal-text-color);\n text-decoration: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n";
@@ -0,0 +1 @@
1
+ import Base from"../Base.js";import"../ea-icon/index.js";import{timeout}from"../../utils/timeout.js";import{stylesheet}from"./src/style/stylesheet.js";export class EaMenuItemGroup extends Base{#t;#e;#s;constructor(){super();const t=this.attachShadow({mode:"open"});t.innerHTML='\n <div class="ea-menu-item-group_wrap" part="container">\n <div class="ea-submenu_title_wrap" part="title-wrap">\n <slot name="title"></slot>\n <ea-icon class="ea-submenu_dropdown_icon" icon="icon-angle-down" part="dropdown-icon"></ea-icon>\n </div>\n <div class="ea-submenu_items_wrap" part="dropdown-wrap">\n <slot></slot>\n </div>\n </div>\n ',this.#t=t.querySelector(".ea-menu-item-group_wrap"),this.#e=t.querySelector(".ea-submenu_title_wrap"),this.#s=t.querySelector(".ea-submenu_items_wrap"),this.build(t,stylesheet)}get actived(){return this.getAttrBoolean("actived")}set actived(t){this.setAttribute("actived",t),this.#t.classList.toggle("is-actived",t)}get backgroundColor(){return this.getAttribute("background-color")||"#fff"}set backgroundColor(t){this.setAttribute("background-color",t),this.#t.style.setProperty("--normal-bgc",t)}get textColor(){return this.getAttribute("text-color")||"#303133"}set textColor(t){this.setAttribute("text-color",t),this.#t.style.setProperty("--normal-text-color",t)}get activeTextColor(){return this.getAttribute("active-text-color")||"#409eff"}set activeTextColor(t){this.setAttribute("active-text-color",t),this.#t.style.setProperty("--actived-text-color",t)}get collapse(){return this.getAttrBoolean("collapse")||!1}set collapse(t){this.setAttribute("collapse",t),this.#s.style.height=t?this.#s.scrollHeight+"px":"0",this.#t.classList.toggle("is-open",t)}connectedCallback(){this.style.width="100%";this.querySelectorAll("ea-menu-item").forEach((t=>{t.isSubItem=!0,t.addEventListener("item-selected",(t=>{timeout((()=>{this.actived=!0}),20)}))})),this.#e.addEventListener("click",(t=>{this.collapse=!this.collapse}))}}customElements.get("ea-menu-item-group")||customElements.define("ea-menu-item-group",EaMenuItemGroup);
@@ -0,0 +1 @@
1
+ export const stylesheet="\n.ea-menu-item-group_wrap {\n --normal-bgc: #fff;\n --normal-text-color: #303133;\n --actived-text-color: #409eff;\n --actived-bgc: #fff;\n width: 100%;\n}\n.ea-menu-item-group_wrap.is-actived .ea-submenu_title_wrap {\n color: var(--actived-text-color);\n border-color: var(--actived-text-color);\n}\n.ea-menu-item-group_wrap .ea-submenu_title_wrap {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n box-sizing: border-box;\n padding: 0 20px;\n border-bottom: 2px solid;\n border-color: transparent;\n height: 60px;\n line-height: 60px;\n font-size: 14px;\n color: var(--normal-text-color);\n background-color: var(--normal-bgc);\n white-space: nowrap;\n cursor: pointer;\n transition: border-color 0.3s, background-color 0.3s, color 0.3s;\n}\n.ea-menu-item-group_wrap .ea-submenu_items_wrap {\n margin: 0 20px;\n height: 0;\n overflow: hidden;\n transition: height 0.3s;\n}\n.ea-menu-item-group_wrap .ea-submenu_dropdown_icon {\n transform: rotate(-90deg);\n transition: transform 0.3s;\n}\n.ea-menu-item-group_wrap.is-open .ea-submenu_dropdown_icon {\n transform: rotate(0deg);\n}\n";