@opentinyvue/vue-date-panel 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 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 DatePanel from './src/index';
13
+ export default DatePanel;
package/lib/index.js ADDED
@@ -0,0 +1,64 @@
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 MobileFirstTemplate from "./mobile-first.js";
13
+ import "@opentinyvue/vue-theme/date-panel/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 DatePanel = defineComponent({
26
+ name: $prefix + "DatePanel",
27
+ componentName: "DatePanel",
28
+ props: _extends({}, $props, {
29
+ emitter: Object,
30
+ step: {
31
+ type: Object,
32
+ default: function _default() {
33
+ return {
34
+ hour: 1,
35
+ minute: 1,
36
+ second: 1
37
+ };
38
+ }
39
+ },
40
+ showWeekNumber: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ formatWeeks: Function,
45
+ nowClick: {
46
+ type: Function
47
+ }
48
+ }),
49
+ setup: function setup(props, context) {
50
+ return $setup({
51
+ props,
52
+ context,
53
+ template
54
+ });
55
+ }
56
+ });
57
+ var version = "2.21.0";
58
+ DatePanel.install = function(Vue) {
59
+ Vue.component(DatePanel.name, DatePanel);
60
+ };
61
+ DatePanel.version = version;
62
+ export {
63
+ DatePanel as default
64
+ };
@@ -0,0 +1,509 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/date-panel/vue';
2
+ import { directive, setup, props } from '@opentinyvue/vue-common';
3
+ import { language } from '@opentinyvue/vue-locale';
4
+ import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
5
+ import Time from '@opentinyvue/vue-time';
6
+ import DateTable from '@opentinyvue/vue-date-table';
7
+ import YearTable from '@opentinyvue/vue-year-table';
8
+ import MonthTable from '@opentinyvue/vue-month-table';
9
+ import Input from '@opentinyvue/vue-input';
10
+ import Button from '@opentinyvue/vue-button';
11
+ import { IconDoubleRight, IconDoubleLeft, IconChevronLeft, IconChevronRight, IconChevronDown, IconChevronUp } from '@opentinyvue/vue-icon';
12
+ import Popup from '@opentinyvue/vue-popup';
13
+
14
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
15
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
16
+ if (render) {
17
+ options.render = render;
18
+ options.staticRenderFns = staticRenderFns;
19
+ options._compiled = true;
20
+ }
21
+ var hook;
22
+ if (injectStyles) {
23
+ hook = injectStyles;
24
+ }
25
+ if (hook) {
26
+ if (options.functional) {
27
+ options._injectStyles = hook;
28
+ var originalRender = options.render;
29
+ options.render = function renderWithStyleInjection(h, context) {
30
+ hook.call(context);
31
+ return originalRender(h, context);
32
+ };
33
+ } else {
34
+ var existing = options.beforeCreate;
35
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
36
+ }
37
+ }
38
+ return {
39
+ exports: scriptExports,
40
+ options
41
+ };
42
+ }
43
+
44
+ function _extends() {
45
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
46
+ for (var e = 1; e < arguments.length; e++) {
47
+ var t = arguments[e];
48
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
49
+ }
50
+ return n;
51
+ }, _extends.apply(null, arguments);
52
+ }
53
+ var classes = {
54
+ "picker-panel": "w-96 text-color-text-primary text-xs shadow-md bg-color-bg-1 rounded leading-4 my-0.5 mx-0",
55
+ "picker-panel-body": "after:content-[''] after:table after:clear-both",
56
+ "content": "relative py-0 px-4",
57
+ "header": "p-4 h-12 text-center",
58
+ "bordered": "mb-0 pb-3",
59
+ "disabled": "text-color-text-disabled",
60
+ "icon-btn": "text-sm leading-4 fill-color-text-primary border-0 cursor-pointer outline-0 hover:fill-color-brand",
61
+ "header-label": "text-xs font-medium py-0 px-1 text-center text-color-text-primary align-middle",
62
+ "body-content": "float-left w-1/2 box-border m-0 pt-4 pr-4 pb-1.5 pl-4",
63
+ "today": "border border-solid border-color-border-focus",
64
+ "footer": "border-t border-t-color-bg-3 py-3 px-4 bg-color-bg-1 overflow-hidden rounded-b",
65
+ "link-btn": "align-middle rounded",
66
+ "time-header": "relative text-xs h-10 leading-10 table w-full box-border border-b border-b-color-bg-3",
67
+ "editor-wrap": "relative table-cell px-1",
68
+ "sidebar": "absolute top-0 bottom-0 w-28 border-r border-r-color-bg-3 box-border pt-5 bg-color-bg-1 overflow-auto",
69
+ "sidebar-btn": "block w-24 my-0 mx-auto rounded border-0 bg-transparent leading-8 text-xs text-color-text-primary pl-4 text-left outline-0 cursor-pointer truncate hover:bg-color-bg-2"
70
+ };
71
+ var render = function render2() {
72
+ var _vm = this;
73
+ var _h = _vm.$createElement;
74
+ var _c = _vm._self._c || _h;
75
+ return _c("transition", {
76
+ on: {
77
+ "after-enter": _vm.handleEnter,
78
+ "after-leave": _vm.handleLeave
79
+ }
80
+ }, [_c("div", {
81
+ directives: [{
82
+ name: "show",
83
+ rawName: "v-show",
84
+ value: _vm.state.visible,
85
+ expression: "state.visible"
86
+ }],
87
+ class: _vm.m([_vm.gcls("picker-panel"), {
88
+ "w-80": _vm.state.currentView === "year"
89
+ }, _vm.state.popperClass]),
90
+ attrs: {
91
+ "data-tag": "tiny-picker-panel tiny-date-picker tiny-popper"
92
+ }
93
+ }, [_c("div", {
94
+ class: _vm.gcls("picker-panel-body"),
95
+ attrs: {
96
+ "data-tag": "tiny-picker-panel__body-wrapper"
97
+ }
98
+ }, [_vm._t("sidebar", null, {
99
+ "dataTag": "tiny-picker-panel__sidebar"
100
+ }), _vm.state.shortcuts ? _c("div", {
101
+ class: _vm.gcls("sidebar"),
102
+ attrs: {
103
+ "data-tag": "tiny-picker-panel__sidebar"
104
+ }
105
+ }, _vm._l(_vm.state.shortcuts, function(shortcut, key) {
106
+ return _c("button", {
107
+ key,
108
+ class: _vm.gcls("sidebar-btn"),
109
+ attrs: {
110
+ "type": "button",
111
+ "data-tag": "tiny-picker-panel__shortcut"
112
+ },
113
+ on: {
114
+ "click": function click($event) {
115
+ return _vm.handleShortcutClick(shortcut);
116
+ }
117
+ }
118
+ }, [_vm._v(" " + _vm._s(shortcut.text) + " ")]);
119
+ }), 0) : _vm._e(), _c("div", {
120
+ class: [_vm.gcls("picker-panel-body"), {
121
+ "ml-28": _vm.slots.sidebar || _vm.state.shortcuts
122
+ }],
123
+ attrs: {
124
+ "data-tag": "tiny-picker-panel__body"
125
+ }
126
+ }, [_vm.state.showTime ? _c("div", {
127
+ class: _vm.gcls("time-header"),
128
+ attrs: {
129
+ "data-tag": "tiny-date-picker__time-header"
130
+ }
131
+ }, [_c("span", {
132
+ class: _vm.gcls("editor-wrap"),
133
+ attrs: {
134
+ "data-tag": "tiny-date-picker__editor-wrap"
135
+ }
136
+ }, [_c("tiny-input", {
137
+ attrs: {
138
+ "placeholder": _vm.t("ui.datepicker.selectDate"),
139
+ "modelValue": _vm.state.visibleDate,
140
+ "size": "small"
141
+ },
142
+ on: {
143
+ "update:modelValue": function updateModelValue(val) {
144
+ return _vm.state.userInputDate = val;
145
+ },
146
+ "change": _vm.handleVisibleDateChange
147
+ }
148
+ })], 1), _c("span", {
149
+ directives: [{
150
+ name: "clickoutside",
151
+ rawName: "v-clickoutside",
152
+ value: _vm.handleTimePickClose,
153
+ expression: "handleTimePickClose"
154
+ }],
155
+ class: _vm.gcls("editor-wrap"),
156
+ attrs: {
157
+ "data-tag": "tiny-date-picker__editor-wrap"
158
+ }
159
+ }, [_c("tiny-input", {
160
+ ref: "input",
161
+ attrs: {
162
+ "placeholder": _vm.t("ui.datepicker.selectTime"),
163
+ "modelValue": _vm.state.visibleTime,
164
+ "size": "small"
165
+ },
166
+ on: {
167
+ "focus": function focus($event) {
168
+ _vm.state.timePickerVisible = true;
169
+ },
170
+ "update:modelValue": function updateModelValue(val) {
171
+ return _vm.state.userInputTime = val;
172
+ },
173
+ "change": _vm.handleVisibleTimeChange
174
+ }
175
+ }), _c("time-picker", {
176
+ ref: "timepicker",
177
+ attrs: {
178
+ "step": _vm.step,
179
+ "time-arrow-control": _vm.state.arrowControl,
180
+ "show": _vm.state.timePickerVisible,
181
+ "value": _vm.state.date
182
+ },
183
+ on: {
184
+ "pick": _vm.handleTimePick
185
+ }
186
+ })], 1)]) : _vm._e(), _c("div", {
187
+ directives: [{
188
+ name: "show",
189
+ rawName: "v-show",
190
+ value: _vm.state.currentView !== "time",
191
+ expression: "state.currentView !== 'time'"
192
+ }],
193
+ class: [_vm.gcls("header"), ["month", "year", "years", "yearrange"].includes(_vm.state.currentView) && _vm.gcls("bordered")],
194
+ attrs: {
195
+ "data-tag": "tiny-date-picker__header"
196
+ }
197
+ }, [_c("button", {
198
+ class: [_vm.gcls("icon-btn"), "float-left"],
199
+ attrs: {
200
+ "type": "button",
201
+ "aria-label": _vm.t("ui.datepicker.prevYear"),
202
+ "data-tag": "tiny-picker-panel__icon-btn tiny-date-picker__prev-btn tiny-icon-arrow-left"
203
+ },
204
+ on: {
205
+ "click": _vm.cusPrevYear
206
+ }
207
+ }, [_c("icon-double-left")], 1), _c("button", {
208
+ directives: [{
209
+ name: "show",
210
+ rawName: "v-show",
211
+ value: _vm.state.currentView === "date",
212
+ expression: "state.currentView === 'date'"
213
+ }],
214
+ class: [_vm.gcls("icon-btn"), "float-left"],
215
+ attrs: {
216
+ "type": "button",
217
+ "aria-label": _vm.t("ui.datepicker.prevMonth"),
218
+ "data-tag": "tiny-picker-panel__icon-btn tiny-date-picker__prev-btn tiny-icon-arrow-left"
219
+ },
220
+ on: {
221
+ "click": _vm.cusPrevMonth
222
+ }
223
+ }, [_c("icon-chevron-left")], 1), _c("span", {
224
+ class: [_vm.gcls("header-label")],
225
+ attrs: {
226
+ "role": "button",
227
+ "data-tag": "tiny-date-picker__header-label"
228
+ },
229
+ on: {
230
+ "click": _vm.showYearPicker
231
+ }
232
+ }, [_vm._v(_vm._s(_vm.state.yearLabel))]), _c("span", {
233
+ directives: [{
234
+ name: "show",
235
+ rawName: "v-show",
236
+ value: _vm.state.currentView === "date",
237
+ expression: "state.currentView === 'date'"
238
+ }],
239
+ class: [_vm.gcls("header-label"), {
240
+ "text-color-brand": _vm.state.currentView === "month"
241
+ }],
242
+ attrs: {
243
+ "role": "button",
244
+ "data-tag": "tiny-date-picker__header-label"
245
+ },
246
+ on: {
247
+ "click": _vm.showMonthPicker
248
+ }
249
+ }, [_vm._v(_vm._s(_vm.t("ui.datepicker.month" + (_vm.state.month + 1))))]), _c("button", {
250
+ class: [_vm.gcls("icon-btn"), "float-right"],
251
+ attrs: {
252
+ "type": "button",
253
+ "aria-label": _vm.t("ui.datepicker.nextYear"),
254
+ "data-tag": "tiny-picker-panel__icon-btn tiny-date-picker__next-btn tiny-icon-arrow-right"
255
+ },
256
+ on: {
257
+ "click": _vm.cusNextYear
258
+ }
259
+ }, [_c("icon-double-right")], 1), _c("button", {
260
+ directives: [{
261
+ name: "show",
262
+ rawName: "v-show",
263
+ value: _vm.state.currentView === "date",
264
+ expression: "state.currentView === 'date'"
265
+ }],
266
+ class: [_vm.gcls("icon-btn"), "float-right"],
267
+ attrs: {
268
+ "type": "button",
269
+ "aria-label": _vm.t("ui.datepicker.nextMonth"),
270
+ "data-tag": "tiny-picker-panel__icon-btn tiny-date-picker__next-btn tiny-icon-arrow-right"
271
+ },
272
+ on: {
273
+ "click": _vm.cusNextMonth
274
+ }
275
+ }, [_c("icon-chevron-right")], 1)]), _c("div", {
276
+ class: _vm.gcls("content"),
277
+ attrs: {
278
+ "data-tag": "tiny-picker-panel__content"
279
+ }
280
+ }, [_vm.state.currentView === "date" ? _c("date-table", {
281
+ ref: "dateTable",
282
+ attrs: {
283
+ "selection-mode": _vm.state.selectionMode,
284
+ "first-day-of-week": _vm.state.firstDayOfWeek,
285
+ "value": _vm.state.value,
286
+ "default-value": _vm.state.defaultValue ? new Date(_vm.state.defaultValue) : null,
287
+ "date": _vm.state.date,
288
+ "cell-class-name": _vm.state.cellClassName,
289
+ "disabled-date": _vm.state.disabledDate,
290
+ "show-week-number": _vm.showWeekNumber,
291
+ "format-weeks": _vm.formatWeeks
292
+ },
293
+ on: {
294
+ "pick": _vm.handleDatePick
295
+ }
296
+ }) : _vm._e(), ["year", "years", "yearrange"].includes(_vm.state.currentView) ? _c("year-table", {
297
+ ref: "yearTable",
298
+ attrs: {
299
+ "value": _vm.state.value,
300
+ "default-value": _vm.state.defaultValue ? new Date(_vm.state.defaultValue) : null,
301
+ "date": _vm.state.date,
302
+ "disabled-date": _vm.state.disabledDate,
303
+ "selection-mode": _vm.state.selectionMode,
304
+ "start-year": _vm.state.startYear
305
+ },
306
+ on: {
307
+ "pick": _vm.handleYearPick
308
+ }
309
+ }) : _vm._e(), _vm.state.currentView === "month" ? _c("month-table", {
310
+ ref: "monthTable",
311
+ attrs: {
312
+ "value": _vm.state.value,
313
+ "default-value": _vm.state.defaultValue ? new Date(_vm.state.defaultValue) : null,
314
+ "date": _vm.state.date,
315
+ "disabled-date": _vm.state.disabledDate
316
+ },
317
+ on: {
318
+ "pick": _vm.handleMonthPick
319
+ }
320
+ }) : _vm._e()], 1)])], 2), _vm.state.isShowTz || _vm.state.timezone.isServiceTimezone ? _c("div", {
321
+ directives: [{
322
+ name: "clickoutside",
323
+ rawName: "v-clickoutside",
324
+ value: _vm.handleTzPickClose,
325
+ expression: "handleTzPickClose"
326
+ }],
327
+ attrs: {
328
+ "data-tag": "tiny-picker-panel__timezone"
329
+ }
330
+ }, [_c("tiny-input", {
331
+ attrs: {
332
+ "disabled": _vm.state.timezone.isServiceTimezone,
333
+ "placeholder": _vm.t("ui.datepicker.timezone")
334
+ },
335
+ on: {
336
+ "update:modelValue": _vm.searchTz
337
+ },
338
+ scopedSlots: _vm._u([{
339
+ key: "suffix",
340
+ fn: function fn() {
341
+ return [_c(_vm.state.showpopup ? "IconChevronDown" : "IconChevronUp", {
342
+ tag: "component",
343
+ attrs: {
344
+ "fill": "#ccc"
345
+ },
346
+ on: {
347
+ "click": _vm.toggleTz
348
+ }
349
+ })];
350
+ },
351
+ proxy: true
352
+ }], null, false, 3034754380),
353
+ model: {
354
+ value: _vm.state.tz,
355
+ callback: function callback($$v) {
356
+ _vm.$set(_vm.state, "tz", $$v);
357
+ },
358
+ expression: "state.tz"
359
+ }
360
+ }), _c("div", {
361
+ attrs: {
362
+ "data-tag": "tiny-picker-panel__tzlist"
363
+ }
364
+ }, [_c("tiny-popup", {
365
+ attrs: {
366
+ "overlay": false,
367
+ "aui_mode": "mobile",
368
+ "position": "bottom",
369
+ "duration": 0.2,
370
+ "closeable": false
371
+ },
372
+ model: {
373
+ value: _vm.state.showpopup,
374
+ callback: function callback($$v) {
375
+ _vm.$set(_vm.state, "showpopup", $$v);
376
+ },
377
+ expression: "state.showpopup"
378
+ }
379
+ }, [_c("div", {
380
+ attrs: {
381
+ "data-tag": "tzlist"
382
+ }
383
+ }, [_c("ul", _vm._l(_vm.state.renderTzdata, function(tz, index) {
384
+ return _c("li", {
385
+ directives: [{
386
+ name: "show",
387
+ rawName: "v-show",
388
+ value: !tz.visible,
389
+ expression: "!tz.visible"
390
+ }],
391
+ key: index,
392
+ attrs: {
393
+ "data-tag": "tiny-picker-panel__tzlist-li",
394
+ "title": tz.name
395
+ },
396
+ on: {
397
+ "click": function click($event) {
398
+ return _vm.selectTz(tz);
399
+ }
400
+ }
401
+ }, [_vm._v(" " + _vm._s(tz.name) + " ")]);
402
+ }), 0)])])], 1)], 1) : _vm._e(), _c("div", {
403
+ directives: [{
404
+ name: "show",
405
+ rawName: "v-show",
406
+ value: _vm.state.isShowFooter,
407
+ expression: "state.isShowFooter"
408
+ }],
409
+ class: _vm.gcls("footer"),
410
+ attrs: {
411
+ "data-tag": "tiny-picker-panel__footer"
412
+ }
413
+ }, [_vm._t("default", function() {
414
+ return [_c("tiny-button", {
415
+ directives: [{
416
+ name: "show",
417
+ rawName: "v-show",
418
+ value: !["dates", "years"].includes(_vm.state.selectionMode),
419
+ expression: "!['dates', 'years'].includes(state.selectionMode)"
420
+ }],
421
+ class: _vm.gcls("link-btn"),
422
+ attrs: {
423
+ "size": "mini",
424
+ "type": "text",
425
+ "data-tag": "tiny-picker-panel__link-btn"
426
+ },
427
+ on: {
428
+ "click": _vm.changeToNow
429
+ }
430
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.now")) + " ")])];
431
+ }), _c("tiny-button", {
432
+ class: ["float-right", _vm.gcls("link-btn")],
433
+ attrs: {
434
+ "type": "primary",
435
+ "size": "mini",
436
+ "data-tag": "tiny-picker-panel__link-btn"
437
+ },
438
+ on: {
439
+ "click": _vm.confirm
440
+ }
441
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.confirm")) + " ")])], 2)])]);
442
+ };
443
+ var staticRenderFns = [];
444
+ var __vue2_script = {
445
+ directives: directive({
446
+ Clickoutside
447
+ }),
448
+ components: {
449
+ TimePicker: Time,
450
+ YearTable,
451
+ MonthTable,
452
+ DateTable,
453
+ TinyInput: Input,
454
+ TinyButton: Button,
455
+ TinyPopup: Popup,
456
+ IconDoubleRight: IconDoubleRight(),
457
+ IconDoubleLeft: IconDoubleLeft(),
458
+ IconChevronLeft: IconChevronLeft(),
459
+ IconChevronRight: IconChevronRight(),
460
+ IconChevronDown: IconChevronDown(),
461
+ IconChevronUp: IconChevronUp()
462
+ },
463
+ props: _extends({}, props, {
464
+ emitter: Object,
465
+ step: {
466
+ type: Object,
467
+ default: function _default() {
468
+ return {
469
+ hour: 1,
470
+ minute: 1,
471
+ second: 1
472
+ };
473
+ }
474
+ },
475
+ showWeekNumber: {
476
+ type: Boolean,
477
+ default: false
478
+ },
479
+ formatWeeks: Function,
480
+ nowClick: {
481
+ type: Function
482
+ }
483
+ }),
484
+ emits: ["pick", "select-change", "dodestroy"],
485
+ setup: function setup$1(props2, context) {
486
+ return setup({
487
+ props: props2,
488
+ context,
489
+ renderless,
490
+ api,
491
+ classes,
492
+ extendOptions: {
493
+ language
494
+ }
495
+ });
496
+ }
497
+ };
498
+ var __cssModules = {};
499
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
500
+ function __vue2_injectStyles(context) {
501
+ for (var o in __cssModules) {
502
+ this[o] = __cssModules[o];
503
+ }
504
+ }
505
+ var mobileFirst = /* @__PURE__ */ function() {
506
+ return __component__.exports;
507
+ }();
508
+
509
+ export { mobileFirst as default };
package/lib/pc.js ADDED
@@ -0,0 +1,455 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/date-panel/vue';
2
+ import { defineComponent, $prefix, directive, setup, $props } from '@opentinyvue/vue-common';
3
+ import { language } from '@opentinyvue/vue-locale';
4
+ import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
5
+ import Time from '@opentinyvue/vue-time';
6
+ import DateTable from '@opentinyvue/vue-date-table';
7
+ import YearTable from '@opentinyvue/vue-year-table';
8
+ import MonthTable from '@opentinyvue/vue-month-table';
9
+ import Input from '@opentinyvue/vue-input';
10
+ import Button from '@opentinyvue/vue-button';
11
+ import { iconDoubleRight, iconDoubleLeft, iconChevronLeft, iconChevronRight, iconChevronDown, iconChevronUp } from '@opentinyvue/vue-icon';
12
+ import Popup from '@opentinyvue/vue-popup';
13
+
14
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
15
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
16
+ if (render) {
17
+ options.render = render;
18
+ options.staticRenderFns = staticRenderFns;
19
+ options._compiled = true;
20
+ }
21
+ var hook;
22
+ if (injectStyles) {
23
+ hook = injectStyles;
24
+ }
25
+ if (hook) {
26
+ if (options.functional) {
27
+ options._injectStyles = hook;
28
+ var originalRender = options.render;
29
+ options.render = function renderWithStyleInjection(h, context) {
30
+ hook.call(context);
31
+ return originalRender(h, context);
32
+ };
33
+ } else {
34
+ var existing = options.beforeCreate;
35
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
36
+ }
37
+ }
38
+ return {
39
+ exports: scriptExports,
40
+ options
41
+ };
42
+ }
43
+
44
+ function _extends() {
45
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
46
+ for (var e = 1; e < arguments.length; e++) {
47
+ var t = arguments[e];
48
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
49
+ }
50
+ return n;
51
+ }, _extends.apply(null, arguments);
52
+ }
53
+ var __vue2_script = defineComponent({
54
+ name: $prefix + "DatePanel",
55
+ directives: directive({
56
+ Clickoutside
57
+ }),
58
+ components: {
59
+ TimePicker: Time,
60
+ YearTable,
61
+ MonthTable,
62
+ DateTable,
63
+ TinyInput: Input,
64
+ TinyButton: Button,
65
+ TinyPopup: Popup,
66
+ IconDoubleRight: iconDoubleRight(),
67
+ IconDoubleLeft: iconDoubleLeft(),
68
+ IconChevronLeft: iconChevronLeft(),
69
+ IconChevronRight: iconChevronRight(),
70
+ IconChevronDown: iconChevronDown(),
71
+ IconChevronUp: iconChevronUp()
72
+ },
73
+ props: _extends({}, $props, {
74
+ emitter: Object,
75
+ step: {
76
+ type: Object,
77
+ default: function _default() {
78
+ return {
79
+ hour: 1,
80
+ minute: 1,
81
+ second: 1
82
+ };
83
+ }
84
+ },
85
+ showWeekNumber: {
86
+ type: Boolean,
87
+ default: false
88
+ },
89
+ formatWeeks: Function,
90
+ timeEditable: {
91
+ type: Boolean,
92
+ default: true
93
+ },
94
+ nowClick: {
95
+ type: Function
96
+ }
97
+ }),
98
+ emits: ["pick", "select-change", "dodestroy"],
99
+ setup: function setup$1(props, context) {
100
+ return setup({
101
+ props,
102
+ context,
103
+ renderless,
104
+ api,
105
+ extendOptions: {
106
+ language
107
+ }
108
+ });
109
+ }
110
+ });
111
+ var render = function render2() {
112
+ var _vm = this;
113
+ var _h = _vm.$createElement;
114
+ var _c = _vm._self._c || _h;
115
+ return _c("transition", {
116
+ attrs: {
117
+ "name": "tiny-zoom-in-top"
118
+ },
119
+ on: {
120
+ "after-enter": _vm.handleEnter,
121
+ "after-leave": _vm.handleLeave
122
+ }
123
+ }, [_c("div", {
124
+ directives: [{
125
+ name: "show",
126
+ rawName: "v-show",
127
+ value: _vm.state.visible,
128
+ expression: "state.visible"
129
+ }],
130
+ staticClass: "tiny-picker-panel tiny-date-picker tiny-popper",
131
+ class: [{
132
+ "has-sidebar": _vm.slots.sidebar || _vm.state.shortcuts,
133
+ "has-time": _vm.state.showTime
134
+ }, _vm.state.popperClass]
135
+ }, [_c("div", {
136
+ staticClass: "tiny-picker-panel__body-wrapper"
137
+ }, [_vm._t("sidebar"), _vm.state.shortcuts ? _c("div", {
138
+ staticClass: "tiny-picker-panel__sidebar"
139
+ }, _vm._l(_vm.state.shortcuts, function(shortcut, key) {
140
+ return _c("button", {
141
+ key,
142
+ staticClass: "tiny-picker-panel__shortcut",
143
+ attrs: {
144
+ "type": "button",
145
+ "title": shortcut.text
146
+ },
147
+ on: {
148
+ "click": function click($event) {
149
+ return _vm.handleShortcutClick(shortcut);
150
+ }
151
+ }
152
+ }, [_vm._v(" " + _vm._s(shortcut.text) + " ")]);
153
+ }), 0) : _vm._e(), _c("div", {
154
+ staticClass: "tiny-picker-panel__body"
155
+ }, [_vm.state.showTime ? _c("div", {
156
+ staticClass: "tiny-date-picker__time-header"
157
+ }, [_c("span", {
158
+ staticClass: "tiny-date-picker__editor-wrap"
159
+ }, [_c("tiny-input", {
160
+ attrs: {
161
+ "placeholder": _vm.t("ui.datepicker.selectDate"),
162
+ "model-value": _vm.state.visibleDate,
163
+ "size": "small"
164
+ },
165
+ on: {
166
+ "update:modelValue": function updateModelValue(val) {
167
+ return _vm.state.userInputDate = val;
168
+ },
169
+ "change": _vm.handleVisibleDateChange
170
+ }
171
+ })], 1), _c("span", {
172
+ directives: [{
173
+ name: "clickoutside",
174
+ rawName: "v-clickoutside",
175
+ value: _vm.handleTimePickClose,
176
+ expression: "handleTimePickClose"
177
+ }],
178
+ staticClass: "tiny-date-picker__editor-wrap"
179
+ }, [_c("tiny-input", {
180
+ ref: "input",
181
+ attrs: {
182
+ "placeholder": _vm.t("ui.datepicker.selectTime"),
183
+ "model-value": _vm.state.visibleTime,
184
+ "size": "small",
185
+ "readonly": !_vm.timeEditable
186
+ },
187
+ on: {
188
+ "focus": function focus($event) {
189
+ _vm.state.timePickerVisible = true;
190
+ },
191
+ "update:modelValue": function updateModelValue(val) {
192
+ return _vm.state.userInputTime = val;
193
+ },
194
+ "change": _vm.handleVisibleTimeChange
195
+ }
196
+ }), _c("time-picker", {
197
+ ref: "timepicker",
198
+ attrs: {
199
+ "step": _vm.step,
200
+ "time-arrow-control": _vm.state.arrowControl,
201
+ "show": _vm.state.timePickerVisible,
202
+ "value": _vm.state.date
203
+ },
204
+ on: {
205
+ "pick": _vm.handleTimePick
206
+ }
207
+ })], 1)]) : _vm._e(), _c("div", {
208
+ directives: [{
209
+ name: "show",
210
+ rawName: "v-show",
211
+ value: _vm.state.currentView !== "time",
212
+ expression: "state.currentView !== 'time'"
213
+ }],
214
+ staticClass: "tiny-date-picker__header",
215
+ class: {
216
+ "tiny-date-picker__header--bordered": ["month", "year", "years", "yearrange"].includes(_vm.state.currentView)
217
+ }
218
+ }, [_c("button", {
219
+ staticClass: "tiny-picker-panel__icon-btn tiny-date-picker__prev-btn tiny-icon-d-arrow-left",
220
+ attrs: {
221
+ "type": "button",
222
+ "aria-label": _vm.t("ui.datepicker.prevYear")
223
+ },
224
+ on: {
225
+ "click": _vm.cusPrevYear
226
+ }
227
+ }, [_c("icon-double-left")], 1), _c("button", {
228
+ directives: [{
229
+ name: "show",
230
+ rawName: "v-show",
231
+ value: _vm.state.currentView === "date",
232
+ expression: "state.currentView === 'date'"
233
+ }],
234
+ staticClass: "tiny-picker-panel__icon-btn tiny-date-picker__prev-btn tiny-icon-arrow-left",
235
+ attrs: {
236
+ "type": "button",
237
+ "aria-label": _vm.t("ui.datepicker.prevMonth")
238
+ },
239
+ on: {
240
+ "click": _vm.cusPrevMonth
241
+ }
242
+ }, [_c("icon-chevron-left")], 1), _c("span", {
243
+ staticClass: "tiny-date-picker__header-label",
244
+ attrs: {
245
+ "role": "button"
246
+ },
247
+ on: {
248
+ "click": _vm.showYearPicker
249
+ }
250
+ }, [_vm._v(" " + _vm._s(_vm.state.yearLabel) + " ")]), _c("span", {
251
+ directives: [{
252
+ name: "show",
253
+ rawName: "v-show",
254
+ value: _vm.state.currentView === "date",
255
+ expression: "state.currentView === 'date'"
256
+ }],
257
+ staticClass: "tiny-date-picker__header-label",
258
+ class: {
259
+ active: _vm.state.currentView === "month"
260
+ },
261
+ attrs: {
262
+ "role": "button"
263
+ },
264
+ on: {
265
+ "click": _vm.showMonthPicker
266
+ }
267
+ }, [_vm._v(_vm._s(_vm.t("ui.datepicker.month" + (_vm.state.month + 1))))]), _c("button", {
268
+ staticClass: "tiny-picker-panel__icon-btn tiny-date-picker__next-btn tiny-icon-d-arrow-right",
269
+ attrs: {
270
+ "type": "button",
271
+ "aria-label": _vm.t("ui.datepicker.nextYear")
272
+ },
273
+ on: {
274
+ "click": _vm.cusNextYear
275
+ }
276
+ }, [_c("icon-double-right")], 1), _c("button", {
277
+ directives: [{
278
+ name: "show",
279
+ rawName: "v-show",
280
+ value: _vm.state.currentView === "date",
281
+ expression: "state.currentView === 'date'"
282
+ }],
283
+ staticClass: "tiny-picker-panel__icon-btn tiny-date-picker__next-btn tiny-icon-arrow-right",
284
+ attrs: {
285
+ "type": "button",
286
+ "aria-label": _vm.t("ui.datepicker.nextMonth")
287
+ },
288
+ on: {
289
+ "click": _vm.cusNextMonth
290
+ }
291
+ }, [_c("icon-chevron-right")], 1)]), _c("div", {
292
+ staticClass: "tiny-picker-panel__content"
293
+ }, [_c("div", {
294
+ staticClass: "tiny-picker-panel__table"
295
+ }, [_vm.state.currentView === "date" ? _c("date-table", {
296
+ ref: "dateTable",
297
+ attrs: {
298
+ "selection-mode": _vm.state.selectionMode,
299
+ "first-day-of-week": _vm.state.firstDayOfWeek,
300
+ "value": _vm.state.value,
301
+ "default-value": _vm.state.defaultValue ? new Date(_vm.state.defaultValue) : null,
302
+ "date": _vm.state.date,
303
+ "cell-class-name": _vm.state.cellClassName,
304
+ "disabled-date": _vm.state.disabledDate,
305
+ "show-week-number": _vm.showWeekNumber,
306
+ "format-weeks": _vm.formatWeeks
307
+ },
308
+ on: {
309
+ "pick": _vm.handleDatePick
310
+ }
311
+ }) : _vm._e(), ["year", "years", "yearrange"].includes(_vm.state.currentView) ? _c("year-table", {
312
+ ref: "yearTable",
313
+ attrs: {
314
+ "value": _vm.state.value,
315
+ "default-value": _vm.state.defaultValue ? new Date(_vm.state.defaultValue) : null,
316
+ "date": _vm.state.date,
317
+ "disabled-date": _vm.state.disabledDate,
318
+ "selection-mode": _vm.state.selectionMode,
319
+ "start-year": _vm.state.startYear
320
+ },
321
+ on: {
322
+ "pick": _vm.handleYearPick
323
+ }
324
+ }) : _vm._e(), _vm.state.currentView === "month" ? _c("month-table", {
325
+ ref: "monthTable",
326
+ attrs: {
327
+ "value": _vm.state.value,
328
+ "default-value": _vm.state.defaultValue ? new Date(_vm.state.defaultValue) : null,
329
+ "date": _vm.state.date,
330
+ "disabled-date": _vm.state.disabledDate
331
+ },
332
+ on: {
333
+ "pick": _vm.handleMonthPick
334
+ }
335
+ }) : _vm._e()], 1)])])], 2), _vm.state.isShowTz || _vm.state.timezone.isServiceTimezone ? _c("div", {
336
+ directives: [{
337
+ name: "clickoutside",
338
+ rawName: "v-clickoutside",
339
+ value: _vm.handleTzPickClose,
340
+ expression: "handleTzPickClose"
341
+ }],
342
+ staticClass: "tiny-picker-panel__timezone"
343
+ }, [_c("tiny-input", {
344
+ attrs: {
345
+ "disabled": _vm.state.timezone.isServiceTimezone,
346
+ "placeholder": _vm.t("ui.datepicker.timezone")
347
+ },
348
+ on: {
349
+ "update:modelValue": _vm.searchTz
350
+ },
351
+ scopedSlots: _vm._u([{
352
+ key: "suffix",
353
+ fn: function fn() {
354
+ return [_c(_vm.state.showpopup ? "IconChevronDown" : "IconChevronUp", {
355
+ tag: "component",
356
+ attrs: {
357
+ "fill": "#ccc"
358
+ },
359
+ on: {
360
+ "click": _vm.toggleTz
361
+ }
362
+ })];
363
+ },
364
+ proxy: true
365
+ }], null, false, 3034754380),
366
+ model: {
367
+ value: _vm.state.tz,
368
+ callback: function callback($$v) {
369
+ _vm.$set(_vm.state, "tz", $$v);
370
+ },
371
+ expression: "state.tz"
372
+ }
373
+ }), _c("div", {
374
+ staticClass: "tiny-picker-panel__tzlist"
375
+ }, [_c("tiny-popup", {
376
+ attrs: {
377
+ "overlay": false,
378
+ "position": "up",
379
+ "duration": 0.2,
380
+ "closeable": false
381
+ },
382
+ model: {
383
+ value: _vm.state.showpopup,
384
+ callback: function callback($$v) {
385
+ _vm.$set(_vm.state, "showpopup", $$v);
386
+ },
387
+ expression: "state.showpopup"
388
+ }
389
+ }, [_c("div", {
390
+ staticClass: "tzlist"
391
+ }, [_c("ul", _vm._l(_vm.state.renderTzdata, function(tz, index) {
392
+ return _c("li", {
393
+ directives: [{
394
+ name: "show",
395
+ rawName: "v-show",
396
+ value: !tz.visible,
397
+ expression: "!tz.visible"
398
+ }],
399
+ key: index,
400
+ staticClass: "tiny-picker-panel__tzlist-li",
401
+ attrs: {
402
+ "title": tz.name
403
+ },
404
+ on: {
405
+ "click": function click($event) {
406
+ return _vm.selectTz(tz);
407
+ }
408
+ }
409
+ }, [_vm._v(" " + _vm._s(tz.name) + " ")]);
410
+ }), 0)])])], 1)], 1) : _vm._e(), _vm.state.isShowFooter ? _c("div", {
411
+ staticClass: "tiny-picker-panel__footer",
412
+ style: {
413
+ justifyContent: !["dates", "years"].includes(_vm.state.selectionMode) ? "space-between" : "right"
414
+ }
415
+ }, [_vm._t("default", function() {
416
+ return [_c("tiny-button", {
417
+ directives: [{
418
+ name: "show",
419
+ rawName: "v-show",
420
+ value: !["dates", "years"].includes(_vm.state.selectionMode),
421
+ expression: "!['dates', 'years'].includes(state.selectionMode)"
422
+ }],
423
+ staticClass: "tiny-picker-panel__link-btn",
424
+ attrs: {
425
+ "size": _vm.state.buttonSize,
426
+ "type": "text"
427
+ },
428
+ on: {
429
+ "click": _vm.changeToNow
430
+ }
431
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.now")) + " ")])];
432
+ }), _c("tiny-button", {
433
+ staticClass: "tiny-picker-panel__link-btn",
434
+ attrs: {
435
+ "type": _vm.state.buttonType,
436
+ "size": _vm.state.buttonSize
437
+ },
438
+ on: {
439
+ "click": _vm.confirm
440
+ }
441
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.confirm")) + " ")])], 2) : _vm._e()])]);
442
+ };
443
+ var staticRenderFns = [];
444
+ var __cssModules = {};
445
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
446
+ function __vue2_injectStyles(context) {
447
+ for (var o in __cssModules) {
448
+ this[o] = __cssModules[o];
449
+ }
450
+ }
451
+ var pc = /* @__PURE__ */ function() {
452
+ return __component__.exports;
453
+ }();
454
+
455
+ export { pc as default };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@opentinyvue/vue-date-panel",
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-renderless": "~3.21.0",
12
+ "@opentinyvue/vue-input": "~2.21.0",
13
+ "@opentinyvue/vue-button": "~2.21.0",
14
+ "@opentinyvue/vue-locale": "~2.21.0",
15
+ "@opentinyvue/vue-time": "~2.21.0",
16
+ "@opentinyvue/vue-date-table": "~2.21.0",
17
+ "@opentinyvue/vue-year-table": "~2.21.0",
18
+ "@opentinyvue/vue-month-table": "~2.21.0",
19
+ "@opentinyvue/vue-theme": "~3.21.0",
20
+ "@opentinyvue/vue-popup": "~2.21.0",
21
+ "@opentinyvue/vue-icon": "~2.21.0"
22
+ },
23
+ "license": "MIT",
24
+ "types": "index.d.ts",
25
+ "scripts": {
26
+ "build": "pnpm -w build:ui $npm_package_name",
27
+ "//postversion": "pnpm build"
28
+ }
29
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue/types/vue").ExtendedVue<import("vue").default, any, any, any, Record<"tiny_mode" | "tiny_mode_root" | "tiny_template" | "tiny_renderless" | "_constants" | "tiny_theme" | "tiny_chart_theme", any>>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
package/src/token.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ export declare const classes: {
2
+ 'picker-panel': string;
3
+ 'picker-panel-body': string;
4
+ content: string;
5
+ header: string;
6
+ bordered: string;
7
+ disabled: string;
8
+ 'icon-btn': string;
9
+ 'header-label': string;
10
+ 'body-content': string;
11
+ today: string;
12
+ footer: string;
13
+ 'link-btn': string;
14
+ 'time-header': string;
15
+ 'editor-wrap': string;
16
+ sidebar: string;
17
+ 'sidebar-btn': string;
18
+ };