jspreadsheet 11.12.1 → 11.13.1

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.d.ts CHANGED
@@ -54,7 +54,7 @@ declare namespace jspreadsheet {
54
54
  function destroyAll() : void;
55
55
 
56
56
  /** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */
57
- let parser: ((options: any) => void) | undefined;
57
+ let parser: ((options?: parseOptions) => void) | undefined;
58
58
 
59
59
  /** Jspreadsheet formula extension. More info at: https://jspreadsheet.com/products */
60
60
  let formula: ((expression: string, variables: object, x: number, y: number, instance: worksheetInstance) => void) | undefined;
@@ -243,12 +243,7 @@ declare namespace jspreadsheet {
243
243
  /** Ignore blank cells */
244
244
  allowBlank?: boolean;
245
245
  /** For type: format you can apply some CSS when condition is matched */
246
- format?: {
247
- color: string;
248
- 'background-color': string;
249
- 'font-weight': number;
250
- 'font-style': string;
251
- }
246
+ format?: Record<string, string>;
252
247
  /** For type: format you can add a class when condition is matched */
253
248
  className?: string;
254
249
  /** Array with two positions, the second position used when criteria is between or not between. */
@@ -550,6 +545,18 @@ declare namespace jspreadsheet {
550
545
  value?: string;
551
546
  }
552
547
 
548
+ /**
549
+ * Cell value
550
+ */
551
+ interface Record {
552
+ /** Cached value of the cell */
553
+ value: string | number | boolean | undefined;
554
+ /** Coordinate X */
555
+ x: number;
556
+ /** Coordinate Y */
557
+ y: number;
558
+ }
559
+
553
560
  /**
554
561
  * Cell object
555
562
  */
@@ -657,6 +664,8 @@ declare namespace jspreadsheet {
657
664
  group?: number;
658
665
  /** State of the column group. */
659
666
  state?: boolean;
667
+ /** Style index */
668
+ s?: number;
660
669
  }
661
670
 
662
671
  interface Cell extends ColumnPrimitiveProperties { }
@@ -709,6 +718,8 @@ declare namespace jspreadsheet {
709
718
  state?: boolean;
710
719
  /** Determines whether the row is read-only or not. */
711
720
  readOnly?: boolean;
721
+ /** Style index */
722
+ s?: number;
712
723
  }
713
724
 
714
725
  interface RowInstance extends Row {
@@ -957,6 +968,8 @@ declare namespace jspreadsheet {
957
968
  onbeforesend?: (worksheet: worksheetInstance, xhr: object) => void
958
969
  /** When defined names is affected */
959
970
  onchangedefinednames?: (worksheet: worksheetInstance, data: Record<string, any>[]) => void
971
+ /** Keyboard event */
972
+ onkeydown?: (worksheet: object, event: object) => void
960
973
  /** New char is entered on editor. */
961
974
  oninput?: (worksheet: object, event: object, text: string) => void
962
975
  /** When change the row visibility */
@@ -1580,9 +1593,10 @@ declare namespace jspreadsheet {
1580
1593
  setHeader: (x: number, title?: string) => false | undefined;
1581
1594
  /** Set the height of one row by its position. currentHeight is for internal use only */
1582
1595
  setHeight: (row: number|number[], height: number|number[], currentHeight?: number|number[]) => void;
1583
- /** Get the merged cells. Cell name: A1, A2, etc */
1596
+ /** Create a merge cells based on a given cell, colspan and rowspan or an object multiple entries A1: [1,1], or null for the current selected cells */
1584
1597
  setMerge(cellName: Record<string, [number, number]>): false | undefined;
1585
1598
  setMerge(cellName: string, colspan: number, rowspan: number): false | undefined;
1599
+ setMerge(): false | undefined;
1586
1600
  /** Get one or various meta information for one cell. */
1587
1601
  setMeta: (cell: string | Record<string, any>, property?: string, value?: string) => false | undefined;
1588
1602
  /** Set the nested headers */
@@ -1792,6 +1806,10 @@ declare namespace jspreadsheet {
1792
1806
  getZoom: () => number;
1793
1807
  /** Get the coordinates as a number from a range string. Adjust helps to define the height dynamically when you have A:A ranges for example. Works in the same way for 1:1 ranges. Default: true */
1794
1808
  getCoordsFromRange: (range: string, adjust?: boolean) => [number | null, number | null, number | null, number | null];
1809
+ /** Edition handler */
1810
+ edition: HTMLElement;
1811
+ /** Get the cell object by its coords */
1812
+ getCellObject: (x: number, y: number) => Records;
1795
1813
  }
1796
1814
 
1797
1815
  interface International {
@@ -1800,6 +1818,23 @@ declare namespace jspreadsheet {
1800
1818
  /** General number format */
1801
1819
  NumberFormat?: Intl.NumberFormat;
1802
1820
  }
1821
+
1822
+ interface parseOptions {
1823
+ /** Load the XLSX from a remote URL. Bear in mind any potential CORS restrictions using this property. */
1824
+ url?: string;
1825
+ /** Define the decimal and a thousand separator based on a locale. */
1826
+ locale?: string;
1827
+ /** Try to import embed cell style as HTML */
1828
+ parseHTML?: boolean;
1829
+ /** Enable or disable the loading spin. Default: true */
1830
+ loadingSpin?: boolean;
1831
+ /** load from a local file. This property is used along input type='file' */
1832
+ file?: object;
1833
+ /** When the file is loaded. */
1834
+ onload?: (config: jspreadsheet.Spreadsheet) => void;
1835
+ /** Method to be called when something is wrong. */
1836
+ onerror?: (error: object) => void;
1837
+ }
1803
1838
  }
1804
1839
 
1805
1840
  export default jspreadsheet;