@3t-transform/threeteeui 0.1.21 → 0.1.22
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-b8a62ede.js → index-dc6cc829.js} +2 -88
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/tttx-button.cjs.entry.js +24 -24
- package/dist/cjs/tttx-filter.cjs.entry.js +152 -152
- package/dist/cjs/tttx-form.cjs.entry.js +363 -363
- package/dist/cjs/tttx-icon.cjs.entry.js +11 -11
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +59 -59
- package/dist/cjs/tttx-list.cjs.entry.js +43 -43
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
- package/dist/cjs/tttx-sorter.cjs.entry.js +112 -0
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +60 -60
- package/dist/cjs/tttx-toolbar.cjs.entry.js +10 -10
- package/dist/cjs/tttx.cjs.js +3 -7
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -110
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +109 -109
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +325 -325
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +89 -89
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +35 -35
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +58 -58
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +364 -364
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +127 -127
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.css +116 -0
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +224 -0
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +47 -0
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +627 -627
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +157 -157
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -44
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +14 -14
- 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/collection/shared/domsanitiser.options.js +14 -14
- package/dist/components/index.d.ts +1 -9
- package/dist/components/index.js +2 -1
- package/dist/components/tttx-button.js +48 -48
- package/dist/components/tttx-filter.js +184 -184
- package/dist/components/tttx-form.js +380 -380
- package/dist/components/tttx-icon2.js +28 -28
- package/dist/components/tttx-keyvalue-block.js +76 -76
- package/dist/components/tttx-list.js +65 -65
- package/dist/components/tttx-loading-spinner.js +33 -33
- package/dist/components/tttx-sorter.d.ts +11 -0
- package/dist/components/tttx-sorter.js +141 -0
- package/dist/components/tttx-standalone-input.js +107 -107
- package/dist/components/tttx-toolbar.js +26 -26
- package/dist/esm/{index-e888a5f4.js → index-86faeaab.js} +3 -88
- package/dist/esm/loader.js +3 -4
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- 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 +24 -24
- package/dist/esm/tttx-filter.entry.js +152 -152
- package/dist/esm/tttx-form.entry.js +363 -363
- package/dist/esm/tttx-icon.entry.js +11 -11
- package/dist/esm/tttx-keyvalue-block.entry.js +59 -59
- package/dist/esm/tttx-list.entry.js +43 -43
- package/dist/esm/tttx-loading-spinner.entry.js +16 -16
- package/dist/esm/tttx-sorter.entry.js +108 -0
- package/dist/esm/tttx-standalone-input.entry.js +60 -60
- package/dist/esm/tttx-toolbar.entry.js +10 -10
- package/dist/esm/tttx.js +3 -4
- package/dist/tttx/p-12fc0b16.entry.js +3 -0
- package/dist/tttx/p-52a47b7c.js +2 -0
- package/dist/tttx/p-5d9b6bc0.entry.js +1 -0
- package/dist/tttx/{p-41f5b296.entry.js → p-603f6ebe.entry.js} +1 -1
- package/dist/tttx/{p-e145951b.entry.js → p-72b4c98a.entry.js} +1 -1
- package/dist/tttx/{p-043f9b8a.entry.js → p-8f3badad.entry.js} +1 -1
- package/dist/tttx/{p-4cf3e1e0.entry.js → p-ae48fe5a.entry.js} +1 -1
- package/dist/tttx/{p-01f4628e.entry.js → p-bdb054b2.entry.js} +1 -1
- package/dist/tttx/{p-dc5c356b.entry.js → p-c72d1a03.entry.js} +1 -1
- package/dist/tttx/{p-96bbf1ed.entry.js → p-e25d5fe2.entry.js} +1 -1
- package/dist/tttx/{p-b3a03986.entry.js → p-f1d7eb35.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -10
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
- 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/molecules/tttx-filter/tttx-filter.d.ts +37 -37
- package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +43 -43
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +114 -114
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +13 -13
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
- package/dist/types/components/molecules/tttx-sorter/interfaces.d.ts +9 -0
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +19 -0
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +30 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +56 -56
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +123 -123
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -4
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -13
- package/dist/types/components/palette.stories.d.ts +6 -6
- package/dist/types/components.d.ts +27 -0
- 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/dist/types/shared/domsanitiser.options.d.ts +10 -10
- package/dist/types/stencil-public-runtime.d.ts +3 -59
- package/loader/index.d.ts +0 -9
- package/package.json +1 -1
- package/dist/tttx/p-6dff6b5a.entry.js +0 -3
- package/dist/tttx/p-f764ffc4.js +0 -2
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
.material-symbols-rounded {
|
|
2
|
+
font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.sorter-container {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
position: relative;
|
|
9
|
+
height: 36px;
|
|
10
|
+
border: 1px solid #d5d5d5;
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
font-family: "Roboto", serif;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
}
|
|
15
|
+
@media (max-width: 475px) {
|
|
16
|
+
.sorter-container {
|
|
17
|
+
width: 68px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
.sorter-container .arrow-toggle-button {
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
height: 36px;
|
|
26
|
+
background-color: white;
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
border: none;
|
|
29
|
+
border-bottom-left-radius: 4px;
|
|
30
|
+
border-top-left-radius: 4px;
|
|
31
|
+
}
|
|
32
|
+
.sorter-container .arrow-toggle-button .hydrated {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
.sorter-container .arrow-toggle-button span {
|
|
38
|
+
display: block;
|
|
39
|
+
margin: auto;
|
|
40
|
+
line-height: 16px;
|
|
41
|
+
}
|
|
42
|
+
.sorter-container .arrow-toggle-button .material-symbols-rounded {
|
|
43
|
+
color: #212121;
|
|
44
|
+
}
|
|
45
|
+
.sorter-container .dropdown-selector {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
position: relative;
|
|
48
|
+
height: 36px;
|
|
49
|
+
flex-grow: 1;
|
|
50
|
+
}
|
|
51
|
+
.sorter-container .dropdown-selector .dropdown-selector-button {
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
flex-direction: row;
|
|
54
|
+
gap: 4px;
|
|
55
|
+
padding-right: 4px;
|
|
56
|
+
align-items: center;
|
|
57
|
+
height: 36px;
|
|
58
|
+
font-size: 16px;
|
|
59
|
+
line-height: 21px;
|
|
60
|
+
color: #212121;
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
width: 100%;
|
|
63
|
+
}
|
|
64
|
+
@media (max-width: 475px) {
|
|
65
|
+
.sorter-container .dropdown-selector .dropdown-selector-button .dropdown-selector-text {
|
|
66
|
+
display: none;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
.sorter-container .dropdown-selector .dropdown-selector-chevron {
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
right: 0;
|
|
72
|
+
top: 0;
|
|
73
|
+
flex-direction: row;
|
|
74
|
+
align-items: center;
|
|
75
|
+
align-self: flex-end;
|
|
76
|
+
height: 36px;
|
|
77
|
+
}
|
|
78
|
+
.sorter-container .dropdown-selector .dropdown-selector-chevron .hydrated {
|
|
79
|
+
height: 24px;
|
|
80
|
+
}
|
|
81
|
+
.sorter-container .dropdown-options-list {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 36px;
|
|
84
|
+
left: 0;
|
|
85
|
+
z-index: 1;
|
|
86
|
+
width: 100%;
|
|
87
|
+
line-height: 21px;
|
|
88
|
+
font-size: 16px;
|
|
89
|
+
border-radius: 4px;
|
|
90
|
+
padding-top: 8px;
|
|
91
|
+
padding-bottom: 7px;
|
|
92
|
+
box-shadow: 0px 1px 5px #1111114D;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
}
|
|
95
|
+
@media (max-width: 475px) {
|
|
96
|
+
.sorter-container .dropdown-options-list {
|
|
97
|
+
width: 220px;
|
|
98
|
+
padding-top: 8px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
.sorter-container .dropdown-options-list .dropdown-option {
|
|
102
|
+
padding: 8px 16px;
|
|
103
|
+
font-size: 16px;
|
|
104
|
+
line-height: 21px;
|
|
105
|
+
}
|
|
106
|
+
.sorter-container .dropdown-options-list .dropdown-option:hover, .sorter-container .dropdown-options-list .dropdown-option:focus {
|
|
107
|
+
background-color: #e7f1f9;
|
|
108
|
+
}
|
|
109
|
+
.sorter-container.--expanded {
|
|
110
|
+
border-color: #1579c6;
|
|
111
|
+
}
|
|
112
|
+
@media (max-width: 475px) {
|
|
113
|
+
.sorter-container.--expanded {
|
|
114
|
+
border: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import { h, Host } from '@stencil/core';
|
|
3
|
+
export class TttxSorter {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.sorterKey = undefined;
|
|
6
|
+
this.defaultSortDirection = 'descending';
|
|
7
|
+
this.fieldOptionsData = null;
|
|
8
|
+
this.defaultOption = '';
|
|
9
|
+
this.selectedField = this.defaultOption;
|
|
10
|
+
this.sortDirection = this.defaultSortDirection;
|
|
11
|
+
this.dropdownExpand = false;
|
|
12
|
+
this.dropdownOptions = undefined;
|
|
13
|
+
}
|
|
14
|
+
emitSortEvent() {
|
|
15
|
+
this.sorterChangeEvent.emit({
|
|
16
|
+
sorterDirection: this.sortDirection,
|
|
17
|
+
sorterKey: this.sorterKey,
|
|
18
|
+
sortField: this.selectedField,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
onSortToggleClick(event) {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
if (this.sortDirection == 'ascending') {
|
|
24
|
+
this.sortDirection = 'descending';
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
this.sortDirection = 'ascending';
|
|
28
|
+
}
|
|
29
|
+
this.emitSortEvent();
|
|
30
|
+
}
|
|
31
|
+
onDropdownClicked() {
|
|
32
|
+
this.dropdownExpand = !this.dropdownExpand;
|
|
33
|
+
}
|
|
34
|
+
onDropdownSelected(event) {
|
|
35
|
+
this.dropdownExpand = false;
|
|
36
|
+
const target = event.target;
|
|
37
|
+
this.selectedField = target.innerHTML;
|
|
38
|
+
this.emitSortEvent();
|
|
39
|
+
}
|
|
40
|
+
// getOptionsList() {
|
|
41
|
+
// return this.el.shadowRoot.querySelectorAll('.dropdown-option');
|
|
42
|
+
// }
|
|
43
|
+
// /* istanbul ignore next */
|
|
44
|
+
// @Listen('keyup')
|
|
45
|
+
// handleKeyDown(ev: KeyboardEvent) {
|
|
46
|
+
// const keyboardEventValue = ev.key;
|
|
47
|
+
// if (document.activeElement.id != `sorter__${this.sorterKey}`) return;
|
|
48
|
+
// switch (keyboardEventValue) {
|
|
49
|
+
// case 'Enter':
|
|
50
|
+
// if (this._focussedElementIndex > -1) {
|
|
51
|
+
// const options = this.el.shadowRoot.querySelectorAll('.dropdown-option');
|
|
52
|
+
// this.selectedField = options[this._focussedElementIndex].innerHTML;
|
|
53
|
+
// this.emitSortEvent();
|
|
54
|
+
// }
|
|
55
|
+
// this.dropdownExpand = false;
|
|
56
|
+
// break;
|
|
57
|
+
// case 'Escape':
|
|
58
|
+
// this.dropdownExpand = false;
|
|
59
|
+
// break;
|
|
60
|
+
// case 'ArrowDown':
|
|
61
|
+
// this.dropdownExpand = true;
|
|
62
|
+
// if (this._focussedElementIndex > -1) {
|
|
63
|
+
// const options = this.getOptionsList();
|
|
64
|
+
// const currentOption = options[this._focussedElementIndex] as HTMLElement;
|
|
65
|
+
// currentOption.blur();
|
|
66
|
+
// options[this._focussedElementIndex].focus();
|
|
67
|
+
// this._focussedElementIndex + 1 < options.length ? this._focussedElementIndex++ : (this._focussedElementIndex = 0);
|
|
68
|
+
// } else {
|
|
69
|
+
// this._focussedElementIndex++;
|
|
70
|
+
// }
|
|
71
|
+
// break;
|
|
72
|
+
// case 'ArrowUp':
|
|
73
|
+
// this.dropdownExpand = true;
|
|
74
|
+
// if (this._focussedElementIndex == -1) {
|
|
75
|
+
// const options = this.getOptionsList();
|
|
76
|
+
// this._focussedElementIndex = options.length - 1;
|
|
77
|
+
// } else {
|
|
78
|
+
// const options = this.getOptionsList();
|
|
79
|
+
// const currentOption = options[this._focussedElementIndex] as HTMLElement;
|
|
80
|
+
// currentOption.blur();
|
|
81
|
+
// this._focussedElementIndex > 0 ? this._focussedElementIndex-- : (this._focussedElementIndex = options.length - 1);
|
|
82
|
+
// options[this._focussedElementIndex].focus();
|
|
83
|
+
// }
|
|
84
|
+
// break;
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
render() {
|
|
88
|
+
const parsedFieldOptionsData = typeof this.fieldOptionsData === 'string' ? JSON.parse(this.fieldOptionsData) : this.fieldOptionsData;
|
|
89
|
+
if (!this.fieldOptionsData)
|
|
90
|
+
return;
|
|
91
|
+
const arrowIcon = this.sortDirection == 'ascending' ? 'arrow_upward' : 'arrow_downward';
|
|
92
|
+
const chevronIcon = this.dropdownExpand ? 'expand_less' : 'expand_more';
|
|
93
|
+
const selectedOption = this.selectedField;
|
|
94
|
+
const dropdownSelectorClassNameModifier = this.dropdownExpand ? '--expanded' : '';
|
|
95
|
+
const sorterKey = `sorter__${this.sorterKey}`;
|
|
96
|
+
return (h(Host, { id: sorterKey }, h("div", { tabindex: 0, class: `sorter-container ${dropdownSelectorClassNameModifier}` }, h("button", { class: "arrow-toggle-button", type: "button", onClick: this.onSortToggleClick.bind(this) }, h("tttx-icon", { icon: arrowIcon, color: "black" })), h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, h("div", { class: "dropdown-selector-button" }, h("div", { class: "dropdown-selector-text" }, selectedOption), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" })))), this.dropdownExpand && (h("div", { class: "dropdown-options-list" }, parsedFieldOptionsData.sorterOptions.map(option => {
|
|
97
|
+
return (h("div", { class: "dropdown-option", tabIndex: -1, onClick: this.onDropdownSelected.bind(this), key: option.optionLabel }, option.optionLabel));
|
|
98
|
+
}))))));
|
|
99
|
+
}
|
|
100
|
+
static get is() { return "tttx-sorter"; }
|
|
101
|
+
static get encapsulation() { return "shadow"; }
|
|
102
|
+
static get originalStyleUrls() {
|
|
103
|
+
return {
|
|
104
|
+
"$": ["tttx-sorter.scss"]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
static get styleUrls() {
|
|
108
|
+
return {
|
|
109
|
+
"$": ["tttx-sorter.css"]
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
static get properties() {
|
|
113
|
+
return {
|
|
114
|
+
"sorterKey": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"mutable": false,
|
|
117
|
+
"complexType": {
|
|
118
|
+
"original": "string",
|
|
119
|
+
"resolved": "string",
|
|
120
|
+
"references": {}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": false,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": ""
|
|
127
|
+
},
|
|
128
|
+
"attribute": "sorter-key",
|
|
129
|
+
"reflect": false
|
|
130
|
+
},
|
|
131
|
+
"defaultSortDirection": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "'ascending' | 'descending'",
|
|
136
|
+
"resolved": "\"ascending\" | \"descending\"",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [],
|
|
143
|
+
"text": ""
|
|
144
|
+
},
|
|
145
|
+
"attribute": "default-sort-direction",
|
|
146
|
+
"reflect": false,
|
|
147
|
+
"defaultValue": "'descending'"
|
|
148
|
+
},
|
|
149
|
+
"fieldOptionsData": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "string | SorterData",
|
|
154
|
+
"resolved": "SorterData | string",
|
|
155
|
+
"references": {
|
|
156
|
+
"SorterData": {
|
|
157
|
+
"location": "import",
|
|
158
|
+
"path": "./interfaces"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"required": false,
|
|
163
|
+
"optional": false,
|
|
164
|
+
"docs": {
|
|
165
|
+
"tags": [],
|
|
166
|
+
"text": ""
|
|
167
|
+
},
|
|
168
|
+
"attribute": "field-options-data",
|
|
169
|
+
"reflect": false,
|
|
170
|
+
"defaultValue": "null"
|
|
171
|
+
},
|
|
172
|
+
"defaultOption": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "string",
|
|
177
|
+
"resolved": "string",
|
|
178
|
+
"references": {}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": ""
|
|
185
|
+
},
|
|
186
|
+
"attribute": "default-option",
|
|
187
|
+
"reflect": false,
|
|
188
|
+
"defaultValue": "''"
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
static get states() {
|
|
193
|
+
return {
|
|
194
|
+
"selectedField": {},
|
|
195
|
+
"sortDirection": {},
|
|
196
|
+
"dropdownExpand": {},
|
|
197
|
+
"dropdownOptions": {}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
static get events() {
|
|
201
|
+
return [{
|
|
202
|
+
"method": "sorterChangeEvent",
|
|
203
|
+
"name": "sorterChangeEvent",
|
|
204
|
+
"bubbles": true,
|
|
205
|
+
"cancelable": true,
|
|
206
|
+
"composed": true,
|
|
207
|
+
"docs": {
|
|
208
|
+
"tags": [],
|
|
209
|
+
"text": ""
|
|
210
|
+
},
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "SorterChangeEvent",
|
|
213
|
+
"resolved": "SorterChangeEvent",
|
|
214
|
+
"references": {
|
|
215
|
+
"SorterChangeEvent": {
|
|
216
|
+
"location": "import",
|
|
217
|
+
"path": "./interfaces"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}];
|
|
222
|
+
}
|
|
223
|
+
static get elementRef() { return "el"; }
|
|
224
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'molecules/Sorter',
|
|
4
|
+
component: 'tttx-sorter',
|
|
5
|
+
argTypes: {
|
|
6
|
+
fieldOptionsData: {
|
|
7
|
+
control: { type: 'object' },
|
|
8
|
+
},
|
|
9
|
+
defaultOption: {
|
|
10
|
+
control: { type: 'text' },
|
|
11
|
+
},
|
|
12
|
+
sorterKey: {
|
|
13
|
+
control: { type: 'text' },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
parameters: {
|
|
17
|
+
actions: {
|
|
18
|
+
handles: ['sorterChangeEvent'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
decorators: [withActions],
|
|
22
|
+
};
|
|
23
|
+
const TemplateSorter = ({ fieldOptionsData, sorterKey, defaultOption }) => {
|
|
24
|
+
return `
|
|
25
|
+
<tttx-sorter
|
|
26
|
+
field-options-data='${JSON.stringify(fieldOptionsData)}'
|
|
27
|
+
default-option='${defaultOption}'
|
|
28
|
+
sorter-key='${sorterKey}'/>
|
|
29
|
+
`;
|
|
30
|
+
};
|
|
31
|
+
const fieldOptionsData = {
|
|
32
|
+
sorterOptions: [{ optionLabel: 'Expiry date' }, { optionLabel: 'Qualification name' }],
|
|
33
|
+
};
|
|
34
|
+
export const BasicSorter = TemplateSorter.bind({});
|
|
35
|
+
BasicSorter.args = {
|
|
36
|
+
fieldOptionsData: fieldOptionsData,
|
|
37
|
+
sorterKey: 'BasicDropdown',
|
|
38
|
+
defaultOption: 'Qualification name',
|
|
39
|
+
};
|
|
40
|
+
export const AnotherSorter = TemplateSorter.bind({});
|
|
41
|
+
AnotherSorter.args = {
|
|
42
|
+
fieldOptionsData: {
|
|
43
|
+
sorterOptions: [{ optionLabel: 'Name' }, { optionLabel: 'Date of Birth' }, { optionLabel: 'Job Role' }],
|
|
44
|
+
},
|
|
45
|
+
sorterKey: 'BasicDropdown',
|
|
46
|
+
defaultOption: 'Date of Birth',
|
|
47
|
+
};
|