md-spreadsheet-parser 1.1.8 → 1.1.10
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
|
@@ -25,6 +25,11 @@ export declare class Table {
|
|
|
25
25
|
endLine: number | undefined;
|
|
26
26
|
constructor(data?: Partial<Table>);
|
|
27
27
|
toDTO(): any;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a JSON-compatible plain object representation.
|
|
30
|
+
* Mirrors Python's .json property.
|
|
31
|
+
*/
|
|
32
|
+
get json(): any;
|
|
28
33
|
toModels(schemaCls: any, conversionSchema?: any): any;
|
|
29
34
|
toMarkdown(schema?: any): any;
|
|
30
35
|
updateCell(rowIdx: any, colIdx: any, value: any): any;
|
|
@@ -40,6 +45,11 @@ export declare class Sheet {
|
|
|
40
45
|
metadata: any | undefined;
|
|
41
46
|
constructor(data?: Partial<Sheet>);
|
|
42
47
|
toDTO(): any;
|
|
48
|
+
/**
|
|
49
|
+
* Returns a JSON-compatible plain object representation.
|
|
50
|
+
* Mirrors Python's .json property.
|
|
51
|
+
*/
|
|
52
|
+
get json(): any;
|
|
43
53
|
getTable(name: any): any;
|
|
44
54
|
toMarkdown(schema?: any): any;
|
|
45
55
|
}
|
|
@@ -48,6 +58,11 @@ export declare class Workbook {
|
|
|
48
58
|
metadata: any | undefined;
|
|
49
59
|
constructor(data?: Partial<Workbook>);
|
|
50
60
|
toDTO(): any;
|
|
61
|
+
/**
|
|
62
|
+
* Returns a JSON-compatible plain object representation.
|
|
63
|
+
* Mirrors Python's .json property.
|
|
64
|
+
*/
|
|
65
|
+
get json(): any;
|
|
51
66
|
getSheet(name: any): any;
|
|
52
67
|
toMarkdown(schema?: any): any;
|
|
53
68
|
addSheet(name: any): any;
|
package/dist/index.js
CHANGED
|
@@ -128,6 +128,22 @@ export class Table {
|
|
|
128
128
|
dto.metadata = JSON.stringify(dto.metadata);
|
|
129
129
|
return dto;
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Returns a JSON-compatible plain object representation.
|
|
133
|
+
* Mirrors Python's .json property.
|
|
134
|
+
*/
|
|
135
|
+
get json() {
|
|
136
|
+
return {
|
|
137
|
+
name: this.name,
|
|
138
|
+
description: this.description,
|
|
139
|
+
headers: this.headers,
|
|
140
|
+
rows: this.rows,
|
|
141
|
+
metadata: this.metadata ?? {},
|
|
142
|
+
startLine: this.startLine,
|
|
143
|
+
endLine: this.endLine,
|
|
144
|
+
alignments: this.alignments,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
131
147
|
toModels(schemaCls, conversionSchema) {
|
|
132
148
|
const dto = this.toDTO();
|
|
133
149
|
const clientRes = clientSideToModels(this.headers, this.rows || [], schemaCls);
|
|
@@ -183,7 +199,7 @@ export class Sheet {
|
|
|
183
199
|
constructor(data) {
|
|
184
200
|
if (data) {
|
|
185
201
|
this.name = data.name;
|
|
186
|
-
this.tables = data.tables;
|
|
202
|
+
this.tables = (data.tables || []).map((x) => x instanceof Table ? x : new Table(x));
|
|
187
203
|
this.metadata = (typeof data.metadata === 'string') ? JSON.parse(data.metadata) : data.metadata;
|
|
188
204
|
}
|
|
189
205
|
}
|
|
@@ -195,6 +211,17 @@ export class Sheet {
|
|
|
195
211
|
dto.metadata = JSON.stringify(dto.metadata);
|
|
196
212
|
return dto;
|
|
197
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Returns a JSON-compatible plain object representation.
|
|
216
|
+
* Mirrors Python's .json property.
|
|
217
|
+
*/
|
|
218
|
+
get json() {
|
|
219
|
+
return {
|
|
220
|
+
name: this.name,
|
|
221
|
+
tables: (this.tables || []).map((t) => t.json ? t.json : t),
|
|
222
|
+
metadata: this.metadata ?? {},
|
|
223
|
+
};
|
|
224
|
+
}
|
|
198
225
|
getTable(name) {
|
|
199
226
|
const dto = this.toDTO();
|
|
200
227
|
const res = _sheetGetTable(dto, name);
|
|
@@ -209,7 +236,7 @@ export class Sheet {
|
|
|
209
236
|
export class Workbook {
|
|
210
237
|
constructor(data) {
|
|
211
238
|
if (data) {
|
|
212
|
-
this.sheets = data.sheets;
|
|
239
|
+
this.sheets = (data.sheets || []).map((x) => x instanceof Sheet ? x : new Sheet(x));
|
|
213
240
|
this.metadata = (typeof data.metadata === 'string') ? JSON.parse(data.metadata) : data.metadata;
|
|
214
241
|
}
|
|
215
242
|
}
|
|
@@ -221,6 +248,16 @@ export class Workbook {
|
|
|
221
248
|
dto.metadata = JSON.stringify(dto.metadata);
|
|
222
249
|
return dto;
|
|
223
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Returns a JSON-compatible plain object representation.
|
|
253
|
+
* Mirrors Python's .json property.
|
|
254
|
+
*/
|
|
255
|
+
get json() {
|
|
256
|
+
return {
|
|
257
|
+
sheets: (this.sheets || []).map((s) => s.json ? s.json : s),
|
|
258
|
+
metadata: this.metadata ?? {},
|
|
259
|
+
};
|
|
260
|
+
}
|
|
224
261
|
getSheet(name) {
|
|
225
262
|
const dto = this.toDTO();
|
|
226
263
|
const res = _workbookGetSheet(dto, name);
|
package/dist/parser.core.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/src/index.ts
CHANGED
|
@@ -163,6 +163,23 @@ export class Table {
|
|
|
163
163
|
return dto;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Returns a JSON-compatible plain object representation.
|
|
168
|
+
* Mirrors Python's .json property.
|
|
169
|
+
*/
|
|
170
|
+
get json(): any {
|
|
171
|
+
return {
|
|
172
|
+
name: this.name,
|
|
173
|
+
description: this.description,
|
|
174
|
+
headers: this.headers,
|
|
175
|
+
rows: this.rows,
|
|
176
|
+
metadata: this.metadata ?? {},
|
|
177
|
+
startLine: this.startLine,
|
|
178
|
+
endLine: this.endLine,
|
|
179
|
+
alignments: this.alignments,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
166
183
|
toModels(schemaCls: any, conversionSchema?: any): any {
|
|
167
184
|
const dto = this.toDTO();
|
|
168
185
|
const clientRes = clientSideToModels(this.headers, this.rows || [], schemaCls);
|
|
@@ -230,7 +247,7 @@ export class Sheet {
|
|
|
230
247
|
constructor(data?: Partial<Sheet>) {
|
|
231
248
|
if (data) {
|
|
232
249
|
this.name = data.name;
|
|
233
|
-
this.tables = data.tables;
|
|
250
|
+
this.tables = (data.tables || []).map((x: any) => x instanceof Table ? x : new Table(x));
|
|
234
251
|
this.metadata = (typeof data.metadata === 'string') ? JSON.parse(data.metadata) : data.metadata;
|
|
235
252
|
}
|
|
236
253
|
}
|
|
@@ -242,6 +259,18 @@ export class Sheet {
|
|
|
242
259
|
return dto;
|
|
243
260
|
}
|
|
244
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Returns a JSON-compatible plain object representation.
|
|
264
|
+
* Mirrors Python's .json property.
|
|
265
|
+
*/
|
|
266
|
+
get json(): any {
|
|
267
|
+
return {
|
|
268
|
+
name: this.name,
|
|
269
|
+
tables: (this.tables || []).map((t: any) => t.json ? t.json : t),
|
|
270
|
+
metadata: this.metadata ?? {},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
245
274
|
getTable(name: any): any {
|
|
246
275
|
const dto = this.toDTO();
|
|
247
276
|
const res = _sheetGetTable(dto, name);
|
|
@@ -261,7 +290,7 @@ export class Workbook {
|
|
|
261
290
|
|
|
262
291
|
constructor(data?: Partial<Workbook>) {
|
|
263
292
|
if (data) {
|
|
264
|
-
this.sheets = data.sheets;
|
|
293
|
+
this.sheets = (data.sheets || []).map((x: any) => x instanceof Sheet ? x : new Sheet(x));
|
|
265
294
|
this.metadata = (typeof data.metadata === 'string') ? JSON.parse(data.metadata) : data.metadata;
|
|
266
295
|
}
|
|
267
296
|
}
|
|
@@ -273,6 +302,17 @@ export class Workbook {
|
|
|
273
302
|
return dto;
|
|
274
303
|
}
|
|
275
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Returns a JSON-compatible plain object representation.
|
|
307
|
+
* Mirrors Python's .json property.
|
|
308
|
+
*/
|
|
309
|
+
get json(): any {
|
|
310
|
+
return {
|
|
311
|
+
sheets: (this.sheets || []).map((s: any) => s.json ? s.json : s),
|
|
312
|
+
metadata: this.metadata ?? {},
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
276
316
|
getSheet(name: any): any {
|
|
277
317
|
const dto = this.toDTO();
|
|
278
318
|
const res = _workbookGetSheet(dto, name);
|