@opentinyvue/vue-calendar 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 +77 -0
- package/lib/pc.js +409 -0
- package/package.json +24 -0
- package/src/index.d.ts +2 -0
- package/src/pc.vue.d.ts +2 -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 Calendar from './src/index';
|
|
13
|
+
export default Calendar;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
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, $props, $setup } from "@opentinyvue/vue-common";
|
|
11
|
+
import PcTemplate from "./pc.js";
|
|
12
|
+
import "@opentinyvue/vue-theme/calendar/index.css";
|
|
13
|
+
var template = function template2(mode) {
|
|
14
|
+
var _process$env;
|
|
15
|
+
typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
|
|
16
|
+
return PcTemplate;
|
|
17
|
+
};
|
|
18
|
+
var Calendar = defineComponent({
|
|
19
|
+
name: $prefix + "Calendar",
|
|
20
|
+
props: _extends({}, $props, {
|
|
21
|
+
/**
|
|
22
|
+
* @property {String} [mode='month'] - 显示模式,month|year 可选
|
|
23
|
+
*/
|
|
24
|
+
mode: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "month",
|
|
27
|
+
validator: function validator(value) {
|
|
28
|
+
return Boolean(~["month", "year"].indexOf(value));
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* @property {Number} [year=getFullYear()] - 指定年份,默认今年
|
|
33
|
+
*/
|
|
34
|
+
year: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: function _default() {
|
|
37
|
+
return (/* @__PURE__ */ new Date()).getFullYear();
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* @property {Number} [month=getMonth()] - 指定月份,默认当月
|
|
42
|
+
*/
|
|
43
|
+
month: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: function _default2() {
|
|
46
|
+
return (/* @__PURE__ */ new Date()).getMonth() + 1;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* @property {Array} events - 事件列表
|
|
51
|
+
* @example
|
|
52
|
+
* [{ time: 1534297845236, title: '消息', content: '这是一条消息', type: 'primary' },
|
|
53
|
+
* { time: 1534297845236, title: '消息', content: '还有', type: 'info' }]
|
|
54
|
+
* type 类型: warning、error、info、success
|
|
55
|
+
*/
|
|
56
|
+
events: Array,
|
|
57
|
+
/**
|
|
58
|
+
* @property {Boolean} [showSelected=false] - 显示选中的日期
|
|
59
|
+
*/
|
|
60
|
+
showSelected: Boolean
|
|
61
|
+
}),
|
|
62
|
+
setup: function setup(props, context) {
|
|
63
|
+
return $setup({
|
|
64
|
+
props,
|
|
65
|
+
context,
|
|
66
|
+
template
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var version = "2.21.0";
|
|
71
|
+
Calendar.install = function(Vue) {
|
|
72
|
+
Vue.component(Calendar.name, Calendar);
|
|
73
|
+
};
|
|
74
|
+
Calendar.version = version;
|
|
75
|
+
export {
|
|
76
|
+
Calendar as default
|
|
77
|
+
};
|
package/lib/pc.js
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/calendar/vue';
|
|
2
|
+
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import Tooltip from '@opentinyvue/vue-tooltip';
|
|
4
|
+
import Popover from '@opentinyvue/vue-popover';
|
|
5
|
+
import Button from '@opentinyvue/vue-button';
|
|
6
|
+
import { iconChevronUp, iconChevronDown } from '@opentinyvue/vue-icon';
|
|
7
|
+
|
|
8
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
9
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
10
|
+
if (render) {
|
|
11
|
+
options.render = render;
|
|
12
|
+
options.staticRenderFns = staticRenderFns;
|
|
13
|
+
options._compiled = true;
|
|
14
|
+
}
|
|
15
|
+
var hook;
|
|
16
|
+
if (injectStyles) {
|
|
17
|
+
hook = injectStyles;
|
|
18
|
+
}
|
|
19
|
+
if (hook) {
|
|
20
|
+
if (options.functional) {
|
|
21
|
+
options._injectStyles = hook;
|
|
22
|
+
var originalRender = options.render;
|
|
23
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
24
|
+
hook.call(context);
|
|
25
|
+
return originalRender(h, context);
|
|
26
|
+
};
|
|
27
|
+
} else {
|
|
28
|
+
var existing = options.beforeCreate;
|
|
29
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
exports: scriptExports,
|
|
34
|
+
options
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var __vue2_script = defineComponent({
|
|
39
|
+
components: {
|
|
40
|
+
Tooltip,
|
|
41
|
+
Popover,
|
|
42
|
+
Button,
|
|
43
|
+
IconChevronUp: iconChevronUp(),
|
|
44
|
+
IconChevronDown: iconChevronDown()
|
|
45
|
+
},
|
|
46
|
+
props: [].concat(props, ["mode", "year", "month", "events", "showSelected"]),
|
|
47
|
+
setup: function setup$1(props2, context) {
|
|
48
|
+
return setup({
|
|
49
|
+
props: props2,
|
|
50
|
+
context,
|
|
51
|
+
renderless,
|
|
52
|
+
api
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var render = function render2() {
|
|
57
|
+
var _vm = this;
|
|
58
|
+
var _h = _vm.$createElement;
|
|
59
|
+
var _c = _vm._self._c || _h;
|
|
60
|
+
return _c("div", {
|
|
61
|
+
staticClass: "tiny-calendar"
|
|
62
|
+
}, [_c("div", {
|
|
63
|
+
staticClass: "tiny-calendar__header"
|
|
64
|
+
}, [_vm.showSelected && _vm.state.selectedTip ? _c("div", {
|
|
65
|
+
staticClass: "tiny-calendar__selected"
|
|
66
|
+
}, [_vm._v(" " + _vm._s(_vm.state.selectedTip) + " ")]) : _vm._e(), _vm._t("tool", function() {
|
|
67
|
+
return [_c("ul", {
|
|
68
|
+
staticClass: "tiny-calendar__tool"
|
|
69
|
+
}, [_c("li", [_c("Popover", {
|
|
70
|
+
attrs: {
|
|
71
|
+
"placement": "bottom-start",
|
|
72
|
+
"trigger": "click",
|
|
73
|
+
"transition": "tiny-transition-zoom-in-top",
|
|
74
|
+
"popper-class": "tiny-calendar is-popover",
|
|
75
|
+
"visible-arrow": false
|
|
76
|
+
},
|
|
77
|
+
scopedSlots: _vm._u([{
|
|
78
|
+
key: "reference",
|
|
79
|
+
fn: function fn() {
|
|
80
|
+
return [_c("div", {
|
|
81
|
+
staticClass: "tiny-calendar__input"
|
|
82
|
+
}, [_c("input", {
|
|
83
|
+
attrs: {
|
|
84
|
+
"type": "text",
|
|
85
|
+
"readonly": ""
|
|
86
|
+
},
|
|
87
|
+
domProps: {
|
|
88
|
+
"value": _vm.state.activeYear + _vm.t("ui.datepicker.year")
|
|
89
|
+
}
|
|
90
|
+
}), _c("div", {
|
|
91
|
+
staticClass: "tiny-calendar__input-btn"
|
|
92
|
+
}, [_c(_vm.state.showYear ? "icon-chevron-up" : "icon-chevron-down", {
|
|
93
|
+
tag: "component",
|
|
94
|
+
staticClass: "tiny-svg-size"
|
|
95
|
+
})], 1)])];
|
|
96
|
+
},
|
|
97
|
+
proxy: true
|
|
98
|
+
}, {
|
|
99
|
+
key: "default",
|
|
100
|
+
fn: function fn() {
|
|
101
|
+
return [_c("div", {
|
|
102
|
+
staticClass: "tiny-calendar__selector"
|
|
103
|
+
}, [_c("ul", {
|
|
104
|
+
staticClass: "tiny-calendar__poplist"
|
|
105
|
+
}, _vm._l(_vm.state.dropdownYear, function(year) {
|
|
106
|
+
return _c("li", {
|
|
107
|
+
key: year,
|
|
108
|
+
class: ["tiny-calendar__list-item", {
|
|
109
|
+
"is-selected": _vm.state.activeYear === year
|
|
110
|
+
}],
|
|
111
|
+
attrs: {
|
|
112
|
+
"title": year + _vm.t("ui.datepicker.year")
|
|
113
|
+
},
|
|
114
|
+
on: {
|
|
115
|
+
"click": function click() {
|
|
116
|
+
_vm.state.activeYear = year;
|
|
117
|
+
_vm.state.showYear = false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, [_vm._v(" " + _vm._s(year + _vm.t("ui.datepicker.year")) + " ")]);
|
|
121
|
+
}), 0)])];
|
|
122
|
+
},
|
|
123
|
+
proxy: true
|
|
124
|
+
}]),
|
|
125
|
+
model: {
|
|
126
|
+
value: _vm.state.showYear,
|
|
127
|
+
callback: function callback($$v) {
|
|
128
|
+
_vm.$set(_vm.state, "showYear", $$v);
|
|
129
|
+
},
|
|
130
|
+
expression: "state.showYear"
|
|
131
|
+
}
|
|
132
|
+
})], 1), _c("li", {
|
|
133
|
+
directives: [{
|
|
134
|
+
name: "show",
|
|
135
|
+
rawName: "v-show",
|
|
136
|
+
value: _vm.state.displayMode === "month",
|
|
137
|
+
expression: "state.displayMode === 'month'"
|
|
138
|
+
}]
|
|
139
|
+
}, [_c("Popover", {
|
|
140
|
+
attrs: {
|
|
141
|
+
"transition": "tiny-transition-zoom-in-top",
|
|
142
|
+
"placement": "bottom-start",
|
|
143
|
+
"trigger": "click",
|
|
144
|
+
"popper-class": "tiny-calendar is-popover",
|
|
145
|
+
"visible-arrow": false
|
|
146
|
+
},
|
|
147
|
+
scopedSlots: _vm._u([{
|
|
148
|
+
key: "reference",
|
|
149
|
+
fn: function fn() {
|
|
150
|
+
return [_c("div", {
|
|
151
|
+
staticClass: "tiny-calendar__input"
|
|
152
|
+
}, [_c("input", {
|
|
153
|
+
attrs: {
|
|
154
|
+
"type": "text",
|
|
155
|
+
"readonly": ""
|
|
156
|
+
},
|
|
157
|
+
domProps: {
|
|
158
|
+
"value": _vm.t("ui.datepicker.month" + _vm.state.activeMonth)
|
|
159
|
+
}
|
|
160
|
+
}), _c("div", {
|
|
161
|
+
staticClass: "tiny-calendar__input-btn"
|
|
162
|
+
}, [_c(_vm.state.showYear ? "icon-chevron-up" : "icon-chevron-down", {
|
|
163
|
+
tag: "component",
|
|
164
|
+
staticClass: "tiny-svg-size"
|
|
165
|
+
})], 1)])];
|
|
166
|
+
},
|
|
167
|
+
proxy: true
|
|
168
|
+
}, {
|
|
169
|
+
key: "default",
|
|
170
|
+
fn: function fn() {
|
|
171
|
+
return [_c("div", {
|
|
172
|
+
staticClass: "tiny-calendar__selector"
|
|
173
|
+
}, [_c("ul", {
|
|
174
|
+
staticClass: "tiny-calendar__poplist"
|
|
175
|
+
}, _vm._l(12, function(month) {
|
|
176
|
+
return _c("li", {
|
|
177
|
+
key: month,
|
|
178
|
+
class: ["tiny-calendar__list-item", {
|
|
179
|
+
"is-selected": _vm.state.activeMonth === month
|
|
180
|
+
}],
|
|
181
|
+
attrs: {
|
|
182
|
+
"title": _vm.t("ui.datepicker.month" + month)
|
|
183
|
+
},
|
|
184
|
+
on: {
|
|
185
|
+
"click": function click() {
|
|
186
|
+
_vm.state.activeMonth = month;
|
|
187
|
+
_vm.state.showMonth = false;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.month" + month)) + " ")]);
|
|
191
|
+
}), 0)])];
|
|
192
|
+
},
|
|
193
|
+
proxy: true
|
|
194
|
+
}]),
|
|
195
|
+
model: {
|
|
196
|
+
value: _vm.state.showMonth,
|
|
197
|
+
callback: function callback($$v) {
|
|
198
|
+
_vm.$set(_vm.state, "showMonth", $$v);
|
|
199
|
+
},
|
|
200
|
+
expression: "state.showMonth"
|
|
201
|
+
}
|
|
202
|
+
})], 1), _c("li", [_c("Button", {
|
|
203
|
+
attrs: {
|
|
204
|
+
"type": "primary"
|
|
205
|
+
},
|
|
206
|
+
on: {
|
|
207
|
+
"click": _vm.toToday
|
|
208
|
+
}
|
|
209
|
+
}, [_vm._v(_vm._s(_vm.state.displayMode === "month" ? _vm.t("ui.datepicker.today") : _vm.t("ui.datepicker.currentMonth")))])], 1), _c("li", [_c("ul", {
|
|
210
|
+
staticClass: "tiny-calendar__tabs"
|
|
211
|
+
}, [_c("li", {
|
|
212
|
+
class: {
|
|
213
|
+
active: _vm.state.displayMode === "month"
|
|
214
|
+
},
|
|
215
|
+
on: {
|
|
216
|
+
"click": function click($event) {
|
|
217
|
+
return _vm.toggeModel("month");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.month")) + " ")]), _c("li", {
|
|
221
|
+
class: {
|
|
222
|
+
active: _vm.state.displayMode === "year"
|
|
223
|
+
},
|
|
224
|
+
on: {
|
|
225
|
+
"click": function click($event) {
|
|
226
|
+
return _vm.toggeModel("year");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.calendar.showType.year")) + " ")])])])])];
|
|
230
|
+
}, {
|
|
231
|
+
"slotScope": _vm.state
|
|
232
|
+
})], 2), _c("div", {
|
|
233
|
+
class: ["tiny-calendar__main", _vm.state.displayMode]
|
|
234
|
+
}, [_c("table", {
|
|
235
|
+
directives: [{
|
|
236
|
+
name: "show",
|
|
237
|
+
rawName: "v-show",
|
|
238
|
+
value: _vm.state.displayMode === "month",
|
|
239
|
+
expression: "state.displayMode === 'month'"
|
|
240
|
+
}],
|
|
241
|
+
staticStyle: {
|
|
242
|
+
"table-layout": "fixed"
|
|
243
|
+
}
|
|
244
|
+
}, [_c("tr", [_c("th", [_vm._v(_vm._s(_vm.t("ui.datepicker.weeks.sun")))]), _c("th", [_vm._v(_vm._s(_vm.t("ui.datepicker.weeks.mon")))]), _c("th", [_vm._v(_vm._s(_vm.t("ui.datepicker.weeks.tue")))]), _c("th", [_vm._v(_vm._s(_vm.t("ui.datepicker.weeks.wed")))]), _c("th", [_vm._v(_vm._s(_vm.t("ui.datepicker.weeks.thu")))]), _c("th", [_vm._v(_vm._s(_vm.t("ui.datepicker.weeks.fri")))]), _c("th", [_vm._v(_vm._s(_vm.t("ui.datepicker.weeks.sat")))])]), _vm._l(_vm.state.calendar, function(item, index) {
|
|
245
|
+
return _c("tr", {
|
|
246
|
+
key: index
|
|
247
|
+
}, _vm._l(item, function(day, i) {
|
|
248
|
+
return _c("td", {
|
|
249
|
+
key: i,
|
|
250
|
+
attrs: {
|
|
251
|
+
"width": "14.2857%"
|
|
252
|
+
},
|
|
253
|
+
on: {
|
|
254
|
+
"click": function click($event) {
|
|
255
|
+
return _vm.selectDay(day);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}, [_c("div", {
|
|
259
|
+
class: ["tiny-calendar__day", {
|
|
260
|
+
selected: !(day.isLast || day.isNext) && _vm.state.selectedDate === _vm.getTime(day.value),
|
|
261
|
+
disable: day.isLast || day.isNext,
|
|
262
|
+
today: _vm.isToday(day)
|
|
263
|
+
}]
|
|
264
|
+
}, [_c("div", {
|
|
265
|
+
staticClass: "label"
|
|
266
|
+
}, [_vm._v(_vm._s(day.value))]), !(day.isLast || day.isNext) ? _c("ul", {
|
|
267
|
+
staticClass: "tiny-calendar__events tiny-min-scrollbar"
|
|
268
|
+
}, _vm._l(_vm.getEventByDay(day.value), function(_ref, j) {
|
|
269
|
+
var type = _ref.type, title = _ref.title, content = _ref.content, _ref$parseTime = _ref.parseTime, year = _ref$parseTime.year, month = _ref$parseTime.month, day2 = _ref$parseTime.day, hours = _ref$parseTime.hours, minutes = _ref$parseTime.minutes;
|
|
270
|
+
return _c("li", {
|
|
271
|
+
key: j
|
|
272
|
+
}, [_vm._t("day", function() {
|
|
273
|
+
return [_c("tooltip", {
|
|
274
|
+
staticClass: "tiny-calendar__tip",
|
|
275
|
+
attrs: {
|
|
276
|
+
"type": type,
|
|
277
|
+
"placement": "right",
|
|
278
|
+
"popper-class": "tiny-calendar__tip",
|
|
279
|
+
"mode": "hover"
|
|
280
|
+
},
|
|
281
|
+
scopedSlots: _vm._u([{
|
|
282
|
+
key: "content",
|
|
283
|
+
fn: function fn() {
|
|
284
|
+
return [_c("div", [_c("div", {
|
|
285
|
+
staticClass: "tiny-calendar__tip-header"
|
|
286
|
+
}, [_c("div", {
|
|
287
|
+
staticClass: "tiny-calendar__tip-year"
|
|
288
|
+
}, [_vm._v(" " + _vm._s(year + "-" + month + "-" + day2) + " ")]), _c("div", {
|
|
289
|
+
staticClass: "tiny-calendar__tip-hours"
|
|
290
|
+
}, [_vm._v(" " + _vm._s(hours + ":" + minutes) + " ")])]), _c("div", {
|
|
291
|
+
class: ["tiny-calendar__tip-title", type || "info"]
|
|
292
|
+
}, [_vm._v(" " + _vm._s(title) + " ")]), _c("div", {
|
|
293
|
+
staticClass: "tiny-calendar__tip-content"
|
|
294
|
+
}, [_vm._v(" " + _vm._s(content) + " ")])])];
|
|
295
|
+
},
|
|
296
|
+
proxy: true
|
|
297
|
+
}], null, true)
|
|
298
|
+
}, [_c("div", {
|
|
299
|
+
class: ["event", type || "info"]
|
|
300
|
+
}, [_vm._v(_vm._s(title))])])];
|
|
301
|
+
}, {
|
|
302
|
+
"slotScope": {
|
|
303
|
+
type,
|
|
304
|
+
title,
|
|
305
|
+
content,
|
|
306
|
+
year,
|
|
307
|
+
month,
|
|
308
|
+
day: day2,
|
|
309
|
+
hours,
|
|
310
|
+
minutes
|
|
311
|
+
}
|
|
312
|
+
})], 2);
|
|
313
|
+
}), 0) : _vm._e()])]);
|
|
314
|
+
}), 0);
|
|
315
|
+
})], 2), _c("table", {
|
|
316
|
+
directives: [{
|
|
317
|
+
name: "show",
|
|
318
|
+
rawName: "v-show",
|
|
319
|
+
value: _vm.state.displayMode === "year",
|
|
320
|
+
expression: "state.displayMode === 'year'"
|
|
321
|
+
}],
|
|
322
|
+
staticStyle: {
|
|
323
|
+
"table-layout": "fixed"
|
|
324
|
+
}
|
|
325
|
+
}, _vm._l(_vm.genMonths(), function(item, i) {
|
|
326
|
+
return _c("tr", {
|
|
327
|
+
key: i
|
|
328
|
+
}, _vm._l(item, function(mth, j) {
|
|
329
|
+
return _c("td", {
|
|
330
|
+
key: j,
|
|
331
|
+
attrs: {
|
|
332
|
+
"width": "25%"
|
|
333
|
+
},
|
|
334
|
+
on: {
|
|
335
|
+
"click": function click($event) {
|
|
336
|
+
return _vm.selectMonth(mth);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}, [_c("div", {
|
|
340
|
+
class: ["tiny-calendar__day", {
|
|
341
|
+
selected: _vm.state.activeMonth === mth,
|
|
342
|
+
"this-month": _vm.isThisMonth(mth)
|
|
343
|
+
}]
|
|
344
|
+
}, [_c("div", {
|
|
345
|
+
staticClass: "label"
|
|
346
|
+
}, [_vm._v(_vm._s(_vm.t("ui.datepicker.month" + mth)))]), _c("ul", {
|
|
347
|
+
staticClass: "tiny-calendar__events tiny-min-scrollbar"
|
|
348
|
+
}, _vm._l(_vm.getEventByMonth(mth), function(_ref2, k) {
|
|
349
|
+
var type = _ref2.type, title = _ref2.title, content = _ref2.content, _ref2$parseTime = _ref2.parseTime, year = _ref2$parseTime.year, month = _ref2$parseTime.month, day = _ref2$parseTime.day, hours = _ref2$parseTime.hours, minutes = _ref2$parseTime.minutes;
|
|
350
|
+
return _c("li", {
|
|
351
|
+
key: k
|
|
352
|
+
}, [_vm._t("month", function() {
|
|
353
|
+
return [_c("tooltip", {
|
|
354
|
+
staticClass: "tiny-calendar__tip",
|
|
355
|
+
attrs: {
|
|
356
|
+
"type": type,
|
|
357
|
+
"placement": "right",
|
|
358
|
+
"popper-class": "tiny-calendar__tip",
|
|
359
|
+
"mode": "hover"
|
|
360
|
+
},
|
|
361
|
+
scopedSlots: _vm._u([{
|
|
362
|
+
key: "content",
|
|
363
|
+
fn: function fn() {
|
|
364
|
+
return [_c("div", [_c("div", {
|
|
365
|
+
staticClass: "tiny-calendar__tip-header"
|
|
366
|
+
}, [_c("div", {
|
|
367
|
+
staticClass: "tiny-calendar__tip-year"
|
|
368
|
+
}, [_vm._v(" " + _vm._s(year + "-" + month + "-" + day) + " ")]), _c("div", {
|
|
369
|
+
staticClass: "tiny-calendar__tip-hours"
|
|
370
|
+
}, [_vm._v(" " + _vm._s(hours + ":" + minutes) + " ")])]), _c("div", {
|
|
371
|
+
class: ["tiny-calendar__tip-title", type || "info"]
|
|
372
|
+
}, [_vm._v(" " + _vm._s(title) + " ")]), _c("div", {
|
|
373
|
+
staticClass: "tiny-calendar__tip-content"
|
|
374
|
+
}, [_vm._v(" " + _vm._s(content) + " ")])])];
|
|
375
|
+
},
|
|
376
|
+
proxy: true
|
|
377
|
+
}], null, true)
|
|
378
|
+
}, [_c("div", {
|
|
379
|
+
class: ["event", type || "info"]
|
|
380
|
+
}, [_vm._v(_vm._s(title))])])];
|
|
381
|
+
}, {
|
|
382
|
+
"slotScope": {
|
|
383
|
+
type,
|
|
384
|
+
title,
|
|
385
|
+
content,
|
|
386
|
+
year,
|
|
387
|
+
month,
|
|
388
|
+
day,
|
|
389
|
+
hours,
|
|
390
|
+
minutes
|
|
391
|
+
}
|
|
392
|
+
})], 2);
|
|
393
|
+
}), 0)])]);
|
|
394
|
+
}), 0);
|
|
395
|
+
}), 0)])]);
|
|
396
|
+
};
|
|
397
|
+
var staticRenderFns = [];
|
|
398
|
+
var __cssModules = {};
|
|
399
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
400
|
+
function __vue2_injectStyles(context) {
|
|
401
|
+
for (var o in __cssModules) {
|
|
402
|
+
this[o] = __cssModules[o];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
var pc = /* @__PURE__ */ function() {
|
|
406
|
+
return __component__.exports;
|
|
407
|
+
}();
|
|
408
|
+
|
|
409
|
+
export { pc as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-calendar",
|
|
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-popover": "~2.21.0",
|
|
15
|
+
"@opentinyvue/vue-theme": "~3.21.0",
|
|
16
|
+
"@opentinyvue/vue-button": "~2.21.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"types": "index.d.ts",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "pnpm -w build:ui $npm_package_name",
|
|
22
|
+
"//postversion": "pnpm build"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/index.d.ts
ADDED
package/src/pc.vue.d.ts
ADDED