@policystudio/policy-studio-ui-vue 1.1.0 → 1.1.4

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.
@@ -1709,6 +1709,9 @@ video {
1709
1709
  --text-opacity: 1;
1710
1710
  color: #798490;
1711
1711
  color: rgba(121, 132, 144, var(--text-opacity));
1712
+ font-size: 16px;
1713
+ line-height: 130%;
1714
+ margin-top: 0.25rem;
1712
1715
  }
1713
1716
 
1714
1717
  .psui-el-climate-zone-badge {
@@ -2075,7 +2078,7 @@ video {
2075
2078
 
2076
2079
  .psui-el-table-results tbody tr td:first-child {
2077
2080
  padding-left: 0;
2078
- padding-right: 2rem;
2081
+ padding-right: 0.5rem;
2079
2082
  text-align: left;
2080
2083
  display: block;
2081
2084
  background-color: #ffffff ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.1.0",
3
+ "version": "1.1.4",
4
4
  "description": "Policy Studio UI",
5
5
  "main": "src/index.js",
6
6
  "author": "Policy Studio Team",
@@ -18,7 +18,7 @@
18
18
  }
19
19
 
20
20
  &-percentage {
21
- @apply psui-text-gray-50;
21
+ @apply psui-text-gray-50 psui-text-p psui-mt-1;
22
22
  }
23
23
  }
24
24
 
@@ -112,7 +112,7 @@
112
112
  }
113
113
 
114
114
  &:first-child {
115
- @apply psui-pl-0 psui-pr-8 psui-text-left psui-block psui-bg-white psui-sticky psui-z-10 psui-left-0;
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
116
  box-shadow: inset -1px 0px 0px #EBEEF0;
117
117
  padding-top: 8px;
118
118
  padding-bottom: 8px;
@@ -1,12 +1,17 @@
1
1
  <template>
2
2
  <div class="psui-el-chart-legend">
3
3
  <div class="psui-flex psui-flex-shrink-0">
4
- <div class="psui-el-chart-legend-dot" :style="dotColor"></div>
4
+ <div class="psui-el-chart-legend-dot" :style="dotColor"/>
5
5
  </div>
6
- <div class="psui-flex-grow-1">
6
+ <div class="psui-flex-grow-1 flex psui-flex-col">
7
7
  <div class="psui-el-chart-legend-text">{{ text }}</div>
8
- <span v-if="this.total" class="psui-el-chart-legend-total">{{ total }}</span>
9
- <span class="psui-el-chart-legend-percentage" v-if="percentage"><span class="psui-text-gray-30" v-if="total && percentage"> | </span>{{ percentage }}%</span>
8
+ <div class="flex psui-items-center psui-flex-shrink-0 psui-gap-1">
9
+ <span v-if="this.total" class="psui-el-chart-legend-total">{{ total }}</span>
10
+ <span class="psui-text-gray-30" v-if="total && percentage"> | </span>
11
+ <span class="psui-el-chart-legend-percentage" v-if="percentage">
12
+ {{ percentage }}%
13
+ </span>
14
+ </div>
10
15
  </div>
11
16
  </div>
12
17
  </template>
@@ -77,6 +77,20 @@ export default {
77
77
  type: Boolean,
78
78
  default: false,
79
79
  },
80
+ /**
81
+ * It sets the vertical position.
82
+ */
83
+ position: {
84
+ type: String,
85
+ validator: (value)=> ['bottom','top', 'custom'].includes(value)
86
+ },
87
+ /**
88
+ * It sets the custom positions.
89
+ */
90
+ customPosition: {
91
+ type: String,
92
+ default: '',
93
+ },
80
94
  },
81
95
  data() {
82
96
  return {
@@ -139,6 +153,16 @@ export default {
139
153
  PSDropdownDialog.style.left = `${rectTrigger.x}px`
140
154
  }
141
155
 
156
+ if(this.position == 'top') {
157
+ PSDropdownDialog.style.top = `${(rectTrigger.y - rectDialog.height) - 10}px`
158
+ }
159
+
160
+ if(this.position == 'custom') {
161
+ PSDropdownDialog.style = this.customPosition
162
+ PSDropdownDialog.style.display = 'block'
163
+ PSDropdownDialog.style.position = 'absolute'
164
+ }
165
+
142
166
  if (rectTrigger.top < 10) {
143
167
  this.close()
144
168
  console.warn('The dropdown are too close from the top of the page')
@@ -152,8 +176,10 @@ export default {
152
176
  open() {
153
177
  this.$emit('open')
154
178
  this.show = true
155
- this.$refs.PSDropdownDialog.style.opacity = 0
156
- this.$refs.PSDropdownDialog.style.display = 'block'
179
+ if(this.$refs.PSDropdownDialog){
180
+ this.$refs.PSDropdownDialog.style.opacity = 0
181
+ this.$refs.PSDropdownDialog.style.display = 'block'
182
+ }
157
183
  setTimeout(() => {
158
184
  this.updatePosition()
159
185
  this.watchParentScrolling()
@@ -165,8 +191,10 @@ export default {
165
191
  close() {
166
192
  if (this.show) {
167
193
  this.$emit('close')
168
- this.$refs.PSDropdownDialog.style.display = 'none'
169
- this.$refs.PSDropdownDialog.style.opacity = 0
194
+ if(this.$refs.PSDropdownDialog){
195
+ this.$refs.PSDropdownDialog.style.display = 'none'
196
+ this.$refs.PSDropdownDialog.style.opacity = 0
197
+ }
170
198
  this.show = false
171
199
  this.unwatchParentScrolling()
172
200
  }
@@ -179,12 +207,7 @@ export default {
179
207
  },
180
208
  clickOutside(event) {
181
209
  if (!this.show) return
182
- if (
183
- !(
184
- this.$refs.PSDropdown == event.target ||
185
- this.$refs.PSDropdown.contains(event.target)
186
- )
187
- ) {
210
+ if (!this.$refs.PSDropdown == event.target || !this.$refs.PSDropdown?.contains(event.target)) {
188
211
  this.close()
189
212
  }
190
213
  },
@@ -29,89 +29,127 @@
29
29
  >
30
30
  <td>
31
31
  <div
32
- class="actions psui-space-x-3"
33
- :style="{ paddingLeft: `${item.deep * 16}px` }"
32
+ class="psui-flex psui-justify-between"
34
33
  >
35
- <PsIcon
36
- v-if="!item.last_deep || item.type === 'total'"
37
- icon="expand_more"
38
- size="24"
39
- class="actions-button psui-transition psui-transform"
40
- :icon-classes="item.is_disabled ? 'psui-text-gray-40' : getIconClasses(item)"
41
- :style="{ display: 'flex' }"
42
- :class="[checkRowIsVisible(item) ? 'psui-rotate-0' : 'psui--rotate-90', { 'psui-pointer-events-none' : item.is_disabled }]"
43
- @click.native="onCollapse(item)"
44
- />
45
-
46
- <PsRichTooltip
47
- v-if="item.is_disabled"
48
- layout="gray"
49
- position="top"
50
- class="psui-inline-flex psui-cursor-default"
51
- :class="{ 'is-last-deep' : item.last_deep }"
52
- >
53
- <template v-slot:trigger>
54
- <p class="title psui-text-gray-50">{{ item.title }}</p>
55
- </template>
56
- <template v-slot:content>
57
- <p
58
- v-if="item.disabled_text"
59
- class="psui-font-bold psui-text-gray-80 psui-text-xsmall"
60
- >
61
- {{ item.disabled_text }}
62
- </p>
63
- <p
64
- v-else
65
- class="psui-font-bold psui-text-gray-80 psui-text-xsmall"
66
- >
67
- {{ item.title }} buildings are <br>not allowed.
68
- </p>
69
- </template>
70
- </PsRichTooltip>
71
- <p
72
- v-else
73
- class="title opacity-100-childrens-on-hover"
74
- :class="[
75
- { 'psui-font-bold' : item.type == 'total' },
76
- { 'is-last-deep' : item.last_deep }
77
- ]"
34
+ <div
35
+ class="actions psui-space-x-3"
36
+ :style="{ paddingLeft: `${item.deep * 16}px` }"
78
37
  >
79
- {{ item.title }}
80
-
81
38
  <PsIcon
82
- v-if="item.has_helper"
83
- icon="info"
84
- size="14"
85
- class="psui-text-blue-60 psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
39
+ v-if="!item.last_deep || item.type === 'total'"
40
+ icon="expand_more"
41
+ size="24"
42
+ class="actions-button psui-transition psui-transform"
43
+ :icon-classes="item.is_disabled ? 'psui-text-gray-40' : getIconClasses(item)"
86
44
  :style="{ display: 'flex' }"
87
- @click.native="$eventBus.$emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
45
+ :class="[checkRowIsVisible(item) ? 'psui-rotate-0' : 'psui--rotate-90', { 'psui-pointer-events-none' : item.is_disabled }]"
46
+ @click.native="onCollapse(item)"
88
47
  />
89
- </p>
90
- <PsRichTooltip
91
- v-if="shouldShowIcon(item)"
92
- position="top"
93
- layout="gray"
94
- class="psui-inline-flex psui-cursor-default"
95
- :class="[isHoveringRow === index ? 'opacity-1' : 'opacity-0', { 'is-last-deep' : item.last_deep }]"
96
- :ignoreDialog="!shouldShowIcon(item)"
97
- >
98
- <template v-slot:trigger>
48
+
49
+ <PsRichTooltip
50
+ v-if="item.is_disabled"
51
+ layout="gray"
52
+ position="top"
53
+ class="psui-inline-flex psui-cursor-default sticky"
54
+ :class="{ 'is-last-deep' : item.last_deep }"
55
+ >
56
+ <template v-slot:trigger>
57
+ <p class="title psui-text-gray-50">{{ item.title }}</p>
58
+ </template>
59
+ <template v-slot:content>
60
+ <p
61
+ v-if="item.disabled_text"
62
+ class="psui-font-bold psui-text-gray-80 psui-text-xsmall"
63
+ >
64
+ {{ item.disabled_text }}
65
+ </p>
66
+ <p
67
+ v-else
68
+ class="psui-font-bold psui-text-gray-80 psui-text-xsmall"
69
+ >
70
+ {{ item.title }} buildings are <br>not allowed.
71
+ </p>
72
+ </template>
73
+ </PsRichTooltip>
74
+ <p
75
+ v-else
76
+ class="title opacity-100-childrens-on-hover"
77
+ :class="[
78
+ { 'psui-font-bold' : item.type == 'total' },
79
+ { 'is-last-deep' : item.last_deep }
80
+ ]"
81
+ >
82
+ {{ item.title }}
83
+
99
84
  <PsIcon
100
- :icon="getIcon(item)"
101
- 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"
102
- size="18"
85
+ v-if="item.has_helper"
86
+ icon="info"
87
+ size="14"
88
+ class="psui-text-blue-60 psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
103
89
  :style="{ display: 'flex' }"
104
- @click.native="executeCallback(item)"
90
+ @click.native="$eventBus.$emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
105
91
  />
106
- </template>
107
- <template v-slot:content>
108
- <p
109
- class="psui-font-bold psui-text-gray-80 psui-text-xsmall"
110
- >
111
- {{ getText(item) }}
112
- </p>
113
- </template>
114
- </PsRichTooltip>
92
+ </p>
93
+ </div>
94
+ <div
95
+ class="actions psui-space-x-3 flex justify-between"
96
+ :style="{ paddingLeft: `${item.deep * 16}px` }"
97
+ >
98
+ <PsRichTooltip
99
+ v-if="shouldShowIcon(item)"
100
+ position="top"
101
+ layout="gray"
102
+ class="psui-inline-flex psui-cursor-default"
103
+ :class="[isHoveringRow === index ? 'opacity-1' : 'opacity-0']"
104
+ :ignoreDialog="!shouldShowIcon(item)"
105
+ >
106
+ <template v-slot:trigger>
107
+ <PsIcon
108
+ :icon="getIcon(item)"
109
+ 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"
110
+ size="18"
111
+ :style="{ display: 'flex' }"
112
+ @click.native="executeCallback(item)"
113
+ />
114
+ </template>
115
+ <template v-slot:content>
116
+ <p
117
+ class="psui-font-bold psui-text-gray-80 psui-text-xsmall"
118
+ >
119
+ {{ getText(item) }}
120
+ </p>
121
+ </template>
122
+ </PsRichTooltip>
123
+
124
+ <PsDropdown
125
+ v-if="shouldShowDropdown(item)"
126
+ :class="[isHoveringRow === index ? 'opacity-1' : 'opacity-0']"
127
+ position="custom"
128
+ custom-position="top: 0; left: 5rem;"
129
+ >
130
+ <template v-slot:dropdownTrigger>
131
+ <PsIcon
132
+ icon="more_horiz"
133
+ size="18"
134
+ 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"
135
+ :style="{ display: 'flex' }"
136
+ />
137
+ </template>
138
+ <template v-slot:items>
139
+ <ul class="psui-w-full psui-font-bold psui-my-3">
140
+ <li
141
+ v-for="(action, index) in item.actions"
142
+ :key="index"
143
+ :title="action.title"
144
+ class="psui-text-gray-60 hover:psui-bg-blue-10 hover:psui-text-blue-60 psui-font-bold psui-cursor-pointer psui-flex psui-items-center psui-gap-3 psui-px-5 psui-py-1 transition-all"
145
+ @click="executeCallback(item, action)"
146
+ >
147
+ <span class="psui-w-auto psui-text-small">{{ action.title }}</span>
148
+ </li>
149
+ </ul>
150
+ </template>
151
+ </PsDropdown>
152
+ </div>
115
153
  </div>
116
154
  </td>
117
155
 
@@ -352,42 +390,28 @@ export default {
352
390
  this.$forceUpdate()
353
391
  this.$emit('collapse-row', this.collapsedRows)
354
392
  },
355
- shouldShowIcon(item) {
356
- if(item.actions && (item.deep == 1 || item.deep == 2)) {
357
- return true
358
- } else {
359
- return false
360
- }
361
- },
362
393
  onRowHover(index) {
363
394
  this.isHoveringRow = index
364
395
  },
396
+ shouldShowIcon(item) {
397
+ if(item?.actions?.length === 1) return true
398
+ else return false
399
+ },
400
+ shouldShowDropdown(item) {
401
+ if(item?.actions?.length > 1) return true
402
+ else return false
403
+ },
365
404
  getIcon(item) {
366
- if(item.actions && item.is_disabled) {
367
- return item.actions[1].icon
368
- } else if(item.actions && !item.is_disabled) {
369
- return item.actions[0].icon
370
- } else {
371
- return ''
372
- }
405
+ if(item?.actions?.length === 1) return item.actions[0].icon
373
406
  },
374
407
  getText(item) {
375
- if(item.actions && item.is_disabled) {
376
- return item.actions[1].text
377
- } else if(item.actions && !item.is_disabled) {
378
- return item.actions[0].text
379
- } else {
380
- return ''
381
- }
408
+ if(item?.actions?.length === 1) return item.actions[0].text
382
409
  },
383
- executeCallback(item) {
384
- if(item.actions && item.is_disabled) {
385
- item.actions[1].callback()
386
- } else if(item.actions && !item.is_disabled) {
387
- item.actions[0].callback()
388
- }
389
- },
390
- }
410
+ executeCallback(item, action) {
411
+ if(item?.actions?.length === 1) item.actions[0].callback(item)
412
+ else action?.callback(item)
413
+ }
414
+ },
391
415
  }
392
416
  </script>
393
417
  <style> /* Please, use the file src/assets/scss/components/PsTableResults.scss */ </style>