2021-06-21 23:47:23 +08:00

758 lines
25 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window.webpackJsonp = window.webpackJsonp || []).push([
[11],
{
'334+': function(I, M, b) {
'use strict';
Object.defineProperty(M, '__esModule', { value: !0 }), (M.default = void 0);
var O = P(b('q1tI')),
g = v(b('TSYQ')),
u = v(b('IEHy')),
s = v(b('laYN'));
function v(e) {
return e && e.__esModule ? e : { default: e };
}
function h() {
if (typeof WeakMap != 'function') return null;
var e = new WeakMap();
return (
(h = function() {
return e;
}),
e
);
}
function P(e) {
if (e && e.__esModule) return e;
if (e === null || (C(e) !== 'object' && typeof e != 'function')) return { default: e };
var n = h();
if (n && n.has(e)) return n.get(e);
var a = {},
t = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var o in e)
if (Object.prototype.hasOwnProperty.call(e, o)) {
var l = t ? Object.getOwnPropertyDescriptor(e, o) : null;
l && (l.get || l.set) ? Object.defineProperty(a, o, l) : (a[o] = e[o]);
}
return (a.default = e), n && n.set(e, a), a;
}
function C(e) {
return (
typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol'
? (C = function(a) {
return typeof a;
})
: (C = function(a) {
return a &&
typeof Symbol == 'function' &&
a.constructor === Symbol &&
a !== Symbol.prototype
? 'symbol'
: typeof a;
}),
C(e)
);
}
function N(e, n) {
var a = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var t = Object.getOwnPropertySymbols(e);
n &&
(t = t.filter(function(o) {
return Object.getOwnPropertyDescriptor(e, o).enumerable;
})),
a.push.apply(a, t);
}
return a;
}
function E(e) {
for (var n = 1; n < arguments.length; n++) {
var a = arguments[n] != null ? arguments[n] : {};
n % 2
? N(Object(a), !0).forEach(function(t) {
V(e, t, a[t]);
})
: Object.getOwnPropertyDescriptors
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(a))
: N(Object(a)).forEach(function(t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(a, t));
});
}
return e;
}
function V(e, n, a) {
return (
n in e
? Object.defineProperty(e, n, {
value: a,
enumerable: !0,
configurable: !0,
writable: !0,
})
: (e[n] = a),
e
);
}
function T(e, n) {
if (!(e instanceof n)) throw new TypeError('Cannot call a class as a function');
}
function F(e, n) {
for (var a = 0; a < n.length; a++) {
var t = n[a];
(t.enumerable = t.enumerable || !1),
(t.configurable = !0),
'value' in t && (t.writable = !0),
Object.defineProperty(e, t.key, t);
}
}
function x(e, n, a) {
return n && F(e.prototype, n), a && F(e, a), e;
}
function W(e, n) {
return n && (C(n) === 'object' || typeof n == 'function') ? n : Y(e);
}
function Y(e) {
if (e === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
}
function R(e) {
return (
(R = Object.setPrototypeOf
? Object.getPrototypeOf
: function(a) {
return a.__proto__ || Object.getPrototypeOf(a);
}),
R(e)
);
}
function i(e, n) {
if (typeof n != 'function' && n !== null)
throw new TypeError('Super expression must either be null or a function');
(e.prototype = Object.create(n && n.prototype, {
constructor: { value: e, writable: !0, configurable: !0 },
})),
n && c(e, n);
}
function c(e, n) {
return (
(c =
Object.setPrototypeOf ||
function(t, o) {
return (t.__proto__ = o), t;
}),
c(e, n)
);
}
var d = ['日', '一', '二', '三', '四', '五', '六'],
r = function(n) {
var a = n.defaultValue,
t = n.multiple,
o = n.value,
l;
(o = o || a),
(o = Object.prototype.toString.call(o) === '[object Array]' ? o : (o && [o]) || []),
(l = o.slice(0, t ? 2 : 1).map(function(S) {
return s.default.parseDay(S);
})),
(l = l.sort(function(S, k) {
return +S - +k;
}));
var p = n.min ? s.default.parseDay(n.min) : new Date(),
y = s.default.cloneDate(p, 'dd', 1),
m = n.max ? s.default.parseDay(n.max) : s.default.cloneDate(p, 'y', 1),
w = s.default.cloneDate(m, 'dd', s.default.getDaysByDate(m)),
D = [p, m].sort(function(S, k) {
return +S - +k;
}),
_ = {
value: l,
min: D[0],
max: D[1],
startMonth: y,
endMonth: w,
refresh: !1,
steps: t ? 2 : 1,
multiple: t,
};
return _;
},
f = (function(e) {
i(n, e);
function n(a) {
var t;
return (
T(this, n),
(t = W(this, R(n).call(this, a))),
(t.nodes = void 0),
(t.state = E({}, r(t.props), { step: 1 })),
(t.handleDateClick = function(o) {
var l = t.state,
p = l.step,
y = l.steps,
m = l.value,
w = t.props.onChange;
p === 1 && m.splice(0, m.length),
(m[p - 1] = o),
m.sort(function(D, _) {
return +D - +_;
}),
t.setState({ value: m, step: p >= y ? 1 : p + 1 }, function() {
p >= y && typeof w == 'function' && w(m);
});
}),
(t.anchor = function() {
var o = t.state.value,
l = o[0] || n.now,
p = ''.concat(l.getFullYear(), '-').concat(l.getMonth()),
y = t.nodes[p];
y && Object.prototype.toString.call(y.anchor) === '[object Function]' && y.anchor();
}),
(t.renderWeekBar = function() {
var o = t.props.prefixCls,
l = d.map(function(p) {
return O.default.createElement(
'li',
{ key: p, className: ''.concat(o, '__bar__item') },
p,
);
});
return O.default.createElement('ul', { className: ''.concat(o, '__bar') }, l);
}),
(t.renderMonth = function(o) {
var l = t.state,
p = l.value,
y = l.min,
m = l.max,
w = t.props,
D = w.prefixCls,
_ = w.dateRender,
S = w.disabledDate,
k = ''.concat(o.getFullYear(), '-').concat(o.getMonth());
return O.default.createElement(u.default, {
prefixCls: D,
key: k,
min: y,
max: m,
value: p,
dateMonth: o,
dateRender: _,
disabledDate: S,
onDateClick: t.handleDateClick,
ref: function(q) {
t.nodes[k] = q;
},
});
}),
(t.nodes = {}),
t
);
}
return (
x(
n,
[
{
key: 'componentDidMount',
value: function() {
this.anchor();
},
},
{
key: 'componentDidUpdate',
value: function(t, o) {
var l = this.state.refresh;
l !== o.refresh && this.anchor();
},
},
{
key: 'renderMonths',
value: function() {
var t = this,
o = this.props.prefixCls,
l = this.state,
p = l.startMonth,
y = l.max,
m = Array.from({ length: s.default.getMonthCount(p, y) }),
w = m.map(function(D, _) {
return t.renderMonth(s.default.cloneDate(p, 'm', _));
});
return O.default.createElement(
'section',
{ className: ''.concat(o, '__body') },
w,
);
},
},
{
key: 'render',
value: function() {
var t = this.props,
o = t.prefixCls,
l = t.className;
return O.default.createElement(
'div',
{ className: (0, g.default)(o, l) },
this.renderWeekBar(),
this.renderMonths(),
);
},
},
],
[
{
key: 'getDerivedStateFromProps',
value: function(t, o) {
return ('value' in t && t.value !== o.prevValue) ||
('multiple' in t && t.multiple !== o.prevMultiple) ||
('min' in t && t.min !== o.prevMin) ||
('max' in t && t.max !== o.prevMax)
? E({}, r(t), {
step: o.step ? 1 : o.step,
refresh: !o.refresh,
prevValue: t.value,
prevMax: t.max,
prevMin: t.min,
prevMultiple: t.multiple,
})
: null;
},
},
],
),
n
);
})(O.PureComponent);
(M.default = f),
(f.displayName = 'CalendarView'),
(f.defaultProps = {
prefixCls: 'za-calendar',
multiple: !1,
min: new Date(),
dateRender: function(n) {
return n.getDate();
},
disabledDate: function() {
return !1;
},
}),
(f.now = new Date()),
(f.cache = {
now: ''
.concat(f.now.getFullYear(), '-')
.concat(f.now.getMonth(), '-')
.concat(f.now.getDate()),
});
},
'7TMV': function(I, M, b) {},
IEHy: function(I, M, b) {
'use strict';
Object.defineProperty(M, '__esModule', { value: !0 }), (M.default = void 0);
var O = h(b('q1tI')),
g = s(b('TSYQ')),
u = s(b('laYN'));
function s(i) {
return i && i.__esModule ? i : { default: i };
}
function v() {
if (typeof WeakMap != 'function') return null;
var i = new WeakMap();
return (
(v = function() {
return i;
}),
i
);
}
function h(i) {
if (i && i.__esModule) return i;
if (i === null || (C(i) !== 'object' && typeof i != 'function')) return { default: i };
var c = v();
if (c && c.has(i)) return c.get(i);
var d = {},
r = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var f in i)
if (Object.prototype.hasOwnProperty.call(i, f)) {
var e = r ? Object.getOwnPropertyDescriptor(i, f) : null;
e && (e.get || e.set) ? Object.defineProperty(d, f, e) : (d[f] = i[f]);
}
return (d.default = i), c && c.set(i, d), d;
}
function P(i, c, d) {
return (
c in i
? Object.defineProperty(i, c, {
value: d,
enumerable: !0,
configurable: !0,
writable: !0,
})
: (i[c] = d),
i
);
}
function C(i) {
return (
typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol'
? (C = function(d) {
return typeof d;
})
: (C = function(d) {
return d &&
typeof Symbol == 'function' &&
d.constructor === Symbol &&
d !== Symbol.prototype
? 'symbol'
: typeof d;
}),
C(i)
);
}
function N(i, c) {
if (!(i instanceof c)) throw new TypeError('Cannot call a class as a function');
}
function E(i, c) {
for (var d = 0; d < c.length; d++) {
var r = c[d];
(r.enumerable = r.enumerable || !1),
(r.configurable = !0),
'value' in r && (r.writable = !0),
Object.defineProperty(i, r.key, r);
}
}
function V(i, c, d) {
return c && E(i.prototype, c), d && E(i, d), i;
}
function T(i, c) {
return c && (C(c) === 'object' || typeof c == 'function') ? c : F(i);
}
function F(i) {
if (i === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return i;
}
function x(i) {
return (
(x = Object.setPrototypeOf
? Object.getPrototypeOf
: function(d) {
return d.__proto__ || Object.getPrototypeOf(d);
}),
x(i)
);
}
function W(i, c) {
if (typeof c != 'function' && c !== null)
throw new TypeError('Super expression must either be null or a function');
(i.prototype = Object.create(c && c.prototype, {
constructor: { value: i, writable: !0, configurable: !0 },
})),
c && Y(i, c);
}
function Y(i, c) {
return (
(Y =
Object.setPrototypeOf ||
function(r, f) {
return (r.__proto__ = f), r;
}),
Y(i, c)
);
}
var R = (function(i) {
W(c, i);
function c(d) {
var r;
return (
N(this, c),
(r = T(this, x(c).call(this, d))),
(r.min = void 0),
(r.max = void 0),
(r.lastIn = !1),
(r.isRefresh = !0),
(r.node = void 0),
(r.anchor = function() {
r.node && r.node.scrollIntoViewIfNeeded && r.node.scrollIntoViewIfNeeded();
}),
(r.checkRefresh = function(f) {
var e = f.dateMonth,
n = f.value,
a = f.min,
t = f.max,
o = f.dateRender,
l = f.disabledDate,
p = r.props,
y = p.dateRender,
m = p.disabledDate,
w = r.state.dateMonth;
if (o !== y || l !== m) return !0;
if (+e - +w !== 0) return !0;
if (+a - +r.min !== 0 || +t - +r.max !== 0) return !0;
var D;
if (n.length > 0) {
var _ = u.default.cloneDate(e, 'dd', 1),
S = u.default.cloneDate(n[0], 'dd', 1),
k = u.default.cloneDate(n[n.length - 1], 'dd', 1);
D = _ >= S && _ <= k;
}
var $ = !(!D && !r.lastIn);
return (r.lastIn = D), $;
}),
(r.checkStatus = function(f) {
var e = r.props,
n = e.min,
a = e.max,
t = e.disabledDate,
o = r.state.value,
l = o === void 0 ? [] : o,
p = f < u.default.cloneDate(n, 'd', 0) || f > u.default.cloneDate(a, 'd', 0),
y = {
disabled: p || (t && t(f)),
isSelected: l.some(function(m) {
return u.default.isOneDay(f, m);
}),
isRange: l.length > 1 && f > l[0] && f < l[l.length - 1],
rangeStart: l.length > 1 && u.default.isOneDay(f, l[0]),
rangeEnd: l.length > 1 && u.default.isOneDay(f, l[l.length - 1]),
};
return (r.lastIn = r.lastIn || y.isSelected || y.isRange), y;
}),
(r.renderDay = function(f, e, n, a) {
var t,
o = r.props,
l = o.prefixCls,
p = o.dateRender,
y = o.onDateClick,
m = new Date(e, n, f),
w =
c.cache.now ===
''
.concat(e, '-')
.concat(n, '-')
.concat(f),
D = r.checkStatus(m),
_ = (m && p && p(m)) || '';
C(_) === 'object' &&
((0, O.isValidElement)(_) ||
(console.warn('dateRender函数返回数据类型错误请返回基本数据类型或者reactNode'),
(_ = '')));
var S =
((t = { d6: (f + a) % 7 === 0, d7: (f + a) % 7 === 1 }),
P(t, ''.concat(l, '__day--disabled'), D.disabled),
P(t, ''.concat(l, '__day--today'), w),
P(t, ''.concat(l, '__day--selected'), D.isSelected),
P(t, ''.concat(l, '__day--range'), D.isRange),
P(t, 'range-start', D.rangeStart),
P(t, 'range-end', D.rangeEnd),
P(t, 'firstday-'.concat(a), f === 1 && a),
t);
return O.default.createElement(
'li',
{
key: ''
.concat(e, '-')
.concat(n, '-')
.concat(f),
className: (0, g.default)(''.concat(l, '__day'), S),
onClick: function() {
return !D.disabled && m && y && y(m);
},
},
(_ &&
O.default.createElement(
'div',
{ className: ''.concat(l, '__day__content') },
_,
)) ||
'',
);
}),
(r.renderContent = function(f, e) {
var n = u.default.getCurrMonthInfo(f, e),
a = n.firstDay,
t = n.dayCount;
return Array.from({ length: t }).map(function(o, l) {
return r.renderDay(l + 1, f, e, a);
});
}),
(r.min = d.min),
(r.max = d.max),
(r.state = { value: d.value, dateMonth: d.dateMonth }),
r
);
}
return (
V(
c,
[
{
key: 'shouldComponentUpdate',
value: function(r) {
return (
(this.isRefresh = this.checkRefresh(r)),
this.isRefresh && ((this.min = r.min), (this.max = r.max)),
this.isRefresh
);
},
},
{
key: 'render',
value: function() {
var r = this,
f = this.props.prefixCls,
e = this.state.dateMonth,
n = e.getFullYear(),
a = e.getMonth(),
t = ''.concat(n, '-').concat(a);
return O.default.createElement(
'section',
{
key: t,
className: ''.concat(f, '__month'),
title: ''.concat(n, '年').concat(a + 1, '月'),
ref: function(l) {
r.node = l;
},
},
O.default.createElement('ul', null, this.renderContent(n, a)),
);
},
},
],
[
{
key: 'getDerivedStateFromProps',
value: function(r, f) {
return ('value' in r && r.value !== f.value) ||
('dateMonth' in r && r.dateMonth !== f.dateMonth)
? { value: r.value, dateMonth: r.dateMonth }
: null;
},
},
],
),
c
);
})(O.Component);
(M.default = R),
(R.displayName = 'CalendarMonthView'),
(R.defaultProps = {
prefixCls: 'za-calendar',
value: [],
dateMonth: new Date(),
min: new Date(),
max: new Date(),
dateRender: function(c) {
return c.getDate();
},
disabledDate: function() {
return !1;
},
}),
(R.now = new Date()),
(R.cache = {
now: ''
.concat(R.now.getFullYear(), '-')
.concat(R.now.getMonth(), '-')
.concat(R.now.getDate()),
});
},
cYC7: function(I, M, b) {
'use strict';
b('1Ywk'), b('7TMV');
},
laYN: function(I, M, b) {
'use strict';
Object.defineProperty(M, '__esModule', { value: !0 }), (M.default = void 0);
var O = {
firstDayOfMonth: function(u) {
var s = u.constructor === Date ? u : this.cloneDate(u, 'dd', 1);
return s.getDay();
},
getDaysInMonth: function(u, s) {
return new Date(u, s, 0).getDate();
},
getDaysByDate: function(u) {
var s = this.parseDate(u);
return new Date(s.getFullYear(), s.getMonth() + 1, 0).getDate();
},
getCurrMonthInfo: function(u, s) {
return {
dayCount: new Date(u, s + 1, 0).getDate(),
firstDay: new Date(u, s, 1).getDay(),
};
},
isLeapYear: function(u) {
if (!+u) throw new Error('年份格式不正确');
if (+u < 1790) throw new Error('年份不能低于1790');
return (+u % 4 === 0 && +u % 100 !== 0) || +u % 400 === 0;
},
getMonthCount: function(u, s) {
var v = this.parseDate(u),
h = this.parseDate(s),
P = (h.getFullYear() - v.getFullYear()) * 12 + (h.getMonth() - v.getMonth());
return Math.abs(P) + 1;
},
isToday: function(u) {
return this.isOneDay(u, new Date());
},
isOneDay: function(u, s) {
if (!u || !s) return !1;
var v = this.parseDate(u),
h = this.parseDate(s);
return v.toDateString() === h.toDateString();
},
isOneMonth: function(u, s) {
if (!u || !s) return !1;
var v = this.parseDate(u),
h = this.parseDate(s);
return v.getFullYear() === h.getFullYear() && v.getMonth() === h.getMonth();
},
getDay: function(u, s) {
var v = this.cloneDate(u),
h = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
return s && s instanceof Array && (h = s), h[v.getDay()];
},
parseDay: function(u) {
var s = this.parseDate(u);
return new Date(s.getFullYear(), s.getMonth(), s.getDate());
},
parseDate: function(u) {
return u.constructor === Date
? u
: (u.constructor === String && (u = +u ? +u : u.replace(/-/gi, '/')), new Date(u));
},
cloneDate: function(u, s, v) {
var h = new Date(this.parseDate(u));
if (!s || !v) return h;
switch (s) {
case 'y':
h.setFullYear(h.getFullYear() + v);
break;
case 'yyyy':
h.setFullYear(v);
break;
case 'm':
h.setMonth(h.getMonth() + v);
break;
case 'mm':
h.setMonth(v);
break;
case 'd':
h.setDate(h.getDate() + v);
break;
case 'dd':
h.setDate(v);
break;
default:
break;
}
return h;
},
};
M.default = O;
},
},
]);
//# sourceMappingURL=11.js.map