@3t-transform/threeteeui 0.2.80 → 0.2.82
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/loader.cjs.js +1 -1
- package/dist/cjs/tttx-percentage-bar.cjs.entry.js +65 -0
- package/dist/cjs/tttx-tree-view.cjs.entry.js +38 -11
- package/dist/cjs/tttx.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.css +11 -0
- package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.js +168 -0
- package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.stories.js +58 -0
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.css +31 -3
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.js +39 -11
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.stories.js +95 -8
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/tttx-percentage-bar.d.ts +11 -0
- package/dist/components/tttx-percentage-bar.js +87 -0
- package/dist/components/tttx-tree-view.js +40 -12
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tttx-percentage-bar.entry.js +61 -0
- package/dist/esm/tttx-tree-view.entry.js +38 -11
- package/dist/esm/tttx.js +1 -1
- package/dist/tttx/p-149f806e.entry.js +1 -0
- package/dist/tttx/p-62115838.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-percentage-bar/tttx-percentage-bar.d.ts +22 -0
- package/dist/types/components/atoms/tttx-percentage-bar/tttx-percentage-bar.stories.d.ts +10 -0
- package/dist/types/components/molecules/tttx-tree-view/helper/helper.d.ts +5 -0
- package/dist/types/components/molecules/tttx-tree-view/tttx-tree-view.d.ts +11 -0
- package/dist/types/components/molecules/tttx-tree-view/tttx-tree-view.stories.d.ts +2 -0
- package/dist/types/components.d.ts +24 -0
- package/package.json +2 -2
- package/dist/tttx/p-6e23f980.entry.js +0 -1
|
@@ -19,7 +19,6 @@ const TttxTreeViewStory = ({ data }) => `
|
|
|
19
19
|
}
|
|
20
20
|
treeViewDefault.data = ${JSON.stringify(data)};
|
|
21
21
|
</script>
|
|
22
|
-
|
|
23
22
|
`;
|
|
24
23
|
export const Default = TttxTreeViewStory.bind({});
|
|
25
24
|
Default.args = {
|
|
@@ -401,7 +400,7 @@ HTML.args = {
|
|
|
401
400
|
id: 1,
|
|
402
401
|
title: 'Role Specific Vocational Qualification',
|
|
403
402
|
isOpen: false,
|
|
404
|
-
html: '<
|
|
403
|
+
html: '<div>This is html </div>',
|
|
405
404
|
openOrClosed: 'arrow_right',
|
|
406
405
|
hasCheckbox: false,
|
|
407
406
|
hasIcon: false,
|
|
@@ -410,14 +409,14 @@ HTML.args = {
|
|
|
410
409
|
id: 2,
|
|
411
410
|
title: 'Boop',
|
|
412
411
|
isOpen: false,
|
|
413
|
-
html: '<
|
|
412
|
+
html: '<div>This is html </div>',
|
|
414
413
|
openOrClosed: 'arrow_right',
|
|
415
414
|
child: [
|
|
416
415
|
{
|
|
417
416
|
id: 2,
|
|
418
417
|
hasIcon: false,
|
|
419
418
|
title: 'this is a test',
|
|
420
|
-
html: '<
|
|
419
|
+
html: '<div>This is html </div>',
|
|
421
420
|
},
|
|
422
421
|
],
|
|
423
422
|
},
|
|
@@ -427,7 +426,7 @@ HTML.args = {
|
|
|
427
426
|
isOpen: false,
|
|
428
427
|
openOrClosed: 'arrow_right',
|
|
429
428
|
hasIcon: false,
|
|
430
|
-
html: '<
|
|
429
|
+
html: '<div>This is html </div>',
|
|
431
430
|
},
|
|
432
431
|
],
|
|
433
432
|
},
|
|
@@ -438,17 +437,17 @@ HTML.args = {
|
|
|
438
437
|
openOrClosed: 'arrow_right',
|
|
439
438
|
hasIcon: false,
|
|
440
439
|
hasCheckbox: false,
|
|
441
|
-
html: '<
|
|
440
|
+
html: '<div>This is html </div>',
|
|
442
441
|
child: [
|
|
443
442
|
{
|
|
444
443
|
id: 4,
|
|
445
444
|
title: 'Boop 2077',
|
|
446
|
-
html: '<
|
|
445
|
+
html: '<div>This is html </div>',
|
|
447
446
|
},
|
|
448
447
|
{
|
|
449
448
|
id: 4,
|
|
450
449
|
title: 'sjdnfkn 2077',
|
|
451
|
-
html: '<
|
|
450
|
+
html: '<div>This is html </div>',
|
|
452
451
|
},
|
|
453
452
|
],
|
|
454
453
|
},
|
|
@@ -741,3 +740,91 @@ const convertedData2 = {
|
|
|
741
740
|
RequirementsList2.args = {
|
|
742
741
|
data: [convertedData2],
|
|
743
742
|
};
|
|
743
|
+
const TttxTreeViewEmptyGroup = ({ data }) => `
|
|
744
|
+
<tttx-tree-view id="treeViewEmptyGroup"></tttx-tree-view>
|
|
745
|
+
<script>
|
|
746
|
+
if(!treeViewEmptyGroup) {
|
|
747
|
+
const treeViewEmptyGroup = document.getElementById('treeViewEmptyGroup');
|
|
748
|
+
}
|
|
749
|
+
treeViewEmptyGroup.data = ${JSON.stringify(data)};
|
|
750
|
+
</script>
|
|
751
|
+
`;
|
|
752
|
+
export const EmptyGroup = TttxTreeViewEmptyGroup.bind({});
|
|
753
|
+
EmptyGroup.args = {
|
|
754
|
+
data: [
|
|
755
|
+
{
|
|
756
|
+
id: 1,
|
|
757
|
+
title: 'Role Specific Vocational Qualification',
|
|
758
|
+
isOpen: false,
|
|
759
|
+
openOrClosed: 'arrow_right',
|
|
760
|
+
hasCheckbox: true,
|
|
761
|
+
checked: false,
|
|
762
|
+
hasIcon: true,
|
|
763
|
+
icon: 'check_circle',
|
|
764
|
+
iconColor: 'green',
|
|
765
|
+
child: [],
|
|
766
|
+
},
|
|
767
|
+
],
|
|
768
|
+
};
|
|
769
|
+
const TttxTreeViewselectable = ({ data }) => `
|
|
770
|
+
<tttx-tree-view id="treeViewselectable"></tttx-tree-view>
|
|
771
|
+
<script>
|
|
772
|
+
if(!treeViewselectable) {
|
|
773
|
+
const treeViewselectable = document.getElementById('treeViewselectable');
|
|
774
|
+
}
|
|
775
|
+
treeViewselectable.data = ${JSON.stringify(data)};
|
|
776
|
+
</script>
|
|
777
|
+
`;
|
|
778
|
+
export const selectableAndHover = TttxTreeViewselectable.bind({});
|
|
779
|
+
selectableAndHover.args = {
|
|
780
|
+
data: [
|
|
781
|
+
{
|
|
782
|
+
id: 1,
|
|
783
|
+
title: 'Role Specific Vocational Qualification',
|
|
784
|
+
isOpen: false,
|
|
785
|
+
openOrClosed: 'arrow_right',
|
|
786
|
+
hasCheckbox: false,
|
|
787
|
+
hasIcon: false,
|
|
788
|
+
hasHover: true,
|
|
789
|
+
selectable: true,
|
|
790
|
+
selected: false,
|
|
791
|
+
chevronActive: true,
|
|
792
|
+
child: [
|
|
793
|
+
{
|
|
794
|
+
id: 2,
|
|
795
|
+
title: 'Boop',
|
|
796
|
+
isOpen: false,
|
|
797
|
+
hasCheckbox: false,
|
|
798
|
+
hasIcon: false,
|
|
799
|
+
openOrClosed: 'arrow_right',
|
|
800
|
+
hasHover: true,
|
|
801
|
+
selectable: true,
|
|
802
|
+
selected: false,
|
|
803
|
+
chevronActive: true,
|
|
804
|
+
child: [
|
|
805
|
+
{
|
|
806
|
+
id: 4,
|
|
807
|
+
hasCheckbox: false,
|
|
808
|
+
hasIcon: false,
|
|
809
|
+
title: 'this is a test',
|
|
810
|
+
hasHover: true,
|
|
811
|
+
selectable: true,
|
|
812
|
+
selected: false,
|
|
813
|
+
},
|
|
814
|
+
],
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
id: 3,
|
|
818
|
+
title: 'Boop',
|
|
819
|
+
isOpen: false,
|
|
820
|
+
openOrClosed: 'arrow_right',
|
|
821
|
+
hasCheckbox: false,
|
|
822
|
+
hasIcon: false,
|
|
823
|
+
hasHover: true,
|
|
824
|
+
selectable: true,
|
|
825
|
+
selected: false,
|
|
826
|
+
},
|
|
827
|
+
],
|
|
828
|
+
},
|
|
829
|
+
],
|
|
830
|
+
};
|
|
@@ -8,6 +8,7 @@ export { TttxKeyvalueBlock as TttxKeyvalueBlock } from '../types/components/atom
|
|
|
8
8
|
export { TttxList as TttxList } from '../types/components/molecules/tttx-list/tttx-list';
|
|
9
9
|
export { TttxLoadingSpinner as TttxLoadingSpinner } from '../types/components/atoms/tttx-loading-spinner/tttx-loading-spinner';
|
|
10
10
|
export { TttxMultiselectBox as TttxMultiselectBox } from '../types/components/molecules/tttx-multiselect-box/tttx-multiselect-box';
|
|
11
|
+
export { TttxPercentageBar as TttxPercentageBar } from '../types/components/atoms/tttx-percentage-bar/tttx-percentage-bar';
|
|
11
12
|
export { TttxQrCode as TttxQrcode } from '../types/components/atoms/tttx-qrcode/tttx-qrcode';
|
|
12
13
|
export { TttxSelectBox as TttxSelectBox } from '../types/components/molecules/tttx-select-box/tttx-select-box';
|
|
13
14
|
export { TttxSorter as TttxSorter } from '../types/components/molecules/tttx-sorter/tttx-sorter';
|
package/dist/components/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { TttxKeyvalueBlock, defineCustomElement as defineCustomElementTttxKeyval
|
|
|
8
8
|
export { TttxList, defineCustomElement as defineCustomElementTttxList } from './tttx-list.js';
|
|
9
9
|
export { TttxLoadingSpinner, defineCustomElement as defineCustomElementTttxLoadingSpinner } from './tttx-loading-spinner.js';
|
|
10
10
|
export { TttxMultiselectBox, defineCustomElement as defineCustomElementTttxMultiselectBox } from './tttx-multiselect-box.js';
|
|
11
|
+
export { TttxPercentageBar, defineCustomElement as defineCustomElementTttxPercentageBar } from './tttx-percentage-bar.js';
|
|
11
12
|
export { TttxQrcode, defineCustomElement as defineCustomElementTttxQrcode } from './tttx-qrcode.js';
|
|
12
13
|
export { TttxSelectBox, defineCustomElement as defineCustomElementTttxSelectBox } from './tttx-select-box.js';
|
|
13
14
|
export { TttxSorter, defineCustomElement as defineCustomElementTttxSorter } from './tttx-sorter.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface TttxPercentageBar extends Components.TttxPercentageBar, HTMLElement {}
|
|
4
|
+
export const TttxPercentageBar: {
|
|
5
|
+
prototype: TttxPercentageBar;
|
|
6
|
+
new (): TttxPercentageBar;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const tttxPercentageBarCss = ".sc-tttx-percentage-bar-h{display:block}.progress.sc-tttx-percentage-bar{width:100%;background-color:#dbdbdb}.progress.sc-tttx-percentage-bar .bar.sc-tttx-percentage-bar{height:20px}";
|
|
4
|
+
|
|
5
|
+
const TttxPercentageBar$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.percentage = undefined;
|
|
10
|
+
this.thresholds = undefined;
|
|
11
|
+
this.color = '#d5d5d5';
|
|
12
|
+
this.min = '1';
|
|
13
|
+
this.labelid = undefined;
|
|
14
|
+
this._percentage = undefined;
|
|
15
|
+
this._ranges = undefined;
|
|
16
|
+
this._min = undefined;
|
|
17
|
+
}
|
|
18
|
+
componentWillRender() {
|
|
19
|
+
if (typeof this.percentage === 'string') {
|
|
20
|
+
this._percentage = parseInt(this.percentage);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
this._percentage = this.percentage;
|
|
24
|
+
}
|
|
25
|
+
let thresholdsArray;
|
|
26
|
+
if (this.thresholds) {
|
|
27
|
+
if (typeof this.thresholds === 'string') {
|
|
28
|
+
thresholdsArray = JSON.parse(this.thresholds);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
thresholdsArray = this.thresholds;
|
|
32
|
+
}
|
|
33
|
+
this._ranges = [{ range: [0], color: thresholdsArray[0].color }];
|
|
34
|
+
for (const [i, thresholdsObj] of thresholdsArray.entries()) {
|
|
35
|
+
this._ranges[this._ranges.length - 1].range.push(thresholdsObj.threshold);
|
|
36
|
+
this._ranges[this._ranges.length - 1].color = thresholdsObj.color;
|
|
37
|
+
if (i < thresholdsArray.length - 1) {
|
|
38
|
+
this._ranges.push({ range: [thresholdsObj.threshold], color: undefined });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
this._min = parseInt(this.min);
|
|
43
|
+
}
|
|
44
|
+
getColour() {
|
|
45
|
+
if (!this._ranges || this._ranges.length === 0) {
|
|
46
|
+
return this.color;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const range = this._ranges.find(r => this._percentage >= r.range[0] && this._percentage <= r.range[1]);
|
|
50
|
+
return range.color;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
getWidth() {
|
|
54
|
+
return Math.min(Math.max(this._percentage, Math.min(this._min, 100)), 100);
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
return (h(Host, null, h("div", { class: "progress" }, h("div", { class: "bar", style: { 'background-color': this.getColour(), 'width': `${this.getWidth()}%` }, role: "progressbar", "aria-valuemin": this._min, "aria-valuemax": "100", "aria-valuenow": this._percentage, "aria-labelledby": this.labelid }))));
|
|
58
|
+
}
|
|
59
|
+
static get style() { return tttxPercentageBarCss; }
|
|
60
|
+
}, [2, "tttx-percentage-bar", {
|
|
61
|
+
"percentage": [8],
|
|
62
|
+
"thresholds": [1],
|
|
63
|
+
"color": [1],
|
|
64
|
+
"min": [1],
|
|
65
|
+
"labelid": [1],
|
|
66
|
+
"_percentage": [32],
|
|
67
|
+
"_ranges": [32],
|
|
68
|
+
"_min": [32]
|
|
69
|
+
}]);
|
|
70
|
+
function defineCustomElement$1() {
|
|
71
|
+
if (typeof customElements === "undefined") {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const components = ["tttx-percentage-bar"];
|
|
75
|
+
components.forEach(tagName => { switch (tagName) {
|
|
76
|
+
case "tttx-percentage-bar":
|
|
77
|
+
if (!customElements.get(tagName)) {
|
|
78
|
+
customElements.define(tagName, TttxPercentageBar$1);
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
} });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const TttxPercentageBar = TttxPercentageBar$1;
|
|
85
|
+
const defineCustomElement = defineCustomElement$1;
|
|
86
|
+
|
|
87
|
+
export { TttxPercentageBar, defineCustomElement };
|
|
@@ -3,7 +3,7 @@ import { p as purify, d as domSanitiserOptions } from './domsanitiser.options.js
|
|
|
3
3
|
import { d as defineCustomElement$3 } from './tttx-button2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './tttx-icon2.js';
|
|
5
5
|
|
|
6
|
-
const tttxTreeViewCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.tree-view-element{margin-left:-50px}.inline-tree-item{display:flex;align-items:center}.element{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center;width:100%}.element-row{min-height:36px;font-family:\"Roboto\", serif;font-size:16px;padding:8px 0px;border-bottom:1px solid #d5d5d5}.
|
|
6
|
+
const tttxTreeViewCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.tree-view-element{margin-left:-50px}.inline-tree-item{display:flex;align-items:center}.element{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center;width:100%}.element-row{min-height:36px;font-family:\"Roboto\", serif;font-size:16px;padding:8px 0px;position:relative}.element-row::before{content:\"\";position:absolute;left:-50%;right:-50%;bottom:0;border-bottom:1px solid #d5d5d5}.element-row.rowSelected::before{content:\"\";position:absolute;left:-50%;right:-50%;top:0;bottom:0;background-color:rgba(17, 17, 17, 0.1);z-index:-1}li{list-style-type:none}.toggleNode{padding-right:3px}.padding-icon{padding:6px 6px;height:24px;width:24px;display:flex;align-items:center;justify-content:center}.treeNode{font-weight:500}.treeLeaf{font-weight:400}.right-buttons-container{margin-left:auto;display:flex}.borderless:active{outline-style:none}@media (hover: hover){.element-row.rowHover:hover{cursor:pointer}.element-row.rowHover:hover::before{content:\"\";position:absolute;left:-50%;right:-50%;top:0;bottom:0;background-color:rgba(17, 17, 17, 0.05);opacity:0.5;z-index:-1}}";
|
|
7
7
|
|
|
8
8
|
const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -13,11 +13,24 @@ const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
13
13
|
this.clickEvent = createEvent(this, "clickEvent", 7);
|
|
14
14
|
this.data = undefined;
|
|
15
15
|
this.treeData = undefined;
|
|
16
|
+
this.selectedId = undefined;
|
|
16
17
|
}
|
|
17
18
|
onClickHandler(clickName, event, node) {
|
|
18
19
|
event.stopPropagation();
|
|
19
20
|
const returnJsonObject = JSON.stringify(node);
|
|
20
21
|
this.clickEvent.emit({ eventName: clickName, returnJsonObject });
|
|
22
|
+
if (clickName === 'row') {
|
|
23
|
+
this.selectedElement(event, node);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//for testing as SelectedId is a state
|
|
27
|
+
updateSelectedId(newId) {
|
|
28
|
+
this.selectedId = newId;
|
|
29
|
+
}
|
|
30
|
+
selectedElement(event, node) {
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
this.selectedId = node.id;
|
|
33
|
+
this.treeData = [...this.treeData];
|
|
21
34
|
}
|
|
22
35
|
toggleNode(node, event) {
|
|
23
36
|
event.stopPropagation();
|
|
@@ -38,7 +51,14 @@ const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
38
51
|
});
|
|
39
52
|
}
|
|
40
53
|
}
|
|
41
|
-
|
|
54
|
+
updateSelected(node) {
|
|
55
|
+
let selected = false;
|
|
56
|
+
if (node.id === this.selectedId) {
|
|
57
|
+
selected = true;
|
|
58
|
+
}
|
|
59
|
+
return selected;
|
|
60
|
+
}
|
|
61
|
+
treeConfigs(node) {
|
|
42
62
|
let checkboxIcon, checkboxColor;
|
|
43
63
|
if (node.checked) {
|
|
44
64
|
checkboxIcon = 'check_box';
|
|
@@ -48,29 +68,36 @@ const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
48
68
|
checkboxIcon = 'check_box_outline_blank';
|
|
49
69
|
checkboxColor = 'grey';
|
|
50
70
|
}
|
|
51
|
-
const rowHoverActive = node.
|
|
71
|
+
const rowHoverActive = node.hasHover ? 'rowHover' : '';
|
|
52
72
|
const expanderIcon = node.isOpen ? 'arrow_drop_down' : 'arrow_right';
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
const selectedActive = node.selectable && node.selected ? 'rowSelected' : '';
|
|
74
|
+
return { checkboxColor, checkboxIcon, rowHoverActive, expanderIcon, selectedActive };
|
|
75
|
+
}
|
|
76
|
+
renderNode(node) {
|
|
77
|
+
if (node.selectable)
|
|
78
|
+
node.selected = this.updateSelected(node);
|
|
79
|
+
const options = this.treeConfigs(node);
|
|
80
|
+
if (node.child) {
|
|
81
|
+
return (h("li", null, h("div", { class: `inline-tree-item element-row ${options.rowHoverActive} ${options.selectedActive}`, onClick: (event) => {
|
|
82
|
+
if (node.hasHover) {
|
|
56
83
|
event.stopPropagation();
|
|
57
84
|
this.onClickHandler('row', event, node);
|
|
58
85
|
}
|
|
59
|
-
} }, h("tttx-button", { class: "toggleNode", design: "borderless-circle", notext: true, icon: expanderIcon, color: "black", onClick: event => this.toggleNode(node, event) }), this.htmlcode('treeNode', node, checkboxIcon, checkboxColor)), node.isOpen ? (h("ul", null, h("div", { class: "child-node" }, node.child.map(childNode => {
|
|
86
|
+
} }, h("tttx-button", { class: "toggleNode", design: "borderless-circle", notext: true, icon: options.expanderIcon, color: "black", onClick: event => this.toggleNode(node, event) }), this.htmlcode('treeNode', node, options.checkboxIcon, options.checkboxColor)), node.isOpen ? (h("ul", null, h("div", { class: "child-node" }, node.child.map(childNode => {
|
|
60
87
|
return this.renderNode(childNode);
|
|
61
88
|
})))) : null));
|
|
62
89
|
}
|
|
63
90
|
else {
|
|
64
|
-
return (h("li", null, h("div", { class: `inline-tree-item element-row ${rowHoverActive}`, onClick: (event) => {
|
|
65
|
-
if (node.
|
|
91
|
+
return (h("li", null, h("div", { class: `inline-tree-item element-row ${options.rowHoverActive} ${options.selectedActive}`, onClick: (event) => {
|
|
92
|
+
if (node.hasHover) {
|
|
66
93
|
event.stopPropagation();
|
|
67
94
|
this.onClickHandler('row', event, node);
|
|
68
95
|
}
|
|
69
|
-
} }, this.htmlcode('treeLeaf', node, checkboxIcon, checkboxColor))));
|
|
96
|
+
} }, this.htmlcode('treeLeaf', node, options.checkboxIcon, options.checkboxColor))));
|
|
70
97
|
}
|
|
71
98
|
}
|
|
72
99
|
htmlcode(type, node, check_box, check_boxColor) {
|
|
73
|
-
const htmlcode = (h("div", { class:
|
|
100
|
+
const htmlcode = (h("div", { class: "inline-tree-item element" }, node.hasCheckbox && (h("tttx-button", { design: "borderless-circle", notext: true, icon: check_box, iconcolor: check_boxColor, class: "padding-icon checkbox", onClick: event => this.handleCheckboxChange(node, event) })), !node.html && node.hasIcon && h("tttx-icon", { icon: node.icon, color: node.iconColor, class: "padding-icon" }), !node.html && h("div", { class: type }, node.title), node.html && h("div", { class: type, innerHTML: purify.sanitize(node.html, domSanitiserOptions) }), (node.menuActive || node.chevronActive) && (h("div", { class: "right-buttons-container" }, node.menuActive && (h("tttx-button", { design: "borderless-circle", notext: true, icon: "more_vert", color: "black", class: "padding-icon menu-button", onClick: (event) => {
|
|
74
101
|
event.stopPropagation();
|
|
75
102
|
this.onClickHandler('menu', event, node);
|
|
76
103
|
} })), node.chevronActive && (h("tttx-icon", { icon: "chevron_right", color: "black", class: "padding-icon chevron-button", onClick: (event) => {
|
|
@@ -88,7 +115,8 @@ const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
88
115
|
static get style() { return tttxTreeViewCss; }
|
|
89
116
|
}, [1, "tttx-tree-view", {
|
|
90
117
|
"data": [1040],
|
|
91
|
-
"treeData": [32]
|
|
118
|
+
"treeData": [32],
|
|
119
|
+
"selectedId": [32]
|
|
92
120
|
}]);
|
|
93
121
|
function defineCustomElement$1() {
|
|
94
122
|
if (typeof customElements === "undefined") {
|
package/dist/esm/loader.js
CHANGED
|
@@ -11,7 +11,7 @@ const patchEsm = () => {
|
|
|
11
11
|
const defineCustomElements = (win, options) => {
|
|
12
12
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
13
13
|
return patchEsm().then(() => {
|
|
14
|
-
return bootstrapLazy([["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-textarea",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
14
|
+
return bootstrapLazy([["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32],"selectedId":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-textarea",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-6a372ea6.js';
|
|
2
|
+
|
|
3
|
+
const tttxPercentageBarCss = ".sc-tttx-percentage-bar-h{display:block}.progress.sc-tttx-percentage-bar{width:100%;background-color:#dbdbdb}.progress.sc-tttx-percentage-bar .bar.sc-tttx-percentage-bar{height:20px}";
|
|
4
|
+
|
|
5
|
+
const TttxPercentageBar = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.percentage = undefined;
|
|
9
|
+
this.thresholds = undefined;
|
|
10
|
+
this.color = '#d5d5d5';
|
|
11
|
+
this.min = '1';
|
|
12
|
+
this.labelid = undefined;
|
|
13
|
+
this._percentage = undefined;
|
|
14
|
+
this._ranges = undefined;
|
|
15
|
+
this._min = undefined;
|
|
16
|
+
}
|
|
17
|
+
componentWillRender() {
|
|
18
|
+
if (typeof this.percentage === 'string') {
|
|
19
|
+
this._percentage = parseInt(this.percentage);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this._percentage = this.percentage;
|
|
23
|
+
}
|
|
24
|
+
let thresholdsArray;
|
|
25
|
+
if (this.thresholds) {
|
|
26
|
+
if (typeof this.thresholds === 'string') {
|
|
27
|
+
thresholdsArray = JSON.parse(this.thresholds);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
thresholdsArray = this.thresholds;
|
|
31
|
+
}
|
|
32
|
+
this._ranges = [{ range: [0], color: thresholdsArray[0].color }];
|
|
33
|
+
for (const [i, thresholdsObj] of thresholdsArray.entries()) {
|
|
34
|
+
this._ranges[this._ranges.length - 1].range.push(thresholdsObj.threshold);
|
|
35
|
+
this._ranges[this._ranges.length - 1].color = thresholdsObj.color;
|
|
36
|
+
if (i < thresholdsArray.length - 1) {
|
|
37
|
+
this._ranges.push({ range: [thresholdsObj.threshold], color: undefined });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
this._min = parseInt(this.min);
|
|
42
|
+
}
|
|
43
|
+
getColour() {
|
|
44
|
+
if (!this._ranges || this._ranges.length === 0) {
|
|
45
|
+
return this.color;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const range = this._ranges.find(r => this._percentage >= r.range[0] && this._percentage <= r.range[1]);
|
|
49
|
+
return range.color;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
getWidth() {
|
|
53
|
+
return Math.min(Math.max(this._percentage, Math.min(this._min, 100)), 100);
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return (h(Host, null, h("div", { class: "progress" }, h("div", { class: "bar", style: { 'background-color': this.getColour(), 'width': `${this.getWidth()}%` }, role: "progressbar", "aria-valuemin": this._min, "aria-valuemax": "100", "aria-valuenow": this._percentage, "aria-labelledby": this.labelid }))));
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
TttxPercentageBar.style = tttxPercentageBarCss;
|
|
60
|
+
|
|
61
|
+
export { TttxPercentageBar as tttx_percentage_bar };
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h } from './index-6a372ea6.js'
|
|
|
2
2
|
import { p as purify, d as domSanitiserOptions } from './domsanitiser.options-68752a19.js';
|
|
3
3
|
import './_commonjsHelpers-9943807e.js';
|
|
4
4
|
|
|
5
|
-
const tttxTreeViewCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.tree-view-element{margin-left:-50px}.inline-tree-item{display:flex;align-items:center}.element{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center;width:100%}.element-row{min-height:36px;font-family:\"Roboto\", serif;font-size:16px;padding:8px 0px;border-bottom:1px solid #d5d5d5}.
|
|
5
|
+
const tttxTreeViewCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.tree-view-element{margin-left:-50px}.inline-tree-item{display:flex;align-items:center}.element{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center;width:100%}.element-row{min-height:36px;font-family:\"Roboto\", serif;font-size:16px;padding:8px 0px;position:relative}.element-row::before{content:\"\";position:absolute;left:-50%;right:-50%;bottom:0;border-bottom:1px solid #d5d5d5}.element-row.rowSelected::before{content:\"\";position:absolute;left:-50%;right:-50%;top:0;bottom:0;background-color:rgba(17, 17, 17, 0.1);z-index:-1}li{list-style-type:none}.toggleNode{padding-right:3px}.padding-icon{padding:6px 6px;height:24px;width:24px;display:flex;align-items:center;justify-content:center}.treeNode{font-weight:500}.treeLeaf{font-weight:400}.right-buttons-container{margin-left:auto;display:flex}.borderless:active{outline-style:none}@media (hover: hover){.element-row.rowHover:hover{cursor:pointer}.element-row.rowHover:hover::before{content:\"\";position:absolute;left:-50%;right:-50%;top:0;bottom:0;background-color:rgba(17, 17, 17, 0.05);opacity:0.5;z-index:-1}}";
|
|
6
6
|
|
|
7
7
|
const TttxTreeView = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -10,11 +10,24 @@ const TttxTreeView = class {
|
|
|
10
10
|
this.clickEvent = createEvent(this, "clickEvent", 7);
|
|
11
11
|
this.data = undefined;
|
|
12
12
|
this.treeData = undefined;
|
|
13
|
+
this.selectedId = undefined;
|
|
13
14
|
}
|
|
14
15
|
onClickHandler(clickName, event, node) {
|
|
15
16
|
event.stopPropagation();
|
|
16
17
|
const returnJsonObject = JSON.stringify(node);
|
|
17
18
|
this.clickEvent.emit({ eventName: clickName, returnJsonObject });
|
|
19
|
+
if (clickName === 'row') {
|
|
20
|
+
this.selectedElement(event, node);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//for testing as SelectedId is a state
|
|
24
|
+
updateSelectedId(newId) {
|
|
25
|
+
this.selectedId = newId;
|
|
26
|
+
}
|
|
27
|
+
selectedElement(event, node) {
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
this.selectedId = node.id;
|
|
30
|
+
this.treeData = [...this.treeData];
|
|
18
31
|
}
|
|
19
32
|
toggleNode(node, event) {
|
|
20
33
|
event.stopPropagation();
|
|
@@ -35,7 +48,14 @@ const TttxTreeView = class {
|
|
|
35
48
|
});
|
|
36
49
|
}
|
|
37
50
|
}
|
|
38
|
-
|
|
51
|
+
updateSelected(node) {
|
|
52
|
+
let selected = false;
|
|
53
|
+
if (node.id === this.selectedId) {
|
|
54
|
+
selected = true;
|
|
55
|
+
}
|
|
56
|
+
return selected;
|
|
57
|
+
}
|
|
58
|
+
treeConfigs(node) {
|
|
39
59
|
let checkboxIcon, checkboxColor;
|
|
40
60
|
if (node.checked) {
|
|
41
61
|
checkboxIcon = 'check_box';
|
|
@@ -45,29 +65,36 @@ const TttxTreeView = class {
|
|
|
45
65
|
checkboxIcon = 'check_box_outline_blank';
|
|
46
66
|
checkboxColor = 'grey';
|
|
47
67
|
}
|
|
48
|
-
const rowHoverActive = node.
|
|
68
|
+
const rowHoverActive = node.hasHover ? 'rowHover' : '';
|
|
49
69
|
const expanderIcon = node.isOpen ? 'arrow_drop_down' : 'arrow_right';
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
const selectedActive = node.selectable && node.selected ? 'rowSelected' : '';
|
|
71
|
+
return { checkboxColor, checkboxIcon, rowHoverActive, expanderIcon, selectedActive };
|
|
72
|
+
}
|
|
73
|
+
renderNode(node) {
|
|
74
|
+
if (node.selectable)
|
|
75
|
+
node.selected = this.updateSelected(node);
|
|
76
|
+
const options = this.treeConfigs(node);
|
|
77
|
+
if (node.child) {
|
|
78
|
+
return (h("li", null, h("div", { class: `inline-tree-item element-row ${options.rowHoverActive} ${options.selectedActive}`, onClick: (event) => {
|
|
79
|
+
if (node.hasHover) {
|
|
53
80
|
event.stopPropagation();
|
|
54
81
|
this.onClickHandler('row', event, node);
|
|
55
82
|
}
|
|
56
|
-
} }, h("tttx-button", { class: "toggleNode", design: "borderless-circle", notext: true, icon: expanderIcon, color: "black", onClick: event => this.toggleNode(node, event) }), this.htmlcode('treeNode', node, checkboxIcon, checkboxColor)), node.isOpen ? (h("ul", null, h("div", { class: "child-node" }, node.child.map(childNode => {
|
|
83
|
+
} }, h("tttx-button", { class: "toggleNode", design: "borderless-circle", notext: true, icon: options.expanderIcon, color: "black", onClick: event => this.toggleNode(node, event) }), this.htmlcode('treeNode', node, options.checkboxIcon, options.checkboxColor)), node.isOpen ? (h("ul", null, h("div", { class: "child-node" }, node.child.map(childNode => {
|
|
57
84
|
return this.renderNode(childNode);
|
|
58
85
|
})))) : null));
|
|
59
86
|
}
|
|
60
87
|
else {
|
|
61
|
-
return (h("li", null, h("div", { class: `inline-tree-item element-row ${rowHoverActive}`, onClick: (event) => {
|
|
62
|
-
if (node.
|
|
88
|
+
return (h("li", null, h("div", { class: `inline-tree-item element-row ${options.rowHoverActive} ${options.selectedActive}`, onClick: (event) => {
|
|
89
|
+
if (node.hasHover) {
|
|
63
90
|
event.stopPropagation();
|
|
64
91
|
this.onClickHandler('row', event, node);
|
|
65
92
|
}
|
|
66
|
-
} }, this.htmlcode('treeLeaf', node, checkboxIcon, checkboxColor))));
|
|
93
|
+
} }, this.htmlcode('treeLeaf', node, options.checkboxIcon, options.checkboxColor))));
|
|
67
94
|
}
|
|
68
95
|
}
|
|
69
96
|
htmlcode(type, node, check_box, check_boxColor) {
|
|
70
|
-
const htmlcode = (h("div", { class:
|
|
97
|
+
const htmlcode = (h("div", { class: "inline-tree-item element" }, node.hasCheckbox && (h("tttx-button", { design: "borderless-circle", notext: true, icon: check_box, iconcolor: check_boxColor, class: "padding-icon checkbox", onClick: event => this.handleCheckboxChange(node, event) })), !node.html && node.hasIcon && h("tttx-icon", { icon: node.icon, color: node.iconColor, class: "padding-icon" }), !node.html && h("div", { class: type }, node.title), node.html && h("div", { class: type, innerHTML: purify.sanitize(node.html, domSanitiserOptions) }), (node.menuActive || node.chevronActive) && (h("div", { class: "right-buttons-container" }, node.menuActive && (h("tttx-button", { design: "borderless-circle", notext: true, icon: "more_vert", color: "black", class: "padding-icon menu-button", onClick: (event) => {
|
|
71
98
|
event.stopPropagation();
|
|
72
99
|
this.onClickHandler('menu', event, node);
|
|
73
100
|
} })), node.chevronActive && (h("tttx-icon", { icon: "chevron_right", color: "black", class: "padding-icon chevron-button", onClick: (event) => {
|
package/dist/esm/tttx.js
CHANGED
|
@@ -14,5 +14,5 @@ const patchBrowser = () => {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
patchBrowser().then(options => {
|
|
17
|
-
return bootstrapLazy([["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-textarea",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
17
|
+
return bootstrapLazy([["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32],"selectedId":[32]}]]],["tttx-filter",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]]]],["tttx-list",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-textarea",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-toolbar",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
18
18
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s,H as i}from"./p-3f1b6013.js";const r=class{constructor(s){t(this,s),this.percentage=void 0,this.thresholds=void 0,this.color="#d5d5d5",this.min="1",this.labelid=void 0,this._percentage=void 0,this._ranges=void 0,this._min=void 0}componentWillRender(){let t;if(this._percentage="string"==typeof this.percentage?parseInt(this.percentage):this.percentage,this.thresholds){t="string"==typeof this.thresholds?JSON.parse(this.thresholds):this.thresholds,this._ranges=[{range:[0],color:t[0].color}];for(const[s,i]of t.entries())this._ranges[this._ranges.length-1].range.push(i.threshold),this._ranges[this._ranges.length-1].color=i.color,s<t.length-1&&this._ranges.push({range:[i.threshold],color:void 0})}this._min=parseInt(this.min)}getColour(){return this._ranges&&0!==this._ranges.length?this._ranges.find((t=>this._percentage>=t.range[0]&&this._percentage<=t.range[1])).color:this.color}getWidth(){return Math.min(Math.max(this._percentage,Math.min(this._min,100)),100)}render(){return s(i,null,s("div",{class:"progress"},s("div",{class:"bar",style:{"background-color":this.getColour(),width:`${this.getWidth()}%`},role:"progressbar","aria-valuemin":this._min,"aria-valuemax":"100","aria-valuenow":this._percentage,"aria-labelledby":this.labelid})))}};r.style=".sc-tttx-percentage-bar-h{display:block}.progress.sc-tttx-percentage-bar{width:100%;background-color:#dbdbdb}.progress.sc-tttx-percentage-bar .bar.sc-tttx-percentage-bar{height:20px}";export{r as tttx_percentage_bar}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as o}from"./p-3f1b6013.js";import{p as i,d as n}from"./p-88ee2406.js";import"./p-112455b1.js";const r=class{constructor(o){e(this,o),this.clickEvent=t(this,"clickEvent",7),this.data=void 0,this.treeData=void 0,this.selectedId=void 0}onClickHandler(e,t,o){t.stopPropagation();const i=JSON.stringify(o);this.clickEvent.emit({eventName:e,returnJsonObject:i}),"row"===e&&this.selectedElement(t,o)}updateSelectedId(e){this.selectedId=e}selectedElement(e,t){e.stopPropagation(),this.selectedId=t.id,this.treeData=[...this.treeData]}toggleNode(e,t){t.stopPropagation(),e.isOpen=!e.isOpen,this.treeData=[...this.treeData]}handleCheckboxChange(e,t){t.stopPropagation(),e.checked=!e.checked,this.updateChildrenCheckStatus(e),this.treeData=[...this.treeData]}updateChildrenCheckStatus(e){e.child&&e.child.forEach((t=>{t.checked=e.checked,this.updateChildrenCheckStatus(t)}))}updateSelected(e){let t=!1;return e.id===this.selectedId&&(t=!0),t}treeConfigs(e){let t,o;return e.checked?(t="check_box",o="blue"):(t="check_box_outline_blank",o="grey"),{checkboxColor:o,checkboxIcon:t,rowHoverActive:e.hasHover?"rowHover":"",expanderIcon:e.isOpen?"arrow_drop_down":"arrow_right",selectedActive:e.selectable&&e.selected?"rowSelected":""}}renderNode(e){e.selectable&&(e.selected=this.updateSelected(e));const t=this.treeConfigs(e);return e.child?o("li",null,o("div",{class:`inline-tree-item element-row ${t.rowHoverActive} ${t.selectedActive}`,onClick:t=>{e.hasHover&&(t.stopPropagation(),this.onClickHandler("row",t,e))}},o("tttx-button",{class:"toggleNode",design:"borderless-circle",notext:!0,icon:t.expanderIcon,color:"black",onClick:t=>this.toggleNode(e,t)}),this.htmlcode("treeNode",e,t.checkboxIcon,t.checkboxColor)),e.isOpen?o("ul",null,o("div",{class:"child-node"},e.child.map((e=>this.renderNode(e))))):null):o("li",null,o("div",{class:`inline-tree-item element-row ${t.rowHoverActive} ${t.selectedActive}`,onClick:t=>{e.hasHover&&(t.stopPropagation(),this.onClickHandler("row",t,e))}},this.htmlcode("treeLeaf",e,t.checkboxIcon,t.checkboxColor)))}htmlcode(e,t,r,s){return o("div",{class:"inline-tree-item element"},t.hasCheckbox&&o("tttx-button",{design:"borderless-circle",notext:!0,icon:r,iconcolor:s,class:"padding-icon checkbox",onClick:e=>this.handleCheckboxChange(t,e)}),!t.html&&t.hasIcon&&o("tttx-icon",{icon:t.icon,color:t.iconColor,class:"padding-icon"}),!t.html&&o("div",{class:e},t.title),t.html&&o("div",{class:e,innerHTML:i.sanitize(t.html,n)}),(t.menuActive||t.chevronActive)&&o("div",{class:"right-buttons-container"},t.menuActive&&o("tttx-button",{design:"borderless-circle",notext:!0,icon:"more_vert",color:"black",class:"padding-icon menu-button",onClick:e=>{e.stopPropagation(),this.onClickHandler("menu",e,t)}}),t.chevronActive&&o("tttx-icon",{icon:"chevron_right",color:"black",class:"padding-icon chevron-button",onClick:e=>{e.stopPropagation(),this.onClickHandler("chevron",e,t)}})))}render(){if(this.data)return this.treeData="string"==typeof this.data?JSON.parse(this.data):this.data,o("div",{class:"tree-view-element"},o("ul",null,this.treeData.map((e=>this.renderNode(e)))))}};r.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}.tree-view-element{margin-left:-50px}.inline-tree-item{display:flex;align-items:center}.element{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center;width:100%}.element-row{min-height:36px;font-family:"Roboto", serif;font-size:16px;padding:8px 0px;position:relative}.element-row::before{content:"";position:absolute;left:-50%;right:-50%;bottom:0;border-bottom:1px solid #d5d5d5}.element-row.rowSelected::before{content:"";position:absolute;left:-50%;right:-50%;top:0;bottom:0;background-color:rgba(17, 17, 17, 0.1);z-index:-1}li{list-style-type:none}.toggleNode{padding-right:3px}.padding-icon{padding:6px 6px;height:24px;width:24px;display:flex;align-items:center;justify-content:center}.treeNode{font-weight:500}.treeLeaf{font-weight:400}.right-buttons-container{margin-left:auto;display:flex}.borderless:active{outline-style:none}@media (hover: hover){.element-row.rowHover:hover{cursor:pointer}.element-row.rowHover:hover::before{content:"";position:absolute;left:-50%;right:-50%;top:0;bottom:0;background-color:rgba(17, 17, 17, 0.05);opacity:0.5;z-index:-1}}';export{r as tttx_tree_view}
|