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