@3t-transform/threeteeui 0.0.24 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-bc080fb4.js → index-451f61dd.js} +51 -60
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/tttx-button.cjs.entry.js +1 -1
- package/dist/cjs/tttx-form.cjs.entry.js +377 -0
- package/dist/cjs/tttx-icon.cjs.entry.js +2 -2
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +8 -5
- package/dist/cjs/tttx-list.cjs.entry.js +1677 -7
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +7 -3
- package/dist/cjs/tttx.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +4 -0
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +1 -1
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +7 -4
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +35 -0
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +58 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +336 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +364 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +127 -0
- package/dist/collection/components/molecules/tttx-list/tttx-list.css +8 -2
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +33 -7
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +46 -14
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +25 -3
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +57 -1
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +14 -1
- package/dist/collection/shared/domsanitiser.options.js +14 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{tttx-table.d.ts → tttx-form.d.ts} +4 -4
- package/dist/components/tttx-form.js +394 -0
- package/dist/components/tttx-icon2.js +1 -1
- package/dist/components/tttx-keyvalue-block.js +7 -4
- package/dist/components/tttx-list.js +1678 -7
- package/dist/components/tttx-standalone-input.js +9 -2
- package/dist/esm/{index-901bfd55.js → index-0350f122.js} +51 -60
- package/dist/esm/loader.js +2 -2
- package/dist/esm/tttx-button.entry.js +1 -1
- package/dist/esm/tttx-form.entry.js +373 -0
- package/dist/esm/tttx-icon.entry.js +2 -2
- package/dist/esm/tttx-keyvalue-block.entry.js +8 -5
- package/dist/esm/tttx-list.entry.js +1677 -7
- package/dist/esm/tttx-loading-spinner.entry.js +1 -1
- package/dist/esm/tttx-standalone-input.entry.js +7 -3
- package/dist/esm/tttx.js +2 -2
- package/dist/tttx/{p-a4077908.entry.js → p-1b015a9d.entry.js} +1 -1
- package/dist/tttx/{p-9a382959.entry.js → p-4f3958fa.entry.js} +1 -1
- package/dist/tttx/p-62869344.js +2 -0
- package/dist/tttx/{p-0ae51ec5.entry.js → p-92465671.entry.js} +1 -1
- package/dist/tttx/p-a0179cb1.entry.js +1 -0
- package/dist/tttx/p-b0a6b872.entry.js +1 -0
- package/dist/tttx/p-cd1565e0.entry.js +3 -0
- package/dist/tttx/p-ce015353.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -0
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -0
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +114 -0
- package/dist/types/components/molecules/{tttx-table/tttx-table.stories.d.ts → tttx-form/tttx-form.stories.d.ts} +2 -10
- package/dist/types/components/molecules/tttx-list/interfaces.d.ts +4 -2
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +3 -1
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +7 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +3 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +16 -0
- package/dist/types/components.d.ts +32 -28
- package/dist/types/shared/domsanitiser.options.d.ts +10 -0
- package/package.json +1 -1
- package/dist/cjs/tttx-table.cjs.entry.js +0 -60
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.e2e.js +0 -9
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.spec.js +0 -43
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.e2e.js +0 -9
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.spec.js +0 -16
- package/dist/collection/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.js +0 -164
- package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js +0 -64
- package/dist/collection/components/molecules/tttx-list/test/tttx-list.spec.js +0 -151
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js +0 -9
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.js +0 -146
- package/dist/collection/components/molecules/tttx-table/test/tttx-table.e2e.js +0 -9
- package/dist/collection/components/molecules/tttx-table/tttx-table.css +0 -166
- package/dist/collection/components/molecules/tttx-table/tttx-table.js +0 -174
- package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +0 -81
- package/dist/components/tttx-table.js +0 -85
- package/dist/esm/tttx-table.entry.js +0 -56
- package/dist/tttx/p-1ec23160.entry.js +0 -1
- package/dist/tttx/p-300ff6a8.entry.js +0 -1
- package/dist/tttx/p-32ad02d3.entry.js +0 -1
- package/dist/tttx/p-80cf5236.entry.js +0 -1
- package/dist/tttx/p-a1bd16a1.entry.js +0 -1
- package/dist/tttx/p-a6953900.entry.js +0 -1
- package/dist/tttx/p-b46e3c59.entry.js +0 -1
- package/dist/tttx/p-c290160b.js +0 -2
- package/dist/tttx/p-dc179257.entry.js +0 -1
- package/dist/tttx/p-e19eb07e.entry.js +0 -1
- package/dist/tttx/p-e4341658.entry.js +0 -1
- package/dist/types/components/atoms/tttx-button/test/tttx-button.e2e.d.ts +0 -1
- package/dist/types/components/atoms/tttx-button/test/tttx-button.spec.d.ts +0 -1
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.e2e.d.ts +0 -1
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.spec.d.ts +0 -1
- package/dist/types/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.d.ts +0 -1
- package/dist/types/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-list/test/tttx-list.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.d.ts +0 -1
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-table/test/tttx-table.e2e.d.ts +0 -1
- package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +0 -15
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { newSpecPage } from '@stencil/core/testing';
|
|
2
|
-
import { TttxList } from '../tttx-list';
|
|
3
|
-
describe('tttx-list', () => {
|
|
4
|
-
it('renders a spinner before loading in data', async () => {
|
|
5
|
-
const page = await newSpecPage({
|
|
6
|
-
components: [TttxList],
|
|
7
|
-
html: '<tttx-list name=\'before-load\' />',
|
|
8
|
-
});
|
|
9
|
-
expect(page.root).toEqualHtml(`
|
|
10
|
-
<tttx-list name='before-load'>
|
|
11
|
-
<mock:shadow-root>
|
|
12
|
-
<div class="list-item-container" tabindex="0">
|
|
13
|
-
</div>
|
|
14
|
-
<div class="load-indicator"><tttx-loading-spinner size='large' /></div>
|
|
15
|
-
</mock:shadow-root>
|
|
16
|
-
</tttx-list>
|
|
17
|
-
`);
|
|
18
|
-
});
|
|
19
|
-
it('renders a No Data message if not loading and empty', async () => {
|
|
20
|
-
const page = await newSpecPage({
|
|
21
|
-
components: [TttxList],
|
|
22
|
-
html: '<tttx-list name=\'empty-list\' />',
|
|
23
|
-
});
|
|
24
|
-
page.doc.dispatchEvent(new CustomEvent('listPageLoad', {
|
|
25
|
-
detail: {
|
|
26
|
-
name: 'empty-list',
|
|
27
|
-
lastPage: true,
|
|
28
|
-
items: []
|
|
29
|
-
}
|
|
30
|
-
}));
|
|
31
|
-
await page.waitForChanges();
|
|
32
|
-
expect(page.root).toEqualHtml(`
|
|
33
|
-
<tttx-list name="empty-list">
|
|
34
|
-
<mock:shadow-root>
|
|
35
|
-
<div class="list-item-container" tabindex="0">
|
|
36
|
-
No data to display
|
|
37
|
-
</div>
|
|
38
|
-
</mock:shadow-root>
|
|
39
|
-
</tttx-list>
|
|
40
|
-
`);
|
|
41
|
-
});
|
|
42
|
-
it('renders a simple list template when no template is provided', async () => {
|
|
43
|
-
const page = await newSpecPage({
|
|
44
|
-
components: [TttxList],
|
|
45
|
-
html: '<tttx-list name=\'simple-list\' />',
|
|
46
|
-
});
|
|
47
|
-
page.doc.dispatchEvent(new CustomEvent('listPageLoad', {
|
|
48
|
-
detail: {
|
|
49
|
-
name: 'simple-list',
|
|
50
|
-
lastPage: true,
|
|
51
|
-
items: [
|
|
52
|
-
{ text: 'A row with only text' },
|
|
53
|
-
{ text: 'A row with text and an icon', icon: 'settings' },
|
|
54
|
-
{ text: 'A row with text and a coloured icon', icon: 'warning', iconColor: '#ff0000' }
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
}));
|
|
58
|
-
await page.waitForChanges();
|
|
59
|
-
expect(page.root).toEqualHtml(`
|
|
60
|
-
<tttx-list name="simple-list">
|
|
61
|
-
<mock:shadow-root>
|
|
62
|
-
<div class="list-item-container" tabindex="0">
|
|
63
|
-
<div class="tttx-list__row">
|
|
64
|
-
<div class="generic-template__content">
|
|
65
|
-
A row with only text
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
<div class="tttx-list__row">
|
|
69
|
-
<div class="generic-template__content">
|
|
70
|
-
<span class="material-symbols-rounded">settings</span>A row with text and an icon
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
<div class="tttx-list__row">
|
|
74
|
-
<div class="generic-template__content">
|
|
75
|
-
<span class="material-symbols-rounded" style="color: #ff0000;">warning</span>A row with text and a coloured icon
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
</mock:shadow-root>
|
|
80
|
-
</tttx-list>
|
|
81
|
-
`);
|
|
82
|
-
});
|
|
83
|
-
it('dispatches an event when clicking a row', async () => {
|
|
84
|
-
const page = await newSpecPage({
|
|
85
|
-
components: [TttxList],
|
|
86
|
-
html: '<tttx-list name=\'clickable-list\' />',
|
|
87
|
-
});
|
|
88
|
-
page.doc.dispatchEvent(new CustomEvent('listPageLoad', {
|
|
89
|
-
detail: {
|
|
90
|
-
name: 'clickable-list',
|
|
91
|
-
lastPage: true,
|
|
92
|
-
items: [
|
|
93
|
-
{ text: 'A row with only text' },
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}));
|
|
97
|
-
await page.waitForChanges();
|
|
98
|
-
});
|
|
99
|
-
it('clears the list data when receiving a listClearDataCache event', async () => {
|
|
100
|
-
const page = await newSpecPage({
|
|
101
|
-
components: [TttxList],
|
|
102
|
-
html: '<tttx-list name=\'clearable-list\' />',
|
|
103
|
-
});
|
|
104
|
-
page.doc.dispatchEvent(new CustomEvent('listPageLoad', {
|
|
105
|
-
detail: {
|
|
106
|
-
name: 'clearable-list',
|
|
107
|
-
lastPage: true,
|
|
108
|
-
items: [
|
|
109
|
-
{ text: 'A row with only text' },
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
}));
|
|
113
|
-
await page.waitForChanges();
|
|
114
|
-
expect(page.root).toEqualHtml(`
|
|
115
|
-
<tttx-list name="clearable-list">
|
|
116
|
-
<mock:shadow-root>
|
|
117
|
-
<div class="list-item-container" tabindex="0">
|
|
118
|
-
<div class="tttx-list__row">
|
|
119
|
-
<div class="generic-template__content">
|
|
120
|
-
A row with only text
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
</mock:shadow-root>
|
|
125
|
-
</tttx-list>
|
|
126
|
-
`);
|
|
127
|
-
page.doc.dispatchEvent(new CustomEvent('listClearDataCache', {
|
|
128
|
-
detail: {
|
|
129
|
-
name: 'clearable-list'
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
|
-
await page.waitForChanges();
|
|
133
|
-
expect(page.root).toEqualHtml(`
|
|
134
|
-
<tttx-list name="clearable-list">
|
|
135
|
-
<mock:shadow-root>
|
|
136
|
-
<div class="list-item-container" tabindex="0">
|
|
137
|
-
No data to display
|
|
138
|
-
</div>
|
|
139
|
-
</mock:shadow-root>
|
|
140
|
-
</tttx-list>
|
|
141
|
-
`);
|
|
142
|
-
});
|
|
143
|
-
// describe('when selectable', () => {
|
|
144
|
-
// it('renders rows with a checkbox', () => {
|
|
145
|
-
// });
|
|
146
|
-
// it('responds with the selected row data when a listActionSelectedEvent event is dispatched', () => {
|
|
147
|
-
// });
|
|
148
|
-
// it('removes selected rows when listActionSelectedEvent instructs it to', () => {
|
|
149
|
-
// });
|
|
150
|
-
// });
|
|
151
|
-
});
|
package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
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,166 +0,0 @@
|
|
|
1
|
-
// SPACING
|
|
2
|
-
$spacing-unit: 4px;
|
|
3
|
-
|
|
4
|
-
// REGULAR
|
|
5
|
-
$horizontal-spacing: $spacing-unit * 4;
|
|
6
|
-
$vertical-spacing: $spacing-unit * 2;
|
|
7
|
-
$base-padding: $vertical-spacing $horizontal-spacing;
|
|
8
|
-
$base-height: $spacing-unit * 9;
|
|
9
|
-
$component-spacing: $spacing-unit * 4;
|
|
10
|
-
|
|
11
|
-
// SMALL
|
|
12
|
-
$horizontal-spacing-sm: $spacing-unit * 2;
|
|
13
|
-
$vertical-spacing-sm: $spacing-unit * 1;
|
|
14
|
-
$base-padding-sm: $vertical-spacing-sm $horizontal-spacing-sm;
|
|
15
|
-
$base-height-sm: $spacing-unit * 7;
|
|
16
|
-
|
|
17
|
-
// COLOURS
|
|
18
|
-
$grey-0: #212121;
|
|
19
|
-
$grey-1: #363636;
|
|
20
|
-
$grey-2: #4c4c4c;
|
|
21
|
-
$grey-3: #636363;
|
|
22
|
-
$grey-4: #757575;
|
|
23
|
-
$grey-5: #9e9e9e;
|
|
24
|
-
$grey-6: #aeaeae;
|
|
25
|
-
$grey-7: #c8c8c8;
|
|
26
|
-
$grey-8: #e3e3e3;
|
|
27
|
-
$grey-9: #f0f0f0;
|
|
28
|
-
|
|
29
|
-
$white: white;
|
|
30
|
-
$black: $grey-0;
|
|
31
|
-
$transparent: transparent;
|
|
32
|
-
|
|
33
|
-
$blue-0: #00187c;
|
|
34
|
-
$blue-1: #032e8c;
|
|
35
|
-
$blue-2: #0849a3;
|
|
36
|
-
$blue-3: #0951a8;
|
|
37
|
-
$blue-4: #1169ba;
|
|
38
|
-
$blue-5: #1479c6;
|
|
39
|
-
$blue-6: #5194d2;
|
|
40
|
-
$blue-7: #7aacdd;
|
|
41
|
-
$blue-8: #b9d5ed;
|
|
42
|
-
$blue-9: #e7f1f9;
|
|
43
|
-
|
|
44
|
-
$red-0: #7c0000;
|
|
45
|
-
$red-1: #8c0000;
|
|
46
|
-
$red-2: #a30000;
|
|
47
|
-
$red-3: #a80000;
|
|
48
|
-
$red-4: #ba0000;
|
|
49
|
-
$red-5: #dc0000;
|
|
50
|
-
$red-6: #d25151;
|
|
51
|
-
$red-7: #dd7a7a;
|
|
52
|
-
$red-8: #edc1c1;
|
|
53
|
-
$red-9: #f9e7e7;
|
|
54
|
-
|
|
55
|
-
$black-1: #e6e6e6;
|
|
56
|
-
|
|
57
|
-
$brand: $blue-0;
|
|
58
|
-
$accent: $blue-5;
|
|
59
|
-
$accent-selected: $blue-9;
|
|
60
|
-
$error: $red-5;
|
|
61
|
-
|
|
62
|
-
$severity-critical: #dc0000;
|
|
63
|
-
$severity-warning: #f59500;
|
|
64
|
-
$severity-success: #a2bb31;
|
|
65
|
-
$severity-info: $accent;
|
|
66
|
-
|
|
67
|
-
$ui-primary: $black;
|
|
68
|
-
$ui-secondary: $grey-4;
|
|
69
|
-
$ui-disabled: $grey-2;
|
|
70
|
-
$ui-placeholder: $grey-5;
|
|
71
|
-
|
|
72
|
-
$ui-background: $grey-9;
|
|
73
|
-
$ui-sheet: $white;
|
|
74
|
-
$ui-border: #d5d5d5;
|
|
75
|
-
|
|
76
|
-
// BORDERS
|
|
77
|
-
$ui-border-radius: 4px;
|
|
78
|
-
$ui-border-width: 1px;
|
|
79
|
-
|
|
80
|
-
// TYPOGRAPHY
|
|
81
|
-
$font-size-default: 16px;
|
|
82
|
-
$font-size-small: 14px;
|
|
83
|
-
|
|
84
|
-
.material-symbols-rounded {
|
|
85
|
-
font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.skeleton {
|
|
89
|
-
animation: skeleton-loading 1s linear infinite alternate;
|
|
90
|
-
border-radius: 4px;
|
|
91
|
-
width: 100%;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@keyframes skeleton-loading {
|
|
95
|
-
0% {
|
|
96
|
-
background-color: hsl(200, 20%, 80%);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
100% {
|
|
100
|
-
background-color: hsl(200, 20%, 95%);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
:host {
|
|
105
|
-
display: block;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
table {
|
|
109
|
-
box-sizing: border-box;
|
|
110
|
-
width: 100%;
|
|
111
|
-
border-collapse: collapse;
|
|
112
|
-
border-spacing: 0;
|
|
113
|
-
border: 1px solid #ddd;
|
|
114
|
-
border-bottom: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
thead tr {
|
|
118
|
-
height: 52px;
|
|
119
|
-
color: #757575;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
tbody tr {
|
|
123
|
-
height: 48px;
|
|
124
|
-
color: #212121;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
tr {
|
|
128
|
-
|
|
129
|
-
/* Cell typography */
|
|
130
|
-
font-family: 'Roboto', sans-serif;
|
|
131
|
-
font-weight: 400;
|
|
132
|
-
font-size: 16px;
|
|
133
|
-
|
|
134
|
-
/* center the contents vertically */
|
|
135
|
-
display: flex;
|
|
136
|
-
align-items: center;
|
|
137
|
-
|
|
138
|
-
/* Border */
|
|
139
|
-
border-bottom: 1px solid #ddd;
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.selected {
|
|
144
|
-
background-color: #F0F0F0;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.checked {
|
|
148
|
-
background-color: #e7f1f9;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
td,
|
|
152
|
-
th {
|
|
153
|
-
min-width: 300px;
|
|
154
|
-
margin-left: 16px;
|
|
155
|
-
display: flex;
|
|
156
|
-
align-items: left;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.skeleton {
|
|
160
|
-
height: 24px;
|
|
161
|
-
display: block;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.align-right {
|
|
165
|
-
margin-left: auto;
|
|
166
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import { Host, h } from '@stencil/core';
|
|
3
|
-
export class TttxTable {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.headers = [];
|
|
6
|
-
this.data = [];
|
|
7
|
-
this.loading = false;
|
|
8
|
-
this.selected = -1;
|
|
9
|
-
}
|
|
10
|
-
handleKeyDown(ev) {
|
|
11
|
-
if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') {
|
|
12
|
-
this.updateSelectedIndex(ev.key);
|
|
13
|
-
this.emitRowSelected();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
updateSelectedIndex(key) {
|
|
17
|
-
if (this.selected === -1) {
|
|
18
|
-
this.selected = 0;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
const isArrowDown = key === 'ArrowDown';
|
|
22
|
-
const isArrowUp = key === 'ArrowUp';
|
|
23
|
-
if (isArrowDown && this.selected < this.data.length - 1) {
|
|
24
|
-
this.selected++;
|
|
25
|
-
}
|
|
26
|
-
else if (isArrowUp && this.selected > 0) {
|
|
27
|
-
this.selected--;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
emitRowSelected() {
|
|
32
|
-
this.rowSelected.emit(this.data[this.selected]);
|
|
33
|
-
}
|
|
34
|
-
rowSelectedHandler(row) {
|
|
35
|
-
this.rowSelected.emit(row);
|
|
36
|
-
this.selected = this.data.findIndex((item) => item === row);
|
|
37
|
-
}
|
|
38
|
-
headerClickedHandler(key) {
|
|
39
|
-
this.headerClicked.emit(key);
|
|
40
|
-
}
|
|
41
|
-
render() {
|
|
42
|
-
return (h(Host, null, h("table", null, h("thead", null, h("tr", null, this.loading ?
|
|
43
|
-
[1, 2, 3].map(() => (h("th", null, h("div", { class: "skeleton" })))) :
|
|
44
|
-
this.headers && this.headers.map((header) => (h("th", { scope: "col", onClick: () => this.headerClickedHandler(header.key) }, header.label))))), h("tbody", null, this.loading ?
|
|
45
|
-
[1, 2, 3].map(() => (h("tr", null, h("td", null, h("div", { class: "skeleton" })), h("td", null, h("div", { class: "skeleton" })), h("td", null, h("div", { class: "skeleton" }))))) :
|
|
46
|
-
Object.keys(this.data).map((key, index) => (h("tr", { class: index === this.selected ? 'selected' : '', onClick: () => this.rowSelectedHandler(this.data[key]) }, this.headers.map((header) => (h("td", null, this.data[key][header.key], " ", header.actions && h("tttx-icon", { class: "align-right", icon: "more_vert" }, h("div", { slot: "popover" }, h("tttx-popover-content", { header: "The humble egg", body: "Most arthropods such as insects, vertebrates (excluding live-bearing mammals), and mollusks lay eggs, although some, such as scorpions, do not.", linkcontext: "Wikipedia_egg", linktext: "Learn more about eggs" })))))))))))));
|
|
47
|
-
}
|
|
48
|
-
static get is() { return "tttx-table"; }
|
|
49
|
-
static get encapsulation() { return "shadow"; }
|
|
50
|
-
static get originalStyleUrls() {
|
|
51
|
-
return {
|
|
52
|
-
"$": ["tttx-table.css"]
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
static get styleUrls() {
|
|
56
|
-
return {
|
|
57
|
-
"$": ["tttx-table.css"]
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
static get properties() {
|
|
61
|
-
return {
|
|
62
|
-
"headers": {
|
|
63
|
-
"type": "unknown",
|
|
64
|
-
"mutable": false,
|
|
65
|
-
"complexType": {
|
|
66
|
-
"original": "any[]",
|
|
67
|
-
"resolved": "any[]",
|
|
68
|
-
"references": {}
|
|
69
|
-
},
|
|
70
|
-
"required": false,
|
|
71
|
-
"optional": false,
|
|
72
|
-
"docs": {
|
|
73
|
-
"tags": [],
|
|
74
|
-
"text": ""
|
|
75
|
-
},
|
|
76
|
-
"defaultValue": "[]"
|
|
77
|
-
},
|
|
78
|
-
"data": {
|
|
79
|
-
"type": "unknown",
|
|
80
|
-
"mutable": false,
|
|
81
|
-
"complexType": {
|
|
82
|
-
"original": "any[]",
|
|
83
|
-
"resolved": "any[]",
|
|
84
|
-
"references": {}
|
|
85
|
-
},
|
|
86
|
-
"required": false,
|
|
87
|
-
"optional": false,
|
|
88
|
-
"docs": {
|
|
89
|
-
"tags": [],
|
|
90
|
-
"text": ""
|
|
91
|
-
},
|
|
92
|
-
"defaultValue": "[]"
|
|
93
|
-
},
|
|
94
|
-
"loading": {
|
|
95
|
-
"type": "boolean",
|
|
96
|
-
"mutable": false,
|
|
97
|
-
"complexType": {
|
|
98
|
-
"original": "boolean",
|
|
99
|
-
"resolved": "boolean",
|
|
100
|
-
"references": {}
|
|
101
|
-
},
|
|
102
|
-
"required": false,
|
|
103
|
-
"optional": false,
|
|
104
|
-
"docs": {
|
|
105
|
-
"tags": [],
|
|
106
|
-
"text": ""
|
|
107
|
-
},
|
|
108
|
-
"attribute": "loading",
|
|
109
|
-
"reflect": false,
|
|
110
|
-
"defaultValue": "false"
|
|
111
|
-
},
|
|
112
|
-
"selected": {
|
|
113
|
-
"type": "number",
|
|
114
|
-
"mutable": false,
|
|
115
|
-
"complexType": {
|
|
116
|
-
"original": "number",
|
|
117
|
-
"resolved": "number",
|
|
118
|
-
"references": {}
|
|
119
|
-
},
|
|
120
|
-
"required": false,
|
|
121
|
-
"optional": false,
|
|
122
|
-
"docs": {
|
|
123
|
-
"tags": [],
|
|
124
|
-
"text": ""
|
|
125
|
-
},
|
|
126
|
-
"attribute": "selected",
|
|
127
|
-
"reflect": false,
|
|
128
|
-
"defaultValue": "-1"
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
static get events() {
|
|
133
|
-
return [{
|
|
134
|
-
"method": "rowSelected",
|
|
135
|
-
"name": "rowSelected",
|
|
136
|
-
"bubbles": true,
|
|
137
|
-
"cancelable": true,
|
|
138
|
-
"composed": true,
|
|
139
|
-
"docs": {
|
|
140
|
-
"tags": [],
|
|
141
|
-
"text": ""
|
|
142
|
-
},
|
|
143
|
-
"complexType": {
|
|
144
|
-
"original": "any",
|
|
145
|
-
"resolved": "any",
|
|
146
|
-
"references": {}
|
|
147
|
-
}
|
|
148
|
-
}, {
|
|
149
|
-
"method": "headerClicked",
|
|
150
|
-
"name": "headerClicked",
|
|
151
|
-
"bubbles": true,
|
|
152
|
-
"cancelable": true,
|
|
153
|
-
"composed": true,
|
|
154
|
-
"docs": {
|
|
155
|
-
"tags": [],
|
|
156
|
-
"text": ""
|
|
157
|
-
},
|
|
158
|
-
"complexType": {
|
|
159
|
-
"original": "any",
|
|
160
|
-
"resolved": "any",
|
|
161
|
-
"references": {}
|
|
162
|
-
}
|
|
163
|
-
}];
|
|
164
|
-
}
|
|
165
|
-
static get listeners() {
|
|
166
|
-
return [{
|
|
167
|
-
"name": "keydown",
|
|
168
|
-
"method": "handleKeyDown",
|
|
169
|
-
"target": "document",
|
|
170
|
-
"capture": false,
|
|
171
|
-
"passive": false
|
|
172
|
-
}];
|
|
173
|
-
}
|
|
174
|
-
}
|