gridjs-spreadsheet 26.4.5 → 26.5.0

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/example/pom.xml CHANGED
@@ -17,7 +17,7 @@
17
17
  </repositories>
18
18
  <groupId>com.aspose.gridjs</groupId>
19
19
  <artifactId>gridjsdemo</artifactId>
20
- <version>26.4</version>
20
+ <version>26.5</version>
21
21
  <name>gridjsdemo</name>
22
22
  <description>GridJs Demo project for Spring Boot</description>
23
23
  <properties>
@@ -51,12 +51,12 @@
51
51
  <dependency>
52
52
  <groupId>com.aspose</groupId>
53
53
  <artifactId>aspose-cells</artifactId>
54
- <version>26.4</version>
54
+ <version>26.5</version>
55
55
  </dependency>
56
56
  <dependency>
57
57
  <groupId>com.aspose</groupId>
58
58
  <artifactId>aspose-cells</artifactId>
59
- <version>26.4</version>
59
+ <version>26.5</version>
60
60
  <classifier>gridjs</classifier>
61
61
  </dependency>
62
62
  <!-- <dependency>
package/index.d.ts CHANGED
@@ -41,6 +41,11 @@ declare module 'gridjs-spreadsheet' {
41
41
  redactionReasons?: string[];
42
42
  /** Default redaction color */
43
43
  redactionDefaultColor?: string;
44
+ /**
45
+ * Custom toolbar buttons injected before the "more" dropdown.
46
+ * Each item defines a tag, tooltip, icon, and onClick handler.
47
+ */
48
+ customToolbarButtons?: CustomToolbarButtonConfig[];
44
49
  /**
45
50
  * Custom callback for adding new redaction reason.
46
51
  * If provided, replaces the default modal dialog.
@@ -72,6 +77,7 @@ declare module 'gridjs-spreadsheet' {
72
77
  export type REDACTION_REASON_INSERTED = 'redactionReason-inserted';
73
78
  export type REDACTION_REASON_CLEARED = 'redactionReason-cleared';
74
79
  export type REDACTION_TRANSPARENCY_TOGGLED = 'redactionTransparency-toggled';
80
+ export type CUSTOM_BUTTON = 'custom-button';
75
81
  export type UPDATE_SERVER_ERROR = 'updateServerError';
76
82
  export type UPDATE_CELL_ERROR = 'updateCellError';
77
83
 
@@ -84,6 +90,64 @@ declare module 'gridjs-spreadsheet' {
84
90
  eci: number;
85
91
  }
86
92
 
93
+ /** Icon descriptor for a custom toolbar button (choose one form) */
94
+ export interface CustomToolbarButtonIcon {
95
+ /** Image URL used as background-image */
96
+ url?: string;
97
+ /** CSS class applied to the inner icon element (user supplies CSS) */
98
+ className?: string;
99
+ /** Raw HTML fragment, e.g. inline <svg>...</svg> */
100
+ html?: string;
101
+ /** Plain text / emoji, e.g. '��' */
102
+ text?: string;
103
+ /** Width in px when using `url` (default: 16) */
104
+ width?: number;
105
+ /** Height in px when using `url` (default: 16) */
106
+ height?: number;
107
+ }
108
+
109
+ /** Runtime instance of a custom toolbar button (passed to onClick and `custom-button` event) */
110
+ export interface CustomToolbarButton {
111
+ /** Unique tag identifier */
112
+ tag: string;
113
+ /** Tooltip text */
114
+ tip: string;
115
+ /** Reference to the owning Spreadsheet instance (injected by Toolbar) */
116
+ spreadsheet: Spreadsheet;
117
+ /** Original config passed in via Options.customToolbarButtons */
118
+ config: CustomToolbarButtonConfig;
119
+ /** Update the icon at runtime */
120
+ setIcon(iconConfig: CustomToolbarButtonIcon): void;
121
+ /** Update the tooltip text at runtime */
122
+ setTooltip(text: string): void;
123
+ /** Toggle active (highlighted) state */
124
+ setActive(active: boolean): void;
125
+ /** Toggle disabled state (click events suppressed) */
126
+ setDisabled(disabled: boolean): void;
127
+ /** Show the button */
128
+ show(): void;
129
+ /** Hide the button */
130
+ hide(): void;
131
+ }
132
+
133
+ /** Configuration for a single custom toolbar button */
134
+ export interface CustomToolbarButtonConfig {
135
+ /** Unique identifier; forwarded as the second argument of the `custom-button` change event */
136
+ tag: string;
137
+ /** Tooltip shown on hover */
138
+ tooltip?: string;
139
+ /** Icon descriptor (url / className / html / text) */
140
+ icon?: CustomToolbarButtonIcon;
141
+ /** Click handler; `button` is the CustomToolbarButton instance, `spreadsheet` is the Spreadsheet instance */
142
+ onClick?: (button: CustomToolbarButton, spreadsheet: Spreadsheet) => void;
143
+ /** Initial active state */
144
+ active?: boolean;
145
+ /** Initial disabled state */
146
+ disabled?: boolean;
147
+ /** Optional fixed button width in px */
148
+ width?: number;
149
+ }
150
+
87
151
  export interface RedactionData {
88
152
  id: string;
89
153
  originId?: string;
@@ -189,6 +253,10 @@ declare module 'gridjs-spreadsheet' {
189
253
  envt: REDACTION_TRANSPARENCY_TOGGLED,
190
254
  callback: (isTransparent: boolean) => void
191
255
  ): void;
256
+ (
257
+ envt: CUSTOM_BUTTON,
258
+ callback: (tag: string, button: CustomToolbarButton) => void
259
+ ): void;
192
260
  (
193
261
  envt: UPDATE_SERVER_ERROR,
194
262
  callback: (...args: any[]) => void
@@ -270,6 +338,8 @@ declare module 'gridjs-spreadsheet' {
270
338
 
271
339
  export default class Spreadsheet {
272
340
  constructor(container: string | HTMLElement, opts?: Options);
341
+ /** Build version string (injected at compile time) */
342
+ readonly version: string;
273
343
  on: SpreadsheetEventHandler;
274
344
  /**
275
345
  * retrieve cell
@@ -307,6 +377,50 @@ declare module 'gridjs-spreadsheet' {
307
377
  */
308
378
  deleteSheet(): void;
309
379
 
380
+ /**
381
+ * insert a redaction shape on a target shape/image
382
+ * @param reason redaction reason text
383
+ * @param color background color
384
+ * @param targetId target shape/image id
385
+ * @param sheetName sheet name, defaults to active sheet
386
+ */
387
+ insertRedactionForShape(reason: string, color: string, targetId: string, sheetName?: string): Promise<void>;
388
+
389
+ /**
390
+ * insert a redaction on a cell range
391
+ * @param reason redaction reason text
392
+ * @param color background color
393
+ * @param range cell range {sri, sci, eri, eci}
394
+ * @param sheetName sheet name, defaults to active sheet
395
+ */
396
+ insertRedactionForRange(reason: string, color: string, range: CellRange, sheetName?: string): Promise<void>;
397
+
398
+ /**
399
+ * remove a redaction by id
400
+ * @param id redaction id
401
+ * @param sheetName sheet name, defaults to active sheet
402
+ */
403
+ removeRedaction(id: string, sheetName?: string): Promise<void>;
404
+
405
+ /**
406
+ * sync redaction operations from history records
407
+ * @param historyOprArray array of operation history records
408
+ * @param isSyncToServer whether to sync to server
409
+ */
410
+ syncRedactionOprClient(historyOprArray: any[], isSyncToServer?: boolean): Promise<void>;
411
+
412
+ /**
413
+ * burn all redactions permanently
414
+ */
415
+ burnAllRedactions(): void;
416
+
417
+ /**
418
+ * clear all redaction shapes on a sheet or sheets array
419
+ * @param sheetNameOrArray sheet name, array of sheet names, or null for active sheet
420
+ * @param isSyncToServer whether to sync to server
421
+ */
422
+ clearRedactionClient(sheetNameOrArray?: string | string[] | null, isSyncToServer?: boolean): Promise<void>;
423
+
310
424
  /**
311
425
  * load data
312
426
  * @param json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridjs-spreadsheet",
3
- "version": "26.4.5",
3
+ "version": "26.5.0",
4
4
  "description": "this is the client side script for GridJs which is a lightweight, scalable, and customizable toolkit that provides cross-platform web applications, enables convenient development for editing or viewing Excel/Spreadsheet files, offers simple deployment, and provides easy-to-use APIs based on JSON format.",
5
5
  "types": "index.d.ts",
6
6
  "main": "xspreadsheet.js",
package/readme.md CHANGED
@@ -399,6 +399,10 @@ v26.4.3:
399
399
 
400
400
  - Add boundary check for redaction
401
401
 
402
+ v26.5:
403
+
404
+ - Support add custom buttons in toolbar
405
+
402
406
  ## License
403
407
 
404
408
  MIT
package/xspreadsheet.css CHANGED
@@ -919,6 +919,21 @@ body {
919
919
  .x-spreadsheet-toolbar .x-spreadsheet-toolbar-more {
920
920
  padding: 0 6px 6px;
921
921
  text-align: left;
922
+ display: flex;
923
+ flex-wrap: wrap;
924
+ align-items: center;
925
+ gap: 2px;
926
+ }
927
+ .x-spreadsheet-toolbar .x-spreadsheet-toolbar-more .x-spreadsheet-toolbar-btn {
928
+ display: inline-flex !important;
929
+ align-items: center;
930
+ }
931
+ .x-spreadsheet-toolbar .x-spreadsheet-toolbar-more .x-spreadsheet-dropdown {
932
+ width: auto !important;
933
+ max-width: 180px;
934
+ }
935
+ .x-spreadsheet-toolbar .x-spreadsheet-toolbar-more .x-spreadsheet-dropdown .x-spreadsheet-dropdown-title {
936
+ max-width: 150px !important;
922
937
  }
923
938
  .x-spreadsheet-toolbar .x-spreadsheet-toolbar-more .x-spreadsheet-toolbar-divider {
924
939
  margin-top: 0;