@policystudio/policy-studio-ui-vue 1.0.18 → 1.0.22
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 +67 -0
- package/.storybook/main.js +11 -2
- package/.storybook/preview.js +1 -1
- package/README.md +8 -0
- package/babel.config.js +3 -0
- package/backup-package-lock.json +37194 -0
- package/{src/assets/scss/tailwind.css → dist/css/psui_styles.css} +16720 -17120
- package/package.json +32 -19
- package/postcss.config.js +2 -0
- package/src/assets/images/check-checkbox-button.svg +1 -0
- package/src/assets/images/radio-checked-button.svg +1 -0
- package/src/assets/scss/base.scss +6 -5
- package/src/assets/scss/components/PsInput.scss +89 -0
- package/src/components/accordion/PsAccordion.vue +40 -0
- package/src/components/accordion/PsAccordionItem.vue +102 -0
- package/src/components/badges-and-tags/PsChartLegend.vue +128 -0
- package/src/components/badges-and-tags/PsClimateZoneBadge.vue +18 -0
- package/src/components/badges-and-tags/PsCostEffectBar.vue +114 -0
- package/src/components/badges-and-tags/PsHighlightRippleDot.vue +78 -0
- package/src/components/badges-and-tags/PsMiniTag.vue +46 -0
- package/src/components/badges-and-tags/PsProgressBar.vue +0 -0
- package/src/components/buttons/PsButton.vue +36 -13
- package/src/components/chips/PsChips.vue +154 -0
- package/src/components/controls/PsCheckbox.vue +30 -17
- package/src/components/controls/PsDraggable.vue +174 -3
- package/src/components/controls/PsRadioButton.vue +67 -60
- package/src/components/controls/PsSlider.vue +13 -12
- package/src/components/controls/PsSwitch.vue +76 -76
- package/src/components/datatable/PsDataTable.vue +89 -0
- package/src/components/datatable/PsDataTableItem.vue +57 -0
- package/src/components/forms/PsDropdown.vue +196 -0
- package/src/components/forms/PsInput.vue +122 -99
- package/src/components/notifications/PsDialog.vue +37 -18
- package/src/components/tabs/PsTabHeader.vue +20 -21
- package/src/components/tooltip/PsDialogTooltip.vue +79 -0
- package/src/components/tooltip/PsRichTooltip.vue +44 -0
- package/src/components/tooltip/PsTooltip.vue +118 -0
- package/src/components/ui/PsIcon.vue +128 -0
- package/src/index.js +53 -24
- package/src/stories/Accordion.stories.js +41 -0
- package/src/stories/Button.stories.js +11 -11
- package/src/stories/ChartLegend.stories.js +16 -0
- package/src/stories/Checkbox.stories.js +21 -14
- package/src/stories/Chips.stories.js +55 -0
- package/src/stories/ClimateZoneBadge.stories.js +24 -0
- package/src/stories/Colors.stories.mdx +35 -35
- package/src/stories/CostEffectBar.stories.js +23 -0
- package/src/stories/Datatable.stories.js +50 -0
- package/src/stories/Dialog.stories.js +150 -17
- package/src/stories/Draggable.stories.js +22 -0
- package/src/stories/Dropdown.stories.js +32 -0
- package/src/stories/HighlightRippleDot.stories.js +16 -0
- package/src/stories/Input.stories.js +46 -15
- package/src/stories/MiniTag.stories.js +46 -0
- package/src/stories/ProgressBar.stories.js +23 -0
- package/src/stories/RadioButton.stories.js +25 -9
- package/src/stories/Slider.stories.js +9 -9
- package/src/stories/Swith.stories.js +10 -10
- package/src/stories/TabHeader.stories.js +9 -9
- package/src/stories/Toast.stories.js +13 -13
- package/src/stories/Toggle.stories.js +12 -13
- package/src/stories/Tooltip.stories.js +114 -0
- package/src/util/GeneralFunctions.js +22 -0
- package/src/util/imageLoader.js +50 -0
- package/tailwind.config.js +82 -45
- package/src/assets/scss/tailwind.scss +0 -61088
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="cssClass">
|
|
3
|
+
<div class="psui-w-full">{{ message }}</div>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export const typeOptions = ['informative', 'success', 'warning', 'error']
|
|
9
|
+
export default {
|
|
10
|
+
name: 'PsMiniTag',
|
|
11
|
+
props: {
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'informative',
|
|
15
|
+
validator: (value) => typeOptions.indexOf(value) !== -1,
|
|
16
|
+
},
|
|
17
|
+
message: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
colors: {
|
|
25
|
+
informative: { background: 'blue-20', color: 'blue-60' },
|
|
26
|
+
success: { background: 'green-10', color: 'green-70' },
|
|
27
|
+
warning: { background: 'yellow-10', color: 'yellow-70' },
|
|
28
|
+
error: { background: 'red-10', color: 'red-20' },
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
computed: {
|
|
33
|
+
cssClass() {
|
|
34
|
+
return `fit-content psui-flex psui-rounded-lg psui-px-2 psui-items-center psui-justify-center psui-flex-row psui-mx-6 psui-bg-${
|
|
35
|
+
this.colors[this.type].background
|
|
36
|
+
} psui-text-${this.colors[this.type].color}`
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<style scoped>
|
|
43
|
+
.fit-content {
|
|
44
|
+
width: fit-content;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
|
-
class="psui-font-bold psui-
|
|
3
|
+
class="psui-font-bold psui-items-center psui-flex psui-rounded-md"
|
|
4
4
|
:class="classes"
|
|
5
5
|
@click="onClick()"
|
|
6
6
|
>
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
>
|
|
11
11
|
{{ icon }}
|
|
12
12
|
</i>
|
|
13
|
-
<
|
|
13
|
+
<span
|
|
14
|
+
v-if="label"
|
|
15
|
+
class="psui-flex-grow psui-text-left"
|
|
16
|
+
>{{ label }}
|
|
17
|
+
</span>
|
|
14
18
|
<i
|
|
15
19
|
v-if="iconRight"
|
|
16
20
|
:class="['psui-ml-2', iconClasses]"
|
|
@@ -26,7 +30,6 @@ export default {
|
|
|
26
30
|
props: {
|
|
27
31
|
label: {
|
|
28
32
|
type: String,
|
|
29
|
-
required: true
|
|
30
33
|
},
|
|
31
34
|
outline: {
|
|
32
35
|
type: Boolean,
|
|
@@ -69,38 +72,58 @@ export default {
|
|
|
69
72
|
},
|
|
70
73
|
computed: {
|
|
71
74
|
iconClasses() {
|
|
72
|
-
const size = this.
|
|
75
|
+
const size = this.size === 'small' ? 'psui-text-small' : this.size === 'medium' ? 'psui-text-small' : 'psui-text-big'
|
|
73
76
|
const color = this.iconColor.length > 0 ? `psui-text-${this.iconColor}` : ''
|
|
74
77
|
return `psui-my-auto material-icons ${size} ${color}`
|
|
75
78
|
},
|
|
76
79
|
classes() {
|
|
77
|
-
let sizeCss = '
|
|
78
|
-
|
|
79
|
-
if (this.size === '
|
|
80
|
-
if (this.
|
|
81
|
-
if (this.
|
|
80
|
+
let sizeCss = ''
|
|
81
|
+
|
|
82
|
+
if (this.size === 'medium') sizeCss = 'medium'
|
|
83
|
+
if (this.size === 'small') sizeCss = 'small'
|
|
84
|
+
if (this.size === 'big') sizeCss = 'big'
|
|
85
|
+
|
|
86
|
+
if (this.outline) return `${sizeCss} psui-bg-white psui-border ${this.disabled ? 'psui-border-gray-40 psui-text-gray-40 psui-cursor-default' : 'psui-border-blue-60 psui-text-blue-60'}`
|
|
87
|
+
if (this.ghost) return `${sizeCss} ${this.disabled ? 'psui-bg-gray-20 psui-text-gray-40 psui-cursor-default' : 'psui-bg-blue-20 psui-text-blue-60 active:psui-shadow-inner'}`
|
|
82
88
|
if (this.textOnly) {
|
|
83
89
|
const hasTextColor = this.textColor.length > 0
|
|
84
90
|
const color = hasTextColor ? this.textColor.split('hover:')[0] : ''
|
|
85
91
|
const hover = hasTextColor ? this.textColor.split('hover:')[1] : ''
|
|
86
92
|
|
|
87
93
|
let textCss = 'psui-text-blue-50 hover:psui-text-blue-60'
|
|
88
|
-
if (this.disabled) textCss = 'psui-text-gray-40'
|
|
94
|
+
if (this.disabled) textCss = 'psui-text-gray-40 psui-cursor-default'
|
|
89
95
|
|
|
90
96
|
if (hasTextColor) textCss = `psui-text-${color}`
|
|
91
97
|
if (hover) textCss += `hover:psui-text-${hover}`
|
|
92
98
|
|
|
93
99
|
return `${sizeCss} ${textCss}`
|
|
94
100
|
}
|
|
95
|
-
if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40`
|
|
96
|
-
return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner`
|
|
101
|
+
if (this.disabled) return `${sizeCss} psui-bg-gray-20 psui-text-gray-40 psui-cursor-default`
|
|
102
|
+
return `${sizeCss} psui-bg-blue-60 hover:psui-bg-blue-50 psui-text-white active:psui-shadow-inner psui-cursor-pointer`
|
|
97
103
|
}
|
|
98
104
|
},
|
|
99
105
|
methods: {
|
|
100
106
|
onClick() {
|
|
101
107
|
if (this.disabled) return false
|
|
102
|
-
this.$emit('click')
|
|
108
|
+
this.$emit('click')
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
</script>
|
|
113
|
+
|
|
114
|
+
<style scoped>
|
|
115
|
+
.small {
|
|
116
|
+
padding: 4px 8px 4px 8px;
|
|
117
|
+
font-size: 14px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.medium{
|
|
121
|
+
padding: 7px 16px 7px 16px;
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.big{
|
|
126
|
+
padding: 9.5px 16px 9.5px 16px;
|
|
127
|
+
font-size: 16px;
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
@click="onClick"
|
|
4
|
+
:for="title"
|
|
5
|
+
:class="getCssClass"
|
|
6
|
+
class="
|
|
7
|
+
psui-flex
|
|
8
|
+
psui-gap-2
|
|
9
|
+
psui-bg-gray-10
|
|
10
|
+
psui-text-gray-50
|
|
11
|
+
psui-px-2
|
|
12
|
+
psui-py-1
|
|
13
|
+
psui-rounded-md
|
|
14
|
+
psui-items-center
|
|
15
|
+
"
|
|
16
|
+
>
|
|
17
|
+
<input
|
|
18
|
+
@change="onChange"
|
|
19
|
+
v-if="type !== 'text'"
|
|
20
|
+
:type="type"
|
|
21
|
+
:id="title"
|
|
22
|
+
:checked="checked"
|
|
23
|
+
/>
|
|
24
|
+
<i v-if="icon" class="material-icons">{{ icon }}</i>
|
|
25
|
+
{{ title }}
|
|
26
|
+
<button @click="onClose" v-if="rich" class="psui-flex psui-items-center">
|
|
27
|
+
<i class="material-icons">close</i>
|
|
28
|
+
</button>
|
|
29
|
+
</label>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
export const type = ["text", "radio", "checkbox", "button"]
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: "PsChips",
|
|
37
|
+
props: {
|
|
38
|
+
title: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "",
|
|
41
|
+
},
|
|
42
|
+
type: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: true,
|
|
45
|
+
validator: (type) => ["text", "radio", "checkbox", "button"].includes(type)
|
|
46
|
+
},
|
|
47
|
+
icon: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "",
|
|
50
|
+
},
|
|
51
|
+
rich: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
checked: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
emits: ["click", "change"],
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
isChecked: false,
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
getCssClass() {
|
|
68
|
+
let cssClass = ''
|
|
69
|
+
|
|
70
|
+
if (this.checked === true ) {
|
|
71
|
+
cssClass = "psui-text-blue-50 psui-bg-blue-20"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return cssClass
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
onClick() {
|
|
79
|
+
this.isChecked = !this.isChecked
|
|
80
|
+
this.$emit("click")
|
|
81
|
+
},
|
|
82
|
+
onChange(event) {
|
|
83
|
+
|
|
84
|
+
this.isChecked = event.target.checked
|
|
85
|
+
|
|
86
|
+
this.$emit('update:checked', event.target.checked)
|
|
87
|
+
this.$emit("change")
|
|
88
|
+
},
|
|
89
|
+
onClose() {
|
|
90
|
+
this.$emit("close")
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<style scoped>
|
|
97
|
+
input[type="radio"] {
|
|
98
|
+
-webkit-appearance: none;
|
|
99
|
+
-moz-appearance: none;
|
|
100
|
+
appearance: none;
|
|
101
|
+
|
|
102
|
+
display: inline-block;
|
|
103
|
+
width: 16px;
|
|
104
|
+
height: 16px;
|
|
105
|
+
border-radius: 50%;
|
|
106
|
+
border: 1px solid #d6dde5;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
input[type="checkbox"] {
|
|
111
|
+
-webkit-appearance: none;
|
|
112
|
+
-moz-appearance: none;
|
|
113
|
+
appearance: none;
|
|
114
|
+
|
|
115
|
+
display: inline-block;
|
|
116
|
+
width: 16px;
|
|
117
|
+
height: 16px;
|
|
118
|
+
border-radius: 25%;
|
|
119
|
+
border: 1px solid #d6dde5;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
input[type="radio"]:hover,
|
|
124
|
+
input[type="checkbox"]:hover {
|
|
125
|
+
border-color: #64b5ce;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
input[type="radio"]:checked {
|
|
129
|
+
border-color: #64b5ce;
|
|
130
|
+
background: url("../../assets/images/radio-checked-button.svg") #ffffff
|
|
131
|
+
no-repeat center;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
input[type="checkbox"]:checked {
|
|
135
|
+
border-color: #64b5ce;
|
|
136
|
+
background: url("../../assets/images/check-checkbox-button.svg") #64b5ce
|
|
137
|
+
no-repeat center;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
label {
|
|
141
|
+
width: fit-content;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
label:hover {
|
|
146
|
+
color: #64b5ce;
|
|
147
|
+
background: #ffffff;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
button {
|
|
151
|
+
outline: none;
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
154
|
+
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<label
|
|
2
|
+
<label
|
|
3
|
+
class="container psui-pl-6"
|
|
4
|
+
:class="[
|
|
5
|
+
{ 'psui-text-gray-40': disabled },
|
|
6
|
+
{ 'psui-text-gray-50': !disabled },
|
|
7
|
+
labelClasses,
|
|
8
|
+
]"
|
|
9
|
+
>
|
|
3
10
|
{{ label }}
|
|
4
11
|
<input
|
|
5
12
|
type="checkbox"
|
|
@@ -7,7 +14,11 @@
|
|
|
7
14
|
:disabled="disabled"
|
|
8
15
|
:value="inputValue"
|
|
9
16
|
/>
|
|
10
|
-
<span
|
|
17
|
+
<span
|
|
18
|
+
class="checkmark psui-border-2"
|
|
19
|
+
:class="classes"
|
|
20
|
+
:style="getSize"
|
|
21
|
+
></span>
|
|
11
22
|
</label>
|
|
12
23
|
</template>
|
|
13
24
|
|
|
@@ -18,31 +29,31 @@ export default {
|
|
|
18
29
|
value: {
|
|
19
30
|
required: true,
|
|
20
31
|
},
|
|
21
|
-
inputValue: String,
|
|
32
|
+
inputValue: String,
|
|
22
33
|
label: {
|
|
23
34
|
type: String,
|
|
24
|
-
default: ''
|
|
35
|
+
default: '',
|
|
25
36
|
},
|
|
26
37
|
checkboxClasses: {
|
|
27
38
|
type: String,
|
|
28
|
-
default: '
|
|
39
|
+
default: '',
|
|
29
40
|
},
|
|
30
41
|
labelClasses: {
|
|
31
42
|
type: String,
|
|
32
|
-
default: ''
|
|
43
|
+
default: '',
|
|
33
44
|
},
|
|
34
45
|
disabled: {
|
|
35
46
|
type: Boolean,
|
|
36
|
-
default: false
|
|
47
|
+
default: false,
|
|
37
48
|
},
|
|
38
49
|
size: {
|
|
39
|
-
default: 18
|
|
40
|
-
}
|
|
50
|
+
default: 18,
|
|
51
|
+
},
|
|
41
52
|
},
|
|
42
53
|
computed: {
|
|
43
54
|
model: {
|
|
44
55
|
get() {
|
|
45
|
-
return this.value
|
|
56
|
+
return this.value
|
|
46
57
|
},
|
|
47
58
|
set(newValue) {
|
|
48
59
|
this.$emit('input', newValue)
|
|
@@ -50,15 +61,17 @@ export default {
|
|
|
50
61
|
},
|
|
51
62
|
},
|
|
52
63
|
classes() {
|
|
53
|
-
return `${
|
|
64
|
+
return `${
|
|
65
|
+
this.disabled ? 'psui-border-gray-40' : 'psui-border-gray-50'
|
|
66
|
+
} ${this.checkboxClasses}`
|
|
54
67
|
},
|
|
55
68
|
getSize() {
|
|
56
69
|
return {
|
|
57
70
|
width: `${this.size}px`,
|
|
58
|
-
height: `${this.size}px
|
|
71
|
+
height: `${this.size}px`,
|
|
59
72
|
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
73
|
+
},
|
|
74
|
+
},
|
|
62
75
|
}
|
|
63
76
|
</script>
|
|
64
77
|
|
|
@@ -92,12 +105,12 @@ export default {
|
|
|
92
105
|
}
|
|
93
106
|
|
|
94
107
|
.container input:checked ~ .checkmark {
|
|
95
|
-
background-color: #
|
|
108
|
+
background-color: #64b5ce;
|
|
96
109
|
border: none;
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
.checkmark:after {
|
|
100
|
-
content:
|
|
113
|
+
content: '';
|
|
101
114
|
position: absolute;
|
|
102
115
|
display: none;
|
|
103
116
|
}
|
|
@@ -118,4 +131,4 @@ export default {
|
|
|
118
131
|
-ms-transform: rotate(45deg);
|
|
119
132
|
transform: rotate(45deg);
|
|
120
133
|
}
|
|
121
|
-
</style>
|
|
134
|
+
</style>
|
|
@@ -1,13 +1,184 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<div class="psui-w-full psui-my-4 psui-pr-4 psui-flex psui-flex-wrap psui-justify-start psui-mb-20">
|
|
3
|
+
<div class="psui-w-full psui-mb-4 psui-rounded-lg psui-bg-gray-30 psui-p-2"
|
|
4
|
+
v-for="(columnGroup, indexColumnGroup) in getColumns.columnGroups"
|
|
5
|
+
:key="indexColumnGroup"
|
|
6
|
+
:class="{ 'is-dragging-out' : indexColumnGroup == isDraggingOverGroup}"
|
|
7
|
+
>
|
|
8
|
+
<!-- COLUMN GROUP -->
|
|
9
|
+
<div
|
|
10
|
+
class="psui-w-full psui-flex psui-justify-between psui-mb-2 psui-rounded-sm psui-items-center psui-px-2 app-draggable-list-item"
|
|
11
|
+
draggable="true"
|
|
12
|
+
@dragstart="dragStartGroup({ indexColumnGroup })"
|
|
13
|
+
@dragover="dragOverGroup({ indexColumnGroup })"
|
|
14
|
+
@dragend="dragEndGroup"
|
|
15
|
+
>
|
|
16
|
+
<h2 class="psui-w-full psui-text-gray-80 psui-font-bold psui-pl-4 psui-py-2">{{columnGroup.title}}</h2>
|
|
17
|
+
<i class='material-icons-round psui-text-gray-40 psui-pr-1 psui-py-2'>drag_indicator</i>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="psui-w-full psui-flex psui-flex-wrap">
|
|
21
|
+
<!-- COLUMNS -->
|
|
22
|
+
<div class="psui-w-full psui-mb-2 app-draggable-list-item"
|
|
23
|
+
v-for="(column, indexColumn) in columnGroup.columns"
|
|
24
|
+
:key="`edit-columns-column-${indexColumnGroup}-${indexColumn}`"
|
|
25
|
+
:id="`edit-columns-column-${indexColumnGroup}-${indexColumn}`"
|
|
26
|
+
>
|
|
27
|
+
<div class="psui-select-none psui-w-full psui-py-2 psui-px-3 psui-rounded-sm psui-flex psui-items-center psui-bg-white"
|
|
28
|
+
draggable="true"
|
|
29
|
+
@dragstart="dragStartColumn({ indexColumnGroup, indexColumn })"
|
|
30
|
+
@dragover="dragOverColumn({ indexColumnGroup, indexColumn })"
|
|
31
|
+
@dragend="dragEndColumn"
|
|
32
|
+
:class="{ 'is-dragging-out' : checkColumnIsDragOver({ indexColumnGroup, indexColumn }) }"
|
|
33
|
+
>
|
|
34
|
+
<PsCheckbox :inputValue='column' :label='column' @change="toggleColumnIsActive({ studyKey: getColumns.key, indexColumnGroup, indexColumn, columnGroupKey: columnGroup.key})">
|
|
35
|
+
</PsCheckbox>
|
|
36
|
+
|
|
37
|
+
<!-- <Checkbox
|
|
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>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
3
51
|
</template>
|
|
4
52
|
|
|
5
53
|
<script>
|
|
54
|
+
import PsCheckbox from './PsCheckbox.vue'
|
|
55
|
+
|
|
6
56
|
export default {
|
|
57
|
+
name: 'DragAndDropEditColumnsList',
|
|
58
|
+
components: { PsCheckbox},
|
|
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
|
+
}
|
|
7
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
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Drag and drop COLUMN
|
|
96
|
+
*/
|
|
97
|
+
dragStartColumn({ indexColumnGroup, indexColumn }) {
|
|
98
|
+
this.isDraggingColumn = indexColumn
|
|
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
|
|
114
|
+
},
|
|
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
|
+
/**
|
|
144
|
+
* Drag and drop GROUP
|
|
145
|
+
*/
|
|
146
|
+
dragStartGroup({ indexColumnGroup }) {
|
|
147
|
+
this.isDraggingGroup = indexColumnGroup
|
|
148
|
+
},
|
|
149
|
+
dragEndGroup() {
|
|
150
|
+
this.moveItemGroup({
|
|
151
|
+
studyKey: this.getColumns.key,
|
|
152
|
+
from: this.isDraggingGroup,
|
|
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
|
|
164
|
+
},
|
|
165
|
+
moveItemGroup({ studyKey, from, to}) {
|
|
166
|
+
this.$store.commit(this.getMoveColumnGroupStoreMutationName, {
|
|
167
|
+
columnsStateKey: this.getColumnsStateKey,
|
|
168
|
+
studyKey,
|
|
169
|
+
from,to
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
}
|
|
8
174
|
}
|
|
9
175
|
</script>
|
|
176
|
+
<style scoped>
|
|
177
|
+
.app-draggable-list-item {
|
|
178
|
+
cursor: grab;
|
|
179
|
+
}
|
|
10
180
|
|
|
11
|
-
|
|
12
|
-
|
|
181
|
+
.app-draggable-list-item label {
|
|
182
|
+
margin-bottom: 0;
|
|
183
|
+
}
|
|
13
184
|
</style>
|