@opentinyvue/vue-calendar-bar 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 +67 -0
- package/lib/mobile-first.js +266 -0
- package/package.json +21 -0
- package/src/calendar-item.vue.d.ts +2 -0
- package/src/index.d.ts +2 -0
- package/src/mobile-first.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,67 @@
|
|
|
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 MobileFirstTemplate from "./mobile-first.js";
|
|
12
|
+
var template = function template2(mode) {
|
|
13
|
+
var _process$env;
|
|
14
|
+
typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
|
|
15
|
+
return MobileFirstTemplate;
|
|
16
|
+
};
|
|
17
|
+
var $constants = {
|
|
18
|
+
POSITON: {
|
|
19
|
+
START: "start",
|
|
20
|
+
CENTER: "center",
|
|
21
|
+
END: "end"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var CalendarBar = defineComponent({
|
|
25
|
+
name: $prefix + "CalendarBar",
|
|
26
|
+
props: _extends({}, $props, {
|
|
27
|
+
_constants: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: function _default() {
|
|
30
|
+
return $constants;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
modelValue: String,
|
|
34
|
+
config: {
|
|
35
|
+
type: Object,
|
|
36
|
+
default: function _default2() {
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
cascaderPosition: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "center",
|
|
43
|
+
validator: function validator(value) {
|
|
44
|
+
return Boolean(~Object.values($constants.POSITON).indexOf(value));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
setup: function setup(props, context) {
|
|
49
|
+
return $setup({
|
|
50
|
+
props,
|
|
51
|
+
context,
|
|
52
|
+
template
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var version = "2.21.0";
|
|
57
|
+
CalendarBar.model = {
|
|
58
|
+
prop: "modelValue",
|
|
59
|
+
event: "update:modelValue"
|
|
60
|
+
};
|
|
61
|
+
CalendarBar.install = function(Vue) {
|
|
62
|
+
Vue.component(CalendarBar.name, CalendarBar);
|
|
63
|
+
};
|
|
64
|
+
CalendarBar.version = version;
|
|
65
|
+
export {
|
|
66
|
+
CalendarBar as default
|
|
67
|
+
};
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/calendar-bar/vue';
|
|
2
|
+
import { defineComponent, h, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import { IconChevronDown } from '@opentinyvue/vue-icon';
|
|
4
|
+
import CascaderSelect from '@opentinyvue/vue-cascader-select';
|
|
5
|
+
|
|
6
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
7
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
8
|
+
if (render) {
|
|
9
|
+
options.render = render;
|
|
10
|
+
options.staticRenderFns = staticRenderFns;
|
|
11
|
+
options._compiled = true;
|
|
12
|
+
}
|
|
13
|
+
var hook;
|
|
14
|
+
if (injectStyles) {
|
|
15
|
+
hook = injectStyles;
|
|
16
|
+
}
|
|
17
|
+
if (hook) {
|
|
18
|
+
if (options.functional) {
|
|
19
|
+
options._injectStyles = hook;
|
|
20
|
+
var originalRender = options.render;
|
|
21
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
22
|
+
hook.call(context);
|
|
23
|
+
return originalRender(h, context);
|
|
24
|
+
};
|
|
25
|
+
} else {
|
|
26
|
+
var existing = options.beforeCreate;
|
|
27
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
exports: scriptExports,
|
|
32
|
+
options
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var __vue2_script$1 = defineComponent({
|
|
37
|
+
name: "CalendarItem",
|
|
38
|
+
props: {
|
|
39
|
+
text: String,
|
|
40
|
+
day: [String, Object],
|
|
41
|
+
config: Object
|
|
42
|
+
},
|
|
43
|
+
emits: ["clickday"],
|
|
44
|
+
render: function render() {
|
|
45
|
+
var _this = this;
|
|
46
|
+
var text = this.text, day = this.day, config = this.config, $emit = this.$emit;
|
|
47
|
+
var renderItem = config.renderItem, render4 = config.render;
|
|
48
|
+
if (typeof render4 === "function") {
|
|
49
|
+
return render4({
|
|
50
|
+
h,
|
|
51
|
+
item: day,
|
|
52
|
+
text,
|
|
53
|
+
config
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
var child = typeof renderItem === "function" ? renderItem({
|
|
57
|
+
h,
|
|
58
|
+
item: day,
|
|
59
|
+
text
|
|
60
|
+
}) : "";
|
|
61
|
+
var backgroundColorClass = "";
|
|
62
|
+
var markVnode = null;
|
|
63
|
+
var ons = {};
|
|
64
|
+
child = child || h("span", text);
|
|
65
|
+
if (day && day.disabled) {
|
|
66
|
+
backgroundColorClass = config && config.disabledBackgroundColorClass || "bg-color-bg-4";
|
|
67
|
+
} else {
|
|
68
|
+
ons.click = function() {
|
|
69
|
+
return $emit.apply(_this, ["clickday", day]);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (day && day.type === "cur" && day.isCur) {
|
|
73
|
+
backgroundColorClass = config && config.currentBackgroundColorClass || "bg-color-brand";
|
|
74
|
+
}
|
|
75
|
+
var itemClass = ["w-8 h-8 rounded-sm flex justify-center items-center", day && day.disabled ? "cursor-not-allowed" : "cursor-pointer", backgroundColorClass];
|
|
76
|
+
var itemAttrs = {
|
|
77
|
+
class: itemClass,
|
|
78
|
+
on: ons,
|
|
79
|
+
attrs: {}
|
|
80
|
+
};
|
|
81
|
+
itemAttrs.attrs["data-tag"] = "tiny-mobile-calendar-bar-item";
|
|
82
|
+
if (day && day.marked) {
|
|
83
|
+
markVnode = h("div", {
|
|
84
|
+
class: ["absolute w-1.5 h-1.5 left-1/2 bottom-0.5 -translate-x-1/2 rounded-full cursor-pointer", config && config.markBackgroundColorClass || "bg-color-brand"],
|
|
85
|
+
attrs: {
|
|
86
|
+
title: config && config.showMarkMessage ? day.markMsg : ""
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return h("div", {
|
|
91
|
+
class: "w-full h-full flex justify-center items-center relative"
|
|
92
|
+
}, [h("div", itemAttrs, [child]), markVnode]);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
var __vue2_render, __vue2_staticRenderFns;
|
|
96
|
+
var __cssModules$1 = {};
|
|
97
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, __vue2_render, __vue2_staticRenderFns, false, __vue2_injectStyles$1);
|
|
98
|
+
function __vue2_injectStyles$1(context) {
|
|
99
|
+
for (var o in __cssModules$1) {
|
|
100
|
+
this[o] = __cssModules$1[o];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
var CalendarItem = /* @__PURE__ */ function() {
|
|
104
|
+
return __component__$1.exports;
|
|
105
|
+
}();
|
|
106
|
+
var __vue2_script = defineComponent({
|
|
107
|
+
emits: ["update:modelValue", "expand", "week-change"],
|
|
108
|
+
props: [].concat(props, ["modelValue", "config", "cascaderPosition"]),
|
|
109
|
+
components: {
|
|
110
|
+
TinyCascaderSelect: CascaderSelect,
|
|
111
|
+
IconChevronDown: IconChevronDown(),
|
|
112
|
+
CalendarItem
|
|
113
|
+
},
|
|
114
|
+
setup: function setup$1(props2, context) {
|
|
115
|
+
return setup({
|
|
116
|
+
props: props2,
|
|
117
|
+
context,
|
|
118
|
+
renderless,
|
|
119
|
+
api
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
var render2 = function render3() {
|
|
124
|
+
var _vm = this;
|
|
125
|
+
var _h = _vm.$createElement;
|
|
126
|
+
var _c = _vm._self._c || _h;
|
|
127
|
+
return _c("div", {
|
|
128
|
+
staticClass: "select-none",
|
|
129
|
+
attrs: {
|
|
130
|
+
"data-tag": "tiny-calendar-bar"
|
|
131
|
+
}
|
|
132
|
+
}, [_c("div", {
|
|
133
|
+
class: ["w-full h-11 flex items-center text-sm text-color-text-primary", "border-b-0.5 border-solid border-color-border-separator", {
|
|
134
|
+
"justify-start": _vm.cascaderPosition === "start",
|
|
135
|
+
"justify-center": _vm.cascaderPosition === "center",
|
|
136
|
+
"justify-end": _vm.cascaderPosition === "end"
|
|
137
|
+
}],
|
|
138
|
+
attrs: {
|
|
139
|
+
"data-tag": "tiny-calendar-bar-content"
|
|
140
|
+
}
|
|
141
|
+
}, [_c("div", {
|
|
142
|
+
staticClass: "w-max h-6 flex items-center cursor-pointer space-x-1.5",
|
|
143
|
+
attrs: {
|
|
144
|
+
"data-tag": "tiny-calendar-bar-visible"
|
|
145
|
+
},
|
|
146
|
+
on: {
|
|
147
|
+
"click": function click($event) {
|
|
148
|
+
return _vm.setCascaderVisible(true);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, [_c("span", [_vm._v(_vm._s(_vm.i18nYearMonth()))]), _c("span", {
|
|
152
|
+
staticClass: "-translate-y-px fill-color-icon-primary"
|
|
153
|
+
}, [_c("icon-chevron-down", {
|
|
154
|
+
class: {
|
|
155
|
+
"rotate-180": _vm.state.cascaderVisible
|
|
156
|
+
}
|
|
157
|
+
})], 1)])]), _c("div", {
|
|
158
|
+
ref: "weekPanel",
|
|
159
|
+
staticClass: "w-full h-max overflow-hidden",
|
|
160
|
+
attrs: {
|
|
161
|
+
"data-tag": "tiny-calendar-bar-gridbox"
|
|
162
|
+
}
|
|
163
|
+
}, [_c("div", {
|
|
164
|
+
staticClass: "grid grid-cols-7"
|
|
165
|
+
}, _vm._l(_vm.state.weekDays, function(weekDay) {
|
|
166
|
+
return _c("div", {
|
|
167
|
+
key: weekDay,
|
|
168
|
+
staticClass: "text-xs",
|
|
169
|
+
style: _vm.state.minSize2,
|
|
170
|
+
attrs: {
|
|
171
|
+
"data-tag": "tiny-calendar-bar-weekday"
|
|
172
|
+
}
|
|
173
|
+
}, [_c("calendar-item", {
|
|
174
|
+
attrs: {
|
|
175
|
+
"text": _vm.t("ui.calendarBar.week." + weekDay),
|
|
176
|
+
"day": "" + weekDay,
|
|
177
|
+
"config": _vm.config
|
|
178
|
+
}
|
|
179
|
+
})], 1);
|
|
180
|
+
}), 0), _c("div", {
|
|
181
|
+
staticClass: "h-max flex relative right-full will-change-transform",
|
|
182
|
+
style: {
|
|
183
|
+
"width": " 300%",
|
|
184
|
+
"transform": "translateX(" + _vm.state.delta + "px)",
|
|
185
|
+
"transition-duration": _vm.state.duration + "ms"
|
|
186
|
+
},
|
|
187
|
+
on: {
|
|
188
|
+
"touchstart": _vm.touchstart,
|
|
189
|
+
"touchend": _vm.touchend,
|
|
190
|
+
"touchmove": _vm.touchmove
|
|
191
|
+
}
|
|
192
|
+
}, [_c("div", {
|
|
193
|
+
ref: "calendarPanel",
|
|
194
|
+
staticClass: "w-full flex"
|
|
195
|
+
}, _vm._l(_vm.state.data, function(calendarDays, idx) {
|
|
196
|
+
return _c("div", {
|
|
197
|
+
key: idx,
|
|
198
|
+
staticClass: "grid grid-cols-7",
|
|
199
|
+
staticStyle: {
|
|
200
|
+
"width": "33.33%"
|
|
201
|
+
}
|
|
202
|
+
}, _vm._l(calendarDays, function(calendarDay) {
|
|
203
|
+
var _vm$m, _vm$m2;
|
|
204
|
+
return _c("div", {
|
|
205
|
+
key: calendarDay.dateStr,
|
|
206
|
+
class: _vm.m("text-sm", (calendarDay.isCurMon || _vm.state.showWeek) && calendarDay.isWorkday ? _vm.config.workdayColorClass || "text-color-icon-primary" : _vm.config.holidayColorClass || "text-color-icon-placeholder", (_vm$m = {}, _vm$m[_vm.config.disabledColorClass || "text-color-icon-disabled"] = calendarDay.disabled, _vm$m), (_vm$m2 = {}, _vm$m2[_vm.config.currentColorClass || "text-color-icon-inverse"] = calendarDay.type === "cur" && calendarDay.isCur, _vm$m2)),
|
|
207
|
+
style: _vm.state.minSize3
|
|
208
|
+
}, [_c("calendar-item", {
|
|
209
|
+
attrs: {
|
|
210
|
+
"text": "" + calendarDay.dateArr[2],
|
|
211
|
+
"day": calendarDay,
|
|
212
|
+
"config": _vm.config
|
|
213
|
+
},
|
|
214
|
+
on: {
|
|
215
|
+
"clickday": _vm.handleClickDay
|
|
216
|
+
}
|
|
217
|
+
})], 1);
|
|
218
|
+
}), 0);
|
|
219
|
+
}), 0)]), _c("div", {
|
|
220
|
+
staticClass: "w-full h-4 flex justify-center items-center"
|
|
221
|
+
}, [_c("div", {
|
|
222
|
+
staticClass: "w-6 h-full flex justify-center items-center",
|
|
223
|
+
on: {
|
|
224
|
+
"click": _vm.handleDraggerClick,
|
|
225
|
+
"mousedown": _vm.handleDraggerMousedown,
|
|
226
|
+
"touchstart": _vm.handleDraggerTouchstart,
|
|
227
|
+
"touchend": _vm.handleDraggerTouchend,
|
|
228
|
+
"touchmove": function touchmove($event) {
|
|
229
|
+
$event.preventDefault();
|
|
230
|
+
return _vm.throttledHandleDraggerTouchmove.apply(null, arguments);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}, [_c("div", {
|
|
234
|
+
class: ["box-content w-6 h-px cursor-pointer bg-color-border-separator rounded-sm", "border-y border-solid border-color-border-separator"]
|
|
235
|
+
})])])]), _c("tiny-cascader-select", _vm._b({
|
|
236
|
+
attrs: {
|
|
237
|
+
"cycle-roll": "",
|
|
238
|
+
"options": _vm.state.cascaderOptions,
|
|
239
|
+
"visible": _vm.state.cascaderVisible
|
|
240
|
+
},
|
|
241
|
+
on: {
|
|
242
|
+
"update:modelValue": _vm.handleCascaderChange,
|
|
243
|
+
"update:visible": _vm.setCascaderVisible
|
|
244
|
+
},
|
|
245
|
+
model: {
|
|
246
|
+
value: _vm.state.cascaderCurrent,
|
|
247
|
+
callback: function callback($$v) {
|
|
248
|
+
_vm.$set(_vm.state, "cascaderCurrent", $$v);
|
|
249
|
+
},
|
|
250
|
+
expression: "state.cascaderCurrent"
|
|
251
|
+
}
|
|
252
|
+
}, "tiny-cascader-select", _vm.config.cascaderOp, false))], 1);
|
|
253
|
+
};
|
|
254
|
+
var staticRenderFns = [];
|
|
255
|
+
var __cssModules = {};
|
|
256
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render2, staticRenderFns, false, __vue2_injectStyles);
|
|
257
|
+
function __vue2_injectStyles(context) {
|
|
258
|
+
for (var o in __cssModules) {
|
|
259
|
+
this[o] = __cssModules[o];
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
var mobileFirst = /* @__PURE__ */ function() {
|
|
263
|
+
return __component__.exports;
|
|
264
|
+
}();
|
|
265
|
+
|
|
266
|
+
export { mobileFirst as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-calendar-bar",
|
|
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-cascader-select": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-icon": "~2.21.0",
|
|
13
|
+
"@opentinyvue/vue-renderless": "~3.21.0"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"types": "index.d.ts",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "pnpm -w build:ui $npm_package_name",
|
|
19
|
+
"//postversion": "pnpm build"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/src/index.d.ts
ADDED