tor-univer-sheet 1.1.14 → 1.1.16
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/dist/tor-univer-sheet.es.js +274 -274
- package/dist/tor-univer-sheet.umd.js +1 -1
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import l from "dayjs";
|
|
2
|
-
import { CellValueType as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { CellValueType as $ } from "@univerjs/presets";
|
|
3
|
+
import K from "decimal.js";
|
|
4
|
+
const dt = (t, o) => {
|
|
5
5
|
for (const r of o)
|
|
6
6
|
t[r] = null;
|
|
7
|
-
},
|
|
7
|
+
}, W = () => {
|
|
8
8
|
if (typeof crypto == "object") {
|
|
9
9
|
if (typeof crypto.randomUUID == "function")
|
|
10
10
|
return crypto.randomUUID();
|
|
11
11
|
if (typeof crypto.getRandomValues == "function" && typeof Uint8Array == "function") {
|
|
12
12
|
const r = (e) => {
|
|
13
|
-
const
|
|
14
|
-
return (
|
|
13
|
+
const f = Number(e);
|
|
14
|
+
return (f ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> f / 4).toString(16);
|
|
15
15
|
};
|
|
16
16
|
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, r);
|
|
17
17
|
}
|
|
@@ -22,19 +22,19 @@ const mt = (t, o) => {
|
|
|
22
22
|
return t > 0 ? (e = (t + e) % 16 | 0, t = Math.floor(t / 16)) : (e = (o + e) % 16 | 0, o = Math.floor(o / 16)), (r === "x" ? e : e & 3 | 8).toString(16);
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
function
|
|
25
|
+
function ht(t) {
|
|
26
26
|
return {
|
|
27
27
|
...t?.workbookData,
|
|
28
|
-
id: t?.id ||
|
|
28
|
+
id: t?.id || W(),
|
|
29
29
|
name: t?.name || "未命名",
|
|
30
30
|
appVersion: t?.appVersion || "1.0.0"
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
class
|
|
33
|
+
const X = Object.prototype.toString, L = (t, o) => X.call(t) === `[object ${o}]`, tt = (t) => typeof t < "u", et = (t) => !tt(t), rt = (t) => t !== null && L(t, "Object"), E = (t) => t == null || typeof t > "u" ? !0 : J(t) || st(t) ? t.length === 0 : t instanceof Map || t instanceof Set ? t.size === 0 : rt(t) ? Object.keys(t).length === 0 : !1, ot = (t) => t === null, nt = (t) => et(t) || ot(t), st = (t) => L(t, "String"), J = (t) => t && Array.isArray(t);
|
|
34
|
+
class at {
|
|
35
35
|
value;
|
|
36
36
|
constructor(o) {
|
|
37
|
-
this.value = new
|
|
37
|
+
this.value = new K(o);
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* 加法运算
|
|
@@ -67,7 +67,7 @@ class nt {
|
|
|
67
67
|
* @throws 当除数为0时抛出错误
|
|
68
68
|
*/
|
|
69
69
|
divide(o) {
|
|
70
|
-
const r = new
|
|
70
|
+
const r = new K(o);
|
|
71
71
|
if (r.isZero())
|
|
72
72
|
throw new Error("除数是0");
|
|
73
73
|
return this.value = this.value.div(r), this;
|
|
@@ -79,7 +79,7 @@ class nt {
|
|
|
79
79
|
* @returns DecimalChain 实例,支持链式调用
|
|
80
80
|
*/
|
|
81
81
|
toFixed(o, r) {
|
|
82
|
-
return this.value = new
|
|
82
|
+
return this.value = new K(this.value.toFixed(o, r)), this;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
85
|
* 返回当前值
|
|
@@ -104,36 +104,36 @@ class nt {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
function C(t = 0) {
|
|
107
|
-
return new
|
|
107
|
+
return new at(t);
|
|
108
108
|
}
|
|
109
|
-
var
|
|
110
|
-
async function
|
|
109
|
+
var it = /* @__PURE__ */ ((t) => (t.无 = "no", t.年 = "year", t.月 = "month", t.周 = "week", t.天 = "day", t.班组 = "shift", t.小时 = "hour", t.半小时 = "half_hour", t))(it || {}), ct = /* @__PURE__ */ ((t) => (t.view = "view", t.edit = "edit", t))(ct || {});
|
|
110
|
+
async function Yt(t, o) {
|
|
111
111
|
if (!o) return Promise.reject("日期不能为空");
|
|
112
112
|
switch (t) {
|
|
113
113
|
case "year":
|
|
114
|
-
if (
|
|
114
|
+
if (J(o))
|
|
115
115
|
return Promise.resolve(o);
|
|
116
116
|
const r = l(o);
|
|
117
117
|
if (!r.isValid())
|
|
118
118
|
return Promise.reject("无效的日期格式");
|
|
119
|
-
const e = r.year(),
|
|
120
|
-
return Promise.resolve([
|
|
119
|
+
const e = r.year(), f = `${e}-01`, n = `${e}-12`;
|
|
120
|
+
return Promise.resolve([f, n]);
|
|
121
121
|
case "month":
|
|
122
|
-
if (
|
|
122
|
+
if (J(o))
|
|
123
123
|
return Promise.resolve(o);
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
124
|
+
const h = l(o);
|
|
125
|
+
if (!h.isValid())
|
|
126
126
|
return Promise.reject("无效的日期格式");
|
|
127
|
-
const
|
|
128
|
-
return Promise.resolve([
|
|
127
|
+
const k = h.startOf("month").format("YYYY-MM-DD"), c = h.endOf("month").format("YYYY-MM-DD");
|
|
128
|
+
return Promise.resolve([k, c]);
|
|
129
129
|
case "day":
|
|
130
|
-
if (
|
|
130
|
+
if (J(o))
|
|
131
131
|
return Promise.resolve(o);
|
|
132
132
|
const Y = l(o);
|
|
133
133
|
if (!Y.isValid())
|
|
134
134
|
return Promise.reject("无效的日期格式");
|
|
135
|
-
const
|
|
136
|
-
return Promise.resolve([
|
|
135
|
+
const p = Y.startOf("day").format("YYYY-MM-DD HH:mm:ss"), d = Y.endOf("day").format("YYYY-MM-DD HH:mm:ss");
|
|
136
|
+
return Promise.resolve([p, d]);
|
|
137
137
|
default:
|
|
138
138
|
return Promise.reject("不支持的周期类型");
|
|
139
139
|
}
|
|
@@ -148,7 +148,7 @@ function H(t, o, r) {
|
|
|
148
148
|
}[r];
|
|
149
149
|
return ["day", "hour"].includes(r) ? l(o, e).diff(l(t, e), r) : l(o, e).diff(l(t, e), r);
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function z(t, o, r) {
|
|
152
152
|
if (!r)
|
|
153
153
|
throw new Error("日期类型不能为空");
|
|
154
154
|
const e = {
|
|
@@ -159,459 +159,459 @@ function J(t, o, r) {
|
|
|
159
159
|
}[r];
|
|
160
160
|
return l(t).subtract(o, r).format(e);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const
|
|
162
|
+
function S(t, o, r, e) {
|
|
163
|
+
const f = "YYYY-MM-DD HH:mm:ss", n = A(t, o, r, e), h = l(n);
|
|
164
164
|
if (o === "month") {
|
|
165
|
-
const c =
|
|
166
|
-
return c === 0 ? [
|
|
165
|
+
const c = h.month();
|
|
166
|
+
return c === 0 ? [h.startOf("month").format(f), h.date(25).endOf("day").format(f)] : c === 11 ? [h.subtract(1, "month").date(26).startOf("day").format(f), h.endOf("month").format(f)] : [h.subtract(1, "month").date(26).startOf("day").format(f), h.date(25).endOf("day").format(f)];
|
|
167
167
|
}
|
|
168
|
-
const
|
|
169
|
-
return [
|
|
168
|
+
const k = { year: "year", day: "day", hour: "hour" };
|
|
169
|
+
return [h.startOf(k[o]).format(f), h.endOf(k[o]).format(f)];
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
171
|
+
function A(t, o, r, e) {
|
|
172
|
+
const f = {
|
|
173
173
|
year: "YYYY",
|
|
174
174
|
month: "YYYY-MM",
|
|
175
175
|
day: "YYYY-MM-DD",
|
|
176
176
|
hour: "YYYY-MM-DD HH:mm:ss"
|
|
177
177
|
}[o];
|
|
178
|
-
return l(t,
|
|
178
|
+
return l(t, f).add(r * e, o).format(f);
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function g(t, o, r) {
|
|
181
181
|
return t[o] || (t[o] = {}), t[o][r] || (t[o][r] = {}), t[o][r];
|
|
182
182
|
}
|
|
183
|
-
async function
|
|
183
|
+
async function Dt(t) {
|
|
184
184
|
if (!t)
|
|
185
185
|
throw new Error("cellData is required");
|
|
186
186
|
const o = Object.entries(t).reduce((r, e) => {
|
|
187
|
-
const [
|
|
188
|
-
for (const [
|
|
189
|
-
const { custom: c, v: Y, t:
|
|
187
|
+
const [f, n] = e;
|
|
188
|
+
for (const [h, k] of Object.entries(n)) {
|
|
189
|
+
const { custom: c, v: Y, t: p, s: d } = k;
|
|
190
190
|
if (!c) continue;
|
|
191
|
-
const { cellType:
|
|
192
|
-
if (
|
|
193
|
-
const
|
|
194
|
-
|
|
191
|
+
const { cellType: q } = c, i = !c.hasOwnProperty("writeBack") || E(c?.writeBack) ? !0 : c.writeBack;
|
|
192
|
+
if (q === "indicator") {
|
|
193
|
+
const j = g(r, f, h);
|
|
194
|
+
j.custom = {
|
|
195
195
|
...c,
|
|
196
|
-
required:
|
|
197
|
-
defaultShift:
|
|
198
|
-
forwardPush:
|
|
199
|
-
forwardPushTimes:
|
|
200
|
-
useDefaultEndDate:
|
|
201
|
-
copyType:
|
|
202
|
-
writeBack:
|
|
203
|
-
},
|
|
196
|
+
required: E(c?.required) ? !1 : c?.required,
|
|
197
|
+
defaultShift: E(c?.defaultShift) ? !1 : c?.defaultShift,
|
|
198
|
+
forwardPush: E(c?.forwardPush) ? !1 : c?.forwardPush,
|
|
199
|
+
forwardPushTimes: E(c?.useDefaultEndDate) ? 0 : c?.forwardPushTimes,
|
|
200
|
+
useDefaultEndDate: E(c?.useDefaultEndDate) ? !1 : c?.useDefaultEndDate,
|
|
201
|
+
copyType: E(c?.copyType) ? "" : c?.copyType,
|
|
202
|
+
writeBack: i
|
|
203
|
+
}, j.s = d, j.t = p, j.v = Y;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
return r;
|
|
207
207
|
}, {});
|
|
208
|
-
return !o ||
|
|
208
|
+
return !o || E(o) ? Promise.reject(new Error("No data found")) : Promise.resolve(o);
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function F(t, o) {
|
|
211
211
|
return t.replace(/\$\{([^}]+)\}/g, (r, e) => {
|
|
212
212
|
try {
|
|
213
|
-
const
|
|
214
|
-
return new Function(...
|
|
215
|
-
} catch (
|
|
216
|
-
return console.error(`表达式执行失败: ${e}`,
|
|
213
|
+
const f = Object.keys(o), n = Object.values(o);
|
|
214
|
+
return new Function(...f, `return ${e};`)(...n);
|
|
215
|
+
} catch (f) {
|
|
216
|
+
return console.error(`表达式执行失败: ${e}`, f), r;
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function ut({
|
|
221
221
|
acc: t,
|
|
222
222
|
params: o,
|
|
223
223
|
initRowNum: r,
|
|
224
224
|
initColNum: e,
|
|
225
|
-
cellData:
|
|
225
|
+
cellData: f
|
|
226
226
|
}) {
|
|
227
|
-
const { rangeData:
|
|
228
|
-
let
|
|
227
|
+
const { rangeData: n, currentDay: h, extraArgs: k } = o, c = k?.teamData || {}, { cycleType: Y, timeIncrement: p, forwardPush: d, forwardPushTimes: q, copyType: i, copyInterval: j, defaultShift: O, templateStr: P, useDefaultEndDate: Z } = f.custom;
|
|
228
|
+
let y = 0;
|
|
229
229
|
switch (Y) {
|
|
230
230
|
case "day": {
|
|
231
|
-
let
|
|
232
|
-
if (
|
|
233
|
-
|
|
234
|
-
|
|
231
|
+
let s = "";
|
|
232
|
+
if (d && (s = z(
|
|
233
|
+
n[0],
|
|
234
|
+
q,
|
|
235
235
|
"day"
|
|
236
236
|
/* day */
|
|
237
|
-
)), !
|
|
238
|
-
let
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
|
|
237
|
+
)), !i) {
|
|
238
|
+
let u = "";
|
|
239
|
+
d ? u = s : u = n[0];
|
|
240
|
+
const a = g(t, r, e);
|
|
241
|
+
a.v = P ? F(P, { businessDate: u, dayjs: l }) : l(u).format("YYYY-MM-DD"), a.t = $.STRING;
|
|
242
242
|
break;
|
|
243
243
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
d ? y = H(
|
|
245
|
+
s,
|
|
246
|
+
n[0],
|
|
247
247
|
"day"
|
|
248
248
|
/* day */
|
|
249
|
-
) : (
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
) : (y = H(
|
|
250
|
+
n[0],
|
|
251
|
+
n[1],
|
|
252
252
|
"day"
|
|
253
253
|
/* day */
|
|
254
|
-
), console.log("copyNum",
|
|
255
|
-
for (let
|
|
256
|
-
const
|
|
257
|
-
let
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
|
|
254
|
+
), console.log("copyNum", y));
|
|
255
|
+
for (let u = 0; u <= Math.abs(y === 0 ? 1 : y); u++) {
|
|
256
|
+
const a = u * (j + 1);
|
|
257
|
+
let M = "";
|
|
258
|
+
d ? M = A(s, "day", u, p) : M = A(n[0], "day", u, p);
|
|
259
|
+
const w = i === "right" ? r : r + a, R = i === "right" ? e + a : e, G = g(t, w, R);
|
|
260
|
+
G.v = P ? F(P, { businessDate: M, dayjs: l }) : l(M).format("YYYY-MM-DD"), G.t = $.STRING;
|
|
261
261
|
}
|
|
262
262
|
break;
|
|
263
263
|
}
|
|
264
264
|
case "month": {
|
|
265
|
-
if (!
|
|
266
|
-
const [
|
|
267
|
-
|
|
265
|
+
if (!i) {
|
|
266
|
+
const [s, u] = S(n[1], "month", 0, 1), a = g(t, r, e);
|
|
267
|
+
a.v = l(u).format("YYYY-MM"), a.t = $.STRING;
|
|
268
268
|
break;
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
y = H(
|
|
271
|
+
n[0],
|
|
272
|
+
n[1],
|
|
273
273
|
"month"
|
|
274
274
|
/* month */
|
|
275
275
|
);
|
|
276
|
-
for (let
|
|
277
|
-
const
|
|
278
|
-
|
|
276
|
+
for (let s = 0; s <= Math.abs(y === 0 ? 1 : y); s++) {
|
|
277
|
+
const u = s * (j + 1), a = i === "right" ? r : r + u, M = i === "right" ? e + u : e, w = g(t, a, M);
|
|
278
|
+
w.v = A(n[0], "month", s, p), w.t = $.STRING;
|
|
279
279
|
}
|
|
280
280
|
break;
|
|
281
281
|
}
|
|
282
282
|
case "year": {
|
|
283
|
-
let
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
let s = "";
|
|
284
|
+
if (d && (s = z(
|
|
285
|
+
n[0],
|
|
286
|
+
q || 0,
|
|
287
287
|
"year"
|
|
288
288
|
/* year */
|
|
289
|
-
)), !
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
startTime:
|
|
293
|
-
endTime:
|
|
294
|
-
rangeData:
|
|
289
|
+
)), !i) {
|
|
290
|
+
const u = d ? s : n[0], [a, M] = S(u, "year", 0, 1), w = g(t, r, e), [, R] = S(n[1], "month", 0, 1);
|
|
291
|
+
w.v = P ? F(P, {
|
|
292
|
+
startTime: a,
|
|
293
|
+
endTime: M,
|
|
294
|
+
rangeData: n,
|
|
295
295
|
dayjs: l
|
|
296
|
-
}) :
|
|
296
|
+
}) : u, w.t = $.STRING;
|
|
297
297
|
break;
|
|
298
298
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
d ? y = H(
|
|
300
|
+
s,
|
|
301
|
+
n[0],
|
|
302
302
|
"year"
|
|
303
303
|
/* year */
|
|
304
|
-
) :
|
|
305
|
-
|
|
306
|
-
|
|
304
|
+
) : y = H(
|
|
305
|
+
n[0],
|
|
306
|
+
n[1],
|
|
307
307
|
"year"
|
|
308
308
|
/* year */
|
|
309
309
|
);
|
|
310
|
-
for (let
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
startTime:
|
|
314
|
-
endTime:
|
|
315
|
-
rangeData:
|
|
310
|
+
for (let u = 0; u <= Math.abs(y === 0 ? 1 : y); u++) {
|
|
311
|
+
const a = u * (j + 1), M = i === "right" ? r : r + a, w = i === "right" ? e + a : e, [R, G] = S(n[0], "year", u, p), x = g(t, M, w), N = A(n[0], "year", u, p);
|
|
312
|
+
x.v = P ? F(P, {
|
|
313
|
+
startTime: R,
|
|
314
|
+
endTime: G,
|
|
315
|
+
rangeData: n,
|
|
316
316
|
dayjs: l
|
|
317
|
-
}) :
|
|
317
|
+
}) : N, x.t = $.STRING;
|
|
318
318
|
}
|
|
319
319
|
break;
|
|
320
320
|
}
|
|
321
321
|
case "hour": {
|
|
322
|
-
if (!
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
|
|
322
|
+
if (!i) {
|
|
323
|
+
const s = g(t, r, e);
|
|
324
|
+
if (s.t = $.STRING, O) {
|
|
325
|
+
s.v = l(n[0]).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
|
|
326
326
|
break;
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
s.v = l(h).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
y = H(
|
|
332
|
+
n[0],
|
|
333
|
+
n[1],
|
|
334
334
|
"hour"
|
|
335
335
|
/* hour */
|
|
336
336
|
);
|
|
337
|
-
for (let
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
340
|
-
const
|
|
341
|
-
|
|
337
|
+
for (let s = 0; s <= Math.abs(y === 0 ? 1 : y); s++) {
|
|
338
|
+
const u = s * (j + 1), a = i === "right" ? r : r + u, M = i === "right" ? e + u : e, w = g(t, a, M);
|
|
339
|
+
if (w.t = $.STRING, O) {
|
|
340
|
+
const R = l(n[0]).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
|
|
341
|
+
w.v = A(R, "hour", s, p);
|
|
342
342
|
continue;
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
w.v = A(l(h).add(1, "hour").format("YYYY-MM-DD HH:mm:ss"), "hour", s, p);
|
|
345
345
|
}
|
|
346
346
|
break;
|
|
347
347
|
}
|
|
348
348
|
case "shift": {
|
|
349
|
-
if (!
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
rangeData:
|
|
349
|
+
if (!i) {
|
|
350
|
+
const s = g(t, r, e);
|
|
351
|
+
s.t = $.STRING, s.v = P ? F(P, {
|
|
352
|
+
rangeData: n,
|
|
353
353
|
dayjs: l
|
|
354
|
-
}) :
|
|
354
|
+
}) : n[0];
|
|
355
355
|
break;
|
|
356
356
|
}
|
|
357
357
|
if (!c.length)
|
|
358
358
|
throw new Error("没有获取到当班数据");
|
|
359
|
-
for (let
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
team:
|
|
363
|
-
}) :
|
|
359
|
+
for (let s = 0; s < c.length; s++) {
|
|
360
|
+
const u = c[s], { startDatetime: a, endDatetime: M } = u, w = s * (j + 1), R = i === "right" ? r : C(r).add(w).toNumber(), G = i === "right" ? C(e).add(w).toNumber() : e, x = g(t, R, G);
|
|
361
|
+
x.v = P ? F(P, {
|
|
362
|
+
team: u
|
|
363
|
+
}) : a;
|
|
364
364
|
}
|
|
365
365
|
break;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
async function
|
|
369
|
+
async function yt(t, o) {
|
|
370
370
|
if (!t)
|
|
371
371
|
return Promise.reject("没有可用的单元格数据");
|
|
372
372
|
const { extraArgs: r, rangeData: e } = o;
|
|
373
373
|
if (!e.length)
|
|
374
374
|
return Promise.reject("处理时间范围失败, rangeData不能为空");
|
|
375
|
-
const
|
|
376
|
-
const [
|
|
377
|
-
for (const [
|
|
378
|
-
const { custom:
|
|
379
|
-
if (!
|
|
375
|
+
const f = r?.teamData || [], { periodicityTime: n } = o, h = o?.currentDay || l().format("YYYY-MM-DD"), k = (Y, p) => n ? parseInt(n.split(":")[0], 10) < 12 ? [l(Y).format("YYYY-MM-DD") + " " + n, l(p).add(1, "day").format("YYYY-MM-DD") + " " + n] : [l(Y).subtract(1, "day").format("YYYY-MM-DD") + " " + n, l(p).format("YYYY-MM-DD") + " " + n] : [Y, p], c = Object.entries(t).reduce((Y, p) => {
|
|
376
|
+
const [d, q] = p;
|
|
377
|
+
for (const [i, j] of Object.entries(q)) {
|
|
378
|
+
const { custom: O } = j;
|
|
379
|
+
if (!O) continue;
|
|
380
380
|
const {
|
|
381
381
|
cellType: P,
|
|
382
|
-
cycleType:
|
|
383
|
-
timeIncrement:
|
|
384
|
-
forwardPush:
|
|
385
|
-
forwardPushTimes:
|
|
386
|
-
copyType:
|
|
387
|
-
copyInterval:
|
|
388
|
-
defaultShift:
|
|
389
|
-
useDefaultStartDate:
|
|
390
|
-
useDefaultEndDate:
|
|
391
|
-
} =
|
|
382
|
+
cycleType: Z,
|
|
383
|
+
timeIncrement: y,
|
|
384
|
+
forwardPush: s,
|
|
385
|
+
forwardPushTimes: u,
|
|
386
|
+
copyType: a,
|
|
387
|
+
copyInterval: M,
|
|
388
|
+
defaultShift: w,
|
|
389
|
+
useDefaultStartDate: R,
|
|
390
|
+
useDefaultEndDate: G
|
|
391
|
+
} = O;
|
|
392
392
|
if (P === "time") {
|
|
393
|
-
|
|
393
|
+
ut({ acc: Y, params: o, initRowNum: Number(d), initColNum: Number(i), cellData: j });
|
|
394
394
|
continue;
|
|
395
395
|
}
|
|
396
|
-
const
|
|
397
|
-
cycleType:
|
|
398
|
-
indicatorName:
|
|
399
|
-
indicatorCode:
|
|
400
|
-
indicatorId:
|
|
401
|
-
indicatorDimensionName:
|
|
402
|
-
indicatorDimensionConfig:
|
|
403
|
-
required:
|
|
404
|
-
cellType:
|
|
405
|
-
defaultShift:
|
|
406
|
-
writeBack:
|
|
396
|
+
const x = {
|
|
397
|
+
cycleType: Z,
|
|
398
|
+
indicatorName: O.indicatorName,
|
|
399
|
+
indicatorCode: O.indicatorCode,
|
|
400
|
+
indicatorId: O.indicatorId,
|
|
401
|
+
indicatorDimensionName: O.indicatorDimensionName,
|
|
402
|
+
indicatorDimensionConfig: O.indicatorDimensionConfig,
|
|
403
|
+
required: nt(O?.required) ?? !1,
|
|
404
|
+
cellType: O.cellType,
|
|
405
|
+
defaultShift: O?.defaultShift || !1,
|
|
406
|
+
writeBack: E(O?.writeBack) ? !0 : O.writeBack
|
|
407
407
|
};
|
|
408
|
-
let
|
|
409
|
-
switch (
|
|
408
|
+
let N = 0;
|
|
409
|
+
switch (Z) {
|
|
410
410
|
case "day": {
|
|
411
|
-
let
|
|
412
|
-
if (
|
|
411
|
+
let m = "";
|
|
412
|
+
if (s && (m = z(
|
|
413
413
|
e[0],
|
|
414
|
-
|
|
414
|
+
u || 0,
|
|
415
415
|
"day"
|
|
416
416
|
/* day */
|
|
417
|
-
)), !
|
|
418
|
-
const
|
|
417
|
+
)), !a) {
|
|
418
|
+
const D = s ? m : e[0], [T, b] = k(...S(D, "day", 0, 1)), v = g(Y, d, i);
|
|
419
419
|
v.custom = {
|
|
420
|
-
...
|
|
420
|
+
...x,
|
|
421
421
|
startTime: T,
|
|
422
|
-
endTime:
|
|
422
|
+
endTime: b
|
|
423
423
|
};
|
|
424
424
|
break;
|
|
425
425
|
}
|
|
426
|
-
|
|
427
|
-
|
|
426
|
+
s ? N = H(
|
|
427
|
+
m,
|
|
428
428
|
e[0],
|
|
429
429
|
"day"
|
|
430
430
|
/* day */
|
|
431
|
-
) :
|
|
431
|
+
) : N = H(
|
|
432
432
|
e[0],
|
|
433
433
|
e[1],
|
|
434
434
|
"day"
|
|
435
435
|
/* day */
|
|
436
436
|
);
|
|
437
|
-
for (let
|
|
438
|
-
const T =
|
|
439
|
-
|
|
440
|
-
...
|
|
437
|
+
for (let D = 0; D <= Math.abs(N === 0 ? 1 : N); D++) {
|
|
438
|
+
const T = D * (M + 1), b = s ? m : e[0], [v, I] = k(...S(b, "day", D, y)), B = a === "right" ? d : C(d).add(T).toNumber(), U = a === "right" ? C(i).add(T).toNumber() : i, V = g(Y, B, U);
|
|
439
|
+
V.custom = {
|
|
440
|
+
...x,
|
|
441
441
|
startTime: v,
|
|
442
|
-
endTime:
|
|
442
|
+
endTime: I
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
445
|
break;
|
|
446
446
|
}
|
|
447
447
|
case "month": {
|
|
448
|
-
if (!
|
|
449
|
-
const [
|
|
448
|
+
if (!a) {
|
|
449
|
+
const [m, D] = S(e[1], "month", 0, 1), T = g(Y, d, i);
|
|
450
450
|
T.custom = {
|
|
451
|
-
...
|
|
452
|
-
startTime:
|
|
453
|
-
endTime:
|
|
451
|
+
...x,
|
|
452
|
+
startTime: m,
|
|
453
|
+
endTime: D
|
|
454
454
|
};
|
|
455
455
|
break;
|
|
456
456
|
}
|
|
457
|
-
|
|
457
|
+
N = H(
|
|
458
458
|
e[0],
|
|
459
459
|
e[1],
|
|
460
460
|
"month"
|
|
461
461
|
/* month */
|
|
462
462
|
);
|
|
463
|
-
for (let
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
...
|
|
463
|
+
for (let m = 0; m <= Math.abs(N === 0 ? 1 : N); m++) {
|
|
464
|
+
const D = m * (M + 1), T = a === "right" ? d : C(d).add(D).toNumber(), b = a === "right" ? C(i).add(D).toNumber() : i, [v, I] = S(e[0], "month", m, y), B = g(Y, T, b);
|
|
465
|
+
B.custom = {
|
|
466
|
+
...x,
|
|
467
467
|
startTime: v,
|
|
468
|
-
endTime:
|
|
468
|
+
endTime: I
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
471
|
break;
|
|
472
472
|
}
|
|
473
473
|
case "year": {
|
|
474
|
-
let
|
|
475
|
-
if (
|
|
476
|
-
|
|
474
|
+
let m = "", D = "", T = "";
|
|
475
|
+
if (s) {
|
|
476
|
+
m = z(
|
|
477
477
|
e[0],
|
|
478
|
-
|
|
478
|
+
u || 0,
|
|
479
479
|
"year"
|
|
480
480
|
/* year */
|
|
481
481
|
);
|
|
482
|
-
const
|
|
483
|
-
|
|
482
|
+
const b = l(e[1]).format("MM");
|
|
483
|
+
D = l(`${m}-${b + 1}`).format("YYYY-MM"), T = l(`${m}-${b + 2}`).format("YYYY-MM");
|
|
484
484
|
}
|
|
485
|
-
if (!
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
...
|
|
489
|
-
startTime:
|
|
490
|
-
endTime:
|
|
485
|
+
if (!a) {
|
|
486
|
+
const b = s ? m : e[0], [v, I] = S(b, "year", 0, 1), B = g(Y, d, i), [, U] = S(D, "month", 0, 1), [V] = S(T, "month", 0, 1);
|
|
487
|
+
B.custom = {
|
|
488
|
+
...x,
|
|
489
|
+
startTime: R ? V : v,
|
|
490
|
+
endTime: G ? U : I
|
|
491
491
|
};
|
|
492
492
|
break;
|
|
493
493
|
}
|
|
494
|
-
|
|
495
|
-
|
|
494
|
+
s ? N = H(
|
|
495
|
+
m,
|
|
496
496
|
e[0],
|
|
497
497
|
"year"
|
|
498
498
|
/* year */
|
|
499
|
-
) :
|
|
499
|
+
) : N = H(
|
|
500
500
|
e[0],
|
|
501
501
|
e[1],
|
|
502
502
|
"year"
|
|
503
503
|
/* year */
|
|
504
504
|
);
|
|
505
|
-
for (let
|
|
506
|
-
const v =
|
|
507
|
-
|
|
508
|
-
...
|
|
509
|
-
startTime:
|
|
510
|
-
endTime:
|
|
505
|
+
for (let b = 0; b <= Math.abs(N === 0 ? 1 : N); b++) {
|
|
506
|
+
const v = b * (M + 1), I = a === "right" ? d : C(d).add(v).toNumber(), B = a === "right" ? C(i).add(v).toNumber() : i, [U, V] = S(e[0], "year", b, y), _ = g(Y, I, B);
|
|
507
|
+
_.custom = {
|
|
508
|
+
...x,
|
|
509
|
+
startTime: U,
|
|
510
|
+
endTime: V
|
|
511
511
|
};
|
|
512
512
|
}
|
|
513
513
|
break;
|
|
514
514
|
}
|
|
515
515
|
case "hour": {
|
|
516
|
-
if (!
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
...
|
|
520
|
-
startTime:
|
|
516
|
+
if (!a) {
|
|
517
|
+
const m = w ? e[0] : e[0] ?? h, [D, T] = S(m, "hour", 1, 1), b = g(Y, d, i);
|
|
518
|
+
b.custom = {
|
|
519
|
+
...x,
|
|
520
|
+
startTime: D,
|
|
521
521
|
endTime: T
|
|
522
522
|
};
|
|
523
523
|
break;
|
|
524
524
|
}
|
|
525
|
-
|
|
525
|
+
N = H(
|
|
526
526
|
e[0],
|
|
527
527
|
e[1],
|
|
528
528
|
"hour"
|
|
529
529
|
/* hour */
|
|
530
530
|
);
|
|
531
|
-
for (let
|
|
532
|
-
const
|
|
533
|
-
if (
|
|
534
|
-
const
|
|
531
|
+
for (let m = 0; m <= Math.abs(N === 0 ? 1 : N); m++) {
|
|
532
|
+
const D = m * (M + 1), T = a === "right" ? d : C(d).add(D).toNumber(), b = a === "right" ? C(i).add(D).toNumber() : i, v = g(Y, T, b);
|
|
533
|
+
if (w) {
|
|
534
|
+
const V = l(e[0]).add(1, "hour").format("YYYY-MM-DD HH:mm:ss"), [_, Q] = S(V, "hour", m, y);
|
|
535
535
|
v.custom = {
|
|
536
|
-
...
|
|
537
|
-
startTime:
|
|
538
|
-
endTime:
|
|
536
|
+
...x,
|
|
537
|
+
startTime: _,
|
|
538
|
+
endTime: Q
|
|
539
539
|
};
|
|
540
540
|
continue;
|
|
541
541
|
}
|
|
542
|
-
const
|
|
542
|
+
const I = l(h).add(1, "hour").format("YYYY-MM-DD HH:mm:ss"), [B, U] = S(I, "hour", m, y);
|
|
543
543
|
v.custom = {
|
|
544
|
-
...
|
|
545
|
-
startTime:
|
|
546
|
-
endTime:
|
|
544
|
+
...x,
|
|
545
|
+
startTime: B,
|
|
546
|
+
endTime: U
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
549
|
break;
|
|
550
550
|
}
|
|
551
551
|
case "shift": {
|
|
552
|
-
if (!
|
|
553
|
-
const [
|
|
552
|
+
if (!a) {
|
|
553
|
+
const [m, D] = e, T = g(Y, d, i);
|
|
554
554
|
T.custom = {
|
|
555
|
-
...
|
|
556
|
-
startTime:
|
|
557
|
-
endTime:
|
|
555
|
+
...x,
|
|
556
|
+
startTime: m,
|
|
557
|
+
endTime: D
|
|
558
558
|
};
|
|
559
559
|
break;
|
|
560
560
|
}
|
|
561
|
-
if (!
|
|
561
|
+
if (!f.length)
|
|
562
562
|
throw new Error("没有获取到当班数据");
|
|
563
|
-
for (let
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
...
|
|
563
|
+
for (let m = 0; m < f.length; m++) {
|
|
564
|
+
const D = f[m], { startDatetime: T, endDatetime: b } = D, v = m * (M + 1), I = a === "right" ? d : C(d).add(v).toNumber(), B = a === "right" ? C(i).add(v).toNumber() : i, U = g(Y, I, B);
|
|
565
|
+
U.custom = {
|
|
566
|
+
...x,
|
|
567
567
|
startTime: T,
|
|
568
|
-
endTime:
|
|
568
|
+
endTime: b
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
571
|
break;
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
return
|
|
575
|
+
return Y;
|
|
576
576
|
}, {});
|
|
577
|
-
return Promise.resolve(
|
|
577
|
+
return Promise.resolve(c);
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
return Object.entries(t).reduce((r, [e,
|
|
581
|
-
const
|
|
582
|
-
return
|
|
579
|
+
function bt(t) {
|
|
580
|
+
return Object.entries(t).reduce((r, [e, f]) => {
|
|
581
|
+
const n = Math.max(...Object.keys(f).map(Number));
|
|
582
|
+
return n > r ? r = Number(n) : r = Number(r) || 0, r;
|
|
583
583
|
}, 0);
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function gt(t, o) {
|
|
586
586
|
const r = JSON.parse(JSON.stringify(t || {}));
|
|
587
|
-
for (const [e,
|
|
587
|
+
for (const [e, f] of Object.entries(o)) {
|
|
588
588
|
r[e] || (r[e] = {});
|
|
589
|
-
for (const [
|
|
590
|
-
const
|
|
591
|
-
c ? r[e][
|
|
589
|
+
for (const [n, h] of Object.entries(f)) {
|
|
590
|
+
const k = h, c = r[e]?.[n];
|
|
591
|
+
c ? r[e][n] = {
|
|
592
592
|
...c,
|
|
593
|
-
...
|
|
593
|
+
...k,
|
|
594
594
|
custom: {
|
|
595
595
|
...c.custom,
|
|
596
|
-
...
|
|
596
|
+
...k.custom
|
|
597
597
|
}
|
|
598
|
-
} : r[e][
|
|
598
|
+
} : r[e][n] = k;
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
return r;
|
|
602
602
|
}
|
|
603
|
-
const
|
|
603
|
+
const Mt = "./style.css";
|
|
604
604
|
export {
|
|
605
|
-
|
|
606
|
-
|
|
605
|
+
it as CycleTypeEnum,
|
|
606
|
+
ct as ModeEnum,
|
|
607
607
|
C as decimal,
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
608
|
+
Dt as filterIndicatorsCell,
|
|
609
|
+
yt as generateIndicatorsCells,
|
|
610
|
+
W as generateUUID,
|
|
611
|
+
bt as getNumColumns,
|
|
612
|
+
dt as handleClearInput,
|
|
613
|
+
Yt as initDateRange,
|
|
614
|
+
gt as mergeCellData,
|
|
615
|
+
Mt as stylePath,
|
|
616
|
+
ht as useData
|
|
617
617
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(M,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("dayjs"),require("@univerjs/presets"),require("decimal.js")):typeof define=="function"&&define.amd?define(["exports","dayjs","@univerjs/presets","decimal.js"],c):(M=typeof globalThis<"u"?globalThis:M||self,c(M.TorUniverSheet={},M.dayjs,M.presets,M.Decimal))})(this,(function(M,c,U,Z){"use strict";const X=(e,n)=>{for(const r of n)e[r]=null},K=()=>{if(typeof crypto=="object"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"&&typeof Uint8Array=="function"){const r=t=>{const f=Number(t);return(f^crypto.getRandomValues(new Uint8Array(1))[0]&15>>f/4).toString(16)};return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r)}}let e=new Date().getTime(),n=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let t=Math.random()*16;return e>0?(t=(e+t)%16|0,e=Math.floor(e/16)):(t=(n+t)%16|0,n=Math.floor(n/16)),(r==="x"?t:t&3|8).toString(16)})};function ee(e){return{...e?.workbookData,id:e?.id||K(),name:e?.name||"未命名",appVersion:e?.appVersion||"1.0.0"}}const te=Object.prototype.toString,L=(e,n)=>te.call(e)===`[object ${n}]`,re=e=>typeof e<"u",ne=e=>!re(e),oe=e=>e!==null&&L(e,"Object"),E=e=>e==null||typeof e>"u"?!0:J(e)||ie(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:oe(e)?Object.keys(e).length===0:!1,se=e=>e===null,ae=e=>ne(e)||se(e),ie=e=>L(e,"String"),J=e=>e&&Array.isArray(e);class ue{value;constructor(n){this.value=new Z(n)}add(n){return this.value=this.value.add(n||0),this}subtract(n){return this.value=this.value.sub(n||0),this}multiply(n){return this.value=this.value.mul(n||0),this}divide(n){const r=new Z(n);if(r.isZero())throw new Error("除数是0");return this.value=this.value.div(r),this}toFixed(n,r){return this.value=new Z(this.value.toFixed(n,r)),this}valueOf(){return this.value}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}}function S(e=0){return new ue(e)}var Q=(e=>(e.无="no",e.年="year",e.月="month",e.周="week",e.天="day",e.班组="shift",e.小时="hour",e.半小时="half_hour",e))(Q||{}),W=(e=>(e.view="view",e.edit="edit",e))(W||{});async function ce(e,n){if(!n)return Promise.reject("日期不能为空");switch(e){case"year":if(J(n))return Promise.resolve(n);const r=c(n);if(!r.isValid())return Promise.reject("无效的日期格式");const t=r.year(),f=`${t}-01`,s=`${t}-12`;return Promise.resolve([f,s]);case"month":if(J(n))return Promise.resolve(n);const D=c(n);if(!D.isValid())return Promise.reject("无效的日期格式");const d=D.startOf("month").format("YYYY-MM-DD"),u=D.endOf("month").format("YYYY-MM-DD");return Promise.resolve([d,u]);case"day":if(J(n))return Promise.resolve(n);const Y=c(n);if(!Y.isValid())return Promise.reject("无效的日期格式");const P=Y.startOf("day").format("YYYY-MM-DD HH:mm:ss"),m=Y.endOf("day").format("YYYY-MM-DD HH:mm:ss");return Promise.resolve([P,m]);default:return Promise.reject("不支持的周期类型")}}function H(e,n,r){if(!r)return 0;const t={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[r];return["day","hour"].includes(r),c(n,t).diff(c(e,t),r)}function z(e,n,r){if(!r)throw new Error("日期类型不能为空");const t={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[r];return c(e).subtract(n,r).format(t)}function k(e,n,r,t){const f="YYYY-MM-DD HH:mm:ss",s=q(e,n,r,t),D=c(s);if(n==="month"){const u=D.month();return u===0?[D.startOf("month").format(f),D.date(25).endOf("day").format(f)]:u===11?[D.subtract(1,"month").date(26).startOf("day").format(f),D.endOf("month").format(f)]:[D.subtract(1,"month").date(26).startOf("day").format(f),D.date(25).endOf("day").format(f)]}const d={year:"year",day:"day",hour:"hour"};return[D.startOf(d[n]).format(f),D.endOf(d[n]).format(f)]}function q(e,n,r,t){const f={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"YYYY-MM-DD HH:mm:ss"}[n];return c(e,f).add(r*t,n).format(f)}function b(e,n,r){return e[n]||(e[n]={}),e[n][r]||(e[n][r]={}),e[n][r]}async function fe(e){if(!e)throw new Error("cellData is required");const n=Object.entries(e).reduce((r,t)=>{const[f,s]=t;for(const[D,d]of Object.entries(s)){const{custom:u,v:Y,t:P,s:m}=d;if(!u)continue;const{cellType:G}=u,l=!u.hasOwnProperty("writeBack")||E(u?.writeBack)?!0:u.writeBack;if(G==="indicator"){const I=b(r,f,D);I.custom={...u,required:E(u?.required)?!1:u?.required,defaultShift:E(u?.defaultShift)?!1:u?.defaultShift,forwardPush:E(u?.forwardPush)?!1:u?.forwardPush,forwardPushTimes:E(u?.useDefaultEndDate)?0:u?.forwardPushTimes,useDefaultEndDate:E(u?.useDefaultEndDate)?!1:u?.useDefaultEndDate,copyType:E(u?.copyType)?"":u?.copyType,writeBack:l},I.s=m,I.t=P,I.v=Y}}return r},{});return!n||E(n)?Promise.reject(new Error("No data found")):Promise.resolve(n)}function j(e,n){return e.replace(/\$\{([^}]+)\}/g,(r,t)=>{try{const f=Object.keys(n),s=Object.values(n);return new Function(...f,`return ${t};`)(...s)}catch(f){return console.error(`表达式执行失败: ${t}`,f),r}})}function le({acc:e,params:n,initRowNum:r,initColNum:t,cellData:f}){const{rangeData:s,currentDay:D,extraArgs:d}=n,u=d?.teamData||{},{cycleType:Y,timeIncrement:P,forwardPush:m,forwardPushTimes:G,copyType:l,copyInterval:I,defaultShift:F,templateStr:N,useDefaultEndDate:$}=f.custom;let v=0;switch(Y){case"day":{let o="";if(m&&(o=z(s[0],G,"day")),!l){let i="";m?i=o:i=s[0];const g=b(e,r,t);g.v=N?j(N,{businessDate:i,dayjs:c}):c(i).format("YYYY-MM-DD"),g.t=U.CellValueType.STRING;break}m?v=H(o,s[0],"day"):(v=H(s[0],s[1],"day"),console.log("copyNum",v));for(let i=0;i<=Math.abs(v===0?1:v);i++){const g=i*(I+1);let O="";m?O=q(o,"day",i,P):O=q(s[0],"day",i,P);const C=l==="right"?r:r+g,T=l==="right"?t+g:t,y=b(e,C,T);y.v=N?j(N,{businessDate:O,dayjs:c}):c(O).format("YYYY-MM-DD"),y.t=U.CellValueType.STRING}break}case"month":{if(!l){const[o,i]=k(s[1],"month",0,1),g=b(e,r,t);g.v=c(i).format("YYYY-MM"),g.t=U.CellValueType.STRING;break}v=H(s[0],s[1],"month");for(let o=0;o<=Math.abs(v===0?1:v);o++){const i=o*(I+1),g=l==="right"?r:r+i,O=l==="right"?t+i:t,C=b(e,g,O);C.v=q(s[0],"month",o,P),C.t=U.CellValueType.STRING}break}case"year":{let o="";if(m&&(o=z(s[0],G||0,"year")),!l){const i=m?o:s[0],[g,O]=k(i,"year",0,1),C=b(e,r,t),[,T]=k(s[1],"month",0,1);C.v=N?j(N,{startTime:g,endTime:O,rangeData:s,dayjs:c}):i,C.t=U.CellValueType.STRING;break}m?v=H(o,s[0],"year"):v=H(s[0],s[1],"year");for(let i=0;i<=Math.abs(v===0?1:v);i++){const g=i*(I+1),O=l==="right"?r:r+g,C=l==="right"?t+g:t,[T,y]=k(s[0],"year",i,P),a=b(e,O,C),h=q(s[0],"year",i,P);a.v=N?j(N,{startTime:T,endTime:y,rangeData:s,dayjs:c}):h,a.t=U.CellValueType.STRING}break}case"hour":{if(!l){const o=b(e,r,t);if(o.t=U.CellValueType.STRING,F){o.v=c(s[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}o.v=c(D).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}v=H(s[0],s[1],"hour");for(let o=0;o<=Math.abs(v===0?1:v);o++){const i=o*(I+1),g=l==="right"?r:r+i,O=l==="right"?t+i:t,C=b(e,g,O);if(C.t=U.CellValueType.STRING,F){const T=c(s[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");C.v=q(T,"hour",o,P);continue}C.v=q(c(D).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",o,P)}break}case"shift":{if(!l){const o=b(e,r,t);o.t=U.CellValueType.STRING,o.v=N?j(N,{rangeData:s,dayjs:c}):s[0];break}if(!u.length)throw new Error("没有获取到当班数据");for(let o=0;o<u.length;o++){const i=u[o],{startDatetime:g,endDatetime:O}=i,C=o*(I+1),T=l==="right"?r:S(r).add(C).toNumber(),y=l==="right"?S(t).add(C).toNumber():t,a=b(e,T,y);a.v=N?j(N,{team:i}):g}break}}}async function me(e,n){if(!e)return Promise.reject("没有可用的单元格数据");const{extraArgs:r,rangeData:t}=n;if(!t.length)return Promise.reject("处理时间范围失败, rangeData不能为空");const f=r?.teamData||[],s=n?.currentDay||c().format("YYYY-MM-DD"),D=Object.entries(e).reduce((d,u)=>{const[Y,P]=u;for(const[m,G]of Object.entries(P)){const{custom:l}=G;if(!l)continue;const{cellType:I,cycleType:F,timeIncrement:N,forwardPush:$,forwardPushTimes:v,copyType:o,copyInterval:i,defaultShift:g,useDefaultStartDate:O,useDefaultEndDate:C}=l;if(I==="time"){le({acc:d,params:n,initRowNum:Number(Y),initColNum:Number(m),cellData:G});continue}const T={cycleType:F,indicatorName:l.indicatorName,indicatorCode:l.indicatorCode,indicatorId:l.indicatorId,indicatorDimensionName:l.indicatorDimensionName,indicatorDimensionConfig:l.indicatorDimensionConfig,required:ae(l?.required)??!1,cellType:l.cellType,defaultShift:l?.defaultShift||!1,writeBack:E(l?.writeBack)?!0:l.writeBack};let y=0;switch(F){case"day":{let a="";if($&&(a=z(t[0],v||0,"day")),!o){const h=$?a:t[0],[p,w]=k(h,"day",0,1),x=b(d,Y,m);x.custom={...T,startTime:p,endTime:w};break}$?y=H(a,t[0],"day"):y=H(t[0],t[1],"day");for(let h=0;h<=Math.abs(y===0?1:y);h++){const p=h*(i+1),w=$?a:t[0],[x,V]=k(w,"day",h,N),B=o==="right"?Y:S(Y).add(p).toNumber(),R=o==="right"?S(m).add(p).toNumber():m,A=b(d,B,R);A.custom={...T,startTime:x,endTime:V}}break}case"month":{if(!o){const[a,h]=k(t[1],"month",0,1),p=b(d,Y,m);p.custom={...T,startTime:a,endTime:h};break}y=H(t[0],t[1],"month");for(let a=0;a<=Math.abs(y===0?1:y);a++){const h=a*(i+1),p=o==="right"?Y:S(Y).add(h).toNumber(),w=o==="right"?S(m).add(h).toNumber():m,[x,V]=k(t[0],"month",a,N),B=b(d,p,w);B.custom={...T,startTime:x,endTime:V}}break}case"year":{let a="",h="",p="";if($){a=z(t[0],v||0,"year");const w=c(t[1]).format("MM");h=c(`${a}-${w+1}`).format("YYYY-MM"),p=c(`${a}-${w+2}`).format("YYYY-MM")}if(!o){const w=$?a:t[0],[x,V]=k(w,"year",0,1),B=b(d,Y,m),[,R]=k(h,"month",0,1),[A]=k(p,"month",0,1);B.custom={...T,startTime:O?A:x,endTime:C?R:V};break}$?y=H(a,t[0],"year"):y=H(t[0],t[1],"year");for(let w=0;w<=Math.abs(y===0?1:y);w++){const x=w*(i+1),V=o==="right"?Y:S(Y).add(x).toNumber(),B=o==="right"?S(m).add(x).toNumber():m,[R,A]=k(t[0],"year",w,N),_=b(d,V,B);_.custom={...T,startTime:R,endTime:A}}break}case"hour":{if(!o){const a=g?t[0]:t[0]??s,[h,p]=k(a,"hour",1,1),w=b(d,Y,m);w.custom={...T,startTime:h,endTime:p};break}y=H(t[0],t[1],"hour");for(let a=0;a<=Math.abs(y===0?1:y);a++){const h=a*(i+1),p=o==="right"?Y:S(Y).add(h).toNumber(),w=o==="right"?S(m).add(h).toNumber():m,x=b(d,p,w);if(g){const A=c(t[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),[_,De]=k(A,"hour",a,N);x.custom={...T,startTime:_,endTime:De};continue}const V=c(s).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),[B,R]=k(V,"hour",a,N);x.custom={...T,startTime:B,endTime:R}}break}case"shift":{if(!o){const[a,h]=t,p=b(d,Y,m);p.custom={...T,startTime:a,endTime:h};break}if(!f.length)throw new Error("没有获取到当班数据");for(let a=0;a<f.length;a++){const h=f[a],{startDatetime:p,endDatetime:w}=h,x=a*(i+1),V=o==="right"?Y:S(Y).add(x).toNumber(),B=o==="right"?S(m).add(x).toNumber():m,R=b(d,V,B);R.custom={...T,startTime:p,endTime:w}}break}}}return d},{});return Promise.resolve(D)}function de(e){return Object.entries(e).reduce((r,[t,f])=>{const s=Math.max(...Object.keys(f).map(Number));return s>r?r=Number(s):r=Number(r)||0,r},0)}function he(e,n){const r=JSON.parse(JSON.stringify(e||{}));for(const[t,f]of Object.entries(n)){r[t]||(r[t]={});for(const[s,D]of Object.entries(f)){const d=D,u=r[t]?.[s];u?r[t][s]={...u,...d,custom:{...u.custom,...d.custom}}:r[t][s]=d}}return r}const Ye="./style.css";M.CycleTypeEnum=Q,M.ModeEnum=W,M.decimal=S,M.filterIndicatorsCell=fe,M.generateIndicatorsCells=me,M.generateUUID=K,M.getNumColumns=de,M.handleClearInput=X,M.initDateRange=ce,M.mergeCellData=he,M.stylePath=Ye,M.useData=ee,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(M,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("dayjs"),require("@univerjs/presets"),require("decimal.js")):typeof define=="function"&&define.amd?define(["exports","dayjs","@univerjs/presets","decimal.js"],a):(M=typeof globalThis<"u"?globalThis:M||self,a(M.TorUniverSheet={},M.dayjs,M.presets,M.Decimal))})(this,(function(M,a,E,_){"use strict";const te=(e,n)=>{for(const r of n)e[r]=null},Q=()=>{if(typeof crypto=="object"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"&&typeof Uint8Array=="function"){const r=t=>{const l=Number(t);return(l^crypto.getRandomValues(new Uint8Array(1))[0]&15>>l/4).toString(16)};return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r)}}let e=new Date().getTime(),n=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let t=Math.random()*16;return e>0?(t=(e+t)%16|0,e=Math.floor(e/16)):(t=(n+t)%16|0,n=Math.floor(n/16)),(r==="x"?t:t&3|8).toString(16)})};function re(e){return{...e?.workbookData,id:e?.id||Q(),name:e?.name||"未命名",appVersion:e?.appVersion||"1.0.0"}}const ne=Object.prototype.toString,W=(e,n)=>ne.call(e)===`[object ${n}]`,oe=e=>typeof e<"u",se=e=>!oe(e),ae=e=>e!==null&&W(e,"Object"),$=e=>e==null||typeof e>"u"?!0:z(e)||ce(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:ae(e)?Object.keys(e).length===0:!1,ie=e=>e===null,ue=e=>se(e)||ie(e),ce=e=>W(e,"String"),z=e=>e&&Array.isArray(e);class fe{value;constructor(n){this.value=new _(n)}add(n){return this.value=this.value.add(n||0),this}subtract(n){return this.value=this.value.sub(n||0),this}multiply(n){return this.value=this.value.mul(n||0),this}divide(n){const r=new _(n);if(r.isZero())throw new Error("除数是0");return this.value=this.value.div(r),this}toFixed(n,r){return this.value=new _(this.value.toFixed(n,r)),this}valueOf(){return this.value}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}}function H(e=0){return new fe(e)}var X=(e=>(e.无="no",e.年="year",e.月="month",e.周="week",e.天="day",e.班组="shift",e.小时="hour",e.半小时="half_hour",e))(X||{}),ee=(e=>(e.view="view",e.edit="edit",e))(ee||{});async function le(e,n){if(!n)return Promise.reject("日期不能为空");switch(e){case"year":if(z(n))return Promise.resolve(n);const r=a(n);if(!r.isValid())return Promise.reject("无效的日期格式");const t=r.year(),l=`${t}-01`,o=`${t}-12`;return Promise.resolve([l,o]);case"month":if(z(n))return Promise.resolve(n);const h=a(n);if(!h.isValid())return Promise.reject("无效的日期格式");const O=h.startOf("month").format("YYYY-MM-DD"),c=h.endOf("month").format("YYYY-MM-DD");return Promise.resolve([O,c]);case"day":if(z(n))return Promise.resolve(n);const Y=a(n);if(!Y.isValid())return Promise.reject("无效的日期格式");const N=Y.startOf("day").format("YYYY-MM-DD HH:mm:ss"),d=Y.endOf("day").format("YYYY-MM-DD HH:mm:ss");return Promise.resolve([N,d]);default:return Promise.reject("不支持的周期类型")}}function V(e,n,r){if(!r)return 0;const t={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[r];return["day","hour"].includes(r),a(n,t).diff(a(e,t),r)}function Z(e,n,r){if(!r)throw new Error("日期类型不能为空");const t={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[r];return a(e).subtract(n,r).format(t)}function k(e,n,r,t){const l="YYYY-MM-DD HH:mm:ss",o=A(e,n,r,t),h=a(o);if(n==="month"){const c=h.month();return c===0?[h.startOf("month").format(l),h.date(25).endOf("day").format(l)]:c===11?[h.subtract(1,"month").date(26).startOf("day").format(l),h.endOf("month").format(l)]:[h.subtract(1,"month").date(26).startOf("day").format(l),h.date(25).endOf("day").format(l)]}const O={year:"year",day:"day",hour:"hour"};return[h.startOf(O[n]).format(l),h.endOf(O[n]).format(l)]}function A(e,n,r,t){const l={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"YYYY-MM-DD HH:mm:ss"}[n];return a(e,l).add(r*t,n).format(l)}function g(e,n,r){return e[n]||(e[n]={}),e[n][r]||(e[n][r]={}),e[n][r]}async function me(e){if(!e)throw new Error("cellData is required");const n=Object.entries(e).reduce((r,t)=>{const[l,o]=t;for(const[h,O]of Object.entries(o)){const{custom:c,v:Y,t:N,s:d}=O;if(!c)continue;const{cellType:J}=c,u=!c.hasOwnProperty("writeBack")||$(c?.writeBack)?!0:c.writeBack;if(J==="indicator"){const I=g(r,l,h);I.custom={...c,required:$(c?.required)?!1:c?.required,defaultShift:$(c?.defaultShift)?!1:c?.defaultShift,forwardPush:$(c?.forwardPush)?!1:c?.forwardPush,forwardPushTimes:$(c?.useDefaultEndDate)?0:c?.forwardPushTimes,useDefaultEndDate:$(c?.useDefaultEndDate)?!1:c?.useDefaultEndDate,copyType:$(c?.copyType)?"":c?.copyType,writeBack:u},I.s=d,I.t=N,I.v=Y}}return r},{});return!n||$(n)?Promise.reject(new Error("No data found")):Promise.resolve(n)}function j(e,n){return e.replace(/\$\{([^}]+)\}/g,(r,t)=>{try{const l=Object.keys(n),o=Object.values(n);return new Function(...l,`return ${t};`)(...o)}catch(l){return console.error(`表达式执行失败: ${t}`,l),r}})}function de({acc:e,params:n,initRowNum:r,initColNum:t,cellData:l}){const{rangeData:o,currentDay:h,extraArgs:O}=n,c=O?.teamData||{},{cycleType:Y,timeIncrement:N,forwardPush:d,forwardPushTimes:J,copyType:u,copyInterval:I,defaultShift:S,templateStr:P,useDefaultEndDate:K}=l.custom;let b=0;switch(Y){case"day":{let s="";if(d&&(s=Z(o[0],J,"day")),!u){let f="";d?f=s:f=o[0];const i=g(e,r,t);i.v=P?j(P,{businessDate:f,dayjs:a}):a(f).format("YYYY-MM-DD"),i.t=E.CellValueType.STRING;break}d?b=V(s,o[0],"day"):(b=V(o[0],o[1],"day"),console.log("copyNum",b));for(let f=0;f<=Math.abs(b===0?1:b);f++){const i=f*(I+1);let w="";d?w=A(s,"day",f,N):w=A(o[0],"day",f,N);const T=u==="right"?r:r+i,R=u==="right"?t+i:t,G=g(e,T,R);G.v=P?j(P,{businessDate:w,dayjs:a}):a(w).format("YYYY-MM-DD"),G.t=E.CellValueType.STRING}break}case"month":{if(!u){const[s,f]=k(o[1],"month",0,1),i=g(e,r,t);i.v=a(f).format("YYYY-MM"),i.t=E.CellValueType.STRING;break}b=V(o[0],o[1],"month");for(let s=0;s<=Math.abs(b===0?1:b);s++){const f=s*(I+1),i=u==="right"?r:r+f,w=u==="right"?t+f:t,T=g(e,i,w);T.v=A(o[0],"month",s,N),T.t=E.CellValueType.STRING}break}case"year":{let s="";if(d&&(s=Z(o[0],J||0,"year")),!u){const f=d?s:o[0],[i,w]=k(f,"year",0,1),T=g(e,r,t),[,R]=k(o[1],"month",0,1);T.v=P?j(P,{startTime:i,endTime:w,rangeData:o,dayjs:a}):f,T.t=E.CellValueType.STRING;break}d?b=V(s,o[0],"year"):b=V(o[0],o[1],"year");for(let f=0;f<=Math.abs(b===0?1:b);f++){const i=f*(I+1),w=u==="right"?r:r+i,T=u==="right"?t+i:t,[R,G]=k(o[0],"year",f,N),v=g(e,w,T),C=A(o[0],"year",f,N);v.v=P?j(P,{startTime:R,endTime:G,rangeData:o,dayjs:a}):C,v.t=E.CellValueType.STRING}break}case"hour":{if(!u){const s=g(e,r,t);if(s.t=E.CellValueType.STRING,S){s.v=a(o[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}s.v=a(h).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}b=V(o[0],o[1],"hour");for(let s=0;s<=Math.abs(b===0?1:b);s++){const f=s*(I+1),i=u==="right"?r:r+f,w=u==="right"?t+f:t,T=g(e,i,w);if(T.t=E.CellValueType.STRING,S){const R=a(o[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");T.v=A(R,"hour",s,N);continue}T.v=A(a(h).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",s,N)}break}case"shift":{if(!u){const s=g(e,r,t);s.t=E.CellValueType.STRING,s.v=P?j(P,{rangeData:o,dayjs:a}):o[0];break}if(!c.length)throw new Error("没有获取到当班数据");for(let s=0;s<c.length;s++){const f=c[s],{startDatetime:i,endDatetime:w}=f,T=s*(I+1),R=u==="right"?r:H(r).add(T).toNumber(),G=u==="right"?H(t).add(T).toNumber():t,v=g(e,R,G);v.v=P?j(P,{team:f}):i}break}}}async function he(e,n){if(!e)return Promise.reject("没有可用的单元格数据");const{extraArgs:r,rangeData:t}=n;if(!t.length)return Promise.reject("处理时间范围失败, rangeData不能为空");const l=r?.teamData||[],{periodicityTime:o}=n,h=n?.currentDay||a().format("YYYY-MM-DD"),O=(Y,N)=>o?parseInt(o.split(":")[0],10)<12?[a(Y).format("YYYY-MM-DD")+" "+o,a(N).add(1,"day").format("YYYY-MM-DD")+" "+o]:[a(Y).subtract(1,"day").format("YYYY-MM-DD")+" "+o,a(N).format("YYYY-MM-DD")+" "+o]:[Y,N],c=Object.entries(e).reduce((Y,N)=>{const[d,J]=N;for(const[u,I]of Object.entries(J)){const{custom:S}=I;if(!S)continue;const{cellType:P,cycleType:K,timeIncrement:b,forwardPush:s,forwardPushTimes:f,copyType:i,copyInterval:w,defaultShift:T,useDefaultStartDate:R,useDefaultEndDate:G}=S;if(P==="time"){de({acc:Y,params:n,initRowNum:Number(d),initColNum:Number(u),cellData:I});continue}const v={cycleType:K,indicatorName:S.indicatorName,indicatorCode:S.indicatorCode,indicatorId:S.indicatorId,indicatorDimensionName:S.indicatorDimensionName,indicatorDimensionConfig:S.indicatorDimensionConfig,required:ue(S?.required)??!1,cellType:S.cellType,defaultShift:S?.defaultShift||!1,writeBack:$(S?.writeBack)?!0:S.writeBack};let C=0;switch(K){case"day":{let m="";if(s&&(m=Z(t[0],f||0,"day")),!i){const D=s?m:t[0],[p,y]=O(...k(D,"day",0,1)),x=g(Y,d,u);x.custom={...v,startTime:p,endTime:y};break}s?C=V(m,t[0],"day"):C=V(t[0],t[1],"day");for(let D=0;D<=Math.abs(C===0?1:C);D++){const p=D*(w+1),y=s?m:t[0],[x,B]=O(...k(y,"day",D,b)),U=i==="right"?d:H(d).add(p).toNumber(),q=i==="right"?H(u).add(p).toNumber():u,F=g(Y,U,q);F.custom={...v,startTime:x,endTime:B}}break}case"month":{if(!i){const[m,D]=k(t[1],"month",0,1),p=g(Y,d,u);p.custom={...v,startTime:m,endTime:D};break}C=V(t[0],t[1],"month");for(let m=0;m<=Math.abs(C===0?1:C);m++){const D=m*(w+1),p=i==="right"?d:H(d).add(D).toNumber(),y=i==="right"?H(u).add(D).toNumber():u,[x,B]=k(t[0],"month",m,b),U=g(Y,p,y);U.custom={...v,startTime:x,endTime:B}}break}case"year":{let m="",D="",p="";if(s){m=Z(t[0],f||0,"year");const y=a(t[1]).format("MM");D=a(`${m}-${y+1}`).format("YYYY-MM"),p=a(`${m}-${y+2}`).format("YYYY-MM")}if(!i){const y=s?m:t[0],[x,B]=k(y,"year",0,1),U=g(Y,d,u),[,q]=k(D,"month",0,1),[F]=k(p,"month",0,1);U.custom={...v,startTime:R?F:x,endTime:G?q:B};break}s?C=V(m,t[0],"year"):C=V(t[0],t[1],"year");for(let y=0;y<=Math.abs(C===0?1:C);y++){const x=y*(w+1),B=i==="right"?d:H(d).add(x).toNumber(),U=i==="right"?H(u).add(x).toNumber():u,[q,F]=k(t[0],"year",y,b),L=g(Y,B,U);L.custom={...v,startTime:q,endTime:F}}break}case"hour":{if(!i){const m=T?t[0]:t[0]??h,[D,p]=k(m,"hour",1,1),y=g(Y,d,u);y.custom={...v,startTime:D,endTime:p};break}C=V(t[0],t[1],"hour");for(let m=0;m<=Math.abs(C===0?1:C);m++){const D=m*(w+1),p=i==="right"?d:H(d).add(D).toNumber(),y=i==="right"?H(u).add(D).toNumber():u,x=g(Y,p,y);if(T){const F=a(t[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),[L,be]=k(F,"hour",m,b);x.custom={...v,startTime:L,endTime:be};continue}const B=a(h).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),[U,q]=k(B,"hour",m,b);x.custom={...v,startTime:U,endTime:q}}break}case"shift":{if(!i){const[m,D]=t,p=g(Y,d,u);p.custom={...v,startTime:m,endTime:D};break}if(!l.length)throw new Error("没有获取到当班数据");for(let m=0;m<l.length;m++){const D=l[m],{startDatetime:p,endDatetime:y}=D,x=m*(w+1),B=i==="right"?d:H(d).add(x).toNumber(),U=i==="right"?H(u).add(x).toNumber():u,q=g(Y,B,U);q.custom={...v,startTime:p,endTime:y}}break}}}return Y},{});return Promise.resolve(c)}function Ye(e){return Object.entries(e).reduce((r,[t,l])=>{const o=Math.max(...Object.keys(l).map(Number));return o>r?r=Number(o):r=Number(r)||0,r},0)}function De(e,n){const r=JSON.parse(JSON.stringify(e||{}));for(const[t,l]of Object.entries(n)){r[t]||(r[t]={});for(const[o,h]of Object.entries(l)){const O=h,c=r[t]?.[o];c?r[t][o]={...c,...O,custom:{...c.custom,...O.custom}}:r[t][o]=O}}return r}const ge="./style.css";M.CycleTypeEnum=X,M.ModeEnum=ee,M.decimal=H,M.filterIndicatorsCell=me,M.generateIndicatorsCells=he,M.generateUUID=Q,M.getNumColumns=Ye,M.handleClearInput=te,M.initDateRange=le,M.mergeCellData=De,M.stylePath=ge,M.useData=re,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare interface IGenerateIndicatorsCellsParams {
|
|
|
90
90
|
extraArgs: any;
|
|
91
91
|
rangeData: string[];
|
|
92
92
|
currentDay?: string;
|
|
93
|
+
periodicityTime?: string;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
export declare function initDateRange(cycleType: CycleTypeEnum, date: string[] | string): Promise<string[]>;
|