smoothly 1.0.0-alpha.112 → 1.0.0-alpha.113
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.
- package/dist/cjs/Observers-6450f075.js +25 -0
- package/dist/cjs/Observers-6450f075.js.map +1 -0
- package/dist/cjs/{index-43af753b.js → index-6ae370b4.js} +4 -1
- package/dist/cjs/index-6ae370b4.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -2
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/smoothly-accordion_67.cjs.entry.js +54 -8
- package/dist/cjs/smoothly-accordion_67.cjs.entry.js.map +1 -1
- package/dist/cjs/smoothly-address-display.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-address.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-addresses.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-color.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-country.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-display-date-time.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-google-font.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-reorder.cjs.entry.js +4 -4
- package/dist/cjs/smoothly-reorder.cjs.entry.js.map +1 -1
- package/dist/cjs/smoothly-trigger-sink.cjs.entry.js +1 -1
- package/dist/cjs/smoothly-trigger-source.cjs.entry.js +1 -1
- package/dist/cjs/smoothly.cjs.js +3 -2
- package/dist/cjs/smoothly.cjs.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/picker/demo/index.js +1 -1
- package/dist/collection/components/picker/demo/index.js.map +1 -1
- package/dist/collection/components/picker/index.js +1 -1
- package/dist/collection/components/picker/index.js.map +1 -1
- package/dist/collection/components/picker/menu/index.js +66 -2
- package/dist/collection/components/picker/menu/index.js.map +1 -1
- package/dist/collection/components/picker/menu/style.css +16 -6
- package/dist/collection/components/picker/option/index.js +28 -2
- package/dist/collection/components/picker/option/index.js.map +1 -1
- package/dist/collection/components/picker/option/style.css +3 -4
- package/dist/collection/components/picker/style.css +1 -3
- package/dist/collection/global/Observers.js +22 -0
- package/dist/collection/global/Observers.js.map +1 -0
- package/dist/collection/global/index.js +5 -0
- package/dist/collection/global/index.js.map +1 -0
- package/dist/collection/model/Option.js.map +1 -1
- package/dist/custom-elements/index.js +76 -9
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/Observers-5f08e828.js +25 -0
- package/dist/esm/Observers-5f08e828.js.map +1 -0
- package/dist/esm/{index-258984d3.js → index-c196715a.js} +4 -2
- package/dist/esm/index-c196715a.js.map +1 -0
- package/dist/esm/loader.js +4 -3
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/smoothly-accordion_67.entry.js +54 -8
- package/dist/esm/smoothly-accordion_67.entry.js.map +1 -1
- package/dist/esm/smoothly-address-display.entry.js +1 -1
- package/dist/esm/smoothly-address.entry.js +1 -1
- package/dist/esm/smoothly-addresses.entry.js +1 -1
- package/dist/esm/smoothly-color.entry.js +1 -1
- package/dist/esm/smoothly-country.entry.js +1 -1
- package/dist/esm/smoothly-display-date-time.entry.js +1 -1
- package/dist/esm/smoothly-google-font.entry.js +1 -1
- package/dist/esm/smoothly-radio-group.entry.js +1 -1
- package/dist/esm/smoothly-reorder.entry.js +2 -2
- package/dist/esm/smoothly-reorder.entry.js.map +1 -1
- package/dist/esm/smoothly-trigger-sink.entry.js +1 -1
- package/dist/esm/smoothly-trigger-source.entry.js +1 -1
- package/dist/esm/smoothly.js +4 -3
- package/dist/esm/smoothly.js.map +1 -1
- package/dist/smoothly/{p-66e9a8b1.entry.js → p-1efa3261.entry.js} +2 -2
- package/dist/smoothly/{p-7bf147bf.entry.js → p-4d743f07.entry.js} +2 -2
- package/dist/smoothly/p-4ff439dd.entry.js +2 -0
- package/dist/smoothly/{p-b3eac6af.entry.js.map → p-4ff439dd.entry.js.map} +1 -1
- package/dist/smoothly/{p-4c1bb81e.entry.js → p-5edb65c6.entry.js} +2 -2
- package/dist/smoothly/{p-12182a73.entry.js → p-663ccbd0.entry.js} +2 -2
- package/dist/smoothly/{p-6fad95bf.entry.js → p-73442332.entry.js} +2 -2
- package/dist/smoothly/{p-7ed2d3dd.entry.js → p-7d43f36c.entry.js} +2 -2
- package/dist/smoothly/{p-47151a53.entry.js → p-9992c8c4.entry.js} +2 -2
- package/dist/smoothly/{p-eef1c80b.entry.js → p-ce4e6f44.entry.js} +2 -2
- package/dist/smoothly/{p-5e387578.js → p-d0b8061e.js} +3 -3
- package/dist/smoothly/p-d0b8061e.js.map +1 -0
- package/dist/smoothly/{p-6aebb818.entry.js → p-dbd1afa9.entry.js} +2 -2
- package/dist/smoothly/p-ede93d69.js +2 -0
- package/dist/smoothly/p-ede93d69.js.map +1 -0
- package/dist/smoothly/p-f85f09d3.entry.js +2 -0
- package/dist/smoothly/p-f85f09d3.entry.js.map +1 -0
- package/dist/smoothly/{p-cb493516.entry.js → p-f96e41aa.entry.js} +2 -2
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/smoothly/smoothly.esm.js.map +1 -1
- package/dist/types/components/picker/menu/index.d.ts +7 -0
- package/dist/types/components/picker/option/index.d.ts +1 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/global/Observers.d.ts +8 -0
- package/dist/types/global/index.d.ts +4 -0
- package/dist/types/model/Option.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/index-43af753b.js.map +0 -1
- package/dist/esm/index-258984d3.js.map +0 -1
- package/dist/smoothly/p-5e387578.js.map +0 -1
- package/dist/smoothly/p-97367511.entry.js +0 -2
- package/dist/smoothly/p-97367511.entry.js.map +0 -1
- package/dist/smoothly/p-b3eac6af.entry.js +0 -2
- /package/dist/smoothly/{p-66e9a8b1.entry.js.map → p-1efa3261.entry.js.map} +0 -0
- /package/dist/smoothly/{p-7bf147bf.entry.js.map → p-4d743f07.entry.js.map} +0 -0
- /package/dist/smoothly/{p-4c1bb81e.entry.js.map → p-5edb65c6.entry.js.map} +0 -0
- /package/dist/smoothly/{p-12182a73.entry.js.map → p-663ccbd0.entry.js.map} +0 -0
- /package/dist/smoothly/{p-6fad95bf.entry.js.map → p-73442332.entry.js.map} +0 -0
- /package/dist/smoothly/{p-7ed2d3dd.entry.js.map → p-7d43f36c.entry.js.map} +0 -0
- /package/dist/smoothly/{p-47151a53.entry.js.map → p-9992c8c4.entry.js.map} +0 -0
- /package/dist/smoothly/{p-eef1c80b.entry.js.map → p-ce4e6f44.entry.js.map} +0 -0
- /package/dist/smoothly/{p-6aebb818.entry.js.map → p-dbd1afa9.entry.js.map} +0 -0
- /package/dist/smoothly/{p-cb493516.entry.js.map → p-f96e41aa.entry.js.map} +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
+
import global from "../../../global/index";
|
|
3
|
+
const Observers = global().Observers;
|
|
2
4
|
function* chain(...iterables) {
|
|
3
5
|
for (const iterable of iterables)
|
|
4
6
|
yield* iterable;
|
|
@@ -17,6 +19,7 @@ function restoreListener(ref, option) {
|
|
|
17
19
|
export class SmoothlyPickerMenu {
|
|
18
20
|
constructor() {
|
|
19
21
|
this.looks = undefined;
|
|
22
|
+
this.open = false;
|
|
20
23
|
this.multiple = false;
|
|
21
24
|
this.mutable = false;
|
|
22
25
|
this.readonly = false;
|
|
@@ -27,6 +30,19 @@ export class SmoothlyPickerMenu {
|
|
|
27
30
|
this.search = "";
|
|
28
31
|
this.valid = false;
|
|
29
32
|
this.display = undefined;
|
|
33
|
+
this.flip = false;
|
|
34
|
+
this.flipChecked = false;
|
|
35
|
+
}
|
|
36
|
+
componentWillLoad() {
|
|
37
|
+
if (!Observers.has(this.element)) {
|
|
38
|
+
const threshold = 0.4;
|
|
39
|
+
Observers.set(this.element, new IntersectionObserver(entries => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
return ((_b = (_a = entries.find(entry => entry.target == this.element)) === null || _a === void 0 ? void 0 : _a.intersectionRatio) !== null && _b !== void 0 ? _b : 0) < threshold &&
|
|
42
|
+
!this.flipChecked &&
|
|
43
|
+
((this.flip = !this.flip), (this.flipChecked = true));
|
|
44
|
+
}, { threshold }));
|
|
45
|
+
}
|
|
30
46
|
}
|
|
31
47
|
componentDidLoad() {
|
|
32
48
|
this.smoothlyPickerMenuLoaded.emit({
|
|
@@ -56,10 +72,27 @@ export class SmoothlyPickerMenu {
|
|
|
56
72
|
},
|
|
57
73
|
});
|
|
58
74
|
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
var _a;
|
|
77
|
+
if (!this.element.parentElement) {
|
|
78
|
+
(_a = Observers.get(this.element)) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
79
|
+
Observers.remove(this.element);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
openChange() {
|
|
83
|
+
const observer = Observers.get(this.element);
|
|
84
|
+
if (this.open)
|
|
85
|
+
observer === null || observer === void 0 ? void 0 : observer.observe(this.element);
|
|
86
|
+
else
|
|
87
|
+
observer === null || observer === void 0 ? void 0 : observer.unobserve(this.element);
|
|
88
|
+
}
|
|
59
89
|
readonlyChanged() {
|
|
60
90
|
for (const option of chain(this.options.values(), this.backend.values()))
|
|
61
91
|
option.element, option.set.readonly(this.readonly);
|
|
62
92
|
}
|
|
93
|
+
scrollHandler() {
|
|
94
|
+
this.flipChecked = false;
|
|
95
|
+
}
|
|
63
96
|
optionLoadHandler(event) {
|
|
64
97
|
if (!this.listElement || !event.composedPath().includes(this.listElement)) {
|
|
65
98
|
event.stopPropagation();
|
|
@@ -144,7 +177,9 @@ export class SmoothlyPickerMenu {
|
|
|
144
177
|
event.detail.set.nodes(this.display);
|
|
145
178
|
}
|
|
146
179
|
render() {
|
|
147
|
-
return (h(Host, { class: { valid: this.valid } }, h("smoothly-slotted-elements", { class: "hide", onSmoothlySlottedChange: e => (this.display = e.detail) }, h("slot", { name: "display" })), h("div", { class: "hide" }, h("slot", null), Array.from(this.created.values(), option => (h("smoothly-picker-option", { key: option.value, value: option.value, selected: option.selected }, option.value, h("smoothly-slot-elements", { slot: "display", nodes: this.display }))))), h("div", { class: "controls" }, h("smoothly-input", { ref: e => (this.searchElement = e), name: "search", value: this.search, looks: this.looks, onKeyDown: e => this.keyDownHandler(e), onSmoothlyInput: e => this.inputHandler(e), onSmoothlyChange: e => e.stopPropagation(), onSmoothlyBlur: e => e.stopPropagation() }, h("slot", { name: "search" })), this.mutable && !this.readonly ? (h("button", { onClick: () => this.addHandler(), disabled: !this.valid, type: "button" }, h("smoothly-icon", { name: "add-outline" }))) : null), h("div", { class: "list", ref: e => (this.listElement = e) }, Array.from(this.backend.values())
|
|
180
|
+
return (h(Host, { class: { valid: this.valid, flip: this.flip } }, h("smoothly-slotted-elements", { class: "hide", onSmoothlySlottedChange: e => (this.display = e.detail) }, h("slot", { name: "display" })), h("div", { class: "hide" }, h("slot", null), Array.from(this.created.values(), option => (h("smoothly-picker-option", { key: option.value, value: option.value, selected: option.selected }, option.value, h("smoothly-slot-elements", { slot: "display", nodes: this.display }))))), h("div", { class: "controls" }, h("smoothly-input", { ref: e => (this.searchElement = e), name: "search", value: this.search, looks: this.looks, onKeyDown: e => this.keyDownHandler(e), onSmoothlyInput: e => this.inputHandler(e), onSmoothlyChange: e => e.stopPropagation(), onSmoothlyBlur: e => e.stopPropagation() }, h("slot", { name: "search" })), this.mutable && !this.readonly ? (h("button", { onClick: () => this.addHandler(), disabled: !this.valid, type: "button" }, h("smoothly-icon", { name: "add-outline" }))) : null), h("div", { class: "list", ref: e => (this.listElement = e) }, Array.from(this.backend.values())
|
|
181
|
+
.sort((a, b) => a.position - b.position)
|
|
182
|
+
.map(option => (h("smoothly-slot-elements", { ref: e => restoreListener(e, option), clone: false, nodes: option.clone }))))));
|
|
148
183
|
}
|
|
149
184
|
static get is() { return "smoothly-picker-menu"; }
|
|
150
185
|
static get encapsulation() { return "scoped"; }
|
|
@@ -182,6 +217,24 @@ export class SmoothlyPickerMenu {
|
|
|
182
217
|
"attribute": "looks",
|
|
183
218
|
"reflect": false
|
|
184
219
|
},
|
|
220
|
+
"open": {
|
|
221
|
+
"type": "boolean",
|
|
222
|
+
"mutable": false,
|
|
223
|
+
"complexType": {
|
|
224
|
+
"original": "boolean",
|
|
225
|
+
"resolved": "boolean",
|
|
226
|
+
"references": {}
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"optional": false,
|
|
230
|
+
"docs": {
|
|
231
|
+
"tags": [],
|
|
232
|
+
"text": ""
|
|
233
|
+
},
|
|
234
|
+
"attribute": "open",
|
|
235
|
+
"reflect": true,
|
|
236
|
+
"defaultValue": "false"
|
|
237
|
+
},
|
|
185
238
|
"multiple": {
|
|
186
239
|
"type": "boolean",
|
|
187
240
|
"mutable": false,
|
|
@@ -265,7 +318,9 @@ export class SmoothlyPickerMenu {
|
|
|
265
318
|
"created": {},
|
|
266
319
|
"search": {},
|
|
267
320
|
"valid": {},
|
|
268
|
-
"display": {}
|
|
321
|
+
"display": {},
|
|
322
|
+
"flip": {},
|
|
323
|
+
"flipChecked": {}
|
|
269
324
|
};
|
|
270
325
|
}
|
|
271
326
|
static get events() {
|
|
@@ -313,12 +368,21 @@ export class SmoothlyPickerMenu {
|
|
|
313
368
|
static get elementRef() { return "element"; }
|
|
314
369
|
static get watchers() {
|
|
315
370
|
return [{
|
|
371
|
+
"propName": "open",
|
|
372
|
+
"methodName": "openChange"
|
|
373
|
+
}, {
|
|
316
374
|
"propName": "readonly",
|
|
317
375
|
"methodName": "readonlyChanged"
|
|
318
376
|
}];
|
|
319
377
|
}
|
|
320
378
|
static get listeners() {
|
|
321
379
|
return [{
|
|
380
|
+
"name": "scroll",
|
|
381
|
+
"method": "scrollHandler",
|
|
382
|
+
"target": "window",
|
|
383
|
+
"capture": false,
|
|
384
|
+
"passive": true
|
|
385
|
+
}, {
|
|
322
386
|
"name": "smoothlyPickerOptionLoad",
|
|
323
387
|
"method": "optionLoadHandler",
|
|
324
388
|
"target": undefined,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AE,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,GAAI,CACnG,CAAC,CACG,CACA,CACP,CAAA;EACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Listen, Prop, State, Watch } from \"@stencil/core\"\nimport { Notice, Option } from \"../../../model\"\nimport { Looks } from \"../../input/Looks\"\nimport { Slot } from \"../slot-elements\"\n\nfunction* chain<T>(...iterables: Iterable<T>[]): Iterable<T> {\n\tfor (const iterable of iterables)\n\t\tyield* iterable\n}\n\nfunction restore<T extends Option>(target: T | undefined, source: Option): T | undefined {\n\ttarget?.set.selected((target.selected = source.selected))\n\ttarget?.set.readonly((target.readonly = source.readonly))\n\ttarget?.set.visible((target.visible = source.visible))\n\ttarget?.set.value((target.value = source.value))\n\ttarget?.set.search((target.search = source.search))\n\treturn target\n}\n\nfunction restoreListener(ref: HTMLElement | undefined, option: Option) {\n\tref?.addEventListener(\"smoothlyPickerOptionLoad\", (e: CustomEvent<Option>) => restore(e.detail, option))\n}\nexport interface Controls {\n\tremember: () => void\n\trestore: () => void\n}\n@Component({\n\ttag: \"smoothly-picker-menu\",\n\tstyleUrl: \"style.css\",\n\tscoped: true,\n})\nexport class SmoothlyPickerMenu {\n\t@Element() element: HTMLSmoothlyPickerMenuElement\n\t@Prop() looks: Looks\n\t@Prop({ reflect: true }) multiple = false\n\t@Prop({ reflect: true }) mutable = false\n\t@Prop({ reflect: true }) readonly = false\n\t@Prop() validator?: (value: string) => boolean | { result: boolean; notice: Notice }\n\t@State() backend = new Map<any, Option & { clone: Node }>() // value -> Option\n\t@State() options = new Map<any, Option>() // value -> Option\n\t@State() created = new Map<any, Option.Created>()\n\t@State() search = \"\"\n\t@State() valid = false\n\t@State() display: Node[]\n\t@Event() notice: EventEmitter<Notice>\n\t@Event() smoothlyPickerMenuLoaded: EventEmitter<Controls>\n\tprivate memory?: { backend: SmoothlyPickerMenu[\"backend\"]; options: SmoothlyPickerMenu[\"options\"] }\n\tprivate listElement?: HTMLElement\n\tprivate searchElement?: HTMLElement\n\n\tcomponentDidLoad() {\n\t\tthis.smoothlyPickerMenuLoaded.emit({\n\t\t\tremember: () => {\n\t\t\t\tthis.memory = {\n\t\t\t\t\tbackend: new Map(Array.from(this.backend.entries(), ([value, option]) => [value, { ...option }])),\n\t\t\t\t\toptions: new Map(Array.from(this.options.entries(), ([value, option]) => [value, { ...option }])),\n\t\t\t\t}\n\t\t\t},\n\t\t\trestore: () => {\n\t\t\t\tif (this.memory) {\n\t\t\t\t\tfor (const option of this.options.values()) {\n\t\t\t\t\t\tconst memory = this.memory.options.get(option.value)\n\t\t\t\t\t\tif (memory != undefined)\n\t\t\t\t\t\t\trestore(option, memory)\n\t\t\t\t\t\telse if (this.created.get(option.value))\n\t\t\t\t\t\t\toption.set.selected((option.selected = false))\n\t\t\t\t\t}\n\t\t\t\t\tfor (const option of this.backend.values()) {\n\t\t\t\t\t\tconst memory = this.memory.backend.get(option.value)\n\t\t\t\t\t\tif (memory != undefined)\n\t\t\t\t\t\t\trestore(option, memory)\n\t\t\t\t\t\telse if (this.created.get(option.value))\n\t\t\t\t\t\t\toption.set.selected((option.selected = false))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t}\n\n\t@Watch(\"readonly\")\n\treadonlyChanged() {\n\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\toption.element, option.set.readonly(this.readonly)\n\t}\n\t@Listen(\"smoothlyPickerOptionLoad\")\n\toptionLoadHandler(event: CustomEvent<Option.Load>) {\n\t\tif (!this.listElement || !event.composedPath().includes(this.listElement)) {\n\t\t\tevent.stopPropagation()\n\t\t\tevent.detail.set.readonly(this.readonly)\n\n\t\t\tconst current = this.options.get(event.detail.value)\n\t\t\tif (current)\n\t\t\t\tevent.detail.set.selected(current.element.selected)\n\t\t}\n\t}\n\t@Listen(\"smoothlyPickerOptionLoaded\")\n\toptionLoadedHandler(event: CustomEvent<Option>) {\n\t\tif (!this.listElement || !event.composedPath().includes(this.listElement)) {\n\t\t\tevent.stopPropagation()\n\t\t\tconst current = restore(this.backend.get(event.detail.value), event.detail)\n\t\t\tthis.backend = new Map(\n\t\t\t\tthis.backend\n\t\t\t\t\t.set(event.detail.value, {\n\t\t\t\t\t\t...event.detail,\n\t\t\t\t\t\tclone: current?.clone ?? event.detail.element.cloneNode(true),\n\t\t\t\t\t})\n\t\t\t\t\t.entries()\n\t\t\t)\n\t\t} else\n\t\t\tthis.options.set(event.detail.value, event.detail)\n\t}\n\t@Listen(\"smoothlyPickerOptionChange\")\n\toptionChangeHandler(event: CustomEvent<Option>) {\n\t\tif (!this.listElement || !event.composedPath().includes(this.listElement)) {\n\t\t\tevent.stopPropagation()\n\t\t\tthis.options.get(event.detail.value)?.set.selected(event.detail.selected)\n\t\t} else {\n\t\t\tconst current = this.backend.get(event.detail.value)\n\t\t\tif (current?.element.parentElement)\n\t\t\t\tcurrent?.set.selected(event.detail.selected)\n\t\t}\n\n\t\tif (!this.readonly && !this.multiple && event.detail.selected)\n\t\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\t\tif (option.value != event.detail.value)\n\t\t\t\t\toption.set.selected(false)\n\t}\n\tinputHandler(event: CustomEvent<Record<string, any>>) {\n\t\tevent.stopPropagation()\n\t\tthis.search = event.detail.search\n\t\tif (!this.search) {\n\t\t\tthis.valid = false\n\t\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\t\toption.set.visible(true)\n\t\t} else {\n\t\t\tthis.valid = !Array.from(this.options.values()).find(option => option.value == this.search)\n\t\t\tconst search = this.search.toLocaleLowerCase()\n\t\t\tfor (const option of chain(this.options.values(), this.backend.values())) {\n\t\t\t\tconst value = option.value.toString().toLocaleLowerCase().includes(search)\n\t\t\t\tconst searches = option.search.some(value => value.includes(search))\n\t\t\t\tconst result = value || searches\n\t\t\t\toption.set.visible(result)\n\t\t\t}\n\t\t}\n\t}\n\taddHandler() {\n\t\tconst validation = !this.validator ? true : this.validator(this.search)\n\t\tif (this.mutable) {\n\t\t\tif (typeof validation == \"object\" ? validation.result : validation) {\n\t\t\t\tif (!this.multiple)\n\t\t\t\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\t\t\t\toption.set.selected(false)\n\t\t\t\tthis.created = new Map(this.created.set(this.search, { value: this.search, selected: true }).entries())\n\t\t\t\tthis.search = \"\"\n\t\t\t\tthis.searchElement?.focus()\n\t\t\t\tthis.valid = false\n\t\t\t}\n\t\t\tif (typeof validation == \"object\")\n\t\t\t\tthis.notice.emit(validation.notice)\n\t\t}\n\t}\n\tkeyDownHandler(event: KeyboardEvent) {\n\t\tif (event.key == \"Enter\") {\n\t\t\tevent.preventDefault()\n\t\t\tthis.addHandler()\n\t\t}\n\t}\n\t@Listen(\"smoothlySlotEmpty\")\n\temptyDisplayHandler(event: CustomEvent<Slot>) {\n\t\tevent.stopPropagation()\n\t\tevent.detail.set.nodes(this.display)\n\t}\n\trender() {\n\t\treturn (\n\t\t\t<Host class={{ valid: this.valid }}>\n\t\t\t\t<smoothly-slotted-elements class={\"hide\"} onSmoothlySlottedChange={e => (this.display = e.detail)}>\n\t\t\t\t\t<slot name=\"display\" />\n\t\t\t\t</smoothly-slotted-elements>\n\t\t\t\t<div class={\"hide\"}>\n\t\t\t\t\t<slot />\n\t\t\t\t\t{Array.from(this.created.values(), option => (\n\t\t\t\t\t\t<smoothly-picker-option key={option.value} value={option.value} selected={option.selected}>\n\t\t\t\t\t\t\t{option.value}\n\t\t\t\t\t\t\t<smoothly-slot-elements slot=\"display\" nodes={this.display} />\n\t\t\t\t\t\t</smoothly-picker-option>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t\t<div class={\"controls\"}>\n\t\t\t\t\t<smoothly-input\n\t\t\t\t\t\tref={e => (this.searchElement = e)}\n\t\t\t\t\t\tname=\"search\"\n\t\t\t\t\t\tvalue={this.search}\n\t\t\t\t\t\tlooks={this.looks}\n\t\t\t\t\t\tonKeyDown={e => this.keyDownHandler(e)}\n\t\t\t\t\t\tonSmoothlyInput={e => this.inputHandler(e)}\n\t\t\t\t\t\tonSmoothlyChange={e => e.stopPropagation()}\n\t\t\t\t\t\tonSmoothlyBlur={e => e.stopPropagation()}>\n\t\t\t\t\t\t<slot name=\"search\" />\n\t\t\t\t\t</smoothly-input>\n\t\t\t\t\t{this.mutable && !this.readonly ? (\n\t\t\t\t\t\t<button onClick={() => this.addHandler()} disabled={!this.valid} type={\"button\"}>\n\t\t\t\t\t\t\t<smoothly-icon name=\"add-outline\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t<div class={\"list\"} ref={e => (this.listElement = e)}>\n\t\t\t\t\t{Array.from(this.backend.values()).map(option => (\n\t\t\t\t\t\t<smoothly-slot-elements ref={e => restoreListener(e, option)} clone={false} nodes={option.clone} />\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/picker/menu/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC5G,OAAO,MAAM,MAAM,uBAAuB,CAAA;AAK1C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,SAAS,CAAA;AAEpC,QAAQ,CA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AK,EAAE,MAAM,CAAC,KAAK,GAAI,CACnG,CAAC,CACE,CACA,CACP,CAAA;EACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Listen, Prop, State, Watch } from \"@stencil/core\"\nimport global from \"../../../global/index\"\nimport { Notice, Option } from \"../../../model\"\nimport { Looks } from \"../../input/Looks\"\nimport { Slot } from \"../slot-elements\"\n\nconst Observers = global().Observers\n\nfunction* chain<T>(...iterables: Iterable<T>[]): Iterable<T> {\n\tfor (const iterable of iterables)\n\t\tyield* iterable\n}\n\nfunction restore<T extends Option>(target: T | undefined, source: Option): T | undefined {\n\ttarget?.set.selected((target.selected = source.selected))\n\ttarget?.set.readonly((target.readonly = source.readonly))\n\ttarget?.set.visible((target.visible = source.visible))\n\ttarget?.set.value((target.value = source.value))\n\ttarget?.set.search((target.search = source.search))\n\treturn target\n}\nfunction restoreListener(ref: HTMLElement | undefined, option: Option) {\n\tref?.addEventListener(\"smoothlyPickerOptionLoad\", (e: CustomEvent<Option>) => restore(e.detail, option))\n}\nexport interface Controls {\n\tremember: () => void\n\trestore: () => void\n}\n@Component({\n\ttag: \"smoothly-picker-menu\",\n\tstyleUrl: \"style.css\",\n\tscoped: true,\n})\nexport class SmoothlyPickerMenu {\n\t@Element() element: HTMLSmoothlyPickerMenuElement\n\t@Prop() looks: Looks\n\t@Prop({ reflect: true }) open = false\n\t@Prop({ reflect: true }) multiple = false\n\t@Prop({ reflect: true }) mutable = false\n\t@Prop({ reflect: true }) readonly = false\n\t@Prop() validator?: (value: string) => boolean | { result: boolean; notice: Notice }\n\t@State() backend = new Map<any, Option & { clone: Node }>() // value -> Option\n\t@State() options = new Map<any, Option>() // value -> Option\n\t@State() created = new Map<any, Option.Created>()\n\t@State() search = \"\"\n\t@State() valid = false\n\t@State() display: Node[]\n\t@State() flip = false\n\t@State() flipChecked = false\n\t@Event() notice: EventEmitter<Notice>\n\t@Event() smoothlyPickerMenuLoaded: EventEmitter<Controls>\n\tprivate memory?: { backend: SmoothlyPickerMenu[\"backend\"]; options: SmoothlyPickerMenu[\"options\"] }\n\tprivate listElement?: HTMLElement\n\tprivate searchElement?: HTMLElement\n\n\tcomponentWillLoad() {\n\t\tif (!Observers.has(this.element)) {\n\t\t\tconst threshold = 0.4\n\t\t\tObservers.set(\n\t\t\t\tthis.element,\n\t\t\t\tnew IntersectionObserver(\n\t\t\t\t\tentries =>\n\t\t\t\t\t\t(entries.find(entry => entry.target == this.element)?.intersectionRatio ?? 0) < threshold &&\n\t\t\t\t\t\t!this.flipChecked &&\n\t\t\t\t\t\t((this.flip = !this.flip), (this.flipChecked = true)),\n\t\t\t\t\t{ threshold }\n\t\t\t\t)\n\t\t\t)\n\t\t}\n\t}\n\tcomponentDidLoad() {\n\t\tthis.smoothlyPickerMenuLoaded.emit({\n\t\t\tremember: () => {\n\t\t\t\tthis.memory = {\n\t\t\t\t\tbackend: new Map(Array.from(this.backend.entries(), ([value, option]) => [value, { ...option }])),\n\t\t\t\t\toptions: new Map(Array.from(this.options.entries(), ([value, option]) => [value, { ...option }])),\n\t\t\t\t}\n\t\t\t},\n\t\t\trestore: () => {\n\t\t\t\tif (this.memory) {\n\t\t\t\t\tfor (const option of this.options.values()) {\n\t\t\t\t\t\tconst memory = this.memory.options.get(option.value)\n\t\t\t\t\t\tif (memory != undefined)\n\t\t\t\t\t\t\trestore(option, memory)\n\t\t\t\t\t\telse if (this.created.get(option.value))\n\t\t\t\t\t\t\toption.set.selected((option.selected = false))\n\t\t\t\t\t}\n\t\t\t\t\tfor (const option of this.backend.values()) {\n\t\t\t\t\t\tconst memory = this.memory.backend.get(option.value)\n\t\t\t\t\t\tif (memory != undefined)\n\t\t\t\t\t\t\trestore(option, memory)\n\t\t\t\t\t\telse if (this.created.get(option.value))\n\t\t\t\t\t\t\toption.set.selected((option.selected = false))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t})\n\t}\n\tdisconnectedCallback() {\n\t\tif (!this.element.parentElement) {\n\t\t\tObservers.get(this.element)?.disconnect()\n\t\t\tObservers.remove(this.element)\n\t\t}\n\t}\n\t@Watch(\"open\")\n\topenChange() {\n\t\tconst observer = Observers.get(this.element)\n\t\tif (this.open)\n\t\t\tobserver?.observe(this.element)\n\t\telse\n\t\t\tobserver?.unobserve(this.element)\n\t}\n\n\t@Watch(\"readonly\")\n\treadonlyChanged() {\n\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\toption.element, option.set.readonly(this.readonly)\n\t}\n\t@Listen(\"scroll\", { target: \"window\" })\n\tscrollHandler() {\n\t\tthis.flipChecked = false\n\t}\n\t@Listen(\"smoothlyPickerOptionLoad\")\n\toptionLoadHandler(event: CustomEvent<Option.Load>) {\n\t\tif (!this.listElement || !event.composedPath().includes(this.listElement)) {\n\t\t\tevent.stopPropagation()\n\t\t\tevent.detail.set.readonly(this.readonly)\n\n\t\t\tconst current = this.options.get(event.detail.value)\n\t\t\tif (current)\n\t\t\t\tevent.detail.set.selected(current.element.selected)\n\t\t}\n\t}\n\t@Listen(\"smoothlyPickerOptionLoaded\")\n\toptionLoadedHandler(event: CustomEvent<Option>) {\n\t\tif (!this.listElement || !event.composedPath().includes(this.listElement)) {\n\t\t\tevent.stopPropagation()\n\t\t\tconst current = restore(this.backend.get(event.detail.value), event.detail)\n\t\t\tthis.backend = new Map(\n\t\t\t\tthis.backend\n\t\t\t\t\t.set(event.detail.value, {\n\t\t\t\t\t\t...event.detail,\n\t\t\t\t\t\tclone: current?.clone ?? event.detail.element.cloneNode(true),\n\t\t\t\t\t})\n\t\t\t\t\t.entries()\n\t\t\t)\n\t\t} else\n\t\t\tthis.options.set(event.detail.value, event.detail)\n\t}\n\t@Listen(\"smoothlyPickerOptionChange\")\n\toptionChangeHandler(event: CustomEvent<Option>) {\n\t\tif (!this.listElement || !event.composedPath().includes(this.listElement)) {\n\t\t\tevent.stopPropagation()\n\t\t\tthis.options.get(event.detail.value)?.set.selected(event.detail.selected)\n\t\t} else {\n\t\t\tconst current = this.backend.get(event.detail.value)\n\t\t\tif (current?.element.parentElement)\n\t\t\t\tcurrent?.set.selected(event.detail.selected)\n\t\t}\n\n\t\tif (!this.readonly && !this.multiple && event.detail.selected)\n\t\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\t\tif (option.value != event.detail.value)\n\t\t\t\t\toption.set.selected(false)\n\t}\n\tinputHandler(event: CustomEvent<Record<string, any>>) {\n\t\tevent.stopPropagation()\n\t\tthis.search = event.detail.search\n\t\tif (!this.search) {\n\t\t\tthis.valid = false\n\t\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\t\toption.set.visible(true)\n\t\t} else {\n\t\t\tthis.valid = !Array.from(this.options.values()).find(option => option.value == this.search)\n\t\t\tconst search = this.search.toLocaleLowerCase()\n\t\t\tfor (const option of chain(this.options.values(), this.backend.values())) {\n\t\t\t\tconst value = option.value.toString().toLocaleLowerCase().includes(search)\n\t\t\t\tconst searches = option.search.some(value => value.includes(search))\n\t\t\t\tconst result = value || searches\n\t\t\t\toption.set.visible(result)\n\t\t\t}\n\t\t}\n\t}\n\taddHandler() {\n\t\tconst validation = !this.validator ? true : this.validator(this.search)\n\t\tif (this.mutable) {\n\t\t\tif (typeof validation == \"object\" ? validation.result : validation) {\n\t\t\t\tif (!this.multiple)\n\t\t\t\t\tfor (const option of chain(this.options.values(), this.backend.values()))\n\t\t\t\t\t\toption.set.selected(false)\n\t\t\t\tthis.created = new Map(this.created.set(this.search, { value: this.search, selected: true }).entries())\n\t\t\t\tthis.search = \"\"\n\t\t\t\tthis.searchElement?.focus()\n\t\t\t\tthis.valid = false\n\t\t\t}\n\t\t\tif (typeof validation == \"object\")\n\t\t\t\tthis.notice.emit(validation.notice)\n\t\t}\n\t}\n\tkeyDownHandler(event: KeyboardEvent) {\n\t\tif (event.key == \"Enter\") {\n\t\t\tevent.preventDefault()\n\t\t\tthis.addHandler()\n\t\t}\n\t}\n\t@Listen(\"smoothlySlotEmpty\")\n\temptyDisplayHandler(event: CustomEvent<Slot>) {\n\t\tevent.stopPropagation()\n\t\tevent.detail.set.nodes(this.display)\n\t}\n\trender() {\n\t\treturn (\n\t\t\t<Host class={{ valid: this.valid, flip: this.flip }}>\n\t\t\t\t<smoothly-slotted-elements class={\"hide\"} onSmoothlySlottedChange={e => (this.display = e.detail)}>\n\t\t\t\t\t<slot name=\"display\" />\n\t\t\t\t</smoothly-slotted-elements>\n\t\t\t\t<div class={\"hide\"}>\n\t\t\t\t\t<slot />\n\t\t\t\t\t{Array.from(this.created.values(), option => (\n\t\t\t\t\t\t<smoothly-picker-option key={option.value} value={option.value} selected={option.selected}>\n\t\t\t\t\t\t\t{option.value}\n\t\t\t\t\t\t\t<smoothly-slot-elements slot=\"display\" nodes={this.display} />\n\t\t\t\t\t\t</smoothly-picker-option>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t\t<div class={\"controls\"}>\n\t\t\t\t\t<smoothly-input\n\t\t\t\t\t\tref={e => (this.searchElement = e)}\n\t\t\t\t\t\tname=\"search\"\n\t\t\t\t\t\tvalue={this.search}\n\t\t\t\t\t\tlooks={this.looks}\n\t\t\t\t\t\tonKeyDown={e => this.keyDownHandler(e)}\n\t\t\t\t\t\tonSmoothlyInput={e => this.inputHandler(e)}\n\t\t\t\t\t\tonSmoothlyChange={e => e.stopPropagation()}\n\t\t\t\t\t\tonSmoothlyBlur={e => e.stopPropagation()}>\n\t\t\t\t\t\t<slot name=\"search\" />\n\t\t\t\t\t</smoothly-input>\n\t\t\t\t\t{this.mutable && !this.readonly ? (\n\t\t\t\t\t\t<button onClick={() => this.addHandler()} disabled={!this.valid} type={\"button\"}>\n\t\t\t\t\t\t\t<smoothly-icon name=\"add-outline\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t<div class={\"list\"} ref={e => (this.listElement = e)}>\n\t\t\t\t\t{Array.from(this.backend.values())\n\t\t\t\t\t\t.sort((a, b) => a.position - b.position)\n\t\t\t\t\t\t.map(option => (\n\t\t\t\t\t\t\t<smoothly-slot-elements ref={e => restoreListener(e, option)} clone={false} nodes={option.clone} />\n\t\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
|
|
@@ -4,31 +4,41 @@
|
|
|
4
4
|
gap: 0.5rem;
|
|
5
5
|
position: absolute;
|
|
6
6
|
z-index: 4;
|
|
7
|
-
top: 100%;
|
|
8
7
|
left: -1px;
|
|
9
8
|
right: -1px;
|
|
9
|
+
min-width: max-content;
|
|
10
10
|
background-color: rgb(var(--background-color, var(--smoothly-color-shade)));
|
|
11
11
|
padding: 0.5rem;
|
|
12
12
|
border: rgb(var(--text-color, var(--smoothly-color-contrast))) solid 1px;
|
|
13
13
|
}
|
|
14
|
-
.
|
|
14
|
+
:host:not(.flip) {
|
|
15
|
+
top: 100%;
|
|
16
|
+
}
|
|
17
|
+
:host.flip {
|
|
18
|
+
bottom: 100%;
|
|
19
|
+
}
|
|
20
|
+
:host:not([open]) {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
:host .list {
|
|
15
24
|
display: grid;
|
|
16
25
|
grid-template-columns: auto 1fr auto;
|
|
17
26
|
align-items: center;
|
|
18
27
|
row-gap: 0.5ch;
|
|
19
|
-
overflow: auto;
|
|
28
|
+
overflow-y: auto;
|
|
20
29
|
max-height: calc(1.75rem * 10 + 0.5ch * 9);
|
|
21
30
|
padding-right: 0.5rem;
|
|
31
|
+
padding-bottom: 0.25rem;
|
|
22
32
|
}
|
|
23
|
-
.hide {
|
|
33
|
+
:host .hide {
|
|
24
34
|
display: none;
|
|
25
35
|
}
|
|
26
|
-
.controls {
|
|
36
|
+
:host .controls {
|
|
27
37
|
display: grid;
|
|
28
38
|
grid-template-columns: 1fr auto;
|
|
29
39
|
gap: 0.5rem;
|
|
30
40
|
transition: grid-template-columns 200ms linear;
|
|
31
41
|
}
|
|
32
|
-
.controls > button:disabled {
|
|
42
|
+
:host .controls > button:disabled {
|
|
33
43
|
opacity: 0.3;
|
|
34
44
|
}
|
|
@@ -17,10 +17,12 @@ export class SmoothlyPickerOption {
|
|
|
17
17
|
this.visible = true;
|
|
18
18
|
this.value = undefined;
|
|
19
19
|
this.search = [];
|
|
20
|
+
this.position = -1;
|
|
20
21
|
this.readonly = false;
|
|
21
22
|
this.slotted = [];
|
|
22
23
|
}
|
|
23
24
|
get option() {
|
|
25
|
+
var _a;
|
|
24
26
|
return {
|
|
25
27
|
element: this.element,
|
|
26
28
|
selected: this.selected,
|
|
@@ -29,6 +31,9 @@ export class SmoothlyPickerOption {
|
|
|
29
31
|
search: this.search,
|
|
30
32
|
value: this.value,
|
|
31
33
|
slotted: this.slotted,
|
|
34
|
+
position: this.position >= 0 || !((_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement)
|
|
35
|
+
? this.position
|
|
36
|
+
: Array.from(this.element.parentElement.parentElement.children).indexOf(this.element.parentElement),
|
|
32
37
|
set: {
|
|
33
38
|
selected: selected => (this.selected = selected),
|
|
34
39
|
readonly: readonly => (this.readonly = readonly),
|
|
@@ -60,7 +65,7 @@ export class SmoothlyPickerOption {
|
|
|
60
65
|
this.selected = !this.selected;
|
|
61
66
|
}
|
|
62
67
|
render() {
|
|
63
|
-
return (h(Host, { class: { visible: this.visible }, onClick: () => this.clickHandler() }, h("div", { class: "display" }, h("slot", { name: "display" })), h("div", { class: "content" }, h("smoothly-slotted-elements", { onSmoothlySlottedChange: e => this.slottedChangeHandler(e), clone: true }, h("slot", null)), h("slot", { name: "label" })), h("button", { type: "button" }, h("smoothly-icon", { name: this.selected ? "checkbox-outline" : "square-outline" }))));
|
|
68
|
+
return (h(Host, { class: { visible: this.visible }, onClick: () => this.clickHandler() }, h("div", { part: "display", class: "display" }, h("slot", { name: "display" })), h("div", { part: "content", class: "content" }, h("smoothly-slotted-elements", { onSmoothlySlottedChange: e => this.slottedChangeHandler(e), clone: true }, h("slot", null)), h("slot", { name: "label" })), h("button", { type: "button" }, h("smoothly-icon", { name: this.selected ? "checkbox-outline" : "square-outline" }))));
|
|
64
69
|
}
|
|
65
70
|
static get is() { return "smoothly-picker-option"; }
|
|
66
71
|
static get encapsulation() { return "shadow"; }
|
|
@@ -144,6 +149,24 @@ export class SmoothlyPickerOption {
|
|
|
144
149
|
"text": ""
|
|
145
150
|
},
|
|
146
151
|
"defaultValue": "[]"
|
|
152
|
+
},
|
|
153
|
+
"position": {
|
|
154
|
+
"type": "number",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "number",
|
|
158
|
+
"resolved": "number",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": ""
|
|
166
|
+
},
|
|
167
|
+
"attribute": "position",
|
|
168
|
+
"reflect": true,
|
|
169
|
+
"defaultValue": "-1"
|
|
147
170
|
}
|
|
148
171
|
};
|
|
149
172
|
}
|
|
@@ -166,7 +189,7 @@ export class SmoothlyPickerOption {
|
|
|
166
189
|
},
|
|
167
190
|
"complexType": {
|
|
168
191
|
"original": "Option.Load",
|
|
169
|
-
"resolved": "{ value: any; selected: boolean; readonly: boolean; element: HTMLSmoothlyPickerOptionElement; search: string[]; visible: boolean; set: { selected: (selected: boolean) => void; visible: (visible: boolean) => void; readonly: (readonly: boolean) => void; search: (search: string[]) => void; value: (value: any) => void; }; }",
|
|
192
|
+
"resolved": "{ value: any; selected: boolean; readonly: boolean; element: HTMLSmoothlyPickerOptionElement; search: string[]; visible: boolean; position: number; set: { selected: (selected: boolean) => void; visible: (visible: boolean) => void; readonly: (readonly: boolean) => void; search: (search: string[]) => void; value: (value: any) => void; }; }",
|
|
170
193
|
"references": {
|
|
171
194
|
"Option": {
|
|
172
195
|
"location": "import",
|
|
@@ -239,6 +262,9 @@ export class SmoothlyPickerOption {
|
|
|
239
262
|
static get elementRef() { return "element"; }
|
|
240
263
|
static get watchers() {
|
|
241
264
|
return [{
|
|
265
|
+
"propName": "position",
|
|
266
|
+
"methodName": "emitChange"
|
|
267
|
+
}, {
|
|
242
268
|
"propName": "selected",
|
|
243
269
|
"methodName": "emitChange"
|
|
244
270
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/picker/option/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAO5G,MAAM,OAAO,oBAAoB;;oBAEmB,KAAK;mBACN,IAAI;;kBAEV,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/picker/option/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAO5G,MAAM,OAAO,oBAAoB;;oBAEmB,KAAK;mBACN,IAAI;;kBAEV,EAAE;oBACV,CAAC,CAAC;oBAClB,KAAK;mBACE,EAAE;;EAK7B,IAAI,MAAM;;IACT,OAAO;MACN,OAAO,EAAE,IAAI,CAAC,OAAO;MACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;MACvB,QAAQ,EAAE,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from \"@stencil/core\"\nimport { Option } from \"../../../model\"\n@Component({\n\ttag: \"smoothly-picker-option\",\n\tstyleUrl: \"style.css\",\n\tshadow: true,\n})\nexport class SmoothlyPickerOption {\n\t@Element() element: HTMLSmoothlyPickerOptionElement\n\t@Prop({ mutable: true, reflect: true }) selected = false\n\t@Prop({ mutable: true, reflect: true }) visible = true\n\t@Prop({ mutable: true }) value: any\n\t@Prop({ mutable: true }) search: string[] = []\n\t@Prop({ reflect: true }) position = -1\n\t@State() readonly = false\n\t@State() slotted: Node[] = []\n\t@Event() smoothlyPickerOptionLoad: EventEmitter<Option.Load>\n\t@Event() smoothlyPickerOptionLoaded: EventEmitter<Option>\n\t@Event() smoothlyPickerOptionChange: EventEmitter<Option>\n\n\tget option(): Option {\n\t\treturn {\n\t\t\telement: this.element,\n\t\t\tselected: this.selected,\n\t\t\treadonly: this.readonly,\n\t\t\tvisible: this.visible,\n\t\t\tsearch: this.search,\n\t\t\tvalue: this.value,\n\t\t\tslotted: this.slotted,\n\t\t\tposition:\n\t\t\t\tthis.position >= 0 || !this.element.parentElement?.parentElement\n\t\t\t\t\t? this.position\n\t\t\t\t\t: Array.from(this.element.parentElement.parentElement.children).indexOf(this.element.parentElement),\n\t\t\tset: {\n\t\t\t\tselected: selected => (this.selected = selected),\n\t\t\t\treadonly: readonly => (this.readonly = readonly),\n\t\t\t\tvisible: visible => (this.visible = visible),\n\t\t\t\tsearch: search => (this.search = search),\n\t\t\t\tvalue: value => (this.value = value),\n\t\t\t},\n\t\t}\n\t}\n\t@Watch(\"position\")\n\t@Watch(\"selected\")\n\t@Watch(\"slotted\")\n\temitChange() {\n\t\tif (this.element.parentElement)\n\t\t\tthis.smoothlyPickerOptionChange.emit(this.option)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.smoothlyPickerOptionLoad.emit((({ slotted, ...option }) => option)(this.option))\n\t}\n\tcomponentDidLoad() {\n\t\tthis.smoothlyPickerOptionLoaded.emit(this.option)\n\t}\n\tslottedChangeHandler(event: CustomEvent<Node[]>) {\n\t\tevent.stopPropagation()\n\t\tthis.slotted = event.detail\n\t}\n\t@Method()\n\tasync clickHandler() {\n\t\tif (!this.readonly)\n\t\t\tthis.selected = !this.selected\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={{ visible: this.visible }} onClick={() => this.clickHandler()}>\n\t\t\t\t<div part=\"display\" class={\"display\"}>\n\t\t\t\t\t<slot name=\"display\" />\n\t\t\t\t</div>\n\t\t\t\t<div part=\"content\" class={\"content\"}>\n\t\t\t\t\t<smoothly-slotted-elements onSmoothlySlottedChange={e => this.slottedChangeHandler(e)} clone>\n\t\t\t\t\t\t<slot />\n\t\t\t\t\t</smoothly-slotted-elements>\n\t\t\t\t\t<slot name={\"label\"} />\n\t\t\t\t</div>\n\t\t\t\t<button type={\"button\"}>\n\t\t\t\t\t<smoothly-icon name={this.selected ? \"checkbox-outline\" : \"square-outline\"} />\n\t\t\t\t</button>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
|
|
@@ -8,18 +8,17 @@
|
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
padding: 0.25ch 0.5rem
|
|
10
10
|
}
|
|
11
|
-
.display {
|
|
11
|
+
:host .display {
|
|
12
12
|
padding-left: 0;
|
|
13
13
|
}
|
|
14
|
-
button {
|
|
14
|
+
:host button {
|
|
15
15
|
color: unset;
|
|
16
16
|
background-color: inherit;
|
|
17
17
|
border: none;
|
|
18
18
|
padding-right: 0;
|
|
19
19
|
}
|
|
20
|
-
.content {
|
|
20
|
+
:host .content {
|
|
21
21
|
display: flex;
|
|
22
22
|
column-gap: 1rem;
|
|
23
|
-
flex-wrap: wrap;
|
|
24
23
|
justify-content: space-between;
|
|
25
24
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const observers = new WeakMap();
|
|
2
|
+
export var Observers;
|
|
3
|
+
(function (Observers) {
|
|
4
|
+
function get(...parameters) {
|
|
5
|
+
return observers.get(...parameters);
|
|
6
|
+
}
|
|
7
|
+
Observers.get = get;
|
|
8
|
+
function set(...parameters) {
|
|
9
|
+
observers.set(...parameters);
|
|
10
|
+
return Observers;
|
|
11
|
+
}
|
|
12
|
+
Observers.set = set;
|
|
13
|
+
function remove(...parameters) {
|
|
14
|
+
return observers.delete(...parameters);
|
|
15
|
+
}
|
|
16
|
+
Observers.remove = remove;
|
|
17
|
+
function has(...parameters) {
|
|
18
|
+
return observers.has(...parameters);
|
|
19
|
+
}
|
|
20
|
+
Observers.has = has;
|
|
21
|
+
})(Observers || (Observers = {}));
|
|
22
|
+
//# sourceMappingURL=Observers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Observers.js","sourceRoot":"","sources":["../../src/global/Observers.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,IAAI,OAAO,EAAqC,CAAA;AAClE,MAAM,KAAW,SAAS,CAczB;AAdD,WAAiB,SAAS;EACzB,SAAgB,GAAG,CAAC,GAAG,UAA4C;IAClE,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAA;EACpC,CAAC;EAFe,aAAG,MAElB,CAAA;EACD,SAAgB,GAAG,CAAC,GAAG,UAA4C;IAClE,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAA;IAC5B,OAAO,SAAS,CAAA;EACjB,CAAC;EAHe,aAAG,MAGlB,CAAA;EACD,SAAgB,MAAM,CAAC,GAAG,UAA+C;IACxE,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAA;EACvC,CAAC;EAFe,gBAAM,SAErB,CAAA;EACD,SAAgB,GAAG,CAAC,GAAG,UAA4C;IAClE,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAA;EACpC,CAAC;EAFe,aAAG,MAElB,CAAA;AACF,CAAC,EAdgB,SAAS,KAAT,SAAS,QAczB","sourcesContent":["const observers = new WeakMap<HTMLElement, IntersectionObserver>()\nexport namespace Observers {\n\texport function get(...parameters: Parameters<typeof observers.get>): ReturnType<typeof observers.get> {\n\t\treturn observers.get(...parameters)\n\t}\n\texport function set(...parameters: Parameters<typeof observers.set>): typeof Observers {\n\t\tobservers.set(...parameters)\n\t\treturn Observers\n\t}\n\texport function remove(...parameters: Parameters<typeof observers.delete>): ReturnType<typeof observers.delete> {\n\t\treturn observers.delete(...parameters)\n\t}\n\texport function has(...parameters: Parameters<typeof observers.has>): ReturnType<typeof observers.has> {\n\t\treturn observers.has(...parameters)\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/global/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,MAAM,CAAC,OAAO;EACb,OAAO,EAAE,SAAS,EAAE,CAAA;AACrB,CAAC","sourcesContent":["import { Observers } from \"./Observers\"\nexport default function () {\n\treturn { Observers }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option.js","sourceRoot":"","sources":["../../src/model/Option.ts"],"names":[],"mappings":"","sourcesContent":["export interface Option {\n\telement: HTMLSmoothlyPickerOptionElement\n\tselected: boolean\n\treadonly: boolean\n\tvisible: boolean\n\tsearch: string[]\n\tvalue: any\n\tslotted: Node[]\n\tset: {\n\t\tselected: (selected: boolean) => void\n\t\tvisible: (visible: boolean) => void\n\t\treadonly: (readonly: boolean) => void\n\t\tsearch: (search: string[]) => void\n\t\tvalue: (value: any) => void\n\t}\n}\nexport namespace Option {\n\texport type Load = Omit<Option, \"slotted\">\n\texport interface Created {\n\t\tvalue: string\n\t\tselected: boolean\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Option.js","sourceRoot":"","sources":["../../src/model/Option.ts"],"names":[],"mappings":"","sourcesContent":["export interface Option {\n\telement: HTMLSmoothlyPickerOptionElement\n\tselected: boolean\n\treadonly: boolean\n\tvisible: boolean\n\tsearch: string[]\n\tvalue: any\n\tslotted: Node[]\n\tposition: number\n\tset: {\n\t\tselected: (selected: boolean) => void\n\t\tvisible: (visible: boolean) => void\n\t\treadonly: (readonly: boolean) => void\n\t\tsearch: (search: string[]) => void\n\t\tvalue: (value: any) => void\n\t}\n}\nexport namespace Option {\n\texport type Load = Omit<Option, \"slotted\">\n\texport interface Created {\n\t\tvalue: string\n\t\tselected: boolean\n\t}\n}\n"]}
|