godown 1.1.4 → 1.1.6

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 (179) hide show
  1. package/README.md +35 -35
  2. package/conf.d.ts +18 -18
  3. package/conf.js +22 -22
  4. package/deps.d.ts +7 -7
  5. package/deps.js +7 -7
  6. package/effect/index.d.ts +3 -3
  7. package/effect/index.js +3 -3
  8. package/effect/ov-effect.d.ts +23 -23
  9. package/effect/ov-effect.d.ts.map +1 -1
  10. package/effect/ov-effect.js +299 -275
  11. package/effect/ro-effect.d.ts +19 -19
  12. package/effect/ro-effect.d.ts.map +1 -1
  13. package/effect/ro-effect.js +125 -120
  14. package/effect/std.d.ts +3 -3
  15. package/effect/std.d.ts.map +1 -1
  16. package/effect/std.js +3 -3
  17. package/effect/tw-effect.d.ts +21 -21
  18. package/effect/tw-effect.d.ts.map +1 -1
  19. package/effect/tw-effect.js +108 -107
  20. package/glob.d.ts +8 -8
  21. package/glob.d.ts.map +1 -1
  22. package/glob.js +25 -24
  23. package/group/avatar-group.d.ts +20 -20
  24. package/group/avatar-group.d.ts.map +1 -1
  25. package/group/avatar-group.js +112 -88
  26. package/group/button-group.d.ts +12 -12
  27. package/group/button-group.d.ts.map +1 -1
  28. package/group/button-group.js +79 -74
  29. package/group/details-group.d.ts +16 -16
  30. package/group/details-group.d.ts.map +1 -1
  31. package/group/details-group.js +55 -53
  32. package/group/index.d.ts +3 -3
  33. package/group/index.js +3 -3
  34. package/group/std.d.ts +3 -3
  35. package/group/std.d.ts.map +1 -1
  36. package/group/std.js +3 -3
  37. package/index.d.ts +7 -7
  38. package/index.js +7 -7
  39. package/input-form/base-input.d.ts +32 -32
  40. package/input-form/base-input.d.ts.map +1 -1
  41. package/input-form/base-input.js +229 -226
  42. package/input-form/exp-input.d.ts +22 -22
  43. package/input-form/exp-input.d.ts.map +1 -1
  44. package/input-form/exp-input.js +218 -205
  45. package/input-form/index.d.ts +8 -8
  46. package/input-form/index.js +8 -8
  47. package/input-form/label-input.d.ts +21 -21
  48. package/input-form/label-input.d.ts.map +1 -1
  49. package/input-form/label-input.js +150 -137
  50. package/input-form/search-input.d.ts +36 -36
  51. package/input-form/search-input.d.ts.map +1 -1
  52. package/input-form/search-input.js +311 -297
  53. package/input-form/select-input.d.ts +31 -31
  54. package/input-form/select-input.d.ts.map +1 -1
  55. package/input-form/select-input.js +354 -330
  56. package/input-form/sign-form.d.ts +25 -23
  57. package/input-form/sign-form.d.ts.map +1 -1
  58. package/input-form/sign-form.js +165 -160
  59. package/input-form/split-input.d.ts +26 -26
  60. package/input-form/split-input.d.ts.map +1 -1
  61. package/input-form/split-input.js +181 -173
  62. package/input-form/std.d.ts +19 -19
  63. package/input-form/std.d.ts.map +1 -1
  64. package/input-form/std.js +72 -68
  65. package/input-form/switch-input.d.ts +22 -22
  66. package/input-form/switch-input.d.ts.map +1 -1
  67. package/input-form/switch-input.js +181 -175
  68. package/items/alert-item.d.ts +16 -16
  69. package/items/alert-item.d.ts.map +1 -1
  70. package/items/alert-item.js +143 -142
  71. package/items/avatar-anchor.d.ts +19 -19
  72. package/items/avatar-anchor.d.ts.map +1 -1
  73. package/items/avatar-anchor.js +150 -148
  74. package/items/base-button.d.ts +16 -16
  75. package/items/base-button.d.ts.map +1 -1
  76. package/items/base-button.js +170 -167
  77. package/items/dialog-item.d.ts +24 -24
  78. package/items/dialog-item.d.ts.map +1 -1
  79. package/items/dialog-item.js +157 -156
  80. package/items/index.d.ts +7 -7
  81. package/items/index.js +7 -7
  82. package/items/link-a.d.ts +19 -19
  83. package/items/link-a.d.ts.map +1 -1
  84. package/items/link-a.js +98 -97
  85. package/items/load-track.d.ts +20 -20
  86. package/items/load-track.d.ts.map +1 -1
  87. package/items/load-track.js +115 -109
  88. package/items/std.d.ts +3 -3
  89. package/items/std.d.ts.map +1 -1
  90. package/items/std.js +3 -3
  91. package/items/super-a.d.ts +15 -15
  92. package/items/super-a.d.ts.map +1 -1
  93. package/items/super-a.js +99 -88
  94. package/layout/div-line.d.ts +15 -15
  95. package/layout/div-line.d.ts.map +1 -1
  96. package/layout/div-line.js +71 -65
  97. package/layout/drag-box.d.ts +25 -25
  98. package/layout/drag-box.d.ts.map +1 -1
  99. package/layout/drag-box.js +95 -94
  100. package/layout/flex-flow.d.ts +13 -13
  101. package/layout/flex-flow.d.ts.map +1 -1
  102. package/layout/flex-flow.js +39 -34
  103. package/layout/index.d.ts +5 -5
  104. package/layout/index.js +5 -5
  105. package/layout/nav-aside.d.ts +13 -13
  106. package/layout/nav-aside.d.ts.map +1 -1
  107. package/layout/nav-aside.js +61 -54
  108. package/layout/nav-layout.d.ts +16 -16
  109. package/layout/nav-layout.d.ts.map +1 -1
  110. package/layout/nav-layout.js +167 -146
  111. package/layout/std.d.ts +4 -4
  112. package/layout/std.d.ts.map +1 -1
  113. package/layout/std.js +10 -8
  114. package/package.json +48 -40
  115. package/react/effect.d.ts +9 -9
  116. package/react/effect.d.ts.map +1 -1
  117. package/react/effect.js +33 -33
  118. package/react/group.d.ts +4 -4
  119. package/react/group.d.ts.map +1 -1
  120. package/react/group.js +19 -19
  121. package/react/index.d.ts +7 -7
  122. package/react/index.d.ts.map +1 -1
  123. package/react/index.js +7 -7
  124. package/react/input-form.d.ts +32 -32
  125. package/react/input-form.d.ts.map +1 -1
  126. package/react/input-form.js +65 -65
  127. package/react/items.d.ts +8 -8
  128. package/react/items.d.ts.map +1 -1
  129. package/react/items.js +39 -39
  130. package/react/layout.d.ts +6 -6
  131. package/react/layout.d.ts.map +1 -1
  132. package/react/layout.js +29 -29
  133. package/react/view.d.ts +6 -6
  134. package/react/view.d.ts.map +1 -1
  135. package/react/view.js +29 -29
  136. package/view/details-expand.d.ts +18 -18
  137. package/view/details-expand.d.ts.map +1 -1
  138. package/view/details-expand.js +85 -80
  139. package/view/down-drop.d.ts +18 -18
  140. package/view/down-drop.d.ts.map +1 -1
  141. package/view/down-drop.js +98 -94
  142. package/view/index.d.ts +5 -5
  143. package/view/index.js +5 -5
  144. package/view/menu-list.d.ts +16 -16
  145. package/view/menu-list.d.ts.map +1 -1
  146. package/view/menu-list.js +77 -72
  147. package/view/route-view.d.ts +57 -57
  148. package/view/route-view.d.ts.map +1 -1
  149. package/view/route-view.js +261 -258
  150. package/view/scroll-x.d.ts +14 -14
  151. package/view/scroll-x.d.ts.map +1 -1
  152. package/view/scroll-x.js +77 -72
  153. package/view/std.d.ts +4 -4
  154. package/view/std.d.ts.map +1 -1
  155. package/view/std.js +37 -37
  156. package/with.d.ts +27 -27
  157. package/with.d.ts.map +1 -1
  158. package/with.js +77 -78
  159. package/view/react/effect.d.ts +0 -10
  160. package/view/react/effect.d.ts.map +0 -1
  161. package/view/react/effect.js +0 -32
  162. package/view/react/group.d.ts +0 -5
  163. package/view/react/group.d.ts.map +0 -1
  164. package/view/react/group.js +0 -18
  165. package/view/react/index.d.ts +0 -7
  166. package/view/react/index.d.ts.map +0 -1
  167. package/view/react/index.js +0 -6
  168. package/view/react/input-form.d.ts +0 -33
  169. package/view/react/input-form.d.ts.map +0 -1
  170. package/view/react/input-form.js +0 -64
  171. package/view/react/items.d.ts +0 -9
  172. package/view/react/items.d.ts.map +0 -1
  173. package/view/react/items.js +0 -38
  174. package/view/react/layout.d.ts +0 -7
  175. package/view/react/layout.d.ts.map +0 -1
  176. package/view/react/layout.js +0 -28
  177. package/view/react/view.d.ts +0 -7
  178. package/view/react/view.d.ts.map +0 -1
  179. package/view/react/view.js +0 -28
@@ -1,330 +1,354 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { html, css, property, query, state, define, conf, cssvar } from '../deps.js';
8
- import STD from './std.js';
9
- let SelectInput = class SelectInput extends STD {
10
- constructor() {
11
- super(...arguments);
12
- this.open = false;
13
- this.selcls = `${conf.tag('select-input')}-selected`;
14
- this.pla = undefined;
15
- this.only = false;
16
- this.def = "";
17
- this.value = [];
18
- this.name = "select";
19
- this.text = [];
20
- this.autofocus = false;
21
- }
22
- get assigned() {
23
- return this.shadowRoot.querySelector('slot').assignedElements();
24
- }
25
- render() {
26
- return html `<div><section>${this.lists()}</section>
27
- <input id="input" @focus=${() => { this.open = true; }} @input=${this._handleInput} placeholder=${this.pla} />
28
- <label for="input"><svg viewBox="0 0 48 48" fill="none"><path d="M36 19L24 31L12 19H36Z" fill="currentColor" stroke="currentColor" stroke-width="3" stroke-linejoin="round"/></svg></label>
29
- <aside ?open=${this.open}><slot></slot></aside>
30
- </div>`;
31
- }
32
- lists() {
33
- var itemTemplates = [];
34
- if (this.value.length)
35
- for (const i in this.value) {
36
- itemTemplates.push(html `<i class="selected-item">${this.text[i] || this.value[i]}
37
- <svg @click=${() => { this.select(this.value[i]); }} t="1678769821062" viewBox="0 0 1024 1024" version="1.1" p-id="2770"><path d="M960 512c0-249.6-198.4-448-448-448S64 262.4 64 512s198.4 448 448 448 448-198.4 448-448zM691.2 736L512 556.8 332.8 736c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L467.2 512 288 332.8c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0L512 467.2 691.2 288c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L556.8 512 736 691.2c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0z" fill="currentColor" p-id="2771"></path></svg>
38
- </i>`);
39
- }
40
- return itemTemplates;
41
- }
42
- _focusCheck() {
43
- var _a;
44
- if (this.autofocus) {
45
- (_a = this._input) === null || _a === void 0 ? void 0 : _a.focus();
46
- this.open = true;
47
- }
48
- }
49
- focus(options) {
50
- var _a;
51
- (_a = this._input) === null || _a === void 0 ? void 0 : _a.focus(options);
52
- this.open = true;
53
- }
54
- firstUpdated() {
55
- this._focusCheck();
56
- this.assigned.forEach((option) => {
57
- if (option.value) {
58
- option.addEventListener("click", () => {
59
- this.select(option.value, option.innerText);
60
- });
61
- }
62
- else if (option.children) {
63
- [...option.children].forEach(option => {
64
- option.addEventListener("click", () => {
65
- this.select(option.value, option.innerText);
66
- });
67
- });
68
- }
69
- });
70
- this.addEventListener("change", (e) => {
71
- this.open = !this.only;
72
- });
73
- document.addEventListener("click", (e) => {
74
- if (!this.contains(e.target)) {
75
- this.open = false;
76
- }
77
- });
78
- }
79
- select(value, text) {
80
- if (text === undefined || text === null) {
81
- this.assigned.forEach((option) => {
82
- if (option.value) {
83
- if (option.value == value) {
84
- text = option.innerText;
85
- }
86
- }
87
- else if (option.children) {
88
- [...option.children].forEach(option => {
89
- if (option.value == value) {
90
- text = option.innerText;
91
- }
92
- });
93
- }
94
- });
95
- }
96
- if (this.value.includes(value)) {
97
- if (!this.only) {
98
- this.value = this.value.filter(v => v != value);
99
- this.text = this.text.filter(v => v != text);
100
- }
101
- else {
102
- this.value = [];
103
- this.text = [];
104
- }
105
- }
106
- else {
107
- if (!this.only) {
108
- this.value.push(value);
109
- this.text.push(text);
110
- }
111
- else {
112
- this.value = [value];
113
- this.text = [text];
114
- }
115
- }
116
- this.assigned.forEach((option) => {
117
- if (option.value) {
118
- if (this.value.includes(option.value)) {
119
- option.classList.add(this.selcls);
120
- }
121
- else {
122
- option.classList.remove(this.selcls);
123
- }
124
- }
125
- else if (option.children) {
126
- [...option.children].forEach(option => {
127
- if (this.value.includes(option.value)) {
128
- option.classList.add(this.selcls);
129
- }
130
- else {
131
- option.classList.remove(this.selcls);
132
- }
133
- });
134
- }
135
- });
136
- this._input.value = "";
137
- this.dispatchEvent(new CustomEvent("change", { detail: this.namevalue() }));
138
- this.requestUpdate();
139
- }
140
- _handleInput() {
141
- let value = this._input.value.trim();
142
- if (!this.only && value.includes(";")) {
143
- value = value.split(";").pop().trim();
144
- }
145
- this.assigned.forEach(option => {
146
- if (option.value) {
147
- option.style.display = "block";
148
- }
149
- if (option.children) {
150
- option.style.display = "block";
151
- [...option.children].forEach(option => {
152
- option.style.display = "block";
153
- });
154
- }
155
- });
156
- if (value) {
157
- this.assigned.forEach(option => {
158
- if (option.value) {
159
- if (option.value.toLowerCase().includes(value.toLowerCase()) || option.innerText.toLowerCase().includes(value.toLowerCase())) {
160
- option.style.display = "block";
161
- }
162
- else {
163
- option.style.display = "none";
164
- }
165
- }
166
- else if (option.children) {
167
- [...option.children].forEach(option => {
168
- if (option.value.toLowerCase().includes(value.toLowerCase()) || option.innerText.toLowerCase().includes(value.toLowerCase())) {
169
- option.style.display = "block";
170
- }
171
- else {
172
- option.style.display = "none";
173
- }
174
- });
175
- if ([...option.children].filter(option => option.style.display == "block").length == 0) {
176
- option.style.display = "none";
177
- }
178
- }
179
- });
180
- }
181
- this.dispatchEvent(new CustomEvent("input", { detail: this.namevalue() }));
182
- }
183
- namevalue() {
184
- if (!this.only) {
185
- return [this.name, this.value];
186
- }
187
- return [this.name, this.value[0]];
188
- }
189
- reset() {
190
- this.value = [];
191
- this.text = [];
192
- this._input.value = "";
193
- this.assigned.forEach((option) => {
194
- if (option.value) {
195
- option.classList.remove(this.selcls);
196
- }
197
- else if (option.children) {
198
- [...option.children].forEach(option => {
199
- option.classList.remove(this.selcls);
200
- });
201
- }
202
- });
203
- if (this.def) {
204
- if (!this.only) {
205
- this.def.split(";").forEach(def => {
206
- if (def.trim())
207
- this.select(def.trim(), null);
208
- });
209
- }
210
- else {
211
- if (this.def.split(";")[0].trim())
212
- this.select(this.def.split(";")[0].trim(), null);
213
- }
214
- }
215
- }
216
- };
217
- SelectInput.styles = [STD.styles, css `
218
- :host{
219
- background:var(${cssvar}--input-background);
220
- color:var(${cssvar}--text);
221
- display: inline-flex;
222
- outline: .145em solid transparent;
223
- border-radius: 0.25em;
224
- height: 1.5em;
225
- width: var(${cssvar}--input-width);
226
- }
227
- :host([open]){
228
- outline-color: var(${cssvar}--input-outline-focus);
229
- }
230
- input{
231
- padding: 0px 0px 0px 0.25em;
232
- background: none;
233
- cursor:inherit;
234
- height:100%;
235
- width: 100%;
236
- box-sizing: border-box;
237
- border:inherit;
238
- outline: none;
239
- border-radius:inherit;
240
- flex:1;
241
- }
242
- div{
243
- display: inline-flex;
244
- position: relative;
245
- width: 100%;
246
- border-radius:inherit;
247
- z-index: inherit;
248
- }
249
- label svg{
250
- height: 100%;
251
- }
252
- aside{
253
- margin-top: 1px;
254
- position: absolute;
255
- top:100%;
256
- width: 100%;
257
- visibility: hidden;
258
- z-index: 1;
259
- border-radius:inherit;
260
- }
261
- section{
262
- max-width:calc(100% - 1.2em);
263
- height: 100%;
264
- overflow: hidden;
265
- pointer-events: none;
266
- border-radius:inherit;
267
- z-index: inherit;
268
- }
269
- i.selected-item{
270
- background:var(${cssvar}--input-true);
271
- border-radius:inherit;
272
- height: 100%;
273
- float:left;
274
- display: inline-flex;
275
- font-style: normal;
276
- align-items: center;
277
- padding-left: .1em;
278
- margin-left: 0.065em;
279
- }
280
- i:first-child{
281
- margin-left: 0;
282
- }
283
- i.selected-item svg{
284
- width: 1em;
285
- padding: 0 .12em;
286
- height:.8em;
287
- pointer-events: all;
288
- }
289
- aside[open]{
290
- visibility: visible;
291
- }
292
- `];
293
- __decorate([
294
- property({ type: Boolean, reflect: true })
295
- ], SelectInput.prototype, "open", void 0);
296
- __decorate([
297
- property()
298
- ], SelectInput.prototype, "selcls", void 0);
299
- __decorate([
300
- property()
301
- ], SelectInput.prototype, "pla", void 0);
302
- __decorate([
303
- property({ type: Boolean })
304
- ], SelectInput.prototype, "only", void 0);
305
- __decorate([
306
- property()
307
- ], SelectInput.prototype, "def", void 0);
308
- __decorate([
309
- property({ type: Array })
310
- ], SelectInput.prototype, "value", void 0);
311
- __decorate([
312
- property()
313
- ], SelectInput.prototype, "name", void 0);
314
- __decorate([
315
- state()
316
- ], SelectInput.prototype, "text", void 0);
317
- __decorate([
318
- property({ type: Boolean })
319
- ], SelectInput.prototype, "autofocus", void 0);
320
- __decorate([
321
- query('input')
322
- ], SelectInput.prototype, "_input", void 0);
323
- __decorate([
324
- query('aside')
325
- ], SelectInput.prototype, "_aside", void 0);
326
- SelectInput = __decorate([
327
- define('select-input')
328
- ], SelectInput);
329
- export { SelectInput };
330
- export default SelectInput;
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { html, css, property, query, state, define, conf, cssvar } from "../deps.js";
8
+ import STD from "./std.js";
9
+ let SelectInput = class SelectInput extends STD {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.open = false;
13
+ this.selcls = `${conf.tag("select-input")}-selected`;
14
+ this.pla = undefined;
15
+ this.only = false;
16
+ this.def = "";
17
+ this.value = [];
18
+ this.name = "select";
19
+ this.text = [];
20
+ this.autofocus = false;
21
+ }
22
+ get assigned() {
23
+ return this.shadowRoot.querySelector("slot").assignedElements();
24
+ }
25
+ render() {
26
+ return html `<div>
27
+ <section>${this.lists()}</section>
28
+ <input
29
+ id="input"
30
+ @focus=${() => {
31
+ this.open = true;
32
+ }}
33
+ @input=${this._handleInput}
34
+ placeholder=${this.pla}
35
+ />
36
+ <label for="input">
37
+ <svg viewBox="0 0 48 48" fill="none"><path d="M36 19L24 31L12 19H36Z" fill="currentColor" stroke="currentColor" stroke-width="3" stroke-linejoin="round" /></svg>
38
+ </label>
39
+ <aside ?open=${this.open}><slot></slot></aside>
40
+ </div>`;
41
+ }
42
+ lists() {
43
+ const itemTemplates = [];
44
+ if (this.value.length)
45
+ for (const i in this.value) {
46
+ itemTemplates.push(html `<i class="selected-item">
47
+ ${this.text[i] || this.value[i]}
48
+ <svg
49
+ @click=${() => {
50
+ this.select(this.value[i]);
51
+ }}
52
+ t="1678769821062"
53
+ viewBox="0 0 1024 1024"
54
+ version="1.1"
55
+ p-id="2770"
56
+ >
57
+ <path d="M960 512c0-249.6-198.4-448-448-448S64 262.4 64 512s198.4 448 448 448 448-198.4 448-448zM691.2 736L512 556.8 332.8 736c-12.8 12.8-32 12.8-44.8 0-12.8-12.8-12.8-32 0-44.8L467.2 512 288 332.8c-12.8-12.8-12.8-32 0-44.8 12.8-12.8 32-12.8 44.8 0L512 467.2 691.2 288c12.8-12.8 32-12.8 44.8 0 12.8 12.8 12.8 32 0 44.8L556.8 512 736 691.2c12.8 12.8 12.8 32 0 44.8-12.8 12.8-32 12.8-44.8 0z" fill="currentColor" p-id="2771"></path>
58
+ </svg>
59
+ </i>`);
60
+ }
61
+ return itemTemplates;
62
+ }
63
+ _focusCheck() {
64
+ var _a;
65
+ if (this.autofocus) {
66
+ (_a = this._input) === null || _a === void 0 ? void 0 : _a.focus();
67
+ this.open = true;
68
+ }
69
+ }
70
+ focus(options) {
71
+ var _a;
72
+ (_a = this._input) === null || _a === void 0 ? void 0 : _a.focus(options);
73
+ this.open = true;
74
+ }
75
+ firstUpdated() {
76
+ this._focusCheck();
77
+ this.assigned.forEach((option) => {
78
+ if (option.value) {
79
+ option.addEventListener("click", () => {
80
+ this.select(option.value, option.innerText);
81
+ });
82
+ }
83
+ else if (option.children) {
84
+ [...option.children].forEach((option) => {
85
+ option.addEventListener("click", () => {
86
+ this.select(option.value, option.innerText);
87
+ });
88
+ });
89
+ }
90
+ });
91
+ this.addEventListener("change", (e) => {
92
+ this.open = !this.only;
93
+ });
94
+ document.addEventListener("click", (e) => {
95
+ if (!this.contains(e.target)) {
96
+ this.open = false;
97
+ }
98
+ });
99
+ }
100
+ select(value, text) {
101
+ if (text === undefined || text === null) {
102
+ this.assigned.forEach((option) => {
103
+ if (option.value) {
104
+ if (option.value == value) {
105
+ text = option.innerText;
106
+ }
107
+ }
108
+ else if (option.children) {
109
+ [...option.children].forEach((option) => {
110
+ if (option.value == value) {
111
+ text = option.innerText;
112
+ }
113
+ });
114
+ }
115
+ });
116
+ }
117
+ if (this.value.includes(value)) {
118
+ if (!this.only) {
119
+ this.value = this.value.filter((v) => v != value);
120
+ this.text = this.text.filter((v) => v != text);
121
+ }
122
+ else {
123
+ this.value = [];
124
+ this.text = [];
125
+ }
126
+ }
127
+ else {
128
+ if (!this.only) {
129
+ this.value.push(value);
130
+ this.text.push(text);
131
+ }
132
+ else {
133
+ this.value = [value];
134
+ this.text = [text];
135
+ }
136
+ }
137
+ this.assigned.forEach((option) => {
138
+ if (option.value) {
139
+ if (this.value.includes(option.value)) {
140
+ option.classList.add(this.selcls);
141
+ }
142
+ else {
143
+ option.classList.remove(this.selcls);
144
+ }
145
+ }
146
+ else if (option.children) {
147
+ [...option.children].forEach((option) => {
148
+ if (this.value.includes(option.value)) {
149
+ option.classList.add(this.selcls);
150
+ }
151
+ else {
152
+ option.classList.remove(this.selcls);
153
+ }
154
+ });
155
+ }
156
+ });
157
+ this._input.value = "";
158
+ this.dispatchEvent(new CustomEvent("change", { detail: this.namevalue() }));
159
+ this.requestUpdate();
160
+ }
161
+ _handleInput() {
162
+ let value = this._input.value.trim();
163
+ if (!this.only && value.includes(";")) {
164
+ value = value.split(";").pop().trim();
165
+ }
166
+ this.assigned.forEach((option) => {
167
+ if (option.value) {
168
+ option.style.display = "block";
169
+ }
170
+ if (option.children) {
171
+ option.style.display = "block";
172
+ [...option.children].forEach((option) => {
173
+ option.style.display = "block";
174
+ });
175
+ }
176
+ });
177
+ if (value) {
178
+ this.assigned.forEach((option) => {
179
+ if (option.value) {
180
+ if (option.value.toLowerCase().includes(value.toLowerCase()) || option.innerText.toLowerCase().includes(value.toLowerCase())) {
181
+ option.style.display = "block";
182
+ }
183
+ else {
184
+ option.style.display = "none";
185
+ }
186
+ }
187
+ else if (option.children) {
188
+ [...option.children].forEach((option) => {
189
+ if (option.value.toLowerCase().includes(value.toLowerCase()) || option.innerText.toLowerCase().includes(value.toLowerCase())) {
190
+ option.style.display = "block";
191
+ }
192
+ else {
193
+ option.style.display = "none";
194
+ }
195
+ });
196
+ if ([...option.children].filter((option) => option.style.display == "block").length == 0) {
197
+ option.style.display = "none";
198
+ }
199
+ }
200
+ });
201
+ }
202
+ this.dispatchEvent(new CustomEvent("input", { detail: this.namevalue() }));
203
+ }
204
+ namevalue() {
205
+ if (!this.only) {
206
+ return [this.name, this.value];
207
+ }
208
+ return [this.name, this.value[0]];
209
+ }
210
+ reset() {
211
+ this.value = [];
212
+ this.text = [];
213
+ this._input.value = "";
214
+ this.assigned.forEach((option) => {
215
+ if (option.value) {
216
+ option.classList.remove(this.selcls);
217
+ }
218
+ else if (option.children) {
219
+ [...option.children].forEach((option) => {
220
+ option.classList.remove(this.selcls);
221
+ });
222
+ }
223
+ });
224
+ if (this.def) {
225
+ if (!this.only) {
226
+ this.def.split(";").forEach((def) => {
227
+ if (def.trim())
228
+ this.select(def.trim(), null);
229
+ });
230
+ }
231
+ else {
232
+ if (this.def.split(";")[0].trim())
233
+ this.select(this.def.split(";")[0].trim(), null);
234
+ }
235
+ }
236
+ }
237
+ };
238
+ SelectInput.styles = [
239
+ STD.styles,
240
+ css `
241
+ :host {
242
+ background: var(${cssvar}--input-background);
243
+ color: var(${cssvar}--text);
244
+ display: inline-flex;
245
+ outline: 0.145em solid transparent;
246
+ border-radius: 0.25em;
247
+ height: 1.5em;
248
+ width: var(${cssvar}--input-width);
249
+ }
250
+ :host([open]) {
251
+ outline-color: var(${cssvar}--input-outline-focus);
252
+ }
253
+ input {
254
+ padding: 0px 0px 0px 0.25em;
255
+ background: none;
256
+ cursor: inherit;
257
+ height: 100%;
258
+ width: 100%;
259
+ box-sizing: border-box;
260
+ border: inherit;
261
+ outline: none;
262
+ border-radius: inherit;
263
+ flex: 1;
264
+ }
265
+ div {
266
+ display: inline-flex;
267
+ position: relative;
268
+ width: 100%;
269
+ border-radius: inherit;
270
+ z-index: inherit;
271
+ }
272
+ label svg {
273
+ height: 100%;
274
+ }
275
+ aside {
276
+ margin-top: 1px;
277
+ position: absolute;
278
+ top: 100%;
279
+ width: 100%;
280
+ visibility: hidden;
281
+ z-index: 1;
282
+ border-radius: inherit;
283
+ }
284
+ section {
285
+ max-width: calc(100% - 1.2em);
286
+ height: 100%;
287
+ overflow: hidden;
288
+ pointer-events: none;
289
+ border-radius: inherit;
290
+ z-index: inherit;
291
+ }
292
+ i.selected-item {
293
+ background: var(${cssvar}--input-true);
294
+ border-radius: inherit;
295
+ height: 100%;
296
+ float: left;
297
+ display: inline-flex;
298
+ font-style: normal;
299
+ align-items: center;
300
+ padding-left: 0.1em;
301
+ margin-left: 0.065em;
302
+ }
303
+ i:first-child {
304
+ margin-left: 0;
305
+ }
306
+ i.selected-item svg {
307
+ width: 1em;
308
+ padding: 0 0.12em;
309
+ height: 0.8em;
310
+ pointer-events: all;
311
+ }
312
+ aside[open] {
313
+ visibility: visible;
314
+ }
315
+ `,
316
+ ];
317
+ __decorate([
318
+ property({ type: Boolean, reflect: true })
319
+ ], SelectInput.prototype, "open", void 0);
320
+ __decorate([
321
+ property()
322
+ ], SelectInput.prototype, "selcls", void 0);
323
+ __decorate([
324
+ property()
325
+ ], SelectInput.prototype, "pla", void 0);
326
+ __decorate([
327
+ property({ type: Boolean })
328
+ ], SelectInput.prototype, "only", void 0);
329
+ __decorate([
330
+ property()
331
+ ], SelectInput.prototype, "def", void 0);
332
+ __decorate([
333
+ property({ type: Array })
334
+ ], SelectInput.prototype, "value", void 0);
335
+ __decorate([
336
+ property()
337
+ ], SelectInput.prototype, "name", void 0);
338
+ __decorate([
339
+ state()
340
+ ], SelectInput.prototype, "text", void 0);
341
+ __decorate([
342
+ property({ type: Boolean })
343
+ ], SelectInput.prototype, "autofocus", void 0);
344
+ __decorate([
345
+ query("input")
346
+ ], SelectInput.prototype, "_input", void 0);
347
+ __decorate([
348
+ query("aside")
349
+ ], SelectInput.prototype, "_aside", void 0);
350
+ SelectInput = __decorate([
351
+ define("select-input")
352
+ ], SelectInput);
353
+ export { SelectInput };
354
+ export default SelectInput;