tor-univer-sheet 1.1.16 → 1.1.18

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