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