@3t-transform/threeteeui 0.0.22 → 0.0.24
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-bf777121.js → index-bc080fb4.js} +2 -148
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/tttx-button.cjs.entry.js +1 -1
- package/dist/cjs/tttx-icon.cjs.entry.js +1 -1
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +1 -1
- package/dist/cjs/tttx-list.cjs.entry.js +14 -178
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +1 -1
- package/dist/cjs/tttx-table.cjs.entry.js +1 -1
- package/dist/cjs/tttx.cjs.js +3 -7
- package/dist/collection/collection-manifest.json +2 -6
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.e2e.js +9 -0
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.spec.js +43 -0
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.e2e.js +9 -0
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.spec.js +16 -0
- package/dist/collection/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.js +164 -0
- package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js +64 -0
- package/dist/collection/components/molecules/tttx-list/test/tttx-list.spec.js +151 -0
- package/dist/collection/components/molecules/tttx-list/tttx-list.css +17 -20
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +22 -255
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +34 -32
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js +9 -0
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.js +146 -0
- package/dist/collection/components/molecules/tttx-table/test/tttx-table.e2e.js +9 -0
- package/dist/components/index.d.ts +0 -13
- package/dist/components/index.js +1 -5
- package/dist/components/tttx-button.js +54 -1
- package/dist/components/tttx-list.js +19 -188
- package/dist/components/tttx-loading-spinner.js +38 -1
- package/dist/components/tttx-table.js +2 -8
- package/dist/esm/{index-a05bd606.js → index-901bfd55.js} +3 -147
- package/dist/esm/loader.js +3 -4
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/tttx-button.entry.js +1 -1
- package/dist/esm/tttx-icon.entry.js +1 -1
- package/dist/esm/tttx-keyvalue-block.entry.js +1 -1
- package/dist/esm/tttx-list.entry.js +14 -178
- package/dist/esm/tttx-loading-spinner.entry.js +1 -1
- package/dist/esm/tttx-standalone-input.entry.js +1 -1
- package/dist/esm/tttx-table.entry.js +1 -1
- package/dist/esm/tttx.js +3 -4
- package/dist/tttx/{p-68ff0f39.entry.js → p-0ae51ec5.entry.js} +1 -1
- package/dist/tttx/{p-9536b8c4.entry.js → p-1ec23160.entry.js} +1 -1
- package/dist/tttx/p-300ff6a8.entry.js +1 -0
- package/dist/tttx/p-32ad02d3.entry.js +1 -0
- package/dist/tttx/{p-a96ca037.entry.js → p-80cf5236.entry.js} +1 -1
- package/dist/tttx/{p-a5808741.entry.js → p-9a382959.entry.js} +1 -1
- package/dist/tttx/{p-46b5551e.entry.js → p-a1bd16a1.entry.js} +1 -1
- package/dist/tttx/{p-93763d3c.entry.js → p-a4077908.entry.js} +1 -1
- package/dist/tttx/p-a6953900.entry.js +1 -0
- package/dist/tttx/p-b46e3c59.entry.js +1 -0
- package/dist/tttx/p-c290160b.js +2 -0
- package/dist/tttx/p-dc179257.entry.js +1 -0
- package/dist/tttx/p-e19eb07e.entry.js +1 -0
- package/dist/tttx/p-e4341658.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-button/test/tttx-button.e2e.d.ts +1 -0
- package/dist/types/components/atoms/tttx-button/test/tttx-button.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.e2e.d.ts +1 -0
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-list/interfaces.d.ts +4 -0
- package/dist/types/components/molecules/tttx-list/test/tttx-list.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +4 -46
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +2 -8
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.d.ts +1 -0
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +6 -6
- package/dist/types/components/molecules/tttx-table/test/tttx-table.e2e.d.ts +1 -0
- package/dist/types/components.d.ts +3 -91
- package/dist/types/stencil-public-runtime.d.ts +3 -59
- package/loader/index.d.ts +0 -9
- package/package.json +3 -2
- package/readme.md +20 -0
- package/dist/cjs/tttx-checkbox.cjs.entry.js +0 -28
- package/dist/cjs/tttx-form.cjs.entry.js +0 -374
- package/dist/cjs/tttx-input-calendar.cjs.entry.js +0 -125
- package/dist/cjs/tttx-popover-content.cjs.entry.js +0 -23
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.css +0 -30
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +0 -97
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +0 -23
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.css +0 -181
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +0 -102
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +0 -13
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +0 -314
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +0 -452
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +0 -109
- package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.css +0 -93
- package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.js +0 -174
- package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.js +0 -27
- package/dist/components/tttx-button2.js +0 -56
- package/dist/components/tttx-checkbox.d.ts +0 -11
- package/dist/components/tttx-checkbox.js +0 -46
- package/dist/components/tttx-form.d.ts +0 -11
- package/dist/components/tttx-form.js +0 -391
- package/dist/components/tttx-input-calendar.d.ts +0 -11
- package/dist/components/tttx-input-calendar.js +0 -157
- package/dist/components/tttx-loading-spinner2.js +0 -40
- package/dist/components/tttx-popover-content.d.ts +0 -11
- package/dist/components/tttx-popover-content.js +0 -6
- package/dist/components/tttx-popover-content2.js +0 -39
- package/dist/esm/tttx-checkbox.entry.js +0 -24
- package/dist/esm/tttx-form.entry.js +0 -370
- package/dist/esm/tttx-input-calendar.entry.js +0 -121
- package/dist/esm/tttx-popover-content.entry.js +0 -19
- package/dist/tttx/p-037d286f.entry.js +0 -1
- package/dist/tttx/p-07b134af.js +0 -2
- package/dist/tttx/p-1b63f16a.entry.js +0 -1
- package/dist/tttx/p-45afb84c.entry.js +0 -1
- package/dist/tttx/p-a92ca87e.entry.js +0 -1
- package/dist/tttx/p-f579ed1e.entry.js +0 -1
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +0 -7
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +0 -18
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +0 -9
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +0 -6
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +0 -134
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +0 -12
- package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.d.ts +0 -19
- package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.d.ts +0 -26
|
@@ -1,185 +1,24 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import { h
|
|
2
|
+
import { h } from '@stencil/core';
|
|
3
3
|
export class TttxList {
|
|
4
4
|
constructor() {
|
|
5
|
-
this.
|
|
6
|
-
this.name = undefined;
|
|
7
|
-
this.selectable = undefined;
|
|
8
|
-
this.items = [];
|
|
9
|
-
this.selectedIds = [];
|
|
10
|
-
this.loading = true;
|
|
11
|
-
this.lastPage = false;
|
|
5
|
+
this.data = undefined;
|
|
12
6
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
this.loading = false;
|
|
18
|
-
this.lastPage = event.detail.lastPage;
|
|
19
|
-
this.renderRows(event.detail.items);
|
|
20
|
-
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
21
|
-
this.listPaginateHandler();
|
|
22
|
-
}
|
|
23
|
-
listPaginateHandler() {
|
|
24
|
-
// 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
|
|
25
|
-
if (this.lastPage || this.loading)
|
|
26
|
-
return;
|
|
27
|
-
this.loading = true;
|
|
28
|
-
this.listPaginate.emit({ name: this.name });
|
|
29
|
-
}
|
|
30
|
-
listClearDataCacheHandler(event) {
|
|
31
|
-
if (event.detail.name !== this.name)
|
|
32
|
-
return;
|
|
33
|
-
this.items = [];
|
|
34
|
-
this.selectedIds = [];
|
|
35
|
-
this.listItemContainer()
|
|
36
|
-
.querySelectorAll('.tttx-list__row')
|
|
37
|
-
.forEach((node) => {
|
|
38
|
-
node.remove();
|
|
39
|
-
});
|
|
40
|
-
this.rowCount = 0;
|
|
41
|
-
this.lastPage = false;
|
|
42
|
-
this.loading = false;
|
|
7
|
+
renderListItem(item) {
|
|
8
|
+
// Onclick should return some row data. May need to rethink how we handle data, since we don't want to return a template
|
|
9
|
+
// Alternatively, could return some sort of row id/index instead
|
|
10
|
+
return h("li", { class: "item", onClick: () => { this.listSelectedEvent.emit({}); } }, item.element && h("span", { class: "item-content", innerHTML: item.element }), item.chevron && h("tttx-icon", { class: "align-right", icon: "chevron_right" }));
|
|
43
11
|
}
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
return;
|
|
47
|
-
const selectedRows = this.selectedIds.map(id => {
|
|
48
|
-
return this.items[id];
|
|
49
|
-
});
|
|
50
|
-
if (event.detail.removeRows)
|
|
51
|
-
this.removeSelectedRows();
|
|
52
|
-
this.listSelectedEvent.emit({
|
|
53
|
-
name: this.name,
|
|
54
|
-
eventName: event.detail.eventName,
|
|
55
|
-
selectedRows,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
removeSelectedRows() {
|
|
59
|
-
const orderedSelectedIds = [...this.selectedIds].sort((a, b) => {
|
|
60
|
-
return b - a;
|
|
61
|
-
});
|
|
62
|
-
orderedSelectedIds.forEach(itemIndex => {
|
|
63
|
-
this.items.splice(itemIndex, 1);
|
|
64
|
-
this.listItemContainer().removeChild(this.listItemContainer().querySelector(`[data-row-id="${itemIndex}"]`));
|
|
65
|
-
// If this removes the scrollbar and we're not on the last page, load in a new page
|
|
66
|
-
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
67
|
-
this.listPaginateHandler();
|
|
68
|
-
});
|
|
69
|
-
// Empty selected ids with mutation rather than assignment to avoid unecessary component rerender
|
|
70
|
-
this.selectedIds.splice(0, this.selectedIds.length);
|
|
71
|
-
}
|
|
72
|
-
listItemClickHandler(itemData) {
|
|
73
|
-
if (this.selectedIds.length !== 0)
|
|
12
|
+
render() {
|
|
13
|
+
if (!this.data)
|
|
74
14
|
return;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
componentWillLoad() {
|
|
78
|
-
this.template = this.host.querySelector('template');
|
|
79
|
-
this.scrollableParent = this.getScrollableParent(this.host);
|
|
80
|
-
const scrollableContext = this.scrollableParent === document.scrollingElement ? document : this.scrollableParent;
|
|
81
|
-
scrollableContext.addEventListener('scroll', this.scrollHandler.bind(this));
|
|
82
|
-
window.addEventListener('resize', this.scrollHandler.bind(this));
|
|
83
|
-
}
|
|
84
|
-
componentDidLoad() {
|
|
85
|
-
// Emit event to load first page
|
|
86
|
-
this.listPaginate.emit({ name: this.name });
|
|
87
|
-
}
|
|
88
|
-
listItemContainer() {
|
|
89
|
-
return this.host.shadowRoot.querySelector('.list-item-container');
|
|
90
|
-
}
|
|
91
|
-
async scrollHandler() {
|
|
92
|
-
const { clientHeight, scrollTop, scrollHeight } = this.scrollableParent;
|
|
93
|
-
if (Math.abs(scrollHeight - clientHeight - scrollTop) < 26)
|
|
94
|
-
this.listPaginateHandler();
|
|
95
|
-
}
|
|
96
|
-
isScrollable(node) {
|
|
97
|
-
const hasScrollbar = ['scroll', 'auto'].includes(node.style.overflowY);
|
|
98
|
-
return hasScrollbar;
|
|
99
|
-
}
|
|
100
|
-
getScrollableParent(node) {
|
|
101
|
-
if (!node || node === document.body) {
|
|
102
|
-
return document.scrollingElement;
|
|
15
|
+
if (typeof this.data === 'string') {
|
|
16
|
+
this._data = JSON.parse(this.data);
|
|
103
17
|
}
|
|
104
18
|
else {
|
|
105
|
-
|
|
19
|
+
this._data = this.data;
|
|
106
20
|
}
|
|
107
|
-
|
|
108
|
-
appendRowCheckbox(rowContainer) {
|
|
109
|
-
if (!this.selectable)
|
|
110
|
-
return;
|
|
111
|
-
const rowId = this.rowCount;
|
|
112
|
-
const checkbox = document.createElement('input');
|
|
113
|
-
checkbox.setAttribute('type', 'checkbox');
|
|
114
|
-
checkbox.addEventListener('click', e => {
|
|
115
|
-
e.stopPropagation();
|
|
116
|
-
if (e.target.checked) {
|
|
117
|
-
this.selectedIds = [...this.selectedIds, rowId];
|
|
118
|
-
rowContainer.classList.add('selected');
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
this.selectedIds = this.selectedIds.filter(id => {
|
|
122
|
-
return id !== rowId;
|
|
123
|
-
});
|
|
124
|
-
rowContainer.classList.remove('selected');
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
rowContainer.setAttribute('data-row-id', `${rowId}`);
|
|
128
|
-
this.rowCount++;
|
|
129
|
-
rowContainer.appendChild(checkbox);
|
|
130
|
-
}
|
|
131
|
-
appendSeededTemplate(rowData, rowContainer) {
|
|
132
|
-
this.template.childNodes.forEach(child => {
|
|
133
|
-
const clone = child.cloneNode(false);
|
|
134
|
-
if (clone.getAttribute('data-fields')) {
|
|
135
|
-
const fields = clone.getAttribute('data-fields').replace(/\s/g, '').split(',');
|
|
136
|
-
const filteredRowData = Object.fromEntries(fields.map((field) => {
|
|
137
|
-
return [field, rowData[field]];
|
|
138
|
-
}));
|
|
139
|
-
clone.setAttribute('row-data', JSON.stringify(filteredRowData));
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
clone.setAttribute('row-data', JSON.stringify(rowData));
|
|
143
|
-
}
|
|
144
|
-
rowContainer.appendChild(clone);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
appendGenericTemplate(rowData, rowContainer) {
|
|
148
|
-
const row = document.createElement('div');
|
|
149
|
-
row.classList.add('generic-template__content');
|
|
150
|
-
row.textContent = rowData.text;
|
|
151
|
-
rowContainer.appendChild(row);
|
|
152
|
-
if (!rowData.icon)
|
|
153
|
-
return;
|
|
154
|
-
const icon = document.createElement('span');
|
|
155
|
-
icon.classList.add('material-symbols-rounded');
|
|
156
|
-
icon.textContent = rowData.icon;
|
|
157
|
-
if (rowData.iconColor)
|
|
158
|
-
icon.style['color'] = rowData.iconColor;
|
|
159
|
-
row.prepend(icon);
|
|
160
|
-
}
|
|
161
|
-
row(rowData) {
|
|
162
|
-
const rowContainer = document.createElement('div');
|
|
163
|
-
rowContainer.classList.add('tttx-list__row');
|
|
164
|
-
rowContainer.addEventListener('click', () => {
|
|
165
|
-
this.listItemClickHandler(rowData);
|
|
166
|
-
});
|
|
167
|
-
this.appendRowCheckbox(rowContainer);
|
|
168
|
-
this.template ? this.appendSeededTemplate(rowData, rowContainer) : this.appendGenericTemplate(rowData, rowContainer);
|
|
169
|
-
return rowContainer;
|
|
170
|
-
}
|
|
171
|
-
renderRows(batchData) {
|
|
172
|
-
batchData.forEach(rowData => {
|
|
173
|
-
this.listItemContainer().appendChild(this.row(rowData));
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
loadIndicator() {
|
|
177
|
-
if (!this.loading)
|
|
178
|
-
return;
|
|
179
|
-
return h("div", { class: "load-indicator" }, h("tttx-loading-spinner", { size: 'large' }));
|
|
180
|
-
}
|
|
181
|
-
render() {
|
|
182
|
-
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()));
|
|
21
|
+
return (h("ul", { class: "list" }, this._data && this._data.map((item) => this.renderListItem(item))));
|
|
183
22
|
}
|
|
184
23
|
static get is() { return "tttx-list"; }
|
|
185
24
|
static get encapsulation() { return "shadow"; }
|
|
@@ -195,30 +34,18 @@ export class TttxList {
|
|
|
195
34
|
}
|
|
196
35
|
static get properties() {
|
|
197
36
|
return {
|
|
198
|
-
"
|
|
37
|
+
"data": {
|
|
199
38
|
"type": "string",
|
|
200
39
|
"mutable": false,
|
|
201
40
|
"complexType": {
|
|
202
|
-
"original": "string",
|
|
203
|
-
"resolved": "string",
|
|
204
|
-
"references": {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
"text": ""
|
|
211
|
-
},
|
|
212
|
-
"attribute": "name",
|
|
213
|
-
"reflect": false
|
|
214
|
-
},
|
|
215
|
-
"selectable": {
|
|
216
|
-
"type": "boolean",
|
|
217
|
-
"mutable": false,
|
|
218
|
-
"complexType": {
|
|
219
|
-
"original": "boolean",
|
|
220
|
-
"resolved": "boolean",
|
|
221
|
-
"references": {}
|
|
41
|
+
"original": "string | ListItem[]",
|
|
42
|
+
"resolved": "ListItem[] | string",
|
|
43
|
+
"references": {
|
|
44
|
+
"ListItem": {
|
|
45
|
+
"location": "import",
|
|
46
|
+
"path": "./interfaces"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
222
49
|
},
|
|
223
50
|
"required": false,
|
|
224
51
|
"optional": false,
|
|
@@ -226,52 +53,14 @@ export class TttxList {
|
|
|
226
53
|
"tags": [],
|
|
227
54
|
"text": ""
|
|
228
55
|
},
|
|
229
|
-
"attribute": "
|
|
56
|
+
"attribute": "data",
|
|
230
57
|
"reflect": false
|
|
231
58
|
}
|
|
232
59
|
};
|
|
233
60
|
}
|
|
234
|
-
static get states() {
|
|
235
|
-
return {
|
|
236
|
-
"items": {},
|
|
237
|
-
"selectedIds": {},
|
|
238
|
-
"loading": {},
|
|
239
|
-
"lastPage": {}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
61
|
static get events() {
|
|
243
62
|
return [{
|
|
244
|
-
"method": "listPaginate",
|
|
245
|
-
"name": "listPaginate",
|
|
246
|
-
"bubbles": true,
|
|
247
|
-
"cancelable": true,
|
|
248
|
-
"composed": true,
|
|
249
|
-
"docs": {
|
|
250
|
-
"tags": [],
|
|
251
|
-
"text": ""
|
|
252
|
-
},
|
|
253
|
-
"complexType": {
|
|
254
|
-
"original": "any",
|
|
255
|
-
"resolved": "any",
|
|
256
|
-
"references": {}
|
|
257
|
-
}
|
|
258
|
-
}, {
|
|
259
63
|
"method": "listSelectedEvent",
|
|
260
|
-
"name": "listSelectedEvent",
|
|
261
|
-
"bubbles": true,
|
|
262
|
-
"cancelable": true,
|
|
263
|
-
"composed": true,
|
|
264
|
-
"docs": {
|
|
265
|
-
"tags": [],
|
|
266
|
-
"text": ""
|
|
267
|
-
},
|
|
268
|
-
"complexType": {
|
|
269
|
-
"original": "any",
|
|
270
|
-
"resolved": "any",
|
|
271
|
-
"references": {}
|
|
272
|
-
}
|
|
273
|
-
}, {
|
|
274
|
-
"method": "listItemClick",
|
|
275
64
|
"name": "listItemClick",
|
|
276
65
|
"bubbles": true,
|
|
277
66
|
"cancelable": true,
|
|
@@ -287,26 +76,4 @@ export class TttxList {
|
|
|
287
76
|
}
|
|
288
77
|
}];
|
|
289
78
|
}
|
|
290
|
-
static get elementRef() { return "host"; }
|
|
291
|
-
static get listeners() {
|
|
292
|
-
return [{
|
|
293
|
-
"name": "listPageLoad",
|
|
294
|
-
"method": "listLoadHandler",
|
|
295
|
-
"target": "document",
|
|
296
|
-
"capture": false,
|
|
297
|
-
"passive": false
|
|
298
|
-
}, {
|
|
299
|
-
"name": "listClearDataCache",
|
|
300
|
-
"method": "listClearDataCacheHandler",
|
|
301
|
-
"target": "document",
|
|
302
|
-
"capture": false,
|
|
303
|
-
"passive": false
|
|
304
|
-
}, {
|
|
305
|
-
"name": "listActionSelectedEvent",
|
|
306
|
-
"method": "listActionSelectedEventHandler",
|
|
307
|
-
"target": "document",
|
|
308
|
-
"capture": false,
|
|
309
|
-
"passive": false
|
|
310
|
-
}];
|
|
311
|
-
}
|
|
312
79
|
}
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
title: 'molecules/List',
|
|
3
3
|
component: 'tttx-list',
|
|
4
|
-
argTypes: {
|
|
5
|
-
selectable: {
|
|
6
|
-
control: {
|
|
7
|
-
type: 'boolean'
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
4
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
5
|
+
const TemplateStringList = ({ data }) => `
|
|
6
|
+
<tttx-list
|
|
7
|
+
data='${JSON.stringify(data)}'
|
|
8
|
+
id='list'
|
|
9
|
+
></tttx-list>
|
|
10
|
+
`;
|
|
11
|
+
export const BasicStringList = TemplateStringList.bind({});
|
|
12
|
+
BasicStringList.args = {
|
|
13
|
+
data: [
|
|
14
|
+
{ chevron: true, element: '<span><tttx-icon icon="egg" /></span> Demulon 1,000,000' },
|
|
15
|
+
{ chevron: true, element: '<span><tttx-icon icon="egg" color="red" /></span> Patrick' },
|
|
16
|
+
{ chevron: true, element: '<span><tttx-icon icon="add" /></span> Lee' },
|
|
17
|
+
{ chevron: false, element: '<span><tttx-icon icon="egg" /></span> Ben' },
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
const TemplateObjectList = ({ data }) => `
|
|
21
|
+
<tttx-list
|
|
22
|
+
id='list'
|
|
23
|
+
></tttx-list>
|
|
24
|
+
<script>
|
|
25
|
+
if(!list) {
|
|
26
|
+
const list = document.getElementId('list');
|
|
27
|
+
}
|
|
28
|
+
list.data = ${JSON.stringify(data)};
|
|
29
|
+
</script>
|
|
30
|
+
`;
|
|
31
|
+
export const BasicObjectList = TemplateObjectList.bind({});
|
|
32
|
+
BasicObjectList.args = {
|
|
33
|
+
data: [
|
|
34
|
+
{ chevron: true, element: '<span><tttx-icon icon="egg" /></span> Demulon 1,000,000' },
|
|
35
|
+
{ chevron: true, element: '<span><tttx-icon icon="egg" color="red" /></span> Patrick' },
|
|
36
|
+
{ chevron: true, element: '<span><tttx-icon icon="add" /></span> Lee' },
|
|
37
|
+
{ chevron: true, element: '<span><tttx-icon icon="egg" /></span> Ben' },
|
|
38
|
+
]
|
|
37
39
|
};
|
package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { newE2EPage } from '@stencil/core/testing';
|
|
2
|
+
describe('tttx-standalone-input', () => {
|
|
3
|
+
it('renders', async () => {
|
|
4
|
+
const page = await newE2EPage();
|
|
5
|
+
await page.setContent('<tttx-standalone-input></tttx-standalone-input>');
|
|
6
|
+
const element = await page.find('tttx-standalone-input');
|
|
7
|
+
expect(element).toHaveClass('hydrated');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { newSpecPage } from '@stencil/core/testing';
|
|
2
|
+
import { TttxInput } from '../tttx-standalone-input';
|
|
3
|
+
describe('tttx-standalone-input', () => {
|
|
4
|
+
it('renders', async () => {
|
|
5
|
+
const page = await newSpecPage({
|
|
6
|
+
components: [TttxInput],
|
|
7
|
+
html: '<tttx-standalone-input />',
|
|
8
|
+
});
|
|
9
|
+
expect(page.root).toEqualHtml(`
|
|
10
|
+
<tttx-standalone-input>
|
|
11
|
+
<label class="inputBlock">
|
|
12
|
+
<span class="optional">
|
|
13
|
+
(optional)
|
|
14
|
+
</span>
|
|
15
|
+
<input class="standalone" type="text">
|
|
16
|
+
<span class="errorBubble">
|
|
17
|
+
<span class="material-symbols-rounded validationicon">
|
|
18
|
+
warning
|
|
19
|
+
</span>
|
|
20
|
+
</span>
|
|
21
|
+
</label>
|
|
22
|
+
</tttx-standalone-input>
|
|
23
|
+
`);
|
|
24
|
+
});
|
|
25
|
+
it('renders the input field with the left icon', async () => {
|
|
26
|
+
const page = await newSpecPage({
|
|
27
|
+
components: [TttxInput],
|
|
28
|
+
html: '<tttx-standalone-input iconleft="info" />',
|
|
29
|
+
});
|
|
30
|
+
expect(page.root).toEqualHtml(`
|
|
31
|
+
<tttx-standalone-input iconleft="info">
|
|
32
|
+
<label class="inputBlock">
|
|
33
|
+
<span class="optional">
|
|
34
|
+
(optional)
|
|
35
|
+
</span>
|
|
36
|
+
<div class="icon-left">
|
|
37
|
+
<tttx-icon color="grey" icon="info"></tttx-icon>
|
|
38
|
+
</div>
|
|
39
|
+
<input class="standalone" type="text">
|
|
40
|
+
<span class="errorBubble">
|
|
41
|
+
<span class="material-symbols-rounded validationicon">
|
|
42
|
+
warning
|
|
43
|
+
</span>
|
|
44
|
+
</span>
|
|
45
|
+
</label>
|
|
46
|
+
</tttx-standalone-input>
|
|
47
|
+
`);
|
|
48
|
+
});
|
|
49
|
+
it('renders the input field with the right icon', async () => {
|
|
50
|
+
const page = await newSpecPage({
|
|
51
|
+
components: [TttxInput],
|
|
52
|
+
html: '<tttx-standalone-input iconright="info" />',
|
|
53
|
+
});
|
|
54
|
+
expect(page.root).toEqualHtml(`
|
|
55
|
+
<tttx-standalone-input iconright="info">
|
|
56
|
+
<label class="inputBlock">
|
|
57
|
+
<span class="optional">
|
|
58
|
+
(optional)
|
|
59
|
+
</span>
|
|
60
|
+
<input class="standalone" type="text">
|
|
61
|
+
<div class="icon-right">
|
|
62
|
+
<tttx-icon color="grey" icon="info"></tttx-icon>
|
|
63
|
+
</div>
|
|
64
|
+
<span class="errorBubble">
|
|
65
|
+
<span class="material-symbols-rounded validationicon">
|
|
66
|
+
warning
|
|
67
|
+
</span>
|
|
68
|
+
</span>
|
|
69
|
+
</label>
|
|
70
|
+
</tttx-standalone-input>
|
|
71
|
+
`);
|
|
72
|
+
});
|
|
73
|
+
it('renders the input field with an error message', async () => {
|
|
74
|
+
const page = await newSpecPage({
|
|
75
|
+
components: [TttxInput],
|
|
76
|
+
html: '<tttx-standalone-input required showerrormsg errormsg="The field is required" />',
|
|
77
|
+
});
|
|
78
|
+
expect(page.root).toEqualHtml(`
|
|
79
|
+
<tttx-standalone-input errormsg="The field is required" required="" showerrormsg="">
|
|
80
|
+
<label class="inputBlock">
|
|
81
|
+
<input class="invalid standalone" required="" type="text">
|
|
82
|
+
<span class="errorBubble visible">
|
|
83
|
+
<span class="material-symbols-rounded validationicon">
|
|
84
|
+
warning
|
|
85
|
+
</span>
|
|
86
|
+
The field is required
|
|
87
|
+
</span>
|
|
88
|
+
</label>
|
|
89
|
+
</tttx-standalone-input>
|
|
90
|
+
`);
|
|
91
|
+
});
|
|
92
|
+
it('can trigger onInput handler', async () => {
|
|
93
|
+
const page = await newSpecPage({
|
|
94
|
+
components: [TttxInput],
|
|
95
|
+
html: '<tttx-standalone-input />',
|
|
96
|
+
});
|
|
97
|
+
const callbackFn = jest.fn();
|
|
98
|
+
page.doc.addEventListener('valueChanged', callbackFn);
|
|
99
|
+
const input = page.root.querySelector('input');
|
|
100
|
+
input.value = 'a';
|
|
101
|
+
const event = new CustomEvent('input', { composed: true, bubbles: true });
|
|
102
|
+
input.dispatchEvent(event);
|
|
103
|
+
expect(callbackFn).toHaveBeenCalled();
|
|
104
|
+
});
|
|
105
|
+
it('can trigger onFocus handler', async () => {
|
|
106
|
+
const page = await newSpecPage({
|
|
107
|
+
components: [TttxInput],
|
|
108
|
+
html: '<tttx-standalone-input />',
|
|
109
|
+
});
|
|
110
|
+
const callbackFn = jest.fn();
|
|
111
|
+
page.doc.addEventListener('focusChanged', callbackFn);
|
|
112
|
+
const input = page.root.querySelector('input');
|
|
113
|
+
input.focus();
|
|
114
|
+
const event = new CustomEvent('focus', { composed: true, bubbles: true });
|
|
115
|
+
input.dispatchEvent(event);
|
|
116
|
+
expect(callbackFn).toHaveBeenCalled();
|
|
117
|
+
});
|
|
118
|
+
it('can trigger onBlur handler', async () => {
|
|
119
|
+
const page = await newSpecPage({
|
|
120
|
+
components: [TttxInput],
|
|
121
|
+
html: '<tttx-standalone-input />',
|
|
122
|
+
});
|
|
123
|
+
const callbackFn = jest.fn();
|
|
124
|
+
page.doc.addEventListener('blurChanged', callbackFn);
|
|
125
|
+
const input = page.root.querySelector('input');
|
|
126
|
+
input.blur();
|
|
127
|
+
const event = new CustomEvent('blur', { composed: true, bubbles: true });
|
|
128
|
+
input.dispatchEvent(event);
|
|
129
|
+
expect(callbackFn).toHaveBeenCalled();
|
|
130
|
+
});
|
|
131
|
+
it('can trigger onInvalid handler', async () => {
|
|
132
|
+
const page = await newSpecPage({
|
|
133
|
+
components: [TttxInput],
|
|
134
|
+
html: '<tttx-standalone-input />',
|
|
135
|
+
});
|
|
136
|
+
const callbackFn = jest.fn();
|
|
137
|
+
page.doc.addEventListener('invalidChanged', callbackFn);
|
|
138
|
+
const input = page.root.querySelector('input');
|
|
139
|
+
// Doesn't work:
|
|
140
|
+
// input.setCustomValidity('required');
|
|
141
|
+
// input.checkValidity();
|
|
142
|
+
const event = new CustomEvent('invalid', { composed: true, bubbles: true });
|
|
143
|
+
input.dispatchEvent(event);
|
|
144
|
+
expect(callbackFn).toHaveBeenCalled();
|
|
145
|
+
});
|
|
146
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { newE2EPage } from '@stencil/core/testing';
|
|
2
|
+
describe('tttx-table', () => {
|
|
3
|
+
it('renders', async () => {
|
|
4
|
+
const page = await newE2EPage();
|
|
5
|
+
await page.setContent('<tttx-table></tttx-table>');
|
|
6
|
+
const element = await page.find('tttx-table');
|
|
7
|
+
expect(element).toHaveClass('hydrated');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
/* tttx custom elements */
|
|
2
2
|
export { TttxButton as TttxButton } from '../types/components/atoms/tttx-button/tttx-button';
|
|
3
|
-
export { TttxCheckbox as TttxCheckbox } from '../types/components/atoms/ttx-checkbox/tttx-checkbox';
|
|
4
|
-
export { TttxForm as TttxForm } from '../types/components/molecules/tttx-form/tttx-form';
|
|
5
3
|
export { TttxIcon as TttxIcon } from '../types/components/atoms/tttx-icon/tttx-icon';
|
|
6
|
-
export { TttxInputCalendar as TttxInputCalendar } from '../types/components/molecules/tttx-input-calendar/tttx-input-calendar';
|
|
7
4
|
export { TttxKeyvalueBlock as TttxKeyvalueBlock } from '../types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block';
|
|
8
5
|
export { TttxList as TttxList } from '../types/components/molecules/tttx-list/tttx-list';
|
|
9
6
|
export { TttxLoadingSpinner as TttxLoadingSpinner } from '../types/components/atoms/tttx-loading-spinner/tttx-loading-spinner';
|
|
10
|
-
export { TttxPopoverContent as TttxPopoverContent } from '../types/components/atoms/tttx-popover-content/tttx-popover-content';
|
|
11
7
|
export { TttxInput as TttxStandaloneInput } from '../types/components/molecules/tttx-standalone-input/tttx-standalone-input';
|
|
12
8
|
export { TttxTable as TttxTable } from '../types/components/molecules/tttx-table/tttx-table';
|
|
13
9
|
|
|
@@ -23,15 +19,6 @@ export { TttxTable as TttxTable } from '../types/components/molecules/tttx-table
|
|
|
23
19
|
*/
|
|
24
20
|
export declare const setAssetPath: (path: string) => void;
|
|
25
21
|
|
|
26
|
-
/**
|
|
27
|
-
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
28
|
-
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
29
|
-
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
30
|
-
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
31
|
-
* will result in the same behavior.
|
|
32
|
-
*/
|
|
33
|
-
export declare const setNonce: (nonce: string) => void
|
|
34
|
-
|
|
35
22
|
export interface SetPlatformOptions {
|
|
36
23
|
raf?: (c: FrameRequestCallback) => number;
|
|
37
24
|
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
package/dist/components/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
export { setAssetPath,
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
2
|
export { TttxButton, defineCustomElement as defineCustomElementTttxButton } from './tttx-button.js';
|
|
3
|
-
export { TttxCheckbox, defineCustomElement as defineCustomElementTttxCheckbox } from './tttx-checkbox.js';
|
|
4
|
-
export { TttxForm, defineCustomElement as defineCustomElementTttxForm } from './tttx-form.js';
|
|
5
3
|
export { TttxIcon, defineCustomElement as defineCustomElementTttxIcon } from './tttx-icon.js';
|
|
6
|
-
export { TttxInputCalendar, defineCustomElement as defineCustomElementTttxInputCalendar } from './tttx-input-calendar.js';
|
|
7
4
|
export { TttxKeyvalueBlock, defineCustomElement as defineCustomElementTttxKeyvalueBlock } from './tttx-keyvalue-block.js';
|
|
8
5
|
export { TttxList, defineCustomElement as defineCustomElementTttxList } from './tttx-list.js';
|
|
9
6
|
export { TttxLoadingSpinner, defineCustomElement as defineCustomElementTttxLoadingSpinner } from './tttx-loading-spinner.js';
|
|
10
|
-
export { TttxPopoverContent, defineCustomElement as defineCustomElementTttxPopoverContent } from './tttx-popover-content.js';
|
|
11
7
|
export { TttxStandaloneInput, defineCustomElement as defineCustomElementTttxStandaloneInput } from './tttx-standalone-input.js';
|
|
12
8
|
export { TttxTable, defineCustomElement as defineCustomElementTttxTable } from './tttx-table.js';
|
|
@@ -1,4 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './tttx-icon2.js';
|
|
3
|
+
|
|
4
|
+
const tttxButtonCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.button{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:400}.button-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #D5D5D5}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #D5D5D5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:hover{background:#146EB3;border:1px solid #146EB3}.primary:active{background:#1464A2;border:1px solid #1464A2}.borderless{background:transparent;border:none;color:#212121}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.danger{background:#DC0000;border:1px solid #DC0000;color:white}.danger:hover{background:#C60000;border:1px solid #C60000}.danger:active{background:#B00000;border:1px solid #B00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}:host{display:inline-block}.spacingleft{margin-left:8px}";
|
|
5
|
+
|
|
6
|
+
const TttxButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this._iconcolor = 'black';
|
|
12
|
+
this.notext = undefined;
|
|
13
|
+
this.icon = undefined;
|
|
14
|
+
this.iconposition = 'left';
|
|
15
|
+
this.design = 'default';
|
|
16
|
+
}
|
|
17
|
+
componentWillLoad() {
|
|
18
|
+
this._design = this.design;
|
|
19
|
+
const designs = ['primary', 'default', 'disabled', 'danger', 'borderless'];
|
|
20
|
+
if (!designs.includes(this.design)) {
|
|
21
|
+
this._design = 'default';
|
|
22
|
+
}
|
|
23
|
+
if (this._design === 'primary' || this._design === 'danger') {
|
|
24
|
+
this._iconcolor = 'white';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return (h(Host, null, h("button", { class: `button ${this._design} ${this.icon ? 'withicon' : ''} ${this.icon && this.iconposition ? 'icon' + this.iconposition : ''} ${this.notext ? 'notext' : ''}` }, this.icon && this.iconposition === 'left' && (h("div", { class: "icon-left" }, h("tttx-icon", { icon: this.icon, color: this._iconcolor }))), !this.notext && h("div", { class: "button-content" }, h("slot", null)), this.icon && this.iconposition === 'right' && (h("div", { class: "icon-right" }, h("tttx-icon", { icon: this.icon, color: this._iconcolor }))))));
|
|
29
|
+
}
|
|
30
|
+
static get style() { return tttxButtonCss; }
|
|
31
|
+
}, [1, "tttx-button", {
|
|
32
|
+
"notext": [4],
|
|
33
|
+
"icon": [1],
|
|
34
|
+
"iconposition": [1],
|
|
35
|
+
"design": [1]
|
|
36
|
+
}]);
|
|
37
|
+
function defineCustomElement$1() {
|
|
38
|
+
if (typeof customElements === "undefined") {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const components = ["tttx-button", "tttx-icon"];
|
|
42
|
+
components.forEach(tagName => { switch (tagName) {
|
|
43
|
+
case "tttx-button":
|
|
44
|
+
if (!customElements.get(tagName)) {
|
|
45
|
+
customElements.define(tagName, TttxButton$1);
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
case "tttx-icon":
|
|
49
|
+
if (!customElements.get(tagName)) {
|
|
50
|
+
defineCustomElement$2();
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
} });
|
|
54
|
+
}
|
|
2
55
|
|
|
3
56
|
const TttxButton = TttxButton$1;
|
|
4
57
|
const defineCustomElement = defineCustomElement$1;
|