@progress/kendo-spreadsheet-common 1.0.0-develop.2 → 1.0.0-develop.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-esm.js CHANGED
@@ -956,8 +956,9 @@ const options = {
956
956
  headerHeight: 20,
957
957
  headerWidth: 32,
958
958
  excel: {
959
+ fileName: "Workbook.xlsx",
960
+ forceProxy: false,
959
961
  proxyURL: "",
960
- fileName: "Workbook.xlsx"
961
962
  },
962
963
  messages: {},
963
964
  pdf: {
@@ -27738,10 +27739,6 @@ class Spreadsheet extends Widget {
27738
27739
  this.events = events;
27739
27740
  this.bind(this.events, this.options);
27740
27741
 
27741
- this.element.classList.add('k-widget');
27742
- this.element.classList.add('k-spreadsheet');
27743
- this.element.setAttribute("role", "application");
27744
-
27745
27742
  locale(this.options.locale);
27746
27743
 
27747
27744
  this._view = new View(this.element, {
@@ -27753,11 +27750,6 @@ class Spreadsheet extends Widget {
27753
27750
  nameBoxRef: this.options.nameBoxRef
27754
27751
  });
27755
27752
 
27756
- // element.querySelector('.k-spreadsheet-cell-context-menu').style.display = 'none';
27757
- // element.querySelector('.k-spreadsheet-row-header-context-menu').style.display = 'none';
27758
- // element.querySelector('.k-spreadsheet-col-header-context-menu').style.display = 'none';
27759
- // element.querySelector('.k-spreadsheet-drawing-context-menu').style.display = 'none';
27760
-
27761
27753
  this._workbook = new Workbook(this.options, this._view);
27762
27754
 
27763
27755
  this._controller = new Controller(this._view, this._workbook);
@@ -27990,8 +27982,8 @@ class Spreadsheet extends Widget {
27990
27982
  return this._workbook.saveJSON();
27991
27983
  }
27992
27984
 
27993
- fromFile(blob, name) {
27994
- return this._workbook.fromFile(blob, name);
27985
+ fromFile(blob) {
27986
+ return this._workbook.fromFile(blob);
27995
27987
  }
27996
27988
 
27997
27989
  saveAsPDF(options) {
package/dist/index.js CHANGED
@@ -956,8 +956,9 @@
956
956
  headerHeight: 20,
957
957
  headerWidth: 32,
958
958
  excel: {
959
+ fileName: "Workbook.xlsx",
960
+ forceProxy: false,
959
961
  proxyURL: "",
960
- fileName: "Workbook.xlsx"
961
962
  },
962
963
  messages: {},
963
964
  pdf: {
@@ -27738,10 +27739,6 @@
27738
27739
  this.events = events;
27739
27740
  this.bind(this.events, this.options);
27740
27741
 
27741
- this.element.classList.add('k-widget');
27742
- this.element.classList.add('k-spreadsheet');
27743
- this.element.setAttribute("role", "application");
27744
-
27745
27742
  locale(this.options.locale);
27746
27743
 
27747
27744
  this._view = new View(this.element, {
@@ -27753,11 +27750,6 @@
27753
27750
  nameBoxRef: this.options.nameBoxRef
27754
27751
  });
27755
27752
 
27756
- // element.querySelector('.k-spreadsheet-cell-context-menu').style.display = 'none';
27757
- // element.querySelector('.k-spreadsheet-row-header-context-menu').style.display = 'none';
27758
- // element.querySelector('.k-spreadsheet-col-header-context-menu').style.display = 'none';
27759
- // element.querySelector('.k-spreadsheet-drawing-context-menu').style.display = 'none';
27760
-
27761
27753
  this._workbook = new Workbook(this.options, this._view);
27762
27754
 
27763
27755
  this._controller = new Controller(this._view, this._workbook);
@@ -27990,8 +27982,8 @@
27990
27982
  return this._workbook.saveJSON();
27991
27983
  }
27992
27984
 
27993
- fromFile(blob, name) {
27994
- return this._workbook.fromFile(blob, name);
27985
+ fromFile(blob) {
27986
+ return this._workbook.fromFile(blob);
27995
27987
  }
27996
27988
 
27997
27989
  saveAsPDF(options) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@progress/kendo-spreadsheet-common",
3
3
  "description": "Kendo UI platform-independent Spreadsheet library",
4
- "version": "1.0.0-develop.2",
4
+ "version": "1.0.0-develop.4",
5
5
  "keywords": [
6
6
  "Kendo UI"
7
7
  ],
package/src/index.d.ts CHANGED
@@ -1,20 +1,431 @@
1
- /**
2
- * @hidden
3
- */
4
- export class Spreadsheet {
1
+
2
+ /* eslint-disable max-len */
3
+ export interface CellDefaultStyle {
4
+ /**
5
+ * The background [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the cell.
6
+ */
7
+ background?: string;
8
+
9
+ /**
10
+ * The text [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) of the cell.
11
+ */
12
+ color?: string;
13
+
14
+ /**
15
+ * The font family of the cell.
16
+ */
17
+ fontFamily?: string;
18
+
19
+ /**
20
+ * The font size of the cell in pixels.
21
+ */
22
+ fontSize?: number;
23
+
24
+ /**
25
+ * If set to `true`, sets the cell font to bold.
26
+ */
27
+ bold?: boolean;
28
+
29
+ /**
30
+ * If set to `true`, sets the cell font to italic.
31
+ */
32
+ italic?: boolean;
33
+
34
+ /**
35
+ * If set to `true`, sets the cell font to underline.
36
+ */
37
+ underline?: boolean;
38
+
39
+ /**
40
+ * If set to `true`, sets the cell wrap.
41
+ */
42
+ wrap?: boolean;
43
+ }
44
+
45
+ export interface ExcelExportSettings {
46
+ /**
47
+ * Specifies the file name of the exported Excel file.
48
+ *
49
+ * @default 'Spreadsheet.xslx'
50
+ */
51
+ fileName?: string;
52
+
53
+ /**
54
+ * If set to `true`, the content will be forwarded to proxyURL even if the browser supports the saving of files locally.
55
+ *
56
+ * @default false
57
+ */
58
+ forceProxy?: boolean;
59
+
60
+ /**
61
+ * The URL of the server side proxy which will stream the file to the end user. A proxy will be used when the browser is not capable of saving files locally. Such browsers are IE version 9 and lower and Safari. The developer is responsible for implementing the server-side proxy. The proxy will return the decoded file with the `Content-Disposition` header set to `attachment; filename="<fileName.xslx>"`.
62
+ * The proxy will receive a POST request with the following parameters in the request body:
63
+ * - contentType - The MIME type of the file.
64
+ * - base64 - The base-64 encoded file content.
65
+ * - fileName - The file name as requested by the caller.
66
+ *
67
+ * @default null
68
+ */
69
+ proxyURL?: string | null;
70
+ }
71
+
72
+ export interface SheetColumn {
73
+ /**
74
+ * The zero-based index of the column. Required to ensure correct positioning.
75
+ */
76
+ index?: number;
77
+
78
+ /**
79
+ * The width of the column in pixels. Defaults to columnWidth.
80
+ */
81
+ width?: number;
82
+ }
83
+
84
+ export interface CellBorder {
85
+ /**
86
+ * The border color of the cell. Many standard CSS formats are supported. However, the canonical form is #ccff00.
87
+ */
88
+ color?: string;
89
+ /**
90
+ * The width of the border in pixels.
91
+ */
92
+ size?: number;
93
+ }
94
+
95
+ export interface Cell extends CellDefaultStyle {
96
+ /**
97
+ * The style information for the bottom border of the cell.
98
+ */
99
+ borderBottom?: CellBorder;
100
+
101
+ /**
102
+ * The style information for the left border of the cell.
103
+ */
104
+ borderLeft?: CellBorder;
105
+
106
+ /**
107
+ * The style information for the right border of the cell.
108
+ */
109
+ borderRight?: CellBorder;
110
+
111
+ /**
112
+ * The style information for the top border of the cell.
113
+ */
114
+ borderTop?: CellBorder;
115
+
116
+ /**
117
+ * If set to `false`, disables the cell.
118
+ */
119
+ enable?: boolean;
120
+
121
+ /**
122
+ * The format of the cell text. For more information, refer to the article on
123
+ * [creating or deleting a custom number format on MS Office](https://support.office.com/en-au/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4).
124
+ */
125
+ format?: string;
126
+
127
+ /**
128
+ * The cell formula without the leading equals sign, for example, `A1 * 10`.
129
+ */
130
+ formula?: string;
131
+
132
+ /**
133
+ * If set to `true`, renders the cell value as HTML.
134
+ * It is important to sanitize the value of the cell on the server for passing safe html because there is no client-side sanitizing.
135
+ * When editing a cell the new value can be checked and prevented in the client `changing` event.
136
+ */
137
+ html?: boolean;
138
+
139
+ /**
140
+ * The zero-based index of the cell. Required to ensure correct positioning.
141
+ */
142
+ index?: number;
143
+
144
+ /**
145
+ * The hyperlink (URL) of the cell.
146
+ */
147
+ link?: string;
148
+
149
+ /**
150
+ * The text-align setting for the cell content.
151
+ *
152
+ * The available options are: `left`, `center`, `right` or `justify`.
153
+ */
154
+ textAlign?: string;
155
+
156
+ /**
157
+ * The cell value.
158
+ */
159
+ value?: number | string | boolean | Date;
160
+
161
+ /**
162
+ * The vertical align setting for the cell content.
163
+ *
164
+ * The available options are: `top`, `center` or `bottom`.
165
+ */
166
+ verticalAlign?: string;
167
+ }
168
+
169
+ export interface SheetRow {
170
+ cells?: Cell[];
171
+
172
+ /**
173
+ * The row height in pixels. Defaults to rowHeight.
174
+ */
175
+ height?: number;
176
+
177
+ /**
178
+ * The absolute row index. Required to ensure correct positioning.
179
+ */
180
+ index?: number;
181
+
182
+ /**
183
+ * The table row element role in the context of the Grid table structure.
184
+ */
185
+ type?: string;
186
+ }
187
+
188
+ export interface SheetDescriptor {
189
+ /**
190
+ * The active cell in the sheet, for example, `A1`.
191
+ */
192
+ activeCell?: string;
193
+
194
+ /**
195
+ * The name of the sheet.
196
+ */
197
+ name?: string;
198
+
199
+ /**
200
+ * An array which defines the columns in this sheet and their content.
201
+ */
202
+ columns?: SheetColumn[];
203
+
204
+ /**
205
+ * The number of frozen columns in this sheet.
206
+ */
207
+ frozenColumns?: number;
208
+
209
+ /**
210
+ * The number of frozen rows in this sheet.
211
+ */
212
+ frozenRows?: number;
213
+
214
+ /**
215
+ * An array of merged cell ranges, for example, `B1:D2`.
216
+ */
217
+ mergedCells?: string[];
218
+
219
+ /**
220
+ * The row data for this sheet.
221
+ */
222
+ rows?: SheetRow[];
223
+
224
+ /**
225
+ * The selected range in the sheet, for example, `A1:B10`.
226
+ */
227
+ selection?: string;
228
+
229
+ /**
230
+ * A Boolean value which indicates if the grid lines of the sheet will be displayed.
231
+ *
232
+ * @default true
233
+ */
234
+ showGridLines?: boolean;
235
+
236
+ hyperlinks?: { ref: string; target: string; }[];
237
+
238
+ defaultCellStyle?: CellDefaultStyle;
239
+
240
+ drawings?: { topLeftCell: any; offsetX: number; offsetY: number; width: number; height: number; image: string; opacity: any; }[];
241
+ }
242
+
243
+ export interface DocumentDescriptor {
244
+ /**
245
+ * The name of the currently active sheet. Must exactly match one of the sheet names.
246
+ */
247
+ activeSheet?: string;
248
+
249
+ /**
250
+ * An array which defines the document sheets and their content.
251
+ */
252
+ sheets?: SheetDescriptor[];
253
+ names?: { value: string; name: string; sheet: string; localName: string; }[];
254
+ images?: { [name: string]: string };
255
+
256
+ /**
257
+ * The default column width in pixels.
258
+ *
259
+ * @default 64
260
+ */
261
+ columnWidth?: number;
262
+
263
+ /**
264
+ * The number of columns in the document.
265
+ *
266
+ * @default 50
267
+ */
268
+ columns?: number;
269
+
270
+ /**
271
+ * The default cell styles that will be applied to the sheet cells.
272
+ */
273
+ defaultCellStyle?: CellDefaultStyle;
274
+
275
+ /**
276
+ * The height of the header row in pixels.
277
+ *
278
+ * @default 20
279
+ */
280
+ headerHeight?: number;
281
+
282
+ /**
283
+ * The width of the header column in pixels.
284
+ *
285
+ * @default 32
286
+ */
287
+ headerWidth?: number;
288
+
289
+ /**
290
+ * The default row height in pixels.
291
+ *
292
+ * @default 20
293
+ */
294
+ rowHeight?: number;
295
+
296
+ /**
297
+ * The number of rows in the document.
298
+ *
299
+ * @default 200
300
+ */
301
+ rows?: number;
302
+ }
303
+
304
+ export class View {
5
305
  constructor(element: HTMLElement, options: any);
6
- get view(): any;
7
- get workbook(): any;
306
+ enableClipboard(enable: boolean): void;
307
+ workbook(workbook?: Workbook): void | Workbook;
308
+ sheet(sheet: Sheet): void;
309
+ refresh(reason: any): void;
310
+ nameEditor: any;
311
+ bind(eventName: string, handler: any, one?: boolean): void;
312
+ }
313
+
314
+ export class Workbook {
315
+ constructor(options: any, view: View);
316
+ execute(options: any): any;
317
+ refresh(reason: any): void;
318
+ undoRedoStack: any;
319
+ }
320
+
321
+ export class Range {
322
+ background(value?: string): string;
323
+ bold(value?: boolean): boolean;
324
+ borderBottom(value?: CellBorder): CellBorder;
325
+ borderLeft(value?: CellBorder): CellBorder;
326
+ borderRight(value?: CellBorder): CellBorder;
327
+ borderTop(value?: CellBorder): CellBorder;
328
+ color(value?: string): string;
329
+ clear(value?: { contentsOnly?: boolean; formatOnly: boolean }): void;
330
+ enable(value?: boolean): boolean;
331
+ fontFamily(value?: string): string;
332
+ fontSize(value?: number): number;
333
+ forEachCell(value: (rowIndex: number, columnIndex: number, cellProperties: Cell) => void): void;
334
+ format(value?: string): string;
335
+ formula(value?: string): string;
336
+ input(value?: string | number | Date): any;
337
+ italic(value?: boolean): boolean;
338
+ link(value?: string): any;
339
+ select(): void;
340
+ textAlign(value?: string): string;
341
+ value(value?: string | number | Date): any;
342
+ verticalAlign(value?: string): string;
343
+ wrap(value?: boolean): boolean;
344
+ }
345
+
346
+ export class Sheet {
347
+ constructor();
348
+ resize(newRows: number, newCols: number): void;
349
+ name(): string;
350
+ range(cell: string): Range;
351
+ activeCell(): any;
352
+ showGridLines(value?: any): any;
353
+ }
354
+
355
+ export interface ExternalRef<T> {
356
+ get current(): T | null;
357
+ }
358
+
359
+ export interface SpreadsheetOptions extends DocumentDescriptor {
360
+ name?: string,
361
+ sheetsbar?: boolean,
362
+ /**
363
+ * Configures the Excel export settings of the Spreadsheet.
364
+ */
365
+ excel?: ExcelExportSettings;
366
+
367
+ messages?: any;
368
+
369
+ locale?: string;
370
+
371
+ formulaBarInputRef?: ExternalRef<any>;
372
+ formulaCellInputRef?: ExternalRef<any>;
373
+ nameBoxRef?: ExternalRef<any>;
374
+ }
375
+
376
+ export class Spreadsheet {
377
+ constructor(element: HTMLElement, options: SpreadsheetOptions);
378
+ get view(): View;
379
+ get workbook(): Workbook;
380
+ get options(): SpreadsheetOptions;
8
381
 
9
382
  executeCommand(options: any): void;
10
383
 
11
- fromJSON(options: { sheets: any[] }): any;
12
- toJSON(): void;
384
+ /**
385
+ * Loads the workbook data from an object with the format that is defined in the configuration.
386
+ *
387
+ * Note: All existing sheets and their data will be lost.
388
+ *
389
+ * @param json The object from where data will be loaded. This has to be the deserialized object, not the JSON string.
390
+ */
391
+ fromJSON(json: DocumentDescriptor): void;
392
+
393
+ /**
394
+ * Serializes the workbook.
395
+ */
396
+ toJSON(): DocumentDescriptor;
13
397
 
14
- fromFile(file: any, fileName: string): void;
398
+ /**
399
+ * Clears the Spreadsheet and populates it with data from the specified Excel (.xlsx) file.
400
+ *
401
+ * @param blob The file or blob that is usually obtained through a file input.
402
+ */
403
+ fromFile(file: File | Blob): void;
404
+
405
+ /**
406
+ * Initiates the Excel export. Also fires the excelExport event.
407
+ *
408
+ * Node: Calling this method may trigger the built-in popup blocker of the browser.
409
+ * To avoid that, always call it as a response to an end-user action, for example, a button click.
410
+ */
15
411
  saveAsExcel(options: any): void;
16
412
 
17
- activeSheet(): any;
18
- sheets(): any[];
413
+ /**
414
+ * Gets or sets the active sheet.
415
+ */
416
+ activeSheet(sheet?: Sheet): Sheet | void;
417
+
418
+ /**
419
+ * Returns an array with the sheets in the workbook.
420
+ */
421
+ sheets(): Sheet[];
422
+
423
+ /**
424
+ * Re-renders all data in the Spreadsheet.
425
+ */
426
+ refresh(): void;
427
+
428
+ bind(eventName: string, handler: any, one?: boolean): void;
429
+
19
430
  destroy(): void;
20
431
  }