@policystudio/policy-studio-ui-vue 1.1.88 → 1.1.90-access.0

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.
Files changed (170) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +75 -67
  3. package/.github/workflows/deploy-storybook.yml +5 -5
  4. package/.nvmrc +1 -0
  5. package/dist/css/psui_styles_output.css +6617 -0
  6. package/dist/index.d.ts +51 -0
  7. package/dist/index.js +106 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/util/GeneralFunctions.d.ts +3 -0
  10. package/dist/util/GeneralFunctions.js +35 -0
  11. package/dist/util/GeneralFunctions.js.map +1 -0
  12. package/dist/util/directives.d.ts +1 -0
  13. package/dist/util/directives.js +22 -0
  14. package/dist/util/directives.js.map +1 -0
  15. package/dist/util/imageLoader.d.ts +6 -0
  16. package/dist/util/imageLoader.js +52 -0
  17. package/dist/util/imageLoader.js.map +1 -0
  18. package/doc/.nvmrc +1 -0
  19. package/doc/.storybook/PolicyStudio.ts +11 -0
  20. package/doc/.storybook/main.ts +27 -0
  21. package/doc/.storybook/manager.ts +7 -0
  22. package/{.storybook/preview.js → doc/.storybook/preview.ts} +2 -3
  23. package/doc/package-lock.json +22653 -0
  24. package/doc/package.json +71 -0
  25. package/doc/shims-vue.d.ts +6 -0
  26. package/{src/stories/Accordion.stories.js → doc/src/stories/Accordion.stories.ts} +4 -5
  27. package/{src/stories/BadgeWithIcon.stories.js → doc/src/stories/BadgeWithIcon.stories.ts} +2 -2
  28. package/{src/stories/BarChart.stories.js → doc/src/stories/BarChart.stories.ts} +2 -2
  29. package/{src/stories/Breadcrumb.stories.js → doc/src/stories/Breadcrumb.stories.ts} +2 -5
  30. package/{src/stories/Button.stories.js → doc/src/stories/Button.stories.ts} +130 -130
  31. package/{src/stories/CardInfos.stories.js → doc/src/stories/CardInfos.stories.ts} +2 -3
  32. package/{src/stories/ChartLegend.stories.js → doc/src/stories/ChartLegend.stories.ts} +2 -3
  33. package/{src/stories/Checkbox.stories.js → doc/src/stories/Checkbox.stories.ts} +2 -2
  34. package/{src/stories/CheckboxSimple.stories.js → doc/src/stories/CheckboxSimple.stories.ts} +2 -2
  35. package/{src/stories/Chips.stories.js → doc/src/stories/Chips.stories.ts} +22 -23
  36. package/{src/stories/ClimateZoneBadge.stories.js → doc/src/stories/ClimateZoneBadge.stories.ts} +3 -2
  37. package/doc/src/stories/Collapse.stories.ts +46 -0
  38. package/{src/stories/CostEffectBar.stories.js → doc/src/stories/CostEffectBar.stories.ts} +3 -2
  39. package/{src/stories/Datatable.stories.js → doc/src/stories/Datatable.stories.ts} +7 -4
  40. package/{src/stories/DateCardInfo.stories.js → doc/src/stories/DateCardInfo.stories.ts} +2 -6
  41. package/{src/stories/Dialog.stories.js → doc/src/stories/Dialog.stories.ts} +2 -2
  42. package/{src/stories/Draggable.stories.js → doc/src/stories/Draggable.stories.ts} +3 -2
  43. package/{src/stories/Dropdown.stories.js → doc/src/stories/Dropdown.stories.ts} +4 -3
  44. package/{src/stories/DropdownList.stories.js → doc/src/stories/DropdownList.stories.ts} +4 -2
  45. package/{src/stories/ElevationSystem.stories.mdx → doc/src/stories/ElevationSystem.mdx} +1 -1
  46. package/{src/stories/HighlightRippleDot.stories.js → doc/src/stories/HighlightRippleDot.stories.ts} +3 -2
  47. package/{src/stories/Icon.stories.js → doc/src/stories/Icon.stories.ts} +3 -1
  48. package/{src/stories/InlineSelector.stories.js → doc/src/stories/InlineSelector.stories.ts} +2 -2
  49. package/{src/stories/Input.stories.js → doc/src/stories/Input.stories.ts} +7 -4
  50. package/{src/stories/InputSelect.stories.js → doc/src/stories/InputSelect.stories.ts} +3 -2
  51. package/{src/stories/InputTextArea.stories.js → doc/src/stories/InputTextArea.stories.ts} +2 -2
  52. package/{src/stories/Introduction.stories.mdx → doc/src/stories/Introduction.mdx} +101 -101
  53. package/{src/stories/MiniTag.stories.js → doc/src/stories/MiniTag.stories.ts} +9 -2
  54. package/{src/stories/ProgressBar.stories.js → doc/src/stories/ProgressBar.stories.ts} +3 -2
  55. package/{src/stories/RadioButton.stories.js → doc/src/stories/RadioButton.stories.ts} +2 -2
  56. package/{src/stories/RadioButtonSimple.stories.js → doc/src/stories/RadioButtonSimple.stories.ts} +2 -2
  57. package/{src/stories/SimpleAlert.stories.js → doc/src/stories/SimpleAlert.stories.ts} +3 -2
  58. package/{src/stories/Slider.stories.js → doc/src/stories/Slider.stories.ts} +6 -2
  59. package/{src/stories/Switch.stories.js → doc/src/stories/Switch.stories.ts} +2 -2
  60. package/{src/stories/TabHeader.stories.js → doc/src/stories/TabHeader.stories.ts} +6 -1
  61. package/{src/stories/TableResults.stories.js → doc/src/stories/TableResults.stories.ts} +11 -7
  62. package/{src/stories/TagScope.stories.js → doc/src/stories/TagScope.stories.ts} +3 -2
  63. package/{src/stories/TestimonialCard.stories.js → doc/src/stories/TestimonialCard.stories.ts} +3 -3
  64. package/{src/stories/Toast.stories.js → doc/src/stories/Toast.stories.ts} +2 -2
  65. package/{src/stories/Toggle.stories.js → doc/src/stories/Toggle.stories.ts} +7 -4
  66. package/{src/stories/Tooltip.stories.js → doc/src/stories/Tooltip.stories.ts} +6 -6
  67. package/{src/stories/Typography.stories.mdx → doc/src/stories/Typography.mdx} +107 -105
  68. package/doc/tsconfig.json +17 -0
  69. package/package.json +43 -39
  70. package/scripts/gulp.js +11 -0
  71. package/scripts/kill-port.sh +12 -0
  72. package/src/App.vue +30 -0
  73. package/src/assets/scss/base.scss +3 -30
  74. package/src/assets/scss/components/PsAccordion.scss +2 -2
  75. package/src/assets/scss/components/PsButton.scss +7 -1
  76. package/src/assets/scss/components/PsChips.scss +12 -7
  77. package/src/assets/scss/components/PsCollapse.scss +71 -0
  78. package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
  79. package/src/assets/scss/components/PsDataTable.scss +1 -1
  80. package/src/assets/scss/components/PsDateCardInfo.scss +4 -5
  81. package/src/assets/scss/components/PsDialog.scss +7 -0
  82. package/src/assets/scss/components/PsDropdownList.scss +1 -1
  83. package/src/assets/scss/components/PsInput.scss +9 -0
  84. package/src/assets/scss/components/PsProgressBar.scss +4 -4
  85. package/src/assets/scss/components/PsTabHeader.scss +57 -2
  86. package/src/assets/scss/components/PsTableResults.scss +53 -22
  87. package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
  88. package/src/assets/scss/components/PsTooltip.scss +149 -145
  89. package/src/components/accordion/PsAccordion.vue +20 -21
  90. package/src/components/accordion/PsAccordionItem.vue +121 -81
  91. package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
  92. package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
  93. package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
  94. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
  95. package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
  96. package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
  97. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
  98. package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
  99. package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
  100. package/src/components/badges-and-tags/PsTagScope.vue +17 -22
  101. package/src/components/badges-and-tags/PsTestimonialCard.vue +25 -30
  102. package/src/components/buttons/PsButton.vue +90 -98
  103. package/src/components/chips/PsChips.vue +118 -103
  104. package/src/components/collapse/PsCollapse.vue +124 -0
  105. package/src/components/controls/PsCheckbox.vue +86 -83
  106. package/src/components/controls/PsCheckboxSimple.vue +97 -97
  107. package/src/components/controls/PsDraggable.vue +100 -99
  108. package/src/components/controls/PsInlineSelector.vue +111 -113
  109. package/src/components/controls/PsRadioButton.vue +72 -60
  110. package/src/components/controls/PsRadioButtonSimple.vue +81 -77
  111. package/src/components/controls/PsSlider.vue +190 -181
  112. package/src/components/controls/PsSwitch.vue +63 -54
  113. package/src/components/controls/PsToggle.vue +62 -57
  114. package/src/components/data-graphics/PsBarChart.vue +22 -23
  115. package/src/components/datatable/PsDataTable.vue +70 -65
  116. package/src/components/datatable/PsDataTableItem.vue +30 -32
  117. package/src/components/forms/PsDropdown.vue +173 -166
  118. package/src/components/forms/PsDropdownList.vue +133 -130
  119. package/src/components/forms/PsInput.vue +163 -146
  120. package/src/components/forms/PsInputSelect.vue +121 -100
  121. package/src/components/forms/PsInputTextArea.vue +84 -74
  122. package/src/components/navigations/PsBreadcrumb.vue +25 -34
  123. package/src/components/notifications/PsDialog.vue +67 -60
  124. package/src/components/notifications/PsSimpleAlert.vue +47 -37
  125. package/src/components/notifications/PsToast.vue +48 -42
  126. package/src/components/table-results/PsTableResults.vue +534 -506
  127. package/src/components/table-results/PsTableResultsBody.vue +69 -68
  128. package/src/components/table-results/PsTableResultsHead.vue +108 -69
  129. package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
  130. package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
  131. package/src/components/table-results/PsTableResultsRow.vue +61 -58
  132. package/src/components/tabs/PsTabHeader.vue +138 -116
  133. package/src/components/tooltip/PsDialogTooltip.vue +112 -107
  134. package/src/components/tooltip/PsRichTooltip.vue +46 -43
  135. package/src/components/tooltip/PsTooltip.vue +126 -122
  136. package/src/components/ui/PsDotLoader.vue +6 -10
  137. package/src/components/ui/PsIcon.vue +149 -134
  138. package/src/index.ts +159 -0
  139. package/src/tsconfig.json +12 -0
  140. package/src/types/index.d.ts +6 -0
  141. package/src/util/GeneralFunctions.js +16 -7
  142. package/src/util/directives.ts +24 -0
  143. package/src/util/imageLoader.js +14 -7
  144. package/tailwind.config.js +12 -3
  145. package/tsconfig.json +47 -0
  146. package/.storybook/PolicyStudio.js +0 -10
  147. package/.storybook/eventBus.js +0 -3
  148. package/.storybook/main.js +0 -25
  149. package/.storybook/manager.js +0 -6
  150. package/babel.config.js +0 -3
  151. package/backup-package-lock.json +0 -37194
  152. package/dist/css/psui_styles.css +0 -110890
  153. package/postcss.config.js +0 -8
  154. package/src/components/playground/PsScrollBar.vue +0 -248
  155. package/src/index.js +0 -167
  156. package/src/stories/Playground.stories.js +0 -16
  157. /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
  158. /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
  159. /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
  160. /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
  161. /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
  162. /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
  163. /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
  164. /package/{src → doc/src}/stories/assets/colors.svg +0 -0
  165. /package/{src → doc/src}/stories/assets/comments.svg +0 -0
  166. /package/{src → doc/src}/stories/assets/direction.svg +0 -0
  167. /package/{src → doc/src}/stories/assets/flow.svg +0 -0
  168. /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
  169. /package/{src → doc/src}/stories/assets/repo.svg +0 -0
  170. /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
@@ -4,17 +4,18 @@
4
4
  <th
5
5
  v-for="columnGroup of header"
6
6
  :key="columnGroup.key"
7
- :colspan="columnGroup.columns.reduce( (prev, cur) => cur.isActive ? prev + 1 : prev, 0 )"
7
+ :colspan="columnGroup.columns.reduce((prev, cur) => (cur.isActive ? prev + 1 : prev), 0)"
8
8
  >
9
9
  <div class="psui-flex psui-space-x-1 psui-items-center psui-show-childrens-on-hover">
10
- <p class="title">{{ columnGroup.title }}</p>
10
+ <p class="title">
11
+ {{ columnGroup.title }}
12
+ </p>
11
13
  <PsIcon
12
- icon="info"
13
- size="18"
14
- class="psui-cursor-pointer"
15
- icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
14
+ icon="info_outline"
15
+ size="16"
16
+ class="psui-cursor-pointer psui-text-blue-40 hover:psui-text-blue-60 psui-opacity-0 psui-leading-none psui-transition"
16
17
  :style="{ display: 'flex' }"
17
- @click.native="$emit('click-column-group-helper', columnGroup, $event)"
18
+ @click="emit('click-column-group-helper', columnGroup, $event)"
18
19
  />
19
20
  </div>
20
21
  </th>
@@ -22,40 +23,72 @@
22
23
 
23
24
  <tr>
24
25
  <template v-for="(columnGroup, columnGroupIndex) of header">
25
- <th
26
- v-for="column of columnGroup.columns"
26
+ <th
27
+ v-for="(column, index) of columnGroup.columns"
27
28
  :key="`${columnGroup.key}-${column.key}`"
28
29
  :data-test-id="column.key"
30
+ class="pr-0"
31
+ :class="{'pl-2':index == 0 && columnGroupIndex > 0}"
29
32
  >
30
- <div
31
- class="psui-flex psui-flex-col psui-justify-center"
33
+ <div
34
+ class="psui-flex psui-flex-col psui-justify-center py-[7px]"
32
35
  :class="columnGroupIndex == 0 ? 'psui-items-center' : 'psui-items-end'"
33
36
  :data-index="columnGroupIndex"
37
+ @mouseleave="emit('column-alert-hide', column, $event, false)"
34
38
  >
35
- <div class="psui-show-childrens-on-hover absolute-childrens psui-mb-px">
36
- <p class="title" v-if="column.title">{{ column.title }}</p>
39
+ <div class="psui-show-childrens-on-hover absolute-childrens">
40
+ <p
41
+ v-tooltip="{
42
+ content: column.description,
43
+ placement: 'bottom',
44
+ classes: 'custom-tooltip'
45
+ }"
46
+ class="title"
47
+ :class="{'is-warning-column': !!column.warning}"
48
+ v-if="column.title"
49
+ >
50
+ {{ column.title }}
51
+ </p>
52
+ <span
53
+ v-if="column.warning"
54
+ class="warning-svg-position"
55
+ @mouseover="emit('column-alert-show', column, $event, true)"
56
+ >
57
+ <span class="cursor-pointer">
58
+ <svg
59
+ width="10"
60
+ height="10"
61
+ viewBox="0 0 10 10"
62
+ fill="none"
63
+ >
64
+ <circle
65
+ cx="5"
66
+ cy="5"
67
+ r="4.5"
68
+ fill="#EDAB3E"
69
+ />
70
+ </svg>
71
+ </span>
72
+ </span>
37
73
 
38
74
  <PsIcon
39
- icon="info"
75
+ icon="info_outline"
40
76
  size="16"
41
- class="psui-cursor-pointer helper"
42
- icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
43
- :style="{ display: 'flex' }"
44
- @click.native="$emit('click-column-helper', column, $event)"
77
+ class="helper psui-cursor-pointer psui-text-gray-40 hover:psui-text-blue-60 psui-opacity-0 psui-leading-none psui-transition"
78
+ :style="{ display: 'flex', marginTop: '1px' }"
79
+ @click="emit('click-column-helper', column, $event)"
45
80
  />
46
-
81
+
47
82
  <PsIcon
48
83
  v-if="showOrder"
49
84
  :icon="orderDirection == 'asc' ? 'arrow_downward' : 'arrow_upward'"
50
85
  :type="orderDirection == 'asc' ? 'arrow_upward' : 'arrow_upward'"
51
86
  size="16"
52
- class="psui-cursor-pointer helper"
53
- icon-classes="psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
54
- :style="{ display: 'flex' }"
55
- @click.native="$emit('click-order-column', column)"
87
+ class="helper psui-cursor-pointer psui-text-blue-50 psui-opacity-0 psui-leading-none psui-transition"
88
+ :style="{ display: 'flex', marginTop: '1px' }"
89
+ @click="emit('click-order-column', column)"
56
90
  />
57
91
  </div>
58
- <p class="description" v-if="column.description">{{ column.description }}</p>
59
92
  </div>
60
93
  </th>
61
94
  </template>
@@ -63,55 +96,62 @@
63
96
  </thead>
64
97
  </template>
65
98
 
66
- <script>
99
+ <script setup>
67
100
  import PsIcon from '../ui/PsIcon.vue'
68
- export default {
69
- name: 'PsTableResultsHeadFlexible',
70
- components: { PsIcon },
71
- props: {
72
- /**
73
- * It sets the title for the first column.
74
- */
75
- firstColumnTitle: {
76
- type: String,
77
- default: ''
78
- },
79
- /**
80
- * It sets the description for the first column.
81
- */
82
- firstColumnDescription: {
83
- type: String,
84
- default: ''
85
- },
86
- /**
87
- * It sets the values which will be use to render the header.
88
- */
89
- header: {
90
- type: Array,
91
- required: true,
92
- default: () => {
93
- return []
94
- },
95
- },
96
- /**
97
- * this sets whether sorting will be displayed.
98
- */
99
- showOrder: {
100
- type: Boolean,
101
- default: false
102
- }
101
+
102
+ import { computed, getCurrentInstance } from 'vue'
103
+
104
+ defineProps({
105
+ /**
106
+ * It sets the title for the first column.
107
+ */
108
+ firstColumnTitle: {
109
+ type: String,
110
+ default: '',
103
111
  },
104
- computed: {
105
- columnsSelectedForStudy() {
106
- return this.$parent.columnsSelectedForStudy
107
- },
108
- orderColumn() {
109
- return this.$parent.orderColumn
110
- },
111
- orderDirection() {
112
- return this.$parent.orderDirection
112
+ /**
113
+ * It sets the description for the first column.
114
+ */
115
+ firstColumnDescription: {
116
+ type: String,
117
+ default: '',
118
+ },
119
+ /**
120
+ * It sets the values which will be use to render the header.
121
+ */
122
+ header: {
123
+ type: Array,
124
+ required: true,
125
+ default: () => {
126
+ return []
113
127
  },
114
- }
115
- }
128
+ },
129
+ /**
130
+ * this sets whether sorting will be displayed.
131
+ */
132
+ showOrder: {
133
+ type: Boolean,
134
+ default: false,
135
+ },
136
+ })
137
+
138
+ const emit = defineEmits(['click-column-group-helper', 'click-column-helper', 'click-order-column', 'column-alert-show', 'column-alert-hide'])
139
+
140
+ const parent = getCurrentInstance().proxy.$parent
141
+
142
+ const columnsSelectedForStudy = computed(() => {
143
+ return parent.columnsSelectedForStudy
144
+ })
145
+
146
+ const orderColumn = computed(() => {
147
+ return parent.orderColumn
148
+ })
149
+
150
+ const orderDirection = computed(() => {
151
+ return parent.orderDirection
152
+ })
116
153
  </script>
117
- <style> /* Please, use the file src/assets/scss/components/PsTableResults.scss */ </style>
154
+
155
+ <style>
156
+ /* Please, use the file src/assets/scss/components/PsTableResults.scss */
157
+ </style>
@@ -5,81 +5,84 @@
5
5
  :key="index"
6
6
  >
7
7
  <td>
8
- <p class="title">{{ row.title }}</p>
8
+ <p class="title">
9
+ {{ row.title }}
10
+ </p>
9
11
  </td>
10
12
 
11
- <template
12
- v-for="(columnGroup, indexColumn) of columnGroups"
13
- >
13
+ <template v-for="(columnGroup, indexColumn) of columnGroups">
14
14
  <td
15
15
  v-for="column of columnGroup.columns"
16
16
  :key="indexColumn + '-' + columnGroup.key + '-' + column.key"
17
17
  >
18
- <p class="ps-table-cell-value">{{ row.data[column.key] }}</p>
18
+ <p class="ps-table-cell-value">
19
+ {{ row.data[column.key] }}
20
+ </p>
19
21
  </td>
20
22
  </template>
21
23
  </tr>
22
24
  </tbody>
23
25
  </template>
24
26
 
25
- <script>
26
- export default {
27
- name: 'PsTableResultsRow',
28
- props: {
29
- /**
30
- * It sets the values which will be use to render the body.
31
- */
32
- summaryData: {
33
- type: Array,
34
- default() {
35
- return []
36
- }
37
- },
38
- /**
39
- * It sets the values which will be use to render the body.
40
- */
41
- columnGroups: {
42
- type: Array,
43
- default() {
44
- return []
45
- }
27
+ <script setup>
28
+ import { computed } from 'vue'
29
+
30
+ const props = defineProps({
31
+ /**
32
+ * It sets the values which will be use to render the body.
33
+ */
34
+ summaryData: {
35
+ type: Array,
36
+ default() {
37
+ return []
46
38
  },
47
- /**
48
- * It sets the values which will be use to render the body.
49
- */
50
- rows: {
51
- type: Array,
52
- default() {
53
- return []
54
- }
39
+ },
40
+ /**
41
+ * It sets the values which will be use to render the body.
42
+ */
43
+ columnGroups: {
44
+ type: Array,
45
+ default() {
46
+ return []
55
47
  },
56
48
  },
57
- computed: {
58
- getRows() {
59
- const rows = []
60
- for (let index = 0; index < this.summaryData.length; index++) {
61
- const item = this.summaryData[index]
62
- this.addRow(item, 0, `${index}`, rows)
63
- }
64
- return rows
65
- }
49
+ /**
50
+ * It sets the values which will be use to render the body.
51
+ */
52
+ rows: {
53
+ type: Array,
54
+ default() {
55
+ return []
56
+ },
66
57
  },
67
- methods: {
68
- addRow(item, deep = 0, index, rows) {
69
- item.deep = deep
70
- item.index = index
71
- rows.push(item)
72
- item.last_deep = item.items ? false : true
73
- if (item.items) {
74
- const items_child = [...item.items]
75
- for (let indexChild = 0; indexChild < items_child.length; indexChild++) {
76
- const item_child = items_child[indexChild]
77
- item_child.is_last = indexChild + 1 === items_child.length ? true : false
78
- this.addRow(item_child, deep + 1, `${index}-${indexChild}`, rows)
79
- }
80
- }
58
+ })
59
+
60
+ const addRow = (item, deep = 0, index, rows) => {
61
+ item.deep = deep
62
+ item.index = index
63
+ rows.push(item)
64
+ item.last_deep = item.items ? false : true
65
+ if (item.items) {
66
+ const items_child = [...item.items]
67
+ for (let indexChild = 0; indexChild < items_child.length; indexChild++) {
68
+ const item_child = items_child[indexChild]
69
+ item_child.is_last = indexChild + 1 === items_child.length ? true : false
70
+ addRow(item_child, deep + 1, `${index}-${indexChild}`, rows)
81
71
  }
82
72
  }
83
73
  }
74
+
75
+ const getRows = computed(() => {
76
+ const rows = []
77
+ for (let index = 0; index < props.summaryData.length; index++) {
78
+ const item = props.summaryData[index]
79
+ addRow(item, 0, `${index}`, rows)
80
+ }
81
+ return rows
82
+ })
83
+
84
84
  </script>
85
- <style> /* Please, use the file src/assets/scss/components/PsTableResults.scss */ </style>
85
+
86
+ <style>
87
+ /* Please, use the file src/assets/scss/components/PsTableResults.scss */
88
+ </style>
@@ -1,137 +1,159 @@
1
1
  <template>
2
- <div
3
- class="psui-el-tab-header"
4
- :class="[getComponentClass, `layout-${layout}`]"
2
+ <div
3
+ class="psui-el-tab-header"
4
+ :class="[getComponentClass, `layout-${layout}`]"
5
5
  role="group"
6
6
  >
7
-
8
7
  <template v-for="(item, index) in getItems">
9
- <slot v-bind:item="item" >
10
- <PsRichTooltip v-if="item.tooltip" :title="item.tooltip" layout="blue">
11
- <template v-slot:trigger>
12
- <button
13
- :key="item[keyValue] + index"
14
- type="button"
15
- @click="selectTab(item)"
16
- :class="getButtonClass(item)"
17
- >
18
- <span>{{ item[keyLabel] }}</span>
19
- </button>
20
- </template>
21
- </PsRichTooltip>
22
- <button
23
- v-else
24
- :key="item[keyValue] + index"
8
+ <slot :item="item">
9
+ <PsRichTooltip
10
+ v-if="item.tooltip"
11
+ :title="item.tooltip"
12
+ layout="blue"
13
+ >
14
+ <template #trigger>
15
+ <button
16
+ :key="item[keyValue] + index"
17
+ type="button"
18
+ @click="selectTab(item)"
19
+ :class="getButtonClass(item).value"
20
+ >
21
+ <PsIcon
22
+ v-if="item.icon"
23
+ :icon="item.icon"
24
+ display="flex"
25
+ size="16"
26
+ />
27
+ <span>{{ item[keyLabel] }}</span>
28
+ </button>
29
+ </template>
30
+ </PsRichTooltip>
31
+ <button
32
+ v-else
25
33
  type="button"
34
+ :key="item[keyValue] + index"
26
35
  @click="selectTab(item)"
27
- :class="getButtonClass(item)"
36
+ :class="getButtonClass(item).value"
28
37
  >
29
- <span>{{ item[keyLabel] }}</span>
38
+ <PsIcon
39
+ v-if="item.icon"
40
+ :icon="item.icon"
41
+ display="flex"
42
+ size="16"
43
+ />
44
+ <span>{{ item[keyLabel] }}</span>
30
45
  </button>
31
46
  </slot>
32
47
  </template>
33
- </div>
48
+ </div>
34
49
  </template>
35
50
 
36
- <script>
51
+ <script setup>
37
52
  import PsRichTooltip from '../tooltip/PsRichTooltip.vue'
38
- export default {
39
- name: 'PsTabHeader',
40
- components: { PsRichTooltip },
41
- props: {
42
- /**
43
- * It sets the layout of the tabheader. eg: standard, underline and folder.
44
- */
45
- layout: {
46
- type: String,
47
- default: 'standard',
48
- validator: (value) => ['standard', 'underline', 'folder'].includes(value)
49
- },
50
- /**
51
- * It sets the tabs which will be rendered.
52
- */
53
- items: {
54
- type: Array,
55
- required: true
56
- },
57
- /**
58
- * It sets the key label of the items if needed.
59
- */
60
- keyLabel: {
61
- type: String,
62
- default: 'label'
63
- },
64
- /**
65
- * It sets the key value of the items if needed.
66
- */
67
- keyValue: {
68
- type: String,
69
- default: 'value'
70
- },
71
- /**
72
- * It disabled the tab header. All mouse events are disabled.
73
- */
74
- disabled: {
75
- type: Boolean,
76
- default: false
77
- },
78
- /**
79
- * It sets the tab seleced.
80
- */
81
- selected: {},
53
+ import { computed } from 'vue'
54
+ import PsIcon from '../ui/PsIcon.vue'
55
+
56
+ const props = defineProps({
57
+ /**
58
+ * It sets the layout of the tabheader. eg: standard, underline and folder.
59
+ */
60
+ layout: {
61
+ type: String,
62
+ default: 'standard',
63
+ validator: (value) => ['standard', 'underline', 'folder', 'policy-design'].includes(value),
82
64
  },
83
- computed: {
84
- getComponentClass() {
85
- if (this.disabled) {
86
- return 'status-disabled'
87
- } else {
88
- return 'status-resting'
89
- }
90
- },
91
- getIsObject() {
92
- return typeof this.selected === 'object'
93
- },
94
- getSelected() {
95
- if (this.selected) {
96
- if (typeof this.selected === 'object' && this.selected[this.keyValue] ) {
97
- return this.selected[this.keyValue]
98
- } else {
99
- return this.selected
100
- }
101
- } else {
102
- return false
103
- }
104
- },
105
- getItems() {
106
- if (this.items.length > 0 && typeof this.items[0] !== 'object') {
107
- return this.items.map((item) => {
108
- return {
109
- [this.keyLabel]: item,
110
- [this.keyValue]: item
111
- }
112
- })
113
- } else {
114
- return this.items
115
- }
116
- },
65
+ /**
66
+ * It sets the tabs which will be rendered.
67
+ */
68
+ items: {
69
+ type: Array,
70
+ required: true,
117
71
  },
118
- methods: {
119
- selectTab(item) {
120
- if (item.disabled !== true) {
121
- this.$emit('update:selected', this.getIsObject ? item : item[this.keyValue] )
122
- this.$emit('change', this.getIsObject ? item : item[this.keyValue])
123
- }
124
- },
125
- getButtonClass(item) {
126
- if (item.disabled) {
127
- return ['status-disabled']
128
- } else {
129
- return { 'status-active': this.getSelected === item[this.keyValue], 'status-enabled' : true }
130
- }
72
+ /**
73
+ * It sets the key label of the items if needed.
74
+ */
75
+ keyLabel: {
76
+ type: String,
77
+ default: 'label',
78
+ },
79
+ /**
80
+ * It sets the key value of the items if needed.
81
+ */
82
+ keyValue: {
83
+ type: String,
84
+ default: 'value',
85
+ },
86
+ /**
87
+ * It disabled the tab header. All mouse events are disabled.
88
+ */
89
+ disabled: {
90
+ type: Boolean,
91
+ default: false,
92
+ },
93
+ /**
94
+ * It sets the tab seleced.
95
+ */
96
+ selected: {},
97
+ })
98
+
99
+ const emit = defineEmits(['change', 'update:selected'])
100
+
101
+ const getComponentClass = computed(() => {
102
+ if (props.disabled) {
103
+ return 'status-disabled'
104
+ }
105
+
106
+ return ''
107
+ })
108
+
109
+ const getIsObject = computed(() => {
110
+ return typeof props.selected === 'object'
111
+ })
112
+
113
+ const getSelected = computed(() => {
114
+ if (props.selected) {
115
+ if (typeof props.selected === 'object' && props.selected[props.keyValue]) {
116
+ return props.selected[props.keyValue]
117
+ } else {
118
+ return props.selected
131
119
  }
120
+ } else {
121
+ return false
122
+ }
123
+ })
124
+
125
+ const getItems = computed(() => {
126
+ if (props.items.length > 0 && typeof props.items[0] !== 'object') {
127
+ return props.items.map((item) => {
128
+ return {
129
+ [props.keyLabel]: item,
130
+ [props.keyValue]: item,
131
+ }
132
+ })
133
+ } else {
134
+ return props.items
135
+ }
136
+ })
137
+
138
+ const selectTab = (item) => {
139
+ if (item.disabled !== true) {
140
+ emit('update:selected', getIsObject.value ? item : item[props.keyValue])
141
+ emit('change', getIsObject.value ? item : item[props.keyValue])
132
142
  }
143
+ }
133
144
 
145
+ const getButtonClass = (item) => {
146
+ return computed(() => {
147
+ if (item.disabled) {
148
+ return ['status-disabled']
149
+ } else {
150
+ return { 'status-active': getSelected.value === item[props.keyValue], 'status-enabled': true }
151
+ }
152
+ })
134
153
  }
154
+
135
155
  </script>
136
156
 
137
- <style> /* Please, use the file src/assets/scss/components/PsTabHeader.scss */</style>
157
+ <style>
158
+ /* Please, use the file src/assets/scss/components/PsTabHeader.scss */
159
+ </style>