index.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. !(function (t) {
  2. const e = {};function n(r) {
  3. if (e[r]) return e[r].exports;const a = e[r] = { i: r, l: !1, exports: {} };return t[r].call(a.exports, a, a.exports, n), a.l = !0, a.exports;
  4. }n.m = t, n.c = e, n.d = function (t, e, r) {
  5. n.o(t, e) || Object.defineProperty(t, e, { enumerable: !0, get: r });
  6. }, n.r = function (t) {
  7. 'undefined' !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }), Object.defineProperty(t, '__esModule', { value: !0 });
  8. }, n.t = function (t, e) {
  9. if (1 & e && (t = n(t)), 8 & e) return t;if (4 & e && 'object' === typeof t && t && t.__esModule) return t;const r = Object.create(null);if (n.r(r), Object.defineProperty(r, 'default', { enumerable: !0, value: t }), 2 & e && 'string' !== typeof t) for (const a in t)n.d(r, a, (e => t[e]).bind(null, a));return r;
  10. }, n.n = function (t) {
  11. const e = t && t.__esModule ? function () {
  12. return t.default;
  13. } : function () {
  14. return t;
  15. };return n.d(e, 'a', e), e;
  16. }, n.o = function (t, e) {
  17. return Object.prototype.hasOwnProperty.call(t, e);
  18. }, n.p = '', n(n.s = 36);
  19. }({ 0(t, e, n) {
  20. 'use strict';function r(t) {
  21. return (function (t) {
  22. if (Array.isArray(t)) {
  23. for (var e = 0, n = new Array(t.length);e < t.length;e++)n[e] = t[e];return n;
  24. }
  25. }(t)) || (function (t) {
  26. if (Symbol.iterator in Object(t) || '[object Arguments]' === Object.prototype.toString.call(t)) return Array.from(t);
  27. }(t)) || (function () {
  28. throw new TypeError('Invalid attempt to spread non-iterable instance');
  29. }());
  30. } function a(t, e) {
  31. let n = Object.keys(t);return Object.getOwnPropertySymbols && n.push.apply(n, Object.getOwnPropertySymbols(t)), e && (n = n.filter(e => Object.getOwnPropertyDescriptor(t, e).enumerable)), n;
  32. } function c(t) {
  33. for (let e = 1;e < arguments.length;e++) {
  34. var n = null != arguments[e] ? arguments[e] : {};e % 2 ? a(n, !0).forEach((e) => {
  35. o(t, e, n[e]);
  36. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : a(n).forEach((e) => {
  37. Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e));
  38. });
  39. } return t;
  40. } function o(t, e, n) {
  41. return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
  42. } function i(t, e) {
  43. return (function (t) {
  44. if (Array.isArray(t)) return t;
  45. }(t)) || (function (t, e) {
  46. const n = []; let r = !0; let a = !1; let c = void 0;try {
  47. for (var o, i = t[Symbol.iterator]();!(r = (o = i.next()).done) && (n.push(o.value), !e || n.length !== e);r = !0);
  48. } catch (t) {
  49. a = !0, c = t;
  50. } finally {
  51. try {
  52. r || null == i.return || i.return();
  53. } finally {
  54. if (a) throw c;
  55. }
  56. } return n;
  57. }(t, e)) || (function () {
  58. throw new TypeError('Invalid attempt to destructure non-iterable instance');
  59. }());
  60. }n.r(e);e.default = { arrayIsEmpty(t) {
  61. return !(!t || 0 !== t.length);
  62. }, timestampToTime(t, e) {
  63. const n = new Date(t); const r = n.getFullYear().toString(); const a = n.getMonth() + 1 < 10 ? '0'.concat(n.getMonth() + 1) : ''.concat(n.getMonth() + 1); const c = n.getDate() < 10 ? '0'.concat(n.getDate()) : ''.concat(n.getDate()); const o = n.getHours() < 10 ? '0'.concat(n.getHours()) : ''.concat(n.getHours()); const i = n.getMinutes() < 10 ? '0'.concat(n.getMinutes()) : ''.concat(n.getMinutes()); const u = n.getSeconds() < 10 ? '0'.concat(n.getSeconds()) : ''.concat(n.getSeconds()); let s = { value: { Y: r, M: a, D: c, h: o, m: i, s: u }, str: ''.concat(r, '-').concat(a, '-')
  64. .concat(c, ' ')
  65. .concat(o, ':')
  66. .concat(i, ':')
  67. .concat(u) };switch (e) {
  68. case 'YYYYMMDDHHMM':s = { value: { Y: r, M: a, D: c, h: o, m: i }, str: ''.concat(r, '-').concat(a, '-')
  69. .concat(c, ' ')
  70. .concat(o, ':')
  71. .concat(i) };break;case 'YYYYMMDD':s = { value: { Y: r, M: a, D: c }, str: ''.concat(r, '-').concat(a, '-')
  72. .concat(c) };break;case 'YYYYMM':s = { value: { Y: r, M: a }, str: ''.concat(r, '-').concat(a) };break;case 'HHMMSS':s = { value: { h: o, m: i, s: u }, str: ''.concat(o, ':').concat(i, ':')
  73. .concat(u) };break;case 'HHMM':s = { value: { h: o, m: i }, str: ''.concat(o, ':').concat(i) };
  74. } return s;
  75. }, timeToTimestamp(t) {
  76. return new Date(t.replace(/-/g, '/')).valueOf();
  77. }, pickerConfirmData(t, e) {
  78. const n = [];console.log(e);const r = 'number' === typeof e ? [e] : e;return t && t.map((t, e) => {
  79. n.push(t[r[e]]);
  80. }), console.log(n), { value: 1 === n.length ? n[0] : n, index: 1 === r.length ? r[0] : r };
  81. }, getCurrentMonthDay(t, e) {
  82. return new Date(t, e, 0).getDate();
  83. }, generateIntervalData(t, e) {
  84. for (var n = [], a = Number(t), c = Number(e), o = a;o <= c;o++) {
  85. const i = o < 10 ? '0'.concat(o) : ''.concat(o);n = [].concat(r(n), [i]);
  86. } return n;
  87. }, datePickerConfirmData(t, e) {
  88. let n = ''; let r = void 0; let a = void 0; let c = void 0; let o = void 0; let u = void 0; let s = void 0;switch (e) {
  89. case 'YYYYMMDDHHMM':var l = i(t, 5);r = l[0], a = l[1], c = l[2], o = l[3], u = l[4], n = ''.concat(r, '-').concat(a, '-')
  90. .concat(c, ' ')
  91. .concat(o, ':')
  92. .concat(u);break;case 'YYYYMMDD':var f = i(t, 3);r = f[0], a = f[1], c = f[2], n = ''.concat(r, '-').concat(a, '-')
  93. .concat(c);break;case 'YYYYMM':var d = i(t, 2);r = d[0], a = d[1], n = ''.concat(r, '-').concat(a);break;case 'HHMMSS':var p = i(t, 3);o = p[0], u = p[1], s = p[2], n = ''.concat(o, ':').concat(u, ':')
  94. .concat(s);break;case 'HHMM':var g = i(t, 2);o = g[0], u = g[1], n = ''.concat(o, ':').concat(u);break;default:var v = i(t, 6);r = v[0], a = v[1], c = v[2], o = v[3], u = v[4], s = v[5], n = ''.concat(r, '-').concat(a, '-')
  95. .concat(c, ' ')
  96. .concat(o, ':')
  97. .concat(u, ':')
  98. .concat(s);
  99. } return n;
  100. }, timeAbbreviationFormat(t) {
  101. return /^[\d]{4}[\/-]{1}[\d]{1,2}[\/-]{1}[\d]{1,2}\s[\d]{1,2}[:][\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'YYYYMMDDHHMMSS' : /^[\d]{4}[\/-]{1}[\d]{1,2}[\/-]{1}[\d]{1,2}\s[\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'YYYYMMDDHHMM' : /^[\d]{4}[\/-]{1}[\d]{1,2}[\/-]{1}[\d]{1,2}$/.test(t) ? 'YYYYMMDD' : /^(\d{4})-(\d{2})$/.test(t) ? 'YYYYMM' : /^[\d]{1,2}[:][\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'HHMMSS' : /^[\d]{1,2}[:][\d]{1,2}$/.test(t) ? 'HHMM' : '';
  102. }, timeToFormatTimestamp(t) {
  103. const e = i(t.split(':'), 3); const n = e[0]; const a = e[1]; const o = e[2]; let u = {}; let s = [];return void 0 !== n && (u = c({}, u, { h: n }), s = [].concat(r(s), [n])), void 0 !== a && (u = c({}, u, { m: a }), s = [].concat(r(s), [a])), void 0 !== o && (u = c({}, u, { s: o }), s = [].concat(r(s), [o])), { value: u, str: s.join(':') };
  104. } };
  105. }, 36(t, e, n) {
  106. 'use strict';n.r(e);const r = n(0);function a(t, e) {
  107. let n = Object.keys(t);return Object.getOwnPropertySymbols && n.push.apply(n, Object.getOwnPropertySymbols(t)), e && (n = n.filter(e => Object.getOwnPropertyDescriptor(t, e).enumerable)), n;
  108. } function c(t) {
  109. for (let e = 1;e < arguments.length;e++) {
  110. var n = null != arguments[e] ? arguments[e] : {};e % 2 ? a(n, !0).forEach((e) => {
  111. o(t, e, n[e]);
  112. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : a(n).forEach((e) => {
  113. Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e));
  114. });
  115. } return t;
  116. } function o(t, e, n) {
  117. return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
  118. }Component({ properties: { range: { type: Array, value: [], observer() {
  119. this.__init();
  120. } }, mode: { type: String, value: 'selector' }, value: { type: Array, optionalTypes: [Number] }, disabled: { type: Boolean, value: !1 }, indicatorStyle: String, indicatorClass: String, maskClass: String, maskStyle: String, columnClass: String }, data: { prefixed: 'seal', isConfirmDisabled: !1, baseAttr: {}, pickerData: {} }, created() {}, attached() {
  121. this.__init();
  122. }, methods: { __init() {
  123. const t = this.data.mode;'selector' === t ? this._handleSelectorData() : 'multiSelector' === t && this._handleMultiSelectorData();
  124. }, _handleSelectorData() {
  125. const t = this.data; const e = t.range; const n = t.value; const a = [e]; let c = [];c = r.default.arrayIsEmpty([n]) ? a.map(() => 0) : [Number(n)], this.setData({ pickerData: { range: a, innerValue: c } });
  126. }, _handleMultiSelectorData() {
  127. const t = this.data; const e = t.range; const n = t.value; let a = [];a = r.default.arrayIsEmpty(n) ? e.map(() => 0) : n, this.setData({ pickerData: { innerValue: a, range: e } });
  128. }, _handleChange(t) {
  129. const e = this.data.pickerData; const n = t.detail.value;this.setData({ pickerData: c({}, e, { innerValue: n }) });const a = r.default.pickerConfirmData(e.range, n);this.triggerEvent('change', a);
  130. }, _handleCancel() {
  131. this.triggerEvent('cancel', {});
  132. }, _handleConfirm() {
  133. const t = this.data; const e = t.pickerData; const n = t.isConfirmDisabled; const a = e.range; const c = e.innerValue; const o = r.default.pickerConfirmData(a, c);!n && this.triggerEvent('confirm', o);
  134. }, _handlePickerStart() {
  135. this.setData({ isConfirmDisabled: !0 }), this.triggerEvent('pickstart', {});
  136. }, _handlePickerEnd() {
  137. this.setData({ isConfirmDisabled: !1 }), this.triggerEvent('pickend', {});
  138. } } });
  139. } }));