@senlinz/import-export 0.1.0-beta.10 → 0.1.0-beta.11

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.
@@ -1,17 +1,46 @@
1
- import { ExcelDataType } from "@senlinz/import-export-wasm";
2
1
  interface ExcelDefinition {
3
2
  name: string;
4
- sheetName: string;
3
+ sheetName?: string;
5
4
  columns: ExcelColumnDefinition[];
6
5
  author?: string;
7
6
  createTime?: Date | string;
7
+ title?: string;
8
+ titleHeight?: number;
9
+ titleFormat?: ExcelCellFormatDefinition;
10
+ defaultRowHeight?: number;
11
+ dx?: number;
12
+ dy?: number;
13
+ isHeaderFreeze?: boolean;
8
14
  }
9
15
  interface ExcelColumnDefinition {
10
16
  key: string;
11
17
  name: string;
12
18
  width?: number;
13
19
  note?: string;
14
- dataType?: ExcelDataType;
20
+ dataType?: "string" | "number" | "date";
15
21
  allowedValues?: string[];
22
+ parent?: string;
23
+ backgroundColor?: string;
24
+ color?: string;
25
+ bold?: boolean;
26
+ format?: ExcelCellFormatDefinition;
27
+ valueFormat?: ExcelCellFormatDefinition[] | ExcelCellFormatDefinition;
28
+ dataGroup: string;
29
+ dataGroupParent: string;
16
30
  }
17
- export { ExcelDefinition, ExcelColumnDefinition, ExcelDataType };
31
+ interface ExcelCellFormatDefinition {
32
+ rule?: 'default' | 'eq';
33
+ value?: string;
34
+ color?: string;
35
+ bold?: boolean;
36
+ italic?: boolean;
37
+ underline?: boolean;
38
+ strikethrough?: boolean;
39
+ fontSize?: number;
40
+ backgroundColor?: string;
41
+ align?: 'left' | 'center' | 'right';
42
+ alignVertical?: 'top' | 'center' | 'bottom';
43
+ dateFormat?: string;
44
+ borderColor?: string;
45
+ }
46
+ export { ExcelDefinition, ExcelColumnDefinition, ExcelCellFormatDefinition };
@@ -1,6 +1,6 @@
1
1
  export type * from './components.d.ts';
2
2
  import { ExcelDefinition } from './declarations/ExcelDefinition.js';
3
- import { importExcel, exportExcel, downloadExcelTemplate, fromExcel, toExcel, generateExcelTemplate } from './utils.js';
3
+ import { importExcel, exportExcel, downloadExcelTemplate, fromExcel, toExcel, generateExcelTemplate, mapRowData } from './utils.js';
4
4
  declare function getUtils(): {
5
5
  importExcel: typeof importExcel;
6
6
  exportExcel: typeof exportExcel;
@@ -8,6 +8,7 @@ declare function getUtils(): {
8
8
  fromExcel: typeof fromExcel;
9
9
  toExcel: typeof toExcel;
10
10
  generateExcelTemplate: typeof generateExcelTemplate;
11
+ mapRowData: typeof mapRowData;
11
12
  };
12
13
  declare function _importExcel<T>(defintion: ExcelDefinition): Promise<T[]>;
13
14
  declare function _exportExcel<T>(defintion: ExcelDefinition, data: T[]): Promise<void>;
@@ -1,10 +1,13 @@
1
1
  import { ExcelDefinition } from './declarations/ExcelDefinition';
2
2
  declare function initializeWasm(): void;
3
3
  declare function fromExcel<T>(definition: ExcelDefinition, buffer: Uint8Array): Promise<T[]>;
4
+ declare function mapRowData(item: any, childrenFields: string[]): {
5
+ root: any[];
6
+ };
4
7
  declare function toExcel<T>(definition: ExcelDefinition, data: T[]): Promise<Uint8Array>;
5
8
  declare function generateExcelTemplate(definition: ExcelDefinition): Promise<Uint8Array>;
6
9
  declare function downloadExcelTemplate(definition: ExcelDefinition): Promise<void>;
7
10
  declare function download(data: Uint8Array | string, name: string, type?: string): void;
8
11
  declare function importExcel<T>(defintion: ExcelDefinition): Promise<T[]>;
9
12
  declare function exportExcel<T>(definition: ExcelDefinition, data: T[]): Promise<void>;
10
- export { importExcel, exportExcel, downloadExcelTemplate, fromExcel, toExcel, generateExcelTemplate, initializeWasm, download };
13
+ export { importExcel, exportExcel, downloadExcelTemplate, fromExcel, toExcel, generateExcelTemplate, initializeWasm, download, mapRowData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senlinz/import-export",
3
- "version": "0.1.0-beta.10",
3
+ "version": "0.1.0-beta.11",
4
4
  "description": "Stencil Component for import/export excel files.",
5
5
  "module": "dist/components/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "fflate": "^0.8.2",
38
- "@senlinz/import-export-wasm": "0.1.0-beta.10"
38
+ "@senlinz/import-export-wasm": "0.1.0-beta.11"
39
39
  },
40
40
  "keywords": [
41
41
  "stencil",