xv-webcomponents 0.1.26 → 0.1.28
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/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/index-782b9733.js +1535 -0
- package/dist/cjs/index-782b9733.js.map +1 -0
- package/dist/cjs/index.cjs.js +11 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/utils-aa46f72a.js +50 -0
- package/dist/cjs/utils-aa46f72a.js.map +1 -0
- package/dist/cjs/xv-accordion-v2_27.cjs.entry.js +1358 -0
- package/dist/cjs/xv-accordion-v2_27.cjs.entry.js.map +1 -0
- package/dist/cjs/xv-breadcrumbs-v2.cjs.entry.js +22 -0
- package/dist/cjs/xv-breadcrumbs-v2.cjs.entry.js.map +1 -0
- package/dist/cjs/xv-webcomponents.cjs.js +27 -0
- package/dist/cjs/xv-webcomponents.cjs.js.map +1 -0
- package/dist/collection/assets/fonts/fontawesome5/fa-brands-400.svg +3717 -0
- package/dist/collection/assets/fonts/fontawesome5/fa-duotone-900.svg +15326 -0
- package/dist/collection/assets/fonts/fontawesome5/fa-light-300.svg +12420 -0
- package/dist/collection/assets/fonts/fontawesome5/fa-regular-400.svg +11323 -0
- package/dist/collection/assets/fonts/fontawesome5/fa-solid-900.svg +9653 -0
- package/dist/collection/collection-manifest.json +39 -0
- package/dist/collection/components/xv-accordion/xv-accordion.css +3 -0
- package/dist/collection/components/xv-accordion/xv-accordion.js +163 -0
- package/dist/collection/components/xv-accordion/xv-accordion.js.map +1 -0
- package/dist/collection/components/xv-accordion-item/xv-accordion-item.css +68 -0
- package/dist/collection/components/xv-accordion-item/xv-accordion-item.js +132 -0
- package/dist/collection/components/xv-accordion-item/xv-accordion-item.js.map +1 -0
- package/dist/collection/components/xv-breadcrumbs/xv-breadcrumbs.css +3 -0
- package/dist/collection/components/xv-breadcrumbs/xv-breadcrumbs.js +19 -0
- package/dist/collection/components/xv-breadcrumbs/xv-breadcrumbs.js.map +1 -0
- package/dist/collection/components/xv-button/xv-button-v2.css +154 -0
- package/dist/collection/components/xv-button/xv-button.js +138 -0
- package/dist/collection/components/xv-button/xv-button.js.map +1 -0
- package/dist/collection/components/xv-card/xv-card.css +63 -0
- package/dist/collection/components/xv-card/xv-card.js +122 -0
- package/dist/collection/components/xv-card/xv-card.js.map +1 -0
- package/dist/collection/components/xv-checkbox/xv-checkbox.css +132 -0
- package/dist/collection/components/xv-checkbox/xv-checkbox.js +402 -0
- package/dist/collection/components/xv-checkbox/xv-checkbox.js.map +1 -0
- package/dist/collection/components/xv-dropdown/_vars.js +2 -0
- package/dist/collection/components/xv-dropdown/_vars.js.map +1 -0
- package/dist/collection/components/xv-dropdown/xv-dropdown-item/xv-dropdown-item.css +14 -0
- package/dist/collection/components/xv-dropdown/xv-dropdown-item/xv-dropdown-item.js +151 -0
- package/dist/collection/components/xv-dropdown/xv-dropdown-item/xv-dropdown-item.js.map +1 -0
- package/dist/collection/components/xv-dropdown/xv-dropdown.css +227 -0
- package/dist/collection/components/xv-dropdown/xv-dropdown.js +340 -0
- package/dist/collection/components/xv-dropdown/xv-dropdown.js.map +1 -0
- package/dist/collection/components/xv-footer/xv-footer.css +230 -0
- package/dist/collection/components/xv-footer/xv-footer.js +37 -0
- package/dist/collection/components/xv-footer/xv-footer.js.map +1 -0
- package/dist/collection/components/xv-header/xv-header.css +22587 -0
- package/dist/collection/components/xv-header/xv-header.js +46 -0
- package/dist/collection/components/xv-header/xv-header.js.map +1 -0
- package/dist/collection/components/xv-link/xv-link.css +61 -0
- package/dist/collection/components/xv-link/xv-link.js +132 -0
- package/dist/collection/components/xv-link/xv-link.js.map +1 -0
- package/dist/collection/components/xv-loader/xv-loader.css +65 -0
- package/dist/collection/components/xv-loader/xv-loader.js +106 -0
- package/dist/collection/components/xv-loader/xv-loader.js.map +1 -0
- package/dist/collection/components/xv-modal/xv-modal.css +98 -0
- package/dist/collection/components/xv-modal/xv-modal.js +202 -0
- package/dist/collection/components/xv-modal/xv-modal.js.map +1 -0
- package/dist/collection/components/xv-notification/_vars.js +8 -0
- package/dist/collection/components/xv-notification/_vars.js.map +1 -0
- package/dist/collection/components/xv-notification/xv-notification.css +112 -0
- package/dist/collection/components/xv-notification/xv-notification.js +118 -0
- package/dist/collection/components/xv-notification/xv-notification.js.map +1 -0
- package/dist/collection/components/xv-overflow-menu/_vars.js +6 -0
- package/dist/collection/components/xv-overflow-menu/_vars.js.map +1 -0
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu-item/xv-overflow-menu-item.css +45 -0
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu-item/xv-overflow-menu-item.js +137 -0
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu-item/xv-overflow-menu-item.js.map +1 -0
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu.css +102 -0
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu.js +202 -0
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu.js.map +1 -0
- package/dist/collection/components/xv-progress-indicator/_vars.js +12 -0
- package/dist/collection/components/xv-progress-indicator/_vars.js.map +1 -0
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator-item/xv-progress-indicator-item.css +96 -0
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator-item/xv-progress-indicator-item.js +54 -0
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator-item/xv-progress-indicator-item.js.map +1 -0
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.css +45 -0
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.js +157 -0
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.js.map +1 -0
- package/dist/collection/components/xv-table/defs.js +28 -0
- package/dist/collection/components/xv-table/defs.js.map +1 -0
- package/dist/collection/components/xv-table/xv-table-col/xv-table-col.css +13 -0
- package/dist/collection/components/xv-table/xv-table-col/xv-table-col.js +111 -0
- package/dist/collection/components/xv-table/xv-table-col/xv-table-col.js.map +1 -0
- package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.css +116 -0
- package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.js +199 -0
- package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.js.map +1 -0
- package/dist/collection/components/xv-table/xv-table-header-row/xv-table-header-row.css +80 -0
- package/dist/collection/components/xv-table/xv-table-header-row/xv-table-header-row.js +172 -0
- package/dist/collection/components/xv-table/xv-table-header-row/xv-table-header-row.js.map +1 -0
- package/dist/collection/components/xv-table/xv-table-row/xv-table-row.css +46 -0
- package/dist/collection/components/xv-table/xv-table-row/xv-table-row.js +275 -0
- package/dist/collection/components/xv-table/xv-table-row/xv-table-row.js.map +1 -0
- package/dist/collection/components/xv-table/xv-table-toolbar/xv-table-toolbar.css +47 -0
- package/dist/collection/components/xv-table/xv-table-toolbar/xv-table-toolbar.js +78 -0
- package/dist/collection/components/xv-table/xv-table-toolbar/xv-table-toolbar.js.map +1 -0
- package/dist/collection/components/xv-table/xv-table.css +165 -0
- package/dist/collection/components/xv-table/xv-table.js +284 -0
- package/dist/collection/components/xv-table/xv-table.js.map +1 -0
- package/dist/collection/components/xv-tabs/_vars.js +11 -0
- package/dist/collection/components/xv-tabs/_vars.js.map +1 -0
- package/dist/collection/components/xv-tabs/xv-tab/xv-tab.css +3 -0
- package/dist/collection/components/xv-tabs/xv-tab/xv-tab.js +65 -0
- package/dist/collection/components/xv-tabs/xv-tab/xv-tab.js.map +1 -0
- package/dist/collection/components/xv-tabs/xv-tabs.css +79 -0
- package/dist/collection/components/xv-tabs/xv-tabs.js +158 -0
- package/dist/collection/components/xv-tabs/xv-tabs.js.map +1 -0
- package/dist/collection/components/xv-tag/xv-tag.css +97 -0
- package/dist/collection/components/xv-tag/xv-tag.js +158 -0
- package/dist/collection/components/xv-tag/xv-tag.js.map +1 -0
- package/dist/collection/components/xv-tooltip/xv-tooltip.css +154 -0
- package/dist/collection/components/xv-tooltip/xv-tooltip.js +70 -0
- package/dist/collection/components/xv-tooltip/xv-tooltip.js.map +1 -0
- package/dist/collection/index.js +11 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/scss/xv/images/xv-sprite.svg +1 -0
- package/dist/collection/scss/xv/sprite/images/xv-sprite.svg +1 -0
- package/dist/collection/types/enum.js +9 -0
- package/dist/collection/types/enum.js.map +1 -0
- package/dist/collection/utils/utils.js +46 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/esm/app-globals-0f993ce5.js +5 -0
- package/dist/esm/app-globals-0f993ce5.js.map +1 -0
- package/dist/esm/index-83ab73b7.js +1506 -0
- package/dist/esm/index-83ab73b7.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/utils-0d1c18d5.js +44 -0
- package/dist/esm/utils-0d1c18d5.js.map +1 -0
- package/dist/esm/xv-accordion-v2_27.entry.js +1328 -0
- package/dist/esm/xv-accordion-v2_27.entry.js.map +1 -0
- package/dist/esm/xv-breadcrumbs-v2.entry.js +18 -0
- package/dist/esm/xv-breadcrumbs-v2.entry.js.map +1 -0
- package/dist/esm/xv-webcomponents.js +22 -0
- package/dist/esm/xv-webcomponents.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/xv-accordion/xv-accordion.d.ts +20 -0
- package/dist/types/components/xv-accordion-item/xv-accordion-item.d.ts +15 -0
- package/dist/types/components/xv-breadcrumbs/xv-breadcrumbs.d.ts +3 -0
- package/dist/types/components/xv-button/xv-button.d.ts +16 -0
- package/dist/types/components/xv-card/xv-card.d.ts +8 -0
- package/dist/types/components/xv-checkbox/xv-checkbox.d.ts +74 -0
- package/dist/types/components/xv-dropdown/_vars.d.ts +5 -0
- package/dist/types/components/xv-dropdown/xv-dropdown-item/xv-dropdown-item.d.ts +17 -0
- package/dist/types/components/xv-dropdown/xv-dropdown.d.ts +28 -0
- package/dist/types/components/xv-footer/xv-footer.d.ts +6 -0
- package/dist/types/components/xv-header/xv-header.d.ts +6 -0
- package/dist/types/components/xv-link/xv-link.d.ts +9 -0
- package/dist/types/components/xv-loader/xv-loader.d.ts +16 -0
- package/dist/types/components/xv-modal/xv-modal.d.ts +26 -0
- package/dist/types/components/xv-notification/_vars.d.ts +6 -0
- package/dist/types/components/xv-notification/xv-notification.d.ts +11 -0
- package/dist/types/components/xv-overflow-menu/_vars.d.ts +8 -0
- package/dist/types/components/xv-overflow-menu/xv-overflow-menu-item/xv-overflow-menu-item.d.ts +10 -0
- package/dist/types/components/xv-overflow-menu/xv-overflow-menu.d.ts +21 -0
- package/dist/types/components/xv-progress-indicator/_vars.d.ts +9 -0
- package/dist/types/components/xv-progress-indicator/xv-progress-indicator-item/xv-progress-indicator-item.d.ts +6 -0
- package/dist/types/components/xv-progress-indicator/xv-progress-indicator.d.ts +25 -0
- package/dist/types/components/xv-table/defs.d.ts +38 -0
- package/dist/types/components/xv-table/xv-table-col/xv-table-col.d.ts +9 -0
- package/dist/types/components/xv-table/xv-table-expand/xv-table-expand.d.ts +24 -0
- package/dist/types/components/xv-table/xv-table-header-row/xv-table-header-row.d.ts +28 -0
- package/dist/types/components/xv-table/xv-table-row/xv-table-row.d.ts +52 -0
- package/dist/types/components/xv-table/xv-table-toolbar/xv-table-toolbar.d.ts +6 -0
- package/dist/types/components/xv-table/xv-table.d.ts +37 -0
- package/dist/types/components/xv-tabs/_vars.d.ts +7 -0
- package/dist/types/components/xv-tabs/xv-tab/xv-tab.d.ts +5 -0
- package/dist/types/components/xv-tabs/xv-tabs.d.ts +36 -0
- package/dist/types/components/xv-tag/xv-tag.d.ts +11 -0
- package/dist/types/components/xv-tooltip/xv-tooltip.d.ts +11 -0
- package/dist/types/components.d.ts +1217 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/dist/types/types/enum.d.ts +7 -0
- package/dist/types/utils/utils.d.ts +17 -0
- package/dist/xv-webcomponents/index.esm.js +2 -0
- package/dist/xv-webcomponents/index.esm.js.map +1 -0
- package/dist/xv-webcomponents/p-07dfeba3.entry.js +2 -0
- package/dist/xv-webcomponents/p-07dfeba3.entry.js.map +1 -0
- package/dist/xv-webcomponents/p-39bf1511.js +2 -0
- package/dist/xv-webcomponents/p-39bf1511.js.map +1 -0
- package/dist/xv-webcomponents/p-5f18d718.entry.js +2 -0
- package/dist/xv-webcomponents/p-5f18d718.entry.js.map +1 -0
- package/dist/xv-webcomponents/p-840929c5.js +3 -0
- package/dist/xv-webcomponents/p-840929c5.js.map +1 -0
- package/dist/xv-webcomponents/p-e1255160.js +2 -0
- package/dist/xv-webcomponents/p-e1255160.js.map +1 -0
- package/dist/xv-webcomponents/xv-webcomponents.esm.js +2 -0
- package/dist/xv-webcomponents/xv-webcomponents.esm.js.map +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { PROGRESS_ITEM_STATUS, PROGRESS_VARIANTS } from "./_vars";
|
|
3
|
+
import { SIZE_VAR } from "../../types/enum";
|
|
4
|
+
import { forEach } from "../../utils/utils";
|
|
5
|
+
export class XvProgressIndicator {
|
|
6
|
+
constructor() {
|
|
7
|
+
/**
|
|
8
|
+
* Current progress
|
|
9
|
+
* from 0 to 100
|
|
10
|
+
*/
|
|
11
|
+
this.progress = 0;
|
|
12
|
+
/**
|
|
13
|
+
* Progress variant
|
|
14
|
+
* enum PROGRESS_VARIANTS
|
|
15
|
+
* possible option `horizontal`
|
|
16
|
+
*/
|
|
17
|
+
this.variant = PROGRESS_VARIANTS.DEFAULT;
|
|
18
|
+
/**
|
|
19
|
+
* Size of progress
|
|
20
|
+
* enum SIZE_VAR
|
|
21
|
+
* possible options `XS | SM | MD | LG | XL`
|
|
22
|
+
*/
|
|
23
|
+
this.size = SIZE_VAR.MD;
|
|
24
|
+
}
|
|
25
|
+
// Update 'xv-progress-indicator-item' done status
|
|
26
|
+
updateChildItems() {
|
|
27
|
+
const items = this.el.children;
|
|
28
|
+
const itemsCount = this.el.childElementCount;
|
|
29
|
+
const progressPerItem = 100 / itemsCount;
|
|
30
|
+
if (!items.length || !itemsCount)
|
|
31
|
+
return;
|
|
32
|
+
forEach(items, (item, index) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const itemProgressStart = index * progressPerItem;
|
|
35
|
+
let status;
|
|
36
|
+
const localProgress = Math.min(Math.max((this.progress - itemProgressStart) / progressPerItem, 0), 1) * 100;
|
|
37
|
+
if (localProgress >= 100) {
|
|
38
|
+
status = PROGRESS_ITEM_STATUS.DONE;
|
|
39
|
+
}
|
|
40
|
+
else if (localProgress > 0) {
|
|
41
|
+
status = PROGRESS_ITEM_STATUS.IN_PROGRESS;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
status = PROGRESS_ITEM_STATUS.NO_STARTED;
|
|
45
|
+
}
|
|
46
|
+
// Set item current status
|
|
47
|
+
item.setAttribute('status', status);
|
|
48
|
+
// Update progress line
|
|
49
|
+
const line = (_a = item === null || item === void 0 ? void 0 : item.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.line');
|
|
50
|
+
if (line)
|
|
51
|
+
line.style.width = `${localProgress}%`;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Load initial done status
|
|
55
|
+
componentDidLoad() {
|
|
56
|
+
this.updateChildItems();
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
return (h(Host, { key: 'be4d8e9691b1421a5e6c50f9737b0f0e72182bdc', variant: this.variant, size: this.size, class: { 'xv-progress-indicator': true } }, h("slot", { key: '59631a2651175f2ccd94c2120df900160812b2fb' })));
|
|
60
|
+
}
|
|
61
|
+
static get is() { return "xv-progress-indicator-v2"; }
|
|
62
|
+
static get encapsulation() { return "shadow"; }
|
|
63
|
+
static get originalStyleUrls() {
|
|
64
|
+
return {
|
|
65
|
+
"$": ["xv-progress-indicator.scss"]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
static get styleUrls() {
|
|
69
|
+
return {
|
|
70
|
+
"$": ["xv-progress-indicator.css"]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
static get properties() {
|
|
74
|
+
return {
|
|
75
|
+
"progress": {
|
|
76
|
+
"type": "number",
|
|
77
|
+
"mutable": false,
|
|
78
|
+
"complexType": {
|
|
79
|
+
"original": "number",
|
|
80
|
+
"resolved": "number",
|
|
81
|
+
"references": {}
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"optional": false,
|
|
85
|
+
"docs": {
|
|
86
|
+
"tags": [],
|
|
87
|
+
"text": "Current progress\nfrom 0 to 100"
|
|
88
|
+
},
|
|
89
|
+
"getter": false,
|
|
90
|
+
"setter": false,
|
|
91
|
+
"attribute": "progress",
|
|
92
|
+
"reflect": false,
|
|
93
|
+
"defaultValue": "0"
|
|
94
|
+
},
|
|
95
|
+
"variant": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "PROGRESS_VARIANTS",
|
|
100
|
+
"resolved": "PROGRESS_VARIANTS.DEFAULT | PROGRESS_VARIANTS.HORIZONTAL",
|
|
101
|
+
"references": {
|
|
102
|
+
"PROGRESS_VARIANTS": {
|
|
103
|
+
"location": "import",
|
|
104
|
+
"path": "./_vars",
|
|
105
|
+
"id": "src/components/xv-progress-indicator/_vars.ts::PROGRESS_VARIANTS"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Progress variant\nenum PROGRESS_VARIANTS\npossible option `horizontal`"
|
|
114
|
+
},
|
|
115
|
+
"getter": false,
|
|
116
|
+
"setter": false,
|
|
117
|
+
"attribute": "variant",
|
|
118
|
+
"reflect": false,
|
|
119
|
+
"defaultValue": "PROGRESS_VARIANTS.DEFAULT"
|
|
120
|
+
},
|
|
121
|
+
"size": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"mutable": false,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "SIZE_VAR",
|
|
126
|
+
"resolved": "SIZE_VAR.LG | SIZE_VAR.MD | SIZE_VAR.SM | SIZE_VAR.XL | SIZE_VAR.XS",
|
|
127
|
+
"references": {
|
|
128
|
+
"SIZE_VAR": {
|
|
129
|
+
"location": "import",
|
|
130
|
+
"path": "../../types/enum",
|
|
131
|
+
"id": "src/types/enum.ts::SIZE_VAR"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": "Size of progress\nenum SIZE_VAR\npossible options `XS | SM | MD | LG | XL`"
|
|
140
|
+
},
|
|
141
|
+
"getter": false,
|
|
142
|
+
"setter": false,
|
|
143
|
+
"attribute": "size",
|
|
144
|
+
"reflect": false,
|
|
145
|
+
"defaultValue": "SIZE_VAR.MD"
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
static get elementRef() { return "el"; }
|
|
150
|
+
static get watchers() {
|
|
151
|
+
return [{
|
|
152
|
+
"propName": "progress",
|
|
153
|
+
"methodName": "updateChildItems"
|
|
154
|
+
}];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=xv-progress-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xv-progress-indicator.js","sourceRoot":"","s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,CAAC;iBAAM,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,GAAG,oBAAoB,CAAC,WAAW,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,oBAAoB,CAAC,UAAU,CAAC;YAC3C,CAAC;YAED,0BAA0B;YACzB,IAAoB,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAErD,uBAAuB;YACvB,MAAM,IAAI,GAAG,MAAC,IAAoB,aAApB,IAAI,uBAAJ,IAAI,CAAkB,UAAU,0CAAE,aAAa,CAAC,OAAO,CAAgB,CAAC;YACtF,IAAI,IAAI;gBAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,aAAa,GAAG,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,2BAA2B;IAC3B,gBAAgB;QACd,IAAI,CAAC,gBAAgB,EAAE,CAAA;IACzB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE;YACpF,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, Watch, Element } from '@stencil/core';\nimport { PROGRESS_ITEM_STATUS, PROGRESS_VARIANTS } from './_vars';\nimport { SIZE_VAR } from '../../types/enum';\nimport { forEach } from '../../utils/utils';\n\n@Component({\n tag: 'xv-progress-indicator-v2',\n styleUrl: 'xv-progress-indicator.scss',\n shadow: true,\n})\nexport class XvProgressIndicator {\n @Element() el: HTMLElement;\n /**\n * Current progress\n * from 0 to 100\n */\n @Prop() progress: number = 0;\n /**\n * Progress variant\n * enum PROGRESS_VARIANTS\n * possible option `horizontal`\n */\n @Prop() variant: PROGRESS_VARIANTS = PROGRESS_VARIANTS.DEFAULT;\n /**\n * Size of progress\n * enum SIZE_VAR\n * possible options `XS | SM | MD | LG | XL`\n */\n @Prop() size: SIZE_VAR = SIZE_VAR.MD;\n\n // Update 'xv-progress-indicator-item' done status\n @Watch('progress')\n updateChildItems() {\n const items = this.el.children;\n const itemsCount = this.el.childElementCount;\n const progressPerItem = 100 / itemsCount;\n\n if (!items.length || !itemsCount) return;\n\n forEach(items, (item, index) => {\n const itemProgressStart = index * progressPerItem;\n let status: PROGRESS_ITEM_STATUS;\n const localProgress = Math.min(\n Math.max((this.progress - itemProgressStart) / progressPerItem, 0), 1\n ) * 100;\n\n if (localProgress >= 100) {\n status = PROGRESS_ITEM_STATUS.DONE;\n } else if (localProgress > 0) {\n status = PROGRESS_ITEM_STATUS.IN_PROGRESS;\n } else {\n status = PROGRESS_ITEM_STATUS.NO_STARTED;\n }\n\n // Set item current status\n (item as HTMLElement).setAttribute('status', status);\n\n // Update progress line\n const line = (item as HTMLElement)?.shadowRoot?.querySelector('.line') as HTMLElement;\n if (line) line.style.width = `${localProgress}%`;\n });\n }\n\n // Load initial done status\n componentDidLoad() {\n this.updateChildItems()\n }\n\n render() {\n return (\n <Host variant={this.variant} size={this.size} class={{ 'xv-progress-indicator': true }}>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export var TABLE_COLOR_SCHEMA;
|
|
2
|
+
(function (TABLE_COLOR_SCHEMA) {
|
|
3
|
+
TABLE_COLOR_SCHEMA["DEF"] = "";
|
|
4
|
+
TABLE_COLOR_SCHEMA["ZEBRA"] = "zebra";
|
|
5
|
+
})(TABLE_COLOR_SCHEMA || (TABLE_COLOR_SCHEMA = {}));
|
|
6
|
+
export var TABLE_SIZE;
|
|
7
|
+
(function (TABLE_SIZE) {
|
|
8
|
+
TABLE_SIZE["EXTRA_SMALL"] = "xs";
|
|
9
|
+
TABLE_SIZE["SMALL"] = "sm";
|
|
10
|
+
TABLE_SIZE["MEDIUM"] = "md";
|
|
11
|
+
TABLE_SIZE["LARGE"] = "lg";
|
|
12
|
+
TABLE_SIZE["EXTRA_LARGE"] = "xl";
|
|
13
|
+
})(TABLE_SIZE || (TABLE_SIZE = {}));
|
|
14
|
+
export var TABLE_TAG;
|
|
15
|
+
(function (TABLE_TAG) {
|
|
16
|
+
TABLE_TAG["TABLE"] = "XV-TABLE-V2";
|
|
17
|
+
TABLE_TAG["EXPAND"] = "XV-TABLE-V2-EXPAND";
|
|
18
|
+
TABLE_TAG["ROW"] = "XV-TABLE-V2-ROW";
|
|
19
|
+
TABLE_TAG["HEADER"] = "XV-TABLE-V2-HEADER-ROW";
|
|
20
|
+
TABLE_TAG["TOOLBAR"] = "XV-TABLE-V2-TOOLBAR";
|
|
21
|
+
})(TABLE_TAG || (TABLE_TAG = {}));
|
|
22
|
+
export var SORT_DIR;
|
|
23
|
+
(function (SORT_DIR) {
|
|
24
|
+
SORT_DIR["ASC"] = "asc";
|
|
25
|
+
SORT_DIR["DESC"] = "desc";
|
|
26
|
+
SORT_DIR["NONE"] = "none";
|
|
27
|
+
})(SORT_DIR || (SORT_DIR = {}));
|
|
28
|
+
//# sourceMappingURL=defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defs.js","sourceRoot":"","sources":["../../../src/components/xv-table/defs.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,8BAAQ,CAAA;IACR,qCAAe,CAAA;AACjB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,gCAAkB,CAAA;IAClB,0BAAY,CAAA;IACZ,2BAAa,CAAA;IACb,0BAAY,CAAA;IACZ,gCAAkB,CAAA;AACpB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAED,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,kCAAqB,CAAA;IACrB,0CAA6B,CAAA;IAC7B,oCAAuB,CAAA;IACvB,8CAAiC,CAAA;IACjC,4CAA+B,CAAA;AACjC,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB;AAED,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,yBAAa,CAAA;AACf,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB","sourcesContent":["export enum TABLE_COLOR_SCHEMA {\n DEF = '',\n ZEBRA = 'zebra',\n}\n\nexport enum TABLE_SIZE {\n EXTRA_SMALL = 'xs',\n SMALL = 'sm',\n MEDIUM = 'md',\n LARGE = 'lg',\n EXTRA_LARGE = 'xl',\n}\n\nexport enum TABLE_TAG {\n TABLE = 'XV-TABLE-V2',\n EXPAND = 'XV-TABLE-V2-EXPAND',\n ROW = 'XV-TABLE-V2-ROW',\n HEADER = 'XV-TABLE-V2-HEADER-ROW',\n TOOLBAR = 'XV-TABLE-V2-TOOLBAR'\n}\n\nexport enum SORT_DIR {\n ASC = 'asc',\n DESC = 'desc',\n NONE = 'none'\n}\n\nexport type TableSelectionEventData = {\n name: string;\n checked: boolean;\n value?: string;\n group?: {\n isMainRow?: boolean;\n id: string;\n data?: TableSelectionEventData[];\n };\n};\n\nexport type TableSelectionEvent = CustomEvent<TableSelectionEventData>;\n\nexport interface TableSortData {\n dir: SORT_DIR;\n name: string;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
color: var(--text-primary, #333);
|
|
3
|
+
font-family: var(--ff-body, Tahoma);
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
padding-left: var(--xv-table-padding, 16px);
|
|
6
|
+
padding-right: var(--xv-table-padding, 16px);
|
|
7
|
+
letter-spacing: 0.16px;
|
|
8
|
+
text-overflow: ellipsis;
|
|
9
|
+
align-content: center;
|
|
10
|
+
max-height: 32px;
|
|
11
|
+
height: 32px;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { SORT_DIR } from "../defs";
|
|
3
|
+
export class XvTableCol {
|
|
4
|
+
handleClick() {
|
|
5
|
+
if (this.sort === undefined)
|
|
6
|
+
return;
|
|
7
|
+
if (this.sort === '')
|
|
8
|
+
this.sort = SORT_DIR.NONE;
|
|
9
|
+
this.sort = this.sort === SORT_DIR.NONE ?
|
|
10
|
+
SORT_DIR.ASC : this.sort === SORT_DIR.ASC ?
|
|
11
|
+
SORT_DIR.DESC : SORT_DIR.NONE;
|
|
12
|
+
this.sortColChange.emit({ dir: this.sort, name: this.sortName });
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return (h(Host, { key: '9b1f74330fbdf33ee631f897b2bec11972ef6323', role: "cell", class: "xv-table-col", sort: this.sort }, h("slot", { key: '80960f0602ed615dceb0aa1f484319bfffc00887' })));
|
|
16
|
+
}
|
|
17
|
+
static get is() { return "xv-table-v2-col"; }
|
|
18
|
+
static get encapsulation() { return "shadow"; }
|
|
19
|
+
static get originalStyleUrls() {
|
|
20
|
+
return {
|
|
21
|
+
"$": ["xv-table-col.scss"]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
static get styleUrls() {
|
|
25
|
+
return {
|
|
26
|
+
"$": ["xv-table-col.css"]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
static get properties() {
|
|
30
|
+
return {
|
|
31
|
+
"sort": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"mutable": true,
|
|
34
|
+
"complexType": {
|
|
35
|
+
"original": "SORT_DIR | ''",
|
|
36
|
+
"resolved": "\"\" | SORT_DIR.ASC | SORT_DIR.DESC | SORT_DIR.NONE",
|
|
37
|
+
"references": {
|
|
38
|
+
"SORT_DIR": {
|
|
39
|
+
"location": "import",
|
|
40
|
+
"path": "../defs",
|
|
41
|
+
"id": "src/components/xv-table/defs.ts::SORT_DIR"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": false,
|
|
46
|
+
"optional": true,
|
|
47
|
+
"docs": {
|
|
48
|
+
"tags": [],
|
|
49
|
+
"text": ""
|
|
50
|
+
},
|
|
51
|
+
"getter": false,
|
|
52
|
+
"setter": false,
|
|
53
|
+
"attribute": "sort",
|
|
54
|
+
"reflect": true
|
|
55
|
+
},
|
|
56
|
+
"sortName": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"mutable": false,
|
|
59
|
+
"complexType": {
|
|
60
|
+
"original": "string",
|
|
61
|
+
"resolved": "string",
|
|
62
|
+
"references": {}
|
|
63
|
+
},
|
|
64
|
+
"required": false,
|
|
65
|
+
"optional": true,
|
|
66
|
+
"docs": {
|
|
67
|
+
"tags": [],
|
|
68
|
+
"text": ""
|
|
69
|
+
},
|
|
70
|
+
"getter": false,
|
|
71
|
+
"setter": false,
|
|
72
|
+
"attribute": "sort-name",
|
|
73
|
+
"reflect": false
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static get events() {
|
|
78
|
+
return [{
|
|
79
|
+
"method": "sortColChange",
|
|
80
|
+
"name": "sortColChange",
|
|
81
|
+
"bubbles": true,
|
|
82
|
+
"cancelable": true,
|
|
83
|
+
"composed": true,
|
|
84
|
+
"docs": {
|
|
85
|
+
"tags": [],
|
|
86
|
+
"text": ""
|
|
87
|
+
},
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "TableSortData",
|
|
90
|
+
"resolved": "TableSortData",
|
|
91
|
+
"references": {
|
|
92
|
+
"TableSortData": {
|
|
93
|
+
"location": "import",
|
|
94
|
+
"path": "../defs",
|
|
95
|
+
"id": "src/components/xv-table/defs.ts::TableSortData"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}];
|
|
100
|
+
}
|
|
101
|
+
static get listeners() {
|
|
102
|
+
return [{
|
|
103
|
+
"name": "click",
|
|
104
|
+
"method": "handleClick",
|
|
105
|
+
"target": undefined,
|
|
106
|
+
"capture": false,
|
|
107
|
+
"passive": false
|
|
108
|
+
}];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=xv-table-col.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xv-table-col.js","sourceRoot":"","sources":["../../../../src/components/xv-table/xv-table-col/xv-table-col.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAiB,MAAM,SAAS,CAAC;AAOlD,MAAM,OAAO,UAAU;IAOrB,WAAW;QACT,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO;QACpC,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE;YAAE,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAEhD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC;YACvC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,GAAG,CAAC,CAAC;YACzC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,cAAc,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI;YACpD,8DAAQ,CACH,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, Listen, Event, EventEmitter } from '@stencil/core';\nimport { SORT_DIR, TableSortData } from '../defs';\n\n@Component({\n tag: 'xv-table-v2-col',\n styleUrl: 'xv-table-col.scss',\n shadow: true,\n})\nexport class XvTableCol {\n @Prop({ reflect: true, mutable: true }) sort?: SORT_DIR | '';\n @Prop({ attribute: 'sort-name' }) sortName?: string;\n\n @Event() sortColChange: EventEmitter<TableSortData>;\n\n @Listen('click')\n handleClick() {\n if (this.sort === undefined) return;\n if (this.sort === '') this.sort = SORT_DIR.NONE;\n\n this.sort = this.sort === SORT_DIR.NONE ?\n SORT_DIR.ASC : this.sort === SORT_DIR.ASC ?\n SORT_DIR.DESC : SORT_DIR.NONE;\n this.sortColChange.emit({ dir: this.sort, name: this.sortName });\n }\n\n render() {\n return (\n <Host role=\"cell\" class=\"xv-table-col\" sort={this.sort}>\n <slot />\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
:host ::slotted(xv-table-v2-header-row[cols="1"]),
|
|
2
|
+
:host ::slotted(xv-table-v2-row[cols="1"]),
|
|
3
|
+
:host ::slotted(xv-table-v2-expand[cols="1"]) {
|
|
4
|
+
--xv-table-cols: 1;
|
|
5
|
+
}
|
|
6
|
+
:host ::slotted(xv-table-v2-header-row[cols="2"]),
|
|
7
|
+
:host ::slotted(xv-table-v2-row[cols="2"]),
|
|
8
|
+
:host ::slotted(xv-table-v2-expand[cols="2"]) {
|
|
9
|
+
--xv-table-cols: 2;
|
|
10
|
+
}
|
|
11
|
+
:host ::slotted(xv-table-v2-header-row[cols="3"]),
|
|
12
|
+
:host ::slotted(xv-table-v2-row[cols="3"]),
|
|
13
|
+
:host ::slotted(xv-table-v2-expand[cols="3"]) {
|
|
14
|
+
--xv-table-cols: 3;
|
|
15
|
+
}
|
|
16
|
+
:host ::slotted(xv-table-v2-header-row[cols="4"]),
|
|
17
|
+
:host ::slotted(xv-table-v2-row[cols="4"]),
|
|
18
|
+
:host ::slotted(xv-table-v2-expand[cols="4"]) {
|
|
19
|
+
--xv-table-cols: 4;
|
|
20
|
+
}
|
|
21
|
+
:host ::slotted(xv-table-v2-header-row[cols="5"]),
|
|
22
|
+
:host ::slotted(xv-table-v2-row[cols="5"]),
|
|
23
|
+
:host ::slotted(xv-table-v2-expand[cols="5"]) {
|
|
24
|
+
--xv-table-cols: 5;
|
|
25
|
+
}
|
|
26
|
+
:host ::slotted(xv-table-v2-header-row[cols="6"]),
|
|
27
|
+
:host ::slotted(xv-table-v2-row[cols="6"]),
|
|
28
|
+
:host ::slotted(xv-table-v2-expand[cols="6"]) {
|
|
29
|
+
--xv-table-cols: 6;
|
|
30
|
+
}
|
|
31
|
+
:host ::slotted(xv-table-v2-header-row[cols="7"]),
|
|
32
|
+
:host ::slotted(xv-table-v2-row[cols="7"]),
|
|
33
|
+
:host ::slotted(xv-table-v2-expand[cols="7"]) {
|
|
34
|
+
--xv-table-cols: 7;
|
|
35
|
+
}
|
|
36
|
+
:host ::slotted(xv-table-v2-header-row[cols="8"]),
|
|
37
|
+
:host ::slotted(xv-table-v2-row[cols="8"]),
|
|
38
|
+
:host ::slotted(xv-table-v2-expand[cols="8"]) {
|
|
39
|
+
--xv-table-cols: 8;
|
|
40
|
+
}
|
|
41
|
+
:host ::slotted(xv-table-v2-header-row[cols="9"]),
|
|
42
|
+
:host ::slotted(xv-table-v2-row[cols="9"]),
|
|
43
|
+
:host ::slotted(xv-table-v2-expand[cols="9"]) {
|
|
44
|
+
--xv-table-cols: 9;
|
|
45
|
+
}
|
|
46
|
+
:host ::slotted(xv-table-v2-header-row[cols="10"]),
|
|
47
|
+
:host ::slotted(xv-table-v2-row[cols="10"]),
|
|
48
|
+
:host ::slotted(xv-table-v2-expand[cols="10"]) {
|
|
49
|
+
--xv-table-cols: 10;
|
|
50
|
+
}
|
|
51
|
+
:host ::slotted(xv-table-v2-header-row[cols="11"]),
|
|
52
|
+
:host ::slotted(xv-table-v2-row[cols="11"]),
|
|
53
|
+
:host ::slotted(xv-table-v2-expand[cols="11"]) {
|
|
54
|
+
--xv-table-cols: 11;
|
|
55
|
+
}
|
|
56
|
+
:host ::slotted(xv-table-v2-header-row[cols="12"]),
|
|
57
|
+
:host ::slotted(xv-table-v2-row[cols="12"]),
|
|
58
|
+
:host ::slotted(xv-table-v2-expand[cols="12"]) {
|
|
59
|
+
--xv-table-cols: 12;
|
|
60
|
+
}
|
|
61
|
+
:host ::slotted(xv-table-v2-header-row[cols="13"]),
|
|
62
|
+
:host ::slotted(xv-table-v2-row[cols="13"]),
|
|
63
|
+
:host ::slotted(xv-table-v2-expand[cols="13"]) {
|
|
64
|
+
--xv-table-cols: 13;
|
|
65
|
+
}
|
|
66
|
+
:host ::slotted(xv-table-v2-header-row[cols="14"]),
|
|
67
|
+
:host ::slotted(xv-table-v2-row[cols="14"]),
|
|
68
|
+
:host ::slotted(xv-table-v2-expand[cols="14"]) {
|
|
69
|
+
--xv-table-cols: 14;
|
|
70
|
+
}
|
|
71
|
+
:host ::slotted(xv-table-v2-header-row[cols="15"]),
|
|
72
|
+
:host ::slotted(xv-table-v2-row[cols="15"]),
|
|
73
|
+
:host ::slotted(xv-table-v2-expand[cols="15"]) {
|
|
74
|
+
--xv-table-cols: 15;
|
|
75
|
+
}
|
|
76
|
+
:host ::slotted(xv-table-v2-header-row[cols="16"]),
|
|
77
|
+
:host ::slotted(xv-table-v2-row[cols="16"]),
|
|
78
|
+
:host ::slotted(xv-table-v2-expand[cols="16"]) {
|
|
79
|
+
--xv-table-cols: 16;
|
|
80
|
+
}
|
|
81
|
+
:host ::slotted(xv-table-v2-header-row[cols="17"]),
|
|
82
|
+
:host ::slotted(xv-table-v2-row[cols="17"]),
|
|
83
|
+
:host ::slotted(xv-table-v2-expand[cols="17"]) {
|
|
84
|
+
--xv-table-cols: 17;
|
|
85
|
+
}
|
|
86
|
+
:host ::slotted(xv-table-v2-header-row[cols="18"]),
|
|
87
|
+
:host ::slotted(xv-table-v2-row[cols="18"]),
|
|
88
|
+
:host ::slotted(xv-table-v2-expand[cols="18"]) {
|
|
89
|
+
--xv-table-cols: 18;
|
|
90
|
+
}
|
|
91
|
+
:host ::slotted(xv-table-v2-header-row[cols="19"]),
|
|
92
|
+
:host ::slotted(xv-table-v2-row[cols="19"]),
|
|
93
|
+
:host ::slotted(xv-table-v2-expand[cols="19"]) {
|
|
94
|
+
--xv-table-cols: 19;
|
|
95
|
+
}
|
|
96
|
+
:host ::slotted(xv-table-v2-header-row[cols="20"]),
|
|
97
|
+
:host ::slotted(xv-table-v2-row[cols="20"]),
|
|
98
|
+
:host ::slotted(xv-table-v2-expand[cols="20"]) {
|
|
99
|
+
--xv-table-cols: 20;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:host(xv-table-v2-expand) ::slotted(xv-table-v2-row) {
|
|
103
|
+
block-size: auto;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
grid-template-columns: var(--xv-table-first-col-size, 0) repeat(var(--xv-table-cols, 1), 1fr);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
:host(xv-table-v2-expand:not([expanded])) ::slotted(xv-table-v2-row:not(:first-of-type)) {
|
|
109
|
+
padding-top: 0;
|
|
110
|
+
padding-bottom: 0;
|
|
111
|
+
block-size: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host(xv-table-v2-expand[expanded]) ::slotted(xv-table-v2-row:not(:first-of-type)) {
|
|
115
|
+
block-size: auto;
|
|
116
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { TABLE_TAG } from "../defs";
|
|
3
|
+
import { debounce, forEach, uidGenerator } from "../../../utils/utils";
|
|
4
|
+
export class XvTableExpand {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.expanded = false;
|
|
7
|
+
this.cols = 1;
|
|
8
|
+
this.hovered = false;
|
|
9
|
+
this.checkedGroup = new Map();
|
|
10
|
+
this.selectedRows = new Set();
|
|
11
|
+
// Expand group ID
|
|
12
|
+
this.groupId = uidGenerator();
|
|
13
|
+
this.setExpandAttrs = (expanded) => {
|
|
14
|
+
forEach(this.el.children, (row, i) => {
|
|
15
|
+
// set group id
|
|
16
|
+
this.setAttr(row, 'group-id', this.groupId);
|
|
17
|
+
// If it's Main selection row
|
|
18
|
+
if (!i) {
|
|
19
|
+
this.setAttr(row, 'expandable', true);
|
|
20
|
+
this.setAttr(row, 'expanded', expanded);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
this.onSlotChange = () => {
|
|
26
|
+
this.cols = this.el.firstElementChild.childElementCount;
|
|
27
|
+
this.setExpandAttrs(this.expanded);
|
|
28
|
+
};
|
|
29
|
+
this.emitChangeSelectionEvent = debounce(() => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
return this.checkedChange.emit(Object.assign(Object.assign({ name: ((_a = this.mainRowData) === null || _a === void 0 ? void 0 : _a.name) || this.el.firstElementChild.getAttribute('selection-name') }, (this.mainRowData || {})), { checked: !!this.selectedRows.size, group: Object.assign(Object.assign({ id: this.groupId }, (((_b = this.mainRowData) === null || _b === void 0 ? void 0 : _b.group) || {})), { data: Array.from(this.selectedRows.values()) }) }));
|
|
32
|
+
}, 100);
|
|
33
|
+
this.handleCheckedChange = (e) => {
|
|
34
|
+
const { group, checked, name } = e.detail;
|
|
35
|
+
if ((group === null || group === void 0 ? void 0 : group.id) !== this.groupId)
|
|
36
|
+
return;
|
|
37
|
+
if (group === null || group === void 0 ? void 0 : group.isMainRow) {
|
|
38
|
+
this.mainRowData = e.detail;
|
|
39
|
+
// clear group selection
|
|
40
|
+
if (!checked)
|
|
41
|
+
this.selectedRows.clear();
|
|
42
|
+
// Change all group except first row
|
|
43
|
+
forEach(this.el.children, (row, i) => {
|
|
44
|
+
if (!i || row.hasAttribute('disabled'))
|
|
45
|
+
return;
|
|
46
|
+
this.setAttr(row, 'checked', checked);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (checked) {
|
|
51
|
+
this.selectedRows.add(e.detail);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.selectedRows
|
|
55
|
+
.forEach(item => item.name === name && this.selectedRows.delete(item));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const isNoSelected = !this.selectedRows.size;
|
|
59
|
+
const isAllSelected = this.selectedRows.size == this.el.childElementCount - 1;
|
|
60
|
+
const isPartialSelected = !isNoSelected && (this.selectedRows.size < this.el.childElementCount - 1);
|
|
61
|
+
if (isAllSelected) {
|
|
62
|
+
this.setAttr(this.el.firstElementChild, 'checked', true);
|
|
63
|
+
}
|
|
64
|
+
else if (isNoSelected) {
|
|
65
|
+
this.setAttr(this.el.firstElementChild, 'checked', false);
|
|
66
|
+
}
|
|
67
|
+
this.setAttr(this.el.firstElementChild, 'partial', isPartialSelected);
|
|
68
|
+
this.emitChangeSelectionEvent();
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async toggleExpand(expanded) {
|
|
72
|
+
this.expanded = !!expanded;
|
|
73
|
+
}
|
|
74
|
+
setAttr(node, name, value) {
|
|
75
|
+
if (typeof value === 'string') {
|
|
76
|
+
!node.hasAttribute(name) && node.setAttribute(name, value);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (value) {
|
|
80
|
+
!node.hasAttribute(name) && node.setAttribute(name, '');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
node.hasAttribute(name) && node.removeAttribute(name);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
setInitialExpandStatus() {
|
|
87
|
+
const table = this.el.parentElement;
|
|
88
|
+
if (table.tagName === TABLE_TAG.TABLE)
|
|
89
|
+
this.setAttr(table, 'expandable', true);
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
return (h(Host, { key: '3e6cfb2feacf723e53db6b256ae0adf1e2a93032', role: "rowgroup", cols: this.cols, expanded: this.expanded, hovered: this.hovered }, h("slot", { key: '56082d65ca6f46eb064383b203b51265ae699b8c', onSlotchange: this.onSlotChange })));
|
|
93
|
+
}
|
|
94
|
+
componentWillLoad() {
|
|
95
|
+
this.setInitialExpandStatus();
|
|
96
|
+
}
|
|
97
|
+
connectedCallback() {
|
|
98
|
+
this.el.childNodes.forEach(row => row.addEventListener('checkedGroupChange', this.handleCheckedChange));
|
|
99
|
+
}
|
|
100
|
+
disconnectedCallback() {
|
|
101
|
+
this.el.childNodes.forEach(row => row.removeEventListener('checkedGroupChange', this.handleCheckedChange));
|
|
102
|
+
}
|
|
103
|
+
static get is() { return "xv-table-v2-expand"; }
|
|
104
|
+
static get encapsulation() { return "shadow"; }
|
|
105
|
+
static get originalStyleUrls() {
|
|
106
|
+
return {
|
|
107
|
+
"$": ["xv-table-expand.scss"]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
static get styleUrls() {
|
|
111
|
+
return {
|
|
112
|
+
"$": ["xv-table-expand.css"]
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
static get properties() {
|
|
116
|
+
return {
|
|
117
|
+
"expanded": {
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"mutable": true,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "boolean",
|
|
122
|
+
"resolved": "boolean",
|
|
123
|
+
"references": {}
|
|
124
|
+
},
|
|
125
|
+
"required": false,
|
|
126
|
+
"optional": false,
|
|
127
|
+
"docs": {
|
|
128
|
+
"tags": [],
|
|
129
|
+
"text": ""
|
|
130
|
+
},
|
|
131
|
+
"getter": false,
|
|
132
|
+
"setter": false,
|
|
133
|
+
"attribute": "expanded",
|
|
134
|
+
"reflect": true,
|
|
135
|
+
"defaultValue": "false"
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
static get states() {
|
|
140
|
+
return {
|
|
141
|
+
"cols": {},
|
|
142
|
+
"hovered": {},
|
|
143
|
+
"checkedGroup": {},
|
|
144
|
+
"selectedRows": {},
|
|
145
|
+
"mainRowData": {}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
static get events() {
|
|
149
|
+
return [{
|
|
150
|
+
"method": "checkedChange",
|
|
151
|
+
"name": "checkedChange",
|
|
152
|
+
"bubbles": true,
|
|
153
|
+
"cancelable": true,
|
|
154
|
+
"composed": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": ""
|
|
158
|
+
},
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "TableSelectionEventData",
|
|
161
|
+
"resolved": "{ name: string; checked: boolean; value?: string; group?: { isMainRow?: boolean; id: string; data?: TableSelectionEventData[]; }; }",
|
|
162
|
+
"references": {
|
|
163
|
+
"TableSelectionEventData": {
|
|
164
|
+
"location": "import",
|
|
165
|
+
"path": "../defs",
|
|
166
|
+
"id": "src/components/xv-table/defs.ts::TableSelectionEventData"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}];
|
|
171
|
+
}
|
|
172
|
+
static get methods() {
|
|
173
|
+
return {
|
|
174
|
+
"toggleExpand": {
|
|
175
|
+
"complexType": {
|
|
176
|
+
"signature": "(expanded: boolean) => Promise<void>",
|
|
177
|
+
"parameters": [{
|
|
178
|
+
"name": "expanded",
|
|
179
|
+
"type": "boolean",
|
|
180
|
+
"docs": ""
|
|
181
|
+
}],
|
|
182
|
+
"references": {
|
|
183
|
+
"Promise": {
|
|
184
|
+
"location": "global",
|
|
185
|
+
"id": "global::Promise"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"return": "Promise<void>"
|
|
189
|
+
},
|
|
190
|
+
"docs": {
|
|
191
|
+
"text": "",
|
|
192
|
+
"tags": []
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
static get elementRef() { return "el"; }
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=xv-table-expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xv-table-expand.js","sourceRoot":"","sources":["../../../../src/components/xv-table/xv-table-expand/xv-table-expand.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,SAAS,EAAgD,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAOvE,MAAM,OAAO,aAAa;IAL1B;QAQ0C,aAAQ,GAAY,KAAK,CAAC;QAEzD,SAAI,GAAW,CAAC,CAAC;QACjB,YAAO,GAAY,KAAK,CAAC;QACzB,iBAAY,GAAqB,IAAI,GAAG,EAAE,CAAC;QAC3C,iBAAY,GAAG,IAAI,GAAG,EAA2B,CAAC;QAK3D,kBAAkB;QACV,YAAO,GAAW,YAAY,EAAE,CAAC;QAoBjC,mBAAc,GAAG,CAAC,QAAiB,EAAE,EAAE;YAC7C,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;gBACnC,eAAe;gBACf,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAE5C,6BAA6B;gBAC7B,IAAI,CAAC,CAAC,EAAE,CAAC;oBACP,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;oBACtC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,C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AC,OAAO;YAErB,6DAAM,YAAY,EAAE,IAAI,CAAC,YAAY,GAAI,CACpC,CACR,CAAC;IACJ,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1G,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC7G,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport { TABLE_TAG, TableSelectionEvent, TableSelectionEventData } from '../defs';\nimport { debounce, forEach, uidGenerator } from '../../../utils/utils';\n\n@Component({\n tag: 'xv-table-v2-expand',\n styleUrl: 'xv-table-expand.scss',\n shadow: true,\n})\nexport class XvTableExpand {\n @Element() el: HTMLElement;\n\n @Prop({ reflect: true, mutable: true }) expanded: boolean = false;\n\n @State() cols: number = 1;\n @State() hovered: boolean = false;\n @State() checkedGroup: Map<string, any> = new Map();\n @State() selectedRows = new Set<TableSelectionEventData>();\n @State() mainRowData: TableSelectionEventData;\n\n @Event() checkedChange: EventEmitter<TableSelectionEventData>;\n\n // Expand group ID\n private groupId: string = uidGenerator();\n\n @Method()\n async toggleExpand(expanded: boolean) {\n this.expanded = !!expanded;\n }\n\n private setAttr(node: Element, name: string, value: string | boolean) {\n if (typeof value === 'string') {\n !node.hasAttribute(name) && node.setAttribute(name, value);\n return;\n }\n\n if (value) {\n !node.hasAttribute(name) && node.setAttribute(name, '');\n } else {\n node.hasAttribute(name) && node.removeAttribute(name);\n }\n }\n\n private setExpandAttrs = (expanded: boolean) => {\n forEach(this.el.children, (row, i) => {\n // set group id\n this.setAttr(row, 'group-id', this.groupId);\n\n // If it's Main selection row\n if (!i) {\n this.setAttr(row, 'expandable', true);\n this.setAttr(row, 'expanded', expanded);\n return;\n }\n });\n }\n\n private onSlotChange = () => {\n this.cols = this.el.firstElementChild.childElementCount;\n this.setExpandAttrs(this.expanded);\n }\n\n private setInitialExpandStatus() {\n const table = this.el.parentElement;\n\n if (table.tagName === TABLE_TAG.TABLE) this.setAttr(table, 'expandable', true);\n }\n\n private emitChangeSelectionEvent = debounce(() => this.checkedChange.emit({\n name: this.mainRowData?.name || this.el.firstElementChild.getAttribute('selection-name'),\n ...(this.mainRowData || {}),\n checked: !!this.selectedRows.size,\n group: {\n id: this.groupId,\n ...(this.mainRowData?.group || {}),\n data: Array.from(this.selectedRows.values()),\n }\n }), 100);\n\n private handleCheckedChange = (e: TableSelectionEvent) => {\n const { group, checked, name } = e.detail;\n\n if (group?.id !== this.groupId) return;\n\n if (group?.isMainRow) {\n this.mainRowData = e.detail;\n // clear group selection\n if (!checked) this.selectedRows.clear();\n // Change all group except first row\n forEach(this.el.children, (row, i) => {\n if (!i || row.hasAttribute('disabled')) return;\n this.setAttr(row, 'checked', checked);\n })\n } else {\n if (checked) {\n this.selectedRows.add(e.detail);\n } else {\n this.selectedRows\n .forEach(item => item.name === name && this.selectedRows.delete(item));\n }\n }\n\n const isNoSelected = !this.selectedRows.size;\n const isAllSelected = this.selectedRows.size == this.el.childElementCount - 1;\n const isPartialSelected = !isNoSelected && (this.selectedRows.size < this.el.childElementCount - 1);\n\n if (isAllSelected) {\n this.setAttr(this.el.firstElementChild, 'checked', true);\n } else if (isNoSelected) {\n this.setAttr(this.el.firstElementChild, 'checked', false);\n }\n\n this.setAttr(this.el.firstElementChild, 'partial', isPartialSelected);\n\n this.emitChangeSelectionEvent();\n };\n\n render() {\n return (\n <Host\n role=\"rowgroup\"\n cols={this.cols}\n expanded={this.expanded}\n hovered={this.hovered}\n >\n <slot onSlotchange={this.onSlotChange} />\n </Host>\n );\n }\n\n componentWillLoad() {\n this.setInitialExpandStatus();\n }\n\n connectedCallback() {\n this.el.childNodes.forEach(row => row.addEventListener('checkedGroupChange', this.handleCheckedChange));\n }\n\n disconnectedCallback() {\n this.el.childNodes.forEach(row => row.removeEventListener('checkedGroupChange', this.handleCheckedChange));\n }\n}\n"]}
|