@policystudio/policy-studio-ui-vue 1.1.89 → 1.1.90-access.1
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/.eslintignore +1 -0
- package/.eslintrc.js +75 -67
- package/.github/workflows/deploy-storybook.yml +5 -5
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6638 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/util/GeneralFunctions.d.ts +3 -0
- package/dist/util/GeneralFunctions.js +35 -0
- package/dist/util/GeneralFunctions.js.map +1 -0
- package/dist/util/directives.d.ts +1 -0
- package/dist/util/directives.js +22 -0
- package/dist/util/directives.js.map +1 -0
- package/dist/util/imageLoader.d.ts +6 -0
- package/dist/util/imageLoader.js +52 -0
- package/dist/util/imageLoader.js.map +1 -0
- package/doc/.nvmrc +1 -0
- package/doc/.storybook/PolicyStudio.ts +11 -0
- package/doc/.storybook/main.ts +27 -0
- package/doc/.storybook/manager.ts +7 -0
- package/{.storybook/preview.js → doc/.storybook/preview.ts} +2 -3
- package/doc/package-lock.json +22653 -0
- package/doc/package.json +71 -0
- package/doc/shims-vue.d.ts +6 -0
- package/{src/stories/Accordion.stories.js → doc/src/stories/Accordion.stories.ts} +4 -5
- package/{src/stories/BadgeWithIcon.stories.js → doc/src/stories/BadgeWithIcon.stories.ts} +2 -2
- package/{src/stories/BarChart.stories.js → doc/src/stories/BarChart.stories.ts} +2 -2
- package/{src/stories/Breadcrumb.stories.js → doc/src/stories/Breadcrumb.stories.ts} +2 -5
- package/{src/stories/Button.stories.js → doc/src/stories/Button.stories.ts} +130 -130
- package/{src/stories/CardInfos.stories.js → doc/src/stories/CardInfos.stories.ts} +2 -3
- package/{src/stories/ChartLegend.stories.js → doc/src/stories/ChartLegend.stories.ts} +2 -3
- package/{src/stories/Checkbox.stories.js → doc/src/stories/Checkbox.stories.ts} +2 -2
- package/{src/stories/CheckboxSimple.stories.js → doc/src/stories/CheckboxSimple.stories.ts} +2 -2
- package/{src/stories/Chips.stories.js → doc/src/stories/Chips.stories.ts} +22 -23
- package/{src/stories/ClimateZoneBadge.stories.js → doc/src/stories/ClimateZoneBadge.stories.ts} +3 -2
- package/doc/src/stories/Collapse.stories.ts +46 -0
- package/{src/stories/CostEffectBar.stories.js → doc/src/stories/CostEffectBar.stories.ts} +3 -2
- package/{src/stories/Datatable.stories.js → doc/src/stories/Datatable.stories.ts} +7 -4
- package/{src/stories/DateCardInfo.stories.js → doc/src/stories/DateCardInfo.stories.ts} +2 -6
- package/{src/stories/Dialog.stories.js → doc/src/stories/Dialog.stories.ts} +2 -2
- package/{src/stories/Draggable.stories.js → doc/src/stories/Draggable.stories.ts} +3 -2
- package/{src/stories/Dropdown.stories.js → doc/src/stories/Dropdown.stories.ts} +4 -3
- package/{src/stories/DropdownList.stories.js → doc/src/stories/DropdownList.stories.ts} +4 -2
- package/{src/stories/ElevationSystem.stories.mdx → doc/src/stories/ElevationSystem.mdx} +1 -1
- package/{src/stories/HighlightRippleDot.stories.js → doc/src/stories/HighlightRippleDot.stories.ts} +3 -2
- package/{src/stories/Icon.stories.js → doc/src/stories/Icon.stories.ts} +3 -1
- package/{src/stories/InlineSelector.stories.js → doc/src/stories/InlineSelector.stories.ts} +2 -2
- package/{src/stories/Input.stories.js → doc/src/stories/Input.stories.ts} +7 -4
- package/{src/stories/InputSelect.stories.js → doc/src/stories/InputSelect.stories.ts} +3 -2
- package/{src/stories/InputTextArea.stories.js → doc/src/stories/InputTextArea.stories.ts} +2 -2
- package/{src/stories/Introduction.stories.mdx → doc/src/stories/Introduction.mdx} +101 -101
- package/{src/stories/MiniTag.stories.js → doc/src/stories/MiniTag.stories.ts} +9 -2
- package/{src/stories/ProgressBar.stories.js → doc/src/stories/ProgressBar.stories.ts} +3 -2
- package/{src/stories/RadioButton.stories.js → doc/src/stories/RadioButton.stories.ts} +2 -2
- package/{src/stories/RadioButtonSimple.stories.js → doc/src/stories/RadioButtonSimple.stories.ts} +2 -2
- package/{src/stories/SimpleAlert.stories.js → doc/src/stories/SimpleAlert.stories.ts} +3 -2
- package/{src/stories/Slider.stories.js → doc/src/stories/Slider.stories.ts} +6 -2
- package/{src/stories/Switch.stories.js → doc/src/stories/Switch.stories.ts} +2 -2
- package/{src/stories/TabHeader.stories.js → doc/src/stories/TabHeader.stories.ts} +6 -1
- package/{src/stories/TableResults.stories.js → doc/src/stories/TableResults.stories.ts} +11 -7
- package/{src/stories/TagScope.stories.js → doc/src/stories/TagScope.stories.ts} +3 -2
- package/{src/stories/TestimonialCard.stories.js → doc/src/stories/TestimonialCard.stories.ts} +3 -3
- package/{src/stories/Toast.stories.js → doc/src/stories/Toast.stories.ts} +2 -2
- package/{src/stories/Toggle.stories.js → doc/src/stories/Toggle.stories.ts} +7 -4
- package/{src/stories/Tooltip.stories.js → doc/src/stories/Tooltip.stories.ts} +6 -6
- package/{src/stories/Typography.stories.mdx → doc/src/stories/Typography.mdx} +107 -105
- package/doc/tsconfig.json +17 -0
- package/package.json +43 -39
- package/scripts/gulp.js +11 -0
- package/scripts/kill-port.sh +12 -0
- package/src/App.vue +30 -0
- package/src/assets/scss/base.scss +3 -30
- package/src/assets/scss/components/PsAccordion.scss +12 -2
- package/src/assets/scss/components/PsButton.scss +7 -1
- package/src/assets/scss/components/PsChips.scss +12 -7
- package/src/assets/scss/components/PsCollapse.scss +71 -0
- package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/assets/scss/components/PsDateCardInfo.scss +4 -5
- package/src/assets/scss/components/PsDialog.scss +7 -0
- package/src/assets/scss/components/PsDropdownList.scss +1 -1
- package/src/assets/scss/components/PsInput.scss +10 -0
- package/src/assets/scss/components/PsProgressBar.scss +4 -4
- package/src/assets/scss/components/PsSwitch.scss +10 -0
- package/src/assets/scss/components/PsTabHeader.scss +64 -2
- package/src/assets/scss/components/PsTableResults.scss +51 -82
- package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
- package/src/assets/scss/components/PsTooltip.scss +149 -145
- package/src/components/accordion/PsAccordion.vue +20 -21
- package/src/components/accordion/PsAccordionItem.vue +122 -81
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
- package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
- package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
- package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
- package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
- package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
- package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
- package/src/components/badges-and-tags/PsTagScope.vue +17 -22
- package/src/components/badges-and-tags/PsTestimonialCard.vue +25 -30
- package/src/components/buttons/PsButton.vue +90 -98
- package/src/components/chips/PsChips.vue +118 -103
- package/src/components/collapse/PsCollapse.vue +124 -0
- package/src/components/controls/PsCheckbox.vue +86 -83
- package/src/components/controls/PsCheckboxSimple.vue +97 -97
- package/src/components/controls/PsDraggable.vue +100 -99
- package/src/components/controls/PsInlineSelector.vue +111 -113
- package/src/components/controls/PsRadioButton.vue +72 -60
- package/src/components/controls/PsRadioButtonSimple.vue +81 -77
- package/src/components/controls/PsSlider.vue +190 -181
- package/src/components/controls/PsSwitch.vue +64 -54
- package/src/components/controls/PsToggle.vue +62 -57
- package/src/components/data-graphics/PsBarChart.vue +22 -23
- package/src/components/datatable/PsDataTable.vue +70 -65
- package/src/components/datatable/PsDataTableItem.vue +30 -32
- package/src/components/forms/PsDropdown.vue +173 -166
- package/src/components/forms/PsDropdownList.vue +133 -130
- package/src/components/forms/PsInput.vue +163 -146
- package/src/components/forms/PsInputSelect.vue +121 -100
- package/src/components/forms/PsInputTextArea.vue +84 -74
- package/src/components/navigations/PsBreadcrumb.vue +25 -34
- package/src/components/notifications/PsDialog.vue +67 -60
- package/src/components/notifications/PsSimpleAlert.vue +47 -37
- package/src/components/notifications/PsToast.vue +48 -42
- package/src/components/table-results/PsTableResults.vue +527 -504
- package/src/components/table-results/PsTableResultsBody.vue +69 -68
- package/src/components/table-results/PsTableResultsHead.vue +108 -69
- package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
- package/src/components/table-results/PsTableResultsRow.vue +61 -58
- package/src/components/tabs/PsTabHeader.vue +138 -116
- package/src/components/tooltip/PsDialogTooltip.vue +112 -107
- package/src/components/tooltip/PsRichTooltip.vue +46 -43
- package/src/components/tooltip/PsTooltip.vue +126 -122
- package/src/components/ui/PsDotLoader.vue +6 -10
- package/src/components/ui/PsIcon.vue +149 -134
- package/src/index.ts +159 -0
- package/src/tsconfig.json +12 -0
- package/src/types/index.d.ts +6 -0
- package/src/util/GeneralFunctions.js +16 -7
- package/src/util/directives.ts +24 -0
- package/src/util/imageLoader.js +14 -7
- package/tailwind.config.js +12 -3
- package/tsconfig.json +47 -0
- package/.storybook/PolicyStudio.js +0 -10
- package/.storybook/eventBus.js +0 -3
- package/.storybook/main.js +0 -25
- package/.storybook/manager.js +0 -6
- package/babel.config.js +0 -3
- package/backup-package-lock.json +0 -37194
- package/dist/css/psui_styles.css +0 -110965
- package/postcss.config.js +0 -8
- package/src/components/playground/PsScrollBar.vue +0 -248
- package/src/index.js +0 -167
- package/src/stories/Playground.stories.js +0 -16
- /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
- /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
- /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
- /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
- /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
- /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
- /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
- /package/{src → doc/src}/stories/assets/colors.svg +0 -0
- /package/{src → doc/src}/stories/assets/comments.svg +0 -0
- /package/{src → doc/src}/stories/assets/direction.svg +0 -0
- /package/{src → doc/src}/stories/assets/flow.svg +0 -0
- /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
- /package/{src → doc/src}/stories/assets/repo.svg +0 -0
- /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
3
|
ref="tableWrapper"
|
|
4
4
|
class="psui-el-table-results-wrapper"
|
|
5
5
|
:class="`table-${layout}`"
|
|
@@ -8,12 +8,9 @@
|
|
|
8
8
|
<table
|
|
9
9
|
ref="table"
|
|
10
10
|
class="psui-el-table-results"
|
|
11
|
-
:class="[
|
|
12
|
-
`layout-${layout}`,
|
|
13
|
-
{ 'is-sticky': isSticky }
|
|
14
|
-
]"
|
|
11
|
+
:class="[`layout-${layout}`, { 'is-sticky': isSticky }]"
|
|
15
12
|
>
|
|
16
|
-
<slot name="header"
|
|
13
|
+
<slot name="header" />
|
|
17
14
|
|
|
18
15
|
<tbody>
|
|
19
16
|
<tr
|
|
@@ -22,45 +19,42 @@
|
|
|
22
19
|
:class="[
|
|
23
20
|
getStatusClass(item),
|
|
24
21
|
{
|
|
25
|
-
'is-disabled'
|
|
26
|
-
'is-first'
|
|
27
|
-
'psui-hidden'
|
|
28
|
-
'is-last'
|
|
29
|
-
'is-active'
|
|
30
|
-
'removed-class'
|
|
31
|
-
'appended-row'
|
|
22
|
+
'is-disabled': item.is_disabled,
|
|
23
|
+
'is-first': item.deep == 0,
|
|
24
|
+
'psui-hidden': checkRowIsCollapsed(item) || item.not_visible,
|
|
25
|
+
'is-last': item.is_last,
|
|
26
|
+
'is-active': selectedRow == item.id,
|
|
27
|
+
'removed-class': (item.slug == 'removed_measures' || item.is_excluded) && layout == 'flexible',
|
|
28
|
+
'appended-row': item.is_appended,
|
|
32
29
|
},
|
|
33
|
-
`${item.type}
|
|
30
|
+
`${item.type}`,
|
|
34
31
|
]"
|
|
35
|
-
:id="
|
|
32
|
+
:id="item.id"
|
|
36
33
|
:data-group="item.id"
|
|
37
|
-
@mouseenter="onRowHover(index,item,'enter')"
|
|
38
|
-
@mouseleave="onRowHover(false,item,'leave')"
|
|
34
|
+
@mouseenter="onRowHover(index, item, 'enter')"
|
|
35
|
+
@mouseleave="onRowHover(false, item, 'leave')"
|
|
39
36
|
>
|
|
40
|
-
<td
|
|
41
|
-
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
<div class="psui-flex psui-relative">
|
|
37
|
+
<td :style="item.background_color ? `background-color: ${getBackgroundColor(item.background_color)}; transition: background-color 0.5s ease;` : ''">
|
|
38
|
+
<div class="psui-flex psui-relative psui-h-full">
|
|
45
39
|
<div
|
|
46
40
|
v-tooltip="{
|
|
47
|
-
classes:'layout-gray-50',
|
|
48
|
-
content: item.remove_add_tooltip
|
|
41
|
+
classes: 'layout-gray-50',
|
|
42
|
+
content: item.remove_add_tooltip,
|
|
49
43
|
}"
|
|
50
44
|
>
|
|
51
45
|
<PsIcon
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</div>
|
|
46
|
+
v-if="item.remove_add_button"
|
|
47
|
+
:icon="item.remove_add_button_icon"
|
|
48
|
+
class="psui-flex psui-text-gray-40 pl-4 psui-cursor-pointer leading-none hover:psui-text-blue-60 transition-all"
|
|
49
|
+
size="15"
|
|
50
|
+
display="flex"
|
|
51
|
+
@click.native="emit('removeOrAddButtonChange', item, $event)"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
60
54
|
<div
|
|
61
|
-
class="psui-flex psui-items-center psui-space-x-
|
|
62
|
-
:style="{paddingLeft: `${item.deep * 16}px`}"
|
|
63
|
-
>
|
|
55
|
+
class="psui-flex psui-items-center psui-space-x-2"
|
|
56
|
+
:style="{ paddingLeft: `${item.deep * 16}px` }"
|
|
57
|
+
>
|
|
64
58
|
<PsIcon
|
|
65
59
|
v-if="(!item.last_deep || item.type === 'total') && !item.is_appended"
|
|
66
60
|
icon="expand_more"
|
|
@@ -68,9 +62,10 @@
|
|
|
68
62
|
class="actions-button psui-transition psui-transform psui-cursor-pointer"
|
|
69
63
|
:icon-classes="item.is_disabled ? 'psui-text-gray-40' : getIconClasses(item)"
|
|
70
64
|
display="flex"
|
|
71
|
-
:class="[
|
|
72
|
-
|
|
73
|
-
{ 'psui
|
|
65
|
+
:class="[
|
|
66
|
+
checkRowIsVisible(item) ? 'psui-rotate-0' : 'psui--rotate-90',
|
|
67
|
+
{ 'psui--rotate-90': item.is_disabled },
|
|
68
|
+
{ 'psui-pointer-events-none psui--rotate-90': item.items.length == 0 },
|
|
74
69
|
]"
|
|
75
70
|
@click.native="onCollapse(item, $event)"
|
|
76
71
|
/>
|
|
@@ -81,25 +76,32 @@
|
|
|
81
76
|
</span>
|
|
82
77
|
</div>
|
|
83
78
|
|
|
84
|
-
<div
|
|
79
|
+
<div
|
|
85
80
|
v-else-if="item.is_disabled || item.tooltip_text"
|
|
86
81
|
class="psui-inline-flex psui-cursor-default sticky"
|
|
87
|
-
:class="{ 'is-last-deep'
|
|
82
|
+
:class="{ 'is-last-deep': item.last_deep }"
|
|
88
83
|
v-tooltip="getTooltipContent(item)"
|
|
89
84
|
>
|
|
90
|
-
<div class="flex psui-items-center psui-relative
|
|
91
|
-
<PsIcon
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
<div class="flex psui-items-center psui-relative">
|
|
86
|
+
<PsIcon
|
|
87
|
+
v-if="item.has_blocked_icon"
|
|
88
|
+
icon="do_disturb_alt"
|
|
89
|
+
size="14"
|
|
90
|
+
icon-classes="psui-absolute psui--left-1 psui-text-gray-50"
|
|
91
|
+
/>
|
|
92
|
+
<p
|
|
93
|
+
class="title psui-text-gray-50 opacity-100-childrens-on-hover"
|
|
94
|
+
:style="item.text_color ? `color: ${item.text_color};` : ''"
|
|
95
|
+
>
|
|
94
96
|
{{ item.title }}
|
|
95
97
|
|
|
96
98
|
<PsIcon
|
|
97
99
|
v-if="item.has_helper"
|
|
98
|
-
icon="
|
|
99
|
-
size="
|
|
100
|
-
class="psui-text-gray-40 psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
|
|
100
|
+
icon="info_outline"
|
|
101
|
+
size="16"
|
|
102
|
+
class="psui-text-gray-40 hover:psui-text-blue-60 psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
|
|
101
103
|
display="flex"
|
|
102
|
-
@click.native="
|
|
104
|
+
@click.native="emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
|
|
103
105
|
/>
|
|
104
106
|
</p>
|
|
105
107
|
</div>
|
|
@@ -108,21 +110,17 @@
|
|
|
108
110
|
<p
|
|
109
111
|
v-else
|
|
110
112
|
class="title opacity-100-childrens-on-hover"
|
|
111
|
-
:class="[
|
|
112
|
-
{ 'psui-font-bold' : item.type == 'total' },
|
|
113
|
-
{ 'is-last-deep' : item.last_deep }
|
|
114
|
-
]"
|
|
113
|
+
:class="[{ 'psui-font-bold': item.type == 'total' }, { 'is-last-deep': item.last_deep }]"
|
|
115
114
|
>
|
|
116
115
|
{{ item.title }}
|
|
117
116
|
|
|
118
117
|
<PsIcon
|
|
119
118
|
v-if="item.has_helper"
|
|
120
|
-
icon="
|
|
121
|
-
size="
|
|
122
|
-
|
|
123
|
-
class="psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
|
|
119
|
+
icon="info_outline"
|
|
120
|
+
size="16"
|
|
121
|
+
class="psui-opacity-0 psui-text-gray-40 hover:psui-text-blue-60 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
|
|
124
122
|
display="flex"
|
|
125
|
-
@click.native="
|
|
123
|
+
@click.native="emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
|
|
126
124
|
/>
|
|
127
125
|
</p>
|
|
128
126
|
|
|
@@ -134,31 +132,32 @@
|
|
|
134
132
|
display="flex"
|
|
135
133
|
/>
|
|
136
134
|
</div>
|
|
137
|
-
<div
|
|
135
|
+
<div
|
|
138
136
|
class="actions psui-space-x-3 flex justify-between"
|
|
139
|
-
:style="{ paddingLeft: `${item.deep * 16}px` }"
|
|
137
|
+
:style="layout !== 'flexible' ? { paddingLeft: `${item.deep * 16}px` } : {}"
|
|
140
138
|
>
|
|
141
|
-
<PsRichTooltip
|
|
139
|
+
<PsRichTooltip
|
|
142
140
|
v-if="shouldShowIcon(item)"
|
|
143
141
|
position="top"
|
|
144
142
|
layout="gray"
|
|
145
143
|
class="psui-inline-flex psui-cursor-default"
|
|
146
144
|
:class="[isHoveringRow === index ? 'opacity-1' : 'opacity-0']"
|
|
147
|
-
:
|
|
145
|
+
:ignore-dialog="getIgnoreDialogIcon(item)"
|
|
148
146
|
>
|
|
149
|
-
<template
|
|
147
|
+
<template #trigger>
|
|
150
148
|
<PsIcon
|
|
151
149
|
:icon="getIcon(item)"
|
|
152
|
-
class="
|
|
153
|
-
|
|
150
|
+
:class="[
|
|
151
|
+
'psui-flex psui-text-gray-40 psui-cursor-pointer leading-none hover:psui-text-blue-60 psui-gap-3 transition-all',
|
|
152
|
+
layout === 'flexible' ? 'px-1 psui-py-0' : 'psui-px-5 psui-py-1'
|
|
153
|
+
]"
|
|
154
|
+
size="16"
|
|
154
155
|
display="flex"
|
|
155
156
|
@click.native="executeCallback(item)"
|
|
156
157
|
/>
|
|
157
158
|
</template>
|
|
158
|
-
<template
|
|
159
|
-
<p
|
|
160
|
-
class="psui-font-bold psui-text-gray-80 psui-text-xsmall"
|
|
161
|
-
>
|
|
159
|
+
<template #content>
|
|
160
|
+
<p class="psui-font-bold psui-text-gray-80 psui-text-xsmall">
|
|
162
161
|
{{ getText(item) }}
|
|
163
162
|
</p>
|
|
164
163
|
</template>
|
|
@@ -170,15 +169,15 @@
|
|
|
170
169
|
:class="[isHoveringRow === index ? 'opacity-1' : 'opacity-0']"
|
|
171
170
|
position="custom"
|
|
172
171
|
>
|
|
173
|
-
<template
|
|
174
|
-
<PsIcon
|
|
172
|
+
<template #dropdownTrigger>
|
|
173
|
+
<PsIcon
|
|
175
174
|
icon="more_horiz"
|
|
176
175
|
size="18"
|
|
177
176
|
class="psui-flex psui-text-gray-40 psui-cursor-pointer leading-none hover:psui-text-blue-60 psui-gap-3 psui-px-5 psui-py-1 transition-all"
|
|
178
177
|
display="flex"
|
|
179
178
|
/>
|
|
180
179
|
</template>
|
|
181
|
-
<template
|
|
180
|
+
<template #items>
|
|
182
181
|
<ul class="psui-w-full psui-font-bold psui-my-3">
|
|
183
182
|
<li
|
|
184
183
|
v-for="(action, index) in item.actions"
|
|
@@ -189,11 +188,11 @@
|
|
|
189
188
|
>
|
|
190
189
|
<span class="psui-w-auto psui-text-small">{{ action.title }}</span>
|
|
191
190
|
</li>
|
|
192
|
-
</ul>
|
|
191
|
+
</ul>
|
|
193
192
|
</template>
|
|
194
193
|
</PsDropdown>
|
|
195
194
|
</div>
|
|
196
|
-
</div>
|
|
195
|
+
</div>
|
|
197
196
|
</td>
|
|
198
197
|
|
|
199
198
|
<template v-for="(columnGroup, indexColumn) of columnGroups">
|
|
@@ -205,31 +204,37 @@
|
|
|
205
204
|
:data-test-id="column.key"
|
|
206
205
|
:class="`column-${column.key}`"
|
|
207
206
|
>
|
|
208
|
-
<div
|
|
207
|
+
<div
|
|
209
208
|
v-if="layout != 'comparison'"
|
|
210
209
|
class="psui-space-x-2 psui-show-childrens-on-hover"
|
|
211
|
-
:class="
|
|
210
|
+
:class="[
|
|
211
|
+
{},
|
|
212
|
+
column.isCenteredContent ? 'psui-justify-center' : 'psui-justify-end'
|
|
213
|
+
]"
|
|
212
214
|
>
|
|
213
|
-
<PsTooltip v-if="isSelectedRow(column,item)">
|
|
214
|
-
<template
|
|
215
|
+
<PsTooltip v-if="isSelectedRow(column, item)">
|
|
216
|
+
<template #trigger>
|
|
215
217
|
<PsIcon
|
|
216
218
|
icon="close"
|
|
217
219
|
size="16"
|
|
218
220
|
class="psui-cursor-pointer"
|
|
219
221
|
icon-classes="psui-text-blue-60 psui-leading-none psui-transition"
|
|
220
222
|
display="flex"
|
|
221
|
-
@click.native="
|
|
223
|
+
@click.native="resetPolicyImpactItemSelected(item, column)"
|
|
222
224
|
/>
|
|
223
225
|
</template>
|
|
224
|
-
<template
|
|
226
|
+
<template #content>
|
|
225
227
|
Close projections
|
|
226
228
|
</template>
|
|
227
229
|
</PsTooltip>
|
|
228
230
|
|
|
229
|
-
<PsTooltip
|
|
230
|
-
|
|
231
|
+
<PsTooltip
|
|
232
|
+
v-else-if="
|
|
233
|
+
(column.hasProjections && !item.is_disabled && item.disable_projection_select !== true && layout != 'flexible') ||
|
|
234
|
+
(column.hasProjections && item.disable_projection_select != true && item.deep != 0 && layout == 'flexible')
|
|
235
|
+
"
|
|
231
236
|
>
|
|
232
|
-
<template
|
|
237
|
+
<template #trigger>
|
|
233
238
|
<PsIcon
|
|
234
239
|
icon="bar_chart"
|
|
235
240
|
size="16"
|
|
@@ -239,20 +244,23 @@
|
|
|
239
244
|
@click.native="onSelectRow(item, column, $event)"
|
|
240
245
|
/>
|
|
241
246
|
</template>
|
|
242
|
-
<template
|
|
247
|
+
<template #content>
|
|
243
248
|
Show projections in the chart
|
|
244
249
|
</template>
|
|
245
250
|
</PsTooltip>
|
|
246
|
-
<p
|
|
251
|
+
<p
|
|
252
|
+
class="ps-table-cell-value"
|
|
253
|
+
v-if="!column.isSwitch"
|
|
254
|
+
>
|
|
247
255
|
<template v-if="column.hasScoreHelper">
|
|
248
|
-
<PsTooltip
|
|
249
|
-
|
|
250
|
-
>
|
|
251
|
-
<template v-slot:trigger>
|
|
256
|
+
<PsTooltip layout="blue">
|
|
257
|
+
<template #trigger>
|
|
252
258
|
{{ getItemContent(column, item) }}
|
|
253
259
|
</template>
|
|
254
|
-
<template
|
|
255
|
-
<p class="psui-text-xsmall psui-font-bold">
|
|
260
|
+
<template #content>
|
|
261
|
+
<p class="psui-text-xsmall psui-font-bold">
|
|
262
|
+
{{ column.hasScoreHelper.title }}
|
|
263
|
+
</p>
|
|
256
264
|
{{ column.hasScoreHelper.description }}
|
|
257
265
|
</template>
|
|
258
266
|
</PsTooltip>
|
|
@@ -275,46 +283,55 @@
|
|
|
275
283
|
/>
|
|
276
284
|
<div
|
|
277
285
|
v-if="column.isSwitch && item.data[column.key] != null"
|
|
278
|
-
class="psui-inline-flex"
|
|
286
|
+
class="psui-inline-flex"
|
|
279
287
|
v-tooltip="{
|
|
280
|
-
content: item.tooltip_text ? `<
|
|
281
|
-
classes: 'layout-blue'
|
|
288
|
+
content: item.tooltip_text ? `<h2>${item.tooltip_text}</h2>` : false,
|
|
289
|
+
classes: 'layout-blue',
|
|
282
290
|
}"
|
|
283
291
|
>
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
292
|
+
<div class="flex psui-items-center psui-relative">
|
|
293
|
+
<span
|
|
294
|
+
v-if="item.has_flag"
|
|
295
|
+
class="psui-w-2 psui-h-2 psui-bg-yellow-20 psui-absolute psui--right-2 psui--top-2 psui-rounded-md"
|
|
296
|
+
/>
|
|
297
|
+
<PsSwitch
|
|
298
|
+
:disabled="item.data.is_disabled || item.is_excluded"
|
|
299
|
+
:value="item.data[column.key]"
|
|
300
|
+
:background-color="switchButtonBackgroundColor"
|
|
301
|
+
class="psui-justify-self-center"
|
|
302
|
+
:class="{ 'psui-pointer-events-none': preventClickOnSwitchButtons }"
|
|
303
|
+
size="small"
|
|
304
|
+
@change="emit('switchButtonItemChanged', item, $event)"
|
|
305
|
+
/>
|
|
298
306
|
</div>
|
|
299
307
|
</div>
|
|
300
308
|
</div>
|
|
301
|
-
|
|
309
|
+
|
|
302
310
|
<!-- only comparison layout -->
|
|
303
311
|
<div v-else>
|
|
304
312
|
<div class="psui-py-4 psui-px-6">
|
|
305
|
-
<PsTagScope
|
|
313
|
+
<PsTagScope
|
|
306
314
|
v-if="column.renderType && column.renderType == 'tag_scope'"
|
|
307
315
|
:included="item.data[column.key] == true"
|
|
308
316
|
/>
|
|
309
317
|
|
|
310
|
-
<PsBarChart
|
|
318
|
+
<PsBarChart
|
|
311
319
|
v-else-if="item.data[column.key] != 0 && column.renderType && column.renderType == 'bar_chart'"
|
|
312
320
|
:show-number="item.data[column.key] != 0 ? true : false"
|
|
313
|
-
:total="
|
|
321
|
+
:total="
|
|
322
|
+
formatFunction
|
|
323
|
+
? formatFunction(column.key, item.data[column.key], item.data) == '--'
|
|
324
|
+
? 0
|
|
325
|
+
: formatFunction(column.key, item.data[column.key], item.data)
|
|
326
|
+
: item.data[column.key]
|
|
327
|
+
"
|
|
314
328
|
:fill-width="getPsBarChartWidth(column.key, item.data[column.key])"
|
|
315
329
|
/>
|
|
316
330
|
|
|
317
|
-
<p
|
|
331
|
+
<p
|
|
332
|
+
class="ps-table-cell-value"
|
|
333
|
+
v-else-if="item.data[column.key] != 0"
|
|
334
|
+
>
|
|
318
335
|
{{ formatFunction(column.key, item.data[column.key], item.data) }}
|
|
319
336
|
</p>
|
|
320
337
|
</div>
|
|
@@ -323,12 +340,12 @@
|
|
|
323
340
|
</template>
|
|
324
341
|
</tr>
|
|
325
342
|
</tbody>
|
|
343
|
+
<slot name="footer" />
|
|
326
344
|
</table>
|
|
327
345
|
</div>
|
|
328
346
|
</template>
|
|
329
347
|
|
|
330
|
-
<script>
|
|
331
|
-
import { eventBus } from '../../../.storybook/eventBus'
|
|
348
|
+
<script setup>
|
|
332
349
|
import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
|
|
333
350
|
import PsIcon from '../ui/PsIcon.vue'
|
|
334
351
|
import PsProgressBar from '../badges-and-tags/PsProgressBar.vue'
|
|
@@ -338,415 +355,421 @@ import PsTooltip from '../tooltip/PsTooltip.vue'
|
|
|
338
355
|
import PsSwitch from '../controls/PsSwitch.vue'
|
|
339
356
|
import tailwindConfig from '../../../tailwind.config'
|
|
340
357
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
export default {
|
|
344
|
-
name: 'PsTableResults',
|
|
345
|
-
components: {
|
|
346
|
-
PsProgressBar,
|
|
347
|
-
PsIcon,
|
|
348
|
-
PsRichTooltip,
|
|
349
|
-
PsTagScope,
|
|
350
|
-
PsBarChart,
|
|
351
|
-
PsTooltip, PsSwitch
|
|
352
|
-
},
|
|
353
|
-
props: {
|
|
354
|
-
/**
|
|
355
|
-
* It sets the layout of the table. eg: results or comparison
|
|
356
|
-
*/
|
|
357
|
-
layout: {
|
|
358
|
-
type: String,
|
|
359
|
-
default: 'results',
|
|
360
|
-
validator: (value) => {
|
|
361
|
-
return tableLayout.indexOf(value) !== -1
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
/**
|
|
365
|
-
* It sets the max-height to table.
|
|
366
|
-
*/
|
|
367
|
-
tableMaxHeight: {
|
|
368
|
-
type: String,
|
|
369
|
-
default: '540px'
|
|
370
|
-
},
|
|
371
|
-
/**
|
|
372
|
-
* It sets if the lines should start collapsed.
|
|
373
|
-
*/
|
|
374
|
-
showRowsCollapsed: {
|
|
375
|
-
type: Boolean,
|
|
376
|
-
default: true
|
|
377
|
-
},
|
|
378
|
-
/**
|
|
379
|
-
* It sets the format function to display values.
|
|
380
|
-
*/
|
|
381
|
-
formatFunction: {
|
|
382
|
-
type: Function
|
|
383
|
-
},
|
|
384
|
-
/**
|
|
385
|
-
* It sets the disabled texts conditionals.
|
|
386
|
-
*/
|
|
387
|
-
disabledText: {
|
|
388
|
-
type: String
|
|
389
|
-
},
|
|
390
|
-
/**
|
|
391
|
-
* It sets the hidden items.
|
|
392
|
-
*/
|
|
393
|
-
hiddenItems: {
|
|
394
|
-
type: Array,
|
|
395
|
-
default() {
|
|
396
|
-
return []
|
|
397
|
-
}
|
|
398
|
-
},
|
|
399
|
-
/**
|
|
400
|
-
* It sets the hidden items index.
|
|
401
|
-
*/
|
|
402
|
-
itemsHiddenIndexes: {
|
|
403
|
-
type: [Array, undefined],
|
|
404
|
-
default: undefined
|
|
405
|
-
},
|
|
406
|
-
/**
|
|
407
|
-
* It sets the values which will be use to render the body.
|
|
408
|
-
*/
|
|
409
|
-
summaryData: {
|
|
410
|
-
type: Array,
|
|
411
|
-
default() {
|
|
412
|
-
return []
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
/**
|
|
416
|
-
* It sets the values which will be use to render the body.
|
|
417
|
-
*/
|
|
418
|
-
columnGroups: {
|
|
419
|
-
type: Array,
|
|
420
|
-
default() {
|
|
421
|
-
return []
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
/**
|
|
425
|
-
* It sets the values which will be use to render the body.
|
|
426
|
-
*/
|
|
427
|
-
existingColumnGroup: {
|
|
428
|
-
type: Array,
|
|
429
|
-
default() {
|
|
430
|
-
return []
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
/**
|
|
434
|
-
* It sets the values which will be use to render the body.
|
|
435
|
-
*/
|
|
436
|
-
rows: {
|
|
437
|
-
type: Array,
|
|
438
|
-
default() {
|
|
439
|
-
return []
|
|
440
|
-
}
|
|
441
|
-
},
|
|
442
|
-
/**
|
|
443
|
-
* It sets if rows is collapsible.
|
|
444
|
-
*/
|
|
445
|
-
isCollapsible: {
|
|
446
|
-
type: Boolean,
|
|
447
|
-
default: true
|
|
448
|
-
},
|
|
449
|
-
/**
|
|
450
|
-
* It sets the level to show opened rows.
|
|
451
|
-
*/
|
|
452
|
-
customLevelOpened: {
|
|
453
|
-
type: Number,
|
|
454
|
-
default: 1
|
|
455
|
-
},
|
|
456
|
-
/**
|
|
457
|
-
* It sets the values which will be use to render the body.
|
|
458
|
-
*/
|
|
459
|
-
policies: {
|
|
460
|
-
type: Array,
|
|
461
|
-
default() {
|
|
462
|
-
return []
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
switchButtonBackgroundColor:{
|
|
466
|
-
type:String,
|
|
467
|
-
},
|
|
468
|
-
preventIsDisabledOnItemsValue:{
|
|
469
|
-
type: Boolean,
|
|
470
|
-
default: false
|
|
471
|
-
},
|
|
472
|
-
preventClickOnSwitchButtons:{
|
|
473
|
-
type: Boolean,
|
|
474
|
-
default: false
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
data: () => ({
|
|
478
|
-
collapsedRows : [],
|
|
479
|
-
isHoveringRow : false,
|
|
480
|
-
selectedRow : null,
|
|
481
|
-
policyItemSelected: null,
|
|
482
|
-
columnSelectedKey : null,
|
|
483
|
-
isSticky: false
|
|
484
|
-
}),
|
|
485
|
-
computed: {
|
|
486
|
-
getRows() {
|
|
487
|
-
const rows = []
|
|
488
|
-
for (let index = 0; index < this.summaryData.length; index++) {
|
|
489
|
-
const item = this.summaryData[index]
|
|
490
|
-
this.addRow(item, 0, `${index}`, rows)
|
|
491
|
-
}
|
|
358
|
+
import { ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue'
|
|
492
359
|
|
|
493
|
-
|
|
360
|
+
const props = defineProps({
|
|
361
|
+
/**
|
|
362
|
+
* It sets the layout of the table. eg: results or comparison
|
|
363
|
+
*/
|
|
364
|
+
layout: {
|
|
365
|
+
type: String,
|
|
366
|
+
default: 'results',
|
|
367
|
+
validator: (value) => {
|
|
368
|
+
return ['results', 'comparison', 'flexible'].indexOf(value) !== -1
|
|
494
369
|
},
|
|
495
370
|
},
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
},
|
|
504
|
-
itemsHiddenIndexes() {
|
|
505
|
-
this.setCollapsedRows()
|
|
506
|
-
},
|
|
507
|
-
showRowsCollapsed() {
|
|
508
|
-
this.setCollapsedRows()
|
|
509
|
-
}
|
|
371
|
+
/**
|
|
372
|
+
* It sets the max-height to table.
|
|
373
|
+
*/
|
|
374
|
+
tableMaxHeight: {
|
|
375
|
+
type: String,
|
|
376
|
+
default: '540px',
|
|
510
377
|
},
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
378
|
+
/**
|
|
379
|
+
* It sets if the lines should start collapsed.
|
|
380
|
+
*/
|
|
381
|
+
showRowsCollapsed: {
|
|
382
|
+
type: Boolean,
|
|
383
|
+
default: true,
|
|
384
|
+
},
|
|
385
|
+
/**
|
|
386
|
+
* It sets the format function to display values.
|
|
387
|
+
*/
|
|
388
|
+
formatFunction: {
|
|
389
|
+
type: Function,
|
|
390
|
+
default: () => '',
|
|
518
391
|
},
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
392
|
+
/**
|
|
393
|
+
* It sets the disabled texts conditionals.
|
|
394
|
+
*/
|
|
395
|
+
disabledText: {
|
|
396
|
+
type: String,
|
|
397
|
+
default: '',
|
|
522
398
|
},
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
399
|
+
/**
|
|
400
|
+
* It sets the hidden items.
|
|
401
|
+
*/
|
|
402
|
+
hiddenItems: {
|
|
403
|
+
type: Array,
|
|
404
|
+
default() {
|
|
405
|
+
return []
|
|
526
406
|
},
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
// if ( this.showRowsCollapsed ) {
|
|
550
|
-
// this.getRows.forEach(element => {
|
|
551
|
-
// if ( element?.items?.length && ( this.customLevelOpened == null || element.index.split('-').length > this.customLevelOpened)) {
|
|
552
|
-
// newRowsCollpased.push(element.index)
|
|
553
|
-
// }
|
|
554
|
-
// })
|
|
555
|
-
// }
|
|
556
|
-
// }
|
|
557
|
-
|
|
558
|
-
this.collapsedRows = newRowsCollpased
|
|
407
|
+
},
|
|
408
|
+
/**
|
|
409
|
+
* It sets the hidden items index.
|
|
410
|
+
*/
|
|
411
|
+
itemsHiddenIndexes: {
|
|
412
|
+
type: [Array, undefined],
|
|
413
|
+
default: undefined,
|
|
414
|
+
},
|
|
415
|
+
/**
|
|
416
|
+
* It forces to use hidden itens on collapsible system independent of layouts
|
|
417
|
+
*/
|
|
418
|
+
useHiddenItemsOnly: {
|
|
419
|
+
type: Boolean,
|
|
420
|
+
default: true,
|
|
421
|
+
},
|
|
422
|
+
/**
|
|
423
|
+
* It sets the values which will be use to render the body.
|
|
424
|
+
*/
|
|
425
|
+
summaryData: {
|
|
426
|
+
type: Array,
|
|
427
|
+
default() {
|
|
428
|
+
return []
|
|
559
429
|
},
|
|
560
|
-
|
|
561
|
-
|
|
430
|
+
},
|
|
431
|
+
/**
|
|
432
|
+
* It sets the values which will be use to render the body.
|
|
433
|
+
*/
|
|
434
|
+
columnGroups: {
|
|
435
|
+
type: Array,
|
|
436
|
+
default() {
|
|
437
|
+
return []
|
|
562
438
|
},
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
const item_child = items_child[indexChild]
|
|
572
|
-
item_child.is_last = indexChild + 1 === items_child.length ? true : false
|
|
573
|
-
this.addRow(item_child, deep + 1, `${index}-${indexChild}`, rows)
|
|
574
|
-
}
|
|
575
|
-
}
|
|
439
|
+
},
|
|
440
|
+
/**
|
|
441
|
+
* It sets the values which will be use to render the body.
|
|
442
|
+
*/
|
|
443
|
+
existingColumnGroup: {
|
|
444
|
+
type: Array,
|
|
445
|
+
default() {
|
|
446
|
+
return []
|
|
576
447
|
},
|
|
577
|
-
|
|
578
|
-
|
|
448
|
+
},
|
|
449
|
+
/**
|
|
450
|
+
* It sets the values which will be use to render the body.
|
|
451
|
+
*/
|
|
452
|
+
rows: {
|
|
453
|
+
type: Array,
|
|
454
|
+
default() {
|
|
455
|
+
return []
|
|
579
456
|
},
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
457
|
+
},
|
|
458
|
+
/**
|
|
459
|
+
* It sets if rows is collapsible.
|
|
460
|
+
*/
|
|
461
|
+
isCollapsible: {
|
|
462
|
+
type: Boolean,
|
|
463
|
+
default: true,
|
|
464
|
+
},
|
|
465
|
+
/**
|
|
466
|
+
* It sets the level to show opened rows.
|
|
467
|
+
*/
|
|
468
|
+
customLevelOpened: {
|
|
469
|
+
type: Number,
|
|
470
|
+
default: 1,
|
|
471
|
+
},
|
|
472
|
+
/**
|
|
473
|
+
* It sets the values which will be use to render the body.
|
|
474
|
+
*/
|
|
475
|
+
policies: {
|
|
476
|
+
type: Array,
|
|
477
|
+
default() {
|
|
478
|
+
return []
|
|
590
479
|
},
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
480
|
+
},
|
|
481
|
+
switchButtonBackgroundColor: {
|
|
482
|
+
type: String,
|
|
483
|
+
default: '',
|
|
484
|
+
},
|
|
485
|
+
preventIsDisabledOnItemsValue: {
|
|
486
|
+
type: Boolean,
|
|
487
|
+
default: false,
|
|
488
|
+
},
|
|
489
|
+
preventClickOnSwitchButtons: {
|
|
490
|
+
type: Boolean,
|
|
491
|
+
default: false,
|
|
492
|
+
},
|
|
493
|
+
})
|
|
595
494
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
if(index > -1) {
|
|
599
|
-
this.collapsedRows.splice(index, 1)
|
|
600
|
-
delete item.isCollapsed
|
|
601
|
-
} else {
|
|
602
|
-
this.collapsedRows.push(item.index)
|
|
603
|
-
item.isCollapsed = true
|
|
604
|
-
}
|
|
605
|
-
this.$forceUpdate()
|
|
606
|
-
|
|
607
|
-
this.$emit('collapse-row', this.collapsedRows, $event)
|
|
608
|
-
},
|
|
609
|
-
onRowHover(index, item, type) {
|
|
610
|
-
const parent = document.getElementById(`${item.id}`)
|
|
611
|
-
const children = parent?.children
|
|
612
|
-
|
|
613
|
-
if (type == 'enter' && item.index != 0 && item.deep != 0 && this.layout == 'flexible') {
|
|
614
|
-
for (let i = 0; i < children.length; i++) {
|
|
615
|
-
children[i].classList.add('hover-color')
|
|
616
|
-
}
|
|
617
|
-
} else if(parent) {
|
|
618
|
-
parent.querySelectorAll('.hover-color').forEach(child => {
|
|
619
|
-
child.classList.remove('hover-color')
|
|
620
|
-
})
|
|
621
|
-
}
|
|
495
|
+
const emit = defineEmits(['policy-selected', 'collapse-row', 'switchButtonItemChanged', 'removeOrAddButtonChange','setPolicyItemSelected','openDescriptionModal'])
|
|
622
496
|
|
|
623
|
-
|
|
624
|
-
},
|
|
625
|
-
getIgnoreDialogIcon(item){
|
|
626
|
-
return !this.shouldShowIcon(item) || item.actions[0].ignoreDialog
|
|
627
|
-
},
|
|
628
|
-
shouldShowIcon(item) {
|
|
629
|
-
if(item?.actions?.length === 1) return true
|
|
630
|
-
else return false
|
|
631
|
-
},
|
|
632
|
-
shouldShowDropdown(item) {
|
|
633
|
-
if(item?.actions?.length > 1) return true
|
|
634
|
-
else return false
|
|
635
|
-
},
|
|
636
|
-
getIcon(item) {
|
|
637
|
-
if(item?.actions?.length === 1) return item.actions[0].icon
|
|
638
|
-
},
|
|
639
|
-
getText(item) {
|
|
640
|
-
if(item?.actions?.length === 1) return item.actions[0].text
|
|
641
|
-
},
|
|
642
|
-
getItemContent(column, item) {
|
|
643
|
-
if ( column.isSwitch ) return
|
|
644
|
-
|
|
645
|
-
if (this.formatFunction && !item.is_disabled || this.preventIsDisabledOnItemsValue) {
|
|
646
|
-
return this.formatFunction(column.key, item.data[column.key], item.data, item.study_id)
|
|
647
|
-
} else if (item.is_disabled) {
|
|
648
|
-
return '--'
|
|
649
|
-
} else {
|
|
650
|
-
return item.data[column.key]
|
|
651
|
-
}
|
|
652
|
-
},
|
|
653
|
-
executeCallback(item, action) {
|
|
654
|
-
if(item?.actions?.length === 1) item.actions[0].callback(item)
|
|
655
|
-
else action?.callback(item)
|
|
656
|
-
|
|
657
|
-
Object.values(this.$refs).flat(Infinity).forEach(( component => {
|
|
658
|
-
if(component?.$options?._componentTag == 'PsDropdown'){
|
|
659
|
-
component.close()
|
|
660
|
-
}}))
|
|
661
|
-
},
|
|
662
|
-
getStatusClass(item) {
|
|
663
|
-
return this.checkRowIsVisible(item) ? 'opened' : 'closed'
|
|
664
|
-
},
|
|
665
|
-
onSelectRow(item, column, $event) {
|
|
666
|
-
if(this.layout != 'flexible') {
|
|
667
|
-
this.selectedRow = item.id
|
|
668
|
-
this.policyItemSelected = { ...item }
|
|
669
|
-
delete this.policyItemSelected.items
|
|
670
|
-
this.columnSelectedKey = column.key
|
|
671
|
-
}
|
|
672
|
-
this.$emit('policy-selected', { item: item, column: column }, $event)
|
|
673
|
-
},
|
|
674
|
-
onCloseSelectRow(item, column) {
|
|
675
|
-
eventBus.$emit('resetPolicyImpactItemSelected', item, column)
|
|
676
|
-
},
|
|
677
|
-
isSelectedRow(column,item) {
|
|
678
|
-
if(!item.id){
|
|
679
|
-
return this.selectedRow === item.id && this.columnSelectedKey == column.key
|
|
680
|
-
}
|
|
681
|
-
return column.hasProjections && !item.is_disabled && this.selectedRow == item.id && this.columnSelectedKey == column.key
|
|
682
|
-
},
|
|
683
|
-
getBackgroundColor(value) {
|
|
684
|
-
if(value && value.includes('psui-bg-')) {
|
|
685
|
-
return tailwindConfig.theme.colors[value.replace('psui-bg-', '')]
|
|
686
|
-
}
|
|
687
|
-
return value || '#ffffff'
|
|
688
|
-
},
|
|
689
|
-
getTooltipContent(item) {
|
|
690
|
-
let content = {
|
|
691
|
-
classes:'layout-gray',
|
|
692
|
-
content:''
|
|
693
|
-
}
|
|
497
|
+
defineExpose({resetPolicy: (item, columnKey) => resetPolicyImpactItemSelected(item, columnKey)})
|
|
694
498
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
}
|
|
704
|
-
return content
|
|
705
|
-
},
|
|
499
|
+
const collapsedRows = ref([])
|
|
500
|
+
const isHoveringRow = ref(false)
|
|
501
|
+
const selectedRow = ref(null)
|
|
502
|
+
const policyItemSelected = ref(null)
|
|
503
|
+
const columnSelectedKey = ref(null)
|
|
504
|
+
const isSticky = ref(false)
|
|
505
|
+
const tableWrapper = ref(null)
|
|
506
|
+
const instance = getCurrentInstance()
|
|
706
507
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
508
|
+
const addRow = (item, deep = 0, index, rows) => {
|
|
509
|
+
item.deep = deep
|
|
510
|
+
item.index = index
|
|
511
|
+
rows.push(item)
|
|
512
|
+
item.last_deep = item.items ? false : true
|
|
513
|
+
if (item.items) {
|
|
514
|
+
const items_child = [...item.items]
|
|
515
|
+
for (let indexChild = 0; indexChild < items_child.length; indexChild++) {
|
|
516
|
+
const item_child = items_child[indexChild]
|
|
517
|
+
item_child.is_last = indexChild + 1 === items_child.length ? true : false
|
|
518
|
+
addRow(item_child, deep + 1, `${index}-${indexChild}`, rows)
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const getRows = computed(() => {
|
|
524
|
+
const rows = []
|
|
525
|
+
for (let index = 0; index < props.summaryData.length; index++) {
|
|
526
|
+
const item = props.summaryData[index]
|
|
527
|
+
addRow(item, 0, `${index}`, rows)
|
|
528
|
+
}
|
|
529
|
+
return rows
|
|
530
|
+
})
|
|
531
|
+
|
|
532
|
+
watch(
|
|
533
|
+
() => getRows.value,
|
|
534
|
+
() => {
|
|
535
|
+
setCollapsedRows()
|
|
536
|
+
},
|
|
537
|
+
{ deep: true },
|
|
538
|
+
{ immediate: true }
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
watch(
|
|
542
|
+
()=> props.itemsHiddenIndexes,
|
|
543
|
+
() => {
|
|
544
|
+
setCollapsedRows()
|
|
545
|
+
})
|
|
546
|
+
|
|
547
|
+
watch(
|
|
548
|
+
()=>props.showRowsCollapsed,
|
|
549
|
+
() => {
|
|
550
|
+
setCollapsedRows()
|
|
551
|
+
})
|
|
552
|
+
|
|
553
|
+
onMounted(() => {
|
|
554
|
+
setCollapsedRows()
|
|
555
|
+
tableWrapper.value.addEventListener('scroll', handleTableScroll)
|
|
556
|
+
})
|
|
557
|
+
|
|
558
|
+
onBeforeUnmount(() => {
|
|
559
|
+
tableWrapper.value.removeEventListener('scroll', handleTableScroll)
|
|
560
|
+
})
|
|
561
|
+
|
|
562
|
+
const resetPolicyImpactItemSelected = (item, columnKey = 'forecast_emissions_savings') => {
|
|
563
|
+
emit('setPolicyItemSelected', { item, columnSelectedKey: columnKey })
|
|
564
|
+
selectedRow.value = null
|
|
565
|
+
}
|
|
739
566
|
|
|
740
|
-
|
|
741
|
-
|
|
567
|
+
const setCollapsedRows = () => {
|
|
568
|
+
let newRowsCollpased = [...(props.itemsHiddenIndexes || [])]
|
|
569
|
+
if (props.useHiddenItemsOnly) {
|
|
570
|
+
collapsedRows.value = newRowsCollpased
|
|
571
|
+
return
|
|
572
|
+
}
|
|
742
573
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
574
|
+
if (props.itemsHiddenIndexes && props.layout != 'flexible') return
|
|
575
|
+
if (props.showRowsCollapsed || props.layout == 'flexible') {
|
|
576
|
+
getRows.value.forEach((element) => {
|
|
577
|
+
const matchForAll = Boolean(element?.items?.length && (props.customLevelOpened == null || element.index.split('-').length > props.customLevelOpened))
|
|
578
|
+
const matchForFlexibleLayout = Boolean(element.isCollapsed === true)
|
|
579
|
+
if (matchForAll || matchForFlexibleLayout) {
|
|
580
|
+
newRowsCollpased.push(element.index)
|
|
747
581
|
}
|
|
582
|
+
})
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
collapsedRows.value = newRowsCollpased
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const getIconClasses = (item) => {
|
|
589
|
+
return checkRowIsVisible(item) ? 'psui-text-gray-40' : 'psui-text-blue-60'
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const checkRowIsVisible = (item) => {
|
|
593
|
+
return collapsedRows.value.indexOf(item.index) < 0
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const checkRowIsCollapsed = (item) => {
|
|
597
|
+
let isHidden = false
|
|
598
|
+
for (let index = 0; index < collapsedRows.value.length; index++) {
|
|
599
|
+
const item_hidden = collapsedRows.value[index]
|
|
600
|
+
if (item.index.startsWith(`${item_hidden}-`)) {
|
|
601
|
+
isHidden = true
|
|
602
|
+
break
|
|
748
603
|
}
|
|
749
|
-
}
|
|
604
|
+
}
|
|
605
|
+
return isHidden
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
const onCollapse = (item, $event) => {
|
|
609
|
+
if (props.itemsHiddenIndexes && props.itemsHiddenIndexes.some((it) => it == item.index.toString()) && props.layout == 'flexible') {
|
|
610
|
+
return
|
|
611
|
+
}
|
|
612
|
+
const index = collapsedRows.value.indexOf(item.index)
|
|
613
|
+
|
|
614
|
+
if (index > -1) {
|
|
615
|
+
collapsedRows.value.splice(index, 1)
|
|
616
|
+
delete item.isCollapsed
|
|
617
|
+
} else {
|
|
618
|
+
collapsedRows.value.push(item.index)
|
|
619
|
+
item.isCollapsed = true
|
|
620
|
+
}
|
|
621
|
+
instance?.proxy?.$forceUpdate()
|
|
622
|
+
emit('collapse-row', collapsedRows.value, $event)
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
const onRowHover = (index, item, type) => {
|
|
626
|
+
const parent = document.getElementById(`${item.id}`)
|
|
627
|
+
const children = parent?.children
|
|
628
|
+
if (type == 'enter' && item.index != 0 && item.deep != 0 && props.layout == 'flexible') {
|
|
629
|
+
for (let i = 0; i < children.length; i++) {
|
|
630
|
+
children[i].classList.add('hover-color')
|
|
631
|
+
}
|
|
632
|
+
} else if (parent) {
|
|
633
|
+
parent.querySelectorAll('.hover-color').forEach((child) => {
|
|
634
|
+
child.classList.remove('hover-color')
|
|
635
|
+
})
|
|
636
|
+
}
|
|
637
|
+
isHoveringRow.value = index
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
const getIgnoreDialogIcon = (item) => {
|
|
641
|
+
return !shouldShowIcon(item) || item.actions[0].ignoreDialog
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const shouldShowIcon = (item) => {
|
|
645
|
+
if (item?.actions?.length === 1) return true
|
|
646
|
+
else return false
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
const shouldShowDropdown = (item) => {
|
|
650
|
+
if (item?.actions?.length > 1) return true
|
|
651
|
+
else return false
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
const getIcon = (item) => {
|
|
655
|
+
if (item?.actions?.length === 1) return item.actions[0].icon
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const getText = (item) => {
|
|
659
|
+
if (item?.actions?.length === 1) return item.actions[0].text
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const getItemContent = (column, item) => {
|
|
663
|
+
if (column.isSwitch) return
|
|
664
|
+
|
|
665
|
+
if ((props.formatFunction && !item.is_disabled) || props.preventIsDisabledOnItemsValue) {
|
|
666
|
+
return props.formatFunction(column.key, item.data[column.key], item.data, item.study_id)
|
|
667
|
+
} else if (item.is_disabled) {
|
|
668
|
+
return '--'
|
|
669
|
+
} else {
|
|
670
|
+
return item.data[column.key]
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
const executeCallback = (item, action) => {
|
|
675
|
+
if (item?.actions?.length === 1) item.actions[0].callback(item)
|
|
676
|
+
else action?.callback(item)
|
|
677
|
+
Object.values(instance.proxy.$refs)
|
|
678
|
+
.flat(Infinity)
|
|
679
|
+
.forEach((component) => {
|
|
680
|
+
if (component?.$options?._componentTag == 'PsDropdown') {
|
|
681
|
+
component.close()
|
|
682
|
+
}
|
|
683
|
+
})
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
const getStatusClass = (item) => {
|
|
687
|
+
return checkRowIsVisible(item) ? 'opened' : 'closed'
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const onSelectRow = (item, column, $event) => {
|
|
691
|
+
if (props.layout != 'flexible') {
|
|
692
|
+
selectedRow.value = item.id
|
|
693
|
+
policyItemSelected.value = { ...item }
|
|
694
|
+
delete policyItemSelected.value.items
|
|
695
|
+
columnSelectedKey.value = column.key
|
|
696
|
+
}
|
|
697
|
+
emit('policy-selected', { item: item, column: column }, $event)
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
const isSelectedRow = (column, item) => {
|
|
701
|
+
if (!item.id) {
|
|
702
|
+
return selectedRow.value === item.id && columnSelectedKey.value == column.key
|
|
703
|
+
}
|
|
704
|
+
return column.hasProjections && !item.is_disabled && selectedRow.value == item.id && columnSelectedKey.value == column.key
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
const getBackgroundColor = (value) => {
|
|
708
|
+
if (value && value.includes('psui-bg-')) {
|
|
709
|
+
return tailwindConfig.theme.colors[value.replace('psui-bg-', '')]
|
|
710
|
+
}
|
|
711
|
+
return value || '#ffffff'
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
const getTooltipContent = (item) => {
|
|
715
|
+
let content = {
|
|
716
|
+
classes: 'layout-gray',
|
|
717
|
+
content: '',
|
|
718
|
+
}
|
|
719
|
+
if (item.tooltip_text && props.layout == 'flexible') {
|
|
720
|
+
content.classes = 'layout-blue'
|
|
721
|
+
content.content = item.tooltip_text
|
|
722
|
+
} else if (item.tooltip_text) {
|
|
723
|
+
content.content = `<h2>${item.tooltip_text}</h2>`
|
|
724
|
+
} else if (item.is_disabled) {
|
|
725
|
+
content.content = `<h2>${item.title} buildings are <br>not allowed.</h2>`
|
|
726
|
+
}
|
|
727
|
+
return content
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
const getPsBarChartWidth = (key, value) => {
|
|
731
|
+
const max = Math.max(...getRows.value.map((item) => item.data[key]))
|
|
732
|
+
return (value * 100) / max
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
const setVerticalStyleWhenScroolingForFlexibleLayout = (tableWrapper) => {
|
|
736
|
+
if (tableWrapper.scrollTop > 0 && tableWrapper.classList.contains('table-flexible')) {
|
|
737
|
+
tableWrapper.getElementsByTagName('thead')[0].style.boxShadow = '0px 0px 8px rgba(0, 0, 0, 0.04), 0px 2px 5px rgba(0, 0, 0, 0.08)'
|
|
738
|
+
} else if (tableWrapper.classList.contains('table-flexible')) {
|
|
739
|
+
tableWrapper.getElementsByTagName('thead')[0].style.boxShadow = '0 0 0 rgba(0, 0, 0, 0)'
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const setHorizontalStyleWhenScrollingForFlexibleLayout = (tableWrapper) => {
|
|
744
|
+
const firstHeaderElement = tableWrapper.querySelector('thead > tr:first-child > th:first-child')
|
|
745
|
+
const secondHeaderElment = tableWrapper.querySelector('thead > tr:not(:first-of-type) > th:nth-child(3)')
|
|
746
|
+
const getAllOtherBodyElements = tableWrapper.querySelectorAll('tbody > tr > td:nth-child(3)')
|
|
747
|
+
if (tableWrapper.scrollLeft > 0 && tableWrapper.classList.contains('table-flexible')) {
|
|
748
|
+
firstHeaderElement.classList.add('pseudo-line')
|
|
749
|
+
secondHeaderElment.style.boxShadow = 'inset -1px 0px 0px #D6DDE5'
|
|
750
|
+
getAllOtherBodyElements.forEach((element) => {
|
|
751
|
+
element.style.boxShadow = 'inset -1px 0px 0px #D6DDE5'
|
|
752
|
+
})
|
|
753
|
+
} else if (tableWrapper.classList.contains('table-flexible')) {
|
|
754
|
+
firstHeaderElement.classList.remove('pseudo-line')
|
|
755
|
+
secondHeaderElment.style.boxShadow = '0 0 0 rgba(0, 0, 0, 0)'
|
|
756
|
+
getAllOtherBodyElements.forEach((element) => {
|
|
757
|
+
element.style.boxShadow = '0 0 0 rgba(0, 0, 0, 0)'
|
|
758
|
+
})
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
const handleTableScroll = () => {
|
|
763
|
+
setVerticalStyleWhenScroolingForFlexibleLayout(tableWrapper.value)
|
|
764
|
+
setHorizontalStyleWhenScrollingForFlexibleLayout(tableWrapper.value)
|
|
765
|
+
if (tableWrapper.value.scrollLeft > 0) {
|
|
766
|
+
isSticky.value = true
|
|
767
|
+
} else {
|
|
768
|
+
isSticky.value = false
|
|
769
|
+
}
|
|
750
770
|
}
|
|
751
771
|
</script>
|
|
752
|
-
|
|
772
|
+
|
|
773
|
+
<style>
|
|
774
|
+
/* Please, use the file src/assets/scss/components/PsTableResults.scss */
|
|
775
|
+
</style>
|