@policystudio/policy-studio-ui-vue 1.1.90-beta.19 → 1.1.90-beta.20

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.90-beta.19",
3
+ "version": "1.1.90-beta.20",
4
4
  "description": "Policy Studio UI",
5
5
  "author": "Policy Studio Team",
6
6
  "scripts": {
@@ -16,7 +16,6 @@
16
16
  "dependencies": {
17
17
  "@vue/compat": "^3.4.5",
18
18
  "core-js": "^3.6.5",
19
- "tiny-emitter": "^2.1.0",
20
19
  "v-tooltip": "^2.1.3",
21
20
  "vue": "^3.4.5"
22
21
  },
@@ -48,7 +47,7 @@
48
47
  },
49
48
  "engines": {
50
49
  "node": "20.11.0",
51
- "npm":"10.2.4"
50
+ "npm": "10.2.4"
52
51
  },
53
52
  "keywords": [
54
53
  "vue",
@@ -29,7 +29,7 @@
29
29
  size="20"
30
30
  class="psui-text-blue-60 psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
31
31
  :display="item.key == getItems.key || isHovering == index ? 'flex' : 'none'"
32
- @click.stop="$eventBus.$emit('openDescriptionModal', { type: item.hasHelper.type, id: item.hasHelper.id, slug: item.hasHelper.slug })"
32
+ @click.stop="emit('openDescriptionModal', { type: item.hasHelper.type, id: item.hasHelper.id, slug: item.hasHelper.slug })"
33
33
  />
34
34
  </div>
35
35
 
@@ -128,7 +128,7 @@ const props = defineProps({
128
128
  */
129
129
  selected: {},
130
130
  })
131
- const emit = defineEmits(['update:selected', 'change'])
131
+ const emit = defineEmits(['update:selected', 'change','openDescriptionModal'])
132
132
 
133
133
  const isHovering = ref(false)
134
134
 
@@ -101,7 +101,7 @@
101
101
  size="14"
102
102
  class="psui-text-gray-40 psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
103
103
  display="flex"
104
- @click.native="$eventBus.$emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
104
+ @click.native="emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
105
105
  />
106
106
  </p>
107
107
  </div>
@@ -121,7 +121,7 @@
121
121
  :class="[{ 'psui-text-gray-50': item.tooltip_text }, { 'psui-text-blue-60': !item.tooltip_text }]"
122
122
  class="psui-opacity-0 psui-transition psui-leading-none psui-cursor-pointer psui-ml-1"
123
123
  display="flex"
124
- @click.native="$eventBus.$emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
124
+ @click.native="emit('openDescriptionModal', { type: 'helper', slug: `table-results-${item.helper_slug}` })"
125
125
  />
126
126
  </p>
127
127
 
@@ -215,7 +215,7 @@
215
215
  class="psui-cursor-pointer"
216
216
  icon-classes="psui-text-blue-60 psui-leading-none psui-transition"
217
217
  display="flex"
218
- @click.native="onCloseSelectRow(item, column)"
218
+ @click.native="resetPolicyImpactItemSelected(item, column)"
219
219
  />
220
220
  </template>
221
221
  <template #content>
@@ -341,7 +341,6 @@
341
341
  </template>
342
342
 
343
343
  <script setup>
344
- import eventBus from '../../util/eventBus'
345
344
  import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
346
345
  import PsIcon from '../ui/PsIcon.vue'
347
346
  import PsProgressBar from '../badges-and-tags/PsProgressBar.vue'
@@ -481,7 +480,9 @@ const props = defineProps({
481
480
  },
482
481
  })
483
482
 
484
- const emit = defineEmits(['policy-selected', 'collapse-row', 'switchButtonItemChanged', 'removeOrAddButtonChange'])
483
+ const emit = defineEmits(['policy-selected', 'collapse-row', 'switchButtonItemChanged', 'removeOrAddButtonChange','setPolicyItemSelected','openDescriptionModal'])
484
+
485
+ defineExpose({resetPolicy: (item, columnKey) => resetPolicyImpactItemSelected(item, columnKey)})
485
486
 
486
487
  const collapsedRows = ref([])
487
488
  const isHoveringRow = ref(false)
@@ -540,17 +541,17 @@ watch(
540
541
  onMounted(() => {
541
542
  setCollapsedRows()
542
543
  tableWrapper.value.addEventListener('scroll', handleTableScroll)
543
- eventBus.$on('resetPolicyImpactItemSelected', (item, columnKey = 'forecast_emissions_savings') => {
544
- eventBus.$emit('setPolicyItemSelected', { item, columnSelectedKey: columnKey })
545
- selectedRow.value = null
546
- })
547
544
  })
548
545
 
549
546
  onBeforeUnmount(() => {
550
- eventBus.$off('resetPolicyImpactItemSelected')
551
547
  tableWrapper.value.removeEventListener('scroll', handleTableScroll)
552
548
  })
553
549
 
550
+ const resetPolicyImpactItemSelected = (item, columnKey = 'forecast_emissions_savings') => {
551
+ emit('setPolicyItemSelected', { item, columnSelectedKey: columnKey })
552
+ selectedRow.value = null
553
+ }
554
+
554
555
  const setCollapsedRows = () => {
555
556
  let newRowsCollpased = [...(props.itemsHiddenIndexes || [])]
556
557
 
@@ -680,10 +681,6 @@ const onSelectRow = (item, column, $event) => {
680
681
  emit('policy-selected', { item: item, column: column }, $event)
681
682
  }
682
683
 
683
- const onCloseSelectRow = (item, column) => {
684
- eventBus.$emit('resetPolicyImpactItemSelected', item, column)
685
- }
686
-
687
684
  const isSelectedRow = (column, item) => {
688
685
  if (!item.id) {
689
686
  return selectedRow.value === item.id && columnSelectedKey.value == column.key
package/tsconfig.json CHANGED
@@ -36,7 +36,9 @@
36
36
  "src/**/*.d.ts",
37
37
  "src/**/*.vue",
38
38
  "tests/**/*.ts",
39
- "tests/**/*.tsx", "src/util/eventBus.js", "src/util/GeneralFunctions.js", "src/util/imageLoader.js",
39
+ "tests/**/*.tsx",
40
+ "src/util/GeneralFunctions.js",
41
+ "src/util/imageLoader.js",
40
42
  ],
41
43
  "exclude": [
42
44
  "node_modules",
@@ -1,7 +0,0 @@
1
- declare namespace _default {
2
- function $on(...args: any[]): any;
3
- function $once(...args: any[]): any;
4
- function $off(...args: any[]): any;
5
- function $emit(...args: any[]): any;
6
- }
7
- export default _default;
@@ -1,8 +0,0 @@
1
- import emitter from 'tiny-emitter/instance';
2
- export default {
3
- $on: (...args) => emitter.on(...args),
4
- $once: (...args) => emitter.once(...args),
5
- $off: (...args) => emitter.off(...args),
6
- $emit: (...args) => emitter.emit(...args)
7
- };
8
- //# sourceMappingURL=eventBus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eventBus.js","sourceRoot":"","sources":["../../src/util/eventBus.js"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,uBAAuB,CAAA;AAE3C,eAAe;IACb,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IACrC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACzC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACvC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1C,CAAA"}
@@ -1,10 +0,0 @@
1
- import emitter from 'tiny-emitter/instance'
2
-
3
- export default {
4
- $on: (...args) => emitter.on(...args),
5
- $once: (...args) => emitter.once(...args),
6
- $off: (...args) => emitter.off(...args),
7
- $emit: (...args) => emitter.emit(...args)
8
- }
9
-
10
-