@rowsncolumns/spreadsheet-state 29.2.0 → 29.3.2

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.
Files changed (127) hide show
  1. package/dist/cjs/api/border.d.ts +1 -1
  2. package/dist/cjs/api/border.d.ts.map +1 -1
  3. package/dist/cjs/commands.d.ts +36 -3
  4. package/dist/cjs/commands.d.ts.map +1 -1
  5. package/dist/cjs/components/editors/cell-format/alignment-tab.d.ts +27 -0
  6. package/dist/cjs/components/editors/cell-format/alignment-tab.d.ts.map +1 -0
  7. package/dist/cjs/components/editors/cell-format/alignment-tab.js +83 -0
  8. package/dist/cjs/components/editors/cell-format/border-edges.d.ts +42 -0
  9. package/dist/cjs/components/editors/cell-format/border-edges.d.ts.map +1 -0
  10. package/dist/cjs/components/editors/cell-format/border-edges.js +118 -0
  11. package/dist/cjs/components/editors/cell-format/border-tab.d.ts +21 -0
  12. package/dist/cjs/components/editors/cell-format/border-tab.d.ts.map +1 -0
  13. package/dist/cjs/components/editors/cell-format/border-tab.js +123 -0
  14. package/dist/cjs/components/editors/cell-format/fill-tab.d.ts +14 -0
  15. package/dist/cjs/components/editors/cell-format/fill-tab.d.ts.map +1 -0
  16. package/dist/cjs/components/editors/cell-format/fill-tab.js +54 -0
  17. package/dist/cjs/components/editors/cell-format/font-tab.d.ts +18 -0
  18. package/dist/cjs/components/editors/cell-format/font-tab.d.ts.map +1 -0
  19. package/dist/cjs/components/editors/cell-format/font-tab.js +99 -0
  20. package/dist/cjs/components/editors/cell-format/list-box.d.ts +35 -0
  21. package/dist/cjs/components/editors/cell-format/list-box.d.ts.map +1 -0
  22. package/dist/cjs/components/editors/cell-format/list-box.js +37 -0
  23. package/dist/cjs/components/editors/cell-format/number-formats.d.ts +90 -0
  24. package/dist/cjs/components/editors/cell-format/number-formats.d.ts.map +1 -0
  25. package/dist/cjs/components/editors/cell-format/number-formats.js +403 -0
  26. package/dist/cjs/components/editors/cell-format/number-tab.d.ts +12 -0
  27. package/dist/cjs/components/editors/cell-format/number-tab.d.ts.map +1 -0
  28. package/dist/cjs/components/editors/cell-format/number-tab.js +194 -0
  29. package/dist/cjs/components/editors/cell-format/protection-tab.d.ts +13 -0
  30. package/dist/cjs/components/editors/cell-format/protection-tab.d.ts.map +1 -0
  31. package/dist/cjs/components/editors/cell-format/protection-tab.js +13 -0
  32. package/dist/cjs/components/editors/cell-format-editor.d.ts +31 -3
  33. package/dist/cjs/components/editors/cell-format-editor.d.ts.map +1 -1
  34. package/dist/cjs/components/editors/cell-format-editor.js +182 -636
  35. package/dist/cjs/components/editors/conditional-format-data-bar-options.d.ts +16 -0
  36. package/dist/cjs/components/editors/conditional-format-data-bar-options.d.ts.map +1 -0
  37. package/dist/cjs/components/editors/conditional-format-data-bar-options.js +166 -0
  38. package/dist/cjs/components/editors/conditional-format-editor.d.ts +7 -1
  39. package/dist/cjs/components/editors/conditional-format-editor.d.ts.map +1 -1
  40. package/dist/cjs/components/editors/conditional-format-editor.js +51 -9
  41. package/dist/cjs/components/editors/conditional-format-icon-set-options.d.ts +17 -0
  42. package/dist/cjs/components/editors/conditional-format-icon-set-options.d.ts.map +1 -0
  43. package/dist/cjs/components/editors/conditional-format-icon-set-options.js +163 -0
  44. package/dist/cjs/components/editors/conditional-format-rule-editor.d.ts +9 -0
  45. package/dist/cjs/components/editors/conditional-format-rule-editor.d.ts.map +1 -1
  46. package/dist/cjs/components/editors/conditional-format-rule-editor.js +97 -125
  47. package/dist/cjs/components/editors/sheet-filter.d.ts +20 -9
  48. package/dist/cjs/components/editors/sheet-filter.d.ts.map +1 -1
  49. package/dist/cjs/components/editors/sheet-filter.js +44 -12
  50. package/dist/cjs/hooks/use-conditional-formatting-rules.d.ts +2 -0
  51. package/dist/cjs/hooks/use-conditional-formatting-rules.d.ts.map +1 -1
  52. package/dist/cjs/hooks/use-conditional-formatting-rules.js +22 -1
  53. package/dist/cjs/hooks/use-spreadsheet-state.d.ts +2 -0
  54. package/dist/cjs/hooks/use-spreadsheet-state.d.ts.map +1 -1
  55. package/dist/cjs/hooks/use-spreadsheet-state.js +4 -2
  56. package/dist/cjs/interface/change-border.d.ts.map +1 -1
  57. package/dist/cjs/interface/change-border.js +8 -1
  58. package/dist/cjs/interface/conditional-formatting-rules.d.ts +11 -1
  59. package/dist/cjs/interface/conditional-formatting-rules.d.ts.map +1 -1
  60. package/dist/cjs/interface/conditional-formatting-rules.js +44 -1
  61. package/dist/cjs/sheet-cell.d.ts +8 -0
  62. package/dist/cjs/sheet-cell.d.ts.map +1 -1
  63. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  64. package/dist/esm/api/border.d.ts +1 -1
  65. package/dist/esm/api/border.d.ts.map +1 -1
  66. package/dist/esm/commands.d.ts +36 -3
  67. package/dist/esm/commands.d.ts.map +1 -1
  68. package/dist/esm/components/editors/cell-format/alignment-tab.d.ts +27 -0
  69. package/dist/esm/components/editors/cell-format/alignment-tab.d.ts.map +1 -0
  70. package/dist/esm/components/editors/cell-format/alignment-tab.js +81 -0
  71. package/dist/esm/components/editors/cell-format/border-edges.d.ts +42 -0
  72. package/dist/esm/components/editors/cell-format/border-edges.d.ts.map +1 -0
  73. package/dist/esm/components/editors/cell-format/border-edges.js +79 -0
  74. package/dist/esm/components/editors/cell-format/border-tab.d.ts +21 -0
  75. package/dist/esm/components/editors/cell-format/border-tab.d.ts.map +1 -0
  76. package/dist/esm/components/editors/cell-format/border-tab.js +103 -0
  77. package/dist/esm/components/editors/cell-format/fill-tab.d.ts +14 -0
  78. package/dist/esm/components/editors/cell-format/fill-tab.d.ts.map +1 -0
  79. package/dist/esm/components/editors/cell-format/fill-tab.js +49 -0
  80. package/dist/esm/components/editors/cell-format/font-tab.d.ts +18 -0
  81. package/dist/esm/components/editors/cell-format/font-tab.d.ts.map +1 -0
  82. package/dist/esm/components/editors/cell-format/font-tab.js +88 -0
  83. package/dist/esm/components/editors/cell-format/list-box.d.ts +35 -0
  84. package/dist/esm/components/editors/cell-format/list-box.d.ts.map +1 -0
  85. package/dist/esm/components/editors/cell-format/list-box.js +30 -0
  86. package/dist/esm/components/editors/cell-format/number-formats.d.ts +90 -0
  87. package/dist/esm/components/editors/cell-format/number-formats.d.ts.map +1 -0
  88. package/dist/esm/components/editors/cell-format/number-formats.js +383 -0
  89. package/dist/esm/components/editors/cell-format/number-tab.d.ts +12 -0
  90. package/dist/esm/components/editors/cell-format/number-tab.d.ts.map +1 -0
  91. package/dist/esm/components/editors/cell-format/number-tab.js +165 -0
  92. package/dist/esm/components/editors/cell-format/protection-tab.d.ts +13 -0
  93. package/dist/esm/components/editors/cell-format/protection-tab.d.ts.map +1 -0
  94. package/dist/esm/components/editors/cell-format/protection-tab.js +9 -0
  95. package/dist/esm/components/editors/cell-format-editor.d.ts +31 -3
  96. package/dist/esm/components/editors/cell-format-editor.d.ts.map +1 -1
  97. package/dist/esm/components/editors/cell-format-editor.js +148 -615
  98. package/dist/esm/components/editors/conditional-format-data-bar-options.d.ts +16 -0
  99. package/dist/esm/components/editors/conditional-format-data-bar-options.d.ts.map +1 -0
  100. package/dist/esm/components/editors/conditional-format-data-bar-options.js +145 -0
  101. package/dist/esm/components/editors/conditional-format-editor.d.ts +7 -1
  102. package/dist/esm/components/editors/conditional-format-editor.d.ts.map +1 -1
  103. package/dist/esm/components/editors/conditional-format-editor.js +39 -8
  104. package/dist/esm/components/editors/conditional-format-icon-set-options.d.ts +17 -0
  105. package/dist/esm/components/editors/conditional-format-icon-set-options.d.ts.map +1 -0
  106. package/dist/esm/components/editors/conditional-format-icon-set-options.js +139 -0
  107. package/dist/esm/components/editors/conditional-format-rule-editor.d.ts +9 -0
  108. package/dist/esm/components/editors/conditional-format-rule-editor.d.ts.map +1 -1
  109. package/dist/esm/components/editors/conditional-format-rule-editor.js +60 -85
  110. package/dist/esm/components/editors/sheet-filter.d.ts +20 -9
  111. package/dist/esm/components/editors/sheet-filter.d.ts.map +1 -1
  112. package/dist/esm/components/editors/sheet-filter.js +31 -11
  113. package/dist/esm/hooks/use-conditional-formatting-rules.d.ts +2 -0
  114. package/dist/esm/hooks/use-conditional-formatting-rules.d.ts.map +1 -1
  115. package/dist/esm/hooks/use-conditional-formatting-rules.js +19 -1
  116. package/dist/esm/hooks/use-spreadsheet-state.d.ts +2 -0
  117. package/dist/esm/hooks/use-spreadsheet-state.d.ts.map +1 -1
  118. package/dist/esm/hooks/use-spreadsheet-state.js +4 -2
  119. package/dist/esm/interface/change-border.d.ts.map +1 -1
  120. package/dist/esm/interface/change-border.js +8 -1
  121. package/dist/esm/interface/conditional-formatting-rules.d.ts +11 -1
  122. package/dist/esm/interface/conditional-formatting-rules.d.ts.map +1 -1
  123. package/dist/esm/interface/conditional-formatting-rules.js +29 -1
  124. package/dist/esm/sheet-cell.d.ts +8 -0
  125. package/dist/esm/sheet-cell.d.ts.map +1 -1
  126. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  127. package/package.json +6 -6
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ export type CellProtectionDraft = {
3
+ locked: boolean;
4
+ hidden: boolean;
5
+ };
6
+ /** Excel's note under the Protection tab's checkboxes. */
7
+ export declare const PROTECTION_NOTE = "Locking cells or hiding formulas has no effect until you protect the worksheet (Review tab, Protect group, Protect Sheet button).";
8
+ /** Format Cells → Protection: Locked (default on) and Hidden. */
9
+ export declare const ProtectionTab: ({ protection, onChange, }: {
10
+ protection: CellProtectionDraft;
11
+ onChange(protection: CellProtectionDraft): void;
12
+ }) => React.JSX.Element;
13
+ //# sourceMappingURL=protection-tab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protection-tab.d.ts","sourceRoot":"","sources":["../../../../../components/editors/cell-format/protection-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,mBAAmB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvE,0DAA0D;AAC1D,eAAO,MAAM,eAAe,sIACyG,CAAC;AAEtI,iEAAiE;AACjE,eAAO,MAAM,aAAa,GAAI,2BAG3B;IACD,UAAU,EAAE,mBAAmB,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACjD,sBAcA,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { CheckboxField } from "./list-box";
3
+ /** Excel's note under the Protection tab's checkboxes. */
4
+ export const PROTECTION_NOTE = "Locking cells or hiding formulas has no effect until you protect the worksheet (Review tab, Protect group, Protect Sheet button).";
5
+ /** Format Cells → Protection: Locked (default on) and Hidden. */
6
+ export const ProtectionTab = ({ protection, onChange, }) => (React.createElement("div", { className: "flex flex-col gap-2" },
7
+ React.createElement(CheckboxField, { label: "Locked", checked: protection.locked, onChange: (locked) => onChange({ ...protection, locked }) }),
8
+ React.createElement(CheckboxField, { label: "Hidden", checked: protection.hidden, onChange: (hidden) => onChange({ ...protection, hidden }) }),
9
+ React.createElement("p", { className: "font-system text-xs text-rnc-muted-foreground" }, PROTECTION_NOTE)));
@@ -1,8 +1,8 @@
1
1
  import type { CellInterface, SelectionArea } from "@rowsncolumns/common-types";
2
- import type { SelectionAttributes, SpreadsheetTheme } from "@rowsncolumns/spreadsheet";
3
- import type { CellFormat } from "@rowsncolumns/spreadsheet";
2
+ import type { CellFormat, SelectionAttributes, SpreadsheetTheme } from "@rowsncolumns/spreadsheet";
4
3
  import React from "react";
5
4
  import type { useSpreadsheetState } from "../../hooks/use-spreadsheet-state";
5
+ export type CellFormatTab = "number" | "alignment" | "font" | "border" | "fill" | "protection";
6
6
  type CellFormatEditorProps = {
7
7
  sheetId: number;
8
8
  activeCell: CellInterface;
@@ -16,9 +16,37 @@ type CellFormatEditorProps = {
16
16
  onChangeFormatting: ReturnType<typeof useSpreadsheetState>["onChangeFormatting"];
17
17
  getEffectiveValue: ReturnType<typeof useSpreadsheetState>["getEffectiveValue"];
18
18
  onMergeCells: ReturnType<typeof useSpreadsheetState>["onMergeCells"];
19
+ /** Alignment → Merge cells unchecked on a merged cell. */
20
+ onUnMergeCells?: ReturnType<typeof useSpreadsheetState>["onUnMergeCells"];
21
+ /** Whether the active cell is part of a merge (Merge cells opens checked). */
22
+ isMerged?: boolean;
23
+ /** The active cell's `CellData.protection` (Protection tab; absent = Locked, not Hidden). */
24
+ cellProtection?: {
25
+ locked?: boolean | null;
26
+ hidden?: boolean | null;
27
+ } | null;
28
+ /** Protection tab: write `locked` / `hidden` onto the selection. */
29
+ onChangeCellProtection?(sheetId: number, activeCell: CellInterface, selections: SelectionArea<SelectionAttributes>[], protection: {
30
+ locked?: boolean;
31
+ hidden?: boolean;
32
+ }): void;
33
+ /** The tab the dialog opens on (Excel reopens on the last one used). */
34
+ defaultTab?: CellFormatTab;
19
35
  onCancel?(): void;
20
36
  };
21
- export declare const CellFormatEditor: ({ locale, cellFormat, sheetId, activeCell, selections, currencySymbol, theme, isDarkMode, onMergeCells, onChangeFormatting, onChangeBorder, onCancel, getEffectiveValue, }: CellFormatEditorProps) => React.JSX.Element;
37
+ /**
38
+ * The properties the dialog changed, and only those — Excel's Format Cells
39
+ * applies what you edited to every selected cell and leaves the rest of each
40
+ * cell's format alone. A removed value is sent as `undefined` (the engines'
41
+ * clear for that property).
42
+ */
43
+ export declare const diffCellFormat: (initial: CellFormat, draft: CellFormat) => CellFormat;
44
+ /**
45
+ * Excel's Format Cells dialog (Ctrl+1 / ⌘1): Number, Alignment, Font,
46
+ * Border, Fill and Protection. Every tab edits a draft; OK applies the
47
+ * edits to the selection, Cancel drops them.
48
+ */
49
+ export declare const CellFormatEditor: ({ locale, cellFormat, sheetId, activeCell, selections, currencySymbol, theme, isDarkMode, onMergeCells, onUnMergeCells, isMerged, cellProtection, onChangeCellProtection, onChangeFormatting, onChangeBorder, onCancel, getEffectiveValue, defaultTab, }: CellFormatEditorProps) => React.JSX.Element;
22
50
  export declare const CellFormatEditorDialog: ({ children, }: {
23
51
  children: React.ReactNode;
24
52
  }) => React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"cell-format-editor.d.ts","sourceRoot":"","sources":["../../../../components/editors/cell-format-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO/E,OAAO,KAAK,EAOV,mBAAmB,EACnB,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA0C5D,OAAO,KAAyC,MAAM,OAAO,CAAC;AAa9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAAE,CAAC;IACjD,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,gBAAgB,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACzE,kBAAkB,EAAE,UAAU,CAC5B,OAAO,mBAAmB,CAC3B,CAAC,oBAAoB,CAAC,CAAC;IACxB,iBAAiB,EAAE,UAAU,CAC3B,OAAO,mBAAmB,CAC3B,CAAC,mBAAmB,CAAC,CAAC;IACvB,YAAY,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,cAAc,CAAC,CAAC;IACrE,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB,CAAC;AAyWF,eAAO,MAAM,gBAAgB,GAAI,4KAc9B,qBAAqB,sBAwlBvB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,eAE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