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