@opentinyvue/vue-date-range 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 DateRange from './src/index';
13
+ export default DateRange;
package/lib/index.js ADDED
@@ -0,0 +1,75 @@
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-range/index.css";
14
+ var template = function template2(mode) {
15
+ var _process$env;
16
+ var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
17
+ if ("pc" === (tinyMode || mode)) {
18
+ return PcTemplate;
19
+ }
20
+ if ("mobile-first" === (tinyMode || mode)) {
21
+ return MobileFirstTemplate;
22
+ }
23
+ return PcTemplate;
24
+ };
25
+ var $constants = {
26
+ startDate: /* @__PURE__ */ new Date("1970-01-01"),
27
+ endDate: /* @__PURE__ */ new Date("2099-12-31")
28
+ };
29
+ var DateRange = defineComponent({
30
+ name: $prefix + "DateRange",
31
+ componentName: "DateRange",
32
+ props: _extends({}, $props, {
33
+ _constants: {
34
+ type: Object,
35
+ default: function _default() {
36
+ return $constants;
37
+ }
38
+ },
39
+ emitter: Object,
40
+ step: {
41
+ type: Object,
42
+ default: function _default2() {
43
+ return {
44
+ hour: 1,
45
+ minute: 1,
46
+ second: 1
47
+ };
48
+ }
49
+ },
50
+ showWeekNumber: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ formatWeeks: Function,
55
+ timeEditable: {
56
+ type: Boolean,
57
+ default: true
58
+ }
59
+ }),
60
+ setup: function setup(props, context) {
61
+ return $setup({
62
+ props,
63
+ context,
64
+ template
65
+ });
66
+ }
67
+ });
68
+ var version = "2.21.0";
69
+ DateRange.install = function(Vue) {
70
+ Vue.component(DateRange.name, DateRange);
71
+ };
72
+ DateRange.version = version;
73
+ export {
74
+ DateRange as default
75
+ };
@@ -0,0 +1,474 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/date-range/vue';
2
+ import { defineComponent, directive, props, setup } from '@opentinyvue/vue-common';
3
+ import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
4
+ import Time from '@opentinyvue/vue-time';
5
+ import DateTable from '@opentinyvue/vue-date-table';
6
+ import Input from '@opentinyvue/vue-input';
7
+ import Button from '@opentinyvue/vue-button';
8
+ import { IconDoubleRight, IconDoubleLeft, IconChevronLeft, IconChevronRight } from '@opentinyvue/vue-icon';
9
+
10
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
11
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
12
+ if (render) {
13
+ options.render = render;
14
+ options.staticRenderFns = staticRenderFns;
15
+ options._compiled = true;
16
+ }
17
+ var hook;
18
+ if (injectStyles) {
19
+ hook = injectStyles;
20
+ }
21
+ if (hook) {
22
+ if (options.functional) {
23
+ options._injectStyles = hook;
24
+ var originalRender = options.render;
25
+ options.render = function renderWithStyleInjection(h, context) {
26
+ hook.call(context);
27
+ return originalRender(h, context);
28
+ };
29
+ } else {
30
+ var existing = options.beforeCreate;
31
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
32
+ }
33
+ }
34
+ return {
35
+ exports: scriptExports,
36
+ options
37
+ };
38
+ }
39
+
40
+ var classes = {
41
+ "picker-panel": "text-color-text-primary text-xs shadow-md bg-color-bg-1 rounded leading-4 my-0.5 mx-0",
42
+ "date-range-picker": "w-144",
43
+ "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",
44
+ "shortcut": "block my-0 mx-auto w-24 rounded border-0 bg-transparent leading-8 text-xs text-color-text-primary pl-4 text-left outline-0 cursor-pointer hover:bg-color-bg-2",
45
+ "shortcut-selected": "text-color-brand bg-color-brand-hover-subtle",
46
+ "body": "min-w-[513px]",
47
+ "time-header": "relative text-xs h-10 leading-10 table w-full box-border border-b border-b-color-bg-3",
48
+ "content": "float-left w-1/2 box-border pt-4 pr-4 pb-1.5 pl-4",
49
+ "header": "relative text-center p-4 h-12",
50
+ "icon-btn": "text-sm leading-4 fill-color-text-primary border-0 cursor-pointer outline-0 hover:fill-color-brand",
51
+ "is-disabled": "text-color-text-disabled hover:cursor-not-allowed",
52
+ "arrow-left": "float-left",
53
+ "arrow-right": "float-right",
54
+ "editors-wrap": "box-border table-cell",
55
+ "is-left": "border-r border-r-color-bg-3 relative -left-px",
56
+ "is-right": "text-right",
57
+ "time-picker-wrap": "relative table-cell px-1",
58
+ "time-picker-wrap-left": "before:content-[''] before:h-6 before:absolute before:right-0 before:top-2 before:border-r before:border-r-color-bg-3",
59
+ "editor": "relative items-center sm:border-0 text-center",
60
+ "footer": "border-t border-t-color-bg-3 py-3 px-4 bg-color-bg-1 overflow-hidden rounded-b"
61
+ };
62
+ var render = function render2() {
63
+ var _vm = this;
64
+ var _h = _vm.$createElement;
65
+ var _c = _vm._self._c || _h;
66
+ return _c("transition", {
67
+ attrs: {
68
+ "name": "tiny-zoom-in-top"
69
+ },
70
+ on: {
71
+ "after-leave": function afterLeave($event) {
72
+ return _vm.$emit("dodestroy");
73
+ }
74
+ }
75
+ }, [_c("div", {
76
+ directives: [{
77
+ name: "show",
78
+ rawName: "v-show",
79
+ value: _vm.state.visible,
80
+ expression: "state.visible"
81
+ }],
82
+ ref: "refDateRange",
83
+ class: _vm.m(_vm.gcls(["picker-panel", "date-range-picker"]), _vm.state.popperClass),
84
+ attrs: {
85
+ "data-tag": "tiny-picker-panel tiny-date-range-picker tiny-popper"
86
+ }
87
+ }, [_c("div", {
88
+ staticClass: "relative",
89
+ attrs: {
90
+ "data-tag": "tiny-picker-panel__body-wrapper"
91
+ }
92
+ }, [_vm._t("sidebar", null, {
93
+ "dataTag": "tiny-picker-panel__sidebar"
94
+ }), _vm.state.shortcuts ? _c("div", {
95
+ ref: "shortcut",
96
+ class: _vm.gcls("sidebar"),
97
+ attrs: {
98
+ "data-tag": "tiny-picker-panel__sidebar"
99
+ }
100
+ }, _vm._l(_vm.state.shortcuts, function(shortcut, key) {
101
+ return _c("button", {
102
+ key,
103
+ class: _vm.m(_vm.gcls("shortcut"), _vm.state.singleSelect && shortcut.type === _vm.state.shortcutType && shortcut.text === _vm.state.shortcutText && _vm.gcls("shortcut-selected")),
104
+ attrs: {
105
+ "type": "button",
106
+ "data-tag": "tiny-picker-panel__shortcut"
107
+ },
108
+ on: {
109
+ "click": function click($event) {
110
+ return _vm.handleShortcutClick(shortcut);
111
+ }
112
+ }
113
+ }, [_vm._v(" " + _vm._s(shortcut.text) + " ")]);
114
+ }), 0) : _vm._e(), _c("div", {
115
+ attrs: {
116
+ "data-tag": "tiny-picker-panel__body"
117
+ }
118
+ }, [_vm.state.showTime ? _c("div", {
119
+ class: _vm.gcls("time-header"),
120
+ attrs: {
121
+ "data-tag": "tiny-date-range-picker__time-header"
122
+ }
123
+ }, [_c("span", {
124
+ class: _vm.gcls(["editors-wrap", "is-left"]),
125
+ attrs: {
126
+ "data-tag": "tiny-date-range-picker__editors-wrap"
127
+ }
128
+ }, [_c("span", {
129
+ class: _vm.gcls(["time-picker-wrap", "time-picker-wrap-left"]),
130
+ attrs: {
131
+ "data-tag": "tiny-date-range-picker__time-picker-wrap"
132
+ }
133
+ }, [_c("tiny-input", {
134
+ ref: "minInput",
135
+ attrs: {
136
+ "size": "small",
137
+ "disabled": _vm.state.rangeState.selecting,
138
+ "placeholder": _vm.t("ui.datepicker.startDate"),
139
+ "data-tag": "tiny-date-range-picker__editor",
140
+ "custom-class": _vm.gcls("editor"),
141
+ "modelValue": _vm.state.minVisibleDate
142
+ },
143
+ on: {
144
+ "update:modelValue": function updateModelValue(val) {
145
+ return _vm.handleDateInput(val, "min");
146
+ },
147
+ "change": function change(val) {
148
+ return _vm.handleDateChange(val, "min");
149
+ }
150
+ }
151
+ })], 1), _c("span", {
152
+ directives: [{
153
+ name: "clickoutside",
154
+ rawName: "v-clickoutside",
155
+ value: _vm.handleMinTimeClose,
156
+ expression: "handleMinTimeClose"
157
+ }],
158
+ class: _vm.gcls("time-picker-wrap"),
159
+ attrs: {
160
+ "data-tag": "tiny-date-range-picker__time-picker-wrap"
161
+ }
162
+ }, [_c("tiny-input", {
163
+ attrs: {
164
+ "size": "small",
165
+ "data-tag": "tiny-date-range-picker__editor",
166
+ "custom-class": _vm.gcls("editor"),
167
+ "disabled": _vm.state.rangeState.selecting,
168
+ "placeholder": _vm.t("ui.datepicker.startTime"),
169
+ "modelValue": _vm.state.minVisibleTime
170
+ },
171
+ on: {
172
+ "focus": function focus($event) {
173
+ _vm.state.minTimePickerVisible = true;
174
+ },
175
+ "update:modelValue": function updateModelValue(val) {
176
+ return _vm.handleTimeInput(val, "min");
177
+ },
178
+ "change": function change(val) {
179
+ return _vm.handleTimeChange(val, "min");
180
+ }
181
+ }
182
+ }), _c("time-picker", {
183
+ ref: "minTimePicker",
184
+ attrs: {
185
+ "step": _vm.step,
186
+ "time-arrow-control": _vm.state.arrowControl,
187
+ "show": _vm.state.minTimePickerVisible,
188
+ "value": _vm.state.minDate
189
+ },
190
+ on: {
191
+ "pick": _vm.handleMinTimePick
192
+ }
193
+ })], 1)]), _c("span", {
194
+ attrs: {
195
+ "data-tag": "tiny-icon-arrow-right"
196
+ }
197
+ }), _c("span", {
198
+ class: _vm.gcls(["editors-wrap", "is-right"]),
199
+ attrs: {
200
+ "data-tag": "tiny-date-range-picker__editors-wrap is-right"
201
+ }
202
+ }, [_c("span", {
203
+ class: _vm.gcls(["time-picker-wrap", "time-picker-wrap-left"]),
204
+ attrs: {
205
+ "data-tag": "tiny-date-range-picker__time-picker-wrap"
206
+ }
207
+ }, [_c("tiny-input", {
208
+ attrs: {
209
+ "size": "small",
210
+ "data-tag": "tiny-date-range-picker__editor",
211
+ "custom-class": _vm.gcls("editor"),
212
+ "disabled": _vm.state.rangeState.selecting,
213
+ "placeholder": _vm.t("ui.datepicker.endDate"),
214
+ "modelValue": _vm.state.maxVisibleDate,
215
+ "readonly": !_vm.state.minDate
216
+ },
217
+ on: {
218
+ "update:modelValue": function updateModelValue(val) {
219
+ return _vm.handleDateInput(val, "max");
220
+ },
221
+ "change": function change(val) {
222
+ return _vm.handleDateChange(val, "max");
223
+ }
224
+ }
225
+ })], 1), _c("span", {
226
+ directives: [{
227
+ name: "clickoutside",
228
+ rawName: "v-clickoutside",
229
+ value: _vm.handleMaxTimeClose,
230
+ expression: "handleMaxTimeClose"
231
+ }],
232
+ class: _vm.gcls("time-picker-wrap"),
233
+ attrs: {
234
+ "data-tag": "tiny-date-range-picker__time-picker-wrap"
235
+ }
236
+ }, [_c("tiny-input", {
237
+ attrs: {
238
+ "size": "small",
239
+ "data-tag": "tiny-date-range-picker__editor",
240
+ "custom-class": _vm.gcls("editor"),
241
+ "disabled": _vm.state.rangeState.selecting,
242
+ "placeholder": _vm.t("ui.datepicker.endTime"),
243
+ "modelValue": _vm.state.maxVisibleTime,
244
+ "readonly": !_vm.state.minDate
245
+ },
246
+ on: {
247
+ "focus": function focus($event) {
248
+ _vm.state.minDate && (_vm.state.maxTimePickerVisible = true);
249
+ },
250
+ "update:modelValue": function updateModelValue(val) {
251
+ return _vm.handleTimeInput(val, "max");
252
+ },
253
+ "change": function change(val) {
254
+ return _vm.handleTimeChange(val, "max");
255
+ }
256
+ }
257
+ }), _c("time-picker", {
258
+ ref: "maxTimePicker",
259
+ attrs: {
260
+ "step": _vm.step,
261
+ "time-arrow-control": _vm.state.arrowControl,
262
+ "show": _vm.state.maxTimePickerVisible,
263
+ "value": _vm.state.maxDate
264
+ },
265
+ on: {
266
+ "pick": _vm.handleMaxTimePick
267
+ }
268
+ })], 1)])]) : _vm._e(), _c("div", {
269
+ class: _vm.gcls(["content", "is-left"]),
270
+ attrs: {
271
+ "data-tag": "tiny-picker-panel__content tiny-date-range-picker__content is-left"
272
+ }
273
+ }, [_c("div", {
274
+ class: _vm.gcls("header"),
275
+ attrs: {
276
+ "data-tag": "tiny-date-range-picker__header"
277
+ }
278
+ }, [_c("button", {
279
+ class: _vm.gcls(["icon-btn", "arrow-left"]),
280
+ attrs: {
281
+ "type": "button",
282
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-d-arrow-left"
283
+ },
284
+ on: {
285
+ "click": _vm.leftPrevYear
286
+ }
287
+ }, [_c("icon-double-left")], 1), _c("button", {
288
+ class: _vm.gcls(["icon-btn", "arrow-left"]),
289
+ attrs: {
290
+ "type": "button",
291
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-arrow-left"
292
+ },
293
+ on: {
294
+ "click": _vm.leftPrevMonth
295
+ }
296
+ }, [_c("icon-chevron-left")], 1), _vm.state.unlinkPanels ? _c("button", {
297
+ class: {
298
+ "is-disabled": !_vm.state.enableYearArrow
299
+ },
300
+ attrs: {
301
+ "type": "button",
302
+ "disabled": !_vm.state.enableYearArrow,
303
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-d-arrow-right"
304
+ },
305
+ on: {
306
+ "click": _vm.leftNextYear
307
+ }
308
+ }, [_c("icon-double-right")], 1) : _vm._e(), _vm.state.unlinkPanels ? _c("button", {
309
+ class: {
310
+ "is-disabled": !_vm.state.enableMonthArrow
311
+ },
312
+ attrs: {
313
+ "type": "button",
314
+ "disabled": !_vm.state.enableMonthArrow,
315
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-arrow-right"
316
+ },
317
+ on: {
318
+ "click": _vm.leftNextMonth
319
+ }
320
+ }, [_c("icon-chevron-right")], 1) : _vm._e(), _c("div", {
321
+ staticClass: "mx-12"
322
+ }, [_vm._v(_vm._s(_vm.state.leftLabel))])]), _c("date-table", {
323
+ attrs: {
324
+ "selection-mode": "range",
325
+ "date": _vm.state.leftDate,
326
+ "default-value": _vm.state.defaultValue,
327
+ "min-date": _vm.state.minDate,
328
+ "max-date": _vm.state.maxDate,
329
+ "range-state": _vm.state.rangeState,
330
+ "disabled-date": _vm.state.disabledDate,
331
+ "cell-class-name": _vm.state.cellClassName,
332
+ "first-day-of-week": _vm.state.firstDayOfWeek,
333
+ "show-week-number": _vm.showWeekNumber,
334
+ "format-weeks": _vm.formatWeeks
335
+ },
336
+ on: {
337
+ "changerange": _vm.handleChangeRange,
338
+ "pick": _vm.handleRangePick
339
+ }
340
+ })], 1), _c("div", {
341
+ class: _vm.gcls(["content", "is-right"]),
342
+ attrs: {
343
+ "data-tag": "tiny-picker-panel__content tiny-date-range-picker__content is-right"
344
+ }
345
+ }, [_c("div", {
346
+ class: _vm.gcls("header"),
347
+ attrs: {
348
+ "data-tag": "tiny-date-range-picker__header"
349
+ }
350
+ }, [_vm.state.unlinkPanels ? _c("button", {
351
+ class: _vm.m(_vm.gcls(["icon-btn", "arrow-left"]), !_vm.state.enableYearArrow && _vm.gcls("is-disabled")),
352
+ attrs: {
353
+ "type": "button",
354
+ "disabled": !_vm.state.enableYearArrow,
355
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-d-arrow-left"
356
+ },
357
+ on: {
358
+ "click": _vm.rightPrevYear
359
+ }
360
+ }, [_c("icon-double-left")], 1) : _vm._e(), _vm.state.unlinkPanels ? _c("button", {
361
+ class: _vm.m(_vm.gcls(["icon-btn", "arrow-left"]), !_vm.state.enableMonthArrow && _vm.gcls("is-disabled")),
362
+ attrs: {
363
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-arrow-left",
364
+ "type": "button",
365
+ "disabled": !_vm.state.enableMonthArrow
366
+ },
367
+ on: {
368
+ "click": _vm.rightPrevMonth
369
+ }
370
+ }, [_c("icon-chevron-left")], 1) : _vm._e(), _c("button", {
371
+ class: _vm.gcls(["icon-btn", "arrow-right"]),
372
+ attrs: {
373
+ "type": "button",
374
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-d-arrow-right"
375
+ },
376
+ on: {
377
+ "click": _vm.rightNextYear
378
+ }
379
+ }, [_c("icon-double-right")], 1), _c("button", {
380
+ class: _vm.gcls(["icon-btn", "arrow-right"]),
381
+ attrs: {
382
+ "type": "button",
383
+ "data-tag": "tiny-picker-panel__icon-btn tiny-icon-arrow-right"
384
+ },
385
+ on: {
386
+ "click": _vm.rightNextMonth
387
+ }
388
+ }, [_c("icon-chevron-right")], 1), _c("div", [_vm._v(_vm._s(_vm.state.rightLabel))])]), _c("date-table", {
389
+ attrs: {
390
+ "selection-mode": "range",
391
+ "date": _vm.state.rightDate,
392
+ "default-value": _vm.state.defaultValue,
393
+ "min-date": _vm.state.minDate,
394
+ "max-date": _vm.state.maxDate,
395
+ "range-state": _vm.state.rangeState,
396
+ "disabled-date": _vm.state.disabledDate,
397
+ "cell-class-name": _vm.state.cellClassName,
398
+ "first-day-of-week": _vm.state.firstDayOfWeek,
399
+ "show-week-number": _vm.showWeekNumber,
400
+ "format-weeks": _vm.formatWeeks
401
+ },
402
+ on: {
403
+ "changerange": _vm.handleChangeRange,
404
+ "pick": _vm.handleRangePick
405
+ }
406
+ })], 1)])], 2), _vm.state.showTime ? _c("div", {
407
+ class: _vm.gcls("footer"),
408
+ attrs: {
409
+ "data-tag": "tiny-picker-panel__footer"
410
+ }
411
+ }, [_c("tiny-button", {
412
+ attrs: {
413
+ "size": "mini",
414
+ "type": "text",
415
+ "data-tag": "tiny-picker-panel__link-btn",
416
+ "custom-class": "text-left pl-0"
417
+ },
418
+ on: {
419
+ "click": _vm.handleClear
420
+ }
421
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.clear")) + " ")]), _c("tiny-button", {
422
+ attrs: {
423
+ "type": "primary",
424
+ "size": "mini",
425
+ "data-tag": "tiny-picker-panel__link-btn",
426
+ "custom-class": "float-right",
427
+ "disabled": _vm.state.btnDisabled
428
+ },
429
+ on: {
430
+ "click": function click($event) {
431
+ return _vm.handleConfirm(false);
432
+ }
433
+ }
434
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.confirm")) + " ")])], 1) : _vm._e()])]);
435
+ };
436
+ var staticRenderFns = [];
437
+ var __vue2_script = defineComponent({
438
+ directives: directive({
439
+ Clickoutside
440
+ }),
441
+ components: {
442
+ TimePicker: Time,
443
+ DateTable,
444
+ TinyInput: Input,
445
+ TinyButton: Button,
446
+ IconDoubleRight: IconDoubleRight(),
447
+ IconDoubleLeft: IconDoubleLeft(),
448
+ IconChevronLeft: IconChevronLeft(),
449
+ IconChevronRight: IconChevronRight()
450
+ },
451
+ props: [].concat(props, ["emitter", "step", "showWeekNumber", "formatWeeks"]),
452
+ emits: ["dodestroy", "pick"],
453
+ setup: function setup$1(props2, context) {
454
+ return setup({
455
+ props: props2,
456
+ context,
457
+ renderless,
458
+ api,
459
+ classes
460
+ });
461
+ }
462
+ });
463
+ var __cssModules = {};
464
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
465
+ function __vue2_injectStyles(context) {
466
+ for (var o in __cssModules) {
467
+ this[o] = __cssModules[o];
468
+ }
469
+ }
470
+ var mobileFirst = /* @__PURE__ */ function() {
471
+ return __component__.exports;
472
+ }();
473
+
474
+ export { mobileFirst as default };
package/lib/pc.js ADDED
@@ -0,0 +1,403 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/date-range/vue';
2
+ import { defineComponent, directive, props, setup } from '@opentinyvue/vue-common';
3
+ import Clickoutside from '@opentinyvue/vue-renderless/common/deps/clickoutside';
4
+ import Time from '@opentinyvue/vue-time';
5
+ import DateTable from '@opentinyvue/vue-date-table';
6
+ import Input from '@opentinyvue/vue-input';
7
+ import Button from '@opentinyvue/vue-button';
8
+ import { iconDoubleRight, iconDoubleLeft, iconChevronLeft, iconChevronRight } from '@opentinyvue/vue-icon';
9
+
10
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
11
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
12
+ if (render) {
13
+ options.render = render;
14
+ options.staticRenderFns = staticRenderFns;
15
+ options._compiled = true;
16
+ }
17
+ var hook;
18
+ if (injectStyles) {
19
+ hook = injectStyles;
20
+ }
21
+ if (hook) {
22
+ if (options.functional) {
23
+ options._injectStyles = hook;
24
+ var originalRender = options.render;
25
+ options.render = function renderWithStyleInjection(h, context) {
26
+ hook.call(context);
27
+ return originalRender(h, context);
28
+ };
29
+ } else {
30
+ var existing = options.beforeCreate;
31
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
32
+ }
33
+ }
34
+ return {
35
+ exports: scriptExports,
36
+ options
37
+ };
38
+ }
39
+
40
+ var __vue2_script = defineComponent({
41
+ directives: directive({
42
+ Clickoutside
43
+ }),
44
+ components: {
45
+ TimePicker: Time,
46
+ DateTable,
47
+ TinyInput: Input,
48
+ TinyButton: Button,
49
+ IconDoubleRight: iconDoubleRight(),
50
+ IconDoubleLeft: iconDoubleLeft(),
51
+ IconChevronLeft: iconChevronLeft(),
52
+ IconChevronRight: iconChevronRight()
53
+ },
54
+ props: [].concat(props, ["emitter", "step", "showWeekNumber", "formatWeeks", "timeEditable"]),
55
+ emits: ["dodestroy", "pick"],
56
+ setup: function setup$1(props2, context) {
57
+ return setup({
58
+ props: props2,
59
+ context,
60
+ renderless,
61
+ api
62
+ });
63
+ }
64
+ });
65
+ var render = function render2() {
66
+ var _vm = this;
67
+ var _h = _vm.$createElement;
68
+ var _c = _vm._self._c || _h;
69
+ return _c("transition", {
70
+ attrs: {
71
+ "name": "tiny-zoom-in-top"
72
+ },
73
+ on: {
74
+ "after-leave": function afterLeave($event) {
75
+ return _vm.$emit("dodestroy");
76
+ }
77
+ }
78
+ }, [_c("div", {
79
+ directives: [{
80
+ name: "show",
81
+ rawName: "v-show",
82
+ value: _vm.state.visible,
83
+ expression: "state.visible"
84
+ }],
85
+ ref: "refDateRange",
86
+ staticClass: "tiny-picker-panel tiny-date-range-picker tiny-popper",
87
+ class: [{
88
+ "has-sidebar": _vm.slots.sidebar || _vm.state.shortcuts,
89
+ "has-time": _vm.state.showTime
90
+ }, _vm.state.popperClass]
91
+ }, [_c("div", {
92
+ staticClass: "tiny-picker-panel__body-wrapper"
93
+ }, [_vm._t("sidebar"), _vm.state.shortcuts ? _c("div", {
94
+ ref: "shortcut",
95
+ staticClass: "tiny-picker-panel__sidebar"
96
+ }, _vm._l(_vm.state.shortcuts, function(shortcut, key) {
97
+ return _c("button", {
98
+ key,
99
+ staticClass: "tiny-picker-panel__shortcut",
100
+ class: {
101
+ "tiny-picker-panel__shortcut-selected": _vm.state.singleSelect && shortcut.type === _vm.state.shortcutType && shortcut.text === _vm.state.shortcutText
102
+ },
103
+ attrs: {
104
+ "type": "button",
105
+ "title": shortcut.text
106
+ },
107
+ on: {
108
+ "click": function click($event) {
109
+ return _vm.handleShortcutClick(shortcut);
110
+ }
111
+ }
112
+ }, [_vm._v(" " + _vm._s(shortcut.text) + " ")]);
113
+ }), 0) : _vm._e(), _c("div", {
114
+ staticClass: "tiny-picker-panel__body"
115
+ }, [_vm.state.showTime ? _c("div", {
116
+ staticClass: "tiny-date-range-picker__time-header"
117
+ }, [_c("span", {
118
+ staticClass: "tiny-date-range-picker__editors-wrap"
119
+ }, [_c("span", {
120
+ staticClass: "tiny-date-range-picker__time-picker-wrap"
121
+ }, [_c("tiny-input", {
122
+ ref: "minInput",
123
+ staticClass: "tiny-date-range-picker__editor",
124
+ attrs: {
125
+ "size": "small",
126
+ "disabled": _vm.state.rangeState.selecting,
127
+ "placeholder": _vm.t("ui.datepicker.startDate"),
128
+ "modelValue": _vm.state.minVisibleDate
129
+ },
130
+ on: {
131
+ "update:modelValue": function updateModelValue(val) {
132
+ return _vm.handleDateInput(val, "min");
133
+ },
134
+ "change": function change(val) {
135
+ return _vm.handleDateChange(val, "min");
136
+ }
137
+ }
138
+ })], 1), _c("span", {
139
+ directives: [{
140
+ name: "clickoutside",
141
+ rawName: "v-clickoutside",
142
+ value: _vm.handleMinTimeClose,
143
+ expression: "handleMinTimeClose"
144
+ }],
145
+ staticClass: "tiny-date-range-picker__time-picker-wrap"
146
+ }, [_c("tiny-input", {
147
+ staticClass: "tiny-date-range-picker__editor",
148
+ attrs: {
149
+ "size": "small",
150
+ "disabled": _vm.state.rangeState.selecting,
151
+ "placeholder": _vm.t("ui.datepicker.startTime"),
152
+ "modelValue": _vm.state.minVisibleTime,
153
+ "readonly": !_vm.timeEditable
154
+ },
155
+ on: {
156
+ "focus": function focus($event) {
157
+ _vm.state.minTimePickerVisible = true;
158
+ },
159
+ "update:modelValue": function updateModelValue(val) {
160
+ return _vm.handleTimeInput(val, "min");
161
+ },
162
+ "change": function change(val) {
163
+ return _vm.handleTimeChange(val, "min");
164
+ }
165
+ }
166
+ }), _c("time-picker", {
167
+ ref: "minTimePicker",
168
+ attrs: {
169
+ "step": _vm.step,
170
+ "time-arrow-control": _vm.state.arrowControl,
171
+ "show": _vm.state.minTimePickerVisible,
172
+ "value": _vm.state.minDate
173
+ },
174
+ on: {
175
+ "pick": _vm.handleMinTimePick
176
+ }
177
+ })], 1)]), _c("span", {
178
+ staticClass: "tiny-icon-arrow-right"
179
+ }), _c("span", {
180
+ staticClass: "tiny-date-range-picker__editors-wrap is-right"
181
+ }, [_c("span", {
182
+ staticClass: "tiny-date-range-picker__time-picker-wrap"
183
+ }, [_c("tiny-input", {
184
+ staticClass: "tiny-date-range-picker__editor",
185
+ attrs: {
186
+ "size": "small",
187
+ "disabled": _vm.state.rangeState.selecting,
188
+ "placeholder": _vm.t("ui.datepicker.endDate"),
189
+ "modelValue": _vm.state.maxVisibleDate,
190
+ "readonly": !_vm.state.minDate
191
+ },
192
+ on: {
193
+ "update:modelValue": function updateModelValue(val) {
194
+ return _vm.handleDateInput(val, "max");
195
+ },
196
+ "change": function change(val) {
197
+ return _vm.handleDateChange(val, "max");
198
+ }
199
+ }
200
+ })], 1), _c("span", {
201
+ directives: [{
202
+ name: "clickoutside",
203
+ rawName: "v-clickoutside",
204
+ value: _vm.handleMaxTimeClose,
205
+ expression: "handleMaxTimeClose"
206
+ }],
207
+ staticClass: "tiny-date-range-picker__time-picker-wrap"
208
+ }, [_c("tiny-input", {
209
+ staticClass: "tiny-date-range-picker__editor",
210
+ attrs: {
211
+ "size": "small",
212
+ "disabled": _vm.state.rangeState.selecting,
213
+ "placeholder": _vm.t("ui.datepicker.endTime"),
214
+ "modelValue": _vm.state.maxVisibleTime,
215
+ "readonly": !_vm.state.minDate || !_vm.timeEditable
216
+ },
217
+ on: {
218
+ "focus": function focus($event) {
219
+ _vm.state.minDate && (_vm.state.maxTimePickerVisible = true);
220
+ },
221
+ "update:modelValue": function updateModelValue(val) {
222
+ return _vm.handleTimeInput(val, "max");
223
+ },
224
+ "change": function change(val) {
225
+ return _vm.handleTimeChange(val, "max");
226
+ }
227
+ }
228
+ }), _c("time-picker", {
229
+ ref: "maxTimePicker",
230
+ attrs: {
231
+ "step": _vm.step,
232
+ "time-arrow-control": _vm.state.arrowControl,
233
+ "show": _vm.state.maxTimePickerVisible,
234
+ "value": _vm.state.maxDate
235
+ },
236
+ on: {
237
+ "pick": _vm.handleMaxTimePick
238
+ }
239
+ })], 1)])]) : _vm._e(), _c("div", {
240
+ staticClass: "tiny-picker-panel__content tiny-date-range-picker__content is-left"
241
+ }, [_c("div", {
242
+ staticClass: "tiny-date-range-picker__header"
243
+ }, [_c("button", {
244
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-d-arrow-left",
245
+ attrs: {
246
+ "type": "button"
247
+ },
248
+ on: {
249
+ "click": _vm.leftPrevYear
250
+ }
251
+ }, [_c("icon-double-left")], 1), _c("button", {
252
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-arrow-left",
253
+ attrs: {
254
+ "type": "button"
255
+ },
256
+ on: {
257
+ "click": _vm.leftPrevMonth
258
+ }
259
+ }, [_c("icon-chevron-left")], 1), _vm.state.unlinkPanels ? _c("button", {
260
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-d-arrow-right",
261
+ class: {
262
+ "is-disabled": !_vm.state.enableYearArrow
263
+ },
264
+ attrs: {
265
+ "type": "button",
266
+ "disabled": !_vm.state.enableYearArrow
267
+ },
268
+ on: {
269
+ "click": _vm.leftNextYear
270
+ }
271
+ }, [_c("icon-double-right")], 1) : _vm._e(), _vm.state.unlinkPanels ? _c("button", {
272
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-arrow-right",
273
+ class: {
274
+ "is-disabled": !_vm.state.enableMonthArrow
275
+ },
276
+ attrs: {
277
+ "type": "button",
278
+ "disabled": !_vm.state.enableMonthArrow
279
+ },
280
+ on: {
281
+ "click": _vm.leftNextMonth
282
+ }
283
+ }, [_c("icon-chevron-right")], 1) : _vm._e(), _c("div", [_vm._v(_vm._s(_vm.state.leftLabel))])]), _c("div", {
284
+ staticClass: "tiny-date-range-picker__table"
285
+ }, [_c("date-table", {
286
+ attrs: {
287
+ "selection-mode": "range",
288
+ "date": _vm.state.leftDate,
289
+ "default-value": _vm.state.defaultValue,
290
+ "min-date": _vm.state.minDate,
291
+ "max-date": _vm.state.maxDate,
292
+ "range-state": _vm.state.rangeState,
293
+ "disabled-date": _vm.state.disabledDate,
294
+ "cell-class-name": _vm.state.cellClassName,
295
+ "first-day-of-week": _vm.state.firstDayOfWeek,
296
+ "show-week-number": _vm.showWeekNumber,
297
+ "format-weeks": _vm.formatWeeks
298
+ },
299
+ on: {
300
+ "changerange": _vm.handleChangeRange,
301
+ "pick": _vm.handleRangePick
302
+ }
303
+ })], 1)]), _c("div", {
304
+ staticClass: "tiny-picker-panel__content tiny-date-range-picker__content is-right"
305
+ }, [_c("div", {
306
+ staticClass: "tiny-date-range-picker__header"
307
+ }, [_vm.state.unlinkPanels ? _c("button", {
308
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-d-arrow-left",
309
+ class: {
310
+ "is-disabled": !_vm.state.enableYearArrow
311
+ },
312
+ attrs: {
313
+ "type": "button",
314
+ "disabled": !_vm.state.enableYearArrow
315
+ },
316
+ on: {
317
+ "click": _vm.rightPrevYear
318
+ }
319
+ }, [_c("icon-double-left")], 1) : _vm._e(), _vm.state.unlinkPanels ? _c("button", {
320
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-arrow-left",
321
+ class: {
322
+ "is-disabled": !_vm.state.enableMonthArrow
323
+ },
324
+ attrs: {
325
+ "type": "button",
326
+ "disabled": !_vm.state.enableMonthArrow
327
+ },
328
+ on: {
329
+ "click": _vm.rightPrevMonth
330
+ }
331
+ }, [_c("icon-chevron-left")], 1) : _vm._e(), _c("button", {
332
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-d-arrow-right",
333
+ attrs: {
334
+ "type": "button"
335
+ },
336
+ on: {
337
+ "click": _vm.rightNextYear
338
+ }
339
+ }, [_c("icon-double-right")], 1), _c("button", {
340
+ staticClass: "tiny-picker-panel__icon-btn tiny-icon-arrow-right",
341
+ attrs: {
342
+ "type": "button"
343
+ },
344
+ on: {
345
+ "click": _vm.rightNextMonth
346
+ }
347
+ }, [_c("icon-chevron-right")], 1), _c("div", [_vm._v(_vm._s(_vm.state.rightLabel))])]), _c("div", {
348
+ staticClass: "tiny-date-range-picker__table"
349
+ }, [_c("date-table", {
350
+ attrs: {
351
+ "selection-mode": "range",
352
+ "date": _vm.state.rightDate,
353
+ "default-value": _vm.state.defaultValue,
354
+ "min-date": _vm.state.minDate,
355
+ "max-date": _vm.state.maxDate,
356
+ "range-state": _vm.state.rangeState,
357
+ "disabled-date": _vm.state.disabledDate,
358
+ "cell-class-name": _vm.state.cellClassName,
359
+ "first-day-of-week": _vm.state.firstDayOfWeek,
360
+ "show-week-number": _vm.showWeekNumber,
361
+ "format-weeks": _vm.formatWeeks
362
+ },
363
+ on: {
364
+ "changerange": _vm.handleChangeRange,
365
+ "pick": _vm.handleRangePick
366
+ }
367
+ })], 1)])])], 2), _vm.state.showTime ? _c("div", {
368
+ staticClass: "tiny-picker-panel__footer"
369
+ }, [_c("tiny-button", {
370
+ staticClass: "tiny-picker-panel__link-btn",
371
+ attrs: {
372
+ "type": "text"
373
+ },
374
+ on: {
375
+ "click": _vm.handleClear
376
+ }
377
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.clear")) + " ")]), _c("tiny-button", {
378
+ staticClass: "tiny-picker-panel__link-btn",
379
+ attrs: {
380
+ "plain": _vm.state.confirmButtonProps.plain,
381
+ "type": _vm.state.confirmButtonProps.type,
382
+ "disabled": _vm.state.btnDisabled
383
+ },
384
+ on: {
385
+ "click": function click($event) {
386
+ return _vm.handleConfirm(false);
387
+ }
388
+ }
389
+ }, [_vm._v(" " + _vm._s(_vm.t("ui.datepicker.confirm")) + " ")])], 1) : _vm._e()])]);
390
+ };
391
+ var staticRenderFns = [];
392
+ var __cssModules = {};
393
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
394
+ function __vue2_injectStyles(context) {
395
+ for (var o in __cssModules) {
396
+ this[o] = __cssModules[o];
397
+ }
398
+ }
399
+ var pc = /* @__PURE__ */ function() {
400
+ return __component__.exports;
401
+ }();
402
+
403
+ export { pc as default };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@opentinyvue/vue-date-range",
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-time": "~2.21.0",
15
+ "@opentinyvue/vue-date-table": "~2.21.0",
16
+ "@opentinyvue/vue-theme": "~3.21.0",
17
+ "@opentinyvue/vue-icon": "~2.21.0"
18
+ },
19
+ "license": "MIT",
20
+ "types": "index.d.ts",
21
+ "scripts": {
22
+ "build": "pnpm -w build:ui $npm_package_name",
23
+ "//postversion": "pnpm build"
24
+ }
25
+ }
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: 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,22 @@
1
+ export declare const classes: {
2
+ 'picker-panel': string;
3
+ 'date-range-picker': string;
4
+ sidebar: string;
5
+ shortcut: string;
6
+ 'shortcut-selected': string;
7
+ body: string;
8
+ 'time-header': string;
9
+ content: string;
10
+ header: string;
11
+ 'icon-btn': string;
12
+ 'is-disabled': string;
13
+ 'arrow-left': string;
14
+ 'arrow-right': string;
15
+ 'editors-wrap': string;
16
+ 'is-left': string;
17
+ 'is-right': string;
18
+ 'time-picker-wrap': string;
19
+ 'time-picker-wrap-left': string;
20
+ editor: string;
21
+ footer: string;
22
+ };