Skip to content

Commit 1889d02

Browse files
author
m.r
committed
rearenge Data model and delete Theme
1 parent d51d942 commit 1889d02

File tree

1 file changed

+151
-150
lines changed

1 file changed

+151
-150
lines changed

src/data-model/excel-table.ts

Lines changed: 151 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,117 @@
1+
export interface ExcelTable extends ExcelTableOption {
2+
sheet: Sheet[];
3+
}
4+
export interface ExcelTableOption {
5+
notSave?: boolean;
6+
creator?: string;
7+
backend?: boolean;
8+
activateConditinalFormating?: boolean;
9+
fileName?: string;
10+
generateType?: "nodebuffer" | "array" | "binarystring" | "base64";
11+
addDefaultTitleStyle?: boolean;
12+
created?: string;
13+
modified?: string;
14+
numberOfColumn?: number;
15+
createType?: string;
16+
mapSheetDataOption?: any;
17+
styles?: Styles;
18+
}
19+
20+
export interface Sheet extends SheetOption {
21+
headers: Header[];
22+
data: Data[];
23+
}
24+
export interface SheetOption {
25+
withoutHeader?: boolean;
26+
conditinalFormating?: ConditinalFormating[];
27+
multiStyleConditin?: MultiStyleConditinFunction;
28+
useSplitBaseOnMatch?: boolean;
29+
convertStringToNumber?: boolean;
30+
images?: ImageTypes[];
31+
formula?: Formula;
32+
name?: string;
33+
title?: Title;
34+
shiftTop?: number;
35+
shiftLeft?: number;
36+
selected?: boolean;
37+
tabColor?: string;
38+
merges?: string[];
39+
headerStyleKey?: string;
40+
mergeRowDataCondition?: MergeRowDataConditionFunction;
41+
styleCellCondition?: StyleCellConditionFunction;
42+
commentCodition?: CommentConditionFunction;
43+
sortAndfilter?: SortAndFilter;
44+
state?: "hidden" | "visible";
45+
headerRowOption?: any;
46+
protectionOption?: ProtectionOption;
47+
headerHeight?: number;
48+
checkbox?: Checkbox[];
49+
}
50+
export interface Header {
51+
label: string;
52+
text: string;
53+
size?: number;
54+
multiStyleValue?: MultiStyleValue;
55+
comment?: Comment | string;
56+
conditinalFormating?: ConditinalFormating;
57+
formula?: {
58+
type: FormulaType;
59+
styleId?: string;
60+
};
61+
}
62+
export interface StyleBody {
63+
fontFamily?: string;
64+
type?: string;
65+
size?: number;
66+
index?: number;
67+
alignment?: AlignmentOption;
68+
border?: BorderOption;
69+
format?: string;
70+
bold?: boolean;
71+
underline?: boolean;
72+
italic?: boolean;
73+
doubleUnderline?: boolean;
74+
color?: string;
75+
backgroundColor?: string;
76+
}
77+
export interface Styles {
78+
[key: string]: StyleBody;
79+
}
80+
export interface Data extends DataOptions {
81+
[key: string]: string | number | any | undefined;
82+
}
83+
export interface DataOptions {
84+
[key: string]:
85+
| "0"
86+
| "1"
87+
| number
88+
| string
89+
| undefined
90+
| MapComment
91+
| MapMultiStyleValue;
92+
outlineLevel?: number;
93+
hidden?: "0" | "1" | number;
94+
rowStyle?: string;
95+
height?: number;
96+
multiStyleValue?: MapMultiStyleValue;
97+
comment?: MapComment;
98+
}
199
export type ProtectionOption = {
2100
[key in ProtectionOptionKey]: "0" | "1" | 0 | 1;
3101
};
102+
export type ProtectionOptionKey =
103+
| "sheet"
104+
| "formatCells"
105+
| "formatColumns"
106+
| "formatRows"
107+
| "insertColumns"
108+
| "insertRows"
109+
| "insertHyperlinks"
110+
| "deleteColumns"
111+
| "deleteRows"
112+
| "sort"
113+
| "autoFilter"
114+
| "pivotTables";
4115
export interface ConditinalFormating {
5116
type: "cells" | "dataBar" | "iconSet" | "colorScale" | "top";
6117
start: string;
@@ -38,20 +149,6 @@ export interface SideBySide {
38149
data: Data[];
39150
headerIndex?: number;
40151
}
41-
export type ProtectionOptionKey =
42-
| "sheet"
43-
| "formatCells"
44-
| "formatColumns"
45-
| "formatRows"
46-
| "insertColumns"
47-
| "insertRows"
48-
| "insertHyperlinks"
49-
| "deleteColumns"
50-
| "deleteRows"
51-
| "sort"
52-
| "autoFilter"
53-
| "pivotTables";
54-
55152
export type AlignmentOptionKey =
56153
| "horizontal"
57154
| "vertical"
@@ -90,21 +187,13 @@ export type BorderOption = {
90187
| "mediumDashed";
91188
};
92189
};
93-
export interface Header {
94-
label: string;
95-
text: string;
96-
size?: number;
97-
multiStyleValue?: MultiStyleValue;
98-
comment?: Comment | string;
99-
conditinalFormating?: ConditinalFormating;
100-
formula?: {
101-
type: FormulaType;
102-
styleId?: string;
103-
};
104-
}
105190

106-
export interface Data extends DataOptions {
107-
[key: string]: string | number | any | undefined;
191+
export interface MapMultiStyleValue {
192+
[key: string]: MultiStyleValue;
193+
}
194+
export interface MultiStyleValue {
195+
[key: string]: string | undefined | MultiStyleRexValue[];
196+
reg?: MultiStyleRexValue[];
108197
}
109198
export interface MultiStyleRexValue {
110199
reg: RegExp | string;
@@ -115,32 +204,8 @@ export interface Comment {
115204
styleId?: string;
116205
author?: string;
117206
}
118-
export interface MultiStyleValue {
119-
[key: string]: string | undefined | MultiStyleRexValue[];
120-
reg?: MultiStyleRexValue[];
121-
}
122-
export interface MapMultiStyleValue {
123-
[key: string]: MultiStyleValue;
124-
}
125-
export interface MapComment {
126-
[key: string]: Comment | string;
127-
}
128-
export interface DataOptions {
129-
[key: string]:
130-
| "0"
131-
| "1"
132-
| number
133-
| string
134-
| undefined
135-
| MapComment
136-
| MapMultiStyleValue;
137-
outlineLevel?: number;
138-
hidden?: "0" | "1" | number;
139-
rowStyle?: string;
140-
height?: number;
141-
multiStyleValue?: MapMultiStyleValue;
142-
comment?: MapComment;
143-
}
207+
208+
144209
export interface MergeRowConditionMap {
145210
[columnKey: string]: {
146211
inProgress: boolean;
@@ -193,39 +258,37 @@ export interface Title {
193258
multiStyleValue?: MultiStyleValue;
194259
comment?: Comment | string;
195260
}
196-
export interface SheetOption {
197-
withoutHeader?: boolean;
198-
conditinalFormating?: ConditinalFormating[];
199-
multiStyleConditin?: MultiStyleConditinFunction;
200-
useSplitBaseOnMatch?: boolean;
201-
convertStringToNumber?: boolean;
202-
images?: ImageTypes[];
203-
formula?: Formula;
204-
name?: string;
205-
title?: Title;
206-
shiftTop?: number;
207-
shiftLeft?: number;
208-
selected?: boolean;
209-
tabColor?: string;
210-
merges?: string[];
211-
headerStyleKey?: string;
212-
mergeRowDataCondition?: MergeRowDataConditionFunction;
213-
styleCellCondition?: StyleCellConditionFunction;
214-
commentCodition?: CommentConditionFunction;
215-
sortAndfilter?: SortAndFilter;
216-
state?: "hidden" | "visible";
217-
headerRowOption?: any;
218-
protectionOption?: ProtectionOption;
219-
headerHeight?: number;
220-
checkbox?: Checkbox[];
221-
}
222-
export interface Sheet extends SheetOption {
223-
headers: Header[];
224-
data: Data[];
225-
}
226261
export interface HeaderRowOption {
227262
outlineLevel: "string";
228263
}
264+
export interface Checkbox {
265+
col: number;
266+
row: number;
267+
text: string;
268+
link?: string;
269+
checked?: boolean;
270+
mixed?: boolean;
271+
threeD?: boolean;
272+
startStr?: string;
273+
endStr?: string;
274+
}
275+
export type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN";
276+
export interface FormatMap {
277+
[format: string]: {
278+
key: number;
279+
value?: string;
280+
};
281+
}
282+
export interface Formula {
283+
[insertCell: string]: FormulaSetting;
284+
}
285+
286+
export interface FormulaSetting {
287+
type: FormulaType;
288+
start: string;
289+
end: string;
290+
styleId?: string;
291+
}
229292
export interface StyleMapper {
230293
conditinalFormating: {
231294
count: number;
@@ -257,69 +320,7 @@ export interface StyleMapper {
257320
value: string;
258321
};
259322
}
260-
export interface Checkbox {
261-
col: number;
262-
row: number;
263-
text: string;
264-
link?: string;
265-
checked?: boolean;
266-
mixed?: boolean;
267-
threeD?: boolean;
268-
startStr?: string;
269-
endStr?: string;
270-
}
271-
export type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN";
272-
export interface StyleBody {
273-
fontFamily?: string;
274-
type?: string;
275-
size?: number;
276-
index?: number;
277-
alignment?: AlignmentOption;
278-
border?: BorderOption;
279-
format?: string;
280-
bold?: boolean;
281-
underline?: boolean;
282-
italic?: boolean;
283-
doubleUnderline?: boolean;
284-
color?: string;
285-
backgroundColor?: string;
286-
}
287-
export interface Styles {
288-
[key: string]: StyleBody;
289-
}
290-
export interface FormatMap {
291-
[format: string]: {
292-
key: number;
293-
value?: string;
294-
};
295-
}
296-
export interface FormulaSetting {
297-
type: FormulaType;
298-
start: string;
299-
end: string;
300-
styleId?: string;
301-
}
302-
export interface Formula {
303-
[insertCell: string]: FormulaSetting;
304-
}
305-
export interface Theme extends ExcelTableOption {
306-
sheet: SheetOption[];
307-
}
308-
export interface ExcelTableOption {
309-
notSave?: boolean;
310-
creator?: string;
311-
backend?: boolean;
312-
activateConditinalFormating?: boolean;
313-
fileName?: string;
314-
generateType?: "nodebuffer" | "array" | "binarystring" | "base64";
315-
addDefaultTitleStyle?: boolean;
316-
created?: string;
317-
modified?: string;
318-
numberOfColumn?: number;
319-
createType?: string;
320-
mapSheetDataOption?: any;
321-
styles?: Styles;
322-
}
323-
export interface ExcelTable extends ExcelTableOption {
324-
sheet: Sheet[];
325-
}
323+
324+
export interface MapComment {
325+
[key: string]: Comment | string;
326+
}

0 commit comments

Comments
 (0)