@policystudio/policy-studio-ui-vue 1.1.89 → 1.1.90-access.1

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 (171) 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 +6638 -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 +12 -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 +10 -0
  84. package/src/assets/scss/components/PsProgressBar.scss +4 -4
  85. package/src/assets/scss/components/PsSwitch.scss +10 -0
  86. package/src/assets/scss/components/PsTabHeader.scss +64 -2
  87. package/src/assets/scss/components/PsTableResults.scss +51 -82
  88. package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
  89. package/src/assets/scss/components/PsTooltip.scss +149 -145
  90. package/src/components/accordion/PsAccordion.vue +20 -21
  91. package/src/components/accordion/PsAccordionItem.vue +122 -81
  92. package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
  93. package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
  94. package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
  95. package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
  96. package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
  97. package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
  98. package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
  99. package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
  100. package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
  101. package/src/components/badges-and-tags/PsTagScope.vue +17 -22
  102. package/src/components/badges-and-tags/PsTestimonialCard.vue +25 -30
  103. package/src/components/buttons/PsButton.vue +90 -98
  104. package/src/components/chips/PsChips.vue +118 -103
  105. package/src/components/collapse/PsCollapse.vue +124 -0
  106. package/src/components/controls/PsCheckbox.vue +86 -83
  107. package/src/components/controls/PsCheckboxSimple.vue +97 -97
  108. package/src/components/controls/PsDraggable.vue +100 -99
  109. package/src/components/controls/PsInlineSelector.vue +111 -113
  110. package/src/components/controls/PsRadioButton.vue +72 -60
  111. package/src/components/controls/PsRadioButtonSimple.vue +81 -77
  112. package/src/components/controls/PsSlider.vue +190 -181
  113. package/src/components/controls/PsSwitch.vue +64 -54
  114. package/src/components/controls/PsToggle.vue +62 -57
  115. package/src/components/data-graphics/PsBarChart.vue +22 -23
  116. package/src/components/datatable/PsDataTable.vue +70 -65
  117. package/src/components/datatable/PsDataTableItem.vue +30 -32
  118. package/src/components/forms/PsDropdown.vue +173 -166
  119. package/src/components/forms/PsDropdownList.vue +133 -130
  120. package/src/components/forms/PsInput.vue +163 -146
  121. package/src/components/forms/PsInputSelect.vue +121 -100
  122. package/src/components/forms/PsInputTextArea.vue +84 -74
  123. package/src/components/navigations/PsBreadcrumb.vue +25 -34
  124. package/src/components/notifications/PsDialog.vue +67 -60
  125. package/src/components/notifications/PsSimpleAlert.vue +47 -37
  126. package/src/components/notifications/PsToast.vue +48 -42
  127. package/src/components/table-results/PsTableResults.vue +527 -504
  128. package/src/components/table-results/PsTableResultsBody.vue +69 -68
  129. package/src/components/table-results/PsTableResultsHead.vue +108 -69
  130. package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
  131. package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
  132. package/src/components/table-results/PsTableResultsRow.vue +61 -58
  133. package/src/components/tabs/PsTabHeader.vue +138 -116
  134. package/src/components/tooltip/PsDialogTooltip.vue +112 -107
  135. package/src/components/tooltip/PsRichTooltip.vue +46 -43
  136. package/src/components/tooltip/PsTooltip.vue +126 -122
  137. package/src/components/ui/PsDotLoader.vue +6 -10
  138. package/src/components/ui/PsIcon.vue +149 -134
  139. package/src/index.ts +159 -0
  140. package/src/tsconfig.json +12 -0
  141. package/src/types/index.d.ts +6 -0
  142. package/src/util/GeneralFunctions.js +16 -7
  143. package/src/util/directives.ts +24 -0
  144. package/src/util/imageLoader.js +14 -7
  145. package/tailwind.config.js +12 -3
  146. package/tsconfig.json +47 -0
  147. package/.storybook/PolicyStudio.js +0 -10
  148. package/.storybook/eventBus.js +0 -3
  149. package/.storybook/main.js +0 -25
  150. package/.storybook/manager.js +0 -6
  151. package/babel.config.js +0 -3
  152. package/backup-package-lock.json +0 -37194
  153. package/dist/css/psui_styles.css +0 -110965
  154. package/postcss.config.js +0 -8
  155. package/src/components/playground/PsScrollBar.vue +0 -248
  156. package/src/index.js +0 -167
  157. package/src/stories/Playground.stories.js +0 -16
  158. /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
  159. /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
  160. /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
  161. /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
  162. /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
  163. /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
  164. /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
  165. /package/{src → doc/src}/stories/assets/colors.svg +0 -0
  166. /package/{src → doc/src}/stories/assets/comments.svg +0 -0
  167. /package/{src → doc/src}/stories/assets/direction.svg +0 -0
  168. /package/{src → doc/src}/stories/assets/flow.svg +0 -0
  169. /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
  170. /package/{src → doc/src}/stories/assets/repo.svg +0 -0
  171. /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
@@ -1,63 +1,73 @@
1
1
  <template>
2
- <div class='psui-el-switch' :class="[getComponentClass, {'disabled':disabled}]" @click="change()">
3
- <input type="checkbox" :checked="value" />
4
- <label class='psui-el-switch-button' :class="[getToggleClass]" />
2
+ <div
3
+ class="psui-el-switch"
4
+ :class="[getComponentClass, { disabled: disabled }]"
5
+ @click="change()"
6
+ tabindex="0"
7
+ >
8
+ <input
9
+ type="checkbox"
10
+ :checked="value"
11
+ >
12
+ <label
13
+ class="psui-el-switch-button"
14
+ :class="[getToggleClass]"
15
+ />
5
16
  </div>
6
17
  </template>
7
18
 
8
- <script>
19
+ <script setup>
9
20
  //FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
21
+ import { computed } from 'vue'
10
22
 
11
- export default {
12
- name: 'PsSwitch',
13
- props: {
14
- /**
15
- * It sets the label of the switch button.
16
- */
17
- label:{
18
- type: String,
19
- },
20
- /**
21
- * It sets the value of the switch button.
22
- */
23
- value:{
24
- type: Boolean,
25
- },
26
- backgroundColor: {
27
- type: String,
28
- default:'psui-bg-green-20'
29
- },
30
- /**
31
- * It sets disabling mode.
32
- */
33
- disabled:{
34
- type: Boolean,
35
- default: false
36
- },
37
- /**
38
- * It sets the size of the switch button. eg: small and big.
39
- */
40
- size:{
41
- type: String,
42
- default: 'big',
43
- validator: (value)=> ['small', 'big'].includes(value)
44
- }
23
+ const emit = defineEmits('change', 'update:value')
24
+
25
+ const props = defineProps({
26
+ /**
27
+ * It sets the label of the switch button.
28
+ */
29
+ label: {
30
+ type: String,
31
+ default: '',
45
32
  },
46
- computed:{
47
- getToggleClass(){
48
- if(this.disabled) return 'toggle-false'
49
- return this.value ? `toggle-true ${this.backgroundColor}` : 'toggle-false psui-bg-gray-40'
50
- },
51
- getComponentClass(){
52
- return `size-${this.size}`
53
- }
33
+ /**
34
+ * It sets the value of the switch button.
35
+ */
36
+ value: {
37
+ type: Boolean,
54
38
  },
55
- methods: {
56
- change() {
57
- this.$emit('update:value', !this.value)
58
- this.$emit('change', !this.value)
59
- }
60
- }
61
- }
62
- </script>
39
+ backgroundColor: {
40
+ type: String,
41
+ default: 'psui-bg-green-20',
42
+ },
43
+ /**
44
+ * It sets disabling mode.
45
+ */
46
+ disabled: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ /**
51
+ * It sets the size of the switch button. eg: small and big.
52
+ */
53
+ size: {
54
+ type: String,
55
+ default: 'big',
56
+ validator: (value) => ['small', 'big'].includes(value),
57
+ },
58
+ })
59
+
60
+ const getToggleClass = computed(() => {
61
+ if (props.disabled) return 'toggle-false'
62
+ return props.value ? `toggle-true ${props.backgroundColor}` : 'toggle-false psui-bg-gray-40'
63
+ })
63
64
 
65
+ const getComponentClass = computed(() => {
66
+ return `size-${props.size}`
67
+ })
68
+
69
+ const change = () => {
70
+ emit('update:value', !props.value)
71
+ emit('change', !props.value)
72
+ }
73
+ </script>
@@ -1,66 +1,71 @@
1
1
  <template>
2
- <div class="psui-el-toggle" role="group">
3
- <button
4
- type="button"
5
- v-for="(item, index) in items"
6
- :key="getKeyValue(item) + index"
7
- @click="selectOption(item)"
8
- :class="{ 'status-active': selected == item }"
9
- >
10
- {{ getKeyLabel(item) }}
11
- </button>
12
- </div>
2
+ <div
3
+ class="psui-el-toggle"
4
+ role="group"
5
+ >
6
+ <button
7
+ type="button"
8
+ v-for="(item, index) in items"
9
+ :key="getKeyValue(item) + index"
10
+ @click="selectOption(item)"
11
+ :class="{ 'status-active': selected == item }"
12
+ >
13
+ {{ getKeyLabel(item) }}
14
+ </button>
15
+ </div>
13
16
  </template>
14
17
 
15
- <script>
18
+ <script setup>
16
19
  //FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
17
20
 
18
- export default {
19
- name: 'PsToggle',
20
- props: {
21
- /**
22
- * It sets the items which will be used to create the toggle tab. See Figma - Controls & Selector for more information.
23
- */
24
- items: {
25
- type: Array,
26
- required: true
27
- },
28
- /**
29
- * It sets the value selected.
30
- */
31
- selected: {},
32
- /**
33
- * It sets the key label of your items if needed.
34
- */
35
- keyLabel: {
36
- type: [String, Function],
37
- default: 'label'
38
- },
39
- /**
40
- * It sets the key value of your items if needed.
41
- */
42
- keyValue: {
43
- type: [String, Function],
44
- default: 'value'
45
- }
21
+ const emit = defineEmits(['change', 'update:selected'])
22
+
23
+ const props = defineProps({
24
+ /**
25
+ * It sets the items which will be used to create the toggle tab. See Figma - Controls & Selector for more information.
26
+ */
27
+ items: {
28
+ type: Array,
29
+ required: true,
30
+ },
31
+ /**
32
+ * It sets the value selected.
33
+ */
34
+ selected: {},
35
+ /**
36
+ * It sets the key label of your items if needed.
37
+ */
38
+ keyLabel: {
39
+ type: [String, Function],
40
+ default: 'label',
46
41
  },
47
- methods: {
48
- selectOption(item) {
49
- this.$emit('update:selected', item)
50
- this.$emit('change', item)
51
- },
52
- getKeyLabel(item) {
53
- if(typeof this.keyLabel == 'function') return this.keyLabel(item)
54
- if(typeof item === 'object') return item[this.keyLabel]
55
- return item
56
- },
57
- getKeyValue(item) {
58
- if(typeof this.keyValue == 'function') return this.keyValue(item)
59
- if(typeof item === 'object') return item[this.keyLabel]
60
- return item
61
- },
62
- }
42
+ /**
43
+ * It sets the key value of your items if needed.
44
+ */
45
+ keyValue: {
46
+ type: [String, Function],
47
+ default: 'value',
48
+ },
49
+ })
50
+
51
+ const selectOption = (item) => {
52
+ emit('update:selected', item)
53
+ emit('change', item)
54
+ }
55
+
56
+ const getKeyLabel = (item) => {
57
+ if (typeof props.keyLabel == 'function') return props.keyLabel(item)
58
+ if (typeof item === 'object') return item[props.keyLabel]
59
+ return item
60
+ }
61
+
62
+ const getKeyValue = (item) => {
63
+ if (typeof props.keyValue == 'function') return props.keyValue(item)
64
+ if (typeof item === 'object') return item[props.keyLabel]
65
+ return item
63
66
  }
64
67
  </script>
65
68
 
66
- <style> /* Please, use the file src/assets/scss/components/PsToggle.scss */</style>
69
+ <style>
70
+ /* Please, use the file src/assets/scss/components/PsToggle.scss */
71
+ </style>
@@ -1,34 +1,33 @@
1
1
  <template>
2
2
  <div class="psui-el-bar-chart">
3
- <p
3
+ <p
4
4
  v-if="showNumber"
5
5
  class="psui-el-bar-chart-total"
6
- >{{ total }}</p>
6
+ >
7
+ {{ total }}
8
+ </p>
7
9
 
8
- <div
10
+ <div
9
11
  class="psui-el-bar-chart-bar"
10
- :style="{width: `${fillWidth}%`}"
11
- ></div>
12
+ :style="{ width: `${fillWidth}%` }"
13
+ />
12
14
  </div>
13
15
  </template>
14
16
 
15
- <script>
16
- export default {
17
- name: 'PsBarChart',
18
- props: {
19
- showNumber: {
20
- type: Boolean,
21
- default: true
22
- },
23
- total: {
24
- type: [String, Number],
25
- default: '5,0',
26
- },
27
- fillWidth: {
28
- type: Number,
29
- default: 50
30
- },
17
+ <script setup>
18
+
19
+ defineProps({
20
+ showNumber: {
21
+ type: Boolean,
22
+ default: true,
23
+ },
24
+ total: {
25
+ type: [String, Number],
26
+ default: '5,0',
27
+ },
28
+ fillWidth: {
29
+ type: Number,
30
+ default: 50,
31
31
  },
32
- computed: {}
33
- }
32
+ })
34
33
  </script>
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <table :class='cssAlign' class="psui-el-table psui-table">
2
+ <table
3
+ :class="cssAlign"
4
+ class="psui-el-table psui-table"
5
+ >
3
6
  <thead v-if="header">
4
7
  <th
5
8
  v-for="head in header"
@@ -9,18 +12,24 @@
9
12
  </th>
10
13
  </thead>
11
14
  <tbody v-if="type === 'simple'">
12
- <tr v-for="(dt, index) in data" :key="index">
13
- <td v-for="(head, cellRow) in header" :key="cellRow">
15
+ <tr
16
+ v-for="(dt, index) in data"
17
+ :key="index"
18
+ >
19
+ <td
20
+ v-for="(head, cellRow) in header"
21
+ :key="cellRow"
22
+ >
14
23
  {{ data[index][head] }}
15
24
  </td>
16
25
  </tr>
17
26
  </tbody>
18
- <slot v-else></slot>
27
+ <slot v-else />
19
28
  <tfoot v-if="footer">
20
29
  <th
21
30
  v-for="ft in footer"
22
31
  :key="ft"
23
- class='psui-bg-gray-10 psui-text-gray-80 psui-font-normal'
32
+ class="psui-bg-gray-10 psui-text-gray-80 psui-font-normal"
24
33
  >
25
34
  {{ ft }}
26
35
  </th>
@@ -28,70 +37,66 @@
28
37
  </table>
29
38
  </template>
30
39
 
31
- <script>
32
- export const type = ['simple', 'rich']
33
- export const alignment = ['center', 'right', 'left']
40
+ <script setup>
41
+ import { computed } from 'vue'
34
42
 
35
- export default {
36
- name: 'PsDataTable',
37
- props: {
38
- /**
39
- * It sets the type of the data table. eg: simple or rich.
40
- */
41
- type: {
42
- type: String,
43
- required: true,
44
- validator: (value) => {
45
- return ['simple', 'rich'].indexOf(value) !== -1
46
- },
47
- },
48
- /**
49
- * It sets the values which will be use to render the header.
50
- */
51
- header: {
52
- type: Array,
53
- required: true,
54
- },
55
- /**
56
- * It sets the values which will be use to render the body.
57
- */
58
- data: {
59
- type: Array,
60
- default() {
61
- return []
62
- }
43
+ const props = defineProps({
44
+ type: {
45
+ type: String,
46
+ required: true,
47
+ validator: (value) => {
48
+ return ['simple', 'rich'].indexOf(value) !== -1
63
49
  },
64
- /**
65
- * It sets the values which will be use to render the footer.
66
- */
67
- footer: {
68
- type: Array,
69
- },
70
- /**
71
- * It sets the alignment of the whole context.
72
- */
73
- align: {
74
- type: String,
75
- default: 'left',
76
- validator: (value) => {
77
- return ['center', 'right', 'left'].indexOf(value) !== -1
78
- }
50
+ },
51
+ /**
52
+ * It sets the values which will be use to render the header.
53
+ */
54
+ header: {
55
+ type: Array,
56
+ required: true,
57
+ },
58
+ /**
59
+ * It sets the values which will be use to render the body.
60
+ */
61
+ data: {
62
+ type: Array,
63
+ default() {
64
+ return []
79
65
  },
80
- /**
81
- * It sets additional styling if needed.
82
- */
83
- cssStyle: {
84
- type: String,
85
- default: 'psui-text-gray-60'
86
- }
87
66
  },
88
- computed: {
89
- cssAlign() {
90
- if (this.align === 'right') return `psui-text-right ${this.cssStyle}`
91
- if (this.align === 'center') return `psui-text-center ${this.cssStyle}`
92
- return `psui-text-left ${this.cssStyle}`
67
+ /**
68
+ * It sets the values which will be use to render the footer.
69
+ */
70
+ footer: {
71
+ type: Array,
72
+ default: () => [],
73
+ },
74
+ /**
75
+ * It sets the alignment of the whole context.
76
+ */
77
+ align: {
78
+ type: String,
79
+ default: 'left',
80
+ validator: (value) => {
81
+ return ['center', 'right', 'left'].indexOf(value) !== -1
93
82
  },
94
83
  },
95
- }
84
+ /**
85
+ * It sets additional styling if needed.
86
+ */
87
+ cssStyle: {
88
+ type: String,
89
+ default: 'psui-text-gray-60',
90
+ },
91
+ })
92
+
93
+ const cssAlign = computed(() => {
94
+ if (props.align === 'right') return `psui-text-right ${props.cssStyle}`
95
+ if (props.align === 'center') return `psui-text-center ${props.cssStyle}`
96
+ return `psui-text-left ${props.cssStyle}`
97
+ })
96
98
  </script>
97
- <style> /* Please, use the file src/assets/scss/components/PsDataTable.scss */</style>
99
+
100
+ <style>
101
+ /* Please, use the file src/assets/scss/components/PsDataTable.scss */
102
+ </style>
@@ -1,52 +1,50 @@
1
1
  <template>
2
2
  <tbody v-if="data">
3
- <tr v-for="(dt, index) in data" :key="index" >
4
- <td v-for="(el, elIndex) in dt" :key="elIndex" class="psui-px-4 psui-py-2">
3
+ <tr
4
+ v-for="(dt, index) in data"
5
+ :key="index"
6
+ >
7
+ <td
8
+ v-for="(el, elIndex) in dt"
9
+ :key="elIndex"
10
+ class="psui-px-4 psui-py-2"
11
+ >
5
12
  <div class="psui-flex psui-gap-1 psui-items-center">
6
13
  <span class="psui-text-gray-80">
7
14
  {{ el[Object.keys(el)[1]].toFixed(3) }}
8
15
  </span>
9
16
  <div
10
17
  class="psui-flex psui-items-center"
11
- :class="
12
- el[Object.keys(el)[1]] >= 0
13
- ? 'psui-text-green-70'
14
- : 'psui-text-red-70'
15
- "
18
+ :class="el[Object.keys(el)[1]] >= 0 ? 'psui-text-green-70' : 'psui-text-red-70'"
16
19
  >
17
- <i v-if="el[Object.keys(el)[1]] >= 0" class="material-icons">arrow_upward</i>
18
- <i v-else class="material-icons">arrow_downward</i>
19
- <span>
20
- {{
21
- (
22
- (el[Object.keys(el)[1]] / el[Object.keys(el)[0]]) *
23
- 100
24
- ).toFixed(2)
25
- }}%
26
- </span>
20
+ <i
21
+ v-if="el[Object.keys(el)[1]] >= 0"
22
+ class="material-icons"
23
+ >arrow_upward</i>
24
+ <i
25
+ v-else
26
+ class="material-icons"
27
+ >arrow_downward</i>
28
+ <span> {{ ((el[Object.keys(el)[1]] / el[Object.keys(el)[0]]) * 100).toFixed(2) }}% </span>
27
29
  </div>
28
30
  </div>
29
- <span class="psui-text-gray-50">{{
30
- el[Object.keys(el)[0]].toFixed(6)
31
- }}</span>
31
+ <span class="psui-text-gray-50">{{ el[Object.keys(el)[0]].toFixed(6) }}</span>
32
32
  </td>
33
33
  </tr>
34
34
  </tbody>
35
35
  </template>
36
36
 
37
- <script>
38
- export default {
39
- name: 'PsDataTableItem',
40
- props: {
41
- data: {
42
- type: Array,
43
- required: true,
44
- default: () => {
45
- return []
46
- },
37
+ <script setup>
38
+
39
+ defineProps({
40
+ data: {
41
+ type: Array,
42
+ required: true,
43
+ default: () => {
44
+ return []
47
45
  },
48
46
  },
49
- }
47
+ })
50
48
  </script>
51
49
 
52
50
  <style scoped>
@@ -54,4 +52,4 @@ export default {
54
52
  font-size: 15px;
55
53
  margin-bottom: 2px;
56
54
  }
57
- </style>
55
+ </style>