@opentinyvue/vue-calendar-view 2.21.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/LICENSE +22 -0
- package/index.d.ts +13 -0
- package/lib/index.js +120 -0
- package/lib/mobile-first.js +502 -0
- package/lib/pc.js +357 -0
- package/package.json +24 -0
- package/src/index.d.ts +72 -0
- package/src/mobile-first.vue.d.ts +2 -0
- package/src/pc.vue.d.ts +2 -0
- package/src/token.d.ts +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - present TinyVue Authors.
|
|
4
|
+
Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022 - present TinyVue Authors.
|
|
3
|
+
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license.
|
|
6
|
+
*
|
|
7
|
+
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
|
|
8
|
+
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
|
|
9
|
+
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
import CalendarView from './src/index';
|
|
13
|
+
export default CalendarView;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
3
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
4
|
+
var t = arguments[e];
|
|
5
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
6
|
+
}
|
|
7
|
+
return n;
|
|
8
|
+
}, _extends.apply(null, arguments);
|
|
9
|
+
}
|
|
10
|
+
import { defineComponent, $prefix, $setup, $props } from "@opentinyvue/vue-common";
|
|
11
|
+
import PcTemplate from "./pc.js";
|
|
12
|
+
import MobileFirstTemplate from "./mobile-first.js";
|
|
13
|
+
import "@opentinyvue/vue-theme/calendar-view/index.css";
|
|
14
|
+
var template = function template2(mode) {
|
|
15
|
+
var _process$env;
|
|
16
|
+
var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
|
|
17
|
+
if ("pc" === (tinyMode || mode)) {
|
|
18
|
+
return PcTemplate;
|
|
19
|
+
}
|
|
20
|
+
if ("mobile-first" === (tinyMode || mode)) {
|
|
21
|
+
return MobileFirstTemplate;
|
|
22
|
+
}
|
|
23
|
+
return PcTemplate;
|
|
24
|
+
};
|
|
25
|
+
var $constants = {
|
|
26
|
+
DAY_START_TIME: "00:00:00",
|
|
27
|
+
DAY_END_TIME: "23:59:59",
|
|
28
|
+
DAY_START_HOUR: 8,
|
|
29
|
+
DAY_END_HOUR: 18,
|
|
30
|
+
CELL_HEIGHT: 20,
|
|
31
|
+
WEDNESDAY: 3
|
|
32
|
+
};
|
|
33
|
+
var calendarViewProps = _extends({}, $props, {
|
|
34
|
+
_constants: {
|
|
35
|
+
type: Object,
|
|
36
|
+
default: function _default() {
|
|
37
|
+
return $constants;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
modelValue: {},
|
|
41
|
+
showMark: {},
|
|
42
|
+
showNewSchedule: {},
|
|
43
|
+
setDayBgColor: {},
|
|
44
|
+
disabled: {},
|
|
45
|
+
mode: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "month",
|
|
48
|
+
validator: function validator(value) {
|
|
49
|
+
return ~["month", "timeline", "schedule"].indexOf(value);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
modes: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: function _default2() {
|
|
55
|
+
return ["month", "timeline", "schedule"];
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
year: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: function _default3() {
|
|
61
|
+
return (/* @__PURE__ */ new Date()).getFullYear();
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
month: {
|
|
65
|
+
type: Number,
|
|
66
|
+
default: function _default4() {
|
|
67
|
+
return (/* @__PURE__ */ new Date()).getMonth() + 1;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
dayTimes: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default: function _default5() {
|
|
73
|
+
return [8, 18];
|
|
74
|
+
},
|
|
75
|
+
validator: function validator2(value) {
|
|
76
|
+
return value.length === 2 && value[0] >= 0 && value[1] <= 23 && Number.isInteger(value[0]) && Number.isInteger(value[1]);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
events: {
|
|
80
|
+
type: Array,
|
|
81
|
+
default: function _default6() {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
height: {
|
|
86
|
+
type: [String, Number],
|
|
87
|
+
default: ""
|
|
88
|
+
},
|
|
89
|
+
markColor: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: "blue"
|
|
92
|
+
},
|
|
93
|
+
multiSelect: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
var CalendarView = defineComponent({
|
|
99
|
+
name: $prefix + "CalendarView",
|
|
100
|
+
props: calendarViewProps,
|
|
101
|
+
setup: function setup(props, context) {
|
|
102
|
+
return $setup({
|
|
103
|
+
props,
|
|
104
|
+
context,
|
|
105
|
+
template
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
var version = "2.21.0";
|
|
110
|
+
CalendarView.model = {
|
|
111
|
+
prop: "modelValue",
|
|
112
|
+
event: "update:modelValue"
|
|
113
|
+
};
|
|
114
|
+
CalendarView.install = function(Vue) {
|
|
115
|
+
Vue.component(CalendarView.name, CalendarView);
|
|
116
|
+
};
|
|
117
|
+
CalendarView.version = version;
|
|
118
|
+
export {
|
|
119
|
+
CalendarView as default
|
|
120
|
+
};
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/calendar-view/vue';
|
|
2
|
+
import { defineComponent, $prefix, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import Button from '@opentinyvue/vue-button';
|
|
4
|
+
import DatePicker from '@opentinyvue/vue-date-picker';
|
|
5
|
+
import SliderButton from '@opentinyvue/vue-slider-button';
|
|
6
|
+
import SliderButtonGroup from '@opentinyvue/vue-slider-button-group';
|
|
7
|
+
import Tooltip from '@opentinyvue/vue-tooltip';
|
|
8
|
+
import { IconCheckedSur, IconPlus, IconChevronLeft, IconChevronRight, IconDayView, IconAgendaView, IconMonthView } from '@opentinyvue/vue-icon';
|
|
9
|
+
|
|
10
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
11
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
12
|
+
if (render) {
|
|
13
|
+
options.render = render;
|
|
14
|
+
options.staticRenderFns = staticRenderFns;
|
|
15
|
+
options._compiled = true;
|
|
16
|
+
}
|
|
17
|
+
var hook;
|
|
18
|
+
if (injectStyles) {
|
|
19
|
+
hook = injectStyles;
|
|
20
|
+
}
|
|
21
|
+
if (hook) {
|
|
22
|
+
if (options.functional) {
|
|
23
|
+
options._injectStyles = hook;
|
|
24
|
+
var originalRender = options.render;
|
|
25
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
26
|
+
hook.call(context);
|
|
27
|
+
return originalRender(h, context);
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
var existing = options.beforeCreate;
|
|
31
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
exports: scriptExports,
|
|
36
|
+
options
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var classes = {
|
|
41
|
+
"theme-blue": "text-color-brand bg-color-brand-hover-subtle border-l-2 border-color-brand",
|
|
42
|
+
"theme-green": "text-color-success bg-color-success-subtler border-l-2 border-color-success",
|
|
43
|
+
"theme-red": "text-color-error bg-color-error-subtler border-l-2 border-color-error",
|
|
44
|
+
"theme-yellow": "text-color-alert bg-color-alert-subtler border-l-2 border-color-alert",
|
|
45
|
+
"theme-purple": "text-color-chart-11 bg-color-chart-11-subtler border-l-2 border-color-chart-11",
|
|
46
|
+
"theme-cyan": "text-color-chart-5 bg-color-chart-5-subtler border-l-2 border-color-chart-5",
|
|
47
|
+
"theme-grey": "text-color-text-placeholder bg-color-none-disabled border-l-2 border-color-text-placeholder",
|
|
48
|
+
"bg-blue": "bg-color-brand-hover-subtle",
|
|
49
|
+
"bg-green": "bg-color-success-subtler",
|
|
50
|
+
"bg-red": "bg-color-error-subtler",
|
|
51
|
+
"bg-yellow": "bg-color-alert-subtler",
|
|
52
|
+
"bg-purple": "bg-color-chart-11-subtler",
|
|
53
|
+
"bg-cyan": "bg-color-chart-5-subtler",
|
|
54
|
+
"bg-grey": "bg-color-none-disabled",
|
|
55
|
+
"bg-white": "bg-color-bg-1",
|
|
56
|
+
"mark-blue": "bg-color-brand",
|
|
57
|
+
"mark-green": "bg-color-success",
|
|
58
|
+
"mark-red": "bg-color-error",
|
|
59
|
+
"mark-yellow": "bg-color-alert",
|
|
60
|
+
"mark-purple": "bg-color-chart-11",
|
|
61
|
+
"mark-cyan": "bg-color-chart-5",
|
|
62
|
+
"mark-grey": "bg-color-none"
|
|
63
|
+
};
|
|
64
|
+
var __vue2_script = defineComponent({
|
|
65
|
+
name: $prefix + "CalendarView",
|
|
66
|
+
emits: ["update:modelValue", "new-schedule", "selected-date-change", "prev-week-click", "next-week-click", "week-change", "year-change", "month-change", "date-click", "mode-change"],
|
|
67
|
+
components: {
|
|
68
|
+
TinyButton: Button,
|
|
69
|
+
IconCheckedSur: IconCheckedSur(),
|
|
70
|
+
IconPlus: IconPlus(),
|
|
71
|
+
IconChevronLeft: IconChevronLeft(),
|
|
72
|
+
IconChevronRight: IconChevronRight(),
|
|
73
|
+
TinySliderButton: SliderButton,
|
|
74
|
+
TinySliderButtonGroup: SliderButtonGroup,
|
|
75
|
+
TinyDatePicker: DatePicker,
|
|
76
|
+
TinyTooltip: Tooltip
|
|
77
|
+
},
|
|
78
|
+
props: [].concat(props, ["_constants", "modelValue", "showMark", "showNewSchedule", "setDayBgColor", "disabled", "mode", "modes", "year", "month", "dayTimes", "events", "height", "mark-color", "multi-select"]),
|
|
79
|
+
setup: function setup$1(props2, context) {
|
|
80
|
+
return setup({
|
|
81
|
+
props: props2,
|
|
82
|
+
context,
|
|
83
|
+
renderless,
|
|
84
|
+
api,
|
|
85
|
+
classes,
|
|
86
|
+
extendOptions: {
|
|
87
|
+
modesIcon: {
|
|
88
|
+
timeline: IconDayView(),
|
|
89
|
+
schedule: IconAgendaView(),
|
|
90
|
+
month: IconMonthView()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
var render = function render2() {
|
|
97
|
+
var _vm = this;
|
|
98
|
+
var _h = _vm.$createElement;
|
|
99
|
+
var _c = _vm._self._c || _h;
|
|
100
|
+
return _c("div", {
|
|
101
|
+
staticClass: "w-full h-auto",
|
|
102
|
+
attrs: {
|
|
103
|
+
"data-tag": "tiny-calendar-view"
|
|
104
|
+
}
|
|
105
|
+
}, [_c("tiny-tooltip", {
|
|
106
|
+
ref: "tooltip",
|
|
107
|
+
attrs: {
|
|
108
|
+
"popper-class": "absolute max-w-[theme(spacing.80)]",
|
|
109
|
+
"manual": true,
|
|
110
|
+
"effect": "light",
|
|
111
|
+
"placement": "right"
|
|
112
|
+
},
|
|
113
|
+
scopedSlots: _vm._u([{
|
|
114
|
+
key: "content",
|
|
115
|
+
fn: function fn() {
|
|
116
|
+
return [_c("div", {
|
|
117
|
+
staticClass: "p-2"
|
|
118
|
+
}, [_c("div", {
|
|
119
|
+
staticClass: "px-1.5 mb-1.5 border-l-2 border-color-brand"
|
|
120
|
+
}, [_vm._v(_vm._s(_vm.state.eventTipContent.title))]), _c("div", {
|
|
121
|
+
staticClass: "mb-1.5 px-2 text-color-text-placeholder"
|
|
122
|
+
}, [_vm._v(" " + _vm._s(_vm.state.eventTipContent.startDay) + " " + _vm._s(_vm.state.eventTipContent.startTime) + " ~ " + _vm._s(_vm.state.eventTipContent.endDay) + " " + _vm._s(_vm.state.eventTipContent.endTime) + " ")]), _c("p", {
|
|
123
|
+
staticClass: "px-2 text-color-icon-primary"
|
|
124
|
+
}, [_vm._v(_vm._s(_vm.state.eventTipContent.content || ""))])])];
|
|
125
|
+
},
|
|
126
|
+
proxy: true
|
|
127
|
+
}]),
|
|
128
|
+
model: {
|
|
129
|
+
value: _vm.state.eventTipVisible,
|
|
130
|
+
callback: function callback($$v) {
|
|
131
|
+
_vm.$set(_vm.state, "eventTipVisible", $$v);
|
|
132
|
+
},
|
|
133
|
+
expression: "state.eventTipVisible"
|
|
134
|
+
}
|
|
135
|
+
}), _c("div", {
|
|
136
|
+
staticClass: "flex justify-around items-center mb-3",
|
|
137
|
+
attrs: {
|
|
138
|
+
"data-tag": "tiny-calendar-view-today"
|
|
139
|
+
}
|
|
140
|
+
}, [_c("tiny-button", {
|
|
141
|
+
on: {
|
|
142
|
+
"click": _vm.toToday
|
|
143
|
+
}
|
|
144
|
+
}, [_vm._v(_vm._s(_vm.t("ui.calendarView.backToday")))]), _c("tiny-date-picker", {
|
|
145
|
+
staticClass: "ml-5 shrink-0",
|
|
146
|
+
attrs: {
|
|
147
|
+
"shape": "filter",
|
|
148
|
+
"type": "month",
|
|
149
|
+
"clearable": false,
|
|
150
|
+
"format": _vm.t("ui.calendarView.dateFormat")
|
|
151
|
+
},
|
|
152
|
+
on: {
|
|
153
|
+
"change": _vm.currentDateChange
|
|
154
|
+
},
|
|
155
|
+
model: {
|
|
156
|
+
value: _vm.state.currentDate,
|
|
157
|
+
callback: function callback($$v) {
|
|
158
|
+
_vm.$set(_vm.state, "currentDate", $$v);
|
|
159
|
+
},
|
|
160
|
+
expression: "state.currentDate"
|
|
161
|
+
}
|
|
162
|
+
}), _c("div", {
|
|
163
|
+
staticClass: "flex-1 mx-5",
|
|
164
|
+
attrs: {
|
|
165
|
+
"data-tag": "tiny-calendar-view-tool"
|
|
166
|
+
}
|
|
167
|
+
}, [_vm._t("tool")], 2), _vm.modes.length ? _c("tiny-slider-button-group", {
|
|
168
|
+
staticClass: "shrink-0",
|
|
169
|
+
attrs: {
|
|
170
|
+
"type": "icon"
|
|
171
|
+
},
|
|
172
|
+
model: {
|
|
173
|
+
value: _vm.state.mode,
|
|
174
|
+
callback: function callback($$v) {
|
|
175
|
+
_vm.$set(_vm.state, "mode", $$v);
|
|
176
|
+
},
|
|
177
|
+
expression: "state.mode"
|
|
178
|
+
}
|
|
179
|
+
}, _vm._l(_vm.modes, function(mode) {
|
|
180
|
+
return _c("tiny-slider-button", {
|
|
181
|
+
key: mode,
|
|
182
|
+
attrs: {
|
|
183
|
+
"label": mode
|
|
184
|
+
}
|
|
185
|
+
}, [_c(_vm.state.modesIcon[mode], {
|
|
186
|
+
tag: "component"
|
|
187
|
+
})], 1);
|
|
188
|
+
}), 1) : _vm._e()], 1), _vm.state.mode === "month" ? _c("div", {
|
|
189
|
+
staticClass: "shadow-sm",
|
|
190
|
+
attrs: {
|
|
191
|
+
"data-tag": "tiny-calendar-view-monthbox"
|
|
192
|
+
}
|
|
193
|
+
}, [_c("div", {
|
|
194
|
+
staticClass: "flex relative justify-around h-10 shadow-sm",
|
|
195
|
+
attrs: {
|
|
196
|
+
"data-tag": "tiny-calendar-view-month"
|
|
197
|
+
}
|
|
198
|
+
}, [_c("div", {
|
|
199
|
+
staticClass: "absolute left-3 top-2.5 cursor-pointer",
|
|
200
|
+
attrs: {
|
|
201
|
+
"data-tag": "tiny-calendar-view-prevmonth"
|
|
202
|
+
},
|
|
203
|
+
on: {
|
|
204
|
+
"click": _vm.goPrevMonth
|
|
205
|
+
}
|
|
206
|
+
}, [_c("icon-chevron-left")], 1), _c("ul", {
|
|
207
|
+
staticClass: "flex justify-around flex-1 h-full",
|
|
208
|
+
attrs: {
|
|
209
|
+
"data-tag": "tiny-calendar-view-monthlist"
|
|
210
|
+
}
|
|
211
|
+
}, _vm._l(_vm.state.weekDays, function(day) {
|
|
212
|
+
return _c("li", {
|
|
213
|
+
key: day,
|
|
214
|
+
staticClass: "leading-10",
|
|
215
|
+
attrs: {
|
|
216
|
+
"data-tag": "tiny-calendar-view-monthitem"
|
|
217
|
+
}
|
|
218
|
+
}, [_c("span", {
|
|
219
|
+
staticClass: "text-sm text-color-text-primary"
|
|
220
|
+
}, [_vm._v(_vm._s(_vm.t("ui.calendarView.weekDays." + day)))])]);
|
|
221
|
+
}), 0), _c("div", {
|
|
222
|
+
staticClass: "absolute right-3 top-2.5 cursor-pointer",
|
|
223
|
+
attrs: {
|
|
224
|
+
"data-tag": "tiny-calendar-view-nextmonth"
|
|
225
|
+
},
|
|
226
|
+
on: {
|
|
227
|
+
"click": _vm.goNextMonth
|
|
228
|
+
}
|
|
229
|
+
}, [_c("icon-chevron-right")], 1)]), _c("div", {
|
|
230
|
+
staticClass: "w-full overflow-hidden",
|
|
231
|
+
attrs: {
|
|
232
|
+
"data-tag": "tiny-calendar-view-calendarbox"
|
|
233
|
+
}
|
|
234
|
+
}, [_c("div", {
|
|
235
|
+
staticClass: "w-full mt-0.5"
|
|
236
|
+
}, _vm._l(_vm.state.calendar, function(item, index) {
|
|
237
|
+
return _c("ul", {
|
|
238
|
+
key: index,
|
|
239
|
+
staticClass: "w-full flex justify-around border-b border-color-bg-2",
|
|
240
|
+
attrs: {
|
|
241
|
+
"data-tag": "tiny-calendar-view-calendarlist"
|
|
242
|
+
}
|
|
243
|
+
}, _vm._l(item, function(day, i) {
|
|
244
|
+
return _c("li", {
|
|
245
|
+
key: i,
|
|
246
|
+
staticClass: "py-0.5 relative h-20 overflow-hidden border-r border-color-bg-2",
|
|
247
|
+
class: _vm.m(i === 0 || i === 6 ? "bg-color-bg-6" : "bg-color-bg-1", day.isLast || day.isNext || day.disabled ? "" : _vm.isSelectedDate(day) ? "bg-color-brand-hover-subtle hover:bg-color-brand-hover-subtle" : "hover:bg-color-brand-hover-subtler", _vm.gcls("bg-" + _vm.getDayBgColor(day))),
|
|
248
|
+
style: {
|
|
249
|
+
"width": "14.2857%"
|
|
250
|
+
},
|
|
251
|
+
attrs: {
|
|
252
|
+
"data-tag": "tiny-calendar-view-calendaritem"
|
|
253
|
+
},
|
|
254
|
+
on: {
|
|
255
|
+
"click": function click($event) {
|
|
256
|
+
return _vm.selectDay(day);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}, [_vm.multiSelect && _vm.isSelectedDate(day) ? _c("div", {
|
|
260
|
+
staticClass: "absolute top-0 right-0 bg-color-brand h-4 w-4 overflow-hidden rounded-bl-lg",
|
|
261
|
+
attrs: {
|
|
262
|
+
"data-tag": "tiny-calendar-view-multiselect"
|
|
263
|
+
}
|
|
264
|
+
}, [_c("icon-checked-sur", {
|
|
265
|
+
staticClass: "fill-color-brand relative -right-px -top-0.5"
|
|
266
|
+
})], 1) : _vm._e(), _c("div", {
|
|
267
|
+
staticClass: "py-1.5 pl-2",
|
|
268
|
+
class: _vm.m(day.isLast || day.isNext ? "text-color-text-primary opacity-30" : _vm.isToday(day) || _vm.isSelectedDate(day) ? "text-color-brand" : "text-color-text-primary", day.disabled ? "text-color-none-hover" : ""),
|
|
269
|
+
attrs: {
|
|
270
|
+
"data-tag": "tiny-calendar-view-daytag"
|
|
271
|
+
}
|
|
272
|
+
}, [_vm._v(" " + _vm._s(_vm.isToday(day) ? _vm.t("ui.datepicker.today") : day.value) + " ")]), _c("div", {
|
|
273
|
+
staticClass: "overflow-y-auto scrollbar-size-0 w-full",
|
|
274
|
+
staticStyle: {
|
|
275
|
+
"max-height": "calc(100% - 26px)"
|
|
276
|
+
},
|
|
277
|
+
attrs: {
|
|
278
|
+
"data-tag": "tiny-calendar-view-timebox"
|
|
279
|
+
}
|
|
280
|
+
}, _vm._l(_vm.getEventByTime(day, _vm._constants.DAY_START_TIME, _vm._constants.DAY_END_TIME), function(event, idx) {
|
|
281
|
+
return _c("div", {
|
|
282
|
+
key: idx,
|
|
283
|
+
staticClass: "mb-0.5",
|
|
284
|
+
on: {
|
|
285
|
+
"mouseenter": function mouseenter($event) {
|
|
286
|
+
return _vm.handleMouseenter($event, event);
|
|
287
|
+
},
|
|
288
|
+
"mouseleave": function mouseleave($event) {
|
|
289
|
+
return _vm.handleMouseleave($event, event);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}, [_vm.isStartOrEndDay("start", day.value, _vm._constants.DAY_START_TIME, _vm._constants.DAY_END_TIME, event) ? _c("div", {
|
|
293
|
+
staticClass: "pl-0.5",
|
|
294
|
+
class: [event.dayNumber > 1 ? "pr-0" : "pr-0.5"]
|
|
295
|
+
}, [_c("span", {
|
|
296
|
+
staticClass: "px-1.5 inline-block rounded-sm leading-5 line-clamp-1",
|
|
297
|
+
class: [_vm.gcls("theme-" + event.theme)],
|
|
298
|
+
attrs: {
|
|
299
|
+
"data-tag": "tiny-calendar-view-time"
|
|
300
|
+
}
|
|
301
|
+
}, [_vm._v(" " + _vm._s(event.title) + " ")])]) : _c("div", {
|
|
302
|
+
staticClass: "h-5 leading-5",
|
|
303
|
+
class: [_vm.isStartOrEndDay("end", day.value, _vm._constants.DAY_START_TIME, _vm._constants.DAY_END_TIME, event) ? "mr-0.5" : "mr-0", _vm.gcls("bg-" + event.theme)],
|
|
304
|
+
attrs: {
|
|
305
|
+
"data-tag": "tiny-calendar-view-theme"
|
|
306
|
+
}
|
|
307
|
+
})]);
|
|
308
|
+
}), 0)]);
|
|
309
|
+
}), 0);
|
|
310
|
+
}), 0)])]) : _c("div", {
|
|
311
|
+
staticClass: "shadow-sm",
|
|
312
|
+
attrs: {
|
|
313
|
+
"data-tag": "tiny-calendar-view-not-month"
|
|
314
|
+
}
|
|
315
|
+
}, [_c("div", {
|
|
316
|
+
staticClass: "flex justify-around items-center h-10 shadow-sm"
|
|
317
|
+
}, [_c("div", {
|
|
318
|
+
staticClass: "w-7 shrink-0 text-right cursor-pointer",
|
|
319
|
+
attrs: {
|
|
320
|
+
"data-tag": "tiny-calendar-view-prevweek"
|
|
321
|
+
},
|
|
322
|
+
on: {
|
|
323
|
+
"click": _vm.getPrevWeek
|
|
324
|
+
}
|
|
325
|
+
}, [_c("icon-chevron-left")], 1), _c("ul", {
|
|
326
|
+
staticClass: "flex justify-around flex-1 h-full",
|
|
327
|
+
attrs: {
|
|
328
|
+
"data-tag": "tiny-calendar-view-weekdates"
|
|
329
|
+
}
|
|
330
|
+
}, _vm._l(_vm.state.weekDates, function(date, index) {
|
|
331
|
+
return _c("li", {
|
|
332
|
+
key: date.value,
|
|
333
|
+
staticClass: "leading-10",
|
|
334
|
+
attrs: {
|
|
335
|
+
"data-tag": "tiny-calendar-view-weekitem"
|
|
336
|
+
}
|
|
337
|
+
}, [_vm._t("header", function() {
|
|
338
|
+
return [_c("span", {
|
|
339
|
+
staticClass: "relative mr-2.5 text-base",
|
|
340
|
+
class: [_vm.dateIsToday(date.value) ? "text-color-brand" : "text-color-text-primary"]
|
|
341
|
+
}, [_c("span", [_vm._v(_vm._s(date.value.split("-")[2]))]), _vm.isShowMark(date.value) ? _c("span", {
|
|
342
|
+
staticClass: "w-1.5 h-1.5 absolute -bottom-2 rounded-full",
|
|
343
|
+
class: [date.value.split("-")[2] > 9 ? "left-2" : "left-0.5", _vm.gcls("mark-" + _vm.markColor)]
|
|
344
|
+
}) : _vm._e()]), _c("span", {
|
|
345
|
+
staticClass: "text-sm",
|
|
346
|
+
class: [_vm.dateIsToday(date.value) ? "text-color-brand" : "text-color-text-placeholder"]
|
|
347
|
+
}, [_vm._v(_vm._s(_vm.dateIsToday(date.value) ? _vm.t("ui.datepicker.today") : _vm.t("ui.calendarView.weekDays." + index)))])];
|
|
348
|
+
}, {
|
|
349
|
+
"slotScope": {
|
|
350
|
+
date: date.value,
|
|
351
|
+
weekDay: _vm.t("ui.calendarView.weekDays." + index)
|
|
352
|
+
}
|
|
353
|
+
})], 2);
|
|
354
|
+
}), 0), _c("div", {
|
|
355
|
+
staticClass: "w-7 shrink-0 text-left cursor-pointer",
|
|
356
|
+
attrs: {
|
|
357
|
+
"data-tag": "tiny-calendar-view-nextvweek"
|
|
358
|
+
},
|
|
359
|
+
on: {
|
|
360
|
+
"click": _vm.getNextWeek
|
|
361
|
+
}
|
|
362
|
+
}, [_c("icon-chevron-right")], 1)]), _vm.state.mode === "timeline" ? _c("div", {
|
|
363
|
+
staticClass: "w-full h-112 flex overflow-y-auto mt-1",
|
|
364
|
+
style: {
|
|
365
|
+
"height": _vm.height
|
|
366
|
+
},
|
|
367
|
+
attrs: {
|
|
368
|
+
"data-tag": "tiny-calendar-view-timeline"
|
|
369
|
+
}
|
|
370
|
+
}, [_c("div", {
|
|
371
|
+
staticClass: "w-12",
|
|
372
|
+
attrs: {
|
|
373
|
+
"data-tag": "tiny-calendar-view-timelinelist"
|
|
374
|
+
}
|
|
375
|
+
}, [_c("ul", _vm._l(_vm.state.dayTimes, function(item, i) {
|
|
376
|
+
return _c("li", {
|
|
377
|
+
key: item.time,
|
|
378
|
+
staticClass: "h-5 text-center border-b",
|
|
379
|
+
class: [i % 2 === 1 ? "border-color-bg-2" : "border-color-bg-1"],
|
|
380
|
+
attrs: {
|
|
381
|
+
"data-tag": "tiny-calendar-view-timelineitem"
|
|
382
|
+
}
|
|
383
|
+
}, [_c("span", {
|
|
384
|
+
staticClass: "text-sm text-color-text-primary"
|
|
385
|
+
}, [_vm._v(_vm._s(item.text.includes("30") ? "" : item.text))])]);
|
|
386
|
+
}), 0)]), _c("div", {
|
|
387
|
+
staticClass: "flex-1",
|
|
388
|
+
attrs: {
|
|
389
|
+
"data-tag": "tiny-calendar-view-timelinelist"
|
|
390
|
+
}
|
|
391
|
+
}, [_c("ul", {
|
|
392
|
+
staticClass: "w-full flex justify-around"
|
|
393
|
+
}, _vm._l(_vm.state.weekDates, function(date, index) {
|
|
394
|
+
return _c("li", {
|
|
395
|
+
key: date.value,
|
|
396
|
+
staticClass: "relative",
|
|
397
|
+
class: [index === 0 || index === 6 ? "bg-color-bg-6" : ""],
|
|
398
|
+
staticStyle: {
|
|
399
|
+
"width": "calc((100% - 10px) / 7)"
|
|
400
|
+
},
|
|
401
|
+
attrs: {
|
|
402
|
+
"data-tag": "tiny-calendar-view-timelineitem"
|
|
403
|
+
}
|
|
404
|
+
}, [_vm._t("timeline" + (index + 1), function() {
|
|
405
|
+
return [_c("ul", _vm._l(_vm.state.dayTimes, function(item, i) {
|
|
406
|
+
return _c("li", {
|
|
407
|
+
key: date.value + item.time,
|
|
408
|
+
staticClass: "relative h-5 p-0.5 list-none border-b border-color-bg-2",
|
|
409
|
+
class: [i % 2 === 0 ? "border-dashed" : "border-solid"]
|
|
410
|
+
}, _vm._l(_vm.getEventByTime(date.value, item.time, _vm.state.dayTimes[i + 1] && _vm.state.dayTimes[i + 1].time), function(event, idx) {
|
|
411
|
+
return _c("div", {
|
|
412
|
+
key: idx,
|
|
413
|
+
staticClass: "w-11/12 flex items-center px-1.5 absolute top-0 left-0 z-10 leading-normal rounded-sm",
|
|
414
|
+
class: [_vm.gcls("theme-" + (event.theme || _vm.blue))],
|
|
415
|
+
style: {
|
|
416
|
+
"height": event.height + "px",
|
|
417
|
+
"left": event.left + "px",
|
|
418
|
+
"width": "calc(92% - " + event.left + "px)"
|
|
419
|
+
}
|
|
420
|
+
}, [_c("span", [_vm._v(_vm._s(event.title))])]);
|
|
421
|
+
}), 0);
|
|
422
|
+
}), 0)];
|
|
423
|
+
}, {
|
|
424
|
+
"slotScope": {
|
|
425
|
+
date: date.value,
|
|
426
|
+
events: _vm.state.curWeekEvents[date.value]
|
|
427
|
+
}
|
|
428
|
+
})], 2);
|
|
429
|
+
}), 0)])]) : _vm._e(), _vm.state.mode === "schedule" ? _c("div", {
|
|
430
|
+
staticClass: "w-full px-6 pb-4 overflow-y-auto h-112",
|
|
431
|
+
style: {
|
|
432
|
+
"height": _vm.height
|
|
433
|
+
},
|
|
434
|
+
attrs: {
|
|
435
|
+
"data-tag": "tiny-calendar-view-schedule"
|
|
436
|
+
}
|
|
437
|
+
}, [_c("ul", {
|
|
438
|
+
staticClass: "flex w-full",
|
|
439
|
+
attrs: {
|
|
440
|
+
"data-tag": "tiny-calendar-view-schedulelist"
|
|
441
|
+
}
|
|
442
|
+
}, _vm._l(_vm.state.weekDates, function(date, index) {
|
|
443
|
+
return _c("li", {
|
|
444
|
+
key: date.value,
|
|
445
|
+
staticClass: "h-full py-3 px-2",
|
|
446
|
+
staticStyle: {
|
|
447
|
+
"width": "14.28%"
|
|
448
|
+
},
|
|
449
|
+
attrs: {
|
|
450
|
+
"data-tag": "tiny-calendar-view-scheduleitem"
|
|
451
|
+
}
|
|
452
|
+
}, [_vm._t("weekday" + (index + 1), function() {
|
|
453
|
+
return _vm._l(_vm.state.curWeekEvents[date.value] || [], function(event, idx) {
|
|
454
|
+
return _c("div", {
|
|
455
|
+
key: idx,
|
|
456
|
+
staticClass: "py-1.5 h-auto border border-color-border-separator rounded mb-2 shadow-sm",
|
|
457
|
+
attrs: {
|
|
458
|
+
"data-tag": "tiny-calendar-view-curWeek"
|
|
459
|
+
}
|
|
460
|
+
}, [_c("div", {
|
|
461
|
+
staticClass: "px-1.5 mb-1.5 border-l-2 border-color-brand"
|
|
462
|
+
}, [_vm._v(_vm._s(event.title))]), _c("div", {
|
|
463
|
+
staticClass: "mb-1.5 px-2 text-color-text-placeholder"
|
|
464
|
+
}, [_vm._v(" " + _vm._s(_vm.getEventShowTime("start", event, date.value)) + " - " + _vm._s(_vm.getEventShowTime("end", event, date.value)) + " ")]), _c("p", {
|
|
465
|
+
staticClass: "px-2 text-color-icon-primary line-clamp-2"
|
|
466
|
+
}, [_vm._v(_vm._s(event.content || ""))])]);
|
|
467
|
+
});
|
|
468
|
+
}, {
|
|
469
|
+
"slotScope": {
|
|
470
|
+
date: date.value,
|
|
471
|
+
events: _vm.state.curWeekEvents[date.value]
|
|
472
|
+
}
|
|
473
|
+
}), _vm.isShowNewSchedule(date.value) ? _c("div", {
|
|
474
|
+
staticClass: "h-8 text-center leading-8 w-full mt-2 border border-color-border-separator rounded cursor-pointer",
|
|
475
|
+
attrs: {
|
|
476
|
+
"data-tag": "tiny-calendar-view-newschedule"
|
|
477
|
+
},
|
|
478
|
+
on: {
|
|
479
|
+
"click": function click($event) {
|
|
480
|
+
return _vm.newSchedule(date.value);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}, [_c("icon-plus", {
|
|
484
|
+
staticClass: "align-sub fill-color-text-placeholder"
|
|
485
|
+
}), _c("span", {
|
|
486
|
+
staticClass: "ml-1 text-color-text-placeholder"
|
|
487
|
+
}, [_vm._v(_vm._s(_vm.t("ui.calendarView.new")))])], 1) : _vm._e()], 2);
|
|
488
|
+
}), 0)]) : _vm._e()])], 1);
|
|
489
|
+
};
|
|
490
|
+
var staticRenderFns = [];
|
|
491
|
+
var __cssModules = {};
|
|
492
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
493
|
+
function __vue2_injectStyles(context) {
|
|
494
|
+
for (var o in __cssModules) {
|
|
495
|
+
this[o] = __cssModules[o];
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
var mobileFirst = /* @__PURE__ */ function() {
|
|
499
|
+
return __component__.exports;
|
|
500
|
+
}();
|
|
501
|
+
|
|
502
|
+
export { mobileFirst as default };
|
package/lib/pc.js
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/calendar-view/vue';
|
|
2
|
+
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import Button from '@opentinyvue/vue-button';
|
|
4
|
+
import DatePicker from '@opentinyvue/vue-date-picker';
|
|
5
|
+
import RadioButton from '@opentinyvue/vue-radio-button';
|
|
6
|
+
import RadioGroup from '@opentinyvue/vue-radio-group';
|
|
7
|
+
import Tooltip from '@opentinyvue/vue-tooltip';
|
|
8
|
+
import { iconCheckedSur, iconPlus, iconChevronLeft, iconChevronRight, iconDayView, iconAgendaView, iconMonthView } from '@opentinyvue/vue-icon';
|
|
9
|
+
|
|
10
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
11
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
12
|
+
if (render) {
|
|
13
|
+
options.render = render;
|
|
14
|
+
options.staticRenderFns = staticRenderFns;
|
|
15
|
+
options._compiled = true;
|
|
16
|
+
}
|
|
17
|
+
var hook;
|
|
18
|
+
if (injectStyles) {
|
|
19
|
+
hook = injectStyles;
|
|
20
|
+
}
|
|
21
|
+
if (hook) {
|
|
22
|
+
if (options.functional) {
|
|
23
|
+
options._injectStyles = hook;
|
|
24
|
+
var originalRender = options.render;
|
|
25
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
26
|
+
hook.call(context);
|
|
27
|
+
return originalRender(h, context);
|
|
28
|
+
};
|
|
29
|
+
} else {
|
|
30
|
+
var existing = options.beforeCreate;
|
|
31
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
exports: scriptExports,
|
|
36
|
+
options
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var render = function render2() {
|
|
41
|
+
var _vm = this;
|
|
42
|
+
var _h = _vm.$createElement;
|
|
43
|
+
var _c = _vm._self._c || _h;
|
|
44
|
+
return _c("div", {
|
|
45
|
+
staticClass: "tiny-calendar-view",
|
|
46
|
+
style: {
|
|
47
|
+
"height": typeof _vm.height === "number" ? _vm.height + "px" : _vm.height
|
|
48
|
+
}
|
|
49
|
+
}, [_c("div", {
|
|
50
|
+
staticClass: "tiny-calendar-view__header"
|
|
51
|
+
}, [_c("div", [_c("tiny-button", {
|
|
52
|
+
on: {
|
|
53
|
+
"click": _vm.toToday
|
|
54
|
+
}
|
|
55
|
+
}, [_vm._v(_vm._s(_vm.t("ui.calendarView.backToday")))])], 1), _c("tiny-date-picker", {
|
|
56
|
+
staticClass: "tiny-calendar-view__picker",
|
|
57
|
+
attrs: {
|
|
58
|
+
"type": "month",
|
|
59
|
+
"clearable": false,
|
|
60
|
+
"format": _vm.t("ui.calendarView.dateFormat")
|
|
61
|
+
},
|
|
62
|
+
on: {
|
|
63
|
+
"change": _vm.currentDateChange
|
|
64
|
+
},
|
|
65
|
+
model: {
|
|
66
|
+
value: _vm.state.currentDate,
|
|
67
|
+
callback: function callback($$v) {
|
|
68
|
+
_vm.$set(_vm.state, "currentDate", $$v);
|
|
69
|
+
},
|
|
70
|
+
expression: "state.currentDate"
|
|
71
|
+
}
|
|
72
|
+
}), _c("div", {
|
|
73
|
+
staticClass: "tiny-calendar-view__tool"
|
|
74
|
+
}, [_vm._t("tool")], 2), _vm.modes.length ? _c("tiny-radio-group", {
|
|
75
|
+
staticClass: "tiny-calendar-view__radio",
|
|
76
|
+
attrs: {
|
|
77
|
+
"size": "mini"
|
|
78
|
+
},
|
|
79
|
+
model: {
|
|
80
|
+
value: _vm.state.mode,
|
|
81
|
+
callback: function callback($$v) {
|
|
82
|
+
_vm.$set(_vm.state, "mode", $$v);
|
|
83
|
+
},
|
|
84
|
+
expression: "state.mode"
|
|
85
|
+
}
|
|
86
|
+
}, _vm._l(_vm.modes, function(mode) {
|
|
87
|
+
return _c("tiny-radio-button", {
|
|
88
|
+
key: mode,
|
|
89
|
+
attrs: {
|
|
90
|
+
"label": mode
|
|
91
|
+
}
|
|
92
|
+
}, [_c(_vm.state.modesIcon[mode], {
|
|
93
|
+
tag: "component",
|
|
94
|
+
class: _vm.state.mode === mode && "fill-brand"
|
|
95
|
+
})], 1);
|
|
96
|
+
}), 1) : _vm._e()], 1), _vm.state.mode === "month" ? _c("div", {
|
|
97
|
+
staticClass: "tiny-calendar-view-month"
|
|
98
|
+
}, [_c("div", {
|
|
99
|
+
staticClass: "tiny-calendar-view-month__header"
|
|
100
|
+
}, [_c("div", {
|
|
101
|
+
staticClass: "header-left",
|
|
102
|
+
on: {
|
|
103
|
+
"click": _vm.goPrevMonth
|
|
104
|
+
}
|
|
105
|
+
}, [_c("icon-chevron-left")], 1), _c("ul", {
|
|
106
|
+
staticClass: "header-main"
|
|
107
|
+
}, _vm._l(_vm.state.weekDays, function(day) {
|
|
108
|
+
return _c("li", {
|
|
109
|
+
key: day
|
|
110
|
+
}, [_c("span", [_vm._v(_vm._s(_vm.t("ui.calendarView.weekDays." + day)))])]);
|
|
111
|
+
}), 0), _c("div", {
|
|
112
|
+
staticClass: "header-right",
|
|
113
|
+
on: {
|
|
114
|
+
"click": _vm.goNextMonth
|
|
115
|
+
}
|
|
116
|
+
}, [_c("icon-chevron-right")], 1)]), _c("div", {
|
|
117
|
+
staticClass: "tiny-calendar-view-month__main"
|
|
118
|
+
}, [_c("div", {
|
|
119
|
+
staticClass: "main-container"
|
|
120
|
+
}, _vm._l(_vm.state.calendar, function(item, index) {
|
|
121
|
+
return _c("ul", {
|
|
122
|
+
key: index
|
|
123
|
+
}, _vm._l(item, function(day, i) {
|
|
124
|
+
return _c("li", {
|
|
125
|
+
key: i,
|
|
126
|
+
class: [i === 0 || i === 6 ? "is-weekends" : "", day.isLast || day.isNext || day.disabled ? "" : _vm.isSelectedDate(day) ? "is-selected" : "not-selected", "bg-" + _vm.getDayBgColor(day)],
|
|
127
|
+
style: {
|
|
128
|
+
"width": "14.2857%"
|
|
129
|
+
},
|
|
130
|
+
on: {
|
|
131
|
+
"click": function click($event) {
|
|
132
|
+
return _vm.selectDay(day);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, [_vm.multiSelect && _vm.isSelectedDate(day) ? _c("div", {
|
|
136
|
+
staticClass: "day-selected"
|
|
137
|
+
}, [_c("icon-checked-sur")], 1) : _vm._e(), _c("div", {
|
|
138
|
+
staticClass: "date",
|
|
139
|
+
class: [day.isLast || day.isNext ? "is-next-or-last" : _vm.isToday(day) || _vm.isSelectedDate(day) ? "is-selected" : "", day.disabled ? "is-disabled" : ""]
|
|
140
|
+
}, [_vm._v(" " + _vm._s(_vm.isToday(day) ? _vm.t("ui.datepicker.today") : day.value) + " ")]), _c("div", {
|
|
141
|
+
staticClass: "day-events",
|
|
142
|
+
staticStyle: {
|
|
143
|
+
"max-height": "calc(100% - 26px)"
|
|
144
|
+
}
|
|
145
|
+
}, _vm._l(_vm.getEventByTime(day, _vm._constants.DAY_START_TIME, _vm._constants.DAY_END_TIME), function(event, idx) {
|
|
146
|
+
return _c("div", {
|
|
147
|
+
key: idx,
|
|
148
|
+
staticClass: "events-container",
|
|
149
|
+
on: {
|
|
150
|
+
"mouseenter": function mouseenter($event) {
|
|
151
|
+
return _vm.handleMouseenter($event, event);
|
|
152
|
+
},
|
|
153
|
+
"mouseleave": function mouseleave($event) {
|
|
154
|
+
return _vm.handleMouseleave($event, event);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}, [_vm.isStartOrEndDay("start", day.value, _vm._constants.DAY_START_TIME, _vm._constants.DAY_END_TIME, event) ? _c("div", {
|
|
158
|
+
staticClass: "events-start",
|
|
159
|
+
class: event.dayNumber > 1 && "multi-day"
|
|
160
|
+
}, [_c("span", {
|
|
161
|
+
staticClass: "events-title",
|
|
162
|
+
class: event.theme ? "theme-" + event.theme : ""
|
|
163
|
+
}, [_vm._v(" " + _vm._s(event.title) + " ")])]) : _c("div", {
|
|
164
|
+
staticClass: "events-end",
|
|
165
|
+
class: [_vm.isStartOrEndDay("end", day.value, _vm._constants.DAY_START_TIME, _vm._constants.DAY_END_TIME, event) ? "is-end" : "", event.theme ? "bg-" + event.theme : ""]
|
|
166
|
+
})]);
|
|
167
|
+
}), 0)]);
|
|
168
|
+
}), 0);
|
|
169
|
+
}), 0)])]) : _c("div", {
|
|
170
|
+
staticClass: "tiny-calendar-view-week"
|
|
171
|
+
}, [_c("div", {
|
|
172
|
+
staticClass: "tiny-calendar-view-week__header"
|
|
173
|
+
}, [_c("div", {
|
|
174
|
+
staticClass: "header-left",
|
|
175
|
+
on: {
|
|
176
|
+
"click": _vm.getPrevWeek
|
|
177
|
+
}
|
|
178
|
+
}, [_c("icon-chevron-left")], 1), _c("ul", {
|
|
179
|
+
staticClass: "header-main"
|
|
180
|
+
}, _vm._l(_vm.state.weekDates, function(date, index) {
|
|
181
|
+
return _c("li", {
|
|
182
|
+
key: date.value
|
|
183
|
+
}, [_vm._t("header", function() {
|
|
184
|
+
return [_c("span", {
|
|
185
|
+
staticClass: "date",
|
|
186
|
+
class: _vm.dateIsToday(date.value) && "is-today"
|
|
187
|
+
}, [_c("span", [_vm._v(_vm._s(date.value.split("-")[2]))]), _vm.isShowMark(date.value) ? _c("span", {
|
|
188
|
+
staticClass: "mark",
|
|
189
|
+
class: [date.value.split("-")[2] > 9 ? "is-two-digit" : "", _vm.markColor ? "mark-" + _vm.markColor : ""]
|
|
190
|
+
}) : _vm._e()]), _c("span", {
|
|
191
|
+
staticClass: "week-day",
|
|
192
|
+
class: _vm.dateIsToday(date.value) && "is-today"
|
|
193
|
+
}, [_vm._v(_vm._s(_vm.dateIsToday(date.value) ? _vm.t("ui.datepicker.today") : _vm.t("ui.calendarView.weekDays." + index)))])];
|
|
194
|
+
}, {
|
|
195
|
+
"slotScope": {
|
|
196
|
+
date: date.value,
|
|
197
|
+
weekDay: _vm.t("ui.calendarView.weekDays." + index)
|
|
198
|
+
}
|
|
199
|
+
})], 2);
|
|
200
|
+
}), 0), _c("div", {
|
|
201
|
+
staticClass: "header-right",
|
|
202
|
+
on: {
|
|
203
|
+
"click": _vm.getNextWeek
|
|
204
|
+
}
|
|
205
|
+
}, [_c("icon-chevron-right")], 1)]), _vm.state.mode === "timeline" ? _c("div", {
|
|
206
|
+
staticClass: "tiny-calendar-view-week__timeline"
|
|
207
|
+
}, [_c("div", {
|
|
208
|
+
staticClass: "day-times"
|
|
209
|
+
}, [_c("ul", _vm._l(_vm.state.dayTimes, function(item, i) {
|
|
210
|
+
return _c("li", {
|
|
211
|
+
key: item.time,
|
|
212
|
+
class: i % 2 === 1 && "is-odd-num"
|
|
213
|
+
}, [_c("span", [_vm._v(_vm._s(item.text.includes("30") ? "" : item.text))])]);
|
|
214
|
+
}), 0)]), _c("div", {
|
|
215
|
+
staticClass: "day-events"
|
|
216
|
+
}, [_c("ul", _vm._l(_vm.state.weekDates, function(date, index) {
|
|
217
|
+
return _c("li", {
|
|
218
|
+
key: date.value,
|
|
219
|
+
class: index === 0 || index === 6 ? "is-weekends" : "",
|
|
220
|
+
staticStyle: {
|
|
221
|
+
"width": "calc((100% - 10px) / 7)"
|
|
222
|
+
}
|
|
223
|
+
}, [_vm._t("timeline" + (index + 1), function() {
|
|
224
|
+
return [_c("ul", {
|
|
225
|
+
staticClass: "events-list"
|
|
226
|
+
}, _vm._l(_vm.state.dayTimes, function(item, i) {
|
|
227
|
+
return _c("li", {
|
|
228
|
+
key: date.value + item.time,
|
|
229
|
+
class: i % 2 === 0 && "is-even-num"
|
|
230
|
+
}, _vm._l(_vm.getEventByTime(date.value, item.time, _vm.state.dayTimes[i + 1] && _vm.state.dayTimes[i + 1].time), function(event, idx) {
|
|
231
|
+
return _c("div", {
|
|
232
|
+
key: idx,
|
|
233
|
+
staticClass: "events-item",
|
|
234
|
+
class: ["theme-" + (event.theme || "blue")],
|
|
235
|
+
style: {
|
|
236
|
+
"height": event.height + "px",
|
|
237
|
+
"left": event.left + "px",
|
|
238
|
+
"width": "calc(92% - " + event.left + "px)"
|
|
239
|
+
}
|
|
240
|
+
}, [_c("span", [_vm._v(_vm._s(event.title))])]);
|
|
241
|
+
}), 0);
|
|
242
|
+
}), 0)];
|
|
243
|
+
}, {
|
|
244
|
+
"slotScope": {
|
|
245
|
+
date: date.value,
|
|
246
|
+
events: _vm.state.curWeekEvents[date.value]
|
|
247
|
+
}
|
|
248
|
+
})], 2);
|
|
249
|
+
}), 0)])]) : _vm._e(), _vm.state.mode === "schedule" ? _c("div", {
|
|
250
|
+
staticClass: "tiny-calendar-view-week__schedule"
|
|
251
|
+
}, [_c("ul", _vm._l(_vm.state.weekDates, function(date, index) {
|
|
252
|
+
return _c("li", {
|
|
253
|
+
key: date.value,
|
|
254
|
+
staticStyle: {
|
|
255
|
+
"width": "14.28%"
|
|
256
|
+
}
|
|
257
|
+
}, [_vm._t("weekday" + (index + 1), function() {
|
|
258
|
+
return _vm._l(_vm.state.curWeekEvents[date.value] || [], function(event, idx) {
|
|
259
|
+
return _c("div", {
|
|
260
|
+
key: idx,
|
|
261
|
+
staticClass: "day-events"
|
|
262
|
+
}, [_c("div", {
|
|
263
|
+
staticClass: "title"
|
|
264
|
+
}, [_vm._v(_vm._s(event.title))]), _c("div", {
|
|
265
|
+
staticClass: "date"
|
|
266
|
+
}, [_vm._v(" " + _vm._s(_vm.getEventShowTime("start", event, date.value)) + " - " + _vm._s(_vm.getEventShowTime("end", event, date.value)) + " ")]), _c("p", {
|
|
267
|
+
staticClass: "content"
|
|
268
|
+
}, [_vm._v(_vm._s(event.content || ""))])]);
|
|
269
|
+
});
|
|
270
|
+
}, {
|
|
271
|
+
"slotScope": {
|
|
272
|
+
date: date.value,
|
|
273
|
+
events: _vm.state.curWeekEvents[date.value]
|
|
274
|
+
}
|
|
275
|
+
}), _vm.isShowNewSchedule(date.value) ? _c("div", {
|
|
276
|
+
staticClass: "new-schedule",
|
|
277
|
+
on: {
|
|
278
|
+
"click": function click($event) {
|
|
279
|
+
return _vm.newSchedule(date.value);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, [_c("icon-plus"), _c("span", [_vm._v(_vm._s(_vm.t("ui.calendarView.new")))])], 1) : _vm._e()], 2);
|
|
283
|
+
}), 0)]) : _vm._e()]), _c("tiny-tooltip", {
|
|
284
|
+
ref: "tooltip",
|
|
285
|
+
attrs: {
|
|
286
|
+
"popper-class": "tiny-calendar-view-tooltip",
|
|
287
|
+
"manual": true,
|
|
288
|
+
"effect": "light",
|
|
289
|
+
"placement": "right"
|
|
290
|
+
},
|
|
291
|
+
scopedSlots: _vm._u([{
|
|
292
|
+
key: "content",
|
|
293
|
+
fn: function fn() {
|
|
294
|
+
return [_c("div", {
|
|
295
|
+
staticClass: "tooltip-main"
|
|
296
|
+
}, [_c("div", {
|
|
297
|
+
staticClass: "title"
|
|
298
|
+
}, [_vm._v(_vm._s(_vm.state.eventTipContent.title))]), _c("div", {
|
|
299
|
+
staticClass: "date"
|
|
300
|
+
}, [_vm._v(" " + _vm._s(_vm.state.eventTipContent.startDay) + " " + _vm._s(_vm.state.eventTipContent.startTime) + " ~ " + _vm._s(_vm.state.eventTipContent.endDay) + " " + _vm._s(_vm.state.eventTipContent.endTime) + " ")]), _c("p", {
|
|
301
|
+
staticClass: "content"
|
|
302
|
+
}, [_vm._v(_vm._s(_vm.state.eventTipContent.content || ""))])])];
|
|
303
|
+
},
|
|
304
|
+
proxy: true
|
|
305
|
+
}]),
|
|
306
|
+
model: {
|
|
307
|
+
value: _vm.state.eventTipVisible,
|
|
308
|
+
callback: function callback($$v) {
|
|
309
|
+
_vm.$set(_vm.state, "eventTipVisible", $$v);
|
|
310
|
+
},
|
|
311
|
+
expression: "state.eventTipVisible"
|
|
312
|
+
}
|
|
313
|
+
})], 1);
|
|
314
|
+
};
|
|
315
|
+
var staticRenderFns = [];
|
|
316
|
+
var __vue2_script = defineComponent({
|
|
317
|
+
emits: ["update:modelValue", "new-schedule", "selected-date-change", "prev-week-click", "next-week-click", "week-change", "year-change", "month-change", "date-click", "mode-change"],
|
|
318
|
+
components: {
|
|
319
|
+
TinyButton: Button,
|
|
320
|
+
IconCheckedSur: iconCheckedSur(),
|
|
321
|
+
IconPlus: iconPlus(),
|
|
322
|
+
IconChevronLeft: iconChevronLeft(),
|
|
323
|
+
IconChevronRight: iconChevronRight(),
|
|
324
|
+
TinyRadioButton: RadioButton,
|
|
325
|
+
TinyRadioGroup: RadioGroup,
|
|
326
|
+
TinyDatePicker: DatePicker,
|
|
327
|
+
TinyTooltip: Tooltip
|
|
328
|
+
},
|
|
329
|
+
props: [].concat(props, ["modelValue", "showMark", "showNewSchedule", "setDayBgColor", "disabled", "mode", "modes", "year", "month", "dayTimes", "events", "height", "markColor", "multiSelect"]),
|
|
330
|
+
setup: function setup$1(props2, context) {
|
|
331
|
+
return setup({
|
|
332
|
+
props: props2,
|
|
333
|
+
context,
|
|
334
|
+
renderless,
|
|
335
|
+
api,
|
|
336
|
+
extendOptions: {
|
|
337
|
+
modesIcon: {
|
|
338
|
+
timeline: iconDayView(),
|
|
339
|
+
schedule: iconAgendaView(),
|
|
340
|
+
month: iconMonthView()
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
var __cssModules = {};
|
|
347
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
348
|
+
function __vue2_injectStyles(context) {
|
|
349
|
+
for (var o in __cssModules) {
|
|
350
|
+
this[o] = __cssModules[o];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
var pc = /* @__PURE__ */ function() {
|
|
354
|
+
return __component__.exports;
|
|
355
|
+
}();
|
|
356
|
+
|
|
357
|
+
export { pc as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-calendar-view",
|
|
3
|
+
"version": "2.21.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-icon": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
13
|
+
"@opentinyvue/vue-tooltip": "~2.21.0",
|
|
14
|
+
"@opentinyvue/vue-button": "~2.21.0",
|
|
15
|
+
"@opentinyvue/vue-date-picker": "~2.21.0",
|
|
16
|
+
"@opentinyvue/vue-radio-button": "~2.21.0",
|
|
17
|
+
"@opentinyvue/vue-radio-group": "~2.21.0",
|
|
18
|
+
"@opentinyvue/vue-slider-button": "~2.21.0",
|
|
19
|
+
"@opentinyvue/vue-slider-button-group": "~2.21.0",
|
|
20
|
+
"@opentinyvue/vue-theme": "~3.21.0"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"types": "index.d.ts"
|
|
24
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const $constants: {
|
|
2
|
+
DAY_START_TIME: string;
|
|
3
|
+
DAY_END_TIME: string;
|
|
4
|
+
DAY_START_HOUR: number;
|
|
5
|
+
DAY_END_HOUR: number;
|
|
6
|
+
CELL_HEIGHT: number;
|
|
7
|
+
WEDNESDAY: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const calendarViewProps: {
|
|
10
|
+
_constants: {
|
|
11
|
+
type: ObjectConstructor;
|
|
12
|
+
default: () => {
|
|
13
|
+
DAY_START_TIME: string;
|
|
14
|
+
DAY_END_TIME: string;
|
|
15
|
+
DAY_START_HOUR: number;
|
|
16
|
+
DAY_END_HOUR: number;
|
|
17
|
+
CELL_HEIGHT: number;
|
|
18
|
+
WEDNESDAY: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
modelValue: {};
|
|
22
|
+
showMark: {};
|
|
23
|
+
showNewSchedule: {};
|
|
24
|
+
setDayBgColor: {};
|
|
25
|
+
disabled: {};
|
|
26
|
+
mode: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
validator: (value: any) => number;
|
|
30
|
+
};
|
|
31
|
+
modes: {
|
|
32
|
+
type: ArrayConstructor;
|
|
33
|
+
default(): string[];
|
|
34
|
+
};
|
|
35
|
+
year: {
|
|
36
|
+
type: NumberConstructor;
|
|
37
|
+
default(): number;
|
|
38
|
+
};
|
|
39
|
+
month: {
|
|
40
|
+
type: NumberConstructor;
|
|
41
|
+
default(): number;
|
|
42
|
+
};
|
|
43
|
+
dayTimes: {
|
|
44
|
+
type: ArrayConstructor;
|
|
45
|
+
default(): number[];
|
|
46
|
+
validator: (value: any) => boolean;
|
|
47
|
+
};
|
|
48
|
+
events: {
|
|
49
|
+
type: ArrayConstructor;
|
|
50
|
+
default(): never[];
|
|
51
|
+
};
|
|
52
|
+
height: {
|
|
53
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
56
|
+
markColor: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
multiSelect: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
tiny_mode: StringConstructor;
|
|
65
|
+
tiny_mode_root: BooleanConstructor;
|
|
66
|
+
tiny_template: (ObjectConstructor | FunctionConstructor)[];
|
|
67
|
+
tiny_renderless: FunctionConstructor;
|
|
68
|
+
tiny_theme: StringConstructor;
|
|
69
|
+
tiny_chart_theme: ObjectConstructor;
|
|
70
|
+
};
|
|
71
|
+
declare const _default: any;
|
|
72
|
+
export default _default;
|
package/src/pc.vue.d.ts
ADDED
package/src/token.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const classes: {
|
|
2
|
+
'theme-blue': string;
|
|
3
|
+
'theme-green': string;
|
|
4
|
+
'theme-red': string;
|
|
5
|
+
'theme-yellow': string;
|
|
6
|
+
'theme-purple': string;
|
|
7
|
+
'theme-cyan': string;
|
|
8
|
+
'theme-grey': string;
|
|
9
|
+
'bg-blue': string;
|
|
10
|
+
'bg-green': string;
|
|
11
|
+
'bg-red': string;
|
|
12
|
+
'bg-yellow': string;
|
|
13
|
+
'bg-purple': string;
|
|
14
|
+
'bg-cyan': string;
|
|
15
|
+
'bg-grey': string;
|
|
16
|
+
'bg-white': string;
|
|
17
|
+
'mark-blue': string;
|
|
18
|
+
'mark-green': string;
|
|
19
|
+
'mark-red': string;
|
|
20
|
+
'mark-yellow': string;
|
|
21
|
+
'mark-purple': string;
|
|
22
|
+
'mark-cyan': string;
|
|
23
|
+
'mark-grey': string;
|
|
24
|
+
};
|