@nanoporetech-digital/components 6.8.1 → 6.8.2
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/CHANGELOG.md +11 -0
- package/dist/cjs/nano-more-less.cjs.entry.js +17 -11
- package/dist/cjs/nano-more-less.cjs.entry.js.map +1 -1
- package/dist/cjs/{nano-table-a578c5a2.js → nano-table-d92fc978.js} +2 -2
- package/dist/cjs/{nano-table-a578c5a2.js.map → nano-table-d92fc978.js.map} +1 -1
- package/dist/cjs/nano-table.cjs.entry.js +1 -1
- package/dist/cjs/{table.worker-3a73e248.js → table.worker-370e3f49.js} +2 -2
- package/dist/cjs/table.worker-370e3f49.js.map +1 -0
- package/dist/collection/components/more-less/more-less.js +17 -11
- package/dist/collection/components/more-less/more-less.js.map +1 -1
- package/dist/components/nano-more-less.js +17 -11
- package/dist/components/nano-more-less.js.map +1 -1
- package/dist/esm/nano-more-less.entry.js +17 -11
- package/dist/esm/nano-more-less.entry.js.map +1 -1
- package/dist/esm/{nano-table-92092ea8.js → nano-table-7b6d2752.js} +2 -2
- package/dist/esm/{nano-table-92092ea8.js.map → nano-table-7b6d2752.js.map} +1 -1
- package/dist/esm/nano-table.entry.js +1 -1
- package/dist/esm/{table.worker-5e8af93c.js → table.worker-e08f657d.js} +2 -2
- package/dist/esm/table.worker-e08f657d.js.map +1 -0
- package/dist/nano-components/nano-more-less.entry.js +1 -1
- package/dist/nano-components/nano-more-less.entry.js.map +1 -1
- package/dist/nano-components/nano-table-7b6d2752.js +5 -0
- package/dist/nano-components/{nano-table-92092ea8.js.map → nano-table-7b6d2752.js.map} +1 -1
- package/dist/nano-components/nano-table.entry.js +1 -1
- package/dist/nano-components/{table.worker-5e8af93c.js → table.worker-e08f657d.js} +2 -2
- package/dist/types/components/more-less/more-less.d.ts +1 -1
- package/docs-json.json +1 -1
- package/hydrate/index.js +17 -11
- package/package.json +2 -2
- package/dist/cjs/table.worker-3a73e248.js.map +0 -1
- package/dist/esm/table.worker-5e8af93c.js.map +0 -1
- package/dist/nano-components/nano-table-92092ea8.js +0 -5
- /package/dist/nano-components/{table.worker-5e8af93c.js.map → table.worker-e08f657d.js.map} +0 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [6.8.2](https://git.oxfordnanolabs.local/Digital/nano-components/compare/v6.8.1...v6.8.2) (2024-11-08)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* **more-less:** don't show buttons unless there are enough items ([bd7889e](https://git.oxfordnanolabs.local/Digital/nano-components/commits/bd7889e35ed084c540e4e5c8497d775bf78f2337))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
6
17
|
## [6.8.1](https://git.oxfordnanolabs.local/Digital/nano-components/compare/v6.8.0...v6.8.1) (2024-11-07)
|
7
18
|
|
8
19
|
|
@@ -17,11 +17,16 @@ const Rating = class {
|
|
17
17
|
this.noHideBtn = false;
|
18
18
|
}
|
19
19
|
get children() {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
let children;
|
21
|
+
if (this.childrenSelector) {
|
22
|
+
children = this.host.querySelectorAll(this.childrenSelector);
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
children = this.host.__children.length
|
26
|
+
? this.host.__children
|
27
|
+
: this.host.children;
|
28
|
+
}
|
29
|
+
return Array.from(children).filter((ele) => !ele.hasAttribute('slot'));
|
25
30
|
}
|
26
31
|
handleShowHideElements() {
|
27
32
|
this.slottedElements.forEach((ele, i) => {
|
@@ -30,7 +35,7 @@ const Rating = class {
|
|
30
35
|
ele.style.display = '';
|
31
36
|
}
|
32
37
|
}
|
33
|
-
else if (i >= this.maxToShow
|
38
|
+
else if (i >= this.maxToShow) {
|
34
39
|
ele.style.display = 'none';
|
35
40
|
}
|
36
41
|
});
|
@@ -42,11 +47,9 @@ const Rating = class {
|
|
42
47
|
mo.observe(this.host, { childList: true });
|
43
48
|
}
|
44
49
|
processSlottedContent() {
|
45
|
-
const
|
46
|
-
console.log(elements);
|
47
|
-
const diff = elements.filter((x) => !this.slottedElements.includes(x));
|
50
|
+
const diff = this.children.filter((x) => !this.slottedElements.includes(x));
|
48
51
|
if (diff?.length)
|
49
|
-
this.slottedElements =
|
52
|
+
this.slottedElements = this.children;
|
50
53
|
}
|
51
54
|
handleClick(_e) {
|
52
55
|
this.show = !this.show;
|
@@ -62,7 +65,10 @@ const Rating = class {
|
|
62
65
|
this.mo.disconnect();
|
63
66
|
}
|
64
67
|
render() {
|
65
|
-
return (index.h(index.Host, null, index.h("slot", null),
|
68
|
+
return (index.h(index.Host, null, index.h("slot", null), this.slottedElements?.length > this.maxToShow && [
|
69
|
+
index.h("div", { style: { display: this.show ? 'none' : 'contents' }, class: "button-wrapper", part: "button-wrapper button-wrapper--less", onClick: (e) => this.handleClick(e) }, index.h("slot", { name: "less" }, index.h("button", null, "Show more (+", this.slottedElements.length - this.maxToShow, ")"))),
|
70
|
+
!this.noHideBtn ? (index.h("div", { style: { display: this.show ? 'contents' : 'none' }, class: "button-wrapper", part: "button-wrapper button-wrapper--more", onClick: (e) => this.handleClick(e) }, index.h("slot", { name: "more" }, index.h("button", null, "Show less (-", this.slottedElements.length - this.maxToShow, ")")))) : (''),
|
71
|
+
]));
|
66
72
|
}
|
67
73
|
get host() { return index.getElement(this); }
|
68
74
|
static get watchers() { return {
|
@@ -1 +1 @@
|
|
1
|
-
{"file":"nano-more-less.entry.cjs.js","mappings":";;;;;;;;;MA4Ba,MAAM;;;2BAGyB,EAAE;gBAIG,KAAK;;qBAOhC,CAAC;qBAGD,KAAK;;EAEzB,IAAI,QAAQ;IACV,IAAI,IAAI,CAAC,gBAAgB;
|
1
|
+
{"file":"nano-more-less.entry.cjs.js","mappings":";;;;;;;;;MA4Ba,MAAM;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AI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,MAClD,CACJ,CACH,KAEN,EAAE,CACH;KACF,CACI,EACP;GACH;;;;;;;;;;;;","names":["h","Host"],"sources":["./src/components/more-less/more-less.tsx"],"sourcesContent":["import {\n Component,\n Element,\n Prop,\n h,\n ComponentInterface,\n Host,\n Build,\n Watch,\n State,\n} from '@stencil/core';\n\n/**\n * A simple component to show more or less elements.\n *\n * @slot less - a button displayed when all fewer are shown. When clicked will show elements\n * @slot more - a button displayed when all items are shown. When clicked will hide elements\n * @slot - default slot displaying children elements to show or hide\n *\n * @part button-wrapper - wraps the 'more' / 'less' buttons\n * @part button-wrapper--more - wraps the 'more' button\n * @part button-wrapper--less - wraps the 'less' button\n */\n@Component({\n tag: 'nano-more-less',\n scoped: true,\n styles: /* css */ `:host { display: contents; }`,\n})\nexport class Rating implements ComponentInterface {\n private mo: MutationObserver;\n\n @State() slottedElements: HTMLElement[] = [];\n @Element() host: HTMLNanoMoreLessElement;\n\n /** The default state. `false` - excess items are hidden. `true` - excess items are shown. */\n @Prop({ reflect: true, mutable: true }) show = false;\n\n /** Optional JS selector to target which elements to hide or show */\n @Prop() childrenSelector: string;\n\n /** The maximum number of items to show when `show` is true.\n * Excess items will be hidden. */\n @Prop() maxToShow = 3;\n\n /** Only show the 'show more' button */\n @Prop() noHideBtn = false;\n\n get children() {\n let children: NodeListOf<Element> | HTMLCollectionOf<Element>;\n\n if (this.childrenSelector) {\n children = this.host.querySelectorAll(this.childrenSelector);\n } else {\n children = this.host.__children.length\n ? this.host.__children\n : this.host.children;\n }\n return Array.from(children).filter(\n (ele) => !ele.hasAttribute('slot')\n ) as HTMLElement[];\n }\n\n @Watch('slottedElements')\n @Watch('maxToShow')\n @Watch('show')\n handleShowHideElements() {\n this.slottedElements.forEach((ele, i) => {\n if (this.show) {\n if (ele.style.display === 'none') {\n ele.style.display = '';\n }\n } else if (i >= this.maxToShow) {\n ele.style.display = 'none';\n }\n });\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n const mo = (this.mo = new MutationObserver(() => {\n this.processSlottedContent();\n }));\n mo.observe(this.host, { childList: true });\n }\n\n private processSlottedContent() {\n const diff = this.children.filter((x) => !this.slottedElements.includes(x));\n if (diff?.length) this.slottedElements = this.children;\n }\n\n private handleClick(_e: MouseEvent) {\n this.show = !this.show;\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n connectedCallback() {\n this.processSlottedContent();\n }\n\n disconnectedCallback() {\n if (Build.isBrowser && this.mo) this.mo.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n {this.slottedElements?.length > this.maxToShow && [\n <div\n style={{ display: this.show ? 'none' : 'contents' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--less\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"less\">\n <button>\n Show more (+{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>,\n !this.noHideBtn ? (\n <div\n style={{ display: this.show ? 'contents' : 'none' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--more\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"more\">\n <button>\n Show less (-{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n ) : (\n ''\n ),\n ]}\n </Host>\n );\n }\n}\n"],"version":3}
|
@@ -113,7 +113,7 @@ const createWorkerProxy = (worker, workerMsgId, exportedMethod) => (
|
|
113
113
|
})
|
114
114
|
);
|
115
115
|
|
116
|
-
const workerPromise = Promise.resolve().then(function () { return require('./table.worker-
|
116
|
+
const workerPromise = Promise.resolve().then(function () { return require('./table.worker-370e3f49.js'); }).then(m => m.worker);
|
117
117
|
const createWorkerStore = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'createWorkerStore');
|
118
118
|
const syncConfigToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncConfigToWorker');
|
119
119
|
const syncDataToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncDataToWorker');
|
@@ -1783,4 +1783,4 @@ Table.style = tableCss;
|
|
1783
1783
|
exports.Table = Table;
|
1784
1784
|
exports.createWorker = createWorker;
|
1785
1785
|
|
1786
|
-
//# sourceMappingURL=nano-table-
|
1786
|
+
//# sourceMappingURL=nano-table-d92fc978.js.map
|