@policystudio/policy-studio-ui-vue 1.1.9 → 1.1.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.1.9",
3
+ "version": "1.1.13",
4
4
  "description": "Policy Studio UI",
5
5
  "main": "src/index.js",
6
6
  "author": "Policy Studio Team",
@@ -34,6 +34,7 @@
34
34
  @import './components/PsTagScope.scss';
35
35
  @import './components/PsBarChart.scss';
36
36
  @import './components/PsSimpleAlert.scss';
37
+ @import './components/PsBreadcrumb.scss';
37
38
  @import "tailwindcss/base";
38
39
  @import "tailwindcss/components";
39
40
  @import "tailwindcss/utilities";
@@ -0,0 +1,20 @@
1
+ @layer components{
2
+
3
+ .psui-el-breadcrumb {
4
+ ol {
5
+ @apply psui-flex psui-items-center;
6
+
7
+ li {
8
+ + li {
9
+ &::before {
10
+ @apply psui-float-left psui-inline-block psui-font-normal psui-mr-0.5;
11
+ content: "chevron_right";
12
+ font-family: 'Material Icons Round';
13
+ font-size: 16px;
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+
20
+ }
@@ -1,13 +1,14 @@
1
1
  @layer components {
2
- .psui-el-date-card {
3
- @apply psui-flex psui-flex-col psui-items-center psui-bg-blue-60 psui-text-white;
4
- padding: 8px 11px;
5
- border-radius:3px;
6
- width: fit-content;
7
- height: fit-content;
8
-
9
- &-day {
10
- @apply psui-font-bold;
11
- }
2
+ .psui-el-date-card {
3
+ @apply psui-flex psui-flex-col psui-items-center psui-py-2 psui-bg-blue-60 psui-text-white psui-text-small psui-w-10;
4
+ border-radius: 3px;
5
+
6
+ &-month {
7
+ @apply psui-mb-1;
12
8
  }
9
+
10
+ &-day {
11
+ @apply psui-font-bold;
12
+ }
13
+ }
13
14
  }
@@ -89,6 +89,7 @@
89
89
  @apply psui-pl-8 psui-text-gray-80 psui-h-10 psui-text-right psui-text-small;
90
90
  padding-top: 11px;
91
91
  padding-bottom: 11px;
92
+ min-height: 41.5px;
92
93
 
93
94
  > div {
94
95
  @apply psui-flex psui-items-center;
@@ -119,6 +120,14 @@
119
120
  padding-bottom: 8px;
120
121
  }
121
122
  }
123
+
124
+ &.is-active {
125
+ @apply psui-bg-gray-10;
126
+
127
+ td:first-child {
128
+ @apply psui-bg-gray-10;
129
+ }
130
+ }
122
131
  }
123
132
  }
124
133
  }
@@ -20,7 +20,7 @@ export default {
20
20
  },
21
21
  computed: {
22
22
  getMonthFromDate() {
23
- return (new Date(this.date))?.toLocaleString('default', { month: 'short' })
23
+ return (new Date(this.date))?.toLocaleString('default', { month: 'short' }).replace('.', '')
24
24
  },
25
25
  getDayFromDate() {
26
26
  return (new Date(this.date))?.toLocaleString('default', { day: '2-digit' })
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <nav
3
+ v-if="items.length > 0"
4
+ aria-label="breadcrumb"
5
+ class="psui-el-breadcrumb"
6
+ >
7
+ <ol class="psui-space-x-0.5">
8
+ <li
9
+ v-for="item in items"
10
+ :key="item.title"
11
+ :class="liClass"
12
+ >
13
+ <router-link
14
+ v-if="item.route && !item.isReset"
15
+ :to="item.route"
16
+ @click.native="onNavigate(item)"
17
+ >
18
+ {{ item.title }}
19
+ </router-link>
20
+
21
+ <span
22
+ v-else-if="item.isReset"
23
+ class="psui-flex psui-items-center psui-cursor-pointer psui-text-blue-60 psui-font-bold"
24
+ @click="$emit('reset-state', item)"
25
+ >
26
+ <PsIcon
27
+ size="18"
28
+ icon="arrow_back"
29
+ icon-classes="psui-text-blue-60 psui-leading-none psui-transition psui-mr-2"
30
+ :style="{ display: 'flex' }"
31
+ />
32
+ {{ item.title }}
33
+ </span>
34
+
35
+ <span
36
+ v-else
37
+ :title="item.title"
38
+ >
39
+ {{ item.title }}
40
+ </span>
41
+ </li>
42
+ </ol>
43
+ </nav>
44
+ </template>
45
+
46
+ <script>
47
+ import PsIcon from '../ui/PsIcon.vue'
48
+ export default {
49
+ name: 'PsBreadcrumb',
50
+ components: { PsIcon },
51
+ props: {
52
+ /**
53
+ * It sets the items which will be rendered.
54
+ */
55
+ items: {
56
+ type: [Array, Boolean],
57
+ },
58
+ /**
59
+ * It sets the li style.
60
+ */
61
+ liClass: {
62
+ type: String,
63
+ default: 'psui-text-small psui-text-gray-60'
64
+ }
65
+ },
66
+ methods: {
67
+ onNavigate(item) {
68
+ if (item.route === this.$route.path) {
69
+ this.$parent.closeDrawer()
70
+ }
71
+ },
72
+ }
73
+ }
74
+ </script>
75
+
76
+ <style>
77
+
78
+ </style>
@@ -22,10 +22,12 @@
22
22
  'is-disabled' : item.is_disabled,
23
23
  'is-first' : item.deep == 0,
24
24
  'psui-hidden' : checkRowIsCollapsed(item),
25
- 'is-last' : item.is_last
25
+ 'is-last' : item.is_last,
26
+ 'is-active' : selectedRow == item.id,
26
27
  },
27
- `type-${item.type}`
28
+ `${item.type}`
28
29
  ]"
30
+ :id=" item.id"
29
31
  @mouseenter="onRowHover(index)"
30
32
  @mouseleave="onRowHover(false)"
31
33
  >
@@ -169,15 +171,37 @@
169
171
  v-if="layout != 'comparison'"
170
172
  class="psui-space-x-2 psui-show-childrens-on-hover"
171
173
  >
172
- <PsIcon
173
- v-if="column.hasProjections && !item.is_disabled"
174
- icon="bar_chart"
175
- size="16"
176
- class="psui-cursor-pointer"
177
- icon-classes="psui-text-blue-60 psui-opacity-0 psui-leading-none psui-transition"
178
- :style="{ display: 'flex' }"
179
- @click.native="$emit('policy-selected', { item, column })"
180
- />
174
+ <PsTooltip v-if="column.hasProjections && !item.is_disabled && selectedRow != item.id">
175
+ <template v-slot:trigger>
176
+ <PsIcon
177
+ icon="bar_chart"
178
+ size="16"
179
+ class="psui-cursor-pointer"
180
+ icon-classes="psui-text-blue-60 psui-opacity-0 psui-leading-none psui-transition"
181
+ :style="{ display: 'flex' }"
182
+ @click.native="onSelectRow(item, column)"
183
+ />
184
+ </template>
185
+ <template v-slot:content>
186
+ Show projections in the chart
187
+ </template>
188
+ </PsTooltip>
189
+
190
+ <PsTooltip v-if="column.hasProjections && !item.is_disabled && selectedRow == item.id && columnSelectedKey == column.key">
191
+ <template v-slot:trigger>
192
+ <PsIcon
193
+ icon="close"
194
+ size="16"
195
+ class="psui-cursor-pointer"
196
+ icon-classes="psui-text-blue-60 psui-leading-none psui-transition"
197
+ :style="{ display: 'flex' }"
198
+ @click.native="onCloseSelectRow(item)"
199
+ />
200
+ </template>
201
+ <template v-slot:content>
202
+ Close projections
203
+ </template>
204
+ </PsTooltip>
181
205
 
182
206
  <p v-if="formatFunction && !item.is_disabled">
183
207
  {{ formatFunction(column.key, item.data[column.key], item.data) }}
@@ -240,12 +264,20 @@ import PsIcon from '../ui/PsIcon.vue'
240
264
  import PsProgressBar from '../badges-and-tags/PsProgressBar.vue'
241
265
  import PsTagScope from '../badges-and-tags/PsTagScope.vue'
242
266
  import PsBarChart from '../data-graphics/PsBarChart.vue'
267
+ import PsTooltip from '../tooltip/PsTooltip.vue'
243
268
 
244
269
  export const tableLayout = ['results', 'comparison']
245
270
 
246
271
  export default {
247
272
  name: 'PsTableResults',
248
- components: { PsProgressBar, PsIcon, PsRichTooltip, PsTagScope, PsBarChart },
273
+ components: {
274
+ PsProgressBar,
275
+ PsIcon,
276
+ PsRichTooltip,
277
+ PsTagScope,
278
+ PsBarChart,
279
+ PsTooltip
280
+ },
249
281
  props: {
250
282
  /**
251
283
  * It sets the layout of the table. eg: results or comparison
@@ -361,7 +393,10 @@ export default {
361
393
  },
362
394
  data: () => ({
363
395
  collapsedRows : [],
364
- isHoveringRow: false
396
+ isHoveringRow : false,
397
+ selectedRow : null,
398
+ policyItemSelected: null,
399
+ columnSelectedKey : null
365
400
  }),
366
401
  computed: {
367
402
  getRows() {
@@ -473,6 +508,17 @@ export default {
473
508
  getStatusClass(item) {
474
509
  return this.checkRowIsVisible(item) ? 'opened' : 'closed'
475
510
  },
511
+ onSelectRow(item, column) {
512
+ this.selectedRow = item.id
513
+ this.policyItemSelected = { ...item }
514
+ delete this.policyItemSelected.items
515
+ this.columnSelectedKey = column.key
516
+ this.$emit('policy-selected', { item: item, column: column })
517
+ },
518
+ onCloseSelectRow(item) {
519
+ this.$eventBus.$emit('setPolicyItemSelected', { item, columnSelectedKey: 'forecast_emissions_savings' })
520
+ this.selectedRow = null
521
+ }
476
522
  },
477
523
  }
478
524
  </script>
package/src/index.js CHANGED
@@ -45,6 +45,7 @@ import PsDateCardInfo from './components/badges-and-tags/PsDateCardInfo.vue'
45
45
  import PsTagScope from './components/badges-and-tags/PsTagScope.vue'
46
46
  import PsBarChart from './components/data-graphics/PsBarChart.vue'
47
47
  import PsSimpleAlert from './components/notifications/PsSimpleAlert.vue'
48
+ import PsBreadcrumb from './components/navigations/PsBreadcrumb.vue'
48
49
 
49
50
  export default {
50
51
  install(Vue) {
@@ -90,6 +91,7 @@ export default {
90
91
  Vue.component('PsTagScope',PsTagScope)
91
92
  Vue.component('PsBarChart',PsBarChart)
92
93
  Vue.component('PsSimpleAlert',PsSimpleAlert)
94
+ Vue.component('PsBreadcrumb', PsBreadcrumb)
93
95
 
94
96
  Vue.directive('click-outside', {
95
97
  bind: function (el, binding, vnode) {
@@ -151,6 +153,7 @@ export {
151
153
  PsDateCardInfo,
152
154
  PsTagScope,
153
155
  PsBarChart,
154
- PsSimpleAlert
156
+ PsSimpleAlert,
157
+ PsBreadcrumb
155
158
  }
156
159
 
@@ -0,0 +1,25 @@
1
+ import PsBreadcrumb from '../components/navigations/PsBreadcrumb.vue'
2
+ export default {
3
+ title: 'Navigations/Breadcrumb',
4
+ component: PsBreadcrumb,
5
+ argTypes: {},
6
+ }
7
+ const items = [
8
+ { title: '1st level', route: '' },
9
+ { title: 'Big name that needs to be shortened', route: '#' },
10
+ { title: '3rd level', route: '' },
11
+ { title: '4th level', route: '' },
12
+ ]
13
+
14
+ const Template = (args, { argTypes }) => ({
15
+ props: Object.keys(argTypes),
16
+ components: { PsBreadcrumb },
17
+ template: `
18
+ <PsBreadcrumb v-bind="$props" />
19
+ `,
20
+ })
21
+
22
+ export const Default = Template.bind({})
23
+ Default.args = {
24
+ items: items,
25
+ }
@@ -20,5 +20,5 @@ export default {
20
20
  export const Default = Template.bind({})
21
21
 
22
22
  Default.args = {
23
- date: new Date()
23
+ date: '2021/02/23'
24
24
  }
@@ -48,7 +48,7 @@ module.exports = {
48
48
  transparent: 'transparent',
49
49
  },
50
50
  fontFamily: {
51
- sans: ['Lato'],
51
+ sans: ['Lato', 'sans-serif'],
52
52
  },
53
53
  fontSize: {
54
54
  big: ['16px', '130%'],
@@ -105,6 +105,15 @@ module.exports = {
105
105
  },
106
106
  zIndex: {
107
107
  '15': '15',
108
+ },
109
+ space: {
110
+ '0.5': '0.125rem',
111
+ },
112
+ margin: {
113
+ '0.5': '0.125rem',
114
+ },
115
+ padding: {
116
+ '0.5': '0.125rem',
108
117
  }
109
118
  },
110
119
  },
@@ -137,6 +146,8 @@ module.exports = {
137
146
  'hover',
138
147
  'checked'
139
148
  ],
149
+ space: ['responsive', 'hover', 'focus', 'first'],
150
+ padding: ['responsive', 'hover', 'focus', 'first'],
140
151
  extend: {},
141
152
  },
142
153
  plugins: [],