@monoui/vuejs 1.1.10
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/README.md +27 -0
- package/dist/main.js +410 -0
- package/package.json +105 -0
- package/src/components/BreadCrumb/BreadCrumb.vue +59 -0
- package/src/components/BreadCrumb/index.js +3 -0
- package/src/components/Button/Button.vue +118 -0
- package/src/components/Button/ButtonCore.vue +59 -0
- package/src/components/Button/ButtonEdit.vue +15 -0
- package/src/components/Button/ButtonRemove.vue +15 -0
- package/src/components/Button/index.js +4 -0
- package/src/components/Card/Card.vue +82 -0
- package/src/components/Card/CardBody.vue +72 -0
- package/src/components/Card/CardFooter.vue +55 -0
- package/src/components/Card/CardHeader.vue +58 -0
- package/src/components/Card/CardSubTitle.vue +43 -0
- package/src/components/Card/CardText.vue +21 -0
- package/src/components/Card/CardTitle.vue +38 -0
- package/src/components/Card/index.js +17 -0
- package/src/components/Checkbox/Checkbox.vue +72 -0
- package/src/components/Checkbox/index.js +3 -0
- package/src/components/Cron/Cron.vue +68 -0
- package/src/components/Cron/index.js +3 -0
- package/src/components/Date/DatePicker.vue +406 -0
- package/src/components/Date/index.js +3 -0
- package/src/components/Dropdown/Dropdown.vue +51 -0
- package/src/components/Dropdown/DropdownDivider.vue +12 -0
- package/src/components/Dropdown/DropdownItem.vue +23 -0
- package/src/components/Dropdown/index.js +5 -0
- package/src/components/DynamicInput/DynamicInput.vue +192 -0
- package/src/components/DynamicInput/index.js +3 -0
- package/src/components/DynamicInput/inputTypes.js +14 -0
- package/src/components/Icon/Icon.vue +43 -0
- package/src/components/Icon/index.js +3 -0
- package/src/components/Info/Info.vue +19 -0
- package/src/components/Info/index.js +3 -0
- package/src/components/Input/Input.vue +73 -0
- package/src/components/Input/index.js +3 -0
- package/src/components/KeyValue/KeyValue.vue +138 -0
- package/src/components/KeyValue/index.js +3 -0
- package/src/components/KeyValueInput/KeyValueInput.vue +203 -0
- package/src/components/KeyValueInput/index.js +3 -0
- package/src/components/Loader/Loader.vue +82 -0
- package/src/components/Loader/content-loader.js +150 -0
- package/src/components/Loader/index.js +2 -0
- package/src/components/Modal/Alert.vue +96 -0
- package/src/components/Modal/Modal.vue +125 -0
- package/src/components/Modal/RemoveAlert.vue +58 -0
- package/src/components/Modal/UnsavedChangesAlert.vue +83 -0
- package/src/components/Modal/index.js +6 -0
- package/src/components/MultiKeyValue/MultiKeyValue.vue +359 -0
- package/src/components/MultiKeyValue/index.js +3 -0
- package/src/components/NoData/NoData.vue +20 -0
- package/src/components/NoData/index.js +3 -0
- package/src/components/Popover/Popover.vue +91 -0
- package/src/components/Popover/index.js +3 -0
- package/src/components/Select/Select.vue +71 -0
- package/src/components/Select/index.js +3 -0
- package/src/components/Spinner/Spinner.vue +19 -0
- package/src/components/Spinner/index.js +3 -0
- package/src/components/Table/Icons/ArrowDown.vue +18 -0
- package/src/components/Table/Icons/ArrowDownLong.vue +18 -0
- package/src/components/Table/Icons/ArrowUp.vue +18 -0
- package/src/components/Table/Icons/ArrowUpLong.vue +18 -0
- package/src/components/Table/Icons/BaseIcon.vue +46 -0
- package/src/components/Table/Icons/Sorting.vue +16 -0
- package/src/components/Table/Icons/SortingAZ.vue +18 -0
- package/src/components/Table/Icons/SortingArrows.vue +18 -0
- package/src/components/Table/Table.vue +548 -0
- package/src/components/Table/index.js +3 -0
- package/src/components/Tabs/Tab.vue +36 -0
- package/src/components/Tabs/Tabs.vue +44 -0
- package/src/components/Tabs/index.js +4 -0
- package/src/components/TagInput/TagInput.vue +129 -0
- package/src/components/TagInput/index.js +3 -0
- package/src/components/Timeline/Timeline.vue +33 -0
- package/src/components/Timeline/TimelineItem.vue +40 -0
- package/src/components/Timeline/index.js +4 -0
- package/src/components/Tooltip/Tooltip.vue +62 -0
- package/src/components/Tooltip/index.js +3 -0
- package/src/functions/alert.js +40 -0
- package/src/functions/notification.js +51 -0
- package/src/icons.js +144 -0
- package/src/index.js +133 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-card-text :text-tag="textTag" v-bind="$props" :class="innerClass">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</b-card-text>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: "mui-card-text",
|
|
10
|
+
props: {
|
|
11
|
+
textTag: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false
|
|
14
|
+
},
|
|
15
|
+
innerClass: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: false
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-card-title
|
|
3
|
+
v-bind="$props"
|
|
4
|
+
:class="innerClass"
|
|
5
|
+
:title-tag="titleTag"
|
|
6
|
+
:title="title"
|
|
7
|
+
>
|
|
8
|
+
<template v-if="hasTitle">
|
|
9
|
+
{{ title }}
|
|
10
|
+
</template>
|
|
11
|
+
<slot v-else></slot>
|
|
12
|
+
</b-card-title>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
name: "mui-card-title",
|
|
18
|
+
computed: {
|
|
19
|
+
hasTitle() {
|
|
20
|
+
return !this.title ? false : true;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
props: {
|
|
24
|
+
title: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: false
|
|
27
|
+
},
|
|
28
|
+
titleTag: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: false
|
|
31
|
+
},
|
|
32
|
+
innerClass: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Card from "./Card";
|
|
2
|
+
import CardBody from "./CardBody";
|
|
3
|
+
import CardFooter from "./CardFooter";
|
|
4
|
+
import CardHeader from "./CardHeader";
|
|
5
|
+
import CardSubTitle from "./CardSubTitle";
|
|
6
|
+
import CardText from "./CardText";
|
|
7
|
+
import CardTitle from "./CardTitle";
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
Card,
|
|
11
|
+
CardBody,
|
|
12
|
+
CardFooter,
|
|
13
|
+
CardHeader,
|
|
14
|
+
CardSubTitle,
|
|
15
|
+
CardText,
|
|
16
|
+
CardTitle
|
|
17
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-checkbox
|
|
3
|
+
v-model="tempValue"
|
|
4
|
+
v-on="$listeners"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:value="checkedValue"
|
|
7
|
+
:unchecked-value="uncheckedValue"
|
|
8
|
+
:class="innerClass"
|
|
9
|
+
>
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</b-checkbox>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
/**
|
|
16
|
+
* MonoUI Checkbox Component
|
|
17
|
+
*/
|
|
18
|
+
export default {
|
|
19
|
+
name: "mui-checkbox",
|
|
20
|
+
props: {
|
|
21
|
+
/**
|
|
22
|
+
* Checkbox check state value.
|
|
23
|
+
*/
|
|
24
|
+
value: {
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Disable component when value is true.
|
|
29
|
+
* @type Boolean
|
|
30
|
+
*/
|
|
31
|
+
disabled: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
required: false
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Class
|
|
38
|
+
* @type String
|
|
39
|
+
*/
|
|
40
|
+
innerClass: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "",
|
|
43
|
+
required: false
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Checked Value
|
|
47
|
+
*/
|
|
48
|
+
checkedValue: {
|
|
49
|
+
required: false
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Unchecked Value
|
|
53
|
+
*/
|
|
54
|
+
uncheckedValue: {
|
|
55
|
+
required: false
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
watch: {
|
|
59
|
+
tempValue(val) {
|
|
60
|
+
this.$emit("input", val);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
tempValue: ""
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
mounted() {
|
|
69
|
+
this.tempValue = this.value;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :id="cronContainerName" class="cron">
|
|
3
|
+
<input
|
|
4
|
+
type="text"
|
|
5
|
+
class="form-control"
|
|
6
|
+
v-model="cron"
|
|
7
|
+
@keyup="onCronChanged"
|
|
8
|
+
autocomplete="off"
|
|
9
|
+
:id="cronFieldName"
|
|
10
|
+
/>
|
|
11
|
+
<b-popover
|
|
12
|
+
:target="cronFieldName"
|
|
13
|
+
placement="topleft"
|
|
14
|
+
triggers="click"
|
|
15
|
+
:container="cronContainerName"
|
|
16
|
+
>
|
|
17
|
+
<cron @change="changeCron" @close="hidePopover" i18n="en"></cron>
|
|
18
|
+
</b-popover>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { cron } from "vue-cron-2";
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: "mui-cron",
|
|
27
|
+
components: {
|
|
28
|
+
cron
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
value: {
|
|
32
|
+
default: ""
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
cronFieldName() {
|
|
37
|
+
return `cronText_${this.nonce}`;
|
|
38
|
+
},
|
|
39
|
+
cronContainerName() {
|
|
40
|
+
return `cronContainer_${this.nonce}`;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
watch: {
|
|
44
|
+
value(val) {
|
|
45
|
+
this.cron = val;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
cronPopover: false,
|
|
51
|
+
cron: this.value,
|
|
52
|
+
nonce: this.$helpers.guid()
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
onCronChanged(e) {
|
|
57
|
+
this.changeCron(e.target.value);
|
|
58
|
+
},
|
|
59
|
+
changeCron(val) {
|
|
60
|
+
this.cron = val;
|
|
61
|
+
this.$emit("input", val);
|
|
62
|
+
},
|
|
63
|
+
hidePopover() {
|
|
64
|
+
this.$root.$emit("bv::hide::popover");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="datePicker">
|
|
3
|
+
<date-picker
|
|
4
|
+
:value="datetime"
|
|
5
|
+
@input="updateDate($event)"
|
|
6
|
+
:type="type"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
:default-value="new Date()"
|
|
9
|
+
:format="momentFormat"
|
|
10
|
+
:disabled-date="disableBeforeMinDateAfterMaxDate"
|
|
11
|
+
:disabled-time="disableBeforeAfterTime"
|
|
12
|
+
:range="!range ? false : true"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
:editable="editable"
|
|
15
|
+
:clearable="clearable"
|
|
16
|
+
:second-options="[]"
|
|
17
|
+
:shortcuts="!range && shortcutsEnable ? shortcuts : []"
|
|
18
|
+
>
|
|
19
|
+
<template #header="{ emit }" v-if="!shortcutsEnable && todayHeader">
|
|
20
|
+
<button class="mx-btn mx-btn-text" @click="emit(new Date())">
|
|
21
|
+
Today
|
|
22
|
+
</button>
|
|
23
|
+
</template>
|
|
24
|
+
<template
|
|
25
|
+
#footer="{ emit }"
|
|
26
|
+
v-if="!shortcutsEnable && range && isBeforeAndAfterOneWeek"
|
|
27
|
+
>
|
|
28
|
+
<div style="text-align: left">
|
|
29
|
+
<button
|
|
30
|
+
class="mx-btn mx-btn-text"
|
|
31
|
+
@click="setNextWeek(emit)"
|
|
32
|
+
>
|
|
33
|
+
Select Next One Week
|
|
34
|
+
</button>
|
|
35
|
+
</div>
|
|
36
|
+
<div style="text-align: left">
|
|
37
|
+
<button
|
|
38
|
+
class="mx-btn mx-btn-text"
|
|
39
|
+
@click="setOneWeekBefore(emit)"
|
|
40
|
+
>
|
|
41
|
+
Select Before One Week
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
</date-picker>
|
|
46
|
+
<span class="ml-2" v-if="prettyLabel"> {{ prettyDate }} </span>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
import DatePicker from "vue2-datepicker";
|
|
52
|
+
import "vue2-datepicker/index.css";
|
|
53
|
+
|
|
54
|
+
import moment from "moment";
|
|
55
|
+
const addDays = count => {
|
|
56
|
+
let date = new Date();
|
|
57
|
+
if (!count) {
|
|
58
|
+
date.setHours(0, 0, 0, 0);
|
|
59
|
+
return date;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const day = 3600 * 1000 * 24;
|
|
63
|
+
date.setTime(date.getTime() + day * count);
|
|
64
|
+
date.setHours(0, 0, 0, 0);
|
|
65
|
+
return date;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
name: "mui-date-picker",
|
|
70
|
+
components: {
|
|
71
|
+
DatePicker
|
|
72
|
+
},
|
|
73
|
+
data() {
|
|
74
|
+
return {
|
|
75
|
+
momentFormat: {
|
|
76
|
+
stringify: date => {
|
|
77
|
+
return date ? moment(date).format(this.dateFormat) : "";
|
|
78
|
+
},
|
|
79
|
+
parse: value => {
|
|
80
|
+
return value
|
|
81
|
+
? moment(value, this.dateFormat).toDate()
|
|
82
|
+
: null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
computed: {
|
|
88
|
+
datetime: {
|
|
89
|
+
get: function() {
|
|
90
|
+
if (!this.value) return null;
|
|
91
|
+
if (Array.isArray(this.value)) {
|
|
92
|
+
let date1 = moment(this.value[0]).toDate();
|
|
93
|
+
let date2 = moment(this.value[1]).toDate();
|
|
94
|
+
return [date1, date2];
|
|
95
|
+
} else {
|
|
96
|
+
let date = moment(this.value).toDate();
|
|
97
|
+
return date;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
set: function(value) {
|
|
101
|
+
this.$emit("input", value);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
prettyDate() {
|
|
105
|
+
if (!this.datetime) return null;
|
|
106
|
+
return moment(this.datetime).fromNow();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
props: {
|
|
110
|
+
/**
|
|
111
|
+
* value.
|
|
112
|
+
* It's used to bind v-model value from parent component to child component's input value.
|
|
113
|
+
*/
|
|
114
|
+
value: {
|
|
115
|
+
required: true
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* type.
|
|
119
|
+
* It determines the component type
|
|
120
|
+
*/
|
|
121
|
+
type: {
|
|
122
|
+
type: String,
|
|
123
|
+
required: true,
|
|
124
|
+
default: "date"
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* Date Format.
|
|
128
|
+
* @see [moment] (https://momentjs.com/docs/#/parsing/string-format/)
|
|
129
|
+
*/
|
|
130
|
+
dateFormat: {
|
|
131
|
+
type: String,
|
|
132
|
+
default: "L"
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* range.
|
|
136
|
+
* Allows to select two dates range
|
|
137
|
+
*/
|
|
138
|
+
range: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
requreid: false,
|
|
141
|
+
default: false
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
* placeholder.
|
|
145
|
+
* Allows to type custom placeholder
|
|
146
|
+
*/
|
|
147
|
+
placeholder: {
|
|
148
|
+
type: String,
|
|
149
|
+
required: false,
|
|
150
|
+
default: "Select a date..."
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* Show pretty label on right.
|
|
154
|
+
*/
|
|
155
|
+
prettyLabel: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: false
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* minDate.
|
|
161
|
+
* Allows to determine minimum date that users can select. It can be string or date object
|
|
162
|
+
*/
|
|
163
|
+
minDate: {
|
|
164
|
+
type: [String, Date],
|
|
165
|
+
required: false
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* minDate.
|
|
169
|
+
* Allows to determine maximum date that users can select. It can be string or date object
|
|
170
|
+
*/
|
|
171
|
+
maxDate: {
|
|
172
|
+
type: [String, Date],
|
|
173
|
+
required: false
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* disabled.
|
|
177
|
+
* Allows to disable the component
|
|
178
|
+
*/
|
|
179
|
+
disabled: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
required: false,
|
|
182
|
+
default: false
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* editable.
|
|
186
|
+
* Allows to edit the date
|
|
187
|
+
*/
|
|
188
|
+
editable: {
|
|
189
|
+
type: Boolean,
|
|
190
|
+
required: false,
|
|
191
|
+
default: true
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* clearable.
|
|
195
|
+
* Allows to clear the date by tapping x button
|
|
196
|
+
*/
|
|
197
|
+
clearable: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
required: false,
|
|
200
|
+
default: true
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* shortcutsEnable.
|
|
204
|
+
* Allows to enable the shortcust determined in the component
|
|
205
|
+
*/
|
|
206
|
+
shortcutsEnable: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
required: false
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* todayHeader.
|
|
212
|
+
* Allows to enable only today button on the header of the component
|
|
213
|
+
*/
|
|
214
|
+
todayHeader: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
required: false
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* isBeforeAndAfterOneWeek.
|
|
220
|
+
* Allows to enable "Select Next One Week" and "Select Before One Week" buttons on the footer
|
|
221
|
+
* when range attribute used to select to dates range
|
|
222
|
+
*/
|
|
223
|
+
isBeforeAndAfterOneWeek: {
|
|
224
|
+
type: Boolean,
|
|
225
|
+
required: false,
|
|
226
|
+
default: false
|
|
227
|
+
},
|
|
228
|
+
/**
|
|
229
|
+
* minTime.
|
|
230
|
+
* Allows to determine minimum time that users can select. It should be number
|
|
231
|
+
*/
|
|
232
|
+
minTime: {
|
|
233
|
+
type: Number,
|
|
234
|
+
required: false
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* maxTime.
|
|
238
|
+
* Allows to determine minimum time that users can select. It should be number
|
|
239
|
+
*/
|
|
240
|
+
maxTime: {
|
|
241
|
+
type: Number,
|
|
242
|
+
required: false
|
|
243
|
+
},
|
|
244
|
+
/**
|
|
245
|
+
* shortcuts.
|
|
246
|
+
* Allows to determine shortcuts when shortcutsEnable property is true
|
|
247
|
+
*/
|
|
248
|
+
shortcuts: {
|
|
249
|
+
type: Array,
|
|
250
|
+
default: () => {
|
|
251
|
+
return [
|
|
252
|
+
{
|
|
253
|
+
text: "Yesterday",
|
|
254
|
+
onClick: () => addDays(-1)
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
text: "Today",
|
|
258
|
+
onClick: () => addDays()
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
text: "Tomorrow",
|
|
262
|
+
onClick: () => addDays(1)
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
text: "A week",
|
|
266
|
+
onClick: () => addDays(7)
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
text: "2 weeks",
|
|
270
|
+
onClick: () => addDays(14)
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
text: "A month",
|
|
274
|
+
onClick: () => addDays(30)
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
text: "6 months",
|
|
278
|
+
onClick: () => addDays(182)
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
text: "A year",
|
|
282
|
+
onClick: () => addDays(365)
|
|
283
|
+
}
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
methods: {
|
|
289
|
+
/**
|
|
290
|
+
* updateDate
|
|
291
|
+
* @input update value when input value changes
|
|
292
|
+
*/
|
|
293
|
+
updateDate(e) {
|
|
294
|
+
if (this.minDate || this.maxDate) {
|
|
295
|
+
let dates = this.formatDates();
|
|
296
|
+
if (e < dates[0]) {
|
|
297
|
+
let date = dates[0];
|
|
298
|
+
this.$emit("input", date);
|
|
299
|
+
} else if (e > dates[1]) {
|
|
300
|
+
let date = dates[1];
|
|
301
|
+
this.$emit("input", date);
|
|
302
|
+
} else {
|
|
303
|
+
this.$emit("input", e);
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
this.$emit("input", e);
|
|
307
|
+
}
|
|
308
|
+
if (e === null) {
|
|
309
|
+
this.$emit("input", null);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
formatDates() {
|
|
313
|
+
const minDate = new Date(this.minDate);
|
|
314
|
+
const maxDate = new Date(this.maxDate);
|
|
315
|
+
return [minDate, maxDate];
|
|
316
|
+
},
|
|
317
|
+
disableBeforeMinDateAfterMaxDate(date) {
|
|
318
|
+
if (!this.minDate && !this.maxDate) return;
|
|
319
|
+
let dates = this.formatDates();
|
|
320
|
+
dates[0].setHours(0, 0, 0, 0);
|
|
321
|
+
dates[1].setHours(0, 0, 0, 0);
|
|
322
|
+
if (!this.maxDate && this.minDate) {
|
|
323
|
+
return date <= dates[0];
|
|
324
|
+
} else if (!this.minDate && this.maxDate) {
|
|
325
|
+
return date >= dates[1];
|
|
326
|
+
} else {
|
|
327
|
+
return date < dates[0] || date > dates[1];
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
disableBeforeAfterTime(date) {
|
|
331
|
+
if (!this.minTime && !this.maxTime) return;
|
|
332
|
+
if (this.minTime && !this.maxTime) {
|
|
333
|
+
return date.getHours() < this.minTime;
|
|
334
|
+
} else if (!this.minTime && this.maxTime) {
|
|
335
|
+
return date.getHours() > this.maxTime;
|
|
336
|
+
}
|
|
337
|
+
if (this.minTime && this.maxTime) {
|
|
338
|
+
return (
|
|
339
|
+
date.getHours() < this.minTime ||
|
|
340
|
+
date.getHours() > this.maxTime
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
setNextWeek(emit) {
|
|
345
|
+
const start = new Date();
|
|
346
|
+
const end = addDays(7);
|
|
347
|
+
|
|
348
|
+
const date1 = new Date(this.maxDate);
|
|
349
|
+
var date = [start, end];
|
|
350
|
+
if (end > date1) {
|
|
351
|
+
date = [start, date1];
|
|
352
|
+
}
|
|
353
|
+
emit(date);
|
|
354
|
+
},
|
|
355
|
+
setOneWeekBefore(emit) {
|
|
356
|
+
const start = addDays(-7);
|
|
357
|
+
const end = new Date();
|
|
358
|
+
|
|
359
|
+
const date1 = new Date(this.minDate);
|
|
360
|
+
var date = [start, end];
|
|
361
|
+
if (start < date1) {
|
|
362
|
+
date = [date1, end];
|
|
363
|
+
}
|
|
364
|
+
emit(date);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
</script>
|
|
369
|
+
|
|
370
|
+
<style scoped>
|
|
371
|
+
@media only screen and (min-width: 600px) {
|
|
372
|
+
.mx-datepicker-range {
|
|
373
|
+
width: 120px;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
@media only screen and (min-width: 768px) {
|
|
378
|
+
.mx-datepicker-range {
|
|
379
|
+
width: 150px;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@media only screen and (min-width: 992px) {
|
|
384
|
+
.mx-datepicker-range {
|
|
385
|
+
width: 200px;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
@media only screen and (min-width: 1200px) {
|
|
390
|
+
.mx-datepicker-range {
|
|
391
|
+
width: 230px;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
@media only screen and (min-width: 1350px) {
|
|
396
|
+
.mx-datepicker-range {
|
|
397
|
+
width: 270px;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
@media only screen and (min-width: 1500px) {
|
|
402
|
+
.mx-datepicker-range {
|
|
403
|
+
width: 320px;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-dropdown
|
|
3
|
+
v-on="$listeners"
|
|
4
|
+
v-bind="$props"
|
|
5
|
+
:text="text"
|
|
6
|
+
:variant="variant"
|
|
7
|
+
:size="size"
|
|
8
|
+
boundary="window"
|
|
9
|
+
right
|
|
10
|
+
>
|
|
11
|
+
<template slot="default">
|
|
12
|
+
<slot name="default"></slot>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<template slot="button-content">
|
|
16
|
+
<slot name="button-content"></slot>
|
|
17
|
+
</template>
|
|
18
|
+
</b-dropdown>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
name: "mui-dropdown",
|
|
24
|
+
props: {
|
|
25
|
+
text: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false
|
|
28
|
+
},
|
|
29
|
+
variant: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "light border",
|
|
32
|
+
required: false
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "sm",
|
|
37
|
+
required: false,
|
|
38
|
+
validator: function(value) {
|
|
39
|
+
return (
|
|
40
|
+
["sm", "xs", "md", "default", "lg"].indexOf(value) !== -1
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
disabled: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
required: false
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
</script>
|