tor-univer-sheet 1.1.3 → 1.1.4
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.
|
@@ -132,8 +132,8 @@ async function ne(e, o) {
|
|
|
132
132
|
const x = b(o);
|
|
133
133
|
if (!x.isValid())
|
|
134
134
|
return Promise.reject("无效的日期格式");
|
|
135
|
-
const
|
|
136
|
-
return Promise.resolve([
|
|
135
|
+
const f = x.startOf("day").format("YYYY-MM-DD HH:mm:ss"), h = x.endOf("day").format("YYYY-MM-DD HH:mm:ss");
|
|
136
|
+
return Promise.resolve([f, h]);
|
|
137
137
|
default:
|
|
138
138
|
return Promise.reject("不支持的周期类型");
|
|
139
139
|
}
|
|
@@ -184,7 +184,7 @@ async function se(e) {
|
|
|
184
184
|
const o = Object.entries(e).reduce((r, t) => {
|
|
185
185
|
const [l, a] = t;
|
|
186
186
|
for (const [d, T] of Object.entries(a)) {
|
|
187
|
-
const { custom: i, v: x, t:
|
|
187
|
+
const { custom: i, v: x, t: f, s: h } = T;
|
|
188
188
|
if (!i) continue;
|
|
189
189
|
const { cellType: Y } = i;
|
|
190
190
|
if (Y === "indicator") {
|
|
@@ -194,7 +194,7 @@ async function se(e) {
|
|
|
194
194
|
required: R(i?.required) ? !1 : i?.required,
|
|
195
195
|
defaultShift: R(i?.defaultShift) ? !1 : i?.defaultShift,
|
|
196
196
|
forwardPush: R(i?.forwardPush) ? !1 : i?.forwardPush
|
|
197
|
-
}, O.s = h, O.t =
|
|
197
|
+
}, O.s = h, O.t = f, O.v = x;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
return r;
|
|
@@ -210,24 +210,24 @@ function X({
|
|
|
210
210
|
}) {
|
|
211
211
|
const { rangeData: a, currentDay: d, extraArgs: T } = o;
|
|
212
212
|
T?.teamData;
|
|
213
|
-
const { cycleType: i, timeIncrement: x, forwardPush:
|
|
213
|
+
const { cycleType: i, timeIncrement: x, forwardPush: f, copyType: h, copyInterval: Y, defaultShift: O } = l.custom;
|
|
214
214
|
let y = 0;
|
|
215
215
|
switch (i) {
|
|
216
216
|
case "day": {
|
|
217
217
|
let n = "";
|
|
218
|
-
if (
|
|
218
|
+
if (f && (n = q(
|
|
219
219
|
a[0],
|
|
220
220
|
6,
|
|
221
221
|
"day"
|
|
222
222
|
/* day */
|
|
223
223
|
)), !h) {
|
|
224
|
-
let
|
|
225
|
-
|
|
224
|
+
let m = "";
|
|
225
|
+
f ? m = n : m = a[0];
|
|
226
226
|
const c = D(e, r, t);
|
|
227
|
-
c.v =
|
|
227
|
+
c.v = m, c.t = j.STRING;
|
|
228
228
|
break;
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
f ? y = H(
|
|
231
231
|
n,
|
|
232
232
|
a[0],
|
|
233
233
|
"day"
|
|
@@ -238,10 +238,10 @@ function X({
|
|
|
238
238
|
"day"
|
|
239
239
|
/* day */
|
|
240
240
|
);
|
|
241
|
-
for (let
|
|
242
|
-
const c =
|
|
241
|
+
for (let m = 0; m <= Math.abs(y === 0 ? 1 : y); m++) {
|
|
242
|
+
const c = m * (Y + 1);
|
|
243
243
|
let w = "";
|
|
244
|
-
|
|
244
|
+
f ? w = N(n, "day", m, x) : w = N(a[0], "day", m, x);
|
|
245
245
|
const g = h === "right" ? r : r + c, p = h === "right" ? t + c : t, M = D(e, g, p);
|
|
246
246
|
M.v = w, M.t = j.STRING;
|
|
247
247
|
}
|
|
@@ -260,7 +260,7 @@ function X({
|
|
|
260
260
|
/* month */
|
|
261
261
|
);
|
|
262
262
|
for (let n = 0; n <= Math.abs(y === 0 ? 1 : y); n++) {
|
|
263
|
-
const
|
|
263
|
+
const m = n * (Y + 1), c = h === "right" ? r : r + m, w = h === "right" ? t + m : t, g = D(e, c, w);
|
|
264
264
|
g.v = N(a[0], "month", n, x), g.t = j.STRING;
|
|
265
265
|
}
|
|
266
266
|
break;
|
|
@@ -278,7 +278,7 @@ function X({
|
|
|
278
278
|
/* year */
|
|
279
279
|
);
|
|
280
280
|
for (let n = 0; n <= Math.abs(y === 0 ? 1 : y); n++) {
|
|
281
|
-
const
|
|
281
|
+
const m = n * (Y + 1), c = h === "right" ? r : r + m, w = h === "right" ? t + m : t, g = D(e, c, w);
|
|
282
282
|
g.v = N(a[0], "year", n, x), g.t = j.STRING;
|
|
283
283
|
}
|
|
284
284
|
break;
|
|
@@ -300,7 +300,7 @@ function X({
|
|
|
300
300
|
/* hour */
|
|
301
301
|
);
|
|
302
302
|
for (let n = 0; n < Math.abs(y === 0 ? 1 : y); n++) {
|
|
303
|
-
const
|
|
303
|
+
const m = n * (Y + 1), c = h === "right" ? r : r + m, w = h === "right" ? t + m : t, g = D(e, c, w);
|
|
304
304
|
if (g.t = j.STRING, O) {
|
|
305
305
|
const p = b(a[0]).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
|
|
306
306
|
g.v = N(p, "hour", n, x);
|
|
@@ -320,12 +320,12 @@ async function ae(e, o) {
|
|
|
320
320
|
r?.teamData;
|
|
321
321
|
const l = o?.currentDay || b().format("YYYY-MM-DD"), a = Object.entries(e).reduce((d, T) => {
|
|
322
322
|
const [i, x] = T;
|
|
323
|
-
for (const [
|
|
323
|
+
for (const [f, h] of Object.entries(x)) {
|
|
324
324
|
const { custom: Y } = h;
|
|
325
325
|
if (!Y) continue;
|
|
326
|
-
const { cellType: O, cycleType: y, timeIncrement: n, forwardPush:
|
|
326
|
+
const { cellType: O, cycleType: y, timeIncrement: n, forwardPush: m, copyType: c, copyInterval: w, defaultShift: g } = Y;
|
|
327
327
|
if (O === "time") {
|
|
328
|
-
X({ acc: d, params: o, initRowNum: Number(i), initColNum: Number(
|
|
328
|
+
X({ acc: d, params: o, initRowNum: Number(i), initColNum: Number(f), cellData: h });
|
|
329
329
|
continue;
|
|
330
330
|
}
|
|
331
331
|
const p = {
|
|
@@ -343,15 +343,15 @@ async function ae(e, o) {
|
|
|
343
343
|
switch (y) {
|
|
344
344
|
case "day": {
|
|
345
345
|
let s = "";
|
|
346
|
-
if (
|
|
346
|
+
if (m && (s = q(
|
|
347
347
|
t[0],
|
|
348
348
|
6,
|
|
349
349
|
"day"
|
|
350
350
|
/* day */
|
|
351
351
|
)), !c) {
|
|
352
352
|
let u = "";
|
|
353
|
-
|
|
354
|
-
const v = D(d, i,
|
|
353
|
+
m ? u = s : u = t[0];
|
|
354
|
+
const v = D(d, i, f);
|
|
355
355
|
v.custom = {
|
|
356
356
|
...p,
|
|
357
357
|
businessDate: u,
|
|
@@ -360,7 +360,7 @@ async function ae(e, o) {
|
|
|
360
360
|
}, g && (v.custom.startTime = t[0], v.custom.endTime = t[1]);
|
|
361
361
|
break;
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
m ? M = H(
|
|
364
364
|
s,
|
|
365
365
|
t[0],
|
|
366
366
|
"day"
|
|
@@ -374,8 +374,8 @@ async function ae(e, o) {
|
|
|
374
374
|
for (let u = 0; u < Math.abs(M === 0 ? 1 : M); u++) {
|
|
375
375
|
const v = u * (w + 1);
|
|
376
376
|
let S = "";
|
|
377
|
-
|
|
378
|
-
const C = c === "right" ? i : k(i).add(v).toNumber(), U = c === "right" ? k(
|
|
377
|
+
m ? S = N(s, "day", u, n) : S = N(t[0], "day", u, n);
|
|
378
|
+
const C = c === "right" ? i : k(i).add(v).toNumber(), U = c === "right" ? k(f).add(v).toNumber() : f, P = D(d, C, U);
|
|
379
379
|
P.custom = {
|
|
380
380
|
...p,
|
|
381
381
|
businessDate: S,
|
|
@@ -387,7 +387,7 @@ async function ae(e, o) {
|
|
|
387
387
|
}
|
|
388
388
|
case "month": {
|
|
389
389
|
if (!c) {
|
|
390
|
-
const s = D(d, i,
|
|
390
|
+
const s = D(d, i, f);
|
|
391
391
|
s.custom = {
|
|
392
392
|
...p,
|
|
393
393
|
businessDate: t[0],
|
|
@@ -403,9 +403,11 @@ async function ae(e, o) {
|
|
|
403
403
|
/* month */
|
|
404
404
|
);
|
|
405
405
|
for (let s = 0; s <= Math.abs(M === 0 ? 1 : M); s++) {
|
|
406
|
-
const u = s * (w + 1), v = c === "right" ? i : k(i).add(u).toNumber(), S = c === "right" ? k(
|
|
406
|
+
const u = s * (w + 1), v = c === "right" ? i : k(i).add(u).toNumber(), S = c === "right" ? k(f).add(u).toNumber() : f, C = D(d, v, S);
|
|
407
407
|
C.custom = {
|
|
408
408
|
...p,
|
|
409
|
+
startTime: "",
|
|
410
|
+
endTime: "",
|
|
409
411
|
businessDate: N(t[0], "month", s, n)
|
|
410
412
|
};
|
|
411
413
|
}
|
|
@@ -413,7 +415,7 @@ async function ae(e, o) {
|
|
|
413
415
|
}
|
|
414
416
|
case "year": {
|
|
415
417
|
if (!c) {
|
|
416
|
-
const s = D(d, i,
|
|
418
|
+
const s = D(d, i, f);
|
|
417
419
|
s.custom = {
|
|
418
420
|
...p,
|
|
419
421
|
businessDate: t[0],
|
|
@@ -429,9 +431,11 @@ async function ae(e, o) {
|
|
|
429
431
|
/* year */
|
|
430
432
|
);
|
|
431
433
|
for (let s = 0; s < Math.abs(M === 0 ? 1 : M); s++) {
|
|
432
|
-
const u = s * (w + 1), v = c === "right" ? i : k(i).add(u).toNumber(), S = c === "right" ? k(
|
|
434
|
+
const u = s * (w + 1), v = c === "right" ? i : k(i).add(u).toNumber(), S = c === "right" ? k(f).add(u).toNumber() : f, C = D(d, v, S);
|
|
433
435
|
C.custom = {
|
|
434
436
|
...p,
|
|
437
|
+
startTime: "",
|
|
438
|
+
endTime: "",
|
|
435
439
|
businessDate: N(t[0], "year", s, n)
|
|
436
440
|
};
|
|
437
441
|
}
|
|
@@ -440,7 +444,7 @@ async function ae(e, o) {
|
|
|
440
444
|
case "hour": {
|
|
441
445
|
if (!c) {
|
|
442
446
|
let s = "";
|
|
443
|
-
const u = D(d, i,
|
|
447
|
+
const u = D(d, i, f);
|
|
444
448
|
if (g) {
|
|
445
449
|
s = N(t[0], "hour", 1, 1), u.custom = {
|
|
446
450
|
...p,
|
|
@@ -467,7 +471,7 @@ async function ae(e, o) {
|
|
|
467
471
|
);
|
|
468
472
|
for (let s = 0; s < Math.abs(M === 0 ? 1 : M); s++) {
|
|
469
473
|
let u = "";
|
|
470
|
-
const v = s * (w + 1), S = c === "right" ? i : k(i).add(v).toNumber(), C = c === "right" ? k(
|
|
474
|
+
const v = s * (w + 1), S = c === "right" ? i : k(i).add(v).toNumber(), C = c === "right" ? k(f).add(v).toNumber() : f, U = D(d, S, C);
|
|
471
475
|
if (g) {
|
|
472
476
|
const P = b(t[0]).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
|
|
473
477
|
u = N(P, "hour", s, n), U.custom = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(Y,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("dayjs"),require("@univerjs/presets"),require("decimal.js")):typeof define=="function"&&define.amd?define(["exports","dayjs","@univerjs/presets","decimal.js"],m):(Y=typeof globalThis<"u"?globalThis:Y||self,m(Y.TorUniverSheet={},Y.dayjs,Y.presets,Y.Decimal))})(this,(function(Y,m,I,G){"use strict";const B=(e,n)=>{for(const r of n)e[r]=null},A=()=>{if(typeof crypto=="object"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"&&typeof Uint8Array=="function"){const r=t=>{const d=Number(t);return(d^crypto.getRandomValues(new Uint8Array(1))[0]&15>>d/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 Z(e){return{...e?.workbookData,id:e?.id||A(),name:e?.name||"未命名",appVersion:e?.appVersion||"1.0.0"}}const _=Object.prototype.toString,F=(e,n)=>_.call(e)===`[object ${n}]`,E=e=>typeof e<"u",K=e=>!E(e),L=e=>e!==null&&F(e,"Object"),U=e=>e==null||typeof e>"u"?!0:R(e)||X(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:L(e)?Object.keys(e).length===0:!1,Q=e=>e===null,W=e=>K(e)||Q(e),X=e=>F(e,"String"),R=e=>e&&Array.isArray(e);class ee{value;constructor(n){this.value=new G(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 G(n);if(r.isZero())throw new Error("除数是0");return this.value=this.value.div(r),this}toFixed(n,r){return this.value=new G(this.value.toFixed(n,r)),this}valueOf(){return this.value}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}}function O(e=0){return new ee(e)}var $=(e=>(e.无="no",e.年="year",e.月="month",e.周="week",e.天="day",e.班组="shift",e.小时="hour",e.半小时="half_hour",e))($||{}),J=(e=>(e.view="view",e.edit="edit",e))(J||{});async function te(e,n){if(!n)return Promise.reject("日期不能为空");switch(e){case"year":if(R(n))return Promise.resolve(n);const r=m(n);if(!r.isValid())return Promise.reject("无效的日期格式");const t=r.year(),d=`${t}-01`,i=`${t}-12`;return Promise.resolve([d,i]);case"month":if(R(n))return Promise.resolve(n);const h=m(n);if(!h.isValid())return Promise.reject("无效的日期格式");const p=h.startOf("month").format("YYYY-MM-DD"),a=h.endOf("month").format("YYYY-MM-DD");return Promise.resolve([p,a]);case"day":if(R(n))return Promise.resolve(n);const v=m(n);if(!v.isValid())return Promise.reject("无效的日期格式");const f=v.startOf("day").format("YYYY-MM-DD HH:mm:ss"),D=v.endOf("day").format("YYYY-MM-DD HH:mm:ss");return Promise.resolve([f,D]);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)?m(n,t).diff(m(e,t),r)+1:m(n,t).diff(m(e,t),r)}function z(e,n,r){const t={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[r];return m(e).subtract(n,r).format(t)}function
|
|
1
|
+
(function(Y,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("dayjs"),require("@univerjs/presets"),require("decimal.js")):typeof define=="function"&&define.amd?define(["exports","dayjs","@univerjs/presets","decimal.js"],m):(Y=typeof globalThis<"u"?globalThis:Y||self,m(Y.TorUniverSheet={},Y.dayjs,Y.presets,Y.Decimal))})(this,(function(Y,m,I,G){"use strict";const B=(e,n)=>{for(const r of n)e[r]=null},A=()=>{if(typeof crypto=="object"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"&&typeof Uint8Array=="function"){const r=t=>{const d=Number(t);return(d^crypto.getRandomValues(new Uint8Array(1))[0]&15>>d/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 Z(e){return{...e?.workbookData,id:e?.id||A(),name:e?.name||"未命名",appVersion:e?.appVersion||"1.0.0"}}const _=Object.prototype.toString,F=(e,n)=>_.call(e)===`[object ${n}]`,E=e=>typeof e<"u",K=e=>!E(e),L=e=>e!==null&&F(e,"Object"),U=e=>e==null||typeof e>"u"?!0:R(e)||X(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:L(e)?Object.keys(e).length===0:!1,Q=e=>e===null,W=e=>K(e)||Q(e),X=e=>F(e,"String"),R=e=>e&&Array.isArray(e);class ee{value;constructor(n){this.value=new G(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 G(n);if(r.isZero())throw new Error("除数是0");return this.value=this.value.div(r),this}toFixed(n,r){return this.value=new G(this.value.toFixed(n,r)),this}valueOf(){return this.value}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}}function O(e=0){return new ee(e)}var $=(e=>(e.无="no",e.年="year",e.月="month",e.周="week",e.天="day",e.班组="shift",e.小时="hour",e.半小时="half_hour",e))($||{}),J=(e=>(e.view="view",e.edit="edit",e))(J||{});async function te(e,n){if(!n)return Promise.reject("日期不能为空");switch(e){case"year":if(R(n))return Promise.resolve(n);const r=m(n);if(!r.isValid())return Promise.reject("无效的日期格式");const t=r.year(),d=`${t}-01`,i=`${t}-12`;return Promise.resolve([d,i]);case"month":if(R(n))return Promise.resolve(n);const h=m(n);if(!h.isValid())return Promise.reject("无效的日期格式");const p=h.startOf("month").format("YYYY-MM-DD"),a=h.endOf("month").format("YYYY-MM-DD");return Promise.resolve([p,a]);case"day":if(R(n))return Promise.resolve(n);const v=m(n);if(!v.isValid())return Promise.reject("无效的日期格式");const f=v.startOf("day").format("YYYY-MM-DD HH:mm:ss"),D=v.endOf("day").format("YYYY-MM-DD HH:mm:ss");return Promise.resolve([f,D]);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)?m(n,t).diff(m(e,t),r)+1:m(n,t).diff(m(e,t),r)}function z(e,n,r){const t={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[r];return m(e).subtract(n,r).format(t)}function w(e,n,r,t){const d={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"YYYY-MM-DD HH:mm:ss"}[n];return m(e,d).add(r*t,n).format(d)}function j(e,n,r,t){const d={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"YYYY-MM-DD HH:mm:ss"}[n];return m(e,d).subtract(r*t,n).format(d)}function b(e,n,r){return e[n]||(e[n]={}),e[n][r]||(e[n][r]={}),e[n][r]}async function re(e){if(!e)throw new Error("cellData is required");const n=Object.entries(e).reduce((r,t)=>{const[d,i]=t;for(const[h,p]of Object.entries(i)){const{custom:a,v,t:f,s:D}=p;if(!a)continue;const{cellType:g}=a;if(g==="indicator"){const P=b(r,d,h);P.custom={...a,required:U(a?.required)?!1:a?.required,defaultShift:U(a?.defaultShift)?!1:a?.defaultShift,forwardPush:U(a?.forwardPush)?!1:a?.forwardPush},P.s=D,P.t=f,P.v=v}}return r},{});return!n||U(n)?Promise.reject(new Error("No data found")):Promise.resolve(n)}function ne({acc:e,params:n,initRowNum:r,initColNum:t,cellData:d}){const{rangeData:i,currentDay:h,extraArgs:p}=n;p?.teamData;const{cycleType:a,timeIncrement:v,forwardPush:f,copyType:D,copyInterval:g,defaultShift:P}=d.custom;let y=0;switch(a){case"day":{let o="";if(f&&(o=z(i[0],6,"day")),!D){let c="";f?c=o:c=i[0];const l=b(e,r,t);l.v=c,l.t=I.CellValueType.STRING;break}f?y=H(o,i[0],"day"):y=H(i[0],i[1],"day");for(let c=0;c<=Math.abs(y===0?1:y);c++){const l=c*(g+1);let x="";f?x=w(o,"day",c,v):x=w(i[0],"day",c,v);const M=D==="right"?r:r+l,N=D==="right"?t+l:t,T=b(e,M,N);T.v=x,T.t=I.CellValueType.STRING}break}case"month":{if(!D){const o=b(e,r,t);o.v=i[0],o.t=I.CellValueType.STRING;break}y=H(i[0],i[1],"month");for(let o=0;o<=Math.abs(y===0?1:y);o++){const c=o*(g+1),l=D==="right"?r:r+c,x=D==="right"?t+c:t,M=b(e,l,x);M.v=w(i[0],"month",o,v),M.t=I.CellValueType.STRING}break}case"year":{if(!D){const o=b(e,r,t);o.v=i[0],o.t=I.CellValueType.STRING;break}y=H(i[0],i[1],"year");for(let o=0;o<=Math.abs(y===0?1:y);o++){const c=o*(g+1),l=D==="right"?r:r+c,x=D==="right"?t+c:t,M=b(e,l,x);M.v=w(i[0],"year",o,v),M.t=I.CellValueType.STRING}break}case"hour":{if(!D){const o=b(e,r,t);if(o.t=I.CellValueType.STRING,P){o.v=m(i[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}o.v=m(h).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}y=H(i[0],i[1],"hour");for(let o=0;o<Math.abs(y===0?1:y);o++){const c=o*(g+1),l=D==="right"?r:r+c,x=D==="right"?t+c:t,M=b(e,l,x);if(M.t=I.CellValueType.STRING,P){const N=m(i[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");M.v=w(N,"hour",o,v);continue}M.v=w(m(h).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",o,v)}}}}async function oe(e,n){if(!e)return Promise.reject("没有可用的单元格数据");const{extraArgs:r,rangeData:t}=n;if(!t.length)return Promise.reject("处理时间范围失败, rangeData不能为空");r?.teamData;const d=n?.currentDay||m().format("YYYY-MM-DD"),i=Object.entries(e).reduce((h,p)=>{const[a,v]=p;for(const[f,D]of Object.entries(v)){const{custom:g}=D;if(!g)continue;const{cellType:P,cycleType:y,timeIncrement:o,forwardPush:c,copyType:l,copyInterval:x,defaultShift:M}=g;if(P==="time"){ne({acc:h,params:n,initRowNum:Number(a),initColNum:Number(f),cellData:D});continue}const N={cycleType:y,indicatorName:g.indicatorName,indicatorCode:g.indicatorCode,indicatorId:g.indicatorId,indicatorDimensionName:g.indicatorDimensionName,indicatorDimensionConfig:g.indicatorDimensionConfig,required:W(g?.required)??!1,cellType:g.cellType,defaultShift:g?.defaultShift||!1};let T=0;switch(y){case"day":{let s="";if(c&&(s=z(t[0],6,"day")),!l){let u="";c?u=s:u=t[0];const C=b(h,a,f);C.custom={...N,businessDate:u,startTime:"",endTime:""},M&&(C.custom.startTime=t[0],C.custom.endTime=t[1]);break}c?T=H(s,t[0],"day"):T=H(t[0],t[1],"day");for(let u=0;u<Math.abs(T===0?1:T);u++){const C=u*(x+1);let S="";c?S=w(s,"day",u,o):S=w(t[0],"day",u,o);const k=l==="right"?a:O(a).add(C).toNumber(),q=l==="right"?O(f).add(C).toNumber():f,V=b(h,k,q);V.custom={...N,businessDate:S,startTime:"",endTime:""},M&&(V.custom.startTime=j(S,"day",u,o),V.custom.endTime=S)}break}case"month":{if(!l){const s=b(h,a,f);s.custom={...N,businessDate:t[0],startTime:"",endTime:""};break}T=H(t[0],t[1],"month");for(let s=0;s<=Math.abs(T===0?1:T);s++){const u=s*(x+1),C=l==="right"?a:O(a).add(u).toNumber(),S=l==="right"?O(f).add(u).toNumber():f,k=b(h,C,S);k.custom={...N,startTime:"",endTime:"",businessDate:w(t[0],"month",s,o)}}break}case"year":{if(!l){const s=b(h,a,f);s.custom={...N,businessDate:t[0],startTime:"",endTime:""};break}T=H(t[0],t[1],"year");for(let s=0;s<Math.abs(T===0?1:T);s++){const u=s*(x+1),C=l==="right"?a:O(a).add(u).toNumber(),S=l==="right"?O(f).add(u).toNumber():f,k=b(h,C,S);k.custom={...N,startTime:"",endTime:"",businessDate:w(t[0],"year",s,o)}}break}case"hour":{if(!l){let s="";const u=b(h,a,f);if(M){s=w(t[0],"hour",1,1),u.custom={...N,businessDate:s,startTime:j(s,"hour",1,1),endTime:s};break}s=w(t[0]??d,"hour",1,1),u.custom={...N,businessDate:s,startTime:j(s,"hour",1,1),endTime:s};break}T=H(t[0],t[1],"hour");for(let s=0;s<Math.abs(T===0?1:T);s++){let u="";const C=s*(x+1),S=l==="right"?a:O(a).add(C).toNumber(),k=l==="right"?O(f).add(C).toNumber():f,q=b(h,S,k);if(M){const V=m(t[0]).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");u=w(V,"hour",s,o),q.custom={...N,businessDate:u,startTime:j(u,"hour",s,o),endTime:u};continue}u=w(m(d).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",s,o),q.custom={...N,startTime:j(u,"hour",s,o),endTime:u}}break}}}return h},{});return Promise.resolve(i)}function se(e){return Object.entries(e).reduce((r,[t,d])=>{const i=Math.max(...Object.keys(d).map(Number));return i>r?r=Number(i):r=Number(r)||0,r},0)}function ie(e,n){const r=JSON.parse(JSON.stringify(e||{}));for(const[t,d]of Object.entries(n)){r[t]||(r[t]={});for(const[i,h]of Object.entries(d)){const p=h,a=r[t]?.[i];a?r[t][i]={...a,...p,custom:{...a.custom,...p.custom||{}}}:r[t][i]=p}}return r}const ae="./style.css";Y.CycleTypeEnum=$,Y.ModeEnum=J,Y.decimal=O,Y.filterIndicatorsCell=re,Y.generateIndicatorsCells=oe,Y.generateUUID=A,Y.getNumColumns=se,Y.handleClearInput=B,Y.initDateRange=te,Y.mergeCellData=ie,Y.stylePath=ae,Y.useData=Z,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})}));
|