@univerjs/sheets-numfmt 0.5.5-nightly.202501210734 → 0.5.5-nightly.202501210849

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/lib/es/facade.js CHANGED
@@ -1,19 +1,25 @@
1
- import { SetNumfmtCommand as l, SheetsNumfmtCellContentController as i } from "@univerjs/sheets-numfmt";
2
- import { FRange as o, FWorkbook as s } from "@univerjs/sheets/facade";
3
- class a extends o {
4
- setNumberFormat(t) {
5
- const e = [];
6
- return this.forEach((m, r) => e.push({ row: m, col: r, pattern: t })), this._commandService.syncExecuteCommand(l.id, {
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
3
+ import { SetNumfmtCommand, SheetsNumfmtCellContentController } from "@univerjs/sheets-numfmt";
4
+ import { FRange, FWorkbook } from "@univerjs/sheets/facade";
5
+ const _FRangeLegacy = class _FRangeLegacy extends FRange {
6
+ setNumberFormat(pattern) {
7
+ const values = [];
8
+ return this.forEach((row, col) => values.push({ row, col, pattern })), this._commandService.syncExecuteCommand(SetNumfmtCommand.id, {
7
9
  unitId: this._workbook.getUnitId(),
8
10
  subUnitId: this._worksheet.getSheetId(),
9
- values: e
11
+ values
10
12
  }), this;
11
13
  }
12
- }
13
- o.extend(a);
14
- class c extends s {
15
- setNumfmtLocal(t) {
16
- return this._injector.get(i).setNumfmtLocal(t), this;
14
+ };
15
+ __name(_FRangeLegacy, "FRangeLegacy");
16
+ let FRangeLegacy = _FRangeLegacy;
17
+ FRange.extend(FRangeLegacy);
18
+ const _FWorkbookLegacy = class _FWorkbookLegacy extends FWorkbook {
19
+ setNumfmtLocal(local) {
20
+ return this._injector.get(SheetsNumfmtCellContentController).setNumfmtLocal(local), this;
17
21
  }
18
- }
19
- s.extend(c);
22
+ };
23
+ __name(_FWorkbookLegacy, "FWorkbookLegacy");
24
+ let FWorkbookLegacy = _FWorkbookLegacy;
25
+ FWorkbook.extend(FWorkbookLegacy);
package/lib/es/index.js CHANGED
@@ -1,12 +1,13 @@
1
- var ne = Object.defineProperty;
2
- var re = (e, t, r) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var y = (e, t, r) => re(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { numfmt as N, CommandType as I, ICommandService as M, IUniverInstanceService as D, IUndoRedoService as se, sequenceExecute as oe, Range as C, CellValueType as A, Inject as E, ThemeService as ce, LocaleService as ae, Disposable as X, LocaleType as b, ObjectMatrix as B, InterceptorEffectEnum as W, isRealNum as ie, UniverInstanceType as Y, DependentOn as ue, Injector as le, Plugin as me, registerDependencies as fe, touchDependencies as G } from "@univerjs/core";
5
- import { getSheetCommandTarget as w, transformCellsToRange as de, rangeMerge as H, SetNumfmtMutation as Z, factorySetNumfmtUndoMutation as he, RemoveNumfmtMutation as ge, factoryRemoveNumfmtUndoMutation as pe, SheetsSelectionsService as V, INumfmtService as F, SheetInterceptorService as ve, INTERCEPTOR_POINT as Se, InterceptCellContentPriority as _e, SetRangeValuesMutation as ye, UniverSheetsPlugin as be } from "@univerjs/sheets";
6
- import { BehaviorSubject as j, merge as Ce, switchMap as Me, of as $e, skip as Ee } from "rxjs";
7
- import { DEFAULT_TEXT_FORMAT as Ne } from "@univerjs/engine-numfmt";
8
- import { stripErrorMargin as Re } from "@univerjs/engine-formula";
9
- const J = [
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
+ import { numfmt, CommandType, ICommandService, IUniverInstanceService, IUndoRedoService, sequenceExecute, Range, CellValueType, Inject, ThemeService, LocaleService, Disposable, LocaleType, ObjectMatrix, InterceptorEffectEnum, isRealNum, UniverInstanceType, DependentOn, Injector, Plugin, registerDependencies, touchDependencies } from "@univerjs/core";
6
+ import { getSheetCommandTarget, transformCellsToRange, rangeMerge, SetNumfmtMutation, factorySetNumfmtUndoMutation, RemoveNumfmtMutation, factoryRemoveNumfmtUndoMutation, SheetsSelectionsService, INumfmtService, SheetInterceptorService, INTERCEPTOR_POINT, InterceptCellContentPriority, SetRangeValuesMutation, UniverSheetsPlugin } from "@univerjs/sheets";
7
+ import { BehaviorSubject, merge, switchMap, of, skip } from "rxjs";
8
+ import { DEFAULT_TEXT_FORMAT } from "@univerjs/engine-numfmt";
9
+ import { stripErrorMargin } from "@univerjs/engine-formula";
10
+ const currencySymbols = [
10
11
  "$",
11
12
  "£",
12
13
  "¥",
@@ -34,7 +35,7 @@ const J = [
34
35
  "₽",
35
36
  "₾",
36
37
  "₿"
37
- ], Ie = {
38
+ ], countryCurrencyMap = {
38
39
  US: "$",
39
40
  // United States Dollar
40
41
  CA: "C$",
@@ -74,7 +75,7 @@ const J = [
74
75
  SI: "€",
75
76
  ES: "€"
76
77
  // Add more mappings as needed
77
- }, Te = [
78
+ }, DATEFMTLISG = [
78
79
  {
79
80
  label: "1930-08-05",
80
81
  suffix: "yyyy-MM-dd"
@@ -119,7 +120,7 @@ const J = [
119
120
  label: "08-05 下午 01:30",
120
121
  suffix: "MM-dd A/P hh:mm"
121
122
  }
122
- ], xe = [
123
+ ], NUMBERFORMAT = [
123
124
  {
124
125
  label: "(1,235)",
125
126
  suffix: "#,##0_);(#,##0)"
@@ -147,468 +148,471 @@ const J = [
147
148
  suffix: "#,##0.00_);[Red]-#,##0.00",
148
149
  color: "red"
149
150
  }
150
- ], Q = [
151
+ ], CURRENCYFORMAT = [
151
152
  {
152
- label: (e) => `${e}1,235`,
153
- suffix: (e) => `"${e}"#,##0.00_);"${e}"#,##0.00`
153
+ label: /* @__PURE__ */ __name((suffix) => `${suffix}1,235`, "label"),
154
+ suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);"${suffix}"#,##0.00`, "suffix")
154
155
  },
155
156
  {
156
- label: (e) => `${e}1,235`,
157
- suffix: (e) => `"${e}"#,##0.00_);[Red]"${e}"#,##0.00`,
157
+ label: /* @__PURE__ */ __name((suffix) => `${suffix}1,235`, "label"),
158
+ suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);[Red]"${suffix}"#,##0.00`, "suffix"),
158
159
  color: "red"
159
160
  },
160
161
  {
161
- label: (e) => `(${e}1,235)`,
162
- suffix: (e) => `"${e}"#,##0.00_);("${e}"#,##0.00)`
162
+ label: /* @__PURE__ */ __name((suffix) => `(${suffix}1,235)`, "label"),
163
+ suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);("${suffix}"#,##0.00)`, "suffix")
163
164
  },
164
165
  {
165
- label: (e) => `(${e}1,235)`,
166
- suffix: (e) => `"${e}"#,##0.00_);[Red]("${e}"#,##0.00)`,
166
+ label: /* @__PURE__ */ __name((suffix) => `(${suffix}1,235)`, "label"),
167
+ suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);[Red]("${suffix}"#,##0.00)`, "suffix"),
167
168
  color: "red"
168
169
  },
169
170
  {
170
- label: (e) => `-${e}1,235`,
171
- suffix: (e) => `"${e}"#,##0.00_);-"${e}"#,##0.00`
171
+ label: /* @__PURE__ */ __name((suffix) => `-${suffix}1,235`, "label"),
172
+ suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);-"${suffix}"#,##0.00`, "suffix")
172
173
  },
173
174
  {
174
- label: (e) => `-${e}1,235`,
175
- suffix: (e) => `"${e}"#,##0.00_);[Red]-"${e}"#,##0.00`,
175
+ label: /* @__PURE__ */ __name((suffix) => `-${suffix}1,235`, "label"),
176
+ suffix: /* @__PURE__ */ __name((suffix) => `"${suffix}"#,##0.00_);[Red]-"${suffix}"#,##0.00`, "suffix"),
176
177
  color: "red"
177
178
  }
178
- ], Pe = "SHEET_NUMFMT_PLUGIN", x = (e, t = 0) => {
179
- var n;
180
- return e && (n = N.getInfo(e).maxDecimals) != null ? n : t;
181
- }, Ze = (e, t) => {
182
- if (e && !t || !e && t)
179
+ ], SHEET_NUMFMT_PLUGIN = "SHEET_NUMFMT_PLUGIN", getDecimalFromPattern = /* @__PURE__ */ __name((pattern, defaultValue = 0) => {
180
+ var _a3;
181
+ return pattern && (_a3 = numfmt.getInfo(pattern).maxDecimals) != null ? _a3 : defaultValue;
182
+ }, "getDecimalFromPattern"), isPatternEqualWithoutDecimal = /* @__PURE__ */ __name((patternA, patternB) => {
183
+ if (patternA && !patternB || !patternA && patternB)
183
184
  return !1;
184
- const r = (c) => c.reduce(
185
- (l, h) => {
186
- if (l.isEnd)
187
- return l;
188
- const f = h.value || h.num;
189
- return h.type === "point" ? (l.isEnd = !0, l) : { ...l, result: l.result + f };
185
+ const getString = /* @__PURE__ */ __name((tokens) => tokens.reduce(
186
+ (pre, cur) => {
187
+ if (pre.isEnd)
188
+ return pre;
189
+ const str = cur.value || cur.num;
190
+ return cur.type === "point" ? (pre.isEnd = !0, pre) : { ...pre, result: pre.result + str };
190
191
  },
191
192
  { isEnd: !1, result: "" }
192
- ).result, n = N.getInfo(e)._partitions, s = N.getInfo(t)._partitions, o = r(n[0].tokens), a = r(s[0].tokens), d = r(n[1].tokens), u = r(s[1].tokens);
193
- return o === a && d === u && n[1].color === s[1].color;
194
- }, z = (e) => new Array(Math.min(Math.max(0, Number(e)), 30)).fill(0).join(""), P = (e, t) => e.split(";").map((n) => /\.0?/.test(n) ? n.replace(
193
+ ).result, "getString"), partitionsA = numfmt.getInfo(patternA)._partitions, partitionsB = numfmt.getInfo(patternB)._partitions, A1 = getString(partitionsA[0].tokens), B1 = getString(partitionsB[0].tokens), A2 = getString(partitionsA[1].tokens), B2 = getString(partitionsB[1].tokens);
194
+ return A1 === B1 && A2 === B2 && partitionsA[1].color === partitionsB[1].color;
195
+ }, "isPatternEqualWithoutDecimal"), getDecimalString = /* @__PURE__ */ __name((length) => new Array(Math.min(Math.max(0, Number(length)), 30)).fill(0).join(""), "getDecimalString"), setPatternDecimal = /* @__PURE__ */ __name((patterns, decimalLength) => patterns.split(";").map((pattern) => /\.0?/.test(pattern) ? pattern.replace(
195
196
  /\.0*/g,
196
- `${t > 0 ? "." : ""}${z(Number(t || 0))}`
197
- ) : /0([^0]?)|0$/.test(n) ? n.replace(
197
+ `${decimalLength > 0 ? "." : ""}${getDecimalString(Number(decimalLength || 0))}`
198
+ ) : /0([^0]?)|0$/.test(pattern) ? pattern.replace(
198
199
  /0([^0]+)|0$/,
199
- `0${t > 0 ? "." : ""}${z(Number(t || 0))}$1`
200
- ) : n).join(";"), Je = (e) => /\.0?/.test(e) || /0([^0]?)|0$/.test(e), T = {
200
+ `0${decimalLength > 0 ? "." : ""}${getDecimalString(Number(decimalLength || 0))}$1`
201
+ ) : pattern).join(";"), "setPatternDecimal"), isPatternHasDecimal = /* @__PURE__ */ __name((pattern) => /\.0?/.test(pattern) || /0([^0]?)|0$/.test(pattern), "isPatternHasDecimal"), SetNumfmtCommand = {
201
202
  id: "sheet.command.numfmt.set.numfmt",
202
- type: I.COMMAND,
203
- handler: (e, t) => {
204
- if (!t)
203
+ type: CommandType.COMMAND,
204
+ handler: /* @__PURE__ */ __name((accessor, params) => {
205
+ if (!params)
205
206
  return !1;
206
- const r = e.get(M), n = e.get(D), s = e.get(se), o = w(n, t);
207
- if (!o) return !1;
208
- const { unitId: a, subUnitId: d } = o, u = t.values.filter((i) => !!i.pattern), c = t.values.filter((i) => !i.pattern), l = de(a, d, u), h = {
209
- unitId: a,
210
- subUnitId: d,
211
- ranges: c.map((i) => ({
212
- startColumn: i.col,
213
- startRow: i.row,
214
- endColumn: i.col,
215
- endRow: i.row
207
+ const commandService = accessor.get(ICommandService), univerInstanceService = accessor.get(IUniverInstanceService), undoRedoService = accessor.get(IUndoRedoService), target = getSheetCommandTarget(univerInstanceService, params);
208
+ if (!target) return !1;
209
+ const { unitId, subUnitId } = target, setCells = params.values.filter((value) => !!value.pattern), removeCells = params.values.filter((value) => !value.pattern), setRedos = transformCellsToRange(unitId, subUnitId, setCells), removeRedos = {
210
+ unitId,
211
+ subUnitId,
212
+ ranges: removeCells.map((cell) => ({
213
+ startColumn: cell.col,
214
+ startRow: cell.row,
215
+ endColumn: cell.col,
216
+ endRow: cell.row
216
217
  }))
217
- }, f = [], v = [];
218
- if (u.length) {
219
- Object.keys(l.values).forEach((g) => {
220
- const p = l.values[g];
221
- p.ranges = H(p.ranges);
222
- }), f.push({
223
- id: Z.id,
224
- params: l
218
+ }, redos = [], undos = [];
219
+ if (setCells.length) {
220
+ Object.keys(setRedos.values).forEach((key) => {
221
+ const v = setRedos.values[key];
222
+ v.ranges = rangeMerge(v.ranges);
223
+ }), redos.push({
224
+ id: SetNumfmtMutation.id,
225
+ params: setRedos
225
226
  });
226
- const i = he(e, l);
227
- v.push(...i);
227
+ const undo = factorySetNumfmtUndoMutation(accessor, setRedos);
228
+ undos.push(...undo);
228
229
  }
229
- if (c.length) {
230
- h.ranges = H(h.ranges), f.push({
231
- id: ge.id,
232
- params: h
230
+ if (removeCells.length) {
231
+ removeRedos.ranges = rangeMerge(removeRedos.ranges), redos.push({
232
+ id: RemoveNumfmtMutation.id,
233
+ params: removeRedos
233
234
  });
234
- const i = pe(e, h);
235
- v.push(...i);
235
+ const undo = factoryRemoveNumfmtUndoMutation(accessor, removeRedos);
236
+ undos.push(...undo);
236
237
  }
237
- const m = oe(f, r).result;
238
- return m && s.pushUndoRedo({
239
- unitID: a,
240
- undoMutations: v,
241
- redoMutations: f
242
- }), m;
243
- }
244
- }, Ue = {
238
+ const result = sequenceExecute(redos, commandService).result;
239
+ return result && undoRedoService.pushUndoRedo({
240
+ unitID: unitId,
241
+ undoMutations: undos,
242
+ redoMutations: redos
243
+ }), result;
244
+ }, "handler")
245
+ }, AddDecimalCommand = {
245
246
  id: "sheet.command.numfmt.add.decimal.command",
246
- type: I.COMMAND,
247
- handler: async (e) => {
248
- const t = e.get(M), r = e.get(V), n = e.get(F), s = e.get(D), o = r.getCurrentSelections();
249
- if (!o || !o.length)
247
+ type: CommandType.COMMAND,
248
+ handler: /* @__PURE__ */ __name(async (accessor) => {
249
+ const commandService = accessor.get(ICommandService), selectionManagerService = accessor.get(SheetsSelectionsService), numfmtService = accessor.get(INumfmtService), univerInstanceService = accessor.get(IUniverInstanceService), selections = selectionManagerService.getCurrentSelections();
250
+ if (!selections || !selections.length)
250
251
  return !1;
251
- const a = w(s);
252
- if (!a) return !1;
253
- const { unitId: d, subUnitId: u } = a;
254
- let c = 0;
255
- o.forEach((v) => {
256
- C.foreach(v.range, (m, i) => {
257
- const g = n.getValue(d, u, m, i);
258
- if (!g) {
259
- const S = a.worksheet.getCellRaw(m, i);
260
- if (!c && S && S.t === A.NUMBER && S.v) {
261
- const _ = /\.(\d*)$/.exec(String(S.v));
262
- if (_) {
263
- const R = _[1].length;
264
- if (!R)
252
+ const target = getSheetCommandTarget(univerInstanceService);
253
+ if (!target) return !1;
254
+ const { unitId, subUnitId } = target;
255
+ let maxDecimals = 0;
256
+ selections.forEach((selection) => {
257
+ Range.foreach(selection.range, (row, col) => {
258
+ const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
259
+ if (!numfmtValue) {
260
+ const cell = target.worksheet.getCellRaw(row, col);
261
+ if (!maxDecimals && cell && cell.t === CellValueType.NUMBER && cell.v) {
262
+ const regResult = /\.(\d*)$/.exec(String(cell.v));
263
+ if (regResult) {
264
+ const length = regResult[1].length;
265
+ if (!length)
265
266
  return;
266
- c = Math.max(c, R);
267
+ maxDecimals = Math.max(maxDecimals, length);
267
268
  }
268
269
  }
269
270
  return;
270
271
  }
271
- const p = x(g.pattern);
272
- c = p > c ? p : c;
272
+ const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
273
+ maxDecimals = decimals2 > maxDecimals ? decimals2 : maxDecimals;
273
274
  });
274
275
  });
275
- const l = c + 1, h = P(`0${l > 0 ? ".0" : ""}`, l), f = [];
276
- return o.forEach((v) => {
277
- C.foreach(v.range, (m, i) => {
278
- const g = n.getValue(d, u, m, i);
279
- if (!g)
280
- f.push({
281
- row: m,
282
- col: i,
283
- pattern: h
276
+ const decimals = maxDecimals + 1, defaultPattern = setPatternDecimal(`0${decimals > 0 ? ".0" : ""}`, decimals), values = [];
277
+ return selections.forEach((selection) => {
278
+ Range.foreach(selection.range, (row, col) => {
279
+ const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
280
+ if (!numfmtValue)
281
+ values.push({
282
+ row,
283
+ col,
284
+ pattern: defaultPattern
284
285
  });
285
286
  else {
286
- const p = x(g.pattern), S = P(g.pattern, p + 1);
287
- S !== g.pattern && f.push({
288
- row: m,
289
- col: i,
290
- pattern: S
287
+ const decimals2 = getDecimalFromPattern(numfmtValue.pattern), pattern = setPatternDecimal(numfmtValue.pattern, decimals2 + 1);
288
+ pattern !== numfmtValue.pattern && values.push({
289
+ row,
290
+ col,
291
+ pattern
291
292
  });
292
293
  }
293
294
  });
294
- }), f.length ? await t.executeCommand(T.id, { values: f }) : !1;
295
- }
296
- };
297
- class k {
295
+ }), values.length ? await commandService.executeCommand(SetNumfmtCommand.id, { values }) : !1;
296
+ }, "handler")
297
+ }, _MenuCurrencyService = class _MenuCurrencyService {
298
298
  constructor() {
299
- y(this, "_currencySymbol$", new j("US"));
300
- y(this, "currencySymbol$", this._currencySymbol$.asObservable());
299
+ __publicField(this, "_currencySymbol$", new BehaviorSubject("US"));
300
+ __publicField(this, "currencySymbol$", this._currencySymbol$.asObservable());
301
301
  }
302
302
  /**
303
303
  * Set the currency symbol by setting the country code.
304
304
  */
305
- setCurrencySymbolByCountryCode(t) {
306
- this._currencySymbol$.next(t);
305
+ setCurrencySymbolByCountryCode(symbol) {
306
+ this._currencySymbol$.next(symbol);
307
307
  }
308
308
  getCurrencySymbol() {
309
309
  return this._currencySymbol$.getValue();
310
310
  }
311
- }
312
- const Oe = {
311
+ };
312
+ __name(_MenuCurrencyService, "MenuCurrencyService");
313
+ let MenuCurrencyService = _MenuCurrencyService;
314
+ const SetCurrencyCommand = {
313
315
  id: "sheet.command.numfmt.set.currency",
314
- type: I.COMMAND,
315
- handler: async (e) => {
316
- const t = e.get(M), r = e.get(V), n = e.get(k), s = Ie[n.getCurrencySymbol()] || "$", o = r.getCurrentSelections();
317
- if (!o || !o.length)
316
+ type: CommandType.COMMAND,
317
+ handler: /* @__PURE__ */ __name(async (accessor) => {
318
+ const commandService = accessor.get(ICommandService), selectionManagerService = accessor.get(SheetsSelectionsService), menuCurrencyService = accessor.get(MenuCurrencyService), symbol = countryCurrencyMap[menuCurrencyService.getCurrencySymbol()] || "$", selections = selectionManagerService.getCurrentSelections();
319
+ if (!selections || !selections.length)
318
320
  return !1;
319
- const a = [], d = Q[4].suffix(s);
320
- return o.forEach((c) => {
321
- C.foreach(c.range, (l, h) => {
322
- a.push({ row: l, col: h, pattern: d, type: "currency" });
321
+ const values = [], suffix = CURRENCYFORMAT[4].suffix(symbol);
322
+ return selections.forEach((selection) => {
323
+ Range.foreach(selection.range, (row, col) => {
324
+ values.push({ row, col, pattern: suffix, type: "currency" });
323
325
  });
324
- }), await t.executeCommand(T.id, { values: a });
325
- }
326
- }, De = {
326
+ }), await commandService.executeCommand(SetNumfmtCommand.id, { values });
327
+ }, "handler")
328
+ }, SetPercentCommand = {
327
329
  id: "sheet.command.numfmt.set.percent",
328
- type: I.COMMAND,
329
- handler: async (e) => {
330
- const t = e.get(M), n = e.get(V).getCurrentSelections();
331
- if (!n || !n.length)
330
+ type: CommandType.COMMAND,
331
+ handler: /* @__PURE__ */ __name(async (accessor) => {
332
+ const commandService = accessor.get(ICommandService), selections = accessor.get(SheetsSelectionsService).getCurrentSelections();
333
+ if (!selections || !selections.length)
332
334
  return !1;
333
- const s = [], o = "0%";
334
- return n.forEach((d) => {
335
- C.foreach(d.range, (u, c) => {
336
- s.push({ row: u, col: c, pattern: o, type: "percent" });
335
+ const values = [], suffix = "0%";
336
+ return selections.forEach((selection) => {
337
+ Range.foreach(selection.range, (row, col) => {
338
+ values.push({ row, col, pattern: suffix, type: "percent" });
337
339
  });
338
- }), await t.executeCommand(T.id, { values: s });
339
- }
340
- }, Ve = {
340
+ }), await commandService.executeCommand(SetNumfmtCommand.id, { values });
341
+ }, "handler")
342
+ }, SubtractDecimalCommand = {
341
343
  id: "sheet.command.numfmt.subtract.decimal.command",
342
- type: I.COMMAND,
343
- handler: async (e) => {
344
- const t = e.get(M), r = e.get(V), n = e.get(F), s = e.get(D), o = r.getCurrentSelections();
345
- if (!o || !o.length)
344
+ type: CommandType.COMMAND,
345
+ handler: /* @__PURE__ */ __name(async (accessor) => {
346
+ const commandService = accessor.get(ICommandService), selectionManagerService = accessor.get(SheetsSelectionsService), numfmtService = accessor.get(INumfmtService), univerInstanceService = accessor.get(IUniverInstanceService), selections = selectionManagerService.getCurrentSelections();
347
+ if (!selections || !selections.length)
346
348
  return !1;
347
- const a = w(s);
348
- if (!a) return !1;
349
- const { unitId: d, subUnitId: u } = a;
350
- let c = 0;
351
- o.forEach((m) => {
352
- C.foreach(m.range, (i, g) => {
353
- const p = n.getValue(d, u, i, g);
354
- if (!p) {
355
- const _ = a.worksheet.getCellRaw(i, g);
356
- if (!c && _ && _.t === A.NUMBER && _.v) {
357
- const R = /\.(\d*)$/.exec(String(_.v));
358
- if (R) {
359
- const L = R[1].length;
360
- if (!L)
349
+ const target = getSheetCommandTarget(univerInstanceService);
350
+ if (!target) return !1;
351
+ const { unitId, subUnitId } = target;
352
+ let maxDecimals = 0;
353
+ selections.forEach((selection) => {
354
+ Range.foreach(selection.range, (row, col) => {
355
+ const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
356
+ if (!numfmtValue) {
357
+ const cell = target.worksheet.getCellRaw(row, col);
358
+ if (!maxDecimals && cell && cell.t === CellValueType.NUMBER && cell.v) {
359
+ const regResult = /\.(\d*)$/.exec(String(cell.v));
360
+ if (regResult) {
361
+ const length = regResult[1].length;
362
+ if (!length)
361
363
  return;
362
- c = Math.max(c, L);
364
+ maxDecimals = Math.max(maxDecimals, length);
363
365
  }
364
366
  }
365
367
  return;
366
368
  }
367
- const S = x(p.pattern);
368
- c = S > c ? S : c;
369
+ const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
370
+ maxDecimals = decimals2 > maxDecimals ? decimals2 : maxDecimals;
369
371
  });
370
372
  });
371
- const l = c - 1, h = P(`0${l > 0 ? ".0" : "."}`, l), f = [];
372
- return o.forEach((m) => {
373
- C.foreach(m.range, (i, g) => {
374
- const p = n.getValue(d, u, i, g);
375
- if (!p)
376
- f.push({
377
- row: i,
378
- col: g,
379
- pattern: h
373
+ const decimals = maxDecimals - 1, defaultPattern = setPatternDecimal(`0${decimals > 0 ? ".0" : "."}`, decimals), values = [];
374
+ return selections.forEach((selection) => {
375
+ Range.foreach(selection.range, (row, col) => {
376
+ const numfmtValue = numfmtService.getValue(unitId, subUnitId, row, col);
377
+ if (!numfmtValue)
378
+ values.push({
379
+ row,
380
+ col,
381
+ pattern: defaultPattern
380
382
  });
381
383
  else {
382
- const S = x(p.pattern);
383
- f.push({
384
- row: i,
385
- col: g,
386
- pattern: P(p.pattern, S - 1)
384
+ const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
385
+ values.push({
386
+ row,
387
+ col,
388
+ pattern: setPatternDecimal(numfmtValue.pattern, decimals2 - 1)
387
389
  });
388
390
  }
389
391
  });
390
- }), await t.executeCommand(T.id, { values: f });
391
- }
392
- }, Qe = (e) => N.getInfo(e).type || "unknown", Ae = (e, t, r = "en") => {
393
- const s = N.getInfo(e)._partitions[1], o = N.format(e, t, { locale: r, throws: !1 });
394
- return t < 0 ? {
395
- result: o,
396
- color: s.color
392
+ }), await commandService.executeCommand(SetNumfmtCommand.id, { values });
393
+ }, "handler")
394
+ }, getPatternType = /* @__PURE__ */ __name((pattern) => numfmt.getInfo(pattern).type || "unknown", "getPatternType"), getPatternPreview = /* @__PURE__ */ __name((pattern, value, locale = "en") => {
395
+ const negInfo = numfmt.getInfo(pattern)._partitions[1], result = numfmt.format(pattern, value, { locale, throws: !1 });
396
+ return value < 0 ? {
397
+ result,
398
+ color: negInfo.color
397
399
  } : {
398
- result: o
400
+ result
399
401
  };
400
- }, we = (e, t, r) => e === "General" ? {
401
- result: String(Re(t))
402
+ }, "getPatternPreview"), getPatternPreviewIgnoreGeneral = /* @__PURE__ */ __name((pattern, value, locale) => pattern === "General" ? {
403
+ result: String(stripErrorMargin(value))
402
404
  // In Excel, the default General format also needs to handle numeric precision.
403
- } : Ae(e, t, r);
404
- var Fe = Object.defineProperty, je = Object.getOwnPropertyDescriptor, Le = (e, t, r, n) => {
405
- for (var s = n > 1 ? void 0 : n ? je(t, r) : t, o = e.length - 1, a; o >= 0; o--)
406
- (a = e[o]) && (s = (n ? a(t, r, s) : a(s)) || s);
407
- return n && s && Fe(t, r, s), s;
408
- }, $ = (e, t) => (r, n) => t(r, n, e);
409
- let U = class extends X {
410
- constructor(t, r, n, s, o, a) {
405
+ } : getPatternPreview(pattern, value, locale), "getPatternPreviewIgnoreGeneral");
406
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
407
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
408
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
409
+ return kind && result && __defProp$1(target, key, result), result;
410
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a;
411
+ let SheetsNumfmtCellContentController = (_a = class extends Disposable {
412
+ constructor(_instanceService, _sheetInterceptorService, _themeService, _commandService, _numfmtService, _localeService) {
411
413
  super();
412
- y(this, "_local$", new j("en"));
413
- y(this, "local$", this._local$.asObservable());
414
- this._instanceService = t, this._sheetInterceptorService = r, this._themeService = n, this._commandService = s, this._numfmtService = o, this._localeService = a, this._initInterceptorCellContent();
414
+ __publicField(this, "_local$", new BehaviorSubject("en"));
415
+ __publicField(this, "local$", this._local$.asObservable());
416
+ this._instanceService = _instanceService, this._sheetInterceptorService = _sheetInterceptorService, this._themeService = _themeService, this._commandService = _commandService, this._numfmtService = _numfmtService, this._localeService = _localeService, this._initInterceptorCellContent();
415
417
  }
416
418
  get local() {
417
- const t = this._local$.getValue();
418
- if (t)
419
- return t;
419
+ const _local = this._local$.getValue();
420
+ if (_local)
421
+ return _local;
420
422
  switch (this._localeService.getCurrentLocale()) {
421
- case b.FR_FR:
423
+ case LocaleType.FR_FR:
422
424
  return "fr";
423
- case b.RU_RU:
425
+ case LocaleType.RU_RU:
424
426
  return "ru";
425
- case b.VI_VN:
427
+ case LocaleType.VI_VN:
426
428
  return "vi";
427
- case b.ZH_CN:
429
+ case LocaleType.ZH_CN:
428
430
  return "zh-CN";
429
- case b.ZH_TW:
431
+ case LocaleType.ZH_TW:
430
432
  return "zh-TW";
431
- case b.EN_US:
432
- case b.FA_IR:
433
+ case LocaleType.EN_US:
434
+ case LocaleType.FA_IR:
433
435
  default:
434
436
  return "en";
435
437
  }
436
438
  }
437
439
  // eslint-disable-next-line max-lines-per-function
438
440
  _initInterceptorCellContent() {
439
- const t = {
441
+ const TEXT_FORMAT_MARK = {
440
442
  tl: {
441
443
  size: 6,
442
444
  color: "#409f11"
443
445
  }
444
- }, r = new B();
445
- this.disposeWithMe(Ce(this._local$, this._localeService.currentLocale$).subscribe(() => {
446
- r.reset();
447
- })), this.disposeWithMe(this._sheetInterceptorService.intercept(Se.CELL_CONTENT, {
448
- effect: W.Value | W.Style,
449
- handler: (n, s, o) => {
450
- const a = s.unitId, d = s.subUnitId;
451
- let u;
452
- const c = n;
453
- if (!c)
454
- return o(n);
455
- if (n != null && n.s) {
456
- const m = s.workbook.getStyles().get(n.s);
457
- m != null && m.n && (u = m.n);
446
+ }, renderCache = new ObjectMatrix();
447
+ this.disposeWithMe(merge(this._local$, this._localeService.currentLocale$).subscribe(() => {
448
+ renderCache.reset();
449
+ })), this.disposeWithMe(this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT, {
450
+ effect: InterceptorEffectEnum.Value | InterceptorEffectEnum.Style,
451
+ handler: /* @__PURE__ */ __name((cell, location, next) => {
452
+ const unitId = location.unitId, sheetId = location.subUnitId;
453
+ let numfmtValue;
454
+ const originCellValue = cell;
455
+ if (!originCellValue)
456
+ return next(cell);
457
+ if (cell != null && cell.s) {
458
+ const style = location.workbook.getStyles().get(cell.s);
459
+ style != null && style.n && (numfmtValue = style.n);
458
460
  }
459
- if (u || (u = this._numfmtService.getValue(a, d, s.row, s.col)), !u)
460
- return o(n);
461
- if (u.pattern === Ne && c.v && ie(c.v))
462
- return o({
463
- ...n,
461
+ if (numfmtValue || (numfmtValue = this._numfmtService.getValue(unitId, sheetId, location.row, location.col)), !numfmtValue)
462
+ return next(cell);
463
+ if (numfmtValue.pattern === DEFAULT_TEXT_FORMAT && originCellValue.v && isRealNum(originCellValue.v))
464
+ return next({
465
+ ...cell,
464
466
  markers: {
465
- ...n == null ? void 0 : n.markers,
466
- ...t
467
+ ...cell == null ? void 0 : cell.markers,
468
+ ...TEXT_FORMAT_MARK
467
469
  }
468
470
  });
469
- if (c.t !== A.NUMBER || c.v == null || Number.isNaN(c.v))
470
- return o(n);
471
- let l = "";
472
- const h = r.getValue(s.row, s.col);
473
- if (h && h.parameters === `${c.v}_${u.pattern}`)
474
- return o({ ...n, ...h.result });
475
- const f = we(u.pattern, Number(c.v), this.local);
476
- if (l = f.result, !l)
477
- return o(n);
478
- const v = { v: l };
479
- if (f.color) {
480
- const m = this._themeService.getCurrentTheme()[`${f.color}500`];
481
- m && (v.interceptorStyle = { cl: { rgb: m } });
471
+ if (originCellValue.t !== CellValueType.NUMBER || originCellValue.v == null || Number.isNaN(originCellValue.v))
472
+ return next(cell);
473
+ let numfmtRes = "";
474
+ const cache = renderCache.getValue(location.row, location.col);
475
+ if (cache && cache.parameters === `${originCellValue.v}_${numfmtValue.pattern}`)
476
+ return next({ ...cell, ...cache.result });
477
+ const info = getPatternPreviewIgnoreGeneral(numfmtValue.pattern, Number(originCellValue.v), this.local);
478
+ if (numfmtRes = info.result, !numfmtRes)
479
+ return next(cell);
480
+ const res = { v: numfmtRes };
481
+ if (info.color) {
482
+ const color = this._themeService.getCurrentTheme()[`${info.color}500`];
483
+ color && (res.interceptorStyle = { cl: { rgb: color } });
482
484
  }
483
- return r.setValue(s.row, s.col, {
484
- result: v,
485
- parameters: `${c.v}_${u.pattern}`
486
- }), o({ ...n, ...v });
487
- },
488
- priority: _e.NUMFMT
489
- })), this.disposeWithMe(this._commandService.onCommandExecuted((n) => {
490
- if (n.id === Z.id) {
491
- const s = n.params;
492
- Object.keys(s.values).forEach((o) => {
493
- s.values[o].ranges.forEach((d) => {
494
- C.foreach(d, (u, c) => {
495
- r.realDeleteValue(u, c);
485
+ return renderCache.setValue(location.row, location.col, {
486
+ result: res,
487
+ parameters: `${originCellValue.v}_${numfmtValue.pattern}`
488
+ }), next({ ...cell, ...res });
489
+ }, "handler"),
490
+ priority: InterceptCellContentPriority.NUMFMT
491
+ })), this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
492
+ if (commandInfo.id === SetNumfmtMutation.id) {
493
+ const params = commandInfo.params;
494
+ Object.keys(params.values).forEach((key) => {
495
+ params.values[key].ranges.forEach((range) => {
496
+ Range.foreach(range, (row, col) => {
497
+ renderCache.realDeleteValue(row, col);
496
498
  });
497
499
  });
498
500
  });
499
- } else if (n.id === ye.id) {
500
- const s = n.params;
501
- new B(s.cellValue).forValue((o, a) => {
502
- r.realDeleteValue(o, a);
501
+ } else if (commandInfo.id === SetRangeValuesMutation.id) {
502
+ const params = commandInfo.params;
503
+ new ObjectMatrix(params.cellValue).forValue((row, col) => {
504
+ renderCache.realDeleteValue(row, col);
503
505
  });
504
506
  }
505
507
  })), this.disposeWithMe(
506
- this._instanceService.getCurrentTypeOfUnit$(Y.UNIVER_SHEET).pipe(
507
- Me((n) => {
508
- var s;
509
- return (s = n == null ? void 0 : n.activeSheet$) != null ? s : $e(null);
508
+ this._instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(
509
+ switchMap((workbook) => {
510
+ var _a3;
511
+ return (_a3 = workbook == null ? void 0 : workbook.activeSheet$) != null ? _a3 : of(null);
510
512
  }),
511
- Ee(1)
512
- ).subscribe(() => r.reset())
513
+ skip(1)
514
+ ).subscribe(() => renderCache.reset())
513
515
  );
514
516
  }
515
- setNumfmtLocal(t) {
516
- this._local$.next(t);
517
+ setNumfmtLocal(local) {
518
+ this._local$.next(local);
517
519
  }
518
- };
519
- U = Le([
520
- $(0, D),
521
- $(1, E(ve)),
522
- $(2, E(ce)),
523
- $(3, E(M)),
524
- $(4, E(F)),
525
- $(5, E(ae))
526
- ], U);
527
- class K extends X {
520
+ }, __name(_a, "SheetsNumfmtCellContentController"), _a);
521
+ SheetsNumfmtCellContentController = __decorateClass$1([
522
+ __decorateParam$1(0, IUniverInstanceService),
523
+ __decorateParam$1(1, Inject(SheetInterceptorService)),
524
+ __decorateParam$1(2, Inject(ThemeService)),
525
+ __decorateParam$1(3, Inject(ICommandService)),
526
+ __decorateParam$1(4, Inject(INumfmtService)),
527
+ __decorateParam$1(5, Inject(LocaleService))
528
+ ], SheetsNumfmtCellContentController);
529
+ const _NumfmtCurrencyController = class _NumfmtCurrencyController extends Disposable {
528
530
  constructor() {
529
531
  super(...arguments);
530
- y(this, "_currencySymbol$", new j("US"));
531
- y(this, "currencySymbol$", this._currencySymbol$.asObservable());
532
+ __publicField(this, "_currencySymbol$", new BehaviorSubject("US"));
533
+ __publicField(this, "currencySymbol$", this._currencySymbol$.asObservable());
532
534
  }
533
535
  /**
534
536
  * Set the currency symbol by setting the country code.
535
537
  */
536
- setCurrencySymbolByCountryCode(r) {
537
- this._currencySymbol$.next(r);
538
+ setCurrencySymbolByCountryCode(symbol) {
539
+ this._currencySymbol$.next(symbol);
538
540
  }
539
541
  getCurrencySymbol() {
540
542
  return this._currencySymbol$.getValue();
541
543
  }
542
- }
543
- var ee = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, We = (e, t, r) => t in e ? ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Ge = (e, t, r, n) => {
544
- for (var s = n > 1 ? void 0 : n ? Be(t, r) : t, o = e.length - 1, a; o >= 0; o--)
545
- (a = e[o]) && (s = (n ? a(t, r, s) : a(s)) || s);
546
- return n && s && ee(t, r, s), s;
547
- }, q = (e, t) => (r, n) => t(r, n, e), te = (e, t, r) => We(e, typeof t != "symbol" ? t + "" : t, r);
548
- let O = class extends me {
549
- constructor(e = void 0, t, r) {
550
- super(), this._config = e, this._injector = t, this._commandService = r;
544
+ };
545
+ __name(_NumfmtCurrencyController, "NumfmtCurrencyController");
546
+ let NumfmtCurrencyController = _NumfmtCurrencyController;
547
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
548
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
549
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
550
+ return kind && result && __defProp2(target, key, result), result;
551
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField"), _a2;
552
+ let UniverSheetsNumfmtPlugin = (_a2 = class extends Plugin {
553
+ constructor(_config = void 0, _injector, _commandService) {
554
+ super(), this._config = _config, this._injector = _injector, this._commandService = _commandService;
551
555
  }
552
556
  onStarting() {
553
- fe(this._injector, [
554
- [U],
555
- [k],
556
- [K]
557
- ]), G(this._injector, [
558
- [U]
557
+ registerDependencies(this._injector, [
558
+ [SheetsNumfmtCellContentController],
559
+ [MenuCurrencyService],
560
+ [NumfmtCurrencyController]
561
+ ]), touchDependencies(this._injector, [
562
+ [SheetsNumfmtCellContentController]
559
563
  ]);
560
564
  }
561
565
  onRendered() {
562
- G(this._injector, [
563
- [K]
566
+ touchDependencies(this._injector, [
567
+ [NumfmtCurrencyController]
564
568
  ]), [
565
- Ue,
566
- Ve,
567
- Oe,
568
- De,
569
- T
570
- ].forEach((e) => {
571
- this.disposeWithMe(this._commandService.registerCommand(e));
569
+ AddDecimalCommand,
570
+ SubtractDecimalCommand,
571
+ SetCurrencyCommand,
572
+ SetPercentCommand,
573
+ SetNumfmtCommand
574
+ ].forEach((config) => {
575
+ this.disposeWithMe(this._commandService.registerCommand(config));
572
576
  });
573
577
  }
574
- };
575
- te(O, "pluginName", Pe);
576
- te(O, "type", Y.UNIVER_SHEET);
577
- O = Ge([
578
- ue(be),
579
- q(1, E(le)),
580
- q(2, M)
581
- ], O);
582
- const ke = (e) => J.find((r) => e.includes(r)), et = () => J.map((e) => ({ label: e, value: e })), tt = (e) => Q.map((t) => ({
583
- label: t.label(e),
584
- value: t.suffix(e),
585
- color: t.color
586
- })), nt = () => Te.map((e) => ({ label: e.label, value: e.suffix })), rt = () => xe.map((e) => ({ label: e.label, value: e.suffix, color: e.color }));
578
+ }, __name(_a2, "UniverSheetsNumfmtPlugin"), _a2);
579
+ __publicField2(UniverSheetsNumfmtPlugin, "pluginName", SHEET_NUMFMT_PLUGIN);
580
+ __publicField2(UniverSheetsNumfmtPlugin, "type", UniverInstanceType.UNIVER_SHEET);
581
+ UniverSheetsNumfmtPlugin = __decorateClass([
582
+ DependentOn(UniverSheetsPlugin),
583
+ __decorateParam(1, Inject(Injector)),
584
+ __decorateParam(2, ICommandService)
585
+ ], UniverSheetsNumfmtPlugin);
586
+ const getCurrencyType = /* @__PURE__ */ __name((pattern) => currencySymbols.find((code) => pattern.includes(code)), "getCurrencyType"), getCurrencyOptions = /* @__PURE__ */ __name(() => currencySymbols.map((item) => ({ label: item, value: item })), "getCurrencyOptions"), getCurrencyFormatOptions = /* @__PURE__ */ __name((suffix) => CURRENCYFORMAT.map((item) => ({
587
+ label: item.label(suffix),
588
+ value: item.suffix(suffix),
589
+ color: item.color
590
+ })), "getCurrencyFormatOptions"), getDateFormatOptions = /* @__PURE__ */ __name(() => DATEFMTLISG.map((item) => ({ label: item.label, value: item.suffix })), "getDateFormatOptions"), getNumberFormatOptions = /* @__PURE__ */ __name(() => NUMBERFORMAT.map((item) => ({ label: item.label, value: item.suffix, color: item.color })), "getNumberFormatOptions");
587
591
  export {
588
- Ue as AddDecimalCommand,
589
- Q as CURRENCYFORMAT,
590
- Te as DATEFMTLISG,
591
- k as MenuCurrencyService,
592
- xe as NUMBERFORMAT,
593
- Oe as SetCurrencyCommand,
594
- T as SetNumfmtCommand,
595
- De as SetPercentCommand,
596
- U as SheetsNumfmtCellContentController,
597
- Ve as SubtractDecimalCommand,
598
- O as UniverSheetsNumfmtPlugin,
599
- Ie as countryCurrencyMap,
600
- J as currencySymbols,
601
- tt as getCurrencyFormatOptions,
602
- et as getCurrencyOptions,
603
- ke as getCurrencyType,
604
- nt as getDateFormatOptions,
605
- x as getDecimalFromPattern,
606
- z as getDecimalString,
607
- rt as getNumberFormatOptions,
608
- Ae as getPatternPreview,
609
- we as getPatternPreviewIgnoreGeneral,
610
- Qe as getPatternType,
611
- Ze as isPatternEqualWithoutDecimal,
612
- Je as isPatternHasDecimal,
613
- P as setPatternDecimal
592
+ AddDecimalCommand,
593
+ CURRENCYFORMAT,
594
+ DATEFMTLISG,
595
+ MenuCurrencyService,
596
+ NUMBERFORMAT,
597
+ SetCurrencyCommand,
598
+ SetNumfmtCommand,
599
+ SetPercentCommand,
600
+ SheetsNumfmtCellContentController,
601
+ SubtractDecimalCommand,
602
+ UniverSheetsNumfmtPlugin,
603
+ countryCurrencyMap,
604
+ currencySymbols,
605
+ getCurrencyFormatOptions,
606
+ getCurrencyOptions,
607
+ getCurrencyType,
608
+ getDateFormatOptions,
609
+ getDecimalFromPattern,
610
+ getDecimalString,
611
+ getNumberFormatOptions,
612
+ getPatternPreview,
613
+ getPatternPreviewIgnoreGeneral,
614
+ getPatternType,
615
+ isPatternEqualWithoutDecimal,
616
+ isPatternHasDecimal,
617
+ setPatternDecimal
614
618
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-numfmt",
3
- "version": "0.5.5-nightly.202501210734",
3
+ "version": "0.5.5-nightly.202501210849",
4
4
  "private": false,
5
5
  "description": "UniverSheet numfmt plugin",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -53,10 +53,10 @@
53
53
  "rxjs": ">=7.0.0"
54
54
  },
55
55
  "dependencies": {
56
- "@univerjs/core": "0.5.5-nightly.202501210734",
57
- "@univerjs/engine-formula": "0.5.5-nightly.202501210734",
58
- "@univerjs/engine-numfmt": "0.5.5-nightly.202501210734",
59
- "@univerjs/sheets": "0.5.5-nightly.202501210734"
56
+ "@univerjs/core": "0.5.5-nightly.202501210849",
57
+ "@univerjs/engine-numfmt": "0.5.5-nightly.202501210849",
58
+ "@univerjs/engine-formula": "0.5.5-nightly.202501210849",
59
+ "@univerjs/sheets": "0.5.5-nightly.202501210849"
60
60
  },
61
61
  "devDependencies": {
62
62
  "rxjs": "^7.8.1",