@opentinyvue/vue-calendar 2.21.0 → 3.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/lib/index.js CHANGED
@@ -67,7 +67,7 @@ var Calendar = defineComponent({
67
67
  });
68
68
  }
69
69
  });
70
- var version = "2.21.0";
70
+ var version = "3.21.0";
71
71
  Calendar.install = function(Vue) {
72
72
  Vue.component(Calendar.name, Calendar);
73
73
  };
package/lib/pc.js CHANGED
@@ -4,38 +4,42 @@ import Tooltip from '@opentinyvue/vue-tooltip';
4
4
  import Popover from '@opentinyvue/vue-popover';
5
5
  import Button from '@opentinyvue/vue-button';
6
6
  import { iconChevronUp, iconChevronDown } from '@opentinyvue/vue-icon';
7
+ import { resolveComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, renderSlot, createVNode, withCtx, createBlock, resolveDynamicComponent, Fragment, renderList, normalizeClass, withDirectives, vShow, createTextVNode } from 'vue';
7
8
 
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;
9
+ function _createForOfIteratorHelperLoose(r, e) {
10
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
11
+ if (t) return (t = t.call(r)).next.bind(t);
12
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
13
+ t && (r = t);
14
+ var o = 0;
15
+ return function() {
16
+ return o >= r.length ? { done: true } : { done: false, value: r[o++] };
17
+ };
14
18
  }
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
- }
19
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20
+ }
21
+ function _unsupportedIterableToArray(r, a) {
22
+ if (r) {
23
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
24
+ var t = {}.toString.call(r).slice(8, -1);
25
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
31
26
  }
32
- return {
33
- exports: scriptExports,
34
- options
35
- };
36
27
  }
28
+ function _arrayLikeToArray(r, a) {
29
+ (null == a || a > r.length) && (a = r.length);
30
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
31
+ return n;
32
+ }
33
+ var _export_sfc = function _export_sfc2(sfc, props) {
34
+ var target = sfc.__vccOpts || sfc;
35
+ for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
36
+ var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
37
+ target[key] = val;
38
+ }
39
+ return target;
40
+ };
37
41
 
38
- var __vue2_script = defineComponent({
42
+ var _sfc_main = defineComponent({
39
43
  components: {
40
44
  Tooltip,
41
45
  Popover,
@@ -53,357 +57,537 @@ var __vue2_script = defineComponent({
53
57
  });
54
58
  }
55
59
  });
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", {
60
+ var _hoisted_1 = {
61
+ class: "tiny-calendar"
62
+ };
63
+ var _hoisted_2 = {
64
+ class: "tiny-calendar__header"
65
+ };
66
+ var _hoisted_3 = {
67
+ key: 0,
68
+ class: "tiny-calendar__selected"
69
+ };
70
+ var _hoisted_4 = {
71
+ class: "tiny-calendar__tool"
72
+ };
73
+ var _hoisted_5 = {
74
+ class: "tiny-calendar__input"
75
+ };
76
+ var _hoisted_6 = ["value"];
77
+ var _hoisted_7 = {
78
+ class: "tiny-calendar__input-btn"
79
+ };
80
+ var _hoisted_8 = {
81
+ class: "tiny-calendar__selector"
82
+ };
83
+ var _hoisted_9 = {
84
+ class: "tiny-calendar__poplist"
85
+ };
86
+ var _hoisted_10 = ["onClick", "title"];
87
+ var _hoisted_11 = {
88
+ class: "tiny-calendar__input"
89
+ };
90
+ var _hoisted_12 = ["value"];
91
+ var _hoisted_13 = {
92
+ class: "tiny-calendar__input-btn"
93
+ };
94
+ var _hoisted_14 = {
95
+ class: "tiny-calendar__selector"
96
+ };
97
+ var _hoisted_15 = {
98
+ class: "tiny-calendar__poplist"
99
+ };
100
+ var _hoisted_16 = ["onClick", "title"];
101
+ var _hoisted_17 = {
102
+ class: "tiny-calendar__tabs"
103
+ };
104
+ var _hoisted_18 = {
105
+ style: {
106
+ "table-layout": "fixed"
107
+ }
108
+ };
109
+ var _hoisted_19 = ["onClick"];
110
+ var _hoisted_20 = {
111
+ class: "label"
112
+ };
113
+ var _hoisted_21 = {
114
+ key: 0,
115
+ class: "tiny-calendar__events tiny-min-scrollbar"
116
+ };
117
+ var _hoisted_22 = {
118
+ class: "tiny-calendar__tip-header"
119
+ };
120
+ var _hoisted_23 = {
121
+ class: "tiny-calendar__tip-year"
122
+ };
123
+ var _hoisted_24 = {
124
+ class: "tiny-calendar__tip-hours"
125
+ };
126
+ var _hoisted_25 = {
127
+ class: "tiny-calendar__tip-content"
128
+ };
129
+ var _hoisted_26 = {
130
+ style: {
131
+ "table-layout": "fixed"
132
+ }
133
+ };
134
+ var _hoisted_27 = ["onClick"];
135
+ var _hoisted_28 = {
136
+ class: "label"
137
+ };
138
+ var _hoisted_29 = {
139
+ class: "tiny-calendar__events tiny-min-scrollbar"
140
+ };
141
+ var _hoisted_30 = {
142
+ class: "tiny-calendar__tip-header"
143
+ };
144
+ var _hoisted_31 = {
145
+ class: "tiny-calendar__tip-year"
146
+ };
147
+ var _hoisted_32 = {
148
+ class: "tiny-calendar__tip-hours"
149
+ };
150
+ var _hoisted_33 = {
151
+ class: "tiny-calendar__tip-content"
152
+ };
153
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
154
+ var _component_Popover = resolveComponent("Popover");
155
+ var _component_Button = resolveComponent("Button");
156
+ var _component_tooltip = resolveComponent("tooltip");
157
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [_ctx.showSelected && _ctx.state.selectedTip ? (openBlock(), createElementBlock(
158
+ "div",
159
+ _hoisted_3,
160
+ toDisplayString(_ctx.state.selectedTip),
161
+ 1
162
+ /* TEXT */
163
+ )) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "tool", {
164
+ slotScope: _ctx.state
165
+ }, function() {
166
+ return [createElementVNode("ul", _hoisted_4, [createElementVNode("li", null, [createVNode(_component_Popover, {
167
+ modelValue: _ctx.state.showYear,
168
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) {
169
+ return _ctx.state.showYear = $event;
170
+ }),
171
+ placement: "bottom-start",
172
+ trigger: "click",
173
+ transition: "tiny-transition-zoom-in-top",
174
+ "popper-class": "tiny-calendar is-popover",
175
+ "visible-arrow": false
176
+ }, {
177
+ reference: withCtx(function() {
178
+ return [createElementVNode("div", _hoisted_5, [createElementVNode("input", {
179
+ value: _ctx.state.activeYear + _ctx.t("ui.datepicker.year"),
180
+ type: "text",
181
+ readonly: ""
182
+ }, null, 8, _hoisted_6), createElementVNode("div", _hoisted_7, [(openBlock(), createBlock(resolveDynamicComponent(_ctx.state.showYear ? "icon-chevron-up" : "icon-chevron-down"), {
183
+ class: "tiny-svg-size"
184
+ }))])])];
185
+ }),
186
+ default: withCtx(function() {
187
+ return [createElementVNode("div", _hoisted_8, [createElementVNode("ul", _hoisted_9, [(openBlock(true), createElementBlock(
188
+ Fragment,
189
+ null,
190
+ renderList(_ctx.state.dropdownYear, function(year) {
191
+ return openBlock(), createElementBlock("li", {
107
192
  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")
193
+ class: normalizeClass(["tiny-calendar__list-item", {
194
+ "is-selected": _ctx.state.activeYear === year
195
+ }]),
196
+ onClick: function onClick() {
197
+ _ctx.state.activeYear = year;
198
+ _ctx.state.showYear = false;
113
199
  },
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",
200
+ title: year + _ctx.t("ui.datepicker.year")
201
+ }, toDisplayString(year + _ctx.t("ui.datepicker.year")), 11, _hoisted_10);
202
+ }),
203
+ 128
204
+ /* KEYED_FRAGMENT */
205
+ ))])])];
206
+ }),
207
+ _: 1
208
+ /* STABLE */
209
+ }, 8, ["modelValue"])]), withDirectives(createElementVNode(
210
+ "li",
211
+ null,
212
+ [createVNode(_component_Popover, {
213
+ modelValue: _ctx.state.showMonth,
214
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = function($event) {
215
+ return _ctx.state.showMonth = $event;
216
+ }),
217
+ transition: "tiny-transition-zoom-in-top",
218
+ placement: "bottom-start",
219
+ trigger: "click",
144
220
  "popper-class": "tiny-calendar is-popover",
145
221
  "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
222
  }, {
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"
223
+ reference: withCtx(function() {
224
+ return [createElementVNode("div", _hoisted_11, [createElementVNode("input", {
225
+ value: _ctx.t("ui.datepicker.month" + _ctx.state.activeMonth),
226
+ type: "text",
227
+ readonly: ""
228
+ }, null, 8, _hoisted_12), createElementVNode("div", _hoisted_13, [(openBlock(), createBlock(resolveDynamicComponent(_ctx.state.showYear ? "icon-chevron-up" : "icon-chevron-down"), {
229
+ class: "tiny-svg-size"
230
+ }))])])];
231
+ }),
232
+ default: withCtx(function() {
233
+ return [createElementVNode("div", _hoisted_14, [createElementVNode("ul", _hoisted_15, [(openBlock(), createElementBlock(
234
+ Fragment,
235
+ null,
236
+ renderList(12, function(month) {
237
+ return createElementVNode("li", {
238
+ key: month,
239
+ class: normalizeClass(["tiny-calendar__list-item", {
240
+ "is-selected": _ctx.state.activeMonth === month
241
+ }]),
242
+ onClick: function onClick() {
243
+ _ctx.state.activeMonth = month;
244
+ _ctx.state.showMonth = false;
245
+ },
246
+ title: _ctx.t("ui.datepicker.month" + month)
247
+ }, toDisplayString(_ctx.t("ui.datepicker.month" + month)), 11, _hoisted_16);
248
+ }),
249
+ 64
250
+ /* STABLE_FRAGMENT */
251
+ ))])])];
252
+ }),
253
+ _: 1
254
+ /* STABLE */
255
+ }, 8, ["modelValue"])],
256
+ 512
257
+ /* NEED_PATCH */
258
+ ), [[vShow, _ctx.state.displayMode === "month"]]), createElementVNode("li", null, [createVNode(_component_Button, {
259
+ type: "primary",
260
+ onClick: _ctx.toToday
261
+ }, {
262
+ default: withCtx(function() {
263
+ return [createTextVNode(
264
+ toDisplayString(_ctx.state.displayMode === "month" ? _ctx.t("ui.datepicker.today") : _ctx.t("ui.datepicker.currentMonth")),
265
+ 1
266
+ /* TEXT */
267
+ )];
268
+ }),
269
+ _: 1
270
+ /* STABLE */
271
+ }, 8, ["onClick"])]), createElementVNode("li", null, [createElementVNode("ul", _hoisted_17, [createElementVNode(
272
+ "li",
273
+ {
274
+ class: normalizeClass({
275
+ active: _ctx.state.displayMode === "month"
276
+ }),
277
+ onClick: _cache[2] || (_cache[2] = function($event) {
278
+ return _ctx.toggeModel("month");
279
+ })
205
280
  },
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"
281
+ toDisplayString(_ctx.t("ui.datepicker.month")),
282
+ 3
283
+ /* TEXT, CLASS */
284
+ ), createElementVNode(
285
+ "li",
286
+ {
287
+ class: normalizeClass({
288
+ active: _ctx.state.displayMode === "year"
289
+ }),
290
+ onClick: _cache[3] || (_cache[3] = function($event) {
291
+ return _ctx.toggeModel("year");
292
+ })
214
293
  },
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
- }
294
+ toDisplayString(_ctx.t("ui.calendar.showType.year")),
295
+ 3
296
+ /* TEXT, CLASS */
297
+ )])])])];
298
+ })]), createElementVNode(
299
+ "div",
300
+ {
301
+ class: normalizeClass(["tiny-calendar__main", _ctx.state.displayMode])
302
+ },
303
+ [withDirectives(createElementVNode(
304
+ "table",
305
+ _hoisted_18,
306
+ [createElementVNode("tr", null, [createElementVNode(
307
+ "th",
308
+ null,
309
+ toDisplayString(_ctx.t("ui.datepicker.weeks.sun")),
310
+ 1
311
+ /* TEXT */
312
+ ), createElementVNode(
313
+ "th",
314
+ null,
315
+ toDisplayString(_ctx.t("ui.datepicker.weeks.mon")),
316
+ 1
317
+ /* TEXT */
318
+ ), createElementVNode(
319
+ "th",
320
+ null,
321
+ toDisplayString(_ctx.t("ui.datepicker.weeks.tue")),
322
+ 1
323
+ /* TEXT */
324
+ ), createElementVNode(
325
+ "th",
326
+ null,
327
+ toDisplayString(_ctx.t("ui.datepicker.weeks.wed")),
328
+ 1
329
+ /* TEXT */
330
+ ), createElementVNode(
331
+ "th",
332
+ null,
333
+ toDisplayString(_ctx.t("ui.datepicker.weeks.thu")),
334
+ 1
335
+ /* TEXT */
336
+ ), createElementVNode(
337
+ "th",
338
+ null,
339
+ toDisplayString(_ctx.t("ui.datepicker.weeks.fri")),
340
+ 1
341
+ /* TEXT */
342
+ ), createElementVNode(
343
+ "th",
344
+ null,
345
+ toDisplayString(_ctx.t("ui.datepicker.weeks.sat")),
346
+ 1
347
+ /* TEXT */
348
+ )]), (openBlock(true), createElementBlock(
349
+ Fragment,
350
+ null,
351
+ renderList(_ctx.state.calendar, function(item, index) {
352
+ return openBlock(), createElementBlock("tr", {
353
+ key: index
354
+ }, [(openBlock(true), createElementBlock(
355
+ Fragment,
356
+ null,
357
+ renderList(item, function(day, i) {
358
+ return openBlock(), createElementBlock("td", {
359
+ key: i,
360
+ onClick: function onClick($event) {
361
+ return _ctx.selectDay(day);
362
+ },
363
+ width: "14.2857%"
364
+ }, [createElementVNode(
365
+ "div",
366
+ {
367
+ class: normalizeClass(["tiny-calendar__day", {
368
+ selected: !(day.isLast || day.isNext) && _ctx.state.selectedDate === _ctx.getTime(day.value),
369
+ disable: day.isLast || day.isNext,
370
+ today: _ctx.isToday(day)
371
+ }])
372
+ },
373
+ [createElementVNode(
374
+ "div",
375
+ _hoisted_20,
376
+ toDisplayString(day.value),
377
+ 1
378
+ /* TEXT */
379
+ ), !(day.isLast || day.isNext) ? (openBlock(), createElementBlock("ul", _hoisted_21, [(openBlock(true), createElementBlock(
380
+ Fragment,
381
+ null,
382
+ renderList(_ctx.getEventByDay(day.value), function(_ref, j) {
383
+ 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;
384
+ return openBlock(), createElementBlock("li", {
385
+ key: j
386
+ }, [renderSlot(_ctx.$slots, "day", {
387
+ slotScope: {
388
+ type,
389
+ title,
390
+ content,
391
+ year,
392
+ month,
393
+ day: day2,
394
+ hours,
395
+ minutes
396
+ }
397
+ }, function() {
398
+ return [createVNode(_component_tooltip, {
399
+ type,
400
+ placement: "right",
401
+ class: "tiny-calendar__tip",
402
+ "popper-class": "tiny-calendar__tip",
403
+ mode: "hover"
404
+ }, {
405
+ content: withCtx(function() {
406
+ return [createElementVNode("div", null, [createElementVNode("div", _hoisted_22, [createElementVNode(
407
+ "div",
408
+ _hoisted_23,
409
+ toDisplayString(year + "-" + month + "-" + day2),
410
+ 1
411
+ /* TEXT */
412
+ ), createElementVNode(
413
+ "div",
414
+ _hoisted_24,
415
+ toDisplayString(hours + ":" + minutes),
416
+ 1
417
+ /* TEXT */
418
+ )]), createElementVNode(
419
+ "div",
420
+ {
421
+ class: normalizeClass(["tiny-calendar__tip-title", type || "info"])
422
+ },
423
+ toDisplayString(title),
424
+ 3
425
+ /* TEXT, CLASS */
426
+ ), createElementVNode(
427
+ "div",
428
+ _hoisted_25,
429
+ toDisplayString(content),
430
+ 1
431
+ /* TEXT */
432
+ )])];
433
+ }),
434
+ default: withCtx(function() {
435
+ return [createElementVNode(
436
+ "div",
437
+ {
438
+ class: normalizeClass(["event", type || "info"])
439
+ },
440
+ toDisplayString(title),
441
+ 3
442
+ /* TEXT, CLASS */
443
+ )];
444
+ }),
445
+ _: 2
446
+ /* DYNAMIC */
447
+ }, 1032, ["type"])];
448
+ })]);
449
+ }),
450
+ 128
451
+ /* KEYED_FRAGMENT */
452
+ ))])) : createCommentVNode("v-if", true)],
453
+ 2
454
+ /* CLASS */
455
+ )], 8, _hoisted_19);
456
+ }),
457
+ 128
458
+ /* KEYED_FRAGMENT */
459
+ ))]);
460
+ }),
461
+ 128
462
+ /* KEYED_FRAGMENT */
463
+ ))],
464
+ 512
465
+ /* NEED_PATCH */
466
+ ), [[vShow, _ctx.state.displayMode === "month"]]), withDirectives(createElementVNode(
467
+ "table",
468
+ _hoisted_26,
469
+ [(openBlock(true), createElementBlock(
470
+ Fragment,
471
+ null,
472
+ renderList(_ctx.genMonths(), function(item, i) {
473
+ return openBlock(), createElementBlock("tr", {
474
+ key: i
475
+ }, [(openBlock(true), createElementBlock(
476
+ Fragment,
477
+ null,
478
+ renderList(item, function(mth, j) {
479
+ return openBlock(), createElementBlock("td", {
480
+ key: j,
481
+ onClick: function onClick($event) {
482
+ return _ctx.selectMonth(mth);
483
+ },
484
+ width: "25%"
485
+ }, [createElementVNode(
486
+ "div",
487
+ {
488
+ class: normalizeClass(["tiny-calendar__day", {
489
+ selected: _ctx.state.activeMonth === mth,
490
+ "this-month": _ctx.isThisMonth(mth)
491
+ }])
492
+ },
493
+ [createElementVNode(
494
+ "div",
495
+ _hoisted_28,
496
+ toDisplayString(_ctx.t("ui.datepicker.month" + mth)),
497
+ 1
498
+ /* TEXT */
499
+ ), createElementVNode("ul", _hoisted_29, [(openBlock(true), createElementBlock(
500
+ Fragment,
501
+ null,
502
+ renderList(_ctx.getEventByMonth(mth), function(_ref2, k) {
503
+ 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;
504
+ return openBlock(), createElementBlock("li", {
505
+ key: k
506
+ }, [renderSlot(_ctx.$slots, "month", {
507
+ slotScope: {
508
+ type,
509
+ title,
510
+ content,
511
+ year,
512
+ month,
513
+ day,
514
+ hours,
515
+ minutes
516
+ }
517
+ }, function() {
518
+ return [createVNode(_component_tooltip, {
519
+ type,
520
+ class: "tiny-calendar__tip",
521
+ placement: "right",
522
+ "popper-class": "tiny-calendar__tip",
523
+ mode: "hover"
524
+ }, {
525
+ content: withCtx(function() {
526
+ return [createElementVNode("div", null, [createElementVNode("div", _hoisted_30, [createElementVNode(
527
+ "div",
528
+ _hoisted_31,
529
+ toDisplayString(year + "-" + month + "-" + day),
530
+ 1
531
+ /* TEXT */
532
+ ), createElementVNode(
533
+ "div",
534
+ _hoisted_32,
535
+ toDisplayString(hours + ":" + minutes),
536
+ 1
537
+ /* TEXT */
538
+ )]), createElementVNode(
539
+ "div",
540
+ {
541
+ class: normalizeClass(["tiny-calendar__tip-title", type || "info"])
542
+ },
543
+ toDisplayString(title),
544
+ 3
545
+ /* TEXT, CLASS */
546
+ ), createElementVNode(
547
+ "div",
548
+ _hoisted_33,
549
+ toDisplayString(content),
550
+ 1
551
+ /* TEXT */
552
+ )])];
553
+ }),
554
+ default: withCtx(function() {
555
+ return [createElementVNode(
556
+ "div",
557
+ {
558
+ class: normalizeClass(["event", type || "info"])
559
+ },
560
+ toDisplayString(title),
561
+ 3
562
+ /* TEXT, CLASS */
563
+ )];
564
+ }),
565
+ _: 2
566
+ /* DYNAMIC */
567
+ }, 1032, ["type"])];
568
+ })]);
569
+ }),
570
+ 128
571
+ /* KEYED_FRAGMENT */
572
+ ))])],
573
+ 2
574
+ /* CLASS */
575
+ )], 8, _hoisted_27);
576
+ }),
577
+ 128
578
+ /* KEYED_FRAGMENT */
579
+ ))]);
580
+ }),
581
+ 128
582
+ /* KEYED_FRAGMENT */
583
+ ))],
584
+ 512
585
+ /* NEED_PATCH */
586
+ ), [[vShow, _ctx.state.displayMode === "year"]])],
587
+ 2
588
+ /* CLASS */
589
+ )]);
404
590
  }
405
- var pc = /* @__PURE__ */ function() {
406
- return __component__.exports;
407
- }();
591
+ var pc = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
408
592
 
409
593
  export { pc as default };
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@opentinyvue/vue-calendar",
3
- "version": "2.21.0",
3
+ "version": "3.21.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
7
7
  "sideEffects": false,
8
8
  "type": "module",
9
9
  "dependencies": {
10
- "@opentinyvue/vue-common": "~2.21.0",
11
- "@opentinyvue/vue-icon": "~2.21.0",
10
+ "@opentinyvue/vue-common": "~3.21.0",
11
+ "@opentinyvue/vue-icon": "~3.21.0",
12
12
  "@opentinyvue/vue-renderless": "~3.21.0",
13
- "@opentinyvue/vue-tooltip": "~2.21.0",
14
- "@opentinyvue/vue-popover": "~2.21.0",
13
+ "@opentinyvue/vue-tooltip": "~3.21.0",
14
+ "@opentinyvue/vue-popover": "~3.21.0",
15
15
  "@opentinyvue/vue-theme": "~3.21.0",
16
- "@opentinyvue/vue-button": "~2.21.0"
16
+ "@opentinyvue/vue-button": "~3.21.0"
17
17
  },
18
18
  "license": "MIT",
19
19
  "types": "index.d.ts",
package/src/index.d.ts CHANGED
@@ -1,2 +1,92 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<{
2
+ /**
3
+ * @property {String} [mode='month'] - 显示模式,month|year 可选
4
+ */
5
+ mode: {
6
+ type: StringConstructor;
7
+ default: string;
8
+ validator: (value: string) => boolean;
9
+ };
10
+ /**
11
+ * @property {Number} [year=getFullYear()] - 指定年份,默认今年
12
+ */
13
+ year: {
14
+ type: NumberConstructor;
15
+ default(): number;
16
+ };
17
+ /**
18
+ * @property {Number} [month=getMonth()] - 指定月份,默认当月
19
+ */
20
+ month: {
21
+ type: NumberConstructor;
22
+ default(): number;
23
+ };
24
+ /**
25
+ * @property {Array} events - 事件列表
26
+ * @example
27
+ * [{ time: 1534297845236, title: '消息', content: '这是一条消息', type: 'primary' },
28
+ * { time: 1534297845236, title: '消息', content: '还有', type: 'info' }]
29
+ * type 类型: warning、error、info、success
30
+ */
31
+ events: ArrayConstructor;
32
+ /**
33
+ * @property {Boolean} [showSelected=false] - 显示选中的日期
34
+ */
35
+ showSelected: BooleanConstructor;
36
+ tiny_mode: StringConstructor;
37
+ tiny_mode_root: BooleanConstructor;
38
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
39
+ tiny_renderless: FunctionConstructor;
40
+ tiny_theme: StringConstructor;
41
+ tiny_chart_theme: ObjectConstructor;
42
+ }, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
43
+ [key: string]: any;
44
+ }>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
45
+ /**
46
+ * @property {String} [mode='month'] - 显示模式,month|year 可选
47
+ */
48
+ mode: {
49
+ type: StringConstructor;
50
+ default: string;
51
+ validator: (value: string) => boolean;
52
+ };
53
+ /**
54
+ * @property {Number} [year=getFullYear()] - 指定年份,默认今年
55
+ */
56
+ year: {
57
+ type: NumberConstructor;
58
+ default(): number;
59
+ };
60
+ /**
61
+ * @property {Number} [month=getMonth()] - 指定月份,默认当月
62
+ */
63
+ month: {
64
+ type: NumberConstructor;
65
+ default(): number;
66
+ };
67
+ /**
68
+ * @property {Array} events - 事件列表
69
+ * @example
70
+ * [{ time: 1534297845236, title: '消息', content: '这是一条消息', type: 'primary' },
71
+ * { time: 1534297845236, title: '消息', content: '还有', type: 'info' }]
72
+ * type 类型: warning、error、info、success
73
+ */
74
+ events: ArrayConstructor;
75
+ /**
76
+ * @property {Boolean} [showSelected=false] - 显示选中的日期
77
+ */
78
+ showSelected: BooleanConstructor;
79
+ tiny_mode: StringConstructor;
80
+ tiny_mode_root: BooleanConstructor;
81
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
82
+ tiny_renderless: FunctionConstructor;
83
+ tiny_theme: StringConstructor;
84
+ tiny_chart_theme: ObjectConstructor;
85
+ }>>, {
86
+ mode: string;
87
+ year: number;
88
+ month: number;
89
+ tiny_mode_root: boolean;
90
+ showSelected: boolean;
91
+ }, {}>;
2
92
  export default _default;
package/src/pc.vue.d.ts CHANGED
@@ -1,2 +1,50 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
2
+ mode?: any;
3
+ year?: any;
4
+ month?: any;
5
+ tiny_mode?: any;
6
+ tiny_mode_root?: any;
7
+ tiny_template?: any;
8
+ tiny_renderless?: any;
9
+ _constants?: any;
10
+ tiny_theme?: any;
11
+ tiny_chart_theme?: any;
12
+ events?: any;
13
+ showSelected?: any;
14
+ }>, {
15
+ t: (this: any, path: any, options?: any) => any;
16
+ vm: any;
17
+ f: (props: any, attrs?: {}) => {};
18
+ a: (attrs: any, filters: any, include: any) => {};
19
+ d: (props: any) => void;
20
+ dp: (props: any) => void;
21
+ gcls: (key: any) => any;
22
+ m: (...cssClasses: any[]) => string;
23
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
24
+ mode?: any;
25
+ year?: any;
26
+ month?: any;
27
+ tiny_mode?: any;
28
+ tiny_mode_root?: any;
29
+ tiny_template?: any;
30
+ tiny_renderless?: any;
31
+ _constants?: any;
32
+ tiny_theme?: any;
33
+ tiny_chart_theme?: any;
34
+ events?: any;
35
+ showSelected?: any;
36
+ }>>>, {
37
+ readonly mode?: any;
38
+ readonly year?: any;
39
+ readonly month?: any;
40
+ readonly tiny_mode?: any;
41
+ readonly tiny_mode_root?: any;
42
+ readonly tiny_template?: any;
43
+ readonly tiny_renderless?: any;
44
+ readonly _constants?: any;
45
+ readonly tiny_theme?: any;
46
+ readonly tiny_chart_theme?: any;
47
+ readonly events?: any;
48
+ readonly showSelected?: any;
49
+ }, {}>;
2
50
  export default _default;