@policystudio/policy-studio-ui-vue 1.0.69 → 1.0.71
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/dist/css/psui_styles.css +7 -1
- package/package.json +1 -1
- package/src/assets/scss/components/PsTableResults.scss +5 -1
- package/src/components/badges-and-tags/PsProgressBar.vue +7 -1
- package/src/components/forms/PsInput.vue +8 -0
- package/src/components/table-results/PsTableResults.vue +77 -21
- package/src/stories/TableResults.stories.js +524 -5939
package/dist/css/psui_styles.css
CHANGED
|
@@ -18578,7 +18578,6 @@ html {
|
|
|
18578
18578
|
padding-left: 0;
|
|
18579
18579
|
padding-right: 2rem;
|
|
18580
18580
|
text-align: left;
|
|
18581
|
-
display: block;
|
|
18582
18581
|
background-color: #ffffff ;
|
|
18583
18582
|
position: sticky;
|
|
18584
18583
|
z-index: 10;
|
|
@@ -18639,6 +18638,13 @@ html {
|
|
|
18639
18638
|
align-items: center;
|
|
18640
18639
|
}
|
|
18641
18640
|
|
|
18641
|
+
.psui-el-table-results tbody tr td .actions {
|
|
18642
|
+
display: flex;
|
|
18643
|
+
align-items: center;
|
|
18644
|
+
height: 100%;
|
|
18645
|
+
position: relative;
|
|
18646
|
+
}
|
|
18647
|
+
|
|
18642
18648
|
.psui-el-table-results tbody tr td:not(:first-child) > div {
|
|
18643
18649
|
justify-content: flex-end;
|
|
18644
18650
|
}
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&:first-child {
|
|
25
|
-
@apply .psui-pl-0 .psui-pr-8 .psui-text-left .psui-
|
|
25
|
+
@apply .psui-pl-0 .psui-pr-8 .psui-text-left .psui-bg-white .psui-sticky .psui-z-10 .psui-left-0;
|
|
26
26
|
box-shadow: inset -1px 0px 0px #EBEEF0;
|
|
27
27
|
min-width: 300px;
|
|
28
28
|
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
@apply .psui-flex .psui-items-center;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
.actions {
|
|
70
|
+
@apply .psui-flex .psui-items-center .psui-h-full .psui-relative;
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
&:not(:first-child) {
|
|
70
74
|
> div {
|
|
71
75
|
@apply .psui-justify-end;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<div class="psui-el-progress-bar-bg" />
|
|
8
8
|
<div
|
|
9
9
|
class="psui-el-progress-bar-value"
|
|
10
|
-
:class="[getBg, {'rounded-tr-full rounded-br-full': getProgressWidth === '100%'}]"
|
|
10
|
+
:class="[getBg, {'rounded-tr-full rounded-br-full': getProgressWidth === '100%'}]"
|
|
11
11
|
:style="{ width: getProgressWidth }"
|
|
12
12
|
/>
|
|
13
13
|
<div
|
|
@@ -37,6 +37,10 @@ export default {
|
|
|
37
37
|
type: Number,
|
|
38
38
|
default: 1
|
|
39
39
|
},
|
|
40
|
+
forceBreakEven: {
|
|
41
|
+
Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
40
44
|
value: {
|
|
41
45
|
type: [String, Number],
|
|
42
46
|
default: null
|
|
@@ -63,12 +67,14 @@ export default {
|
|
|
63
67
|
return `${this.getProgress}%`
|
|
64
68
|
},
|
|
65
69
|
getIsBreakEven() {
|
|
70
|
+
if ( this.forceBreakEven ) return true
|
|
66
71
|
return this.value >= this.breakEven ? true : false
|
|
67
72
|
},
|
|
68
73
|
getBreakEvenLeft() {
|
|
69
74
|
return `${(100 / this.getVolume) * this.breakEven}%`
|
|
70
75
|
},
|
|
71
76
|
getBg() {
|
|
77
|
+
if ( this.forceBreakEven ) return this.positiveBg
|
|
72
78
|
return this.getIsBreakEven ? this.positiveBg : this.negativeBg
|
|
73
79
|
}
|
|
74
80
|
}
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
:placeholder="placeholder"
|
|
19
19
|
:disabled="disabled"
|
|
20
20
|
:value="value"
|
|
21
|
+
:min="minValue"
|
|
22
|
+
:max="maxValue"
|
|
21
23
|
@focus="onInputFocus"
|
|
22
24
|
@blur="onInputBlur"
|
|
23
25
|
@input="$emit('input', $event)"
|
|
@@ -105,6 +107,12 @@ export default {
|
|
|
105
107
|
type: Boolean,
|
|
106
108
|
default: false
|
|
107
109
|
},
|
|
110
|
+
minValue: {
|
|
111
|
+
type: Number
|
|
112
|
+
},
|
|
113
|
+
maxValue: {
|
|
114
|
+
type: Number
|
|
115
|
+
}
|
|
108
116
|
},
|
|
109
117
|
data: () => ({
|
|
110
118
|
isFocus: false,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="psui-w-full psui-whitespace-no-wrap psui-flex psui-overflow-auto">
|
|
3
|
-
<table
|
|
3
|
+
<table
|
|
4
|
+
ref="table"
|
|
5
|
+
class="psui-el-table-results"
|
|
6
|
+
>
|
|
4
7
|
<slot name="header"></slot>
|
|
5
8
|
|
|
6
9
|
<!-- <slot name="body"></slot> -->
|
|
@@ -11,8 +14,7 @@
|
|
|
11
14
|
:key="index"
|
|
12
15
|
:class="[
|
|
13
16
|
{
|
|
14
|
-
'
|
|
15
|
-
'psui-text-blue-80' : item.type == 'vintage',
|
|
17
|
+
'psui-font-bold psui-text-gray-80' : item.type == 'total',
|
|
16
18
|
'psui-hidden' : checkIndexIsHidden(item),
|
|
17
19
|
'cell-pb-20 psui-text-red-70' : item.type == 'vintage' && !checkItemIsVisible(item) || item.type == 'study_data' && item.is_last,
|
|
18
20
|
'is-last' : item.is_last
|
|
@@ -22,19 +24,42 @@
|
|
|
22
24
|
>
|
|
23
25
|
<td>
|
|
24
26
|
<div
|
|
25
|
-
class="actions psui-
|
|
27
|
+
class="actions psui-space-x-3"
|
|
28
|
+
:class="{ 'psui-ml-8' : item.type == 'study_data' }"
|
|
26
29
|
:style="{ paddingLeft: `${item.deep * 20}px` }"
|
|
27
30
|
>
|
|
28
31
|
<PsIcon
|
|
29
|
-
v-if="
|
|
30
|
-
|
|
32
|
+
v-if="item.deep > 0 && !item.last_deep || item.type === 'total'"
|
|
33
|
+
icon="expand_more"
|
|
31
34
|
size="24"
|
|
32
|
-
class="psui-cursor-pointer"
|
|
33
|
-
icon-classes="psui-text-gray-40 psui-leading-none
|
|
35
|
+
class="psui-cursor-pointer psui-transform psui-transition"
|
|
36
|
+
icon-classes="psui-text-gray-40 psui-leading-none"
|
|
34
37
|
:style="{ display: 'flex' }"
|
|
35
|
-
|
|
38
|
+
:class="checkItemIsVisible(item) ? 'psui-rotate-0' : 'psui--rotate-90'"
|
|
39
|
+
@click.native="$emit('collapse-row', item)"
|
|
36
40
|
/>
|
|
37
|
-
<
|
|
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>
|
|
38
63
|
</div>
|
|
39
64
|
</td>
|
|
40
65
|
|
|
@@ -47,20 +72,28 @@
|
|
|
47
72
|
>
|
|
48
73
|
<div class="psui-space-x-2 psui-show-childrens-on-hover">
|
|
49
74
|
<PsIcon
|
|
50
|
-
v-if="column.hasProjections"
|
|
75
|
+
v-if="column.hasProjections && !item.is_disabled"
|
|
51
76
|
icon="bar_chart"
|
|
52
77
|
size="16"
|
|
53
78
|
class="psui-cursor-pointer"
|
|
54
79
|
icon-classes="psui-text-blue-60 psui-opacity-0 psui-leading-none psui-transition"
|
|
55
80
|
:style="{ display: 'flex' }"
|
|
56
|
-
@click.native="$emit('
|
|
81
|
+
@click.native="$emit('policy-selected', { item, column })"
|
|
57
82
|
/>
|
|
58
83
|
|
|
59
|
-
<p>{{ item.data[column.key].
|
|
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>
|
|
60
92
|
|
|
61
93
|
<PsProgressBar
|
|
62
94
|
v-if="column.isChart"
|
|
63
|
-
:value="item.data[column.key]"
|
|
95
|
+
:value="!item.is_disabled ? item.data[column.key] : 0"
|
|
96
|
+
:force-break-even="item.is_disabled ? true : false"
|
|
64
97
|
/>
|
|
65
98
|
</div>
|
|
66
99
|
</td>
|
|
@@ -74,12 +107,31 @@
|
|
|
74
107
|
</template>
|
|
75
108
|
|
|
76
109
|
<script>
|
|
110
|
+
import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
|
|
77
111
|
import PsIcon from '../ui/PsIcon.vue'
|
|
78
112
|
import PsProgressBar from '../badges-and-tags/PsProgressBar.vue'
|
|
79
113
|
export default {
|
|
80
114
|
name: 'PsTableResults',
|
|
81
|
-
components: { PsProgressBar, PsIcon },
|
|
115
|
+
components: { PsProgressBar, PsIcon, PsRichTooltip },
|
|
82
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
|
+
*/
|
|
83
135
|
itemsHiddenIndexes: {
|
|
84
136
|
type: Array,
|
|
85
137
|
default() {
|
|
@@ -127,10 +179,6 @@ export default {
|
|
|
127
179
|
type: String,
|
|
128
180
|
default: 'psui-text-gray-60'
|
|
129
181
|
},
|
|
130
|
-
testValue: {
|
|
131
|
-
type: String,
|
|
132
|
-
default: ''
|
|
133
|
-
}
|
|
134
182
|
},
|
|
135
183
|
computed: {
|
|
136
184
|
cssAlign() {
|
|
@@ -163,7 +211,7 @@ export default {
|
|
|
163
211
|
}
|
|
164
212
|
},
|
|
165
213
|
checkItemIsVisible(item) {
|
|
166
|
-
return this.
|
|
214
|
+
return this.hiddenItems.indexOf(item) < 0
|
|
167
215
|
},
|
|
168
216
|
checkIndexIsHidden(item) {
|
|
169
217
|
let isHidden = false
|
|
@@ -184,7 +232,15 @@ export default {
|
|
|
184
232
|
this.itemsHiddenIndexes.push(item)
|
|
185
233
|
}
|
|
186
234
|
this.$emit('click')
|
|
187
|
-
}
|
|
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
|
+
},
|
|
188
244
|
}
|
|
189
245
|
}
|
|
190
246
|
</script>
|