@policystudio/policy-studio-ui-vue 1.0.30 → 1.0.31
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/.storybook/preview.js +7 -1
- package/README.md +6 -2
- package/dist/css/psui_styles.css +461 -139
- package/package.json +15 -5
- package/src/assets/scss/base.scss +2 -0
- package/src/assets/scss/components/PsAccordion.scss +28 -11
- package/src/assets/scss/components/PsButton.scss +21 -4
- package/src/assets/scss/components/PsCardInfos.scss +1 -1
- package/src/assets/scss/components/PsCheckbox.scss +4 -5
- package/src/assets/scss/components/PsChips.scss +13 -8
- package/src/assets/scss/components/PsDialog.scss +5 -2
- package/src/assets/scss/components/PsDraggable.scss +64 -0
- package/src/assets/scss/components/PsDropdown.scss +5 -22
- package/src/assets/scss/components/PsDropdownList.scss +19 -0
- package/src/assets/scss/components/PsInput.scss +8 -3
- package/src/assets/scss/components/PsInputSelect.scss +6 -3
- package/src/assets/scss/components/PsInputTextArea.scss +5 -2
- package/src/assets/scss/components/PsRadioButton.scss +5 -5
- package/src/assets/scss/components/PsSwitch.scss +4 -4
- package/src/assets/scss/components/PsTabHeader.scss +14 -0
- package/src/assets/scss/components/PsToast.scss +3 -3
- package/src/assets/scss/components/PsToggle.scss +6 -2
- package/src/assets/scss/components/PsTooltip.scss +51 -18
- package/src/components/accordion/PsAccordion.vue +7 -23
- package/src/components/accordion/PsAccordionItem.vue +41 -25
- package/src/components/badges-and-tags/PsCardInfos.vue +12 -0
- package/src/components/badges-and-tags/PsChartLegend.vue +13 -0
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +7 -0
- package/src/components/badges-and-tags/PsCostEffectBar.vue +6 -0
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +3 -1
- package/src/components/badges-and-tags/PsMiniTag.vue +6 -0
- package/src/components/badges-and-tags/PsProgressBar.vue +17 -9
- package/src/components/buttons/PsButton.vue +22 -1
- package/src/components/chips/PsChips.vue +24 -3
- package/src/components/controls/PsCheckbox.vue +32 -16
- package/src/components/controls/PsDraggable.vue +39 -150
- package/src/components/controls/PsInlineSelector.vue +30 -0
- package/src/components/controls/PsRadioButton.vue +28 -15
- package/src/components/controls/PsSwitch.vue +20 -11
- package/src/components/controls/PsToggle.vue +33 -12
- package/src/components/datatable/PsDataTable.vue +18 -0
- package/src/components/forms/PsDropdown.vue +18 -60
- package/src/components/forms/PsDropdownList.vue +82 -0
- package/src/components/forms/PsInput.vue +28 -1
- package/src/components/forms/PsInputSelect.vue +21 -0
- package/src/components/forms/PsInputTextArea.vue +53 -40
- package/src/components/notifications/PsDialog.vue +15 -0
- package/src/components/notifications/PsToast.vue +12 -0
- package/src/components/playground/PsScrollBar.vue +15 -0
- package/src/components/tabs/PsTabHeader.vue +18 -0
- package/src/components/tooltip/PsDialogTooltip.vue +103 -20
- package/src/components/tooltip/PsRichTooltip.vue +6 -3
- package/src/components/tooltip/PsTooltip.vue +19 -3
- package/src/components/ui/PsIcon.vue +30 -0
- package/src/index.js +30 -2
- package/src/stories/Accordion.stories.js +12 -48
- package/src/stories/Button.stories.js +30 -7
- package/src/stories/Chips.stories.js +14 -2
- package/src/stories/Dropdown.stories.js +36 -13
- package/src/stories/Playground.stories.js +16 -0
- package/src/stories/Switch.stories.js +8 -2
- package/src/stories/Toast.stories.js +16 -16
- package/src/stories/Tooltip.stories.js +6 -6
- package/src/stories/Typography.stories.mdx +22 -18
- package/src/util/GeneralFunctions.js +8 -0
- package/tailwind.config.js +7 -3
- package/vetur/attributes.json +1376 -0
- package/vetur/tags.json +632 -0
- package/src/components/forms/PsDropdownCopy.vue +0 -212
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
<input
|
|
4
4
|
:id="label"
|
|
5
5
|
type="checkbox"
|
|
6
|
-
:value="
|
|
7
|
-
|
|
8
|
-
:
|
|
9
|
-
:disabled='disabled'
|
|
6
|
+
:value="inputValue"
|
|
7
|
+
v-model="model"
|
|
8
|
+
:disabled="disabled"
|
|
10
9
|
/>
|
|
11
10
|
<label :for="label" class="psui-el-checkmark"><span>{{ label }}</span></label>
|
|
12
11
|
</div>
|
|
@@ -18,41 +17,58 @@
|
|
|
18
17
|
export default {
|
|
19
18
|
name: 'PsCheckbox',
|
|
20
19
|
props: {
|
|
20
|
+
/**
|
|
21
|
+
* It sets the label of the checkbox input.
|
|
22
|
+
*/
|
|
21
23
|
label: {
|
|
22
24
|
type: String,
|
|
23
25
|
default: '',
|
|
24
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* It sets the value which should be monitored.
|
|
29
|
+
*/
|
|
30
|
+
inputValue: {
|
|
31
|
+
type: String,
|
|
32
|
+
},
|
|
33
|
+
value:{
|
|
34
|
+
type: Array
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* It disables the checkbox input.
|
|
38
|
+
*/
|
|
25
39
|
disabled: {
|
|
26
40
|
type: Boolean,
|
|
27
41
|
default: false,
|
|
28
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* It set the of the checkbox input. eg: big and small.
|
|
45
|
+
*/
|
|
29
46
|
size: {
|
|
30
47
|
type: String,
|
|
31
48
|
default: 'big',
|
|
32
49
|
validator: (value)=> ['big', 'small'].includes(value)
|
|
33
50
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
/**
|
|
52
|
+
* It set the layout of the checkbox input. eg: default and mixed.
|
|
53
|
+
*/
|
|
37
54
|
layout:{
|
|
38
55
|
type: String,
|
|
39
56
|
default: 'default',
|
|
40
57
|
validator: (value)=> ['default','mixed'].includes(value)
|
|
41
58
|
}
|
|
42
59
|
},
|
|
43
|
-
emits:['@update:checked', 'value'],
|
|
44
60
|
computed:{
|
|
45
61
|
getComponentClass(){
|
|
46
62
|
return `size-${this.size} layout-${this.layout}`
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.$emit('
|
|
63
|
+
},
|
|
64
|
+
model: {
|
|
65
|
+
get(){
|
|
66
|
+
return this.value
|
|
67
|
+
},
|
|
68
|
+
set(value){
|
|
69
|
+
this.$emit('input', value)
|
|
54
70
|
}
|
|
55
|
-
}
|
|
71
|
+
}
|
|
56
72
|
},
|
|
57
73
|
}
|
|
58
74
|
</script>
|
|
@@ -1,184 +1,73 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="psui-
|
|
3
|
-
<div class="psui-
|
|
2
|
+
<div class="psui-el-draggable">
|
|
3
|
+
<div class="psui-el-draggable-wrapper"
|
|
4
4
|
v-for="(columnGroup, indexColumnGroup) in getColumns.columnGroups"
|
|
5
5
|
:key="indexColumnGroup"
|
|
6
|
-
:
|
|
6
|
+
:ref="indexColumnGroup"
|
|
7
7
|
>
|
|
8
8
|
<!-- COLUMN GROUP -->
|
|
9
9
|
<div
|
|
10
|
-
class="psui-
|
|
10
|
+
class="psui-el-draggable-title"
|
|
11
11
|
draggable="true"
|
|
12
|
-
@dragstart="
|
|
13
|
-
@dragover="
|
|
14
|
-
@dragend="
|
|
12
|
+
@dragstart="onDragStart"
|
|
13
|
+
@dragover="$emit('drag-over', $event)"
|
|
14
|
+
@dragend="onDragEnd"
|
|
15
15
|
>
|
|
16
|
-
<h2
|
|
17
|
-
<i
|
|
16
|
+
<h2 >{{columnGroup.title}}</h2>
|
|
17
|
+
<i >drag_indicator</i>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
<
|
|
20
|
+
<ul class="psui-el-draggable-list-items-wrapper">
|
|
21
21
|
<!-- COLUMNS -->
|
|
22
|
-
<
|
|
22
|
+
<li
|
|
23
23
|
v-for="(column, indexColumn) in columnGroup.columns"
|
|
24
24
|
:key="`edit-columns-column-${indexColumnGroup}-${indexColumn}`"
|
|
25
25
|
:id="`edit-columns-column-${indexColumnGroup}-${indexColumn}`"
|
|
26
26
|
>
|
|
27
|
-
<div class="psui-
|
|
27
|
+
<div class="psui-el-draggable-item-wrapper"
|
|
28
28
|
draggable="true"
|
|
29
|
-
@dragstart="
|
|
30
|
-
@dragover="
|
|
31
|
-
@dragend="
|
|
32
|
-
:class="{ 'is-dragging-out' : checkColumnIsDragOver({ indexColumnGroup, indexColumn }) }"
|
|
29
|
+
@dragstart="$emit('drag-start-item',$event)"
|
|
30
|
+
@dragover="$emit('drag-over-item',$event)"
|
|
31
|
+
@dragend="$emit('drag-end-item',$event)"
|
|
33
32
|
>
|
|
34
|
-
<
|
|
35
|
-
</
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class="psui-whitespace-no-wrap"
|
|
39
|
-
:label="column.title"
|
|
40
|
-
:value="column.isActive"
|
|
41
|
-
@change="toggleColumnIsActive({ studyKey: getColumns.key, indexColumnGroup, indexColumn, columnGroupKey: columnGroup.key})"
|
|
42
|
-
></Checkbox> -->
|
|
43
|
-
<div class="psui-w-full psui-flex psui-justify-end">
|
|
44
|
-
<i class='material-icons-round psui-text-gray-30'>drag_indicator</i>
|
|
33
|
+
<slot name="item">
|
|
34
|
+
</slot>
|
|
35
|
+
<div class="psui-el-draggable-item-icon">
|
|
36
|
+
<i>drag_indicator</i>
|
|
45
37
|
</div>
|
|
46
38
|
</div>
|
|
47
|
-
</
|
|
48
|
-
</
|
|
39
|
+
</li>
|
|
40
|
+
</ul>
|
|
49
41
|
</div>
|
|
50
42
|
</div>
|
|
51
43
|
</template>
|
|
52
44
|
|
|
53
45
|
<script>
|
|
54
|
-
import PsCheckbox from './PsCheckbox.vue'
|
|
55
46
|
|
|
56
47
|
export default {
|
|
57
|
-
name: '
|
|
58
|
-
|
|
59
|
-
props: ['getColumns', 'module'],
|
|
60
|
-
data() {
|
|
61
|
-
return {
|
|
62
|
-
// Column
|
|
63
|
-
isDraggingColumnGroup: -1,
|
|
64
|
-
isDraggingOverColumn: -1,
|
|
65
|
-
isDraggingColumn: -1,
|
|
66
|
-
|
|
67
|
-
// Group
|
|
68
|
-
isDraggingGroup: -1,
|
|
69
|
-
isDraggingOverGroup: -1,
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
computed: {
|
|
74
|
-
getColumnsStateKey() {
|
|
75
|
-
return `${this.module}Columns`
|
|
76
|
-
},
|
|
77
|
-
getMoveColumnStoreMutationName() {
|
|
78
|
-
return `${this.module}/moveColumnItem`
|
|
79
|
-
},
|
|
80
|
-
getMoveColumnGroupStoreMutationName() {
|
|
81
|
-
return `${this.module}/moveColumnGroup`
|
|
82
|
-
},
|
|
83
|
-
getToggleColumnIsActiveStoreMutationName() {
|
|
84
|
-
return `${this.module}/toggleColumnIsActive`
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
methods: {
|
|
90
|
-
toggleColumnIsActive({ studyKey, indexColumnGroup, indexColumn, columnGroupKey }) {
|
|
91
|
-
this.$store.commit(this.getToggleColumnIsActiveStoreMutationName, { columnsStateKey: this.getColumnsStateKey, studyKey, indexColumnGroup, indexColumn, columnGroupKey })
|
|
92
|
-
},
|
|
93
|
-
|
|
48
|
+
name: 'PsDraggable',
|
|
49
|
+
props: {
|
|
94
50
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.isDraggingColumnGroup = indexColumnGroup
|
|
100
|
-
},
|
|
101
|
-
dragEndColumn() {
|
|
102
|
-
this.moveItemColumn({
|
|
103
|
-
studyKey: this.getColumns.key,
|
|
104
|
-
indexColumnGroup: this.isDraggingColumnGroup,
|
|
105
|
-
from: this.isDraggingColumn,
|
|
106
|
-
to: this.isDraggingOverColumn
|
|
107
|
-
})
|
|
108
|
-
this.dragLeaveColumn()
|
|
109
|
-
this.dragLeaveGroup()
|
|
110
|
-
},
|
|
111
|
-
dragOverColumn({ indexColumnGroup, indexColumn }) {
|
|
112
|
-
if(this.isDraggingColumnGroup != indexColumnGroup) return
|
|
113
|
-
this.isDraggingOverColumn = indexColumn
|
|
51
|
+
* It sets the data that will be used.
|
|
52
|
+
*/
|
|
53
|
+
getColumns: {
|
|
54
|
+
type: Object,
|
|
114
55
|
},
|
|
115
|
-
checkColumnIsDragOver({indexColumnGroup, indexColumn }) {
|
|
116
|
-
return (this.isDraggingColumnGroup == indexColumnGroup && this.isDraggingOverColumn == indexColumn)
|
|
117
|
-
},
|
|
118
|
-
dragLeaveColumn() {
|
|
119
|
-
this.isDraggingColumn = -1
|
|
120
|
-
this.isDraggingColumnGroup = -1
|
|
121
|
-
this.isDraggingOverColumn = -1
|
|
122
|
-
},
|
|
123
|
-
moveItemColumn({ studyKey, indexColumnGroup, from, to}) {
|
|
124
|
-
this.$store.commit(this.getMoveColumnStoreMutationName, {
|
|
125
|
-
columnsStateKey: this.getColumnsStateKey,
|
|
126
|
-
studyKey,
|
|
127
|
-
indexColumnGroup,
|
|
128
|
-
from,
|
|
129
|
-
to
|
|
130
|
-
})
|
|
131
|
-
this.blinkColumns({ indexColumnGroup, to })
|
|
132
|
-
this.dragLeaveColumn()
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
blinkColumns({ indexColumnGroup, to }) {
|
|
136
|
-
const colToBlink = document.getElementById(`edit-columns-column-${indexColumnGroup}-${to}`)
|
|
137
|
-
if(colToBlink) {
|
|
138
|
-
colToBlink.classList.add('blink')
|
|
139
|
-
setTimeout(() => colToBlink.classList.remove('blink'), 800)
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
|
|
143
56
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
to: this.isDraggingOverGroup
|
|
154
|
-
})
|
|
155
|
-
this.dragLeaveGroup()
|
|
156
|
-
},
|
|
157
|
-
dragOverGroup({ indexColumnGroup }) {
|
|
158
|
-
if(this.isDraggingGroup < 0) return
|
|
159
|
-
this.isDraggingOverGroup = indexColumnGroup
|
|
160
|
-
},
|
|
161
|
-
dragLeaveGroup() {
|
|
162
|
-
this.isDraggingGroup = -1
|
|
163
|
-
this.isDraggingOverGroup = -1
|
|
57
|
+
* It sets the module which will be used to set getters and actions.
|
|
58
|
+
*/
|
|
59
|
+
module:{
|
|
60
|
+
type: String
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
methods:{
|
|
64
|
+
onDragStart(event){
|
|
65
|
+
this.$emit('drag-start', event)
|
|
164
66
|
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
studyKey,
|
|
169
|
-
from,to
|
|
170
|
-
})
|
|
67
|
+
|
|
68
|
+
onDragEnd(event){
|
|
69
|
+
this.$emit('drag-end',event)
|
|
171
70
|
}
|
|
172
|
-
|
|
173
71
|
}
|
|
174
72
|
}
|
|
175
73
|
</script>
|
|
176
|
-
<style scoped>
|
|
177
|
-
.app-draggable-list-item {
|
|
178
|
-
cursor: grab;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.app-draggable-list-item label {
|
|
182
|
-
margin-bottom: 0;
|
|
183
|
-
}
|
|
184
|
-
</style>
|
|
@@ -69,15 +69,27 @@
|
|
|
69
69
|
export default {
|
|
70
70
|
name: 'PsInlineSelector',
|
|
71
71
|
props: {
|
|
72
|
+
/**
|
|
73
|
+
* It sets the default width of the inline selector.
|
|
74
|
+
*/
|
|
72
75
|
width: {
|
|
73
76
|
default: 244
|
|
74
77
|
},
|
|
78
|
+
/**
|
|
79
|
+
* It sets if it should receive focus or not when componented is mounted.
|
|
80
|
+
*/
|
|
75
81
|
focusOnMount: {
|
|
76
82
|
default: false
|
|
77
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* It sets if the component should be scrollable.
|
|
86
|
+
*/
|
|
78
87
|
shouldScroll: {
|
|
79
88
|
default: false
|
|
80
89
|
},
|
|
90
|
+
/**
|
|
91
|
+
* It sets the label of the component.
|
|
92
|
+
*/
|
|
81
93
|
label: {
|
|
82
94
|
type: String,
|
|
83
95
|
default: 'Type a City or County'
|
|
@@ -86,19 +98,31 @@ export default {
|
|
|
86
98
|
type: Boolean,
|
|
87
99
|
default: false
|
|
88
100
|
},
|
|
101
|
+
/**
|
|
102
|
+
* It sets the jurisdiction selected.
|
|
103
|
+
*/
|
|
89
104
|
jurisdictionSelected: {
|
|
90
105
|
type: [ Object, Boolean ]
|
|
91
106
|
},
|
|
107
|
+
/**
|
|
108
|
+
* It gets and set the data that was written.
|
|
109
|
+
*/
|
|
92
110
|
search: {
|
|
93
111
|
type: String,
|
|
94
112
|
default: '',
|
|
95
113
|
required: true
|
|
96
114
|
},
|
|
115
|
+
/**
|
|
116
|
+
* It provides all the jurisdictions.
|
|
117
|
+
*/
|
|
97
118
|
jurisdictions: {
|
|
98
119
|
type: Array,
|
|
99
120
|
default: () => [],
|
|
100
121
|
required: true
|
|
101
122
|
},
|
|
123
|
+
/**
|
|
124
|
+
* It is a helper for checking if fetching data was successful.
|
|
125
|
+
*/
|
|
102
126
|
requestFetched: {
|
|
103
127
|
type: Boolean,
|
|
104
128
|
},
|
|
@@ -110,10 +134,16 @@ export default {
|
|
|
110
134
|
type: Number,
|
|
111
135
|
default: 0,
|
|
112
136
|
},
|
|
137
|
+
/**
|
|
138
|
+
* It sets if the component is focused or not.
|
|
139
|
+
*/
|
|
113
140
|
isFocused:{
|
|
114
141
|
type: Boolean,
|
|
115
142
|
default: false,
|
|
116
143
|
},
|
|
144
|
+
/**
|
|
145
|
+
* It sets the placeholder of the component.
|
|
146
|
+
*/
|
|
117
147
|
placeholder:{
|
|
118
148
|
type: String,
|
|
119
149
|
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
<input
|
|
4
4
|
:id="label"
|
|
5
5
|
type="radio"
|
|
6
|
-
:value="
|
|
7
|
-
|
|
8
|
-
:checked="checked"
|
|
6
|
+
:value="inputValue"
|
|
7
|
+
v-model="model"
|
|
9
8
|
:disabled='disabled'
|
|
10
9
|
/>
|
|
11
10
|
<label :for="label" class="psui-el-checkmark"><span>{{ label }}</span></label>
|
|
@@ -19,37 +18,51 @@
|
|
|
19
18
|
export default {
|
|
20
19
|
name: 'PsRadioButton',
|
|
21
20
|
props: {
|
|
21
|
+
/**
|
|
22
|
+
* It sets the label of the radio button.
|
|
23
|
+
*/
|
|
22
24
|
label: {
|
|
23
25
|
type: String,
|
|
24
26
|
default: '',
|
|
25
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* It's the value of the checkbox
|
|
30
|
+
*/
|
|
31
|
+
inputValue:{
|
|
32
|
+
type: String,
|
|
33
|
+
},
|
|
34
|
+
value:{
|
|
35
|
+
type: String
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* It disables the radio button. All mouse events are disabled.
|
|
39
|
+
*/
|
|
26
40
|
disabled: {
|
|
27
41
|
type: Boolean,
|
|
28
42
|
default: false
|
|
29
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* It sets the size of the radio button. eg: big and small.
|
|
46
|
+
*/
|
|
30
47
|
size: {
|
|
31
48
|
type: String,
|
|
32
49
|
default: 'big',
|
|
33
50
|
validator: (value) => ['big', 'small'].includes(value)
|
|
34
51
|
},
|
|
35
|
-
checked:{
|
|
36
|
-
type: Boolean,
|
|
37
|
-
}
|
|
38
52
|
},
|
|
39
|
-
emits:['@update:checked', 'value'],
|
|
40
53
|
computed: {
|
|
41
54
|
getComponentClass(){
|
|
42
55
|
return `size-${this.size}`
|
|
56
|
+
},
|
|
57
|
+
model: {
|
|
58
|
+
get(){
|
|
59
|
+
return this.value
|
|
60
|
+
},
|
|
61
|
+
set(value){
|
|
62
|
+
this.$emit('input', value)
|
|
43
63
|
}
|
|
64
|
+
}
|
|
44
65
|
},
|
|
45
|
-
methods:{
|
|
46
|
-
onChange(event){
|
|
47
|
-
if(!this.disabled){
|
|
48
|
-
this.$emit('value', event.target.value)
|
|
49
|
-
this.$emit('update:checked', event.target.checked)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
66
|
}
|
|
54
67
|
</script>
|
|
55
68
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class='psui-el-switch' :class="getComponentClass">
|
|
3
|
-
<input type="checkbox" :id='label'
|
|
4
|
-
<
|
|
5
|
-
<label :for="label" class='psui-el-switch-button' :class="getToggleClass" />
|
|
6
|
-
</transition>
|
|
3
|
+
<input type="checkbox" :id='label' v-model="getValue">
|
|
4
|
+
<label :for="label" class='psui-el-switch-button' :class="getToggleClass" />
|
|
7
5
|
</div>
|
|
8
6
|
</template>
|
|
9
7
|
|
|
@@ -13,13 +11,21 @@
|
|
|
13
11
|
export default {
|
|
14
12
|
name: 'PsSwitch',
|
|
15
13
|
props: {
|
|
14
|
+
/**
|
|
15
|
+
* It sets the label of the switch button.
|
|
16
|
+
*/
|
|
16
17
|
label:{
|
|
17
18
|
type: String,
|
|
18
19
|
},
|
|
20
|
+
/**
|
|
21
|
+
* It sets the value of the switch button.
|
|
22
|
+
*/
|
|
19
23
|
value:{
|
|
20
24
|
type: Boolean,
|
|
21
|
-
required: true,
|
|
22
25
|
},
|
|
26
|
+
/**
|
|
27
|
+
* It sets the size of the switch button. eg: small and big.
|
|
28
|
+
*/
|
|
23
29
|
size:{
|
|
24
30
|
type: String,
|
|
25
31
|
default: 'big',
|
|
@@ -32,14 +38,17 @@ export default {
|
|
|
32
38
|
},
|
|
33
39
|
getComponentClass(){
|
|
34
40
|
return `size-${this.size}`
|
|
41
|
+
},
|
|
42
|
+
getValue:{
|
|
43
|
+
get(){
|
|
44
|
+
return this.value
|
|
45
|
+
},
|
|
46
|
+
set(value){
|
|
47
|
+
this.$emit('input', value)
|
|
48
|
+
this.$emit('change', value)
|
|
49
|
+
}
|
|
35
50
|
}
|
|
36
51
|
},
|
|
37
|
-
methods:{
|
|
38
|
-
onChange(event){
|
|
39
|
-
this.value = event.target.checked
|
|
40
|
-
this.$emit('update:value', event.target.value)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
52
|
}
|
|
44
53
|
</script>
|
|
45
54
|
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<button
|
|
4
4
|
type="button"
|
|
5
5
|
v-for="(item, index) in items"
|
|
6
|
-
:key="index"
|
|
6
|
+
:key="getKeyValue(item) + index"
|
|
7
7
|
@click="selectOption(item)"
|
|
8
|
-
:class="{ 'status-active':
|
|
8
|
+
:class="{ 'status-active': selected == item }"
|
|
9
9
|
>
|
|
10
|
-
{{ item }}
|
|
10
|
+
{{ getKeyLabel(item) }}
|
|
11
11
|
</button>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
@@ -18,26 +18,47 @@
|
|
|
18
18
|
export default {
|
|
19
19
|
name: 'PsToggle',
|
|
20
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
|
+
*/
|
|
21
24
|
items: {
|
|
22
25
|
type: Array,
|
|
23
26
|
required: true
|
|
24
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* It sets the value selected.
|
|
30
|
+
*/
|
|
25
31
|
selected: {},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return false
|
|
33
|
-
}
|
|
32
|
+
/**
|
|
33
|
+
* It sets the key label of your items if needed.
|
|
34
|
+
*/
|
|
35
|
+
keyLabel: {
|
|
36
|
+
type: [String, Function],
|
|
37
|
+
default: 'label'
|
|
34
38
|
},
|
|
39
|
+
/**
|
|
40
|
+
* It sets the key value of your items if needed.
|
|
41
|
+
*/
|
|
42
|
+
keyValue: {
|
|
43
|
+
type: [String, Function],
|
|
44
|
+
default: 'value'
|
|
45
|
+
}
|
|
35
46
|
},
|
|
36
47
|
methods: {
|
|
37
48
|
selectOption(item) {
|
|
38
49
|
this.$emit('update:selected', item)
|
|
39
50
|
this.$emit('change', item)
|
|
40
|
-
}
|
|
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
|
+
},
|
|
41
62
|
}
|
|
42
63
|
}
|
|
43
64
|
</script>
|
|
@@ -35,6 +35,9 @@ export const alignment = ['center', 'right', 'left']
|
|
|
35
35
|
export default {
|
|
36
36
|
name: 'PsDataTable',
|
|
37
37
|
props: {
|
|
38
|
+
/**
|
|
39
|
+
* It sets the type of the data table. eg: simple or rich.
|
|
40
|
+
*/
|
|
38
41
|
type: {
|
|
39
42
|
type: String,
|
|
40
43
|
required: true,
|
|
@@ -42,17 +45,29 @@ export default {
|
|
|
42
45
|
return ['simple', 'rich'].indexOf(value) !== -1
|
|
43
46
|
},
|
|
44
47
|
},
|
|
48
|
+
/**
|
|
49
|
+
* It sets the values which will be use to render the header.
|
|
50
|
+
*/
|
|
45
51
|
header: {
|
|
46
52
|
type: Array,
|
|
47
53
|
required: true,
|
|
48
54
|
},
|
|
55
|
+
/**
|
|
56
|
+
* It sets the values which will be use to render the body.
|
|
57
|
+
*/
|
|
49
58
|
data: {
|
|
50
59
|
type: Array,
|
|
51
60
|
required: true
|
|
52
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* It sets the values which will be use to render the footer.
|
|
64
|
+
*/
|
|
53
65
|
footer: {
|
|
54
66
|
type: Array,
|
|
55
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* It sets the alignment of the whole context.
|
|
70
|
+
*/
|
|
56
71
|
align: {
|
|
57
72
|
type: String,
|
|
58
73
|
default: 'left',
|
|
@@ -60,6 +75,9 @@ export default {
|
|
|
60
75
|
return ['center', 'right', 'left'].indexOf(value) !== -1
|
|
61
76
|
}
|
|
62
77
|
},
|
|
78
|
+
/**
|
|
79
|
+
* It sets additional styling if needed.
|
|
80
|
+
*/
|
|
63
81
|
cssStyle: {
|
|
64
82
|
type: String,
|
|
65
83
|
default: 'psui-text-gray-60'
|