@syncfusion/ej2-treemap 20.1.59 → 20.2.36

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.
@@ -0,0 +1,93 @@
1
+ import { print as printWindow, createElement } from '@syncfusion/ej2-base';
2
+ import { TreeMap} from '../../index';
3
+ import { getElement } from '../utils/helper';
4
+ import { IPrintEventArgs } from '../model/interface';
5
+ import { beforePrint } from '../model/constants';
6
+
7
+ /**
8
+ * Print module handles the print functionality for treemap.
9
+ *
10
+ * @hidden
11
+ */
12
+ export class Print {
13
+ private control: TreeMap ;
14
+ private printWindow: Window;
15
+
16
+ /**
17
+ * Constructor for Maps
18
+ *
19
+ * @param {TreeMap} control - Specifies the treemap instance.
20
+ */
21
+ // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
22
+ constructor(control: TreeMap) {
23
+ this.control = control;
24
+ }
25
+
26
+ /**
27
+ * This method is used to perform the print functionality in treemap.
28
+ *
29
+ * @param { string[] | string | Element} elements - Specifies the element.
30
+ * @returns {void}
31
+ * @private
32
+ */
33
+ public print(elements?: string[] | string | Element): void {
34
+ this.printWindow = window.open('', 'print', 'height=' + window.outerHeight + ',width=' + window.outerWidth + ',tabbar=no');
35
+ this.printWindow.moveTo(0, 0);
36
+ this.printWindow.resizeTo(screen.availWidth, screen.availHeight);
37
+ const argsData: IPrintEventArgs = {
38
+ cancel: false, htmlContent: this.getHTMLContent(elements), name: beforePrint
39
+ };
40
+ this.control.trigger(beforePrint, argsData, () => {
41
+ if (!argsData.cancel) {
42
+ printWindow(argsData.htmlContent, this.printWindow);
43
+ }
44
+ });
45
+ }
46
+
47
+ /**
48
+ * To get the html string of the Maps
49
+ *
50
+ * @param {string[] | string | Element} elements - Specifies the element
51
+ * @returns {Element} - Returns the element
52
+ * @private
53
+ */
54
+ public getHTMLContent(elements?: string[] | string | Element): Element {
55
+ const div: Element = createElement('div');
56
+ if (elements) {
57
+ if (elements instanceof Array) {
58
+ elements.forEach((value: string) => {
59
+ div.appendChild(getElement(value).cloneNode(true) as Element);
60
+ });
61
+ } else if (elements instanceof Element) {
62
+ div.appendChild(elements.cloneNode(true) as Element);
63
+ } else {
64
+ div.appendChild(getElement(elements).cloneNode(true) as Element);
65
+ }
66
+ } else {
67
+ div.appendChild(this.control.element.cloneNode(true) as Element);
68
+ }
69
+ return div;
70
+ }
71
+
72
+ /**
73
+ * Get module name.
74
+ *
75
+ * @returns {string} - Returns the module name.
76
+ */
77
+ protected getModuleName(): string {
78
+ // Returns te module name
79
+ return 'Print';
80
+ }
81
+ /**
82
+ * To destroy the legend.
83
+ *
84
+ * @param {TreeMap} treemap - Specifies the treemap instance
85
+ * @returns {void}
86
+ * @private
87
+ */
88
+ public destroy(treemap: TreeMap): void {
89
+ /**
90
+ * Destroy method performed here
91
+ */
92
+ }
93
+ }
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Maps Themes doc
3
+ */
4
+
5
+ import { IFontMapping, IThemeStyle } from '../model/interface';
6
+ import { TreeMapTheme } from '../utils/enum';
7
+
8
+ // eslint-disable-next-line @typescript-eslint/no-namespace
9
+ export namespace Theme {
10
+ /**
11
+ * @private
12
+ */
13
+ export const mapsTitleFont: IFontMapping = {
14
+ size: '14px',
15
+ fontWeight: 'Medium',
16
+ color: '#424242',
17
+ fontStyle: 'Medium',
18
+ fontFamily: 'Roboto, Noto, Sans-serif'
19
+ };
20
+ }
21
+
22
+ /**
23
+ * To get the theme style based on treemap theme.
24
+ *
25
+ * @param {TreeMapTheme} theme Specifies the theme of the treemap control.
26
+ * @returns {IThemeStyle} Returns the theme.
27
+ * @private
28
+ */
29
+ export function getThemeStyle(theme: TreeMapTheme): IThemeStyle {
30
+ let style: IThemeStyle; let color: string;
31
+ switch (theme.toLowerCase()) {
32
+ case 'materialdark':
33
+ color = '#303030';
34
+ break;
35
+ case 'fabricdark':
36
+ color = '#201F1F';
37
+ break;
38
+ case 'bootstrapdark':
39
+ color = '#1A1A1A';
40
+ break;
41
+ }
42
+ switch (theme.toLowerCase()) {
43
+ case 'bootstrapdark':
44
+ case 'fabricdark':
45
+ case 'materialdark':
46
+ style = {
47
+ backgroundColor: color,
48
+ titleFontColor: '#FFFFFF',
49
+ subTitleFontColor: '#FFFFFF',
50
+ tooltipFillColor: '#363F4C',
51
+ tooltipFontColor: '#ffffff',
52
+ legendTitleColor: '#DADADA',
53
+ legendTextColor: '#DADADA',
54
+ fontFamily: 'Roboto, Noto, Sans-serif'
55
+ };
56
+ break;
57
+ case 'highcontrast':
58
+ style = {
59
+ backgroundColor: '#000000',
60
+ titleFontColor: '#FFFFFF',
61
+ subTitleFontColor: '#FFFFFF',
62
+ tooltipFillColor: '#363F4C',
63
+ tooltipFontColor: '#ffffff',
64
+ legendTitleColor: '#FFFFFF',
65
+ legendTextColor: '#FFFFFF',
66
+ fontFamily: 'Roboto, Noto, Sans-serif'
67
+ };
68
+ break;
69
+ case 'bootstrap4':
70
+ style = {
71
+ backgroundColor: '#FFFFFF',
72
+ titleFontColor: '#212529',
73
+ subTitleFontColor: '#212529',
74
+ tooltipFillColor: '#000000',
75
+ tooltipFontColor: '#FFFFFF',
76
+ tooltipFillOpacity: 1,
77
+ tooltipTextOpacity: 0.9,
78
+ legendTitleColor: '#212529',
79
+ legendTextColor: '#212529',
80
+ fontFamily: 'HelveticaNeue-Medium',
81
+ fontSize: '16px',
82
+ legendFontSize: '14px',
83
+ labelFontFamily: 'HelveticaNeue'
84
+ };
85
+ break;
86
+ case 'tailwind':
87
+ style = {
88
+ backgroundColor: 'transparent',
89
+ titleFontColor: '#374151',
90
+ subTitleFontColor: '#374151',
91
+ tooltipFillColor: '#111827',
92
+ tooltipFontColor: '#F9FAFB',
93
+ tooltipFillOpacity: 1,
94
+ tooltipTextOpacity: 1,
95
+ legendTitleColor: '#374151',
96
+ legendTextColor: '#374151',
97
+ fontFamily: 'Inter',
98
+ fontSize: '14px',
99
+ legendFontSize: '12px',
100
+ labelFontFamily: 'Inter'
101
+ };
102
+ break;
103
+ case 'tailwinddark':
104
+ style = {
105
+ backgroundColor: 'transparent',
106
+ titleFontColor: '#D1D5DB',
107
+ subTitleFontColor: '#D1D5DB',
108
+ tooltipFillColor: '#F9FAFB',
109
+ tooltipFontColor: '#1F2937',
110
+ tooltipFillOpacity: 1,
111
+ tooltipTextOpacity: 1,
112
+ legendTitleColor: '#D1D5DB',
113
+ legendTextColor: '#D1D5DB',
114
+ fontFamily: 'Inter',
115
+ fontSize: '14px',
116
+ legendFontSize: '12px',
117
+ labelFontFamily: 'Inter'
118
+ };
119
+ break;
120
+ case 'bootstrap5':
121
+ style = {
122
+ backgroundColor: 'rgba(255,255,255, 0.0)',
123
+ titleFontColor: '#212529',
124
+ subTitleFontColor: '#212529',
125
+ tooltipFillColor: '#212529',
126
+ tooltipFontColor: '#F9FAFB',
127
+ tooltipFillOpacity: 1,
128
+ tooltipTextOpacity: 1,
129
+ legendTitleColor: '#212529',
130
+ legendTextColor: '#212529',
131
+ fontFamily: 'Helvetica Neue',
132
+ fontSize: '14px',
133
+ legendFontSize: '12px',
134
+ labelFontFamily: 'Helvetica Neue'
135
+ };
136
+ break;
137
+ case 'bootstrap5dark':
138
+ style = {
139
+ backgroundColor: 'rgba(255,255,255, 0.0)',
140
+ titleFontColor: '#FFFFFF',
141
+ subTitleFontColor: '#FFFFFF',
142
+ tooltipFillColor: '#E9ECEF',
143
+ tooltipFontColor: '#212529',
144
+ tooltipFillOpacity: 1,
145
+ tooltipTextOpacity: 1,
146
+ legendTitleColor: '#FFFFFF',
147
+ legendTextColor: '#FFFFFF',
148
+ fontFamily: 'Helvetica Neue',
149
+ fontSize: '14px',
150
+ legendFontSize: '12px',
151
+ labelFontFamily: 'Helvetica Neue'
152
+ };
153
+ break;
154
+ case 'fluent':
155
+ style = {
156
+ backgroundColor: 'rgba(255,255,255, 0.0)',
157
+ titleFontColor: '#201F1E',
158
+ subTitleFontColor: '#201F1E',
159
+ tooltipFillColor: '#FFFFFF',
160
+ tooltipFontColor: '#323130',
161
+ tooltipFillOpacity: 1,
162
+ tooltipTextOpacity: 1,
163
+ legendTitleColor: '#201F1E',
164
+ legendTextColor: '#201F1E',
165
+ fontFamily: 'Segoe UI',
166
+ fontSize: '14px',
167
+ legendFontSize: '12px',
168
+ labelFontFamily: 'Segoe UI'
169
+ };
170
+ break;
171
+ case 'fluentdark':
172
+ style = {
173
+ backgroundColor: 'rgba(255,255,255, 0.0)',
174
+ titleFontColor: '#F3F2F1',
175
+ subTitleFontColor: '#F3F2F1',
176
+ tooltipFillColor: '#252423',
177
+ tooltipFontColor: '#F3F2F1',
178
+ tooltipFillOpacity: 1,
179
+ tooltipTextOpacity: 1,
180
+ legendTitleColor: '#F3F2F1',
181
+ legendTextColor: '#F3F2F1',
182
+ fontFamily: 'Segoe UI',
183
+ fontSize: '14px',
184
+ legendFontSize: '12px',
185
+ labelFontFamily: 'Segoe UI'
186
+ };
187
+ break;
188
+ default:
189
+ style = {
190
+ backgroundColor: '#FFFFFF',
191
+ titleFontColor: '#424242',
192
+ subTitleFontColor: '#424242',
193
+ tooltipFillColor: '#363F4C',
194
+ tooltipFontColor: '#ffffff',
195
+ legendTitleColor: '#353535',
196
+ legendTextColor: '#353535',
197
+ fontFamily: 'Roboto, Noto, Sans-serif'
198
+ };
199
+ break;
200
+ }
201
+ return style;
202
+ }