@policystudio/policy-studio-ui-vue 1.0.29 → 1.0.32
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/.eslintrc.js +36 -35
- package/.storybook/preview.js +7 -1
- package/README.md +6 -2
- package/babel.config.js +1 -1
- package/dist/css/psui_styles.css +1580 -185
- package/package.json +16 -5
- package/postcss.config.js +1 -1
- package/src/assets/scss/base.scss +3 -0
- package/src/assets/scss/components/PsAccordion.scss +28 -11
- package/src/assets/scss/components/PsButton.scss +39 -18
- 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/PsClimateZoneBadge.scss +1 -1
- package/src/assets/scss/components/PsCostEffectBar.scss +22 -27
- package/src/assets/scss/components/PsDataTable.scss +17 -0
- package/src/assets/scss/components/PsDialog.scss +5 -2
- package/src/assets/scss/components/PsDotLoader.scss +45 -0
- package/src/assets/scss/components/PsDraggable.scss +64 -0
- package/src/assets/scss/components/PsDropdown.scss +9 -24
- package/src/assets/scss/components/PsDropdownList.scss +19 -0
- package/src/assets/scss/components/PsInlineSelector.scss +40 -25
- 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/PsMiniTag.scss +3 -3
- 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 +50 -18
- package/src/components/accordion/PsAccordion.vue +7 -23
- package/src/components/accordion/PsAccordionItem.vue +42 -26
- 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 +27 -2
- package/src/components/chips/PsChips.vue +33 -13
- package/src/components/controls/PsCheckbox.vue +32 -16
- package/src/components/controls/PsDraggable.vue +39 -150
- package/src/components/controls/PsInlineSelector.vue +34 -16
- package/src/components/controls/PsRadioButton.vue +28 -15
- package/src/components/controls/PsSlider.vue +1 -1
- package/src/components/controls/PsSwitch.vue +20 -11
- package/src/components/controls/PsToggle.vue +33 -12
- package/src/components/datatable/PsDataTable.vue +21 -1
- package/src/components/datatable/PsDataTableItem.vue +1 -1
- package/src/components/forms/PsDropdown.vue +73 -101
- 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 +54 -41
- package/src/components/notifications/PsDialog.vue +15 -0
- package/src/components/notifications/PsToast.vue +12 -0
- package/src/components/playground/PsScrollBar.vue +54 -0
- package/src/components/tabs/PsTabHeader.vue +31 -5
- package/src/components/tooltip/PsDialogTooltip.vue +107 -24
- package/src/components/tooltip/PsRichTooltip.vue +12 -9
- package/src/components/tooltip/PsTooltip.vue +27 -11
- package/src/components/ui/PsDotLoader.vue +15 -0
- package/src/components/ui/PsIcon.vue +30 -0
- package/src/index.js +39 -7
- package/src/stories/Accordion.stories.js +12 -48
- package/src/stories/Button.stories.js +30 -7
- package/src/stories/Chips.stories.js +16 -4
- package/src/stories/Colors.stories.mdx +1 -0
- package/src/stories/Dropdown.stories.js +81 -14
- package/src/stories/InlineSelector.stories.js +1 -1
- 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/src/util/imageLoader.js +1 -1
- package/tailwind.config.js +8 -3
- package/vetur/attributes.json +1376 -0
- package/vetur/tags.json +632 -0
- package/src/components/forms/PsDropdownCopy.vue +0 -212
|
@@ -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>
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
<span> {{ search ? search : placeholder }} </span>
|
|
14
14
|
<input
|
|
15
15
|
ref="input"
|
|
16
|
-
v-model="search"
|
|
17
16
|
:label="label"
|
|
18
17
|
:placeholder="placeholder"
|
|
19
18
|
@input="$emit('input', $event)"
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
class="psui-el-inline-selector-dropdown-wrapper"
|
|
41
40
|
>
|
|
42
41
|
<slot name='loader'></slot>
|
|
43
|
-
<div>
|
|
42
|
+
<div class="psui-el-inline-selector-dropdown">
|
|
44
43
|
<div v-if="requestFetched && !jurisdictions.length">
|
|
45
44
|
<h3>Hmmmm</h3>
|
|
46
45
|
<p>Please check the spelling and try again</p>
|
|
@@ -70,18 +69,27 @@
|
|
|
70
69
|
export default {
|
|
71
70
|
name: 'PsInlineSelector',
|
|
72
71
|
props: {
|
|
72
|
+
/**
|
|
73
|
+
* It sets the default width of the inline selector.
|
|
74
|
+
*/
|
|
73
75
|
width: {
|
|
74
76
|
default: 244
|
|
75
77
|
},
|
|
78
|
+
/**
|
|
79
|
+
* It sets if it should receive focus or not when componented is mounted.
|
|
80
|
+
*/
|
|
76
81
|
focusOnMount: {
|
|
77
82
|
default: false
|
|
78
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* It sets if the component should be scrollable.
|
|
86
|
+
*/
|
|
79
87
|
shouldScroll: {
|
|
80
88
|
default: false
|
|
81
89
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
/**
|
|
91
|
+
* It sets the label of the component.
|
|
92
|
+
*/
|
|
85
93
|
label: {
|
|
86
94
|
type: String,
|
|
87
95
|
default: 'Type a City or County'
|
|
@@ -90,19 +98,31 @@ export default {
|
|
|
90
98
|
type: Boolean,
|
|
91
99
|
default: false
|
|
92
100
|
},
|
|
101
|
+
/**
|
|
102
|
+
* It sets the jurisdiction selected.
|
|
103
|
+
*/
|
|
93
104
|
jurisdictionSelected: {
|
|
94
105
|
type: [ Object, Boolean ]
|
|
95
106
|
},
|
|
107
|
+
/**
|
|
108
|
+
* It gets and set the data that was written.
|
|
109
|
+
*/
|
|
96
110
|
search: {
|
|
97
111
|
type: String,
|
|
98
112
|
default: '',
|
|
99
113
|
required: true
|
|
100
114
|
},
|
|
115
|
+
/**
|
|
116
|
+
* It provides all the jurisdictions.
|
|
117
|
+
*/
|
|
101
118
|
jurisdictions: {
|
|
102
119
|
type: Array,
|
|
103
120
|
default: () => [],
|
|
104
121
|
required: true
|
|
105
122
|
},
|
|
123
|
+
/**
|
|
124
|
+
* It is a helper for checking if fetching data was successful.
|
|
125
|
+
*/
|
|
106
126
|
requestFetched: {
|
|
107
127
|
type: Boolean,
|
|
108
128
|
},
|
|
@@ -114,22 +134,20 @@ export default {
|
|
|
114
134
|
type: Number,
|
|
115
135
|
default: 0,
|
|
116
136
|
},
|
|
137
|
+
/**
|
|
138
|
+
* It sets if the component is focused or not.
|
|
139
|
+
*/
|
|
117
140
|
isFocused:{
|
|
118
141
|
type: Boolean,
|
|
119
142
|
default: false,
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
computed:{
|
|
123
|
-
placeholder(){
|
|
124
|
-
return this.jurisdictionsAsText && !this.isFocused ? this.jurisdictionsAsText : this.label
|
|
125
143
|
},
|
|
126
|
-
|
|
127
|
-
|
|
144
|
+
/**
|
|
145
|
+
* It sets the placeholder of the component.
|
|
146
|
+
*/
|
|
147
|
+
placeholder:{
|
|
148
|
+
type: String,
|
|
128
149
|
}
|
|
129
|
-
}
|
|
130
|
-
mounted(){
|
|
131
|
-
if(this.focusOnMount) this.$refs.input.focus()
|
|
132
|
-
},
|
|
150
|
+
}
|
|
133
151
|
}
|
|
134
152
|
</script>
|
|
135
153
|
|
|
@@ -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,31 @@ 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
|
+
default() {
|
|
61
|
+
return []
|
|
62
|
+
}
|
|
52
63
|
},
|
|
64
|
+
/**
|
|
65
|
+
* It sets the values which will be use to render the footer.
|
|
66
|
+
*/
|
|
53
67
|
footer: {
|
|
54
68
|
type: Array,
|
|
55
69
|
},
|
|
70
|
+
/**
|
|
71
|
+
* It sets the alignment of the whole context.
|
|
72
|
+
*/
|
|
56
73
|
align: {
|
|
57
74
|
type: String,
|
|
58
75
|
default: 'left',
|
|
@@ -60,6 +77,9 @@ export default {
|
|
|
60
77
|
return ['center', 'right', 'left'].indexOf(value) !== -1
|
|
61
78
|
}
|
|
62
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* It sets additional styling if needed.
|
|
82
|
+
*/
|
|
63
83
|
cssStyle: {
|
|
64
84
|
type: String,
|
|
65
85
|
default: 'psui-text-gray-60'
|