-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathclass.ts
932 lines (818 loc) · 18 KB
/
class.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
import { ChildProperty, Property, Complex } from '@syncfusion/ej2-base';
import { FontFamily, TextAlign, VerticalAlign, FontWeight, FontStyle, TextDecoration, HighlightCell, ChartType, ChartTheme, AutoFillType } from './enum';
import { ValidationType, ValidationOperator, TopBottom, DataBar, ColorScale, IconSet, CFColor } from './enum';
import { CellStyleModel, FormatModel, LegendSettingsModel, AxisModel, DataLabelSettingsModel, ChartModel, MarkerSettingsModel, BorderModel } from './class-model';
import { CellModel } from '../base';
import { LabelPosition, LegendPosition, ChartShape } from './enum';
import { MajorGridLinesModel, MinorGridLinesModel } from './class-model';
/**
* Represents the cell style.
*/
export class CellStyle extends ChildProperty<CellStyle> {
/**
* Specifies font family to the cell.
*
* @default 'Calibri'
* @hidden
*/
@Property('Calibri')
public fontFamily: FontFamily;
/**
* Specifies vertical align to the cell.
*
* @default 'bottom'
*/
@Property('bottom')
public verticalAlign: VerticalAlign;
/**
* Specifies text align style to the cell.
*
* @default 'left'
*/
@Property('left')
public textAlign: TextAlign;
/**
* Specifies text indent style to the cell.
*
* @default '0pt'
*/
@Property('0pt')
public textIndent: string;
/**
* Specifies font color to the cell.
*
* @default '#000000'
*/
@Property('#000000')
public color: string;
/**
* Specifies background color to the cell.
*
* @default '#ffffff'
*/
@Property('#ffffff')
public backgroundColor: string;
/**
* Specifies font weight to the cell.
*
* @default 'normal'
*/
@Property('normal')
public fontWeight: FontWeight;
/**
* Specifies font style to the cell.
*
* @default 'normal'
*/
@Property('normal')
public fontStyle: FontStyle;
/**
* Specifies font size to the cell.
*
* @default '11pt'
*/
@Property('11pt')
public fontSize: string;
/**
* Specifies text decoration to the cell.
*
* @default 'none'
* @aspIgnore
*/
@Property('none')
public textDecoration: TextDecoration;
/**
* Specifies border of the cell.
*
* @default ''
*/
@Property('')
public border: string;
/**
* Specifies top border of the cell.
*
* @default ''
*/
@Property('')
public borderTop: string;
/**
* Specifies bottom border of the cell.
*
* @default ''
*/
@Property('')
public borderBottom: string;
/**
* Specifies left border of the cell.
*
* @default ''
*/
@Property('')
public borderLeft: string;
/**
* Specifies right border of the cell.
*
* @default ''
*/
@Property('')
public borderRight: string;
/** @hidden */
public bottomPriority: boolean;
}
/**
* Represents the Filter Collection.
*
*/
export class FilterCollection extends ChildProperty<FilterCollection> {
/**
* Specifies the sheet index of the filter collection.
*
* @default null
*/
@Property()
public sheetIndex: number;
/**
* Specifies the range of the filter collection.
*
* @default []
*/
@Property()
public filterRange: string;
/**
* Specifies the sheet has filter or not.
*
* @default false
*/
@Property(false)
public hasFilter: boolean;
/**
* Specifies the filtered column collection.
*
* @default []
*/
@Property()
public column: number[];
/**
* Specifies the condition for column filtering.
*
* @default []
*/
@Property()
public criteria: string[];
/**
* Specifies the value for column filtering.
*
* @default []
*/
@Property()
public value: (string | number | boolean | Date)[];
/**
* Specifies the data type of column filtering.
*
* @default []
*/
@Property()
public dataType: string[];
/**
* Specifies the predicate type of column filtering.
*
* @default []
*/
@Property()
public predicates: string[];
}
/**
* Represents the sort Collection.
*
*/
export class SortCollection extends ChildProperty<SortCollection> {
/**
* Specifies the range of the sort collection.
*
*/
@Property()
public sortRange: string;
/**
* Specifies the sorted column collection.
*
*/
@Property()
public columnIndex: number;
/**
* Specifies the order for sorting.
*
*/
@Property()
public order: string;
/**
* Specifies the order for sorting.
*
*/
@Property()
public sheetIndex: number;
}
/**
* Represents the DefineName.
*/
export class DefineName extends ChildProperty<DefineName> {
/**
* Specifies name for the defined name, which can be used in formula.
*
* @default ''
*/
@Property('')
public name: string;
/**
* Specifies scope for the defined name.
*
* @default ''
*/
@Property('')
public scope: string;
/**
* Specifies comment for the defined name.
*
* @default ''
*/
@Property('')
public comment: string;
/**
* Specifies reference for the defined name.
*
* @default ''
*/
@Property('')
public refersTo: string;
}
/**
* Configures the Protect behavior for the spreadsheet.
*
*/
export class ProtectSettings extends ChildProperty<ProtectSettings> {
/**
* Specifies to allow selection in spreadsheet.
*
* @default false
*/
@Property(false)
public selectCells: boolean;
/**
* Specifies to allow selection only for unlocked cells in spreadsheet.
*
* @default false
*/
@Property(false)
public selectUnLockedCells: boolean;
/**
* specifies to allow formating in cells.
*
* @default false
*/
@Property(false)
public formatCells: boolean;
/**
* Specifies to allow format rows in spreadsheet.
*
* @default false
*/
@Property(false)
public formatRows: boolean;
/**
* Specifies to allow format columns in spreadsheet.
*
* @default false
*/
@Property(false)
public formatColumns: boolean;
/**
* Specifies to allow insert Hyperlink in Spreadsheet.
*
* @default false
*/
@Property(false)
public insertLink: boolean;
}
/**
* Represents the Hyperlink.
*
*/
export class Hyperlink extends ChildProperty<Hyperlink> {
/**
* Specifies Hyperlink Address.
*
* @default ''
*/
@Property('')
public address: string;
}
/**
* Represents the DataValidation.
*/
export class Validation extends ChildProperty<Validation> {
/**
* Specifies Validation Type.
*
* @default 'WholeNumber'
*/
@Property('WholeNumber')
public type: ValidationType;
/**
* Specifies Validation Operator.
*
* @default 'Between'
*/
@Property('Between')
public operator: ValidationOperator;
/**
* Specifies Validation Minimum Value.
*
* @default ''
*/
@Property('0')
public value1: string;
/**
* Specifies Validation Maximum Value.
*
* @default ''
*/
@Property('0')
public value2: string;
/**
* Specifies IgnoreBlank option in Data Validation.
*
* @default true
*/
@Property(true)
public ignoreBlank: boolean;
/**
* Specifies InCellDropDown option in Data Validation.
*
* @default true
*/
@Property(true)
public inCellDropDown: boolean;
/**
* specifies to allow Highlight Invalid Data.
*
* @default false
*/
@Property(false)
public isHighlighted: boolean;
/**
* Specifies address for validation within the same column.
*
* @default ''
* @hidden
*/
@Property('')
public address: string;
}
/**
* Represents the Format.
*/
export class Format extends ChildProperty<FormatModel> {
/**
* Specifies the number format code to display value in specified number format.
*
* @default 'General'
*/
@Property('General')
public format: string;
/**
* Specifies the cell style options.
*
* @default {}
*/
@Complex<CellStyleModel>({}, CellStyle)
public style: CellStyleModel;
/**
* Specifies the range is locked or not, for allow edit range in spreadsheet protect option.
*
* @default true
*/
@Property(true)
public isLocked: boolean;
}
/**
* Represents the Conditional Formatting.
*
*/
export class ConditionalFormat extends ChildProperty<ConditionalFormat> {
/**
* Specifies Conditional formatting Type.
*
* @default 'GreaterThan'
* @aspIgnore
*/
@Property('GreaterThan')
public type: HighlightCell | TopBottom | DataBar | ColorScale | IconSet;
/**
* Specifies format.
*
* @default {}
*/
@Complex<FormatModel>({}, Format)
public format: FormatModel;
/**
* Specifies Conditional formatting Highlight Color.
*
* @default 'RedFT'
*/
@Property('RedFT')
public cFColor: CFColor;
/**
* Specifies Conditional formatting Value.
*
* @default ''
*/
@Property('')
public value: string;
/**
* Specifies Conditional formatting range.
*
* @default ''
*/
@Property('')
public range: string;
/**
* Specifies Conditional formatting action.
*
* @hidden
* @default ''
*/
@Property('')
public action: string;
/** @hidden */
public result: string[] | number[];
}
/**
* Represents the Legend.
*
*/
export class LegendSettings extends ChildProperty<ChartModel> {
/**
* If set to true, legend will be visible.
*
* @default true
*/
@Property(true)
public visible: boolean;
/**
* Position of the legend in the chart are,
* * Auto: Places the legend based on area type.
* * Top: Displays the legend at the top of the chart.
* * Left: Displays the legend at the left of the chart.
* * Bottom: Displays the legend at the bottom of the chart.
* * Right: Displays the legend at the right of the chart.
*
* @default 'Auto'
*/
@Property('Auto')
public position: LegendPosition;
}
/**
* Represents the DataLabelSettings.
*
*/
export class DataLabelSettings extends ChildProperty<ChartModel> {
/**
* If set true, data label for series renders.
*
* @default false
*/
@Property(false)
public visible: boolean;
/**
* Specifies the position of the data label. They are,
* * Outer: Positions the label outside the point.
* * top: Positions the label on top of the point.
* * Bottom: Positions the label at the bottom of the point.
* * Middle: Positions the label to the middle of the point.
* * Auto: Positions the label based on series.
*
* @default 'Auto'
*/
@Property('Auto')
public position: LabelPosition;
}
/**
* Represents the Border.
*
*/
export class Border extends ChildProperty<ChartModel>{
/**
* The color of the border that accepts value in hex and rgba as a valid CSS color string.
*
* @default ''
*/
@Property('')
public color: string;
/**
* The width of the border in pixels.
*
* @default 1
*/
@Property(1)
public width: number;
}
/**
* Represents the MarkerSettings.
*
*/
export class MarkerSettings extends ChildProperty<ChartModel> {
/**
* If set to true the marker for series is rendered. This is applicable only for line and area type series.
*
* @default false
*/
@Property(false)
public visible: boolean;
/**
* The different shape of a marker:
* * Circle
* * Triangle
* * Diamond
* * Plus
* * None
*
* @default 'Circle'
*/
@Property('Circle')
public shape: ChartShape;
/**
* The size of the marker in pixels.
*
* @default 5
*/
@Property(5)
public size: number;
/**
* The fill color of the marker that accepts value in hex and rgba as a valid CSS color string. By default, it will take series color.
* This property will work only if the `isFilled` property is set to true.
*
* @default null
*/
@Property(null)
public fill: string;
/**
* By default, the marker gets filled with the fill color. If set to false, the marker background will be transparent.
*
* @default true
*/
@Property(true)
public isFilled: boolean;
/**
* Options for customizing the border of a marker.
*
* @default {}
*/
@Complex<BorderModel>({}, Border)
public border: BorderModel;
}
/**
* Specifies the major grid lines in the `axis`.
*
*/
export class MajorGridLines extends ChildProperty<AxisModel> {
/**
* The width of the line in pixels.
*
* @default 0
*/
@Property(0)
public width: number;
}
/**
* Specifies the minor grid lines in the `axis`.
*
*/
export class MinorGridLines extends ChildProperty<AxisModel> {
/**
* The width of the line in pixels.
*
* @default 0
*/
@Property(0)
public width: number;
}
/**
* Represents the axis.
*
*/
export class Axis extends ChildProperty<ChartModel> {
/**
* Specifies the title of an axis.
*
* @default ''
*/
@Property('')
public title: string;
/**
* Options for customizing major grid lines.
*
* @default {}
*/
@Complex<MajorGridLinesModel>({}, MajorGridLines)
public majorGridLines: MajorGridLinesModel;
/**
* Options for customizing minor grid lines.
*
* @default {}
*/
@Complex<MinorGridLinesModel>({}, MinorGridLines)
public minorGridLines: MinorGridLinesModel;
/**
* If set to true, axis label will be visible.
*
* @default true
*/
@Property(true)
public visible: boolean;
}
/**
* Represents the Chart.
*/
export class Chart extends ChildProperty<CellModel> {
/**
* Specifies the type of a chart.
*
* @default 'Line'
*/
@Property('Line')
public type: ChartType;
/**
* Specifies the theme of a chart.
*
* @default 'Material'
*/
@Property('Material')
public theme: ChartTheme;
/**
* Specifies to switch the row or a column.
*
* @default false
*/
@Property(false)
public isSeriesInRows: boolean;
/**
* Options to configure the marker
*
* @default {}
*/
@Complex<MarkerSettingsModel>({}, MarkerSettings)
public markerSettings: MarkerSettingsModel;
/**
* Specifies the selected range or specified range.
*
* @default ''
*/
@Property('')
public range: string;
/**
* Specifies chart element id.
*
* @default ''
*/
@Property('')
public id: string;
/**
* Title of the chart
*
* @default ''
*/
@Property('')
public title: string;
/**
* Specifies the height of the chart.
*
* @default 290
*/
@Property(290)
public height: number;
/**
* Specifies the width of the chart.
*
* @default 480
*/
@Property(480)
public width: number;
/**
* Specifies the top position of the chart.
*
* @default 0
* @hidden
*/
@Property(0)
protected top: number;
/**
* Specifies the left side of the chart.
*
* @default 0
* @hidden
*/
@Property(0)
protected left: number;
/**
* Options for customizing the legend of the chart.
*
* @default {}
*/
@Complex<LegendSettingsModel>({}, LegendSettings)
public legendSettings: LegendSettingsModel;
/**
* Options to configure the horizontal axis.
*
* @default {}
*/
@Complex<AxisModel>({}, Axis)
public primaryXAxis: AxisModel;
/**
* Options to configure the vertical axis.
*
* @default {}
*/
@Complex<AxisModel>({}, Axis)
public primaryYAxis: AxisModel;
/**
* The data label for the series.
*
* @default {}
*/
@Complex<DataLabelSettingsModel>({}, DataLabelSettings)
public dataLabelSettings: DataLabelSettingsModel;
}
/**
* Represents the Image.
*/
export class Image extends ChildProperty<CellModel> {
/**
* Specifies the image source.
*
* @default ''
*/
@Property('')
public src: string;
/**
* Specifies image element id.
*
* @default ''
*/
@Property('')
public id: string;
/**
* Specifies the height of the image.
*
* @default 300
* @asptype double
*/
@Property(300)
public height: number;
/**
* Specifies the width of the image.
*
* @default 400
* @asptype double
*/
@Property(400)
public width: number;
/**
* Specifies the height of the image.
*
* @default 0
* @asptype double
*/
@Property(0)
public top: number;
/**
* Specifies the width of the image.
*
* @default 0
* @asptype double
*/
@Property(0)
public left: number;
}
/**
* Represents the AutoFillSettings.
*/
export class AutoFillSettings extends ChildProperty<AutoFillSettings> {
/**
* Specifies the auto fill settings. The possible values are
*
* * CopyCells: To update the copied cells of the selected range.
* * FillSeries: To update the filled series of the selected range.
* * FillFormattingOnly: To fill the formats only for the selected range.
* * FillWithoutFormatting: To fill without the format of the selected range.
*
* @default 'FillSeries'
*/
@Property('FillSeries')
public fillType: AutoFillType;
/**
* Specifies whether fill options need to shown or not.
*
* @default true
*/
@Property(true)
public showFillOptions: boolean;
}