@policystudio/policy-studio-ui-vue 1.1.89 → 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.
- package/.eslintignore +1 -0
- package/.eslintrc.js +75 -67
- package/.github/workflows/deploy-storybook.yml +5 -5
- package/.nvmrc +1 -0
- package/dist/css/psui_styles_output.css +6617 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/util/GeneralFunctions.d.ts +3 -0
- package/dist/util/GeneralFunctions.js +35 -0
- package/dist/util/GeneralFunctions.js.map +1 -0
- package/dist/util/directives.d.ts +1 -0
- package/dist/util/directives.js +22 -0
- package/dist/util/directives.js.map +1 -0
- package/dist/util/imageLoader.d.ts +6 -0
- package/dist/util/imageLoader.js +52 -0
- package/dist/util/imageLoader.js.map +1 -0
- package/doc/.nvmrc +1 -0
- package/doc/.storybook/PolicyStudio.ts +11 -0
- package/doc/.storybook/main.ts +27 -0
- package/doc/.storybook/manager.ts +7 -0
- package/{.storybook/preview.js → doc/.storybook/preview.ts} +2 -3
- package/doc/package-lock.json +22653 -0
- package/doc/package.json +71 -0
- package/doc/shims-vue.d.ts +6 -0
- package/{src/stories/Accordion.stories.js → doc/src/stories/Accordion.stories.ts} +4 -5
- package/{src/stories/BadgeWithIcon.stories.js → doc/src/stories/BadgeWithIcon.stories.ts} +2 -2
- package/{src/stories/BarChart.stories.js → doc/src/stories/BarChart.stories.ts} +2 -2
- package/{src/stories/Breadcrumb.stories.js → doc/src/stories/Breadcrumb.stories.ts} +2 -5
- package/{src/stories/Button.stories.js → doc/src/stories/Button.stories.ts} +130 -130
- package/{src/stories/CardInfos.stories.js → doc/src/stories/CardInfos.stories.ts} +2 -3
- package/{src/stories/ChartLegend.stories.js → doc/src/stories/ChartLegend.stories.ts} +2 -3
- package/{src/stories/Checkbox.stories.js → doc/src/stories/Checkbox.stories.ts} +2 -2
- package/{src/stories/CheckboxSimple.stories.js → doc/src/stories/CheckboxSimple.stories.ts} +2 -2
- package/{src/stories/Chips.stories.js → doc/src/stories/Chips.stories.ts} +22 -23
- package/{src/stories/ClimateZoneBadge.stories.js → doc/src/stories/ClimateZoneBadge.stories.ts} +3 -2
- package/doc/src/stories/Collapse.stories.ts +46 -0
- package/{src/stories/CostEffectBar.stories.js → doc/src/stories/CostEffectBar.stories.ts} +3 -2
- package/{src/stories/Datatable.stories.js → doc/src/stories/Datatable.stories.ts} +7 -4
- package/{src/stories/DateCardInfo.stories.js → doc/src/stories/DateCardInfo.stories.ts} +2 -6
- package/{src/stories/Dialog.stories.js → doc/src/stories/Dialog.stories.ts} +2 -2
- package/{src/stories/Draggable.stories.js → doc/src/stories/Draggable.stories.ts} +3 -2
- package/{src/stories/Dropdown.stories.js → doc/src/stories/Dropdown.stories.ts} +4 -3
- package/{src/stories/DropdownList.stories.js → doc/src/stories/DropdownList.stories.ts} +4 -2
- package/{src/stories/ElevationSystem.stories.mdx → doc/src/stories/ElevationSystem.mdx} +1 -1
- package/{src/stories/HighlightRippleDot.stories.js → doc/src/stories/HighlightRippleDot.stories.ts} +3 -2
- package/{src/stories/Icon.stories.js → doc/src/stories/Icon.stories.ts} +3 -1
- package/{src/stories/InlineSelector.stories.js → doc/src/stories/InlineSelector.stories.ts} +2 -2
- package/{src/stories/Input.stories.js → doc/src/stories/Input.stories.ts} +7 -4
- package/{src/stories/InputSelect.stories.js → doc/src/stories/InputSelect.stories.ts} +3 -2
- package/{src/stories/InputTextArea.stories.js → doc/src/stories/InputTextArea.stories.ts} +2 -2
- package/{src/stories/Introduction.stories.mdx → doc/src/stories/Introduction.mdx} +101 -101
- package/{src/stories/MiniTag.stories.js → doc/src/stories/MiniTag.stories.ts} +9 -2
- package/{src/stories/ProgressBar.stories.js → doc/src/stories/ProgressBar.stories.ts} +3 -2
- package/{src/stories/RadioButton.stories.js → doc/src/stories/RadioButton.stories.ts} +2 -2
- package/{src/stories/RadioButtonSimple.stories.js → doc/src/stories/RadioButtonSimple.stories.ts} +2 -2
- package/{src/stories/SimpleAlert.stories.js → doc/src/stories/SimpleAlert.stories.ts} +3 -2
- package/{src/stories/Slider.stories.js → doc/src/stories/Slider.stories.ts} +6 -2
- package/{src/stories/Switch.stories.js → doc/src/stories/Switch.stories.ts} +2 -2
- package/{src/stories/TabHeader.stories.js → doc/src/stories/TabHeader.stories.ts} +6 -1
- package/{src/stories/TableResults.stories.js → doc/src/stories/TableResults.stories.ts} +11 -7
- package/{src/stories/TagScope.stories.js → doc/src/stories/TagScope.stories.ts} +3 -2
- package/{src/stories/TestimonialCard.stories.js → doc/src/stories/TestimonialCard.stories.ts} +3 -3
- package/{src/stories/Toast.stories.js → doc/src/stories/Toast.stories.ts} +2 -2
- package/{src/stories/Toggle.stories.js → doc/src/stories/Toggle.stories.ts} +7 -4
- package/{src/stories/Tooltip.stories.js → doc/src/stories/Tooltip.stories.ts} +6 -6
- package/{src/stories/Typography.stories.mdx → doc/src/stories/Typography.mdx} +107 -105
- package/doc/tsconfig.json +17 -0
- package/package.json +43 -39
- package/scripts/gulp.js +11 -0
- package/scripts/kill-port.sh +12 -0
- package/src/App.vue +30 -0
- package/src/assets/scss/base.scss +3 -30
- package/src/assets/scss/components/PsAccordion.scss +2 -2
- package/src/assets/scss/components/PsButton.scss +7 -1
- package/src/assets/scss/components/PsChips.scss +12 -7
- package/src/assets/scss/components/PsCollapse.scss +71 -0
- package/src/assets/scss/components/PsCostEffectBar.scss +4 -4
- package/src/assets/scss/components/PsDataTable.scss +1 -1
- package/src/assets/scss/components/PsDateCardInfo.scss +4 -5
- package/src/assets/scss/components/PsDialog.scss +7 -0
- package/src/assets/scss/components/PsDropdownList.scss +1 -1
- package/src/assets/scss/components/PsInput.scss +9 -0
- package/src/assets/scss/components/PsProgressBar.scss +4 -4
- package/src/assets/scss/components/PsTabHeader.scss +57 -2
- package/src/assets/scss/components/PsTableResults.scss +51 -82
- package/src/assets/scss/components/PsTestimonialCard.scss +1 -1
- package/src/assets/scss/components/PsTooltip.scss +149 -145
- package/src/components/accordion/PsAccordion.vue +20 -21
- package/src/components/accordion/PsAccordionItem.vue +121 -81
- package/src/components/badges-and-tags/PsBadgeWithIcon.vue +37 -36
- package/src/components/badges-and-tags/PsCardInfos.vue +40 -40
- package/src/components/badges-and-tags/PsChartLegend.vue +50 -41
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +13 -19
- package/src/components/badges-and-tags/PsCostEffectBar.vue +28 -61
- package/src/components/badges-and-tags/PsDateCardInfo.vue +17 -18
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +4 -3
- package/src/components/badges-and-tags/PsMiniTag.vue +39 -41
- package/src/components/badges-and-tags/PsProgressBar.vue +72 -68
- package/src/components/badges-and-tags/PsTagScope.vue +17 -22
- package/src/components/badges-and-tags/PsTestimonialCard.vue +25 -30
- package/src/components/buttons/PsButton.vue +90 -98
- package/src/components/chips/PsChips.vue +118 -103
- package/src/components/collapse/PsCollapse.vue +124 -0
- package/src/components/controls/PsCheckbox.vue +86 -83
- package/src/components/controls/PsCheckboxSimple.vue +97 -97
- package/src/components/controls/PsDraggable.vue +100 -99
- package/src/components/controls/PsInlineSelector.vue +111 -113
- package/src/components/controls/PsRadioButton.vue +72 -60
- package/src/components/controls/PsRadioButtonSimple.vue +81 -77
- package/src/components/controls/PsSlider.vue +190 -181
- package/src/components/controls/PsSwitch.vue +63 -54
- package/src/components/controls/PsToggle.vue +62 -57
- package/src/components/data-graphics/PsBarChart.vue +22 -23
- package/src/components/datatable/PsDataTable.vue +70 -65
- package/src/components/datatable/PsDataTableItem.vue +30 -32
- package/src/components/forms/PsDropdown.vue +173 -166
- package/src/components/forms/PsDropdownList.vue +133 -130
- package/src/components/forms/PsInput.vue +163 -146
- package/src/components/forms/PsInputSelect.vue +121 -100
- package/src/components/forms/PsInputTextArea.vue +84 -74
- package/src/components/navigations/PsBreadcrumb.vue +25 -34
- package/src/components/notifications/PsDialog.vue +67 -60
- package/src/components/notifications/PsSimpleAlert.vue +47 -37
- package/src/components/notifications/PsToast.vue +48 -42
- package/src/components/table-results/PsTableResults.vue +527 -504
- package/src/components/table-results/PsTableResultsBody.vue +69 -68
- package/src/components/table-results/PsTableResultsHead.vue +108 -69
- package/src/components/table-results/PsTableResultsHeadComparison.vue +88 -69
- package/src/components/table-results/PsTableResultsHeadFlexible.vue +112 -72
- package/src/components/table-results/PsTableResultsRow.vue +61 -58
- package/src/components/tabs/PsTabHeader.vue +138 -116
- package/src/components/tooltip/PsDialogTooltip.vue +112 -107
- package/src/components/tooltip/PsRichTooltip.vue +46 -43
- package/src/components/tooltip/PsTooltip.vue +126 -122
- package/src/components/ui/PsDotLoader.vue +6 -10
- package/src/components/ui/PsIcon.vue +149 -134
- package/src/index.ts +159 -0
- package/src/tsconfig.json +12 -0
- package/src/types/index.d.ts +6 -0
- package/src/util/GeneralFunctions.js +16 -7
- package/src/util/directives.ts +24 -0
- package/src/util/imageLoader.js +14 -7
- package/tailwind.config.js +12 -3
- package/tsconfig.json +47 -0
- package/.storybook/PolicyStudio.js +0 -10
- package/.storybook/eventBus.js +0 -3
- package/.storybook/main.js +0 -25
- package/.storybook/manager.js +0 -6
- package/babel.config.js +0 -3
- package/backup-package-lock.json +0 -37194
- package/dist/css/psui_styles.css +0 -110965
- package/postcss.config.js +0 -8
- package/src/components/playground/PsScrollBar.vue +0 -248
- package/src/index.js +0 -167
- package/src/stories/Playground.stories.js +0 -16
- /package/{src → doc/src}/assets/images/multifamily-units.svg +0 -0
- /package/{src → doc/src}/assets/images/policy-studio.svg +0 -0
- /package/{src/contents/ComparisonData.js → doc/src/contents/ComparisonData.ts} +0 -0
- /package/{src/contents/FlexibleData.js → doc/src/contents/FlexibleData.ts} +0 -0
- /package/{src/contents/ResultsData.js → doc/src/contents/ResultsData.ts} +0 -0
- /package/{src/stories/Colors.stories.mdx → doc/src/stories/Colors.mdx} +0 -0
- /package/{src → doc/src}/stories/assets/code-brackets.svg +0 -0
- /package/{src → doc/src}/stories/assets/colors.svg +0 -0
- /package/{src → doc/src}/stories/assets/comments.svg +0 -0
- /package/{src → doc/src}/stories/assets/direction.svg +0 -0
- /package/{src → doc/src}/stories/assets/flow.svg +0 -0
- /package/{src → doc/src}/stories/assets/plugin.svg +0 -0
- /package/{src → doc/src}/stories/assets/repo.svg +0 -0
- /package/{src → doc/src}/stories/assets/stackalt.svg +0 -0
|
@@ -1,63 +1,72 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="psui-el-switch"
|
|
4
|
+
:class="[getComponentClass, { disabled: disabled }]"
|
|
5
|
+
@click="change()"
|
|
6
|
+
>
|
|
7
|
+
<input
|
|
8
|
+
type="checkbox"
|
|
9
|
+
:checked="value"
|
|
10
|
+
>
|
|
11
|
+
<label
|
|
12
|
+
class="psui-el-switch-button"
|
|
13
|
+
:class="[getToggleClass]"
|
|
14
|
+
/>
|
|
5
15
|
</div>
|
|
6
16
|
</template>
|
|
7
17
|
|
|
8
|
-
<script>
|
|
18
|
+
<script setup>
|
|
9
19
|
//FIGMA CONTROLS & SELECTORS https://www.figma.com/file/Tto8hrNlSfuPcwd1pfqogF/%E2%9A%A1%EF%B8%8F-Design-System?node-id=1768%3A64852
|
|
20
|
+
import { computed } from 'vue'
|
|
10
21
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
}
|
|
22
|
+
const emit = defineEmits('change', 'update:value')
|
|
23
|
+
|
|
24
|
+
const props = defineProps({
|
|
25
|
+
/**
|
|
26
|
+
* It sets the label of the switch button.
|
|
27
|
+
*/
|
|
28
|
+
label: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: '',
|
|
45
31
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
getComponentClass(){
|
|
52
|
-
return `size-${this.size}`
|
|
53
|
-
}
|
|
32
|
+
/**
|
|
33
|
+
* It sets the value of the switch button.
|
|
34
|
+
*/
|
|
35
|
+
value: {
|
|
36
|
+
type: Boolean,
|
|
54
37
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
38
|
+
backgroundColor: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'psui-bg-green-20',
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* It sets disabling mode.
|
|
44
|
+
*/
|
|
45
|
+
disabled: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false,
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* It sets the size of the switch button. eg: small and big.
|
|
51
|
+
*/
|
|
52
|
+
size: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'big',
|
|
55
|
+
validator: (value) => ['small', 'big'].includes(value),
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const getToggleClass = computed(() => {
|
|
60
|
+
if (props.disabled) return 'toggle-false'
|
|
61
|
+
return props.value ? `toggle-true ${props.backgroundColor}` : 'toggle-false psui-bg-gray-40'
|
|
62
|
+
})
|
|
63
63
|
|
|
64
|
+
const getComponentClass = computed(() => {
|
|
65
|
+
return `size-${props.size}`
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const change = () => {
|
|
69
|
+
emit('update:value', !props.value)
|
|
70
|
+
emit('change', !props.value)
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
@@ -1,66 +1,71 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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>
|
|
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
|
-
>
|
|
6
|
+
>
|
|
7
|
+
{{ total }}
|
|
8
|
+
</p>
|
|
7
9
|
|
|
8
|
-
<div
|
|
10
|
+
<div
|
|
9
11
|
class="psui-el-bar-chart-bar"
|
|
10
|
-
:style="{width: `${fillWidth}%`}"
|
|
11
|
-
|
|
12
|
+
:style="{ width: `${fillWidth}%` }"
|
|
13
|
+
/>
|
|
12
14
|
</div>
|
|
13
15
|
</template>
|
|
14
16
|
|
|
15
|
-
<script>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
33
|
-
}
|
|
32
|
+
})
|
|
34
33
|
</script>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<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
|
|
13
|
-
|
|
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
|
|
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=
|
|
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
|
-
|
|
33
|
-
export const alignment = ['center', 'right', 'left']
|
|
40
|
+
<script setup>
|
|
41
|
+
import { computed } from 'vue'
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
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
|
|
4
|
-
|
|
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
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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>
|