@particle-academy/fancy-sheets 0.4.3 → 0.4.4
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.cjs +17 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2202,7 +2202,18 @@ function DefaultToolbar() {
|
|
|
2202
2202
|
const isItalic = cell?.format?.italic ?? false;
|
|
2203
2203
|
const textAlign = cell?.format?.textAlign ?? "left";
|
|
2204
2204
|
const displayFormat = cell?.format?.displayFormat ?? "auto";
|
|
2205
|
-
const
|
|
2205
|
+
const explicitDecimals = cell?.format?.decimals;
|
|
2206
|
+
const cellValue = cell?.computedValue ?? cell?.value;
|
|
2207
|
+
const inferredDecimals = (() => {
|
|
2208
|
+
if (explicitDecimals !== void 0) return explicitDecimals;
|
|
2209
|
+
if (typeof cellValue === "number") {
|
|
2210
|
+
const str = String(cellValue);
|
|
2211
|
+
const dotIdx = str.indexOf(".");
|
|
2212
|
+
return dotIdx === -1 ? 0 : str.length - dotIdx - 1;
|
|
2213
|
+
}
|
|
2214
|
+
return 0;
|
|
2215
|
+
})();
|
|
2216
|
+
const currentDecimals = explicitDecimals ?? inferredDecimals;
|
|
2206
2217
|
const selectedAddresses = [selection.activeCell];
|
|
2207
2218
|
const handleFormulaBarChange = (e) => {
|
|
2208
2219
|
if (editingCell) {
|
|
@@ -2339,9 +2350,9 @@ function DefaultToolbar() {
|
|
|
2339
2350
|
"button",
|
|
2340
2351
|
{
|
|
2341
2352
|
className: btnClass,
|
|
2342
|
-
onClick: () => setCellFormat(selectedAddresses, { decimals: Math.max(0,
|
|
2343
|
-
disabled: readOnly ||
|
|
2344
|
-
title:
|
|
2353
|
+
onClick: () => setCellFormat(selectedAddresses, { decimals: Math.max(0, currentDecimals - 1) }),
|
|
2354
|
+
disabled: readOnly || currentDecimals <= 0,
|
|
2355
|
+
title: `Decrease decimal places (currently ${currentDecimals})`,
|
|
2345
2356
|
children: [
|
|
2346
2357
|
/* @__PURE__ */ jsx("span", { className: "text-[10px]", children: ".0" }),
|
|
2347
2358
|
/* @__PURE__ */ jsx("span", { className: "text-[8px]", children: "\u2190" })
|
|
@@ -2352,9 +2363,9 @@ function DefaultToolbar() {
|
|
|
2352
2363
|
"button",
|
|
2353
2364
|
{
|
|
2354
2365
|
className: btnClass,
|
|
2355
|
-
onClick: () => setCellFormat(selectedAddresses, { decimals:
|
|
2366
|
+
onClick: () => setCellFormat(selectedAddresses, { decimals: currentDecimals + 1 }),
|
|
2356
2367
|
disabled: readOnly,
|
|
2357
|
-
title:
|
|
2368
|
+
title: `Increase decimal places (currently ${currentDecimals})`,
|
|
2358
2369
|
children: [
|
|
2359
2370
|
/* @__PURE__ */ jsx("span", { className: "text-[10px]", children: ".00" }),
|
|
2360
2371
|
/* @__PURE__ */ jsx("span", { className: "text-[8px]", children: "\u2192" })
|