godown 1.1.5 → 1.2.0

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 (142) hide show
  1. package/LICENSE +9 -9
  2. package/conf.d.ts +17 -18
  3. package/conf.d.ts.map +1 -1
  4. package/conf.js +24 -22
  5. package/deps.d.ts +7 -7
  6. package/deps.d.ts.map +1 -1
  7. package/deps.js +7 -7
  8. package/effect/index.d.ts +3 -3
  9. package/effect/index.js +3 -3
  10. package/effect/ov-effect.d.ts +23 -23
  11. package/effect/ov-effect.js +85 -85
  12. package/effect/ro-effect.d.ts +19 -19
  13. package/effect/ro-effect.js +76 -76
  14. package/effect/std.d.ts +3 -3
  15. package/effect/std.js +3 -3
  16. package/effect/tw-effect.d.ts +21 -21
  17. package/effect/tw-effect.js +90 -90
  18. package/glob.d.ts +11 -8
  19. package/glob.d.ts.map +1 -1
  20. package/glob.js +20 -9
  21. package/group/avatar-group.d.ts +20 -20
  22. package/group/avatar-group.js +88 -88
  23. package/group/button-group.d.ts +12 -12
  24. package/group/button-group.js +26 -26
  25. package/group/details-group.d.ts +16 -16
  26. package/group/details-group.js +51 -51
  27. package/group/index.d.ts +3 -3
  28. package/group/index.js +3 -3
  29. package/group/std.d.ts +3 -3
  30. package/group/std.js +3 -3
  31. package/index.d.ts +7 -7
  32. package/index.js +7 -7
  33. package/input-form/base-input.d.ts +33 -32
  34. package/input-form/base-input.d.ts.map +1 -1
  35. package/input-form/base-input.js +129 -129
  36. package/input-form/exp-input.d.ts +23 -22
  37. package/input-form/exp-input.d.ts.map +1 -1
  38. package/input-form/exp-input.js +67 -67
  39. package/input-form/index.d.ts +8 -8
  40. package/input-form/index.js +8 -8
  41. package/input-form/label-input.d.ts +22 -21
  42. package/input-form/label-input.d.ts.map +1 -1
  43. package/input-form/label-input.js +69 -69
  44. package/input-form/search-input.d.ts +37 -36
  45. package/input-form/search-input.d.ts.map +1 -1
  46. package/input-form/search-input.js +163 -163
  47. package/input-form/select-input.d.ts +35 -31
  48. package/input-form/select-input.d.ts.map +1 -1
  49. package/input-form/select-input.js +290 -259
  50. package/input-form/sign-form.d.ts +26 -25
  51. package/input-form/sign-form.d.ts.map +1 -1
  52. package/input-form/sign-form.js +147 -147
  53. package/input-form/split-input.d.ts +27 -26
  54. package/input-form/split-input.d.ts.map +1 -1
  55. package/input-form/split-input.js +127 -127
  56. package/input-form/std.d.ts +20 -19
  57. package/input-form/std.d.ts.map +1 -1
  58. package/input-form/std.js +56 -55
  59. package/input-form/switch-input.d.ts +23 -22
  60. package/input-form/switch-input.d.ts.map +1 -1
  61. package/input-form/switch-input.js +73 -73
  62. package/items/alert-item.d.ts +16 -16
  63. package/items/alert-item.js +69 -69
  64. package/items/avatar-anchor.d.ts +19 -19
  65. package/items/avatar-anchor.js +71 -71
  66. package/items/base-button.d.ts +16 -16
  67. package/items/base-button.js +117 -117
  68. package/items/dialog-item.d.ts +24 -24
  69. package/items/dialog-item.js +92 -92
  70. package/items/index.d.ts +7 -7
  71. package/items/index.js +7 -7
  72. package/items/link-a.d.ts +19 -19
  73. package/items/link-a.js +76 -76
  74. package/items/load-track.d.ts +21 -20
  75. package/items/load-track.d.ts.map +1 -1
  76. package/items/load-track.js +76 -76
  77. package/items/std.d.ts +3 -3
  78. package/items/std.js +3 -3
  79. package/items/super-a.d.ts +15 -15
  80. package/items/super-a.js +46 -46
  81. package/layout/div-line.d.ts +15 -15
  82. package/layout/div-line.js +39 -39
  83. package/layout/drag-box.d.ts +25 -25
  84. package/layout/drag-box.js +88 -88
  85. package/layout/flex-flow.d.ts +13 -13
  86. package/layout/flex-flow.js +32 -32
  87. package/layout/index.d.ts +5 -5
  88. package/layout/index.js +5 -5
  89. package/layout/nav-aside.d.ts +14 -13
  90. package/layout/nav-aside.d.ts.map +1 -1
  91. package/layout/nav-aside.js +38 -38
  92. package/layout/nav-layout.d.ts +17 -16
  93. package/layout/nav-layout.d.ts.map +1 -1
  94. package/layout/nav-layout.js +51 -51
  95. package/layout/std.d.ts +4 -4
  96. package/layout/std.js +4 -4
  97. package/package.json +17 -13
  98. package/react/effect.d.ts +9 -9
  99. package/react/effect.d.ts.map +1 -1
  100. package/react/effect.js +33 -33
  101. package/react/group.d.ts +4 -4
  102. package/react/group.d.ts.map +1 -1
  103. package/react/group.js +19 -19
  104. package/react/index.d.ts +7 -7
  105. package/react/index.d.ts.map +1 -1
  106. package/react/index.js +7 -7
  107. package/react/input-form.d.ts +32 -32
  108. package/react/input-form.d.ts.map +1 -1
  109. package/react/input-form.js +65 -65
  110. package/react/items.d.ts +8 -8
  111. package/react/items.d.ts.map +1 -1
  112. package/react/items.js +39 -39
  113. package/react/layout.d.ts +6 -6
  114. package/react/layout.d.ts.map +1 -1
  115. package/react/layout.js +29 -29
  116. package/react/view.d.ts +6 -6
  117. package/react/view.d.ts.map +1 -1
  118. package/react/view.js +29 -29
  119. package/view/details-expand.d.ts +19 -18
  120. package/view/details-expand.d.ts.map +1 -1
  121. package/view/details-expand.js +53 -53
  122. package/view/down-drop.d.ts +19 -18
  123. package/view/down-drop.d.ts.map +1 -1
  124. package/view/down-drop.js +71 -71
  125. package/view/index.d.ts +5 -5
  126. package/view/index.js +5 -5
  127. package/view/menu-list.d.ts +17 -16
  128. package/view/menu-list.d.ts.map +1 -1
  129. package/view/menu-list.js +48 -48
  130. package/view/route-view.d.ts +46 -57
  131. package/view/route-view.d.ts.map +1 -1
  132. package/view/route-view.js +256 -257
  133. package/view/scroll-x.d.ts +14 -14
  134. package/view/scroll-x.js +47 -47
  135. package/view/std.d.ts +4 -4
  136. package/view/std.js +4 -4
  137. package/with.d.ts +23 -27
  138. package/with.d.ts.map +1 -1
  139. package/with.js +70 -77
  140. package/items/no-support.d.ts +0 -7
  141. package/items/no-support.d.ts.map +0 -1
  142. package/items/no-support.js +0 -23
@@ -1,32 +1,36 @@
1
- import STD from "./std.js";
2
- export declare class SelectInput extends STD {
3
- static styles: (import("lit").CSSResult | import("@lit/reactive-element/css-tag.js").CSSResultGroup[])[];
4
- open: boolean;
5
- selcls: string;
6
- pla: any;
7
- only: boolean;
8
- def: string;
9
- value: any[];
10
- name: string;
11
- text: Array<string>;
12
- autofocus: boolean;
13
- get assigned(): any;
14
- _input: HTMLInputElement;
15
- _aside: HTMLInputElement;
16
- render(): import("lit-html").TemplateResult<1>;
17
- lists(): any[];
18
- _focusCheck(): void;
19
- focus(options?: FocusOptions): void;
20
- firstUpdated(): void;
21
- select(value: string, text?: string): void;
22
- _handleInput(): void;
23
- namevalue(): [string, any[]] | [string, any];
24
- reset(): void;
25
- }
26
- export default SelectInput;
27
- declare global {
28
- interface HTMLElementTagNameMap {
29
- "select-input": SelectInput;
30
- }
31
- }
1
+ import { CSSResultGroup } from "../deps.js";
2
+ import STD from "./std.js";
3
+ export declare class SelectInput extends STD {
4
+ static styles: CSSResultGroup[];
5
+ open: boolean;
6
+ selcls: string;
7
+ pla?: string;
8
+ only: boolean;
9
+ def: string;
10
+ value: any[];
11
+ name: string;
12
+ text: Array<string>;
13
+ autofocus: boolean;
14
+ get assigned(): any;
15
+ _input: HTMLInputElement;
16
+ _aside: HTMLInputElement;
17
+ render(): import("lit").TemplateResult<1>;
18
+ lists(): any[];
19
+ _focusCheck(): void;
20
+ focus(options?: FocusOptions): void;
21
+ connectedCallback(): void;
22
+ getIndexFunc(option: HTMLOptionElement | any): any;
23
+ firstUpdated(): void;
24
+ disconnectedCallback(): void;
25
+ select(value: string, text?: string): void;
26
+ _handleInput(): void;
27
+ namevalue(): [string, any[]] | [string, any];
28
+ reset(): void;
29
+ }
30
+ export default SelectInput;
31
+ declare global {
32
+ interface HTMLElementTagNameMap {
33
+ "select-input": SelectInput;
34
+ }
35
+ }
32
36
  //# sourceMappingURL=select-input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-input.d.ts","sourceRoot":"","sources":["../../src/input-form/select-input.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,qBACa,WAAY,SAAQ,GAAG;IAClC,MAAM,CAAC,MAAM,4FA8EX;IAC0C,IAAI,UAAS;IAC7C,MAAM,SAA0C;IAChD,GAAG,MAAa;IACC,IAAI,UAAS;IAC9B,GAAG,SAAM;IACM,KAAK,QAAM;IAC1B,IAAI,SAAY;IACnB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IACL,SAAS,UAAS;IAC/C,IAAI,QAAQ,IAAI,GAAG,CAElB;IACe,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzC,MAAM;IAiBN,KAAK;IAuBL,WAAW;IAMX,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAInC,YAAY;IAwBZ,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAsDnC,YAAY;IAwCZ,SAAS,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAM5C,KAAK;CAuBN;AACD,eAAe,WAAW,CAAC;AAC3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"select-input.d.ts","sourceRoot":"","sources":["../../src/input-form/select-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgF,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1H,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,qBACa,WAAY,SAAQ,GAAG;IAClC,MAAM,CAAC,MAAM,mBA8ES;IACsB,IAAI,UAAS;IAC7C,MAAM,SAA0C;IAChD,GAAG,CAAC,EAAE,MAAM,CAAa;IACO,IAAI,UAAS;IAC7C,GAAG,EAAE,MAAM,CAAM;IACF,KAAK,QAAM;IACT,IAAI,SAAY;IAClB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IACvB,SAAS,UAAS;IAE/C,IAAI,QAAQ,IAAI,GAAG,CAElB;IACe,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzC,MAAM;IAiBN,KAAK;IAqBL,WAAW;IAMX,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B,iBAAiB;IAGjB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,GAAG;IAG5C,YAAY;IAmCZ,oBAAoB,IAAI,IAAI;IAa5B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAsDnC,YAAY;IAwCZ,SAAS,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC;IAM5C,KAAK;CAuBN;AAGD,eAAe,WAAW,CAAC;AAC3B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
@@ -1,34 +1,34 @@
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() {
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, define, conf, cssvar, DisableWarning, LitElement } 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
26
  return html `<div>
27
27
  <section>${this.lists()}</section>
28
28
  <input
29
29
  id="input"
30
- @focus=${() => {
31
- this.open = true;
30
+ @focus=${() => {
31
+ this.open = true;
32
32
  }}
33
33
  @input=${this._handleInput}
34
34
  placeholder=${this.pla}
@@ -37,206 +37,236 @@ let SelectInput = class SelectInput extends STD {
37
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
38
  </label>
39
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) {
40
+ </div>`;
41
+ }
42
+ lists() {
43
+ const itemTemplates = [];
44
+ if (this.value.length)
45
+ for (const i in this.value) {
46
46
  itemTemplates.push(html `<i class="selected-item">
47
47
  ${this.text[i] || this.value[i]}
48
48
  <svg
49
- @click=${() => {
50
- this.select(this.value[i]);
49
+ @click=${() => {
50
+ this.select(this.value[i]);
51
51
  }}
52
- t="1678769821062"
53
52
  viewBox="0 0 1024 1024"
54
53
  version="1.1"
55
- p-id="2770"
56
54
  >
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>
55
+ <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"></path>
58
56
  </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,
57
+ </i>`);
58
+ }
59
+ return itemTemplates;
60
+ }
61
+ _focusCheck() {
62
+ var _a;
63
+ if (this.autofocus) {
64
+ (_a = this._input) === null || _a === void 0 ? void 0 : _a.focus();
65
+ this.open = true;
66
+ }
67
+ }
68
+ focus(options) {
69
+ var _a;
70
+ (_a = this._input) === null || _a === void 0 ? void 0 : _a.focus(options);
71
+ this.open = true;
72
+ }
73
+ connectedCallback() {
74
+ LitElement.prototype.connectedCallback.call(this);
75
+ }
76
+ getIndexFunc(option) {
77
+ return this.getIndexFunc(option);
78
+ }
79
+ firstUpdated() {
80
+ if (this.def) {
81
+ if (this.only) {
82
+ this.select(this.def);
83
+ }
84
+ else {
85
+ for (const i of this.def.split(";")) {
86
+ if (i.trim()) {
87
+ this.select(i);
88
+ }
89
+ }
90
+ }
91
+ }
92
+ this._focusCheck();
93
+ this.assigned.forEach((option) => {
94
+ if (this.getIndexFunc(option)) {
95
+ option.addEventListener("click", () => {
96
+ this.select(this.getIndexFunc(option), option.innerText);
97
+ });
98
+ }
99
+ else if (option.children) {
100
+ [...option.children].forEach((option) => {
101
+ option.addEventListener("click", () => {
102
+ this.select(this.getIndexFunc(option), option.innerText);
103
+ });
104
+ });
105
+ }
106
+ });
107
+ this.addEventListener("change", () => {
108
+ this.open = !this.only;
109
+ });
110
+ document.addEventListener("click", (e) => {
111
+ if (!this.contains(e.target)) {
112
+ this.open = false;
113
+ }
114
+ });
115
+ }
116
+ disconnectedCallback() {
117
+ this.assigned.forEach((option) => {
118
+ if (this.getIndexFunc(option)) {
119
+ option.removeEventListener("click", () => { });
120
+ }
121
+ else if (option.children) {
122
+ [...option.children].forEach((option) => {
123
+ option.removeEventListener("click", () => {
124
+ this.select(this.getIndexFunc(option), option.innerText);
125
+ });
126
+ });
127
+ }
128
+ });
129
+ }
130
+ select(value, text) {
131
+ if (text === undefined || text === null) {
132
+ this.assigned.forEach((option) => {
133
+ if (this.getIndexFunc(option)) {
134
+ if (this.getIndexFunc(option) == value) {
135
+ text = option.innerText;
136
+ }
137
+ }
138
+ else if (option.children) {
139
+ [...option.children].forEach((option) => {
140
+ if (this.getIndexFunc(option) == value) {
141
+ text = option.innerText;
142
+ }
143
+ });
144
+ }
145
+ });
146
+ }
147
+ if (this.value.includes(value)) {
148
+ if (!this.only) {
149
+ this.value = this.value.filter((v) => v != value);
150
+ this.text = this.text.filter((v) => v != text);
151
+ }
152
+ else {
153
+ this.value = [];
154
+ this.text = [];
155
+ }
156
+ }
157
+ else {
158
+ if (!this.only) {
159
+ this.value.push(value);
160
+ this.text.push(text);
161
+ }
162
+ else {
163
+ this.value = [value];
164
+ this.text = [text];
165
+ }
166
+ }
167
+ this.assigned.forEach((option) => {
168
+ if (this.getIndexFunc(option)) {
169
+ if (this.value.includes(this.getIndexFunc(option))) {
170
+ option.classList.add(this.selcls);
171
+ }
172
+ else {
173
+ option.classList.remove(this.selcls);
174
+ }
175
+ }
176
+ else if (option.children) {
177
+ [...option.children].forEach((option) => {
178
+ if (this.value.includes(this.getIndexFunc(option))) {
179
+ option.classList.add(this.selcls);
180
+ }
181
+ else {
182
+ option.classList.remove(this.selcls);
183
+ }
184
+ });
185
+ }
186
+ });
187
+ this._input.value = "";
188
+ this.dispatchEvent(new CustomEvent("change", { detail: this.namevalue() }));
189
+ this.requestUpdate();
190
+ }
191
+ _handleInput() {
192
+ let value = this._input.value.trim();
193
+ if (!this.only && value.includes(";")) {
194
+ value = value.split(";").pop().trim();
195
+ }
196
+ this.assigned.forEach((option) => {
197
+ if (this.getIndexFunc(option)) {
198
+ option.style.display = "block";
199
+ }
200
+ if (option.children) {
201
+ option.style.display = "block";
202
+ [...option.children].forEach((option) => {
203
+ option.style.display = "block";
204
+ });
205
+ }
206
+ });
207
+ if (value) {
208
+ this.assigned.forEach((option) => {
209
+ if (this.getIndexFunc(option)) {
210
+ if (this.getIndexFunc(option).toLowerCase().includes(value.toLowerCase()) || option.innerText.toLowerCase().includes(value.toLowerCase())) {
211
+ option.style.display = "block";
212
+ }
213
+ else {
214
+ option.style.display = "none";
215
+ }
216
+ }
217
+ else if (option.children) {
218
+ [...option.children].forEach((option) => {
219
+ if (this.getIndexFunc(option).toLowerCase().includes(value.toLowerCase()) || option.innerText.toLowerCase().includes(value.toLowerCase())) {
220
+ option.style.display = "block";
221
+ }
222
+ else {
223
+ option.style.display = "none";
224
+ }
225
+ });
226
+ if ([...option.children].filter((option) => option.style.display == "block").length == 0) {
227
+ option.style.display = "none";
228
+ }
229
+ }
230
+ });
231
+ }
232
+ this.dispatchEvent(new CustomEvent("input", { detail: this.namevalue() }));
233
+ }
234
+ namevalue() {
235
+ if (!this.only) {
236
+ return [this.name, this.value];
237
+ }
238
+ return [this.name, this.value[0]];
239
+ }
240
+ reset() {
241
+ this.value = [];
242
+ this.text = [];
243
+ this._input.value = "";
244
+ this.assigned.forEach((option) => {
245
+ if (this.getIndexFunc(option)) {
246
+ option.classList.remove(this.selcls);
247
+ }
248
+ else if (option.children) {
249
+ [...option.children].forEach((option) => {
250
+ option.classList.remove(this.selcls);
251
+ });
252
+ }
253
+ });
254
+ if (this.def) {
255
+ if (!this.only) {
256
+ this.def.split(";").forEach((def) => {
257
+ if (def.trim())
258
+ this.select(def.trim(), null);
259
+ });
260
+ }
261
+ else {
262
+ if (this.def.split(";")[0].trim())
263
+ this.select(this.def.split(";")[0].trim(), null);
264
+ }
265
+ }
266
+ }
267
+ };
268
+ SelectInput.styles = [
269
+ STD.styles,
240
270
  css `
241
271
  :host {
242
272
  background: var(${cssvar}--input-background);
@@ -312,43 +342,44 @@ SelectInput.styles = [
312
342
  aside[open] {
313
343
  visibility: visible;
314
344
  }
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;
345
+ `,
346
+ ];
347
+ __decorate([
348
+ property({ type: Boolean, reflect: true })
349
+ ], SelectInput.prototype, "open", void 0);
350
+ __decorate([
351
+ property()
352
+ ], SelectInput.prototype, "selcls", void 0);
353
+ __decorate([
354
+ property()
355
+ ], SelectInput.prototype, "pla", void 0);
356
+ __decorate([
357
+ property({ type: Boolean, reflect: true })
358
+ ], SelectInput.prototype, "only", void 0);
359
+ __decorate([
360
+ property()
361
+ ], SelectInput.prototype, "def", void 0);
362
+ __decorate([
363
+ property({ type: Array })
364
+ ], SelectInput.prototype, "value", void 0);
365
+ __decorate([
366
+ property({ reflect: true })
367
+ ], SelectInput.prototype, "name", void 0);
368
+ __decorate([
369
+ property({ type: Array })
370
+ ], SelectInput.prototype, "text", void 0);
371
+ __decorate([
372
+ property({ type: Boolean })
373
+ ], SelectInput.prototype, "autofocus", void 0);
374
+ __decorate([
375
+ query("input")
376
+ ], SelectInput.prototype, "_input", void 0);
377
+ __decorate([
378
+ query("aside")
379
+ ], SelectInput.prototype, "_aside", void 0);
380
+ SelectInput = __decorate([
381
+ define("select-input")
382
+ ], SelectInput);
383
+ export { SelectInput };
384
+ DisableWarning(SelectInput);
385
+ export default SelectInput;