@fileverse-dev/dsheet 1.2.20 → 1.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -176448,99 +176448,100 @@ const n6 = `$#,##0.${"0".repeat(2)}`, Cm = ({
176448
176448
  column: t,
176449
176449
  newValue: r,
176450
176450
  apiData: a,
176451
- sheetEditorRef: n
176451
+ sheetEditorRef: n,
176452
+ shouldIgnoreUsdValue: i
176452
176453
  }) => {
176453
- var m, p, d, h, b, g, y;
176454
- const i = Array.isArray(a[0]) ? a[0] : Object.keys(a[0]), l = (m = n.current) == null ? void 0 : m.getSheet(), c = ((p = l == null ? void 0 : l.data) == null ? void 0 : p.length) || 0, f = ((h = (d = l == null ? void 0 : l.data) == null ? void 0 : d[0]) == null ? void 0 : h.length) || 0, s = a.length - (c - e) + 1, o = i.length - (f - t) + 1;
176455
- s > 0 && ((b = n.current) == null || b.insertRowOrColumn(
176454
+ var p, d, h, b, g, y, w;
176455
+ const l = Array.isArray(a[0]) ? a[0] : Object.keys(a[0]), c = (p = n.current) == null ? void 0 : p.getSheet(), f = ((d = c == null ? void 0 : c.data) == null ? void 0 : d.length) || 0, s = ((b = (h = c == null ? void 0 : c.data) == null ? void 0 : h[0]) == null ? void 0 : b.length) || 0, o = a.length - (f - e) + 1, u = l.length - (s - t) + 1;
176456
+ o > 0 && ((g = n.current) == null || g.insertRowOrColumn(
176456
176457
  "row",
176457
- c - 1,
176458
- s
176459
- )), o > 0 && ((g = n.current) == null || g.insertRowOrColumn(
176460
- "column",
176461
176458
  f - 1,
176462
176459
  o
176460
+ )), u > 0 && ((y = n.current) == null || y.insertRowOrColumn(
176461
+ "column",
176462
+ s - 1,
176463
+ u
176463
176464
  ));
176464
- let u;
176465
- const v = [];
176465
+ let v;
176466
+ const m = [];
176466
176467
  if (Array.isArray(a[0])) {
176467
176468
  if (Array.isArray(a[0])) {
176468
- u = {
176469
+ v = {
176469
176470
  row: [e, e + a.length - 1],
176470
176471
  column: [t, t + (a[0].length - 1)]
176471
176472
  };
176472
- const x = a[0].map(String).map((_, T) => {
176473
- if (T === 0)
176473
+ const _ = a[0].map(String).map((T, M) => {
176474
+ if (M === 0)
176474
176475
  return {
176475
176476
  ...r && typeof r == "object" ? UR({ ...r }) : r,
176476
- m: _,
176477
- v: _,
176477
+ m: T,
176478
+ v: T,
176478
176479
  isDataBlockFormula: !0
176479
176480
  };
176480
- const M = P5(e, t + T, n), { m: N, ct: L, ...B } = M || {}, R = z5(_, M == null ? void 0 : M.ct);
176481
+ const N = P5(e, t + M, n), { m: L, ct: B, ...R } = N || {}, D = z5(T, N == null ? void 0 : N.ct);
176481
176482
  return {
176482
- ...B,
176483
- v: _,
176484
- m: String(_),
176485
- ...R ? { ct: R } : {}
176483
+ ...R,
176484
+ v: T,
176485
+ m: String(T),
176486
+ ...D ? { ct: D } : {}
176486
176487
  };
176487
176488
  });
176488
- v.push(x);
176489
- for (let _ = 1; _ < a.length; _++) {
176490
- const T = [];
176491
- a[_].forEach((M, N) => {
176492
- const L = P5(e + _, t + N, n), { m: B, ct: R, ...D } = L || {}, j = Lx(M);
176493
- T.push({
176494
- ...D,
176495
- ...HR(L, j),
176489
+ m.push(_);
176490
+ for (let T = 1; T < a.length; T++) {
176491
+ const M = [];
176492
+ a[T].forEach((N, L) => {
176493
+ const B = P5(e + T, t + L, n), { m: R, ct: D, ...j } = B || {}, E = Lx(N);
176494
+ M.push({
176495
+ ...j,
176496
+ ...HR(B, E),
176496
176497
  // move color from styles to cell-level 'fc' when becoming numeric
176497
- v: M,
176498
- ct: z5(M, L.ct),
176498
+ v: N,
176499
+ ct: z5(N, B.ct),
176499
176500
  // if the value is numeric, skip "m" (FortuneSheet will render display text using v + ct/fa).
176500
176501
  // if it's text, explicitly set "m" to match the value so it displays correctly.
176501
- ...j ? {} : { m: M ? String(M) : "" }
176502
+ ...E ? {} : { m: N ? String(N) : "" }
176502
176503
  });
176503
- }), v.push(T);
176504
+ }), m.push(M);
176504
176505
  }
176505
176506
  }
176506
176507
  } else {
176507
- u = {
176508
+ v = {
176508
176509
  row: [e, e + a.length],
176509
- column: [t, t + (i.length - 1)]
176510
+ column: [t, t + (l.length - 1)]
176510
176511
  };
176511
- const w = i.map((x, _) => {
176512
- if (_ === 0)
176512
+ const x = l.map((_, T) => {
176513
+ if (T === 0)
176513
176514
  return {
176514
176515
  ...r && typeof r == "object" ? UR({ ...r }) : r,
176515
- m: x,
176516
- v: x,
176516
+ m: _,
176517
+ v: _,
176517
176518
  isDataBlockFormula: !0
176518
176519
  };
176519
- const T = P5(e, t + _, n), { m: M, ct: N, ...L } = T || {}, B = z5(x, T == null ? void 0 : T.ct);
176520
+ const M = P5(e, t + T, n), { m: N, ct: L, ...B } = M || {}, R = z5(_, M == null ? void 0 : M.ct);
176520
176521
  return {
176521
- ...L,
176522
- v: x,
176523
- m: String(x),
176524
- ...B ? { ct: B } : {}
176522
+ ...B,
176523
+ v: _,
176524
+ m: String(_),
176525
+ ...R ? { ct: R } : {}
176525
176526
  };
176526
176527
  });
176527
- v.push(w);
176528
- for (let x = 0; x < a.length; x++) {
176529
- const _ = [];
176530
- i.forEach((T, M) => {
176531
- const N = a[x][T], L = P5(e + 1 + x, t + M, n), { m: B, ct: R, ...D } = L || {}, j = Lx(N), E = {};
176532
- j && iY(T) ? (E.m = qn(n6, N), E.ht = 2) : N && (E.m = String(N)), _.push({
176533
- ...D,
176534
- ...HR(L, j),
176528
+ m.push(x);
176529
+ for (let _ = 0; _ < a.length; _++) {
176530
+ const T = [];
176531
+ l.forEach((M, N) => {
176532
+ const L = a[_][M], B = P5(e + 1 + _, t + N, n), { m: R, ct: D, ...j } = B || {}, E = Lx(L), k = {};
176533
+ E && iY(M) && !i ? (k.m = qn(n6, L), k.ht = 2) : L && (k.m = String(L)), T.push({
176534
+ ...j,
176535
+ ...HR(B, E),
176535
176536
  // move color from styles to cell-level 'fc' when becoming numeric
176536
- v: N,
176537
- ct: z5(N, L.ct, T),
176538
- ...E
176537
+ v: L,
176538
+ ct: z5(L, B.ct, M),
176539
+ ...k
176539
176540
  });
176540
- }), v.push(_);
176541
+ }), m.push(T);
176541
176542
  }
176542
176543
  }
176543
- u && ((y = n.current) == null || y.setCellValuesByRange(v, u));
176544
+ v && ((w = n.current) == null || w.setCellValuesByRange(m, v));
176544
176545
  }, P5 = (e, t, r) => {
176545
176546
  var i, l, c;
176546
176547
  const a = (l = (i = r.current) == null ? void 0 : i.getSheet()) == null ? void 0 : l.data, n = (c = a == null ? void 0 : a[e]) == null ? void 0 : c[t];
@@ -176639,13 +176640,14 @@ const jkt = (e) => {
176639
176640
  m: e,
176640
176641
  isDataBlockFormula: !0
176641
176642
  });
176642
- }, oY = (e, t) => {
176643
+ }, oY = (e, t, r) => {
176643
176644
  Cm({
176644
176645
  row: t.row,
176645
176646
  column: t.column,
176646
176647
  newValue: t.newValue,
176647
176648
  apiData: e,
176648
- sheetEditorRef: t.sheetEditorRef
176649
+ sheetEditorRef: t.sheetEditorRef,
176650
+ shouldIgnoreUsdValue: r === "COINGECKO"
176649
176651
  });
176650
176652
  }, Hkt = (e, t, r) => {
176651
176653
  var n;
@@ -176736,7 +176738,7 @@ const jkt = (e) => {
176736
176738
  ...t.newValue,
176737
176739
  m: "No Data",
176738
176740
  isDataBlockFormula: !0
176739
- }) : oY(g, t);
176741
+ }) : oY(g, t, y);
176740
176742
  } else !g && typeof g != "boolean" ? (s = t.sheetEditorRef.current) == null || s.setCellValue(t.row, t.column, {
176741
176743
  ...t.newValue,
176742
176744
  m: "No Data",
@@ -176916,7 +176918,8 @@ const jkt = (e) => {
176916
176918
  column: M,
176917
176919
  newValue: x,
176918
176920
  apiData: j,
176919
- sheetEditorRef: e
176921
+ sheetEditorRef: e,
176922
+ shouldIgnoreUsdValue: !0
176920
176923
  }), B != null && B.toString()) {
176921
176924
  const F = {
176922
176925
  ...v,
@@ -6,10 +6,11 @@ export type FormulaSyncType = {
6
6
  newValue: Record<string, string>;
7
7
  apiData: Array<Record<string, object>> | Array<Array<string>>;
8
8
  sheetEditorRef: React.RefObject<WorkbookInstance | null>;
9
+ shouldIgnoreUsdValue?: boolean;
9
10
  };
10
11
  export declare function isUsdValue(str: string): boolean;
11
12
  export declare const USD_FA: string;
12
- export declare const formulaResponseUiSync: ({ row, column, newValue, apiData, sheetEditorRef, }: FormulaSyncType) => void;
13
+ export declare const formulaResponseUiSync: ({ row, column, newValue, apiData, sheetEditorRef, shouldIgnoreUsdValue, }: FormulaSyncType) => void;
13
14
  export declare const getCellClone: (r: number, c: number, sheetEditorRef: React.RefObject<WorkbookInstance | null>) => {
14
15
  v?: string | number | boolean;
15
16
  m?: string | number;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/dsheet",
3
3
  "private": false,
4
4
  "description": "DSheet",
5
- "version": "1.2.20",
5
+ "version": "1.2.21",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {