@policystudio/policy-studio-ui-vue 1.0.68 → 1.0.70
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/.storybook/PolicyStudio.js +11 -0
- package/.storybook/main.js +6 -0
- package/.storybook/manager.js +6 -0
- package/dist/css/psui_styles.css +565 -343
- package/package.json +4 -2
- package/src/assets/images/policy-studio.svg +15 -0
- package/src/assets/scss/base.scss +26 -1
- package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
- package/src/assets/scss/components/PsHighlightRippleDot.scss +38 -38
- package/src/assets/scss/components/PsProgressBar.scss +32 -19
- package/src/assets/scss/components/PsTableResults.scss +96 -0
- package/src/assets/scss/components/_PsTableResults.scss +68 -0
- package/src/components/accordion/PsAccordionItem.vue +1 -0
- package/src/components/badges-and-tags/PsProgressBar.vue +71 -36
- package/src/components/controls/PsDraggable.vue +1 -1
- package/src/components/table-results/PsTableResults.vue +247 -0
- package/src/components/table-results/PsTableResultsBody.vue +98 -0
- package/src/components/table-results/PsTableResultsHead.vue +109 -0
- package/src/components/table-results/PsTableResultsRow.vue +86 -0
- package/src/index.js +12 -0
- package/src/stories/Draggable.stories.js +1 -1
- package/src/stories/Dropdown.stories.js +65 -65
- package/src/stories/Input.stories.js +0 -3
- package/src/stories/ProgressBar.stories.js +3 -3
- package/src/stories/TableResults.stories.js +1291 -0
- package/tailwind.config.js +3 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="psui-w-full psui-whitespace-no-wrap psui-flex psui-overflow-auto">
|
|
3
|
+
<table
|
|
4
|
+
ref="table"
|
|
5
|
+
class="psui-el-table-results"
|
|
6
|
+
>
|
|
7
|
+
<slot name="header"></slot>
|
|
8
|
+
|
|
9
|
+
<!-- <slot name="body"></slot> -->
|
|
10
|
+
|
|
11
|
+
<tbody>
|
|
12
|
+
<tr
|
|
13
|
+
v-for="(item, index) in getRows"
|
|
14
|
+
:key="index"
|
|
15
|
+
:class="[
|
|
16
|
+
{
|
|
17
|
+
'psui-font-bold psui-text-gray-80' : item.type == 'total',
|
|
18
|
+
'psui-hidden' : checkIndexIsHidden(item),
|
|
19
|
+
'cell-pb-20 psui-text-red-70' : item.type == 'vintage' && !checkItemIsVisible(item) || item.type == 'study_data' && item.is_last,
|
|
20
|
+
'is-last' : item.is_last
|
|
21
|
+
},
|
|
22
|
+
`type-${item.type}`
|
|
23
|
+
]"
|
|
24
|
+
>
|
|
25
|
+
<td>
|
|
26
|
+
<div
|
|
27
|
+
class="actions psui-space-x-3"
|
|
28
|
+
:class="{ 'psui-ml-8' : item.type == 'study_data' }"
|
|
29
|
+
:style="{ paddingLeft: `${item.deep * 20}px` }"
|
|
30
|
+
>
|
|
31
|
+
<PsIcon
|
|
32
|
+
v-if="item.deep > 0 && !item.last_deep || item.type === 'total'"
|
|
33
|
+
icon="expand_more"
|
|
34
|
+
size="24"
|
|
35
|
+
class="psui-cursor-pointer psui-transform psui-transition"
|
|
36
|
+
icon-classes="psui-text-gray-40 psui-leading-none"
|
|
37
|
+
:style="{ display: 'flex' }"
|
|
38
|
+
:class="checkItemIsVisible(item) ? 'psui-rotate-0' : 'psui--rotate-90'"
|
|
39
|
+
@click.native="$emit('collapse-row', item)"
|
|
40
|
+
/>
|
|
41
|
+
<PsRichTooltip
|
|
42
|
+
v-if="item.is_disabled"
|
|
43
|
+
layout="gray"
|
|
44
|
+
position="top"
|
|
45
|
+
class="psui-inline-flex psui-cursor-default"
|
|
46
|
+
>
|
|
47
|
+
<template v-slot:trigger>
|
|
48
|
+
<p class="title psui-text-gray-50">{{ item.title }}</p>
|
|
49
|
+
</template>
|
|
50
|
+
<template v-slot:content>
|
|
51
|
+
<p class="psui-font-bold psui-text-gray-80 psui-text-xsmall">
|
|
52
|
+
{{ item.title }} buildings are <br>not allowed.
|
|
53
|
+
</p>
|
|
54
|
+
</template>
|
|
55
|
+
</PsRichTooltip>
|
|
56
|
+
<p
|
|
57
|
+
v-else
|
|
58
|
+
class="title"
|
|
59
|
+
:class="{ 'psui-font-bold' : item.type == 'total' }"
|
|
60
|
+
>
|
|
61
|
+
{{ item.title }}
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
</td>
|
|
65
|
+
|
|
66
|
+
<template
|
|
67
|
+
v-for="(columnGroup, indexColumn) of columnGroups"
|
|
68
|
+
>
|
|
69
|
+
<td
|
|
70
|
+
v-for="column of columnGroup.columns"
|
|
71
|
+
:key="indexColumn + '-' + columnGroup.key + '-' + column.key"
|
|
72
|
+
>
|
|
73
|
+
<div class="psui-space-x-2 psui-show-childrens-on-hover">
|
|
74
|
+
<PsIcon
|
|
75
|
+
v-if="column.hasProjections && !item.is_disabled"
|
|
76
|
+
icon="bar_chart"
|
|
77
|
+
size="16"
|
|
78
|
+
class="psui-cursor-pointer"
|
|
79
|
+
icon-classes="psui-text-blue-60 psui-opacity-0 psui-leading-none psui-transition"
|
|
80
|
+
:style="{ display: 'flex' }"
|
|
81
|
+
@click.native="$emit('policy-selected', { item, column })"
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<p v-if="formatFunction && !item.is_disabled">{{ formatFunction(column.key, item.data[column.key], item.data) }}</p>
|
|
85
|
+
<p
|
|
86
|
+
v-else-if="item.is_disabled"
|
|
87
|
+
class="psui-text-gray-50"
|
|
88
|
+
>
|
|
89
|
+
--
|
|
90
|
+
</p>
|
|
91
|
+
<p v-else>{{ item.data[column.key] }}</p>
|
|
92
|
+
|
|
93
|
+
<PsProgressBar
|
|
94
|
+
v-if="column.isChart"
|
|
95
|
+
:value="!item.is_disabled ? item.data[column.key] : 0"
|
|
96
|
+
:force-break-even="item.is_disabled ? true : false"
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
</td>
|
|
100
|
+
</template>
|
|
101
|
+
</tr>
|
|
102
|
+
</tbody>
|
|
103
|
+
|
|
104
|
+
<!-- <slot name="footer"></slot> -->
|
|
105
|
+
</table>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<script>
|
|
110
|
+
import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
|
|
111
|
+
import PsIcon from '../ui/PsIcon.vue'
|
|
112
|
+
import PsProgressBar from '../badges-and-tags/PsProgressBar.vue'
|
|
113
|
+
export default {
|
|
114
|
+
name: 'PsTableResults',
|
|
115
|
+
components: { PsProgressBar, PsIcon, PsRichTooltip },
|
|
116
|
+
props: {
|
|
117
|
+
/**
|
|
118
|
+
* It sets the format function to display values.
|
|
119
|
+
*/
|
|
120
|
+
formatFunction: {
|
|
121
|
+
type: Function
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* It sets the hidden items.
|
|
125
|
+
*/
|
|
126
|
+
hiddenItems: {
|
|
127
|
+
type: Array,
|
|
128
|
+
default() {
|
|
129
|
+
return []
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* It sets the hidden items index.
|
|
134
|
+
*/
|
|
135
|
+
itemsHiddenIndexes: {
|
|
136
|
+
type: Array,
|
|
137
|
+
default() {
|
|
138
|
+
return []
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* It sets the values which will be use to render the body.
|
|
143
|
+
*/
|
|
144
|
+
summaryData: {
|
|
145
|
+
type: Array,
|
|
146
|
+
default() {
|
|
147
|
+
return []
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* It sets the values which will be use to render the body.
|
|
152
|
+
*/
|
|
153
|
+
columnGroups: {
|
|
154
|
+
type: Array,
|
|
155
|
+
default() {
|
|
156
|
+
return []
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* It sets the values which will be use to render the body.
|
|
161
|
+
*/
|
|
162
|
+
rows: {
|
|
163
|
+
type: Array,
|
|
164
|
+
default() {
|
|
165
|
+
return []
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* It sets a close button if needed.
|
|
170
|
+
*/
|
|
171
|
+
isCollapsible: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: true
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* It sets additional styling if needed.
|
|
177
|
+
*/
|
|
178
|
+
cssStyle: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: 'psui-text-gray-60'
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
computed: {
|
|
184
|
+
cssAlign() {
|
|
185
|
+
if (this.align === 'right') return `psui-text-right ${this.cssStyle}`
|
|
186
|
+
if (this.align === 'center') return `psui-text-center ${this.cssStyle}`
|
|
187
|
+
return `psui-text-left ${this.cssStyle}`
|
|
188
|
+
},
|
|
189
|
+
getRows() {
|
|
190
|
+
const rows = []
|
|
191
|
+
for (let index = 0; index < this.summaryData.length; index++) {
|
|
192
|
+
const item = this.summaryData[index]
|
|
193
|
+
this.addRow(item, 0, `${index}`, rows)
|
|
194
|
+
}
|
|
195
|
+
return rows
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
methods: {
|
|
199
|
+
addRow(item, deep = 0, index, rows) {
|
|
200
|
+
item.deep = deep
|
|
201
|
+
item.index = index
|
|
202
|
+
rows.push(item)
|
|
203
|
+
item.last_deep = item.items ? false : true
|
|
204
|
+
if (item.items) {
|
|
205
|
+
const items_child = [...item.items]
|
|
206
|
+
for (let indexChild = 0; indexChild < items_child.length; indexChild++) {
|
|
207
|
+
const item_child = items_child[indexChild]
|
|
208
|
+
item_child.is_last = indexChild + 1 === items_child.length ? true : false
|
|
209
|
+
this.addRow(item_child, deep + 1, `${index}-${indexChild}`, rows)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
checkItemIsVisible(item) {
|
|
214
|
+
return this.hiddenItems.indexOf(item) < 0
|
|
215
|
+
},
|
|
216
|
+
checkIndexIsHidden(item) {
|
|
217
|
+
let isHidden = false
|
|
218
|
+
for (let index = 0; index < this.itemsHiddenIndexes.length; index++) {
|
|
219
|
+
const item_hidden = this.itemsHiddenIndexes[index]
|
|
220
|
+
if (item.index.startsWith(`${item_hidden}-`)) {
|
|
221
|
+
isHidden = true
|
|
222
|
+
break
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return isHidden
|
|
226
|
+
},
|
|
227
|
+
onCollapse(item) {
|
|
228
|
+
const index = this.itemsHiddenIndexes.indexOf(item)
|
|
229
|
+
if(index > -1) {
|
|
230
|
+
this.itemsHiddenIndexes.splice(index, 1)
|
|
231
|
+
} else {
|
|
232
|
+
this.itemsHiddenIndexes.push(item)
|
|
233
|
+
}
|
|
234
|
+
this.$emit('click')
|
|
235
|
+
},
|
|
236
|
+
progressBarBreakEven(columnKey) {
|
|
237
|
+
const data = this.formatFunction(columnKey, this.item.data[columnKey], this.item.data)
|
|
238
|
+
console.log('data:', data)
|
|
239
|
+
if (Number(data) === 0 || data === '--') {
|
|
240
|
+
return this.item.data[columnKey]
|
|
241
|
+
}
|
|
242
|
+
return 1
|
|
243
|
+
},
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
</script>
|
|
247
|
+
<style> /* Please, use the file src/assets/scss/components/PsTableResults.scss */ </style>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tbody>
|
|
3
|
+
<tr
|
|
4
|
+
v-for="(row, index) in getRows"
|
|
5
|
+
:key="index"
|
|
6
|
+
>
|
|
7
|
+
<td>
|
|
8
|
+
<p class="title">{{ row.title }}</p>
|
|
9
|
+
</td>
|
|
10
|
+
|
|
11
|
+
<template
|
|
12
|
+
v-for="(columnGroup, indexColumn) of columnGroups"
|
|
13
|
+
>
|
|
14
|
+
<td
|
|
15
|
+
v-for="column of columnGroup.columns"
|
|
16
|
+
:key="indexColumn + '-' + columnGroup.key + '-' + column.key"
|
|
17
|
+
>
|
|
18
|
+
<!-- <pre>{{ column }}</pre> -->
|
|
19
|
+
<p>{{ column.title }}</p>
|
|
20
|
+
</td>
|
|
21
|
+
</template>
|
|
22
|
+
</tr>
|
|
23
|
+
</tbody>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: 'PsTableResultsBody',
|
|
29
|
+
props: {
|
|
30
|
+
/**
|
|
31
|
+
* It sets the values which will be use to render the body.
|
|
32
|
+
*/
|
|
33
|
+
summaryData: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default() {
|
|
36
|
+
return []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* It sets the values which will be use to render the body.
|
|
41
|
+
*/
|
|
42
|
+
columnGroups: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default() {
|
|
45
|
+
return []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* It sets the values which will be use to render the body.
|
|
50
|
+
*/
|
|
51
|
+
rows: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default() {
|
|
54
|
+
return []
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* It sets additional styling if needed.
|
|
59
|
+
*/
|
|
60
|
+
cssStyle: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'psui-text-gray-60'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
cssAlign() {
|
|
67
|
+
if (this.align === 'right') return `psui-text-right ${this.cssStyle}`
|
|
68
|
+
if (this.align === 'center') return `psui-text-center ${this.cssStyle}`
|
|
69
|
+
return `psui-text-left ${this.cssStyle}`
|
|
70
|
+
},
|
|
71
|
+
getRows() {
|
|
72
|
+
const rows = []
|
|
73
|
+
for (let index = 0; index < this.summaryData.length; index++) {
|
|
74
|
+
const item = this.summaryData[index]
|
|
75
|
+
this.addRow(item, 0, `${index}`, rows)
|
|
76
|
+
}
|
|
77
|
+
return rows
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
methods: {
|
|
81
|
+
addRow(item, deep = 0, index, rows) {
|
|
82
|
+
item.deep = deep
|
|
83
|
+
item.index = index
|
|
84
|
+
rows.push(item)
|
|
85
|
+
item.last_deep = item.items ? false : true
|
|
86
|
+
if (item.items) {
|
|
87
|
+
const items_child = [...item.items]
|
|
88
|
+
for (let indexChild = 0; indexChild < items_child.length; indexChild++) {
|
|
89
|
+
const item_child = items_child[indexChild]
|
|
90
|
+
item_child.is_last = indexChild + 1 === items_child.length ? true : false
|
|
91
|
+
this.addRow(item_child, deep + 1, `${index}-${indexChild}`, rows)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</script>
|
|
98
|
+
<style> /* Please, use the file src/assets/scss/components/PsTableResults.scss */ </style>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<thead>
|
|
3
|
+
<tr>
|
|
4
|
+
<th>
|
|
5
|
+
<div>
|
|
6
|
+
<p class="title">Measures & Packages</p>
|
|
7
|
+
</div>
|
|
8
|
+
</th>
|
|
9
|
+
|
|
10
|
+
<th
|
|
11
|
+
v-for="columnGroup of header"
|
|
12
|
+
:key="columnGroup.key"
|
|
13
|
+
:colspan="columnGroup.columns.reduce( (prev, cur) => cur.isActive ? prev + 1 : prev, 0 )"
|
|
14
|
+
>
|
|
15
|
+
<div class="psui-space-x-1 psui-items-center psui-show-childrens-on-hover">
|
|
16
|
+
<p class="title">{{ columnGroup.title }}</p>
|
|
17
|
+
<PsIcon
|
|
18
|
+
icon="info"
|
|
19
|
+
size="18"
|
|
20
|
+
class="psui-cursor-pointer"
|
|
21
|
+
icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
|
|
22
|
+
:style="{ display: 'flex' }"
|
|
23
|
+
@click.native="$emit('click-column-group-helper', columnGroup, $event)"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
</th>
|
|
27
|
+
</tr>
|
|
28
|
+
|
|
29
|
+
<tr>
|
|
30
|
+
<th>
|
|
31
|
+
<div>
|
|
32
|
+
<p class="description">Select the measures you want to combine <br />to create your policy.</p>
|
|
33
|
+
</div>
|
|
34
|
+
</th>
|
|
35
|
+
|
|
36
|
+
<template v-for="columnGroup of header">
|
|
37
|
+
<th
|
|
38
|
+
v-for="column of columnGroup.columns"
|
|
39
|
+
:key="`${columnGroup.key}-${column.key}`"
|
|
40
|
+
>
|
|
41
|
+
<div class="psui-flex psui-flex-col">
|
|
42
|
+
<div class="psui-flex psui-flex-row psui-space-x-1 psui-items-center psui-justify-end psui-show-childrens-on-hover psui-mb-px">
|
|
43
|
+
<PsIcon
|
|
44
|
+
v-if="showOrder"
|
|
45
|
+
:icon="orderDirection == 'asc' ? 'arrow_downward' : 'arrow_upward'"
|
|
46
|
+
:type="orderDirection == 'asc' ? 'arrow_upward' : 'arrow_upward'"
|
|
47
|
+
size="16"
|
|
48
|
+
class="psui-cursor-pointer"
|
|
49
|
+
icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
|
|
50
|
+
:style="{ display: 'flex' }"
|
|
51
|
+
@click.native="$emit('click-order-column', column)"
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<PsIcon
|
|
55
|
+
icon="info"
|
|
56
|
+
size="16"
|
|
57
|
+
class="psui-cursor-pointer"
|
|
58
|
+
icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
|
|
59
|
+
:style="{ display: 'flex' }"
|
|
60
|
+
@click.native="$emit('click-column-helper', column, $event)"
|
|
61
|
+
/>
|
|
62
|
+
<p class="title" v-if="column.title">{{ column.title }}</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p class="description" v-if="column.description">{{ column.description }}</p>
|
|
65
|
+
</div>
|
|
66
|
+
</th>
|
|
67
|
+
</template>
|
|
68
|
+
</tr>
|
|
69
|
+
</thead>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script>
|
|
73
|
+
import PsIcon from '../ui/PsIcon.vue'
|
|
74
|
+
export default {
|
|
75
|
+
name: 'PsTableResultsHead',
|
|
76
|
+
components: { PsIcon },
|
|
77
|
+
props: {
|
|
78
|
+
/**
|
|
79
|
+
* It sets the values which will be use to render the header.
|
|
80
|
+
*/
|
|
81
|
+
header: {
|
|
82
|
+
type: Array,
|
|
83
|
+
required: true,
|
|
84
|
+
default: () => {
|
|
85
|
+
return []
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* this sets whether sorting will be displayed.
|
|
90
|
+
*/
|
|
91
|
+
showOrder: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
computed: {
|
|
97
|
+
columnsSelectedForStudy() {
|
|
98
|
+
return this.$parent.columnsSelectedForStudy
|
|
99
|
+
},
|
|
100
|
+
orderColumn() {
|
|
101
|
+
return this.$parent.orderColumn
|
|
102
|
+
},
|
|
103
|
+
orderDirection() {
|
|
104
|
+
return this.$parent.orderDirection
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
<style> /* Please, use the file src/assets/scss/components/PsTableResults.scss */ </style>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tbody>
|
|
3
|
+
<tr
|
|
4
|
+
v-for="(row, index) in getRows"
|
|
5
|
+
:key="index"
|
|
6
|
+
>
|
|
7
|
+
<td>
|
|
8
|
+
<p class="title">{{ row.title }}</p>
|
|
9
|
+
</td>
|
|
10
|
+
|
|
11
|
+
<template
|
|
12
|
+
v-for="(columnGroup, indexColumn) of columnGroups"
|
|
13
|
+
>
|
|
14
|
+
<td
|
|
15
|
+
v-for="column of columnGroup.columns"
|
|
16
|
+
:key="indexColumn + '-' + columnGroup.key + '-' + column.key"
|
|
17
|
+
>
|
|
18
|
+
<!-- <pre>{{ column }}</pre> -->
|
|
19
|
+
<p>{{ row.data[column.key] }}</p>
|
|
20
|
+
</td>
|
|
21
|
+
</template>
|
|
22
|
+
</tr>
|
|
23
|
+
</tbody>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
export default {
|
|
28
|
+
name: 'PsTableResultsRow',
|
|
29
|
+
props: {
|
|
30
|
+
/**
|
|
31
|
+
* It sets the values which will be use to render the body.
|
|
32
|
+
*/
|
|
33
|
+
summaryData: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default() {
|
|
36
|
+
return []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* It sets the values which will be use to render the body.
|
|
41
|
+
*/
|
|
42
|
+
columnGroups: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default() {
|
|
45
|
+
return []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* It sets the values which will be use to render the body.
|
|
50
|
+
*/
|
|
51
|
+
rows: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default() {
|
|
54
|
+
return []
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
computed: {
|
|
59
|
+
getRows() {
|
|
60
|
+
const rows = []
|
|
61
|
+
for (let index = 0; index < this.summaryData.length; index++) {
|
|
62
|
+
const item = this.summaryData[index]
|
|
63
|
+
this.addRow(item, 0, `${index}`, rows)
|
|
64
|
+
}
|
|
65
|
+
return rows
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
addRow(item, deep = 0, index, rows) {
|
|
70
|
+
item.deep = deep
|
|
71
|
+
item.index = index
|
|
72
|
+
rows.push(item)
|
|
73
|
+
item.last_deep = item.items ? false : true
|
|
74
|
+
if (item.items) {
|
|
75
|
+
const items_child = [...item.items]
|
|
76
|
+
for (let indexChild = 0; indexChild < items_child.length; indexChild++) {
|
|
77
|
+
const item_child = items_child[indexChild]
|
|
78
|
+
item_child.is_last = indexChild + 1 === items_child.length ? true : false
|
|
79
|
+
this.addRow(item_child, deep + 1, `${index}-${indexChild}`, rows)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
<style> /* Please, use the file src/assets/scss/components/PsTableResults.scss */ </style>
|
package/src/index.js
CHANGED
|
@@ -17,6 +17,9 @@ import PsAccordionItem from './components/accordion/PsAccordionItem.vue'
|
|
|
17
17
|
import PsChips from './components/chips/PsChips.vue'
|
|
18
18
|
import PsDataTable from './components/datatable/PsDataTable.vue'
|
|
19
19
|
import PsDataTableItem from './components/datatable/PsDataTableItem.vue'
|
|
20
|
+
import PsTableResults from './components/table-results/PsTableResults.vue'
|
|
21
|
+
import PsTableResultsHead from './components/table-results/PsTableResultsHead.vue'
|
|
22
|
+
import PsTableResultsBody from './components/table-results/PsTableResultsBody.vue'
|
|
20
23
|
import PsIcon from './components/ui/PsIcon.vue'
|
|
21
24
|
import PsDotLoader from './components/ui/PsDotLoader.vue'
|
|
22
25
|
import PsTooltip from './components/tooltip/PsTooltip.vue'
|
|
@@ -30,6 +33,7 @@ import PsScrollBar from './components/playground/PsScrollBar.vue'
|
|
|
30
33
|
import PsMiniTag from './components/badges-and-tags/PsMiniTag.vue'
|
|
31
34
|
import PsCheckboxSimple from './components/controls/PsCheckboxSimple.vue'
|
|
32
35
|
import PsBadgeWithIcon from './components/badges-and-tags/PsBadgeWithIcon.vue'
|
|
36
|
+
import PsProgressBar from './components/badges-and-tags/PsProgressBar.vue'
|
|
33
37
|
import PsRadioButtonSimple from './components/controls/PsRadioButtonSimple.vue'
|
|
34
38
|
|
|
35
39
|
|
|
@@ -51,6 +55,9 @@ export default {
|
|
|
51
55
|
Vue.component('PsChips', PsChips)
|
|
52
56
|
Vue.component('PsDataTable', PsDataTable)
|
|
53
57
|
Vue.component('PsDataTableItem', PsDataTableItem)
|
|
58
|
+
Vue.component('PsTableResults', PsTableResults)
|
|
59
|
+
Vue.component('PsTableResultsHead', PsTableResultsHead)
|
|
60
|
+
Vue.component('PsTableResultsBody', PsTableResultsBody)
|
|
54
61
|
Vue.component('PsIcon', PsIcon)
|
|
55
62
|
Vue.component('PsDotLoader', PsDotLoader)
|
|
56
63
|
Vue.component('PsTooltip', PsTooltip)
|
|
@@ -68,6 +75,7 @@ export default {
|
|
|
68
75
|
Vue.component('PsMiniTag', PsMiniTag)
|
|
69
76
|
Vue.component('PsCheckboxSimple', PsCheckboxSimple)
|
|
70
77
|
Vue.component('PsBadgeWithIcon', PsBadgeWithIcon)
|
|
78
|
+
Vue.component('PsProgressBar', PsProgressBar)
|
|
71
79
|
Vue.component('PsRadioButtonSimple', PsRadioButtonSimple)
|
|
72
80
|
|
|
73
81
|
Vue.directive('click-outside', {
|
|
@@ -104,6 +112,9 @@ export {
|
|
|
104
112
|
PsChips,
|
|
105
113
|
PsDataTable,
|
|
106
114
|
PsDataTableItem,
|
|
115
|
+
PsTableResults,
|
|
116
|
+
PsTableResultsHead,
|
|
117
|
+
PsTableResultsBody,
|
|
107
118
|
PsIcon,
|
|
108
119
|
PsDotLoader,
|
|
109
120
|
PsTooltip,
|
|
@@ -121,6 +132,7 @@ export {
|
|
|
121
132
|
PsMiniTag,
|
|
122
133
|
PsCheckboxSimple,
|
|
123
134
|
PsBadgeWithIcon,
|
|
135
|
+
PsProgressBar,
|
|
124
136
|
PsRadioButtonSimple
|
|
125
137
|
}
|
|
126
138
|
|