tor-univer-sheet 1.1.0 → 1.1.1

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.
@@ -1,10 +1,10 @@
1
- import D from "dayjs";
2
- import { CellValueType as O } from "@univerjs/presets";
1
+ import Y from "dayjs";
2
+ import { CellValueType as C } from "@univerjs/presets";
3
3
  import G from "decimal.js";
4
- const X = (t, o) => {
4
+ const rt = (t, o) => {
5
5
  for (const e of o)
6
6
  t[e] = null;
7
- }, q = () => {
7
+ }, F = () => {
8
8
  if (typeof crypto == "object") {
9
9
  if (typeof crypto.randomUUID == "function")
10
10
  return crypto.randomUUID();
@@ -22,16 +22,16 @@ const X = (t, o) => {
22
22
  return t > 0 ? (r = (t + r) % 16 | 0, t = Math.floor(t / 16)) : (r = (o + r) % 16 | 0, o = Math.floor(o / 16)), (e === "x" ? r : r & 3 | 8).toString(16);
23
23
  });
24
24
  };
25
- function E(t) {
25
+ function ot(t) {
26
26
  return {
27
27
  ...t?.workbookData,
28
- id: t?.id || q(),
28
+ id: t?.id || F(),
29
29
  name: t?.name || "未命名",
30
30
  appVersion: t?.appVersion || "1.0.0"
31
31
  };
32
32
  }
33
- const F = Object.prototype.toString, V = (t, o) => F.call(t) === `[object ${o}]`, $ = (t) => t !== null && V(t, "Object"), J = (t) => t == null || typeof t > "u" ? !0 : R(t) || z(t) ? t.length === 0 : t instanceof Map || t instanceof Set ? t.size === 0 : $(t) ? Object.keys(t).length === 0 : !1, z = (t) => V(t, "String"), R = (t) => t && Array.isArray(t);
34
- class Z {
33
+ const $ = Object.prototype.toString, A = (t, o) => $.call(t) === `[object ${o}]`, J = (t) => typeof t < "u", z = (t) => !J(t), Z = (t) => t !== null && A(t, "Object"), U = (t) => t == null || typeof t > "u" ? !0 : R(t) || K(t) ? t.length === 0 : t instanceof Map || t instanceof Set ? t.size === 0 : Z(t) ? Object.keys(t).length === 0 : !1, _ = (t) => t === null, B = (t) => z(t) || _(t), K = (t) => A(t, "String"), R = (t) => t && Array.isArray(t);
34
+ class L {
35
35
  value;
36
36
  constructor(o) {
37
37
  this.value = new G(o);
@@ -103,17 +103,17 @@ class Z {
103
103
  return this.value.toNumber();
104
104
  }
105
105
  }
106
- function I(t = 0) {
107
- return new Z(t);
106
+ function P(t = 0) {
107
+ return new L(t);
108
108
  }
109
- var _ = /* @__PURE__ */ ((t) => (t.无 = "no", t.年 = "year", t.月 = "month", t.周 = "week", t.天 = "day", t.班组 = "shift", t.小时 = "hour", t.半小时 = "half_hour", t))(_ || {}), B = /* @__PURE__ */ ((t) => (t.view = "view", t.edit = "edit", t))(B || {});
110
- async function tt(t, o) {
109
+ var Q = /* @__PURE__ */ ((t) => (t.无 = "no", t.年 = "year", t.月 = "month", t.周 = "week", t.天 = "day", t.班组 = "shift", t.小时 = "hour", t.半小时 = "half_hour", t))(Q || {}), W = /* @__PURE__ */ ((t) => (t.view = "view", t.edit = "edit", t))(W || {});
110
+ async function st(t, o) {
111
111
  if (!o) return Promise.reject("日期不能为空");
112
112
  switch (t) {
113
113
  case "year":
114
114
  if (R(o))
115
115
  return Promise.resolve(o);
116
- const e = D(o);
116
+ const e = Y(o);
117
117
  if (!e.isValid())
118
118
  return Promise.reject("无效的日期格式");
119
119
  const r = e.year(), i = `${r}-01`, n = `${r}-12`;
@@ -121,24 +121,24 @@ async function tt(t, o) {
121
121
  case "month":
122
122
  if (R(o))
123
123
  return Promise.resolve(o);
124
- const v = D(o);
125
- if (!v.isValid())
124
+ const N = Y(o);
125
+ if (!N.isValid())
126
126
  return Promise.reject("无效的日期格式");
127
- const l = v.startOf("month").format("YYYY-MM-DD"), y = v.endOf("month").format("YYYY-MM-DD");
128
- return Promise.resolve([l, y]);
127
+ const d = N.startOf("month").format("YYYY-MM-DD"), f = N.endOf("month").format("YYYY-MM-DD");
128
+ return Promise.resolve([d, f]);
129
129
  case "day":
130
130
  if (R(o))
131
131
  return Promise.resolve(o);
132
- const f = D(o);
133
- if (!f.isValid())
132
+ const m = Y(o);
133
+ if (!m.isValid())
134
134
  return Promise.reject("无效的日期格式");
135
- const N = f.startOf("day").format("YYYY-MM-DD HH:mm:ss"), m = f.endOf("day").format("YYYY-MM-DD HH:mm:ss");
136
- return Promise.resolve([N, m]);
135
+ const v = m.startOf("day").format("YYYY-MM-DD HH:mm:ss"), l = m.endOf("day").format("YYYY-MM-DD HH:mm:ss");
136
+ return Promise.resolve([v, l]);
137
137
  default:
138
138
  return Promise.reject("不支持的周期类型");
139
139
  }
140
140
  }
141
- function j(t, o, e) {
141
+ function O(t, o, e) {
142
142
  if (!e) return 0;
143
143
  const r = {
144
144
  year: "YYYY",
@@ -146,310 +146,315 @@ function j(t, o, e) {
146
146
  day: "YYYY-MM-DD",
147
147
  hour: "HH:mm:ss"
148
148
  }[e];
149
- return ["day", "hour"].includes(e) ? D(o, r).diff(D(t, r), e) + 1 : D(o, r).diff(D(t, r), e);
149
+ return ["day", "hour"].includes(e) ? Y(o, r).diff(Y(t, r), e) + 1 : Y(o, r).diff(Y(t, r), e);
150
150
  }
151
- function A(t, o, e) {
151
+ function q(t, o, e) {
152
152
  const r = {
153
153
  year: "YYYY",
154
154
  month: "YYYY-MM",
155
155
  day: "YYYY-MM-DD",
156
156
  hour: "HH:mm:ss"
157
157
  }[e];
158
- return D(t).subtract(o, e).format(r);
158
+ return Y(t).subtract(o, e).format(r);
159
159
  }
160
- function H(t, o, e, r) {
160
+ function S(t, o, e, r) {
161
161
  const i = {
162
162
  year: "YYYY",
163
163
  month: "YYYY-MM",
164
164
  day: "YYYY-MM-DD",
165
165
  hour: "YYYY-MM-DD HH:mm:ss"
166
166
  }[o];
167
- return D(t, i).add(e * r, o).format(i);
167
+ return Y(t, i).add(e * r, o).format(i);
168
168
  }
169
- function b(t, o, e) {
169
+ function y(t, o, e) {
170
170
  return t[o] || (t[o] = {}), t[o][e] || (t[o][e] = {}), t[o][e];
171
171
  }
172
- async function et(t) {
172
+ async function nt(t) {
173
173
  if (!t)
174
174
  throw new Error("cellData is required");
175
175
  const o = Object.entries(t).reduce((e, r) => {
176
176
  const [i, n] = r;
177
- for (const [v, l] of Object.entries(n)) {
178
- const { custom: y, v: f, t: N, s: m } = l;
179
- if (!y) continue;
180
- const { cellType: Y } = y;
181
- if (Y === "indicator") {
182
- const d = b(e, i, v);
183
- d.custom = y, d.s = m, d.t = N, d.v = f;
177
+ for (const [N, d] of Object.entries(n)) {
178
+ const { custom: f, v: m, t: v, s: l } = d;
179
+ if (!f) continue;
180
+ const { cellType: b } = f;
181
+ if (b === "indicator") {
182
+ const h = y(e, i, N);
183
+ h.custom = {
184
+ ...f,
185
+ required: U(f?.required) ? !1 : f?.required,
186
+ defaultShift: U(f?.defaultShift) ? !1 : f?.defaultShift,
187
+ forwardPush: U(f?.forwardPush) ? !1 : f?.forwardPush
188
+ }, h.s = l, h.t = v, h.v = m;
184
189
  }
185
190
  }
186
191
  return e;
187
192
  }, {});
188
- return !o || J(o) ? Promise.reject(new Error("No data found")) : Promise.resolve(o);
193
+ return !o || U(o) ? Promise.reject(new Error("No data found")) : Promise.resolve(o);
189
194
  }
190
- function K({
195
+ function X({
191
196
  acc: t,
192
197
  params: o,
193
198
  initRowNum: e,
194
199
  initColNum: r,
195
200
  cellData: i
196
201
  }) {
197
- const { rangeData: n, currentDay: v, extraArgs: l } = o, y = l?.teamData || {}, { cycleType: f, timeIncrement: N, forwardPush: m, copyType: Y, copyInterval: d, defaultShift: P } = i.custom;
202
+ const { rangeData: n, currentDay: N, extraArgs: d } = o, f = d?.teamData || {}, { cycleType: m, timeIncrement: v, forwardPush: l, copyType: b, copyInterval: h, defaultShift: I } = i.custom;
198
203
  let g = 0;
199
- switch (f) {
204
+ switch (m) {
200
205
  case "day": {
201
206
  let s = "";
202
- if (m && (s = A(
207
+ if (l && (s = q(
203
208
  n[0],
204
209
  6,
205
210
  "day"
206
211
  /* day */
207
- )), !Y) {
212
+ )), !b) {
208
213
  let c = "";
209
- m ? c = s : c = n[0];
210
- const u = b(t, e, r);
211
- u.v = c, u.t = O.STRING;
214
+ l ? c = s : c = n[0];
215
+ const u = y(t, e, r);
216
+ u.v = c, u.t = C.STRING;
212
217
  break;
213
218
  }
214
- m ? g = j(
219
+ l ? g = O(
215
220
  s,
216
221
  n[0],
217
222
  "day"
218
223
  /* day */
219
- ) : g = j(
224
+ ) : g = O(
220
225
  n[0],
221
226
  n[1],
222
227
  "day"
223
228
  /* day */
224
229
  );
225
230
  for (let c = 0; c <= Math.abs(g === 0 ? 1 : g); c++) {
226
- const u = c * (d + 1);
231
+ const u = c * (h + 1);
227
232
  let w = "";
228
- m ? w = H(s, "day", c, N) : w = H(n[0], "day", c, N);
229
- const M = Y === "right" ? e : e + u, p = Y === "right" ? r + u : r, x = b(t, M, p);
230
- x.v = w, x.t = O.STRING;
233
+ l ? w = S(s, "day", c, v) : w = S(n[0], "day", c, v);
234
+ const M = b === "right" ? e : e + u, p = b === "right" ? r + u : r, x = y(t, M, p);
235
+ x.v = w, x.t = C.STRING;
231
236
  }
232
237
  break;
233
238
  }
234
239
  case "month": {
235
- if (!Y) {
236
- const s = b(t, e, r);
237
- s.v = n[0], s.t = O.STRING;
240
+ if (!b) {
241
+ const s = y(t, e, r);
242
+ s.v = n[0], s.t = C.STRING;
238
243
  break;
239
244
  }
240
- g = j(
245
+ g = O(
241
246
  n[0],
242
247
  n[1],
243
248
  "month"
244
249
  /* month */
245
250
  );
246
251
  for (let s = 0; s <= Math.abs(g === 0 ? 1 : g); s++) {
247
- const c = s * (d + 1), u = Y === "right" ? e : e + c, w = Y === "right" ? r + c : r, M = b(t, u, w);
248
- M.v = H(n[0], "month", s, N), M.t = O.STRING;
252
+ const c = s * (h + 1), u = b === "right" ? e : e + c, w = b === "right" ? r + c : r, M = y(t, u, w);
253
+ M.v = S(n[0], "month", s, v), M.t = C.STRING;
249
254
  }
250
255
  break;
251
256
  }
252
257
  case "year": {
253
- if (!Y) {
254
- const s = b(t, e, r);
255
- s.v = n[0], s.t = O.STRING;
258
+ if (!b) {
259
+ const s = y(t, e, r);
260
+ s.v = n[0], s.t = C.STRING;
256
261
  break;
257
262
  }
258
- g = j(
263
+ g = O(
259
264
  n[0],
260
265
  n[1],
261
266
  "year"
262
267
  /* year */
263
268
  );
264
269
  for (let s = 0; s <= Math.abs(g === 0 ? 1 : g); s++) {
265
- const c = s * (d + 1), u = Y === "right" ? e : e + c, w = Y === "right" ? r + c : r, M = b(t, u, w);
266
- M.v = H(n[0], "year", s, N), M.t = O.STRING;
270
+ const c = s * (h + 1), u = b === "right" ? e : e + c, w = b === "right" ? r + c : r, M = y(t, u, w);
271
+ M.v = S(n[0], "year", s, v), M.t = C.STRING;
267
272
  }
268
273
  break;
269
274
  }
270
275
  case "hour": {
271
- if (!Y) {
272
- const s = b(t, e, r);
273
- if (s.t = O.STRING, P) {
274
- s.v = D(y?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
276
+ if (!b) {
277
+ const s = y(t, e, r);
278
+ if (s.t = C.STRING, I) {
279
+ s.v = Y(f?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
275
280
  break;
276
281
  }
277
- s.v = D(v).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
282
+ s.v = Y(N).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
278
283
  break;
279
284
  }
280
- g = j(
281
- y?.startDatetime,
282
- y?.endDatetime,
285
+ g = O(
286
+ f?.startDatetime,
287
+ f?.endDatetime,
283
288
  "hour"
284
289
  /* hour */
285
290
  );
286
291
  for (let s = 0; s < Math.abs(g === 0 ? 1 : g); s++) {
287
- const c = s * (d + 1), u = Y === "right" ? e : e + c, w = Y === "right" ? r + c : r, M = b(t, u, w);
288
- if (M.t = O.STRING, P) {
289
- const p = D(y?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
290
- M.v = H(p, "hour", s, N);
292
+ const c = s * (h + 1), u = b === "right" ? e : e + c, w = b === "right" ? r + c : r, M = y(t, u, w);
293
+ if (M.t = C.STRING, I) {
294
+ const p = Y(f?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
295
+ M.v = S(p, "hour", s, v);
291
296
  continue;
292
297
  }
293
- M.v = H(D(v).add(1, "hour").format("YYYY-MM-DD HH:mm:ss"), "hour", s, N);
298
+ M.v = S(Y(N).add(1, "hour").format("YYYY-MM-DD HH:mm:ss"), "hour", s, v);
294
299
  }
295
300
  }
296
301
  }
297
302
  }
298
- async function rt(t, o) {
303
+ async function at(t, o) {
299
304
  if (!t)
300
305
  return Promise.reject("没有可用的单元格数据");
301
306
  const { extraArgs: e, rangeData: r } = o;
302
307
  if (!r.length)
303
308
  return Promise.reject("处理时间范围失败, rangeData不能为空");
304
- const i = e?.teamData || {}, n = o?.currentDay || D().format("YYYY-MM-DD"), v = Object.entries(t).reduce((l, y) => {
305
- const [f, N] = y;
306
- for (const [m, Y] of Object.entries(N)) {
307
- const { custom: d } = Y;
308
- if (!d) continue;
309
- const { cellType: P, cycleType: g, timeIncrement: s, forwardPush: c, copyType: u, copyInterval: w, defaultShift: M } = d;
310
- if (P === "time") {
311
- K({ acc: l, params: o, initRowNum: Number(f), initColNum: Number(m), cellData: Y });
309
+ const i = e?.teamData || {}, n = o?.currentDay || Y().format("YYYY-MM-DD"), N = Object.entries(t).reduce((d, f) => {
310
+ const [m, v] = f;
311
+ for (const [l, b] of Object.entries(v)) {
312
+ const { custom: h } = b;
313
+ if (!h) continue;
314
+ const { cellType: I, cycleType: g, timeIncrement: s, forwardPush: c, copyType: u, copyInterval: w, defaultShift: M } = h;
315
+ if (I === "time") {
316
+ X({ acc: d, params: o, initRowNum: Number(m), initColNum: Number(l), cellData: b });
312
317
  continue;
313
318
  }
314
319
  const p = {
315
320
  cycleType: g,
316
- indicatorName: d.indicatorName,
317
- indicatorCode: d.indicatorCode,
318
- indicatorId: d.indicatorId,
319
- indicatorDimensionName: d.indicatorDimensionName,
320
- indicatorDimensionConfig: d.indicatorDimensionConfig,
321
- required: d?.required || !1,
322
- cellType: d.cellType,
323
- defaultShift: d?.defaultShift || !1
321
+ indicatorName: h.indicatorName,
322
+ indicatorCode: h.indicatorCode,
323
+ indicatorId: h.indicatorId,
324
+ indicatorDimensionName: h.indicatorDimensionName,
325
+ indicatorDimensionConfig: h.indicatorDimensionConfig,
326
+ required: B(h?.required) ?? !1,
327
+ cellType: h.cellType,
328
+ defaultShift: h?.defaultShift || !1
324
329
  };
325
330
  let x = 0;
326
331
  switch (g) {
327
332
  case "day": {
328
333
  let a = "";
329
- if (c && (a = A(
334
+ if (c && (a = q(
330
335
  r[0],
331
336
  6,
332
337
  "day"
333
338
  /* day */
334
339
  )), !u) {
335
- let h = "";
336
- c ? h = a : h = r[0];
337
- const S = b(l, f, m);
338
- S.custom = {
340
+ let D = "";
341
+ c ? D = a : D = r[0];
342
+ const H = y(d, m, l);
343
+ H.custom = {
339
344
  ...p,
340
- businessDate: h
341
- }, M && (S.custom.teamData = i);
345
+ businessDate: D
346
+ }, M && (H.custom.teamData = i);
342
347
  break;
343
348
  }
344
- c ? x = j(
349
+ c ? x = O(
345
350
  a,
346
351
  r[0],
347
352
  "day"
348
353
  /* day */
349
- ) : x = j(
354
+ ) : x = O(
350
355
  r[0],
351
356
  r[1],
352
357
  "day"
353
358
  /* day */
354
359
  );
355
- for (let h = 0; h < Math.abs(x === 0 ? 1 : x); h++) {
356
- const S = h * (w + 1);
357
- let k = "";
358
- c ? k = H(a, "day", h, s) : k = H(r[0], "day", h, s);
359
- const C = u === "right" ? f : I(f).add(S).toNumber(), T = u === "right" ? I(m).add(S).toNumber() : m, U = b(l, C, T);
360
- U.custom = {
360
+ for (let D = 0; D < Math.abs(x === 0 ? 1 : x); D++) {
361
+ const H = D * (w + 1);
362
+ let j = "";
363
+ c ? j = S(a, "day", D, s) : j = S(r[0], "day", D, s);
364
+ const k = u === "right" ? m : P(m).add(H).toNumber(), T = u === "right" ? P(l).add(H).toNumber() : l, V = y(d, k, T);
365
+ V.custom = {
361
366
  ...p,
362
- businessDate: k
363
- }, M && (U.custom.teamData = i);
367
+ businessDate: j
368
+ }, M && (V.custom.teamData = i);
364
369
  }
365
370
  break;
366
371
  }
367
372
  case "month": {
368
373
  if (!u) {
369
- const a = b(l, f, m);
374
+ const a = y(d, m, l);
370
375
  a.custom = {
371
376
  ...p,
372
377
  businessDate: r[0]
373
378
  };
374
379
  break;
375
380
  }
376
- x = j(
381
+ x = O(
377
382
  r[0],
378
383
  r[1],
379
384
  "month"
380
385
  /* month */
381
386
  );
382
387
  for (let a = 0; a <= Math.abs(x === 0 ? 1 : x); a++) {
383
- const h = a * (w + 1), S = u === "right" ? f : I(f).add(h).toNumber(), k = u === "right" ? I(m).add(h).toNumber() : m, C = b(l, S, k);
384
- C.custom = {
388
+ const D = a * (w + 1), H = u === "right" ? m : P(m).add(D).toNumber(), j = u === "right" ? P(l).add(D).toNumber() : l, k = y(d, H, j);
389
+ k.custom = {
385
390
  ...p,
386
- businessDate: H(r[0], "month", a, s)
391
+ businessDate: S(r[0], "month", a, s)
387
392
  };
388
393
  }
389
394
  break;
390
395
  }
391
396
  case "year": {
392
397
  if (!u) {
393
- const a = b(l, f, m);
398
+ const a = y(d, m, l);
394
399
  a.custom = {
395
400
  ...p,
396
401
  businessDate: r[0]
397
402
  };
398
403
  break;
399
404
  }
400
- x = j(
405
+ x = O(
401
406
  r[0],
402
407
  r[1],
403
408
  "year"
404
409
  /* year */
405
410
  );
406
411
  for (let a = 0; a < Math.abs(x === 0 ? 1 : x); a++) {
407
- const h = a * (w + 1), S = u === "right" ? f : I(f).add(h).toNumber(), k = u === "right" ? I(m).add(h).toNumber() : m, C = b(l, S, k);
408
- C.custom = {
412
+ const D = a * (w + 1), H = u === "right" ? m : P(m).add(D).toNumber(), j = u === "right" ? P(l).add(D).toNumber() : l, k = y(d, H, j);
413
+ k.custom = {
409
414
  ...p,
410
- businessDate: H(r[0], "year", a, s)
415
+ businessDate: S(r[0], "year", a, s)
411
416
  };
412
417
  }
413
418
  break;
414
419
  }
415
420
  case "hour": {
416
421
  if (!u) {
417
- const a = b(l, f, m);
422
+ const a = y(d, m, l);
418
423
  if (M) {
419
424
  a.custom = {
420
425
  ...p,
421
426
  teamData: i,
422
- businessDate: D(i?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss")
427
+ businessDate: Y(i?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss")
423
428
  };
424
429
  break;
425
430
  }
426
431
  a.custom = {
427
432
  ...p,
428
- businessDate: D(n).add(1, "hour").format("YYYY-MM-DD HH:mm:ss")
433
+ businessDate: Y(n).add(1, "hour").format("YYYY-MM-DD HH:mm:ss")
429
434
  };
430
435
  break;
431
436
  }
432
- x = j(
437
+ x = O(
433
438
  i?.startDatetime,
434
439
  i?.endDatetime,
435
440
  "hour"
436
441
  /* hour */
437
442
  );
438
443
  for (let a = 0; a < Math.abs(x === 0 ? 1 : x); a++) {
439
- const h = a * (w + 1), S = u === "right" ? f : I(f).add(h).toNumber(), k = u === "right" ? I(m).add(h).toNumber() : m, C = b(l, S, k);
444
+ const D = a * (w + 1), H = u === "right" ? m : P(m).add(D).toNumber(), j = u === "right" ? P(l).add(D).toNumber() : l, k = y(d, H, j);
440
445
  if (M) {
441
- const T = D(i?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
442
- C.custom = {
446
+ const T = Y(i?.startDatetime).add(1, "hour").format("YYYY-MM-DD HH:mm:ss");
447
+ k.custom = {
443
448
  ...p,
444
449
  teamData: i,
445
- businessDate: H(T, "hour", a, s)
450
+ businessDate: S(T, "hour", a, s)
446
451
  };
447
452
  continue;
448
453
  }
449
- C.custom = {
454
+ k.custom = {
450
455
  ...p,
451
- businessDate: H(
452
- D(n).add(1, "hour").format("YYYY-MM-DD HH:mm:ss"),
456
+ businessDate: S(
457
+ Y(n).add(1, "hour").format("YYYY-MM-DD HH:mm:ss"),
453
458
  "hour",
454
459
  a,
455
460
  s
@@ -460,46 +465,46 @@ async function rt(t, o) {
460
465
  }
461
466
  }
462
467
  }
463
- return l;
468
+ return d;
464
469
  }, {});
465
- return Promise.resolve(v);
470
+ return Promise.resolve(N);
466
471
  }
467
- function ot(t) {
472
+ function it(t) {
468
473
  return Object.entries(t).reduce((e, [r, i]) => {
469
474
  const n = Math.max(...Object.keys(i).map(Number));
470
475
  return n > e ? e = Number(n) : e = Number(e) || 0, e;
471
476
  }, 0);
472
477
  }
473
- function st(t, o) {
478
+ function ut(t, o) {
474
479
  const e = JSON.parse(JSON.stringify(t || {}));
475
480
  for (const [r, i] of Object.entries(o)) {
476
481
  e[r] || (e[r] = {});
477
- for (const [n, v] of Object.entries(i)) {
478
- const l = v, y = e[r]?.[n];
479
- y ? e[r][n] = {
480
- ...y,
481
- ...l,
482
+ for (const [n, N] of Object.entries(i)) {
483
+ const d = N, f = e[r]?.[n];
484
+ f ? e[r][n] = {
485
+ ...f,
486
+ ...d,
482
487
  custom: {
483
- ...y.custom,
484
- ...l.custom || {}
488
+ ...f.custom,
489
+ ...d.custom || {}
485
490
  }
486
- } : e[r][n] = l;
491
+ } : e[r][n] = d;
487
492
  }
488
493
  }
489
494
  return e;
490
495
  }
491
- const nt = "./style.css";
496
+ const ct = "./style.css";
492
497
  export {
493
- _ as CycleTypeEnum,
494
- B as ModeEnum,
495
- I as decimal,
496
- et as filterIndicatorsCell,
497
- rt as generateIndicatorsCells,
498
- q as generateUUID,
499
- ot as getNumColumns,
500
- X as handleClearInput,
501
- tt as initDateRange,
502
- st as mergeCellData,
503
- nt as stylePath,
504
- E as useData
498
+ Q as CycleTypeEnum,
499
+ W as ModeEnum,
500
+ P as decimal,
501
+ nt as filterIndicatorsCell,
502
+ at as generateIndicatorsCells,
503
+ F as generateUUID,
504
+ it as getNumColumns,
505
+ rt as handleClearInput,
506
+ st as initDateRange,
507
+ ut as mergeCellData,
508
+ ct as stylePath,
509
+ ot as useData
505
510
  };
@@ -1 +1 @@
1
- (function(d,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("dayjs"),require("@univerjs/presets"),require("decimal.js")):typeof define=="function"&&define.amd?define(["exports","dayjs","@univerjs/presets","decimal.js"],l):(d=typeof globalThis<"u"?globalThis:d||self,l(d.TorUniverSheet={},d.dayjs,d.presets,d.Decimal))})(this,(function(d,l,P,U){"use strict";const z=(e,n)=>{for(const t of n)e[t]=null},G=()=>{if(typeof crypto=="object"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"&&typeof Uint8Array=="function"){const t=r=>{const i=Number(r);return(i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>i/4).toString(16)};return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t)}}let e=new Date().getTime(),n=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=Math.random()*16;return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(n+r)%16|0,n=Math.floor(n/16)),(t==="x"?r:r&3|8).toString(16)})};function Z(e){return{...e?.workbookData,id:e?.id||G(),name:e?.name||"未命名",appVersion:e?.appVersion||"1.0.0"}}const _=Object.prototype.toString,A=(e,n)=>_.call(e)===`[object ${n}]`,B=e=>e!==null&&A(e,"Object"),E=e=>e==null||typeof e>"u"?!0:V(e)||K(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:B(e)?Object.keys(e).length===0:!1,K=e=>A(e,"String"),V=e=>e&&Array.isArray(e);class L{value;constructor(n){this.value=new U(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 t=new U(n);if(t.isZero())throw new Error("除数是0");return this.value=this.value.div(t),this}toFixed(n,t){return this.value=new U(this.value.toFixed(n,t)),this}valueOf(){return this.value}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}}function O(e=0){return new L(e)}var q=(e=>(e.无="no",e.年="year",e.月="month",e.周="week",e.天="day",e.班组="shift",e.小时="hour",e.半小时="half_hour",e))(q||{}),F=(e=>(e.view="view",e.edit="edit",e))(F||{});async function Q(e,n){if(!n)return Promise.reject("日期不能为空");switch(e){case"year":if(V(n))return Promise.resolve(n);const t=l(n);if(!t.isValid())return Promise.reject("无效的日期格式");const r=t.year(),i=`${r}-01`,s=`${r}-12`;return Promise.resolve([i,s]);case"month":if(V(n))return Promise.resolve(n);const p=l(n);if(!p.isValid())return Promise.reject("无效的日期格式");const h=p.startOf("month").format("YYYY-MM-DD"),y=p.endOf("month").format("YYYY-MM-DD");return Promise.resolve([h,y]);case"day":if(V(n))return Promise.resolve(n);const m=l(n);if(!m.isValid())return Promise.reject("无效的日期格式");const S=m.startOf("day").format("YYYY-MM-DD HH:mm:ss"),f=m.endOf("day").format("YYYY-MM-DD HH:mm:ss");return Promise.resolve([S,f]);default:return Promise.reject("不支持的周期类型")}}function I(e,n,t){if(!t)return 0;const r={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[t];return["day","hour"].includes(t)?l(n,r).diff(l(e,r),t)+1:l(n,r).diff(l(e,r),t)}function $(e,n,t){const r={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[t];return l(e).subtract(n,t).format(r)}function N(e,n,t,r){const i={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"YYYY-MM-DD HH:mm:ss"}[n];return l(e,i).add(t*r,n).format(i)}function b(e,n,t){return e[n]||(e[n]={}),e[n][t]||(e[n][t]={}),e[n][t]}async function W(e){if(!e)throw new Error("cellData is required");const n=Object.entries(e).reduce((t,r)=>{const[i,s]=r;for(const[p,h]of Object.entries(s)){const{custom:y,v:m,t:S,s:f}=h;if(!y)continue;const{cellType:g}=y;if(g==="indicator"){const D=b(t,i,p);D.custom=y,D.s=f,D.t=S,D.v=m}}return t},{});return!n||E(n)?Promise.reject(new Error("No data found")):Promise.resolve(n)}function X({acc:e,params:n,initRowNum:t,initColNum:r,cellData:i}){const{rangeData:s,currentDay:p,extraArgs:h}=n,y=h?.teamData||{},{cycleType:m,timeIncrement:S,forwardPush:f,copyType:g,copyInterval:D,defaultShift:j}=i.custom;let M=0;switch(m){case"day":{let o="";if(f&&(o=$(s[0],6,"day")),!g){let c="";f?c=o:c=s[0];const u=b(e,t,r);u.v=c,u.t=P.CellValueType.STRING;break}f?M=I(o,s[0],"day"):M=I(s[0],s[1],"day");for(let c=0;c<=Math.abs(M===0?1:M);c++){const u=c*(D+1);let x="";f?x=N(o,"day",c,S):x=N(s[0],"day",c,S);const w=g==="right"?t:t+u,C=g==="right"?r+u:r,v=b(e,w,C);v.v=x,v.t=P.CellValueType.STRING}break}case"month":{if(!g){const o=b(e,t,r);o.v=s[0],o.t=P.CellValueType.STRING;break}M=I(s[0],s[1],"month");for(let o=0;o<=Math.abs(M===0?1:M);o++){const c=o*(D+1),u=g==="right"?t:t+c,x=g==="right"?r+c:r,w=b(e,u,x);w.v=N(s[0],"month",o,S),w.t=P.CellValueType.STRING}break}case"year":{if(!g){const o=b(e,t,r);o.v=s[0],o.t=P.CellValueType.STRING;break}M=I(s[0],s[1],"year");for(let o=0;o<=Math.abs(M===0?1:M);o++){const c=o*(D+1),u=g==="right"?t:t+c,x=g==="right"?r+c:r,w=b(e,u,x);w.v=N(s[0],"year",o,S),w.t=P.CellValueType.STRING}break}case"hour":{if(!g){const o=b(e,t,r);if(o.t=P.CellValueType.STRING,j){o.v=l(y?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}o.v=l(p).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}M=I(y?.startDatetime,y?.endDatetime,"hour");for(let o=0;o<Math.abs(M===0?1:M);o++){const c=o*(D+1),u=g==="right"?t:t+c,x=g==="right"?r+c:r,w=b(e,u,x);if(w.t=P.CellValueType.STRING,j){const C=l(y?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");w.v=N(C,"hour",o,S);continue}w.v=N(l(p).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",o,S)}}}}async function ee(e,n){if(!e)return Promise.reject("没有可用的单元格数据");const{extraArgs:t,rangeData:r}=n;if(!r.length)return Promise.reject("处理时间范围失败, rangeData不能为空");const i=t?.teamData||{},s=n?.currentDay||l().format("YYYY-MM-DD"),p=Object.entries(e).reduce((h,y)=>{const[m,S]=y;for(const[f,g]of Object.entries(S)){const{custom:D}=g;if(!D)continue;const{cellType:j,cycleType:M,timeIncrement:o,forwardPush:c,copyType:u,copyInterval:x,defaultShift:w}=D;if(j==="time"){X({acc:h,params:n,initRowNum:Number(m),initColNum:Number(f),cellData:g});continue}const C={cycleType:M,indicatorName:D.indicatorName,indicatorCode:D.indicatorCode,indicatorId:D.indicatorId,indicatorDimensionName:D.indicatorDimensionName,indicatorDimensionConfig:D.indicatorDimensionConfig,required:D?.required||!1,cellType:D.cellType,defaultShift:D?.defaultShift||!1};let v=0;switch(M){case"day":{let a="";if(c&&(a=$(r[0],6,"day")),!u){let Y="";c?Y=a:Y=r[0];const H=b(h,m,f);H.custom={...C,businessDate:Y},w&&(H.custom.teamData=i);break}c?v=I(a,r[0],"day"):v=I(r[0],r[1],"day");for(let Y=0;Y<Math.abs(v===0?1:v);Y++){const H=Y*(x+1);let k="";c?k=N(a,"day",Y,o):k=N(r[0],"day",Y,o);const T=u==="right"?m:O(m).add(H).toNumber(),R=u==="right"?O(f).add(H).toNumber():f,J=b(h,T,R);J.custom={...C,businessDate:k},w&&(J.custom.teamData=i)}break}case"month":{if(!u){const a=b(h,m,f);a.custom={...C,businessDate:r[0]};break}v=I(r[0],r[1],"month");for(let a=0;a<=Math.abs(v===0?1:v);a++){const Y=a*(x+1),H=u==="right"?m:O(m).add(Y).toNumber(),k=u==="right"?O(f).add(Y).toNumber():f,T=b(h,H,k);T.custom={...C,businessDate:N(r[0],"month",a,o)}}break}case"year":{if(!u){const a=b(h,m,f);a.custom={...C,businessDate:r[0]};break}v=I(r[0],r[1],"year");for(let a=0;a<Math.abs(v===0?1:v);a++){const Y=a*(x+1),H=u==="right"?m:O(m).add(Y).toNumber(),k=u==="right"?O(f).add(Y).toNumber():f,T=b(h,H,k);T.custom={...C,businessDate:N(r[0],"year",a,o)}}break}case"hour":{if(!u){const a=b(h,m,f);if(w){a.custom={...C,teamData:i,businessDate:l(i?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss")};break}a.custom={...C,businessDate:l(s).add(1,"hour").format("YYYY-MM-DD HH:mm:ss")};break}v=I(i?.startDatetime,i?.endDatetime,"hour");for(let a=0;a<Math.abs(v===0?1:v);a++){const Y=a*(x+1),H=u==="right"?m:O(m).add(Y).toNumber(),k=u==="right"?O(f).add(Y).toNumber():f,T=b(h,H,k);if(w){const R=l(i?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");T.custom={...C,teamData:i,businessDate:N(R,"hour",a,o)};continue}T.custom={...C,businessDate:N(l(s).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",a,o)}}break}}}return h},{});return Promise.resolve(p)}function te(e){return Object.entries(e).reduce((t,[r,i])=>{const s=Math.max(...Object.keys(i).map(Number));return s>t?t=Number(s):t=Number(t)||0,t},0)}function re(e,n){const t=JSON.parse(JSON.stringify(e||{}));for(const[r,i]of Object.entries(n)){t[r]||(t[r]={});for(const[s,p]of Object.entries(i)){const h=p,y=t[r]?.[s];y?t[r][s]={...y,...h,custom:{...y.custom,...h.custom||{}}}:t[r][s]=h}}return t}const ne="./style.css";d.CycleTypeEnum=q,d.ModeEnum=F,d.decimal=O,d.filterIndicatorsCell=W,d.generateIndicatorsCells=ee,d.generateUUID=G,d.getNumColumns=te,d.handleClearInput=z,d.initDateRange=Q,d.mergeCellData=re,d.stylePath=ne,d.useData=Z,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(h,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):(h=typeof globalThis<"u"?globalThis:h||self,c(h.TorUniverSheet={},h.dayjs,h.presets,h.Decimal))})(this,(function(h,c,k,R){"use strict";const Z=(e,n)=>{for(const t of n)e[t]=null},G=()=>{if(typeof crypto=="object"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"&&typeof Uint8Array=="function"){const t=r=>{const i=Number(r);return(i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>i/4).toString(16)};return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t)}}let e=new Date().getTime(),n=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let r=Math.random()*16;return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(n+r)%16|0,n=Math.floor(n/16)),(t==="x"?r:r&3|8).toString(16)})};function _(e){return{...e?.workbookData,id:e?.id||G(),name:e?.name||"未命名",appVersion:e?.appVersion||"1.0.0"}}const B=Object.prototype.toString,A=(e,n)=>B.call(e)===`[object ${n}]`,E=e=>typeof e<"u",K=e=>!E(e),L=e=>e!==null&&A(e,"Object"),V=e=>e==null||typeof e>"u"?!0:j(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=>A(e,"String"),j=e=>e&&Array.isArray(e);class ee{value;constructor(n){this.value=new R(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 t=new R(n);if(t.isZero())throw new Error("除数是0");return this.value=this.value.div(t),this}toFixed(n,t){return this.value=new R(this.value.toFixed(n,t)),this}valueOf(){return this.value}toString(){return this.value.toString()}toNumber(){return this.value.toNumber()}}function P(e=0){return new ee(e)}var F=(e=>(e.无="no",e.年="year",e.月="month",e.周="week",e.天="day",e.班组="shift",e.小时="hour",e.半小时="half_hour",e))(F||{}),$=(e=>(e.view="view",e.edit="edit",e))($||{});async function te(e,n){if(!n)return Promise.reject("日期不能为空");switch(e){case"year":if(j(n))return Promise.resolve(n);const t=c(n);if(!t.isValid())return Promise.reject("无效的日期格式");const r=t.year(),i=`${r}-01`,s=`${r}-12`;return Promise.resolve([i,s]);case"month":if(j(n))return Promise.resolve(n);const p=c(n);if(!p.isValid())return Promise.reject("无效的日期格式");const D=p.startOf("month").format("YYYY-MM-DD"),f=p.endOf("month").format("YYYY-MM-DD");return Promise.resolve([D,f]);case"day":if(j(n))return Promise.resolve(n);const d=c(n);if(!d.isValid())return Promise.reject("无效的日期格式");const S=d.startOf("day").format("YYYY-MM-DD HH:mm:ss"),m=d.endOf("day").format("YYYY-MM-DD HH:mm:ss");return Promise.resolve([S,m]);default:return Promise.reject("不支持的周期类型")}}function O(e,n,t){if(!t)return 0;const r={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[t];return["day","hour"].includes(t)?c(n,r).diff(c(e,r),t)+1:c(n,r).diff(c(e,r),t)}function J(e,n,t){const r={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"HH:mm:ss"}[t];return c(e).subtract(n,t).format(r)}function C(e,n,t,r){const i={year:"YYYY",month:"YYYY-MM",day:"YYYY-MM-DD",hour:"YYYY-MM-DD HH:mm:ss"}[n];return c(e,i).add(t*r,n).format(i)}function g(e,n,t){return e[n]||(e[n]={}),e[n][t]||(e[n][t]={}),e[n][t]}async function re(e){if(!e)throw new Error("cellData is required");const n=Object.entries(e).reduce((t,r)=>{const[i,s]=r;for(const[p,D]of Object.entries(s)){const{custom:f,v:d,t:S,s:m}=D;if(!f)continue;const{cellType:y}=f;if(y==="indicator"){const Y=g(t,i,p);Y.custom={...f,required:V(f?.required)?!1:f?.required,defaultShift:V(f?.defaultShift)?!1:f?.defaultShift,forwardPush:V(f?.forwardPush)?!1:f?.forwardPush},Y.s=m,Y.t=S,Y.v=d}}return t},{});return!n||V(n)?Promise.reject(new Error("No data found")):Promise.resolve(n)}function ne({acc:e,params:n,initRowNum:t,initColNum:r,cellData:i}){const{rangeData:s,currentDay:p,extraArgs:D}=n,f=D?.teamData||{},{cycleType:d,timeIncrement:S,forwardPush:m,copyType:y,copyInterval:Y,defaultShift:U}=i.custom;let M=0;switch(d){case"day":{let o="";if(m&&(o=J(s[0],6,"day")),!y){let l="";m?l=o:l=s[0];const u=g(e,t,r);u.v=l,u.t=k.CellValueType.STRING;break}m?M=O(o,s[0],"day"):M=O(s[0],s[1],"day");for(let l=0;l<=Math.abs(M===0?1:M);l++){const u=l*(Y+1);let x="";m?x=C(o,"day",l,S):x=C(s[0],"day",l,S);const w=y==="right"?t:t+u,N=y==="right"?r+u:r,v=g(e,w,N);v.v=x,v.t=k.CellValueType.STRING}break}case"month":{if(!y){const o=g(e,t,r);o.v=s[0],o.t=k.CellValueType.STRING;break}M=O(s[0],s[1],"month");for(let o=0;o<=Math.abs(M===0?1:M);o++){const l=o*(Y+1),u=y==="right"?t:t+l,x=y==="right"?r+l:r,w=g(e,u,x);w.v=C(s[0],"month",o,S),w.t=k.CellValueType.STRING}break}case"year":{if(!y){const o=g(e,t,r);o.v=s[0],o.t=k.CellValueType.STRING;break}M=O(s[0],s[1],"year");for(let o=0;o<=Math.abs(M===0?1:M);o++){const l=o*(Y+1),u=y==="right"?t:t+l,x=y==="right"?r+l:r,w=g(e,u,x);w.v=C(s[0],"year",o,S),w.t=k.CellValueType.STRING}break}case"hour":{if(!y){const o=g(e,t,r);if(o.t=k.CellValueType.STRING,U){o.v=c(f?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}o.v=c(p).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");break}M=O(f?.startDatetime,f?.endDatetime,"hour");for(let o=0;o<Math.abs(M===0?1:M);o++){const l=o*(Y+1),u=y==="right"?t:t+l,x=y==="right"?r+l:r,w=g(e,u,x);if(w.t=k.CellValueType.STRING,U){const N=c(f?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");w.v=C(N,"hour",o,S);continue}w.v=C(c(p).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",o,S)}}}}async function oe(e,n){if(!e)return Promise.reject("没有可用的单元格数据");const{extraArgs:t,rangeData:r}=n;if(!r.length)return Promise.reject("处理时间范围失败, rangeData不能为空");const i=t?.teamData||{},s=n?.currentDay||c().format("YYYY-MM-DD"),p=Object.entries(e).reduce((D,f)=>{const[d,S]=f;for(const[m,y]of Object.entries(S)){const{custom:Y}=y;if(!Y)continue;const{cellType:U,cycleType:M,timeIncrement:o,forwardPush:l,copyType:u,copyInterval:x,defaultShift:w}=Y;if(U==="time"){ne({acc:D,params:n,initRowNum:Number(d),initColNum:Number(m),cellData:y});continue}const N={cycleType:M,indicatorName:Y.indicatorName,indicatorCode:Y.indicatorCode,indicatorId:Y.indicatorId,indicatorDimensionName:Y.indicatorDimensionName,indicatorDimensionConfig:Y.indicatorDimensionConfig,required:W(Y?.required)??!1,cellType:Y.cellType,defaultShift:Y?.defaultShift||!1};let v=0;switch(M){case"day":{let a="";if(l&&(a=J(r[0],6,"day")),!u){let b="";l?b=a:b=r[0];const H=g(D,d,m);H.custom={...N,businessDate:b},w&&(H.custom.teamData=i);break}l?v=O(a,r[0],"day"):v=O(r[0],r[1],"day");for(let b=0;b<Math.abs(v===0?1:v);b++){const H=b*(x+1);let I="";l?I=C(a,"day",b,o):I=C(r[0],"day",b,o);const T=u==="right"?d:P(d).add(H).toNumber(),q=u==="right"?P(m).add(H).toNumber():m,z=g(D,T,q);z.custom={...N,businessDate:I},w&&(z.custom.teamData=i)}break}case"month":{if(!u){const a=g(D,d,m);a.custom={...N,businessDate:r[0]};break}v=O(r[0],r[1],"month");for(let a=0;a<=Math.abs(v===0?1:v);a++){const b=a*(x+1),H=u==="right"?d:P(d).add(b).toNumber(),I=u==="right"?P(m).add(b).toNumber():m,T=g(D,H,I);T.custom={...N,businessDate:C(r[0],"month",a,o)}}break}case"year":{if(!u){const a=g(D,d,m);a.custom={...N,businessDate:r[0]};break}v=O(r[0],r[1],"year");for(let a=0;a<Math.abs(v===0?1:v);a++){const b=a*(x+1),H=u==="right"?d:P(d).add(b).toNumber(),I=u==="right"?P(m).add(b).toNumber():m,T=g(D,H,I);T.custom={...N,businessDate:C(r[0],"year",a,o)}}break}case"hour":{if(!u){const a=g(D,d,m);if(w){a.custom={...N,teamData:i,businessDate:c(i?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss")};break}a.custom={...N,businessDate:c(s).add(1,"hour").format("YYYY-MM-DD HH:mm:ss")};break}v=O(i?.startDatetime,i?.endDatetime,"hour");for(let a=0;a<Math.abs(v===0?1:v);a++){const b=a*(x+1),H=u==="right"?d:P(d).add(b).toNumber(),I=u==="right"?P(m).add(b).toNumber():m,T=g(D,H,I);if(w){const q=c(i?.startDatetime).add(1,"hour").format("YYYY-MM-DD HH:mm:ss");T.custom={...N,teamData:i,businessDate:C(q,"hour",a,o)};continue}T.custom={...N,businessDate:C(c(s).add(1,"hour").format("YYYY-MM-DD HH:mm:ss"),"hour",a,o)}}break}}}return D},{});return Promise.resolve(p)}function se(e){return Object.entries(e).reduce((t,[r,i])=>{const s=Math.max(...Object.keys(i).map(Number));return s>t?t=Number(s):t=Number(t)||0,t},0)}function ae(e,n){const t=JSON.parse(JSON.stringify(e||{}));for(const[r,i]of Object.entries(n)){t[r]||(t[r]={});for(const[s,p]of Object.entries(i)){const D=p,f=t[r]?.[s];f?t[r][s]={...f,...D,custom:{...f.custom,...D.custom||{}}}:t[r][s]=D}}return t}const ie="./style.css";h.CycleTypeEnum=F,h.ModeEnum=$,h.decimal=P,h.filterIndicatorsCell=re,h.generateIndicatorsCells=oe,h.generateUUID=G,h.getNumColumns=se,h.handleClearInput=Z,h.initDateRange=te,h.mergeCellData=ae,h.stylePath=ie,h.useData=_,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tor-univer-sheet",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "style": "./dist/style.css",
5
5
  "description": "基于 Univer 的 Vue3 电子表格组件",
6
6
  "author": "tortormore",