@univerjs/sheets-numfmt 0.5.5-nightly.202501210734 → 0.5.5-nightly.202501210925
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 +20 -14
- package/lib/es/index.js +354 -350
- package/package.json +5 -5
package/lib/es/facade.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
11
|
+
values
|
|
10
12
|
}), this;
|
|
11
13
|
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
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
|
-
],
|
|
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
|
-
},
|
|
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
|
-
],
|
|
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
|
-
],
|
|
151
|
+
], CURRENCYFORMAT = [
|
|
151
152
|
{
|
|
152
|
-
label: (
|
|
153
|
-
suffix: (
|
|
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: (
|
|
157
|
-
suffix: (
|
|
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: (
|
|
162
|
-
suffix: (
|
|
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: (
|
|
166
|
-
suffix: (
|
|
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: (
|
|
171
|
-
suffix: (
|
|
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: (
|
|
175
|
-
suffix: (
|
|
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
|
-
],
|
|
179
|
-
var
|
|
180
|
-
return
|
|
181
|
-
},
|
|
182
|
-
if (
|
|
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
|
|
185
|
-
(
|
|
186
|
-
if (
|
|
187
|
-
return
|
|
188
|
-
const
|
|
189
|
-
return
|
|
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,
|
|
193
|
-
return
|
|
194
|
-
},
|
|
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
|
-
`${
|
|
197
|
-
) : /0([^0]?)|0$/.test(
|
|
197
|
+
`${decimalLength > 0 ? "." : ""}${getDecimalString(Number(decimalLength || 0))}`
|
|
198
|
+
) : /0([^0]?)|0$/.test(pattern) ? pattern.replace(
|
|
198
199
|
/0([^0]+)|0$/,
|
|
199
|
-
`0${
|
|
200
|
-
) :
|
|
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:
|
|
203
|
-
handler: (
|
|
204
|
-
if (!
|
|
203
|
+
type: CommandType.COMMAND,
|
|
204
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
205
|
+
if (!params)
|
|
205
206
|
return !1;
|
|
206
|
-
const
|
|
207
|
-
if (!
|
|
208
|
-
const { unitId
|
|
209
|
-
unitId
|
|
210
|
-
subUnitId
|
|
211
|
-
ranges:
|
|
212
|
-
startColumn:
|
|
213
|
-
startRow:
|
|
214
|
-
endColumn:
|
|
215
|
-
endRow:
|
|
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
|
-
},
|
|
218
|
-
if (
|
|
219
|
-
Object.keys(
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
}),
|
|
223
|
-
id:
|
|
224
|
-
params:
|
|
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
|
|
227
|
-
|
|
227
|
+
const undo = factorySetNumfmtUndoMutation(accessor, setRedos);
|
|
228
|
+
undos.push(...undo);
|
|
228
229
|
}
|
|
229
|
-
if (
|
|
230
|
-
|
|
231
|
-
id:
|
|
232
|
-
params:
|
|
230
|
+
if (removeCells.length) {
|
|
231
|
+
removeRedos.ranges = rangeMerge(removeRedos.ranges), redos.push({
|
|
232
|
+
id: RemoveNumfmtMutation.id,
|
|
233
|
+
params: removeRedos
|
|
233
234
|
});
|
|
234
|
-
const
|
|
235
|
-
|
|
235
|
+
const undo = factoryRemoveNumfmtUndoMutation(accessor, removeRedos);
|
|
236
|
+
undos.push(...undo);
|
|
236
237
|
}
|
|
237
|
-
const
|
|
238
|
-
return
|
|
239
|
-
unitID:
|
|
240
|
-
undoMutations:
|
|
241
|
-
redoMutations:
|
|
242
|
-
}),
|
|
243
|
-
}
|
|
244
|
-
},
|
|
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:
|
|
247
|
-
handler: async (
|
|
248
|
-
const
|
|
249
|
-
if (!
|
|
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
|
|
252
|
-
if (!
|
|
253
|
-
const { unitId
|
|
254
|
-
let
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
if (!
|
|
259
|
-
const
|
|
260
|
-
if (!
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
263
|
-
const
|
|
264
|
-
if (!
|
|
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
|
-
|
|
267
|
+
maxDecimals = Math.max(maxDecimals, length);
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
return;
|
|
270
271
|
}
|
|
271
|
-
const
|
|
272
|
-
|
|
272
|
+
const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
|
|
273
|
+
maxDecimals = decimals2 > maxDecimals ? decimals2 : maxDecimals;
|
|
273
274
|
});
|
|
274
275
|
});
|
|
275
|
-
const
|
|
276
|
-
return
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
280
|
-
|
|
281
|
-
row
|
|
282
|
-
col
|
|
283
|
-
pattern:
|
|
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
|
|
287
|
-
|
|
288
|
-
row
|
|
289
|
-
col
|
|
290
|
-
pattern
|
|
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
|
-
}),
|
|
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
|
-
|
|
300
|
-
|
|
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(
|
|
306
|
-
this._currencySymbol$.next(
|
|
305
|
+
setCurrencySymbolByCountryCode(symbol) {
|
|
306
|
+
this._currencySymbol$.next(symbol);
|
|
307
307
|
}
|
|
308
308
|
getCurrencySymbol() {
|
|
309
309
|
return this._currencySymbol$.getValue();
|
|
310
310
|
}
|
|
311
|
-
}
|
|
312
|
-
|
|
311
|
+
};
|
|
312
|
+
__name(_MenuCurrencyService, "MenuCurrencyService");
|
|
313
|
+
let MenuCurrencyService = _MenuCurrencyService;
|
|
314
|
+
const SetCurrencyCommand = {
|
|
313
315
|
id: "sheet.command.numfmt.set.currency",
|
|
314
|
-
type:
|
|
315
|
-
handler: async (
|
|
316
|
-
const
|
|
317
|
-
if (!
|
|
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
|
|
320
|
-
return
|
|
321
|
-
|
|
322
|
-
|
|
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
|
|
325
|
-
}
|
|
326
|
-
},
|
|
326
|
+
}), await commandService.executeCommand(SetNumfmtCommand.id, { values });
|
|
327
|
+
}, "handler")
|
|
328
|
+
}, SetPercentCommand = {
|
|
327
329
|
id: "sheet.command.numfmt.set.percent",
|
|
328
|
-
type:
|
|
329
|
-
handler: async (
|
|
330
|
-
const
|
|
331
|
-
if (!
|
|
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
|
|
334
|
-
return
|
|
335
|
-
|
|
336
|
-
|
|
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
|
|
339
|
-
}
|
|
340
|
-
},
|
|
340
|
+
}), await commandService.executeCommand(SetNumfmtCommand.id, { values });
|
|
341
|
+
}, "handler")
|
|
342
|
+
}, SubtractDecimalCommand = {
|
|
341
343
|
id: "sheet.command.numfmt.subtract.decimal.command",
|
|
342
|
-
type:
|
|
343
|
-
handler: async (
|
|
344
|
-
const
|
|
345
|
-
if (!
|
|
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
|
|
348
|
-
if (!
|
|
349
|
-
const { unitId
|
|
350
|
-
let
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const
|
|
354
|
-
if (!
|
|
355
|
-
const
|
|
356
|
-
if (!
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
359
|
-
const
|
|
360
|
-
if (!
|
|
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
|
-
|
|
364
|
+
maxDecimals = Math.max(maxDecimals, length);
|
|
363
365
|
}
|
|
364
366
|
}
|
|
365
367
|
return;
|
|
366
368
|
}
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
+
const decimals2 = getDecimalFromPattern(numfmtValue.pattern);
|
|
370
|
+
maxDecimals = decimals2 > maxDecimals ? decimals2 : maxDecimals;
|
|
369
371
|
});
|
|
370
372
|
});
|
|
371
|
-
const
|
|
372
|
-
return
|
|
373
|
-
|
|
374
|
-
const
|
|
375
|
-
if (!
|
|
376
|
-
|
|
377
|
-
row
|
|
378
|
-
col
|
|
379
|
-
pattern:
|
|
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
|
|
383
|
-
|
|
384
|
-
row
|
|
385
|
-
col
|
|
386
|
-
pattern:
|
|
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
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
const
|
|
394
|
-
return
|
|
395
|
-
result
|
|
396
|
-
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
|
|
400
|
+
result
|
|
399
401
|
};
|
|
400
|
-
},
|
|
401
|
-
result: String(
|
|
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
|
-
} :
|
|
404
|
-
var
|
|
405
|
-
for (var
|
|
406
|
-
(
|
|
407
|
-
return
|
|
408
|
-
}, $ = (
|
|
409
|
-
let
|
|
410
|
-
constructor(
|
|
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
|
-
|
|
413
|
-
|
|
414
|
-
this._instanceService =
|
|
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
|
|
418
|
-
if (
|
|
419
|
-
return
|
|
419
|
+
const _local = this._local$.getValue();
|
|
420
|
+
if (_local)
|
|
421
|
+
return _local;
|
|
420
422
|
switch (this._localeService.getCurrentLocale()) {
|
|
421
|
-
case
|
|
423
|
+
case LocaleType.FR_FR:
|
|
422
424
|
return "fr";
|
|
423
|
-
case
|
|
425
|
+
case LocaleType.RU_RU:
|
|
424
426
|
return "ru";
|
|
425
|
-
case
|
|
427
|
+
case LocaleType.VI_VN:
|
|
426
428
|
return "vi";
|
|
427
|
-
case
|
|
429
|
+
case LocaleType.ZH_CN:
|
|
428
430
|
return "zh-CN";
|
|
429
|
-
case
|
|
431
|
+
case LocaleType.ZH_TW:
|
|
430
432
|
return "zh-TW";
|
|
431
|
-
case
|
|
432
|
-
case
|
|
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
|
|
441
|
+
const TEXT_FORMAT_MARK = {
|
|
440
442
|
tl: {
|
|
441
443
|
size: 6,
|
|
442
444
|
color: "#409f11"
|
|
443
445
|
}
|
|
444
|
-
},
|
|
445
|
-
this.disposeWithMe(
|
|
446
|
-
|
|
447
|
-
})), this.disposeWithMe(this._sheetInterceptorService.intercept(
|
|
448
|
-
effect:
|
|
449
|
-
handler: (
|
|
450
|
-
const
|
|
451
|
-
let
|
|
452
|
-
const
|
|
453
|
-
if (!
|
|
454
|
-
return
|
|
455
|
-
if (
|
|
456
|
-
const
|
|
457
|
-
|
|
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 (
|
|
460
|
-
return
|
|
461
|
-
if (
|
|
462
|
-
return
|
|
463
|
-
...
|
|
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
|
-
...
|
|
466
|
-
...
|
|
467
|
+
...cell == null ? void 0 : cell.markers,
|
|
468
|
+
...TEXT_FORMAT_MARK
|
|
467
469
|
}
|
|
468
470
|
});
|
|
469
|
-
if (
|
|
470
|
-
return
|
|
471
|
-
let
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
474
|
-
return
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
return
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
480
|
-
const
|
|
481
|
-
|
|
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
|
|
484
|
-
result:
|
|
485
|
-
parameters: `${
|
|
486
|
-
}),
|
|
487
|
-
},
|
|
488
|
-
priority:
|
|
489
|
-
})), this.disposeWithMe(this._commandService.onCommandExecuted((
|
|
490
|
-
if (
|
|
491
|
-
const
|
|
492
|
-
Object.keys(
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
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 (
|
|
500
|
-
const
|
|
501
|
-
new
|
|
502
|
-
|
|
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$(
|
|
507
|
-
|
|
508
|
-
var
|
|
509
|
-
return (
|
|
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
|
-
|
|
512
|
-
).subscribe(() =>
|
|
513
|
+
skip(1)
|
|
514
|
+
).subscribe(() => renderCache.reset())
|
|
513
515
|
);
|
|
514
516
|
}
|
|
515
|
-
setNumfmtLocal(
|
|
516
|
-
this._local$.next(
|
|
517
|
+
setNumfmtLocal(local) {
|
|
518
|
+
this._local$.next(local);
|
|
517
519
|
}
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
$(0,
|
|
521
|
-
$(1,
|
|
522
|
-
$(2,
|
|
523
|
-
$(3,
|
|
524
|
-
$(4,
|
|
525
|
-
$(5,
|
|
526
|
-
],
|
|
527
|
-
class
|
|
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
|
-
|
|
531
|
-
|
|
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(
|
|
537
|
-
this._currencySymbol$.next(
|
|
538
|
+
setCurrencySymbolByCountryCode(symbol) {
|
|
539
|
+
this._currencySymbol$.next(symbol);
|
|
538
540
|
}
|
|
539
541
|
getCurrencySymbol() {
|
|
540
542
|
return this._currencySymbol$.getValue();
|
|
541
543
|
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
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
|
-
|
|
554
|
-
[
|
|
555
|
-
[
|
|
556
|
-
[
|
|
557
|
-
]),
|
|
558
|
-
[
|
|
557
|
+
registerDependencies(this._injector, [
|
|
558
|
+
[SheetsNumfmtCellContentController],
|
|
559
|
+
[MenuCurrencyService],
|
|
560
|
+
[NumfmtCurrencyController]
|
|
561
|
+
]), touchDependencies(this._injector, [
|
|
562
|
+
[SheetsNumfmtCellContentController]
|
|
559
563
|
]);
|
|
560
564
|
}
|
|
561
565
|
onRendered() {
|
|
562
|
-
|
|
563
|
-
[
|
|
566
|
+
touchDependencies(this._injector, [
|
|
567
|
+
[NumfmtCurrencyController]
|
|
564
568
|
]), [
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
].forEach((
|
|
571
|
-
this.disposeWithMe(this._commandService.registerCommand(
|
|
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
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
],
|
|
582
|
-
const
|
|
583
|
-
label:
|
|
584
|
-
value:
|
|
585
|
-
color:
|
|
586
|
-
})),
|
|
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
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
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.
|
|
3
|
+
"version": "0.5.5-nightly.202501210925",
|
|
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.
|
|
57
|
-
"@univerjs/engine-formula": "0.5.5-nightly.
|
|
58
|
-
"@univerjs/engine-numfmt": "0.5.5-nightly.
|
|
59
|
-
"@univerjs/sheets": "0.5.5-nightly.
|
|
56
|
+
"@univerjs/core": "0.5.5-nightly.202501210925",
|
|
57
|
+
"@univerjs/engine-formula": "0.5.5-nightly.202501210925",
|
|
58
|
+
"@univerjs/engine-numfmt": "0.5.5-nightly.202501210925",
|
|
59
|
+
"@univerjs/sheets": "0.5.5-nightly.202501210925"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"rxjs": "^7.8.1",
|