@opentinyvue/vue-date-picker-mobile-first 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/index.d.ts +2 -0
- package/lib/index.js +643 -0
- package/package.json +24 -0
- package/src/index.d.ts +2 -0
- package/src/normal.vue.d.ts +2 -0
- package/src/option.vue.d.ts +4 -0
- package/src/year-month-range.vue.d.ts +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - present TinyVue Authors.
|
|
4
|
+
Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import { defineComponent, props, setup, $prefix, $props, $setup } from '@opentinyvue/vue-common';
|
|
2
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/date-picker-mobile/vue';
|
|
3
|
+
import Button from '@opentinyvue/vue-button';
|
|
4
|
+
import TimePickerMobile from '@opentinyvue/vue-time-picker-mobile';
|
|
5
|
+
import ActionSheet from '@opentinyvue/vue-action-sheet';
|
|
6
|
+
import RecycleScroller from '@opentinyvue/vue-recycle-scroller';
|
|
7
|
+
import { t } from '@opentinyvue/vue-locale';
|
|
8
|
+
|
|
9
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
10
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
11
|
+
if (render) {
|
|
12
|
+
options.render = render;
|
|
13
|
+
options.staticRenderFns = staticRenderFns;
|
|
14
|
+
options._compiled = true;
|
|
15
|
+
}
|
|
16
|
+
var hook;
|
|
17
|
+
if (injectStyles) {
|
|
18
|
+
hook = injectStyles;
|
|
19
|
+
}
|
|
20
|
+
if (hook) {
|
|
21
|
+
if (options.functional) {
|
|
22
|
+
options._injectStyles = hook;
|
|
23
|
+
var originalRender = options.render;
|
|
24
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
25
|
+
hook.call(context);
|
|
26
|
+
return originalRender(h, context);
|
|
27
|
+
};
|
|
28
|
+
} else {
|
|
29
|
+
var existing = options.beforeCreate;
|
|
30
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
exports: scriptExports,
|
|
35
|
+
options
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function _extends() {
|
|
40
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
41
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
42
|
+
var t2 = arguments[e];
|
|
43
|
+
for (var r in t2) ({}).hasOwnProperty.call(t2, r) && (n[r] = t2[r]);
|
|
44
|
+
}
|
|
45
|
+
return n;
|
|
46
|
+
}, _extends.apply(null, arguments);
|
|
47
|
+
}
|
|
48
|
+
var render$2 = function render$22() {
|
|
49
|
+
var _vm = this;
|
|
50
|
+
var _h = _vm.$createElement;
|
|
51
|
+
var _c = _vm._self._c || _h;
|
|
52
|
+
return _c("div", {
|
|
53
|
+
staticClass: "w-full flex"
|
|
54
|
+
}, [_vm._t("default", function() {
|
|
55
|
+
return [_vm._v(_vm._s(_vm.data.value))];
|
|
56
|
+
}, {
|
|
57
|
+
"data": _vm.data
|
|
58
|
+
})], 2);
|
|
59
|
+
};
|
|
60
|
+
var staticRenderFns$2 = [];
|
|
61
|
+
var __vue2_script$2 = {
|
|
62
|
+
inheritAttrs: false,
|
|
63
|
+
components: {},
|
|
64
|
+
props: {
|
|
65
|
+
data: Object
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var __cssModules$2 = {};
|
|
69
|
+
var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2);
|
|
70
|
+
function __vue2_injectStyles$2(context) {
|
|
71
|
+
for (var o in __cssModules$2) {
|
|
72
|
+
this[o] = __cssModules$2[o];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
var Option = /* @__PURE__ */ function() {
|
|
76
|
+
return __component__$2.exports;
|
|
77
|
+
}();
|
|
78
|
+
var __vue2_script$1 = defineComponent({
|
|
79
|
+
components: {
|
|
80
|
+
TinyOption: Option,
|
|
81
|
+
TinyActionSheet: ActionSheet,
|
|
82
|
+
TinyTimePickerMobile: TimePickerMobile,
|
|
83
|
+
TinyRecycleScroller: RecycleScroller,
|
|
84
|
+
TinyButton: Button
|
|
85
|
+
},
|
|
86
|
+
emits: ["click", "confirm", "update:visible", "update:modelValue", "time-confirm"],
|
|
87
|
+
props: [].concat(props, ["modelValue", "visible", "title", "type", "lockScroll", "pickerOptions", "customClass", "clearable", "step", "rangeSeparator", "endPlaceholder", "showTimeSecond"]),
|
|
88
|
+
setup: function setup$1(props2, context) {
|
|
89
|
+
return setup({
|
|
90
|
+
props: props2,
|
|
91
|
+
context,
|
|
92
|
+
renderless,
|
|
93
|
+
api
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
var render$1 = function render$12() {
|
|
98
|
+
var _vm = this;
|
|
99
|
+
var _h = _vm.$createElement;
|
|
100
|
+
var _c = _vm._self._c || _h;
|
|
101
|
+
return _c("div", {
|
|
102
|
+
attrs: {
|
|
103
|
+
"data-tag": "tiny-date-picker-mobile"
|
|
104
|
+
}
|
|
105
|
+
}, [_c("tiny-action-sheet", {
|
|
106
|
+
ref: "actionSheet",
|
|
107
|
+
attrs: {
|
|
108
|
+
"title": _vm.title,
|
|
109
|
+
"custom-class": _vm.m("h-full max-h-full rounded-none min-h-[95vh]", _vm.customClass),
|
|
110
|
+
"lock-scroll": _vm.lockScroll,
|
|
111
|
+
"visible": _vm.visible
|
|
112
|
+
},
|
|
113
|
+
on: {
|
|
114
|
+
"update:visible": function updateVisible($event) {
|
|
115
|
+
return _vm.$emit("update:visible", $event);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
scopedSlots: _vm._u([_vm.clearable ? {
|
|
119
|
+
key: "header-left",
|
|
120
|
+
fn: function fn() {
|
|
121
|
+
return [_c("div", {
|
|
122
|
+
staticClass: "cursor-pointer text-color-brand",
|
|
123
|
+
on: {
|
|
124
|
+
"click": _vm.clear
|
|
125
|
+
}
|
|
126
|
+
}, [_vm._v(_vm._s(_vm.t("ui.datepicker.clear")))])];
|
|
127
|
+
},
|
|
128
|
+
proxy: true
|
|
129
|
+
} : null], null, true)
|
|
130
|
+
}, [_c("div", {
|
|
131
|
+
class: ["flex flex-col flex-auto h-full"],
|
|
132
|
+
attrs: {
|
|
133
|
+
"data-tag": "tiny-date-picker-inner"
|
|
134
|
+
}
|
|
135
|
+
}, [_c("div", {
|
|
136
|
+
staticClass: "flex leading-6 py-2.5 px-4 text-sm items-center text-center border-b border-color-bg-4 shadow-sm",
|
|
137
|
+
attrs: {
|
|
138
|
+
"data-tag": "date-picker-header"
|
|
139
|
+
}
|
|
140
|
+
}, _vm._l(7, function(item, index) {
|
|
141
|
+
return _c("div", {
|
|
142
|
+
key: index,
|
|
143
|
+
staticClass: "flex-1"
|
|
144
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.calendarBar.week." + index)) + " ")]);
|
|
145
|
+
}), 0), _c("div", {
|
|
146
|
+
ref: "datePickerBody",
|
|
147
|
+
staticClass: "flex-auto overflow-hidden px-4",
|
|
148
|
+
attrs: {
|
|
149
|
+
"data-tag": "date-picker-body"
|
|
150
|
+
}
|
|
151
|
+
}, [_c("tiny-recycle-scroller", {
|
|
152
|
+
ref: "recycleScroller",
|
|
153
|
+
staticClass: "h-full scrollbar-size-0",
|
|
154
|
+
style: {
|
|
155
|
+
height: _vm.state.scrollerHeight ? _vm.state.scrollerHeight + "px" : null
|
|
156
|
+
},
|
|
157
|
+
attrs: {
|
|
158
|
+
"key-field": "id",
|
|
159
|
+
"items": _vm.state.months,
|
|
160
|
+
"item-size": _vm.state.itemSize,
|
|
161
|
+
"buffer": _vm.state.buffer
|
|
162
|
+
},
|
|
163
|
+
on: {
|
|
164
|
+
"scroll-start": _vm.scrollStart,
|
|
165
|
+
"scroll-end": _vm.scrollEnd
|
|
166
|
+
},
|
|
167
|
+
scopedSlots: _vm._u([{
|
|
168
|
+
key: "default",
|
|
169
|
+
fn: function fn(scopeSlots) {
|
|
170
|
+
return [_c("div", {
|
|
171
|
+
staticClass: "mt-4"
|
|
172
|
+
}, [_c("div", {
|
|
173
|
+
staticClass: "text-xl leading-7 text-color-text-primary"
|
|
174
|
+
}, [_vm._v(" " + _vm._s(_vm.formatDate(scopeSlots.item.yearMonth, _vm.t("ui.datepicker.yearMonth", {
|
|
175
|
+
year: "yyyy",
|
|
176
|
+
month: "MM"
|
|
177
|
+
}))) + " ")]), _c("div", {
|
|
178
|
+
staticClass: "text-center leading-9 text-xs font-medium"
|
|
179
|
+
}, _vm._l(_vm.getWeeksByMonth(scopeSlots.item.yearMonth), function(item, week) {
|
|
180
|
+
return _c("div", {
|
|
181
|
+
key: week,
|
|
182
|
+
class: ["flex mt-2"]
|
|
183
|
+
}, _vm._l(7, function(item2, index) {
|
|
184
|
+
return _c("div", {
|
|
185
|
+
key: index,
|
|
186
|
+
class: ["flex-1 h-9 cursor-pointer", index === 0 || index === 6 ? "text-color-text-placeholder" : "text-color-text-primary"],
|
|
187
|
+
on: {
|
|
188
|
+
"click": function click($event) {
|
|
189
|
+
$event.stopPropagation();
|
|
190
|
+
return _vm.selectOption({
|
|
191
|
+
value: scopeSlots.item.yearMonth,
|
|
192
|
+
index: index + week * 7
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, [_c("tiny-option", {
|
|
197
|
+
attrs: {
|
|
198
|
+
"data": _vm.getDate({
|
|
199
|
+
yearMonth: scopeSlots.item.yearMonth,
|
|
200
|
+
index: index + week * 7
|
|
201
|
+
})
|
|
202
|
+
},
|
|
203
|
+
scopedSlots: _vm._u([{
|
|
204
|
+
key: "default",
|
|
205
|
+
fn: function fn2(_ref) {
|
|
206
|
+
var data = _ref.data;
|
|
207
|
+
return [_c("div", {
|
|
208
|
+
class: ["flex-1", {
|
|
209
|
+
"bg-color-info-primary-subtler": !data.disabled && _vm.state.date.length === 2 && ["end", "inner"].includes(_vm.getSelectedPosition(data.value))
|
|
210
|
+
}, {
|
|
211
|
+
"rounded-l": index === 0
|
|
212
|
+
}]
|
|
213
|
+
}), _c("div", {
|
|
214
|
+
class: _vm.m("w-9 h-9", {
|
|
215
|
+
"text-color-brand border-0.5 border-current rounded": data.isToday
|
|
216
|
+
}, {
|
|
217
|
+
"bg-color-info-primary-subtler": ["inner"].includes(_vm.getSelectedPosition(data.value))
|
|
218
|
+
}, {
|
|
219
|
+
"bg-color-brand text-color-text-inverse rounded": ["start", "end"].includes(_vm.getSelectedPosition(data.value))
|
|
220
|
+
}, {
|
|
221
|
+
"bg-white text-color-text-disabled cursor-not-allowed": data.disabled
|
|
222
|
+
})
|
|
223
|
+
}, [_vm._t("default", function() {
|
|
224
|
+
return [_vm._v(" " + _vm._s(data.day) + " ")];
|
|
225
|
+
}, {
|
|
226
|
+
"data": data
|
|
227
|
+
})], 2), _c("div", {
|
|
228
|
+
class: ["flex-1", {
|
|
229
|
+
"bg-color-info-primary-subtler": !data.disabled && _vm.state.date.length === 2 && _vm.state.selected.length > 1 && ["start", "inner"].includes(_vm.getSelectedPosition(data.value))
|
|
230
|
+
}, {
|
|
231
|
+
"rounded-r": index === 6
|
|
232
|
+
}]
|
|
233
|
+
})];
|
|
234
|
+
}
|
|
235
|
+
}], null, true)
|
|
236
|
+
})], 1);
|
|
237
|
+
}), 0);
|
|
238
|
+
}), 0)])];
|
|
239
|
+
}
|
|
240
|
+
}])
|
|
241
|
+
})], 1), _c("div", {
|
|
242
|
+
staticClass: "flex flex-none flex-col items-center justify-center p-4 border-t border-color-bg-4 shadow-sm",
|
|
243
|
+
attrs: {
|
|
244
|
+
"data-tag": "date-picker-footer"
|
|
245
|
+
}
|
|
246
|
+
}, [["datetimerange", "daterange"].includes(_vm.type) && _vm.state.date.length ? _c("div", {
|
|
247
|
+
staticClass: "w-full",
|
|
248
|
+
attrs: {
|
|
249
|
+
"data-tag": "rang-box"
|
|
250
|
+
}
|
|
251
|
+
}, [_c("div", {
|
|
252
|
+
staticClass: "w-full flex mb-4 h-6 leading-6 text-base text-center"
|
|
253
|
+
}, [_c("div", {
|
|
254
|
+
staticClass: "min-w-[theme(spacing.32)]"
|
|
255
|
+
}, [_vm._v(" " + _vm._s(_vm.formatDate(_vm.state.date[0], _vm.t("ui.datepicker.yearMonthDay", {
|
|
256
|
+
year: "yyyy",
|
|
257
|
+
month: "MM",
|
|
258
|
+
day: "dd"
|
|
259
|
+
}))) + " ")]), _c("div", {
|
|
260
|
+
staticClass: "flex-auto min-w-[theme(spacing.4)]"
|
|
261
|
+
}, [["datetimerange"].includes(_vm.type) ? _c("div", {
|
|
262
|
+
staticClass: "h-9 border-l-0.5 inline-block rotate-45 relative top-6 border-color-bg-2"
|
|
263
|
+
}) : _c("div", {
|
|
264
|
+
staticClass: "text-center"
|
|
265
|
+
}, [typeof _vm.rangeSeparator === "string" ? [_vm._v(_vm._s(_vm.rangeSeparator))] : _c(_vm.rangeSeparator, {
|
|
266
|
+
tag: "component"
|
|
267
|
+
})], 2)]), _c("div", {
|
|
268
|
+
staticClass: "min-w-[theme(spacing.32)]"
|
|
269
|
+
}, [_vm.state.btnDisabled ? _c("span", {
|
|
270
|
+
staticClass: "text-color-icon-placeholder"
|
|
271
|
+
}, [_vm._v(_vm._s(_vm.endPlaceholder))]) : _c("span", [_vm._v(_vm._s(_vm.formatDate(_vm.state.date[1], _vm.t("ui.datepicker.yearMonthDay", {
|
|
272
|
+
year: "yyyy",
|
|
273
|
+
month: "MM",
|
|
274
|
+
day: "dd"
|
|
275
|
+
}))))])])]), _vm.type === "datetimerange" ? _c("div", {
|
|
276
|
+
staticClass: "w-full h-9 flex mb-4 leading-9 text-base text-center"
|
|
277
|
+
}, [_c("div", {
|
|
278
|
+
staticClass: "w-32 bg-color-bg-2",
|
|
279
|
+
on: {
|
|
280
|
+
"click": function click($event) {
|
|
281
|
+
$event.stopPropagation();
|
|
282
|
+
return _vm.timeToggle(0);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}, [_vm._v(_vm._s(_vm.state.timeList[0].join(":")))]), _c("div", {
|
|
286
|
+
staticClass: "flex-auto min-w-[theme(spacing.4)]"
|
|
287
|
+
}), _c("div", {
|
|
288
|
+
staticClass: "w-32 bg-color-bg-2",
|
|
289
|
+
on: {
|
|
290
|
+
"click": function click($event) {
|
|
291
|
+
$event.stopPropagation();
|
|
292
|
+
return _vm.timeToggle(1);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}, [_vm._v(_vm._s(_vm.state.timeList[1].join(":")))])]) : _vm._e()]) : _vm._e(), ["datetime"].includes(_vm.type) && _vm.state.date ? _c("div", {
|
|
296
|
+
staticClass: "w-full",
|
|
297
|
+
attrs: {
|
|
298
|
+
"data-tag": "datetime-box"
|
|
299
|
+
}
|
|
300
|
+
}, [_c("div", {
|
|
301
|
+
staticClass: "w-full flex mb-4 leading-6 text-base text-center"
|
|
302
|
+
}, [_c("div", {
|
|
303
|
+
staticClass: "min-w-[theme(spacing.32)]"
|
|
304
|
+
}, [_vm._v(" " + _vm._s(_vm.formatDate(_vm.state.date, _vm.t("ui.datepicker.yearMonthDay", {
|
|
305
|
+
year: "yyyy",
|
|
306
|
+
month: "MM",
|
|
307
|
+
day: "dd"
|
|
308
|
+
}))) + " ")]), _c("div", {
|
|
309
|
+
staticClass: "flex-auto min-w-[theme(spacing.4)]"
|
|
310
|
+
}), _c("div", {
|
|
311
|
+
staticClass: "w-32 bg-color-bg-2",
|
|
312
|
+
on: {
|
|
313
|
+
"click": function click($event) {
|
|
314
|
+
$event.stopPropagation();
|
|
315
|
+
return _vm.timeToggle(0);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}, [_vm._v(_vm._s(_vm.state.timeList[0].join(":")))])])]) : _vm._e(), _c("div", {
|
|
319
|
+
staticClass: "w-full text-center"
|
|
320
|
+
}, [_c("tiny-button", {
|
|
321
|
+
attrs: {
|
|
322
|
+
"tiny_mode": "mobile-first",
|
|
323
|
+
"custom-class": "w-full",
|
|
324
|
+
"disabled": _vm.state.btnDisabled,
|
|
325
|
+
"type": "primary",
|
|
326
|
+
"size": "medium",
|
|
327
|
+
"reset-time": 0
|
|
328
|
+
},
|
|
329
|
+
on: {
|
|
330
|
+
"click": _vm.confirm
|
|
331
|
+
}
|
|
332
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.button.confirm")) + " ")])], 1)])])]), _c("tiny-time-picker-mobile", {
|
|
333
|
+
attrs: {
|
|
334
|
+
"title": _vm.t("ui.datepicker.selectTime"),
|
|
335
|
+
"step": _vm.step,
|
|
336
|
+
"show-seconds": _vm.showTimeSecond,
|
|
337
|
+
"visible": _vm.state.timeVisible
|
|
338
|
+
},
|
|
339
|
+
on: {
|
|
340
|
+
"update:visible": function updateVisible($event) {
|
|
341
|
+
_vm.state.timeVisible = $event;
|
|
342
|
+
},
|
|
343
|
+
"confirm": _vm.timeConfirm
|
|
344
|
+
},
|
|
345
|
+
model: {
|
|
346
|
+
value: _vm.state.time,
|
|
347
|
+
callback: function callback($$v) {
|
|
348
|
+
_vm.$set(_vm.state, "time", $$v);
|
|
349
|
+
},
|
|
350
|
+
expression: "state.time"
|
|
351
|
+
}
|
|
352
|
+
})], 1);
|
|
353
|
+
};
|
|
354
|
+
var staticRenderFns$1 = [];
|
|
355
|
+
var __cssModules$1 = {};
|
|
356
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1);
|
|
357
|
+
function __vue2_injectStyles$1(context) {
|
|
358
|
+
for (var o in __cssModules$1) {
|
|
359
|
+
this[o] = __cssModules$1[o];
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
var NormalTemplate = /* @__PURE__ */ function() {
|
|
363
|
+
return __component__$1.exports;
|
|
364
|
+
}();
|
|
365
|
+
var __vue2_script = defineComponent({
|
|
366
|
+
components: {
|
|
367
|
+
TinyOption: Option,
|
|
368
|
+
TinyActionSheet: ActionSheet,
|
|
369
|
+
TinyRecycleScroller: RecycleScroller,
|
|
370
|
+
TinyButton: Button
|
|
371
|
+
},
|
|
372
|
+
emits: ["click", "confirm", "update:visible", "update:modelValue", "time-confirm"],
|
|
373
|
+
props: [].concat(props, ["modelValue", "visible", "title", "type", "lockScroll", "pickerOptions"]),
|
|
374
|
+
setup: function setup2(props2, context) {
|
|
375
|
+
return setup({
|
|
376
|
+
props: props2,
|
|
377
|
+
context,
|
|
378
|
+
renderless,
|
|
379
|
+
api
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
var render = function render2() {
|
|
384
|
+
var _vm = this;
|
|
385
|
+
var _h = _vm.$createElement;
|
|
386
|
+
var _c = _vm._self._c || _h;
|
|
387
|
+
return _c("div", {
|
|
388
|
+
attrs: {
|
|
389
|
+
"data-tag": "tiny-date-picker-mobile year-month"
|
|
390
|
+
}
|
|
391
|
+
}, [_c("tiny-action-sheet", {
|
|
392
|
+
attrs: {
|
|
393
|
+
"custom-class": "h-full",
|
|
394
|
+
"title": _vm.title,
|
|
395
|
+
"lock-scroll": _vm.lockScroll,
|
|
396
|
+
"visible": _vm.visible
|
|
397
|
+
},
|
|
398
|
+
on: {
|
|
399
|
+
"update:visible": function updateVisible($event) {
|
|
400
|
+
return _vm.$emit("update:visible", $event);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}, [_c("div", {
|
|
404
|
+
class: ["flex flex-col overflow-hidden"],
|
|
405
|
+
attrs: {
|
|
406
|
+
"data-tag": "tiny-date-picker-inner"
|
|
407
|
+
}
|
|
408
|
+
}, [_c("div", {
|
|
409
|
+
ref: "datePickerBody",
|
|
410
|
+
staticClass: "flex-auto overflow-hidden px-4",
|
|
411
|
+
attrs: {
|
|
412
|
+
"data-tag": "date-picker-body"
|
|
413
|
+
}
|
|
414
|
+
}, [_c("tiny-recycle-scroller", {
|
|
415
|
+
ref: "recycleScroller",
|
|
416
|
+
staticClass: "h-full scrollbar-size-0",
|
|
417
|
+
style: {
|
|
418
|
+
height: _vm.state.scrollerHeight ? _vm.state.scrollerHeight + "px" : null
|
|
419
|
+
},
|
|
420
|
+
attrs: {
|
|
421
|
+
"key-field": "id",
|
|
422
|
+
"items": _vm.state.computedYears,
|
|
423
|
+
"item-size": _vm.state.itemSize,
|
|
424
|
+
"buffer": _vm.state.buffer
|
|
425
|
+
},
|
|
426
|
+
on: {
|
|
427
|
+
"scroll-start": _vm.scrollStart,
|
|
428
|
+
"scroll-end": _vm.scrollEnd
|
|
429
|
+
},
|
|
430
|
+
scopedSlots: _vm._u([{
|
|
431
|
+
key: "default",
|
|
432
|
+
fn: function fn(scopeSlots) {
|
|
433
|
+
return [_c("div", {
|
|
434
|
+
staticClass: "mt-4"
|
|
435
|
+
}, [_c("div", {
|
|
436
|
+
staticClass: "text-xl leading-7"
|
|
437
|
+
}, [_vm._v(_vm._s(scopeSlots.item.year) + _vm._s(_vm.t("ui.datepicker.year")))]), _c("div", {
|
|
438
|
+
staticClass: "text-center leading-9 text-xs font-medium"
|
|
439
|
+
}, _vm._l(2, function(v, row) {
|
|
440
|
+
return _c("div", {
|
|
441
|
+
key: row,
|
|
442
|
+
class: ["flex mt-2"]
|
|
443
|
+
}, _vm._l(6, function(v2, col) {
|
|
444
|
+
return _c("div", {
|
|
445
|
+
key: col,
|
|
446
|
+
class: ["flex-1 h-9 cursor-pointer"],
|
|
447
|
+
on: {
|
|
448
|
+
"click": function click($event) {
|
|
449
|
+
$event.stopPropagation();
|
|
450
|
+
return _vm.selectOption({
|
|
451
|
+
value: scopeSlots.item.year,
|
|
452
|
+
index: row * 6 + col
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}, [_c("tiny-option", {
|
|
457
|
+
attrs: {
|
|
458
|
+
"data": _vm.state.years[scopeSlots.item.year][row * 6 + col]
|
|
459
|
+
},
|
|
460
|
+
scopedSlots: _vm._u([{
|
|
461
|
+
key: "default",
|
|
462
|
+
fn: function fn2(_ref) {
|
|
463
|
+
var data = _ref.data;
|
|
464
|
+
return [_c("div", {
|
|
465
|
+
class: ["flex-1", {
|
|
466
|
+
"bg-color-info-primary-subtler": !data.disabled && _vm.state.date.length === 2 && ["end", "inner"].includes(_vm.getSelectedPosition(data.value))
|
|
467
|
+
}]
|
|
468
|
+
}), _c("div", {
|
|
469
|
+
class: _vm.m("w-9 h-9", {
|
|
470
|
+
"text-color-brand border-0.5 border-current": data.isToday
|
|
471
|
+
}, {
|
|
472
|
+
"bg-color-info-primary-subtler": ["inner"].includes(_vm.getSelectedPosition(data.value))
|
|
473
|
+
}, {
|
|
474
|
+
"bg-color-brand text-color-text-inverse": ["start", "end"].includes(_vm.getSelectedPosition(data.value))
|
|
475
|
+
}, {
|
|
476
|
+
"bg-white text-color-text-disabled cursor-not-allowed": data.disabled
|
|
477
|
+
})
|
|
478
|
+
}, [_vm._t("default", function() {
|
|
479
|
+
return [_vm._v(" " + _vm._s(data.month) + " ")];
|
|
480
|
+
}, {
|
|
481
|
+
"data": data
|
|
482
|
+
})], 2), _c("div", {
|
|
483
|
+
class: ["flex-1", {
|
|
484
|
+
"bg-color-info-primary-subtler": !data.disabled && _vm.state.date.length === 2 && _vm.state.selected.length > 1 && ["start", "inner"].includes(_vm.getSelectedPosition(data.value))
|
|
485
|
+
}]
|
|
486
|
+
})];
|
|
487
|
+
}
|
|
488
|
+
}], null, true)
|
|
489
|
+
})], 1);
|
|
490
|
+
}), 0);
|
|
491
|
+
}), 0)])];
|
|
492
|
+
}
|
|
493
|
+
}])
|
|
494
|
+
})], 1), _c("div", {
|
|
495
|
+
staticClass: "w-full flex-none flex flex-col items-center justify-center p-4 border-t border-color-bg-4 shadow-sm",
|
|
496
|
+
attrs: {
|
|
497
|
+
"data-tag": "date-picker-footer"
|
|
498
|
+
}
|
|
499
|
+
}, [["year-month-range"].includes(_vm.type) && _vm.state.date.length ? _c("div", {
|
|
500
|
+
staticClass: "w-full",
|
|
501
|
+
attrs: {
|
|
502
|
+
"data-tag": "rang-box"
|
|
503
|
+
}
|
|
504
|
+
}, [_c("div", {
|
|
505
|
+
staticClass: "w-full flex mb-4 h-6 leading-6 text-base text-center"
|
|
506
|
+
}, [_c("div", {
|
|
507
|
+
staticClass: "min-w-[theme(spacing.32)]"
|
|
508
|
+
}, [_vm._v(" " + _vm._s(_vm.formatDate(_vm.state.date[0], _vm.t("ui.datepicker.yearMonth", {
|
|
509
|
+
year: "yyyy",
|
|
510
|
+
month: "MM"
|
|
511
|
+
}))) + " ")]), _c("div", {
|
|
512
|
+
staticClass: "flex-auto min-w-[theme(spacing.4)] justify-center"
|
|
513
|
+
}, [_vm._v("~")]), _c("div", {
|
|
514
|
+
staticClass: "min-w-[theme(spacing.32)]"
|
|
515
|
+
}, [_vm.state.btnDisabled ? _c("span", {
|
|
516
|
+
staticClass: "text-color-icon-placeholder"
|
|
517
|
+
}, [_vm._v(_vm._s(_vm.t("ui.datepicker.endTime")))]) : _c("span", [_vm._v(_vm._s(_vm.formatDate(_vm.state.date[1], _vm.t("ui.datepicker.yearMonth", {
|
|
518
|
+
year: "yyyy",
|
|
519
|
+
month: "MM"
|
|
520
|
+
}))))])])])]) : _vm._e(), _c("div", {
|
|
521
|
+
staticClass: "w-full text-center"
|
|
522
|
+
}, [_c("tiny-button", {
|
|
523
|
+
attrs: {
|
|
524
|
+
"tiny_mode": "mobile-first",
|
|
525
|
+
"custom-class": "w-full",
|
|
526
|
+
"disabled": _vm.state.btnDisabled,
|
|
527
|
+
"type": "primary",
|
|
528
|
+
"size": "medium",
|
|
529
|
+
"reset-time": 0
|
|
530
|
+
},
|
|
531
|
+
on: {
|
|
532
|
+
"click": _vm.confirm
|
|
533
|
+
}
|
|
534
|
+
}, [_vm._v(" " + _vm._s(_vm.t("ui.button.confirm")) + " ")])], 1)])])])], 1);
|
|
535
|
+
};
|
|
536
|
+
var staticRenderFns = [];
|
|
537
|
+
var __cssModules = {};
|
|
538
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
539
|
+
function __vue2_injectStyles(context) {
|
|
540
|
+
for (var o in __cssModules) {
|
|
541
|
+
this[o] = __cssModules[o];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
var YearMonthTemplate = /* @__PURE__ */ function() {
|
|
545
|
+
return __component__.exports;
|
|
546
|
+
}();
|
|
547
|
+
var $constants = {
|
|
548
|
+
TYPE: {
|
|
549
|
+
DATE: "date",
|
|
550
|
+
DATE_TIME: "datetime",
|
|
551
|
+
DATE_RANGE: "daterange",
|
|
552
|
+
DATE_TIME_RANGE: "datetimerange",
|
|
553
|
+
YEAR_MONTH_RANGE: "year-month-range",
|
|
554
|
+
YEAR_MONTH: "year-month"
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
var template = function template2(mode, props2) {
|
|
558
|
+
var _$constants$TYPE = $constants.TYPE, YEAR_MONTH_RANGE = _$constants$TYPE.YEAR_MONTH_RANGE, YEAR_MONTH = _$constants$TYPE.YEAR_MONTH;
|
|
559
|
+
return [YEAR_MONTH_RANGE, YEAR_MONTH].includes(props2.type) ? YearMonthTemplate : NormalTemplate;
|
|
560
|
+
};
|
|
561
|
+
var DatePickerMobile = defineComponent({
|
|
562
|
+
name: $prefix + "DatePickerMobile",
|
|
563
|
+
props: _extends({}, $props, {
|
|
564
|
+
_constants: {
|
|
565
|
+
type: Object,
|
|
566
|
+
default: function _default() {
|
|
567
|
+
return $constants;
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
modelValue: [Number, String, Array, Date],
|
|
571
|
+
visible: {
|
|
572
|
+
type: Boolean,
|
|
573
|
+
default: false
|
|
574
|
+
},
|
|
575
|
+
title: String,
|
|
576
|
+
type: {
|
|
577
|
+
type: String,
|
|
578
|
+
default: "date",
|
|
579
|
+
validator: function validator(value) {
|
|
580
|
+
return !value || ~Object.values($constants.TYPE).indexOf(value);
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
clearable: {
|
|
584
|
+
type: Boolean,
|
|
585
|
+
default: false
|
|
586
|
+
},
|
|
587
|
+
lockScroll: {
|
|
588
|
+
type: Boolean,
|
|
589
|
+
default: true
|
|
590
|
+
},
|
|
591
|
+
pickerOptions: {
|
|
592
|
+
type: Object,
|
|
593
|
+
default: function _default2() {
|
|
594
|
+
return {
|
|
595
|
+
disabledDate: null
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
customClass: [String, Object, Array],
|
|
600
|
+
step: {
|
|
601
|
+
type: Object,
|
|
602
|
+
default: function _default3() {
|
|
603
|
+
return {
|
|
604
|
+
hour: 1,
|
|
605
|
+
minute: 1,
|
|
606
|
+
second: 1
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
endPlaceholder: {
|
|
611
|
+
type: String,
|
|
612
|
+
default: function _default4() {
|
|
613
|
+
return t("ui.datepicker.endTime");
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
rangeSeparator: {
|
|
617
|
+
type: [Object, String],
|
|
618
|
+
default: "~"
|
|
619
|
+
},
|
|
620
|
+
showTimeSecond: {
|
|
621
|
+
type: Boolean,
|
|
622
|
+
default: true
|
|
623
|
+
}
|
|
624
|
+
}),
|
|
625
|
+
setup: function setup3(props2, context) {
|
|
626
|
+
return $setup({
|
|
627
|
+
props: props2,
|
|
628
|
+
context,
|
|
629
|
+
template
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
var version = "2.21.0";
|
|
634
|
+
DatePickerMobile.model = {
|
|
635
|
+
prop: "modelValue",
|
|
636
|
+
event: "update:modelValue"
|
|
637
|
+
};
|
|
638
|
+
DatePickerMobile.install = function(Vue) {
|
|
639
|
+
Vue.component(DatePickerMobile.name, DatePickerMobile);
|
|
640
|
+
};
|
|
641
|
+
DatePickerMobile.version = version;
|
|
642
|
+
|
|
643
|
+
export { DatePickerMobile as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-date-picker-mobile-first",
|
|
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-action-sheet": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-button": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
13
|
+
"@opentinyvue/vue-time-picker-mobile": "~2.21.0",
|
|
14
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
15
|
+
"@opentinyvue/vue-locale": "~2.21.0",
|
|
16
|
+
"@opentinyvue/vue-recycle-scroller": "~2.21.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"types": "index.d.ts",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "pnpm -w build:ui $npm_package_name",
|
|
22
|
+
"//postversion": "pnpm build"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/index.d.ts
ADDED