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