@3t-transform/threeteeui 0.0.14 → 0.0.16
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/{index-bf39be87.js → index-864b7110.js} +4 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/tttx-button.cjs.entry.js +18 -18
- package/dist/cjs/tttx-checkbox.cjs.entry.js +18 -18
- package/dist/cjs/tttx-form.cjs.entry.js +364 -176
- package/dist/cjs/tttx-icon.cjs.entry.js +56 -54
- package/dist/cjs/tttx-list.cjs.entry.js +188 -188
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
- package/dist/cjs/tttx-popover-content.cjs.entry.js +13 -13
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +127 -127
- package/dist/cjs/tttx-table.cjs.entry.js +60 -0
- package/dist/cjs/tttx.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +93 -93
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +25 -25
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +116 -114
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +32 -32
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +66 -66
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +96 -96
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +23 -23
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +101 -101
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +9 -9
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +451 -249
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +109 -102
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +311 -311
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +15 -15
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +569 -569
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +134 -134
- package/dist/collection/components/molecules/tttx-table/tttx-table.css +166 -0
- package/dist/collection/components/molecules/tttx-table/tttx-table.js +177 -0
- package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +81 -0
- package/dist/collection/components/palette.stories.js +7 -7
- package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
- package/dist/collection/icons.js +2838 -2838
- package/dist/collection/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/tttx-button.js +35 -35
- package/dist/components/tttx-checkbox.js +36 -36
- package/dist/components/tttx-form.js +381 -193
- package/dist/components/tttx-icon2.js +73 -71
- package/dist/components/tttx-list.js +214 -214
- package/dist/components/tttx-loading-spinner2.js +33 -33
- package/dist/components/tttx-popover-content.js +1 -37
- package/dist/components/tttx-popover-content2.js +39 -0
- package/dist/components/tttx-standalone-input.js +169 -168
- package/dist/components/tttx-table.d.ts +11 -0
- package/dist/components/tttx-table.js +91 -0
- package/dist/esm/{index-63c4d25e.js → index-232e347b.js} +4 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/tttx-button.entry.js +18 -18
- package/dist/esm/tttx-checkbox.entry.js +18 -18
- package/dist/esm/tttx-form.entry.js +364 -176
- package/dist/esm/tttx-icon.entry.js +56 -54
- package/dist/esm/tttx-list.entry.js +188 -188
- package/dist/esm/tttx-loading-spinner.entry.js +16 -16
- package/dist/esm/tttx-popover-content.entry.js +13 -13
- package/dist/esm/tttx-standalone-input.entry.js +127 -127
- package/dist/esm/tttx-table.entry.js +56 -0
- package/dist/esm/tttx.js +3 -3
- package/dist/tttx/{p-2d54f8aa.entry.js → p-01e1894e.entry.js} +1 -1
- package/dist/tttx/{p-709246f5.entry.js → p-10316ff1.entry.js} +1 -1
- package/dist/tttx/p-125f06b3.entry.js +1 -0
- package/dist/tttx/p-184c4fae.js +2 -0
- package/dist/tttx/{p-ad0c3fe4.entry.js → p-3973b7dd.entry.js} +1 -1
- package/dist/tttx/p-5ce1ba22.entry.js +1 -0
- package/dist/tttx/{p-4c57bcbd.entry.js → p-6828fe6f.entry.js} +1 -1
- package/dist/tttx/p-b1c22f5f.entry.js +1 -0
- package/dist/tttx/{p-1a4eb1f3.entry.js → p-c7f9be65.entry.js} +1 -1
- package/dist/tttx/{p-2b6720ac.entry.js → p-fe4c70b2.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +9 -9
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +20 -20
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +14 -14
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +21 -21
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +7 -7
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +18 -18
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +9 -9
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +6 -6
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +134 -18
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +12 -6
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +51 -51
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +13 -13
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +38 -38
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +106 -106
- package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +15 -0
- package/dist/types/components/molecules/tttx-table/tttx-table.stories.d.ts +21 -0
- package/dist/types/components/palette.stories.d.ts +6 -6
- package/dist/types/components.d.ts +29 -1
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
- package/dist/types/icons.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +7 -4
- package/dist/tttx/p-28e4c359.entry.js +0 -1
- package/dist/tttx/p-95a29e09.entry.js +0 -1
- package/dist/tttx/p-bec472d8.js +0 -2
|
@@ -1799,77 +1799,79 @@ var createPopper = /*#__PURE__*/popperGenerator({
|
|
|
1799
1799
|
|
|
1800
1800
|
const tttxIconCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}:host{display:block}.tooltip{background:#ffffff;color:#343434;font-weight:bold;padding:8px 16px;font-size:13px;border-radius:4px;box-shadow:0 0 5px 1px rgba(0, 0, 0, 0.3);display:none}.tooltip[data-show]{display:block}.arrow,.arrow::before{position:absolute;width:8px;height:8px;background:inherit}.arrow{visibility:hidden}.arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.tooltip[data-popper-placement^=top]>.arrow{bottom:-4px}.tooltip[data-popper-placement^=bottom]>.arrow{top:-4px}.tooltip[data-popper-placement^=left]>.arrow{right:-4px}.tooltip[data-popper-placement^=right]>.arrow{left:-4px}.red{color:#dc0000}.orange{color:#f59500}.blue{color:#1479c6}.green{color:#a2bb31}.gray{color:#757575}.black{color:#212121}.white{color:white}.clickable{cursor:pointer}";
|
|
1801
1801
|
|
|
1802
|
-
const TttxIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
|
|
1803
|
-
constructor() {
|
|
1804
|
-
super();
|
|
1805
|
-
this.__registerHost();
|
|
1806
|
-
this.__attachShadow();
|
|
1807
|
-
this.icon = undefined;
|
|
1808
|
-
this.colour = 'grey';
|
|
1809
|
-
}
|
|
1810
|
-
handleDocumentClick(event) {
|
|
1811
|
-
if (!event.composedPath().includes(this.referenceElement)) {
|
|
1812
|
-
if (this.popperElement) {
|
|
1813
|
-
this.popperElement.removeAttribute('data-show');
|
|
1814
|
-
}
|
|
1815
|
-
if (this.popperInstance) {
|
|
1816
|
-
this.popperInstance.update();
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
componentWillLoad() {
|
|
1821
|
-
this.hasPopoverSlot = !!this.el.querySelector('[slot="popover"]');
|
|
1822
|
-
}
|
|
1823
|
-
componentDidLoad() {
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1802
|
+
const TttxIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
|
|
1803
|
+
constructor() {
|
|
1804
|
+
super();
|
|
1805
|
+
this.__registerHost();
|
|
1806
|
+
this.__attachShadow();
|
|
1807
|
+
this.icon = undefined;
|
|
1808
|
+
this.colour = 'grey';
|
|
1809
|
+
}
|
|
1810
|
+
handleDocumentClick(event) {
|
|
1811
|
+
if (!event.composedPath().includes(this.referenceElement)) {
|
|
1812
|
+
if (this.popperElement) {
|
|
1813
|
+
this.popperElement.removeAttribute('data-show');
|
|
1814
|
+
}
|
|
1815
|
+
if (this.popperInstance) {
|
|
1816
|
+
this.popperInstance.update();
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
componentWillLoad() {
|
|
1821
|
+
this.hasPopoverSlot = !!this.el.querySelector('[slot="popover"]');
|
|
1822
|
+
}
|
|
1823
|
+
componentDidLoad() {
|
|
1824
|
+
if (this.popperElement) {
|
|
1825
|
+
this.popperInstance = createPopper(this.referenceElement, this.popperElement, {
|
|
1826
|
+
placement: 'top',
|
|
1827
|
+
modifiers: [
|
|
1828
|
+
{
|
|
1829
|
+
name: 'flip',
|
|
1830
|
+
options: {
|
|
1831
|
+
fallbackPlacements: ['bottom'],
|
|
1832
|
+
},
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
name: 'offset',
|
|
1836
|
+
options: {
|
|
1837
|
+
offset: [0, 12],
|
|
1838
|
+
},
|
|
1839
|
+
},
|
|
1840
|
+
],
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
disconnectedCallback() {
|
|
1845
|
+
this.popperInstance.destroy();
|
|
1846
|
+
}
|
|
1847
|
+
render() {
|
|
1848
|
+
return (h(Host, null, h("span", { onClick: () => {
|
|
1849
|
+
if (this.popperElement) {
|
|
1850
|
+
this.popperElement.setAttribute('data-show', '');
|
|
1851
|
+
}
|
|
1852
|
+
if (this.popperInstance) {
|
|
1853
|
+
this.popperInstance.update();
|
|
1854
|
+
}
|
|
1855
|
+
}, ref: el => (this.referenceElement = el), class: `material-symbols-rounded ${this.colour ? this.colour : ''} ${this.hasPopoverSlot ? 'clickable' : ''}` }, this.icon), this.hasPopoverSlot && (h("div", { ref: el => (this.popperElement = el), class: "tooltip" }, h("slot", { name: "popover" }), h("div", { class: "arrow", "data-popper-arrow": true })))));
|
|
1856
|
+
}
|
|
1857
|
+
get el() { return this; }
|
|
1858
|
+
static get style() { return tttxIconCss; }
|
|
1859
|
+
}, [1, "tttx-icon", {
|
|
1860
|
+
"icon": [1],
|
|
1861
|
+
"colour": [1]
|
|
1862
|
+
}, [[4, "click", "handleDocumentClick"]]]);
|
|
1863
|
+
function defineCustomElement() {
|
|
1864
|
+
if (typeof customElements === "undefined") {
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1867
|
+
const components = ["tttx-icon"];
|
|
1868
|
+
components.forEach(tagName => { switch (tagName) {
|
|
1869
|
+
case "tttx-icon":
|
|
1870
|
+
if (!customElements.get(tagName)) {
|
|
1871
|
+
customElements.define(tagName, TttxIcon);
|
|
1872
|
+
}
|
|
1873
|
+
break;
|
|
1874
|
+
} });
|
|
1873
1875
|
}
|
|
1874
1876
|
|
|
1875
1877
|
export { TttxIcon as T, defineCustomElement as d };
|
|
@@ -3,220 +3,220 @@ import { d as defineCustomElement$2 } from './tttx-loading-spinner2.js';
|
|
|
3
3
|
|
|
4
4
|
const tttxListCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}:host{display:flex;flex-direction:column}.tttx-list__row{min-height:52px;line-height:36px;padding:8px;display:flex;flex-direction:row;align-items:center;cursor:pointer;border-bottom:1px solid #d5d5d5}.tttx-list__row .generic-template__content{width:100%;display:flex;align-items:center;gap:8px}.tttx-list__row:first-of-type{border-top:1px solid #d5d5d5}.tttx-list__row:focus,.tttx-list__row:active{background-color:#e6e6e6}.tttx-list__row.selected{background-color:#e7f1f9}.load-indicator{display:flex;justify-content:center}";
|
|
5
5
|
|
|
6
|
-
const TttxList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.__registerHost();
|
|
10
|
-
this.__attachShadow();
|
|
11
|
-
this.listPaginate = createEvent(this, "listPaginate", 7);
|
|
12
|
-
this.listSelectedEvent = createEvent(this, "listSelectedEvent", 7);
|
|
13
|
-
this.listItemClick = createEvent(this, "listItemClick", 7);
|
|
14
|
-
this.rowCount = 0;
|
|
15
|
-
this.name = undefined;
|
|
16
|
-
this.selectable = undefined;
|
|
17
|
-
this.items = [];
|
|
18
|
-
this.selectedIds = [];
|
|
19
|
-
this.loading = true;
|
|
20
|
-
this.lastPage = false;
|
|
21
|
-
}
|
|
22
|
-
listLoadHandler(event) {
|
|
23
|
-
if (event.detail.name !== this.name)
|
|
24
|
-
return;
|
|
25
|
-
this.items = [...this.items, ...event.detail.items];
|
|
26
|
-
this.loading = false;
|
|
27
|
-
this.lastPage = event.detail.lastPage;
|
|
28
|
-
this.renderRows(event.detail.items);
|
|
29
|
-
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
30
|
-
this.listPaginateHandler();
|
|
31
|
-
}
|
|
32
|
-
listPaginateHandler() {
|
|
33
|
-
// We don't want to emit an event to load the next page if this is the last page, or if we're already loading
|
|
34
|
-
if (this.lastPage || this.loading)
|
|
35
|
-
return;
|
|
36
|
-
this.loading = true;
|
|
37
|
-
this.listPaginate.emit({ name: this.name });
|
|
38
|
-
}
|
|
39
|
-
listClearDataCacheHandler(event) {
|
|
40
|
-
if (event.detail.name !== this.name)
|
|
41
|
-
return;
|
|
42
|
-
this.items = [];
|
|
43
|
-
this.selectedIds = [];
|
|
44
|
-
this.listItemContainer()
|
|
45
|
-
.querySelectorAll(".tttx-list__row")
|
|
46
|
-
.forEach((node) => {
|
|
47
|
-
node.remove();
|
|
48
|
-
});
|
|
49
|
-
this.rowCount = 0;
|
|
50
|
-
this.lastPage = false;
|
|
51
|
-
this.loading = false;
|
|
52
|
-
}
|
|
53
|
-
listActionSelectedEventHandler(event) {
|
|
54
|
-
if (event.detail.name !== this.name || !this.selectable || this.selectedIds.length === 0)
|
|
55
|
-
return;
|
|
56
|
-
const selectedRows = this.selectedIds.map(id => {
|
|
57
|
-
return this.items[id];
|
|
58
|
-
});
|
|
59
|
-
if (event.detail.removeRows)
|
|
60
|
-
this.removeSelectedRows();
|
|
61
|
-
this.listSelectedEvent.emit({
|
|
62
|
-
name: this.name,
|
|
63
|
-
eventName: event.detail.eventName,
|
|
64
|
-
selectedRows,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
removeSelectedRows() {
|
|
68
|
-
const orderedSelectedIds = [...this.selectedIds].sort((a, b) => {
|
|
69
|
-
return b - a;
|
|
70
|
-
});
|
|
71
|
-
orderedSelectedIds.forEach(itemIndex => {
|
|
72
|
-
this.items.splice(itemIndex, 1);
|
|
73
|
-
this.listItemContainer().removeChild(this.listItemContainer().querySelector(`[data-row-id="${itemIndex}"]`));
|
|
74
|
-
// If this removes the scrollbar and we're not on the last page, load in a new page
|
|
75
|
-
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
76
|
-
this.listPaginateHandler();
|
|
77
|
-
});
|
|
78
|
-
// Empty selected ids with mutation rather than assignment to avoid unecessary component rerender
|
|
79
|
-
this.selectedIds.splice(0, this.selectedIds.length);
|
|
80
|
-
}
|
|
81
|
-
listItemClickHandler(itemData) {
|
|
82
|
-
if (this.selectedIds.length !== 0)
|
|
83
|
-
return;
|
|
84
|
-
this.listItemClick.emit({ itemData, name: this.name });
|
|
85
|
-
}
|
|
86
|
-
componentWillLoad() {
|
|
87
|
-
this.template = this.host.querySelector("template");
|
|
88
|
-
this.scrollableParent = this.getScrollableParent(this.host);
|
|
89
|
-
const scrollableContext = this.scrollableParent === document.scrollingElement ? document : this.scrollableParent;
|
|
90
|
-
scrollableContext.addEventListener("scroll", this.scrollHandler.bind(this));
|
|
91
|
-
window.addEventListener("resize", this.scrollHandler.bind(this));
|
|
92
|
-
}
|
|
93
|
-
componentDidLoad() {
|
|
94
|
-
// Emit event to load first page
|
|
95
|
-
this.listPaginate.emit({ name: this.name });
|
|
96
|
-
}
|
|
97
|
-
listItemContainer() {
|
|
98
|
-
return this.host.shadowRoot.querySelector(".list-item-container");
|
|
99
|
-
}
|
|
100
|
-
async scrollHandler() {
|
|
101
|
-
const { clientHeight, scrollTop, scrollHeight } = this.scrollableParent;
|
|
102
|
-
if (Math.abs(scrollHeight - clientHeight - scrollTop) < 26)
|
|
103
|
-
this.listPaginateHandler();
|
|
104
|
-
}
|
|
105
|
-
isScrollable(node) {
|
|
106
|
-
const hasScrollbar = ["scroll", "auto"].includes(node.style.overflowY);
|
|
107
|
-
return hasScrollbar;
|
|
108
|
-
}
|
|
109
|
-
getScrollableParent(node) {
|
|
110
|
-
if (!node || node === document.body) {
|
|
111
|
-
return document.scrollingElement;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return this.isScrollable(node) ? node : this.getScrollableParent(node.parentElement);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
appendRowCheckbox(rowContainer) {
|
|
118
|
-
if (!this.selectable)
|
|
119
|
-
return;
|
|
120
|
-
const rowId = this.rowCount;
|
|
121
|
-
const checkbox = document.createElement("input");
|
|
122
|
-
checkbox.setAttribute("type", "checkbox");
|
|
123
|
-
checkbox.addEventListener("click", e => {
|
|
124
|
-
e.stopPropagation();
|
|
125
|
-
if (e.target.checked) {
|
|
126
|
-
this.selectedIds = [...this.selectedIds, rowId];
|
|
127
|
-
rowContainer.classList.add("selected");
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
this.selectedIds = this.selectedIds.filter(id => {
|
|
131
|
-
return id !== rowId;
|
|
132
|
-
});
|
|
133
|
-
rowContainer.classList.remove("selected");
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
rowContainer.setAttribute("data-row-id", `${rowId}`);
|
|
137
|
-
this.rowCount++;
|
|
138
|
-
rowContainer.appendChild(checkbox);
|
|
139
|
-
}
|
|
140
|
-
appendSeededTemplate(rowData, rowContainer) {
|
|
141
|
-
this.template.childNodes.forEach(child => {
|
|
142
|
-
const clone = child.cloneNode(false);
|
|
143
|
-
if (clone.getAttribute("data-fields")) {
|
|
144
|
-
const fields = clone.getAttribute("data-fields").replace(/\s/g, "").split(",");
|
|
145
|
-
const filteredRowData = Object.fromEntries(fields.map((field) => {
|
|
146
|
-
return [field, rowData[field]];
|
|
147
|
-
}));
|
|
148
|
-
clone.setAttribute("row-data", JSON.stringify(filteredRowData));
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
clone.setAttribute("row-data", JSON.stringify(rowData));
|
|
152
|
-
}
|
|
153
|
-
rowContainer.appendChild(clone);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
appendGenericTemplate(rowData, rowContainer) {
|
|
157
|
-
const row = document.createElement("div");
|
|
158
|
-
row.classList.add("generic-template__content");
|
|
159
|
-
row.textContent = rowData.text;
|
|
160
|
-
rowContainer.appendChild(row);
|
|
161
|
-
if (!rowData.icon)
|
|
162
|
-
return;
|
|
163
|
-
const icon = document.createElement("span");
|
|
164
|
-
icon.classList.add("material-symbols-rounded");
|
|
165
|
-
icon.textContent = rowData.icon;
|
|
166
|
-
if (rowData.iconColor)
|
|
167
|
-
icon.style["color"] = rowData.iconColor;
|
|
168
|
-
row.prepend(icon);
|
|
169
|
-
}
|
|
170
|
-
row(rowData) {
|
|
171
|
-
const rowContainer = document.createElement("div");
|
|
172
|
-
rowContainer.classList.add("tttx-list__row");
|
|
173
|
-
rowContainer.addEventListener("click", () => {
|
|
174
|
-
this.listItemClickHandler(rowData);
|
|
175
|
-
});
|
|
176
|
-
this.appendRowCheckbox(rowContainer);
|
|
177
|
-
this.template ? this.appendSeededTemplate(rowData, rowContainer) : this.appendGenericTemplate(rowData, rowContainer);
|
|
178
|
-
return rowContainer;
|
|
179
|
-
}
|
|
180
|
-
renderRows(batchData) {
|
|
181
|
-
batchData.forEach(rowData => {
|
|
182
|
-
this.listItemContainer().appendChild(this.row(rowData));
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
loadIndicator() {
|
|
186
|
-
if (!this.loading)
|
|
187
|
-
return;
|
|
188
|
-
return h("div", { class: "load-indicator" }, h("tttx-loading-spinner", { size: 'large' }));
|
|
189
|
-
}
|
|
190
|
-
render() {
|
|
191
|
-
return (h(Host, null, h("div", { class: "list-item-container", tabindex: "0" }, !this.loading && this.items.length === 0 ? "No data to display" : undefined), this.loadIndicator()));
|
|
192
|
-
}
|
|
193
|
-
get host() { return this; }
|
|
194
|
-
static get style() { return tttxListCss; }
|
|
195
|
-
}, [1, "tttx-list", {
|
|
196
|
-
"name": [1],
|
|
197
|
-
"selectable": [4],
|
|
198
|
-
"items": [32],
|
|
199
|
-
"selectedIds": [32],
|
|
200
|
-
"loading": [32],
|
|
201
|
-
"lastPage": [32]
|
|
202
|
-
}, [[4, "listPageLoad", "listLoadHandler"], [4, "listClearDataCache", "listClearDataCacheHandler"], [4, "listActionSelectedEvent", "listActionSelectedEventHandler"]]]);
|
|
203
|
-
function defineCustomElement$1() {
|
|
204
|
-
if (typeof customElements === "undefined") {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
const components = ["tttx-list", "tttx-loading-spinner"];
|
|
208
|
-
components.forEach(tagName => { switch (tagName) {
|
|
209
|
-
case "tttx-list":
|
|
210
|
-
if (!customElements.get(tagName)) {
|
|
211
|
-
customElements.define(tagName, TttxList$1);
|
|
212
|
-
}
|
|
213
|
-
break;
|
|
214
|
-
case "tttx-loading-spinner":
|
|
215
|
-
if (!customElements.get(tagName)) {
|
|
216
|
-
defineCustomElement$2();
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
} });
|
|
6
|
+
const TttxList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.listPaginate = createEvent(this, "listPaginate", 7);
|
|
12
|
+
this.listSelectedEvent = createEvent(this, "listSelectedEvent", 7);
|
|
13
|
+
this.listItemClick = createEvent(this, "listItemClick", 7);
|
|
14
|
+
this.rowCount = 0;
|
|
15
|
+
this.name = undefined;
|
|
16
|
+
this.selectable = undefined;
|
|
17
|
+
this.items = [];
|
|
18
|
+
this.selectedIds = [];
|
|
19
|
+
this.loading = true;
|
|
20
|
+
this.lastPage = false;
|
|
21
|
+
}
|
|
22
|
+
listLoadHandler(event) {
|
|
23
|
+
if (event.detail.name !== this.name)
|
|
24
|
+
return;
|
|
25
|
+
this.items = [...this.items, ...event.detail.items];
|
|
26
|
+
this.loading = false;
|
|
27
|
+
this.lastPage = event.detail.lastPage;
|
|
28
|
+
this.renderRows(event.detail.items);
|
|
29
|
+
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
30
|
+
this.listPaginateHandler();
|
|
31
|
+
}
|
|
32
|
+
listPaginateHandler() {
|
|
33
|
+
// We don't want to emit an event to load the next page if this is the last page, or if we're already loading
|
|
34
|
+
if (this.lastPage || this.loading)
|
|
35
|
+
return;
|
|
36
|
+
this.loading = true;
|
|
37
|
+
this.listPaginate.emit({ name: this.name });
|
|
38
|
+
}
|
|
39
|
+
listClearDataCacheHandler(event) {
|
|
40
|
+
if (event.detail.name !== this.name)
|
|
41
|
+
return;
|
|
42
|
+
this.items = [];
|
|
43
|
+
this.selectedIds = [];
|
|
44
|
+
this.listItemContainer()
|
|
45
|
+
.querySelectorAll(".tttx-list__row")
|
|
46
|
+
.forEach((node) => {
|
|
47
|
+
node.remove();
|
|
48
|
+
});
|
|
49
|
+
this.rowCount = 0;
|
|
50
|
+
this.lastPage = false;
|
|
51
|
+
this.loading = false;
|
|
52
|
+
}
|
|
53
|
+
listActionSelectedEventHandler(event) {
|
|
54
|
+
if (event.detail.name !== this.name || !this.selectable || this.selectedIds.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
const selectedRows = this.selectedIds.map(id => {
|
|
57
|
+
return this.items[id];
|
|
58
|
+
});
|
|
59
|
+
if (event.detail.removeRows)
|
|
60
|
+
this.removeSelectedRows();
|
|
61
|
+
this.listSelectedEvent.emit({
|
|
62
|
+
name: this.name,
|
|
63
|
+
eventName: event.detail.eventName,
|
|
64
|
+
selectedRows,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
removeSelectedRows() {
|
|
68
|
+
const orderedSelectedIds = [...this.selectedIds].sort((a, b) => {
|
|
69
|
+
return b - a;
|
|
70
|
+
});
|
|
71
|
+
orderedSelectedIds.forEach(itemIndex => {
|
|
72
|
+
this.items.splice(itemIndex, 1);
|
|
73
|
+
this.listItemContainer().removeChild(this.listItemContainer().querySelector(`[data-row-id="${itemIndex}"]`));
|
|
74
|
+
// If this removes the scrollbar and we're not on the last page, load in a new page
|
|
75
|
+
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
76
|
+
this.listPaginateHandler();
|
|
77
|
+
});
|
|
78
|
+
// Empty selected ids with mutation rather than assignment to avoid unecessary component rerender
|
|
79
|
+
this.selectedIds.splice(0, this.selectedIds.length);
|
|
80
|
+
}
|
|
81
|
+
listItemClickHandler(itemData) {
|
|
82
|
+
if (this.selectedIds.length !== 0)
|
|
83
|
+
return;
|
|
84
|
+
this.listItemClick.emit({ itemData, name: this.name });
|
|
85
|
+
}
|
|
86
|
+
componentWillLoad() {
|
|
87
|
+
this.template = this.host.querySelector("template");
|
|
88
|
+
this.scrollableParent = this.getScrollableParent(this.host);
|
|
89
|
+
const scrollableContext = this.scrollableParent === document.scrollingElement ? document : this.scrollableParent;
|
|
90
|
+
scrollableContext.addEventListener("scroll", this.scrollHandler.bind(this));
|
|
91
|
+
window.addEventListener("resize", this.scrollHandler.bind(this));
|
|
92
|
+
}
|
|
93
|
+
componentDidLoad() {
|
|
94
|
+
// Emit event to load first page
|
|
95
|
+
this.listPaginate.emit({ name: this.name });
|
|
96
|
+
}
|
|
97
|
+
listItemContainer() {
|
|
98
|
+
return this.host.shadowRoot.querySelector(".list-item-container");
|
|
99
|
+
}
|
|
100
|
+
async scrollHandler() {
|
|
101
|
+
const { clientHeight, scrollTop, scrollHeight } = this.scrollableParent;
|
|
102
|
+
if (Math.abs(scrollHeight - clientHeight - scrollTop) < 26)
|
|
103
|
+
this.listPaginateHandler();
|
|
104
|
+
}
|
|
105
|
+
isScrollable(node) {
|
|
106
|
+
const hasScrollbar = ["scroll", "auto"].includes(node.style.overflowY);
|
|
107
|
+
return hasScrollbar;
|
|
108
|
+
}
|
|
109
|
+
getScrollableParent(node) {
|
|
110
|
+
if (!node || node === document.body) {
|
|
111
|
+
return document.scrollingElement;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
return this.isScrollable(node) ? node : this.getScrollableParent(node.parentElement);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
appendRowCheckbox(rowContainer) {
|
|
118
|
+
if (!this.selectable)
|
|
119
|
+
return;
|
|
120
|
+
const rowId = this.rowCount;
|
|
121
|
+
const checkbox = document.createElement("input");
|
|
122
|
+
checkbox.setAttribute("type", "checkbox");
|
|
123
|
+
checkbox.addEventListener("click", e => {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
if (e.target.checked) {
|
|
126
|
+
this.selectedIds = [...this.selectedIds, rowId];
|
|
127
|
+
rowContainer.classList.add("selected");
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
this.selectedIds = this.selectedIds.filter(id => {
|
|
131
|
+
return id !== rowId;
|
|
132
|
+
});
|
|
133
|
+
rowContainer.classList.remove("selected");
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
rowContainer.setAttribute("data-row-id", `${rowId}`);
|
|
137
|
+
this.rowCount++;
|
|
138
|
+
rowContainer.appendChild(checkbox);
|
|
139
|
+
}
|
|
140
|
+
appendSeededTemplate(rowData, rowContainer) {
|
|
141
|
+
this.template.childNodes.forEach(child => {
|
|
142
|
+
const clone = child.cloneNode(false);
|
|
143
|
+
if (clone.getAttribute("data-fields")) {
|
|
144
|
+
const fields = clone.getAttribute("data-fields").replace(/\s/g, "").split(",");
|
|
145
|
+
const filteredRowData = Object.fromEntries(fields.map((field) => {
|
|
146
|
+
return [field, rowData[field]];
|
|
147
|
+
}));
|
|
148
|
+
clone.setAttribute("row-data", JSON.stringify(filteredRowData));
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
clone.setAttribute("row-data", JSON.stringify(rowData));
|
|
152
|
+
}
|
|
153
|
+
rowContainer.appendChild(clone);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
appendGenericTemplate(rowData, rowContainer) {
|
|
157
|
+
const row = document.createElement("div");
|
|
158
|
+
row.classList.add("generic-template__content");
|
|
159
|
+
row.textContent = rowData.text;
|
|
160
|
+
rowContainer.appendChild(row);
|
|
161
|
+
if (!rowData.icon)
|
|
162
|
+
return;
|
|
163
|
+
const icon = document.createElement("span");
|
|
164
|
+
icon.classList.add("material-symbols-rounded");
|
|
165
|
+
icon.textContent = rowData.icon;
|
|
166
|
+
if (rowData.iconColor)
|
|
167
|
+
icon.style["color"] = rowData.iconColor;
|
|
168
|
+
row.prepend(icon);
|
|
169
|
+
}
|
|
170
|
+
row(rowData) {
|
|
171
|
+
const rowContainer = document.createElement("div");
|
|
172
|
+
rowContainer.classList.add("tttx-list__row");
|
|
173
|
+
rowContainer.addEventListener("click", () => {
|
|
174
|
+
this.listItemClickHandler(rowData);
|
|
175
|
+
});
|
|
176
|
+
this.appendRowCheckbox(rowContainer);
|
|
177
|
+
this.template ? this.appendSeededTemplate(rowData, rowContainer) : this.appendGenericTemplate(rowData, rowContainer);
|
|
178
|
+
return rowContainer;
|
|
179
|
+
}
|
|
180
|
+
renderRows(batchData) {
|
|
181
|
+
batchData.forEach(rowData => {
|
|
182
|
+
this.listItemContainer().appendChild(this.row(rowData));
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
loadIndicator() {
|
|
186
|
+
if (!this.loading)
|
|
187
|
+
return;
|
|
188
|
+
return h("div", { class: "load-indicator" }, h("tttx-loading-spinner", { size: 'large' }));
|
|
189
|
+
}
|
|
190
|
+
render() {
|
|
191
|
+
return (h(Host, null, h("div", { class: "list-item-container", tabindex: "0" }, !this.loading && this.items.length === 0 ? "No data to display" : undefined), this.loadIndicator()));
|
|
192
|
+
}
|
|
193
|
+
get host() { return this; }
|
|
194
|
+
static get style() { return tttxListCss; }
|
|
195
|
+
}, [1, "tttx-list", {
|
|
196
|
+
"name": [1],
|
|
197
|
+
"selectable": [4],
|
|
198
|
+
"items": [32],
|
|
199
|
+
"selectedIds": [32],
|
|
200
|
+
"loading": [32],
|
|
201
|
+
"lastPage": [32]
|
|
202
|
+
}, [[4, "listPageLoad", "listLoadHandler"], [4, "listClearDataCache", "listClearDataCacheHandler"], [4, "listActionSelectedEvent", "listActionSelectedEventHandler"]]]);
|
|
203
|
+
function defineCustomElement$1() {
|
|
204
|
+
if (typeof customElements === "undefined") {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const components = ["tttx-list", "tttx-loading-spinner"];
|
|
208
|
+
components.forEach(tagName => { switch (tagName) {
|
|
209
|
+
case "tttx-list":
|
|
210
|
+
if (!customElements.get(tagName)) {
|
|
211
|
+
customElements.define(tagName, TttxList$1);
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
case "tttx-loading-spinner":
|
|
215
|
+
if (!customElements.get(tagName)) {
|
|
216
|
+
defineCustomElement$2();
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
} });
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
const TttxList = TttxList$1;
|
|
@@ -2,39 +2,39 @@ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/clien
|
|
|
2
2
|
|
|
3
3
|
const tttxLoadingSpinnerCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.spinner-container{position:absolute}.loading-box{display:flex;align-items:center;justify-content:center}.loading-text{font-size:16px;font-weight:400;padding-top:10px;text-align:center}.spinner{border:solid #1479c6;border-bottom-color:#d5d5d5;border-radius:50%;position:relative;box-sizing:border-box;animation:rotation 1s linear infinite}.spinner.small{height:20px;width:20px;border-width:4px}.spinner.large{height:60px;width:60px;border-width:8px}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
|
|
4
4
|
|
|
5
|
-
const TttxLoadingSpinner = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
this.__registerHost();
|
|
9
|
-
this.__attachShadow();
|
|
10
|
-
this.loadingMessage = undefined;
|
|
11
|
-
this.size = 'large';
|
|
12
|
-
}
|
|
13
|
-
renderLoadingMessage() {
|
|
14
|
-
if (!this.loadingMessage)
|
|
15
|
-
return '';
|
|
16
|
-
return h("div", { class: "loading-text" }, "Loading, please wait...");
|
|
17
|
-
}
|
|
18
|
-
render() {
|
|
19
|
-
return (h("div", { class: "spinner-container" }, h("div", { class: "loading-box" }, h("span", { class: `spinner ${this.size}` })), this.renderLoadingMessage()));
|
|
20
|
-
}
|
|
21
|
-
static get style() { return tttxLoadingSpinnerCss; }
|
|
22
|
-
}, [1, "tttx-loading-spinner", {
|
|
23
|
-
"loadingMessage": [1028, "loading-message"],
|
|
24
|
-
"size": [1025]
|
|
25
|
-
}]);
|
|
26
|
-
function defineCustomElement() {
|
|
27
|
-
if (typeof customElements === "undefined") {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const components = ["tttx-loading-spinner"];
|
|
31
|
-
components.forEach(tagName => { switch (tagName) {
|
|
32
|
-
case "tttx-loading-spinner":
|
|
33
|
-
if (!customElements.get(tagName)) {
|
|
34
|
-
customElements.define(tagName, TttxLoadingSpinner);
|
|
35
|
-
}
|
|
36
|
-
break;
|
|
37
|
-
} });
|
|
5
|
+
const TttxLoadingSpinner = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.loadingMessage = undefined;
|
|
11
|
+
this.size = 'large';
|
|
12
|
+
}
|
|
13
|
+
renderLoadingMessage() {
|
|
14
|
+
if (!this.loadingMessage)
|
|
15
|
+
return '';
|
|
16
|
+
return h("div", { class: "loading-text" }, "Loading, please wait...");
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return (h("div", { class: "spinner-container" }, h("div", { class: "loading-box" }, h("span", { class: `spinner ${this.size}` })), this.renderLoadingMessage()));
|
|
20
|
+
}
|
|
21
|
+
static get style() { return tttxLoadingSpinnerCss; }
|
|
22
|
+
}, [1, "tttx-loading-spinner", {
|
|
23
|
+
"loadingMessage": [1028, "loading-message"],
|
|
24
|
+
"size": [1025]
|
|
25
|
+
}]);
|
|
26
|
+
function defineCustomElement() {
|
|
27
|
+
if (typeof customElements === "undefined") {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const components = ["tttx-loading-spinner"];
|
|
31
|
+
components.forEach(tagName => { switch (tagName) {
|
|
32
|
+
case "tttx-loading-spinner":
|
|
33
|
+
if (!customElements.get(tagName)) {
|
|
34
|
+
customElements.define(tagName, TttxLoadingSpinner);
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
} });
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export { TttxLoadingSpinner as T, defineCustomElement as d };
|