@policystudio/policy-studio-ui-vue 1.1.6 → 1.1.8

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.
@@ -6,116 +6,265 @@
6
6
  .psui-el-table-results {
7
7
  @apply psui-relative psui-align-top psui-w-full psui-max-w-full psui-text-p;
8
8
 
9
- tr {
10
- th, td {
11
- &:last-child {
12
- @apply psui-pr-2;
9
+ &.layout-results {
10
+ tr {
11
+ th, td {
12
+ &:last-child {
13
+ @apply psui-pr-2;
14
+ }
15
+ }
16
+ }
17
+
18
+ thead {
19
+ @apply psui-bg-white psui-items-start psui-shadow-elevation-10 psui-sticky psui-top-0 psui-z-15;
20
+
21
+ &:after {
22
+ content: '';
23
+ @apply psui-inline-block psui-absolute psui-top-0 psui-w-2 psui-h-full psui-bg-white;
24
+ right: -8px;
25
+ }
26
+
27
+ tr {
28
+ .title {
29
+ @apply psui-text-small psui-font-bold psui-leading-4 psui-text-gray-80;
30
+ }
31
+
32
+ th {
33
+ @apply psui-pl-6 psui-text-gray-50 psui-text-right psui-w-auto psui-align-top;
34
+ padding-top: 13px;
35
+ padding-bottom: 13px;
36
+
37
+ .description {
38
+ @apply psui-text-xsmall psui-font-normal;
39
+ line-height: 110%;
40
+ }
41
+
42
+ &:first-child {
43
+ @apply psui-pl-0 psui-pr-8 psui-text-left psui-bg-white psui-sticky psui-z-10 psui-left-0;
44
+ box-shadow: inset -1px 0px 0px #EBEEF0;
45
+ min-width: 300px;
46
+
47
+ > div {
48
+ @apply psui-pl-0;
49
+ }
50
+ }
51
+ }
52
+
53
+ &:first-of-type {
54
+ th {
55
+ @apply psui-text-left;
56
+ padding-top: 0;
57
+ padding-bottom: 0;
58
+
59
+ > div {
60
+ @apply psui-flex psui-flex-row psui-border-b psui-border-gray-30;
61
+ padding-top: 11px;
62
+ padding-bottom: 11px;
63
+ }
64
+ }
65
+
66
+ p {
67
+ @apply psui-text-p;
68
+ line-height: 18px;
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ tbody {
75
+ tr {
76
+ @apply psui-border-b psui-border-gray-20;
77
+
78
+ &.is-first {
79
+ .title {
80
+ @apply psui-font-bold psui-text-gray-80;
81
+ }
82
+ }
83
+
84
+ .title {
85
+ @apply psui-flex psui-items-center;
86
+ }
87
+
88
+ td {
89
+ @apply psui-pl-8 psui-text-gray-80 psui-h-10 psui-text-right psui-text-small;
90
+ padding-top: 11px;
91
+ padding-bottom: 11px;
92
+
93
+ > div {
94
+ @apply psui-flex psui-items-center;
95
+ }
96
+
97
+ .actions {
98
+ @apply psui-flex psui-items-center psui-h-full psui-relative;
99
+
100
+ &-button {
101
+ @apply psui-cursor-pointer psui-ml-1;
102
+ }
103
+
104
+ .is-last-deep {
105
+ @apply psui-pl-10;
106
+ }
107
+ }
108
+
109
+ &:not(:first-child) {
110
+ > div {
111
+ @apply psui-justify-end;
112
+ }
113
+ }
114
+
115
+ &:first-child {
116
+ @apply psui-pl-0 psui-pr-8 psui-text-left psui-block psui-bg-white psui-sticky psui-z-10 psui-left-0;
117
+ box-shadow: inset -1px 0px 0px #EBEEF0;
118
+ padding-top: 8px;
119
+ padding-bottom: 8px;
120
+ }
121
+ }
13
122
  }
14
123
  }
15
124
  }
16
125
 
17
- thead {
18
- @apply psui-bg-white psui-items-start psui-shadow-elevation-10 psui-sticky psui-top-0 psui-z-15;
19
-
20
- &:after {
21
- content: '';
22
- @apply psui-inline-block psui-absolute psui-top-0 psui-w-2 psui-h-full psui-bg-white;
23
- right: -8px;
24
- }
126
+ &.layout-comparison {
127
+ @apply psui-border-separate;
128
+ border-spacing: 2px 8px;
25
129
 
26
130
  tr {
27
- .title {
28
- @apply psui-text-small psui-font-bold psui-leading-4 psui-text-gray-80;
131
+ th, td {
132
+ @apply psui-relative;
29
133
  }
134
+ }
30
135
 
31
- th {
32
- @apply psui-pl-6 psui-text-gray-50 psui-text-right psui-w-auto psui-align-top;
33
- padding-top: 13px;
34
- padding-bottom: 13px;
136
+ thead {
137
+ @apply psui-bg-transparent psui-items-start;
35
138
 
36
- .description {
37
- @apply psui-text-xsmall psui-font-normal;
38
- line-height: 110%;
139
+ div {
140
+ @apply psui-relative;
141
+ }
142
+
143
+ tr {
144
+ .title {
145
+ @apply psui-text-small psui-font-bold psui-leading-4 psui-text-gray-80;
39
146
  }
40
-
41
- &:first-child {
42
- @apply psui-pl-0 psui-pr-8 psui-text-left psui-bg-white psui-sticky psui-z-10 psui-left-0;
43
- box-shadow: inset -1px 0px 0px #EBEEF0;
44
- min-width: 300px;
45
-
46
- > div {
47
- @apply psui-pl-0;
147
+
148
+ th {
149
+ @apply psui-px-6 psui-py-4 psui-text-gray-50 psui-text-center psui-align-top;
150
+ padding-top: 13px;
151
+ padding-bottom: 13px;
152
+ min-width: 200px;
153
+
154
+ .description {
155
+ @apply psui-text-xsmall psui-font-normal;
156
+ line-height: 110%;
48
157
  }
49
158
  }
50
- }
51
159
 
52
- &:first-of-type {
53
- th {
54
- @apply psui-text-left;
55
- padding-top: 0;
56
- padding-bottom: 0;
160
+ &:not(:first-of-type) {
161
+ th {
57
162
 
58
- > div {
59
- @apply psui-flex psui-flex-row psui-border-b psui-border-gray-30;
163
+ &:after {
164
+ @apply psui-absolute psui-top-0 psui-h-full psui-inline-block psui-bg-gray-30 psui-w-px;
165
+ content: '';
166
+ right: -1px;
167
+ }
168
+ }
169
+ }
170
+
171
+ &:first-of-type {
172
+ th {
173
+ @apply psui-text-left psui-text-gray-50 psui-text-p;
60
174
  padding-top: 11px;
61
175
  padding-bottom: 11px;
176
+
177
+ &:first-child {
178
+ @apply psui-pl-0 psui-pt-4;
179
+ min-width: 240px;
180
+
181
+ .title {
182
+ @apply psui-text-gray-80 psui-font-bold;
183
+ }
184
+ }
185
+
186
+ &:not(:first-child) {
187
+ &:before {
188
+ @apply psui-inline-block psui-absolute psui-top-0 psui-left-0 psui-w-full;
189
+ content: '';
190
+ background: linear-gradient(180deg, #FFFFFF 0%, #E6ECF2 100%);
191
+ border-radius: 12px 12px 0px 0px;
192
+ height: 5.5rem;
193
+ }
194
+ }
62
195
  }
63
- }
196
+
197
+ p {
198
+ @apply psui-text-small;
199
+ line-height: 18px;
64
200
 
65
- p {
66
- @apply psui-text-p;
67
- line-height: 18px;
201
+ &.title {
202
+ @apply psui-text-gray-50 psui-font-normal;
203
+ }
204
+ }
68
205
  }
69
206
  }
70
207
  }
71
- }
72
208
 
73
- tbody {
74
- tr {
75
- @apply psui-border-b psui-border-gray-20;
209
+ tbody {
210
+ tr {
211
+ td {
212
+ @apply psui-bg-white psui-relative psui-shadow-elevation-5;
76
213
 
77
- &.is-first {
78
- .title {
79
- @apply psui-font-bold psui-text-gray-80;
80
- }
81
- }
214
+ .title {
215
+ @apply psui-text-small psui-text-gray-80 psui-font-bold psui-truncate psui-leading-none psui-ml-1;
216
+ width: 144px;
217
+ }
82
218
 
83
- .title {
84
- @apply psui-flex psui-items-center;
85
- }
219
+ .badge {
220
+ @apply psui-flex psui-items-center psui-justify-center psui-rounded psui-h-6;
221
+ width: 28px;
222
+ background-color: #D3EFDE;
223
+ }
86
224
 
87
- td {
88
- @apply psui-pl-8 psui-text-gray-80 psui-h-10 psui-text-right psui-text-small;
89
- padding-top: 11px;
90
- padding-bottom: 11px;
225
+ &:before {
226
+ @apply psui-inline-block psui-absolute psui-w-full psui-h-2 psui-bg-white psui-left-0;
227
+ content: '';
228
+ top: -8px;
229
+ }
91
230
 
92
- > div {
93
- @apply psui-flex psui-items-center;
94
- }
231
+ &:after {
232
+ @apply psui-top-0 psui-absolute psui-h-full psui-inline-block psui-bg-blue-20;
233
+ content: '';
234
+ width: 2px;
235
+ right: -2px;
236
+ background: linear-gradient(90deg, rgba(214,221,229,1) 50%, rgba(255,255,255,1) 50%);
237
+ }
95
238
 
96
- .actions {
97
- @apply psui-flex psui-items-center psui-h-full psui-relative;
239
+ &:first-child {
240
+ @apply psui-px-3 psui-rounded-tl-md psui-rounded-bl-md;
98
241
 
99
- &-button {
100
- @apply psui-cursor-pointer psui-ml-1;
242
+ &:after {
243
+ @apply psui-bg-gray-20 psui-bg-none;
244
+ }
101
245
  }
246
+ }
102
247
 
103
- .is-last-deep {
104
- @apply psui-pl-10;
248
+ &.is-first {
249
+ td {
250
+ &:before {
251
+ @apply psui-hidden;
252
+ }
105
253
  }
106
- }
107
254
 
108
- &:not(:first-child) {
109
- > div {
110
- @apply psui-justify-end;
255
+ &.opened {
256
+ td:first-child {
257
+ @apply psui-rounded-bl-none;
258
+ }
111
259
  }
112
260
  }
113
261
 
114
- &:first-child {
115
- @apply psui-pl-0 psui-pr-2 psui-text-left psui-block psui-bg-white psui-sticky psui-z-10 psui-left-0;
116
- box-shadow: inset -1px 0px 0px #EBEEF0;
117
- padding-top: 8px;
118
- padding-bottom: 8px;
262
+ &:not(.is-first) {
263
+ td {
264
+ &:first-child {
265
+ @apply psui-rounded-tl-none;
266
+ }
267
+ }
119
268
  }
120
269
  }
121
270
  }
@@ -23,6 +23,7 @@
23
23
  <span class="flex psui-items-center">
24
24
  <p>{{ columnGroup.title }}</p>
25
25
  <PsIcon
26
+ class="psui-el-draggable-wrapper-title-icon"
26
27
  v-if="columnGroup.hasHelper && columnGroup.hasHelper.showOnEditHideColumns"
27
28
  icon="info"
28
29
  size="16"
@@ -37,7 +38,6 @@
37
38
  class="psui-el-draggable-wrapper-list"
38
39
  :class="{'psui-opacity-50 psui-pointer-events-none':columnGroup.disabled}"
39
40
  >
40
-
41
41
  <div
42
42
  v-for="(column, indexColumn) in columnGroup.columns"
43
43
  :key="`edit-columns-column-${indexColumnGroup}-${indexColumn}`"
@@ -62,6 +62,7 @@
62
62
  @change="$emit('on-select-item', { studyKey: getColumns.key, indexColumnGroup, indexColumn, columnGroupKey: columnGroup.key })"
63
63
  />
64
64
  <PsIcon
65
+ class="psui-el-draggable-item-title-icon"
65
66
  v-if="column.hasHelper && column.hasHelper.showOnEditHideColumns"
66
67
  icon="info"
67
68
  size="16"
@@ -21,7 +21,7 @@ export default {
21
21
  default: true
22
22
  },
23
23
  total: {
24
- type: String,
24
+ type: [String, Number],
25
25
  default: '5,0',
26
26
  },
27
27
  fillWidth: {
@@ -3,9 +3,10 @@
3
3
  class="psui-el-table-results-wrapper"
4
4
  :style="{ maxHeight: tableMaxHeight }"
5
5
  >
6
- <table
6
+ <table
7
7
  ref="table"
8
8
  class="psui-el-table-results"
9
+ :class="`layout-${layout}`"
9
10
  >
10
11
  <slot name="header"></slot>
11
12
 
@@ -16,6 +17,7 @@
16
17
  v-for="(item, index) in getRows"
17
18
  :key="index"
18
19
  :class="[
20
+ getStatusClass(item),
19
21
  {
20
22
  'is-disabled' : item.is_disabled,
21
23
  'is-first' : item.deep == 0,
@@ -28,18 +30,16 @@
28
30
  @mouseleave="onRowHover(false)"
29
31
  >
30
32
  <td>
31
- <div
32
- class="psui-flex psui-justify-between"
33
- >
33
+ <div class="psui-flex psui-justify-between">
34
34
  <div
35
- class="actions psui-space-x-3"
35
+ class="psui-flex psui-items-center actions psui-space-x-3"
36
36
  :style="{ paddingLeft: `${item.deep * 16}px` }"
37
37
  >
38
38
  <PsIcon
39
39
  v-if="!item.last_deep || item.type === 'total'"
40
40
  icon="expand_more"
41
41
  size="24"
42
- class="actions-button psui-transition psui-transform"
42
+ class="actions-button psui-transition psui-transform psui-cursor-pointer"
43
43
  :icon-classes="item.is_disabled ? 'psui-text-gray-40' : getIconClasses(item)"
44
44
  :style="{ display: 'flex' }"
45
45
  :class="[checkRowIsVisible(item) ? 'psui-rotate-0' : 'psui--rotate-90', { 'psui-pointer-events-none' : item.is_disabled }]"
@@ -80,7 +80,7 @@
80
80
  ]"
81
81
  >
82
82
  {{ item.title }}
83
-
83
+
84
84
  <PsIcon
85
85
  v-if="item.has_helper"
86
86
  icon="info"
@@ -90,6 +90,14 @@
90
90
  @click.native="$eventBus.$emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
91
91
  />
92
92
  </p>
93
+
94
+ <PsIcon
95
+ v-if="item.has_badge"
96
+ :icon="item.has_badge"
97
+ size="20"
98
+ class="badge psui-text-green-70 psui-leading-none psui-ml-0"
99
+ :style="{ display: 'flex' }"
100
+ />
93
101
  </div>
94
102
  <div
95
103
  class="actions psui-space-x-3 flex justify-between"
@@ -152,14 +160,15 @@
152
160
  </div>
153
161
  </td>
154
162
 
155
- <template
156
- v-for="(columnGroup, indexColumn) of columnGroups"
157
- >
163
+ <template v-for="(columnGroup, indexColumn) of columnGroups">
158
164
  <td
159
165
  v-for="column of columnGroup.columns"
160
166
  :key="indexColumn + '-' + columnGroup.key + '-' + column.key"
161
167
  >
162
- <div class="psui-space-x-2 psui-show-childrens-on-hover">
168
+ <div
169
+ v-if="layout != 'comparison'"
170
+ class="psui-space-x-2 psui-show-childrens-on-hover"
171
+ >
163
172
  <PsIcon
164
173
  v-if="column.hasProjections && !item.is_disabled"
165
174
  icon="bar_chart"
@@ -196,6 +205,25 @@
196
205
  :force-break-even="item.is_disabled || item.data[column.key] === '--' ? true : false"
197
206
  />
198
207
  </div>
208
+ <div v-else>
209
+ <div class="psui-py-4 psui-px-6">
210
+ <PsTagScope
211
+ v-if="item.data[column.key] != 0 && column.renderType && column.renderType == 'tag_scope'"
212
+ :included="item.data[column.key] != 0 ? true : false"
213
+ />
214
+
215
+ <PsBarChart
216
+ v-else-if="item.data[column.key] != 0 && column.renderType && column.renderType == 'bar_chart'"
217
+ :show-number="item.data[column.key] != 0 ? true : false"
218
+ :total="item.data[column.key]"
219
+ :fill-width="Math.floor(Math.random() * 100)"
220
+ />
221
+
222
+ <p v-else-if="item.data[column.key] != 0">
223
+ {{ item.data[column.key] }}
224
+ </p>
225
+ </div>
226
+ </div>
199
227
  </td>
200
228
  </template>
201
229
  </tr>
@@ -210,11 +238,25 @@
210
238
  import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
211
239
  import PsIcon from '../ui/PsIcon.vue'
212
240
  import PsProgressBar from '../badges-and-tags/PsProgressBar.vue'
241
+ import PsTagScope from '../badges-and-tags/PsTagScope.vue'
242
+ import PsBarChart from '../data-graphics/PsBarChart.vue'
243
+
244
+ export const tableLayout = ['results', 'comparison']
213
245
 
214
246
  export default {
215
247
  name: 'PsTableResults',
216
- components: { PsProgressBar, PsIcon, PsRichTooltip },
248
+ components: { PsProgressBar, PsIcon, PsRichTooltip, PsTagScope, PsBarChart },
217
249
  props: {
250
+ /**
251
+ * It sets the layout of the table. eg: results or comparison
252
+ */
253
+ layout: {
254
+ type: String,
255
+ default: 'results',
256
+ validator: (value) => {
257
+ return tableLayout.indexOf(value) !== -1
258
+ }
259
+ },
218
260
  /**
219
261
  * It sets the max-height to table.
220
262
  */
@@ -278,6 +320,15 @@ export default {
278
320
  /**
279
321
  * It sets the values which will be use to render the body.
280
322
  */
323
+ existingColumnGroup: {
324
+ type: Array,
325
+ default() {
326
+ return []
327
+ }
328
+ },
329
+ /**
330
+ * It sets the values which will be use to render the body.
331
+ */
281
332
  rows: {
282
333
  type: Array,
283
334
  default() {
@@ -298,6 +349,15 @@ export default {
298
349
  type: Number,
299
350
  default: 1
300
351
  },
352
+ /**
353
+ * It sets the values which will be use to render the body.
354
+ */
355
+ policies: {
356
+ type: Array,
357
+ default() {
358
+ return []
359
+ }
360
+ },
301
361
  },
302
362
  data: () => ({
303
363
  collapsedRows : [],
@@ -409,7 +469,10 @@ export default {
409
469
  executeCallback(item, action) {
410
470
  if(item?.actions?.length === 1) item.actions[0].callback(item)
411
471
  else action?.callback(item)
412
- }
472
+ },
473
+ getStatusClass(item) {
474
+ return this.checkRowIsVisible(item) ? 'opened' : 'closed'
475
+ },
413
476
  },
414
477
  }
415
478
  </script>
@@ -15,7 +15,6 @@
15
15
  v-for="column of columnGroup.columns"
16
16
  :key="indexColumn + '-' + columnGroup.key + '-' + column.key"
17
17
  >
18
- <!-- <pre>{{ column }}</pre> -->
19
18
  <p>{{ column.title }}</p>
20
19
  </td>
21
20
  </template>
@@ -45,7 +45,7 @@
45
45
  :icon="orderDirection == 'asc' ? 'arrow_downward' : 'arrow_upward'"
46
46
  :type="orderDirection == 'asc' ? 'arrow_upward' : 'arrow_upward'"
47
47
  size="16"
48
- class="psui-cursor-pointer"
48
+ class="psui-cursor-pointer helper"
49
49
  icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
50
50
  :style="{ display: 'flex' }"
51
51
  @click.native="$emit('click-order-column', column)"
@@ -54,7 +54,7 @@
54
54
  <PsIcon
55
55
  icon="info"
56
56
  size="16"
57
- class="psui-cursor-pointer"
57
+ class="psui-cursor-pointer helper"
58
58
  icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
59
59
  :style="{ display: 'flex' }"
60
60
  @click.native="$emit('click-column-helper', column, $event)"