@syncfusion/ej2-docx-renderer 0.0.0-stage → 35.2.15

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.
Files changed (129) hide show
  1. package/README.md +2 -2
  2. package/base.d.ts +4 -0
  3. package/base.js +4 -0
  4. package/dist/ej2-docx-renderer.umd.min.js +2 -0
  5. package/dist/ej2-docx-renderer.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-docx-renderer.es2015.js +52432 -0
  7. package/dist/es6/ej2-docx-renderer.es2015.js.map +1 -0
  8. package/dist/es6/ej2-docx-renderer.es5.js +54425 -0
  9. package/dist/es6/ej2-docx-renderer.es5.js.map +1 -0
  10. package/dist/global/ej2-docx-renderer.min.js +2 -0
  11. package/dist/global/ej2-docx-renderer.min.js.map +1 -0
  12. package/dist/global/index.d.ts +5 -0
  13. package/format.d.ts +4 -0
  14. package/format.js +4 -0
  15. package/helper.d.ts +4 -0
  16. package/helper.js +4 -0
  17. package/index.d.ts +4 -0
  18. package/index.js +4 -0
  19. package/license +10 -0
  20. package/list.d.ts +4 -0
  21. package/list.js +4 -0
  22. package/package.json +26 -4
  23. package/parser.d.ts +4 -0
  24. package/parser.js +4 -0
  25. package/src/base/constants.d.ts +2 -0
  26. package/src/base/constants.js +2 -0
  27. package/src/base/dictionary.d.ts +52 -0
  28. package/src/base/dictionary.js +137 -0
  29. package/src/base/index.d.ts +9 -0
  30. package/src/base/index.js +9 -0
  31. package/src/base/keywords.d.ts +422 -0
  32. package/src/base/keywords.js +422 -0
  33. package/src/base/types.d.ts +2590 -0
  34. package/src/base/types.js +1056 -0
  35. package/src/base/unique-format.d.ts +87 -0
  36. package/src/base/unique-format.js +858 -0
  37. package/src/base/unique-formats.d.ts +32 -0
  38. package/src/base/unique-formats.js +87 -0
  39. package/src/document-canvas.d.ts +61 -0
  40. package/src/document-canvas.js +221 -0
  41. package/src/docx-renderer.d.ts +941 -0
  42. package/src/docx-renderer.js +2251 -0
  43. package/src/format/border.d.ts +53 -0
  44. package/src/format/border.js +600 -0
  45. package/src/format/borders.d.ts +44 -0
  46. package/src/format/borders.js +314 -0
  47. package/src/format/cell-format.d.ts +42 -0
  48. package/src/format/cell-format.js +309 -0
  49. package/src/format/character-format.d.ts +152 -0
  50. package/src/format/character-format.js +1224 -0
  51. package/src/format/index.d.ts +14 -0
  52. package/src/format/index.js +14 -0
  53. package/src/format/list-format.d.ts +32 -0
  54. package/src/format/list-format.js +238 -0
  55. package/src/format/paragraph-format.d.ts +103 -0
  56. package/src/format/paragraph-format.js +854 -0
  57. package/src/format/row-format.d.ts +119 -0
  58. package/src/format/row-format.js +545 -0
  59. package/src/format/section-format.d.ts +89 -0
  60. package/src/format/section-format.js +689 -0
  61. package/src/format/shading.d.ts +24 -0
  62. package/src/format/shading.js +137 -0
  63. package/src/format/style.d.ts +106 -0
  64. package/src/format/style.js +286 -0
  65. package/src/format/table-format.d.ts +51 -0
  66. package/src/format/table-format.js +395 -0
  67. package/src/global.js +1 -0
  68. package/src/helper/document-editor-helper.d.ts +515 -0
  69. package/src/helper/document-editor-helper.js +1302 -0
  70. package/src/helper/document-editor-settings.d.ts +293 -0
  71. package/src/helper/document-editor-settings.js +94 -0
  72. package/src/helper/index.d.ts +5 -0
  73. package/src/helper/index.js +5 -0
  74. package/src/helper/layout-helper-methods.d.ts +539 -0
  75. package/src/helper/layout-helper-methods.js +1065 -0
  76. package/src/helper/renderer-hooks.d.ts +74 -0
  77. package/src/helper/renderer-hooks.js +14 -0
  78. package/src/helper/revision-helper-methods.d.ts +199 -0
  79. package/src/helper/revision-helper-methods.js +362 -0
  80. package/src/index.d.ts +18 -0
  81. package/src/index.js +18 -0
  82. package/src/layout-helper.d.ts +190 -0
  83. package/src/layout-helper.js +1368 -0
  84. package/src/layout.d.ts +779 -0
  85. package/src/layout.js +17232 -0
  86. package/src/list/abstract-list.d.ts +25 -0
  87. package/src/list/abstract-list.js +67 -0
  88. package/src/list/index.d.ts +7 -0
  89. package/src/list/index.js +7 -0
  90. package/src/list/level-override.d.ts +22 -0
  91. package/src/list/level-override.js +43 -0
  92. package/src/list/list-level.d.ts +57 -0
  93. package/src/list/list-level.js +249 -0
  94. package/src/list/list.d.ts +30 -0
  95. package/src/list/list.js +100 -0
  96. package/src/page.d.ts +4155 -0
  97. package/src/page.js +11342 -0
  98. package/src/parser/index.d.ts +1 -0
  99. package/src/parser/index.js +1 -0
  100. package/src/parser/sfdt-reader.d.ts +254 -0
  101. package/src/parser/sfdt-reader.js +4569 -0
  102. package/src/render.d.ts +226 -0
  103. package/src/render.js +4222 -0
  104. package/src/text-helper.d.ts +144 -0
  105. package/src/text-helper.js +1079 -0
  106. package/src/text-helpers/index.d.ts +2 -0
  107. package/src/text-helpers/index.js +2 -0
  108. package/src/text-helpers/optimized.d.ts +45 -0
  109. package/src/text-helpers/optimized.js +121 -0
  110. package/src/text-helpers/regular.d.ts +37 -0
  111. package/src/text-helpers/regular.js +93 -0
  112. package/src/themes/font-scheme.d.ts +28 -0
  113. package/src/themes/font-scheme.js +107 -0
  114. package/src/themes/index.d.ts +6 -0
  115. package/src/themes/index.js +6 -0
  116. package/src/themes/major-minor-font-scheme.d.ts +14 -0
  117. package/src/themes/major-minor-font-scheme.js +45 -0
  118. package/src/themes/themes.d.ts +11 -0
  119. package/src/themes/themes.js +31 -0
  120. package/src/utility/index.d.ts +1 -0
  121. package/src/utility/index.js +1 -0
  122. package/src/utility/path-util.d.ts +133 -0
  123. package/src/utility/path-util.js +639 -0
  124. package/text-helpers.d.ts +4 -0
  125. package/text-helpers.js +4 -0
  126. package/themes.d.ts +4 -0
  127. package/themes.js +4 -0
  128. package/utility.d.ts +4 -0
  129. package/utility.js +4 -0
@@ -0,0 +1,24 @@
1
+ import { TextureStyle } from '../base/types';
2
+ /**
3
+ * @private
4
+ */
5
+ export declare class WShading {
6
+ private uniqueShadingFormat;
7
+ private static uniqueShadingFormats;
8
+ private static uniqueFormatType;
9
+ ownerBase: Object;
10
+ backgroundColor: string;
11
+ foregroundColor: string;
12
+ textureStyle: TextureStyle;
13
+ constructor(node?: Object);
14
+ private getPropertyValue;
15
+ private setPropertyValue;
16
+ private static getPropertyDefaultValue;
17
+ private initializeUniqueShading;
18
+ private addUniqueShading;
19
+ destroy(): void;
20
+ cloneFormat(): WShading;
21
+ copyFormat(shading: WShading): void;
22
+ hasValue(property: string): boolean;
23
+ static clear(): void;
24
+ }
@@ -0,0 +1,137 @@
1
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
2
+ import { WUniqueFormat } from '../base/unique-format';
3
+ import { WUniqueFormats } from '../base/unique-formats';
4
+ import { Dictionary } from '../base/dictionary';
5
+ /* eslint-disable */
6
+ /**
7
+ * @private
8
+ */
9
+ var WShading = /** @class */ (function () {
10
+ function WShading(node) {
11
+ this.uniqueShadingFormat = undefined;
12
+ this.ownerBase = undefined;
13
+ this.ownerBase = node;
14
+ }
15
+ Object.defineProperty(WShading.prototype, "backgroundColor", {
16
+ get: function () {
17
+ return this.getPropertyValue('backgroundColor');
18
+ },
19
+ set: function (value) {
20
+ this.setPropertyValue('backgroundColor', value);
21
+ },
22
+ enumerable: true,
23
+ configurable: true
24
+ });
25
+ Object.defineProperty(WShading.prototype, "foregroundColor", {
26
+ get: function () {
27
+ return this.getPropertyValue('foregroundColor');
28
+ },
29
+ set: function (value) {
30
+ this.setPropertyValue('foregroundColor', value);
31
+ },
32
+ enumerable: true,
33
+ configurable: true
34
+ });
35
+ Object.defineProperty(WShading.prototype, "textureStyle", {
36
+ get: function () {
37
+ return this.getPropertyValue('textureStyle');
38
+ },
39
+ set: function (value) {
40
+ this.setPropertyValue('textureStyle', value);
41
+ },
42
+ enumerable: true,
43
+ configurable: true
44
+ });
45
+ WShading.prototype.getPropertyValue = function (property) {
46
+ var hasValue = this.hasValue(property);
47
+ if (hasValue) {
48
+ var propertyType = WUniqueFormat.getPropertyType(WShading.uniqueFormatType, property);
49
+ if (!isNullOrUndefined(this.uniqueShadingFormat) && this.uniqueShadingFormat.propertiesHash.containsKey(propertyType)) {
50
+ return this.uniqueShadingFormat.propertiesHash.get(propertyType);
51
+ }
52
+ }
53
+ return WShading.getPropertyDefaultValue(property);
54
+ };
55
+ WShading.prototype.setPropertyValue = function (property, value) {
56
+ if (isNullOrUndefined(value) || value === '') {
57
+ value = WShading.getPropertyDefaultValue(property);
58
+ }
59
+ if (isNullOrUndefined(this.uniqueShadingFormat)) {
60
+ this.initializeUniqueShading(property, value);
61
+ }
62
+ else {
63
+ var propertyType = WUniqueFormat.getPropertyType(this.uniqueShadingFormat.uniqueFormatType, property);
64
+ if (this.uniqueShadingFormat.propertiesHash.containsKey(propertyType) &&
65
+ this.uniqueShadingFormat.propertiesHash.get(propertyType) === value) {
66
+ //Do nothing, since no change in property value and return
67
+ return;
68
+ }
69
+ this.uniqueShadingFormat = WShading.uniqueShadingFormats.updateUniqueFormat(this.uniqueShadingFormat, property, value);
70
+ }
71
+ };
72
+ WShading.getPropertyDefaultValue = function (property) {
73
+ var value = undefined;
74
+ switch (property) {
75
+ case 'backgroundColor':
76
+ value = 'empty';
77
+ break;
78
+ case 'foregroundColor':
79
+ value = 'empty';
80
+ break;
81
+ case 'textureStyle':
82
+ value = 'TextureNone';
83
+ break;
84
+ }
85
+ return value;
86
+ };
87
+ WShading.prototype.initializeUniqueShading = function (property, propValue) {
88
+ var uniqueShadingTemp = new Dictionary();
89
+ this.addUniqueShading('backgroundColor', property, propValue, uniqueShadingTemp);
90
+ this.addUniqueShading('foregroundColor', property, propValue, uniqueShadingTemp);
91
+ this.addUniqueShading('textureStyle', property, propValue, uniqueShadingTemp);
92
+ this.uniqueShadingFormat = WShading.uniqueShadingFormats.addUniqueFormat(uniqueShadingTemp, WShading.uniqueFormatType);
93
+ };
94
+ WShading.prototype.addUniqueShading = function (property, modifiedProperty, propValue, uniqueShadingTemp) {
95
+ var propertyType = WUniqueFormat.getPropertyType(WShading.uniqueFormatType, property);
96
+ if (property === modifiedProperty) {
97
+ uniqueShadingTemp.add(propertyType, propValue);
98
+ }
99
+ else {
100
+ uniqueShadingTemp.add(propertyType, WShading.getPropertyDefaultValue(property));
101
+ }
102
+ };
103
+ WShading.prototype.destroy = function () {
104
+ if (!isNullOrUndefined(this.uniqueShadingFormat)) {
105
+ WShading.uniqueShadingFormats.remove(this.uniqueShadingFormat);
106
+ }
107
+ this.uniqueShadingFormat = undefined;
108
+ };
109
+ WShading.prototype.cloneFormat = function () {
110
+ var shading = new WShading(undefined);
111
+ shading.backgroundColor = this.backgroundColor;
112
+ shading.foregroundColor = this.foregroundColor;
113
+ shading.textureStyle = this.textureStyle;
114
+ return shading;
115
+ };
116
+ WShading.prototype.copyFormat = function (shading) {
117
+ if (!isNullOrUndefined(shading) && !isNullOrUndefined(shading.uniqueShadingFormat)) {
118
+ this.backgroundColor = shading.backgroundColor;
119
+ this.foregroundColor = shading.foregroundColor;
120
+ this.textureStyle = shading.textureStyle;
121
+ }
122
+ };
123
+ WShading.prototype.hasValue = function (property) {
124
+ if (!isNullOrUndefined(this.uniqueShadingFormat)) {
125
+ var propertyType = WUniqueFormat.getPropertyType(this.uniqueShadingFormat.uniqueFormatType, property);
126
+ return this.uniqueShadingFormat.propertiesHash.containsKey(propertyType);
127
+ }
128
+ return false;
129
+ };
130
+ WShading.clear = function () {
131
+ this.uniqueShadingFormats.clear();
132
+ };
133
+ WShading.uniqueShadingFormats = new WUniqueFormats();
134
+ WShading.uniqueFormatType = 5;
135
+ return WShading;
136
+ }());
137
+ export { WShading };
@@ -0,0 +1,106 @@
1
+ import { StyleType } from '../base/index';
2
+ import { WParagraphFormat } from './paragraph-format';
3
+ import { WCharacterFormat } from './character-format';
4
+ /**
5
+ * @private
6
+ */
7
+ export declare abstract class WStyle {
8
+ ownerBase: Object;
9
+ type: StyleType;
10
+ next: WStyle;
11
+ basedOn: WStyle;
12
+ link: WStyle;
13
+ name: string;
14
+ }
15
+ /**
16
+ * @private
17
+ */
18
+ export declare class WParagraphStyle extends WStyle {
19
+ /**
20
+ * Specifies the paragraph format
21
+ *
22
+ * @default undefined
23
+ */
24
+ paragraphFormat: WParagraphFormat;
25
+ /**
26
+ * Specifies the character format
27
+ *
28
+ * @default undefined
29
+ */
30
+ characterFormat: WCharacterFormat;
31
+ constructor(node?: Object);
32
+ /**
33
+ * @private
34
+ * @returns {void}
35
+ */
36
+ clear(): void;
37
+ /**
38
+ * Disposes the internal objects which are maintained.
39
+ *
40
+ * @private
41
+ * @returns {void}
42
+ */
43
+ destroy(): void;
44
+ copyStyle(paraStyle: WParagraphStyle): void;
45
+ }
46
+ /**
47
+ * @private
48
+ */
49
+ export declare class WCharacterStyle extends WStyle {
50
+ /**
51
+ * Specifies the character format
52
+ *
53
+ * @default undefined
54
+ */
55
+ characterFormat: WCharacterFormat;
56
+ constructor(node?: Object);
57
+ /**
58
+ * @private
59
+ * @returns {void}
60
+ */
61
+ clear(): void;
62
+ /**
63
+ * Disposes the internal objects which are maintained.
64
+ *
65
+ * @private
66
+ * @returns {void}
67
+ */
68
+ destroy(): void;
69
+ copyStyle(charStyle: WCharacterStyle): void;
70
+ }
71
+ /**
72
+ * @private
73
+ */
74
+ export declare class WTableStyle extends WStyle {
75
+ constructor(node?: Object);
76
+ /**
77
+ * Disposes the internal objects which are maintained.
78
+ *
79
+ * @private
80
+ * @returns {void}
81
+ */
82
+ destroy(): void;
83
+ }
84
+ /**
85
+ * @private
86
+ */
87
+ export declare class WStyles {
88
+ collection: Object[];
89
+ readonly length: number;
90
+ remove(item: WParagraphStyle | WCharacterStyle): void;
91
+ push(item: WParagraphStyle | WCharacterStyle): number;
92
+ getItem(index: number): Object;
93
+ indexOf(item: WParagraphStyle | WCharacterStyle): number;
94
+ contains(item: WParagraphStyle | WCharacterStyle): boolean;
95
+ clear(): void;
96
+ findByName(name: string, type?: StyleType): Object;
97
+ getStyleNames(type?: StyleType): string[];
98
+ getStyles(type?: StyleType): Object[];
99
+ /**
100
+ * Disposes the internal objects which are maintained.
101
+ *
102
+ * @private
103
+ * @returns {void}
104
+ */
105
+ destroy(): void;
106
+ }
@@ -0,0 +1,286 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import { WParagraphFormat } from './paragraph-format';
15
+ import { WCharacterFormat } from './character-format';
16
+ import { LayoutHelperMethods } from '../helper/layout-helper-methods';
17
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
18
+ /**
19
+ * @private
20
+ */
21
+ var WStyle = /** @class */ (function () {
22
+ function WStyle() {
23
+ }
24
+ return WStyle;
25
+ }());
26
+ export { WStyle };
27
+ /**
28
+ * @private
29
+ */
30
+ var WParagraphStyle = /** @class */ (function (_super) {
31
+ __extends(WParagraphStyle, _super);
32
+ function WParagraphStyle(node) {
33
+ var _this = _super.call(this) || this;
34
+ _this.ownerBase = node;
35
+ _this.paragraphFormat = new WParagraphFormat(_this);
36
+ _this.characterFormat = new WCharacterFormat(_this);
37
+ return _this;
38
+ }
39
+ /**
40
+ * @private
41
+ * @returns {void}
42
+ */
43
+ WParagraphStyle.prototype.clear = function () {
44
+ if (this.characterFormat) {
45
+ this.characterFormat.clearFormat();
46
+ }
47
+ if (this.paragraphFormat) {
48
+ this.paragraphFormat.clearFormat();
49
+ }
50
+ };
51
+ /**
52
+ * Disposes the internal objects which are maintained.
53
+ *
54
+ * @private
55
+ * @returns {void}
56
+ */
57
+ WParagraphStyle.prototype.destroy = function () {
58
+ if (this.characterFormat) {
59
+ this.characterFormat.destroy();
60
+ this.characterFormat = undefined;
61
+ }
62
+ if (this.paragraphFormat) {
63
+ this.paragraphFormat.destroy();
64
+ this.paragraphFormat = undefined;
65
+ }
66
+ this.ownerBase = undefined;
67
+ this.name = undefined;
68
+ this.next = undefined;
69
+ this.basedOn = undefined;
70
+ this.link = undefined;
71
+ };
72
+ WParagraphStyle.prototype.copyStyle = function (paraStyle) {
73
+ this.name = paraStyle.name;
74
+ this.ownerBase = paraStyle.ownerBase;
75
+ this.type = paraStyle.type;
76
+ this.next = paraStyle.next;
77
+ this.basedOn = paraStyle.basedOn;
78
+ this.link = paraStyle.link;
79
+ this.characterFormat.copyFormat(paraStyle.characterFormat);
80
+ this.paragraphFormat.copyFormat(paraStyle.paragraphFormat);
81
+ };
82
+ return WParagraphStyle;
83
+ }(WStyle));
84
+ export { WParagraphStyle };
85
+ /**
86
+ * @private
87
+ */
88
+ var WCharacterStyle = /** @class */ (function (_super) {
89
+ __extends(WCharacterStyle, _super);
90
+ function WCharacterStyle(node) {
91
+ var _this = _super.call(this) || this;
92
+ _this.ownerBase = node;
93
+ _this.characterFormat = new WCharacterFormat(_this);
94
+ return _this;
95
+ }
96
+ /**
97
+ * @private
98
+ * @returns {void}
99
+ */
100
+ WCharacterStyle.prototype.clear = function () {
101
+ if (this.characterFormat) {
102
+ this.characterFormat.clearFormat();
103
+ }
104
+ };
105
+ /**
106
+ * Disposes the internal objects which are maintained.
107
+ *
108
+ * @private
109
+ * @returns {void}
110
+ */
111
+ WCharacterStyle.prototype.destroy = function () {
112
+ if (this.characterFormat) {
113
+ this.characterFormat.destroy();
114
+ this.characterFormat = undefined;
115
+ }
116
+ this.ownerBase = undefined;
117
+ this.name = undefined;
118
+ this.next = undefined;
119
+ this.basedOn = undefined;
120
+ this.link = undefined;
121
+ };
122
+ WCharacterStyle.prototype.copyStyle = function (charStyle) {
123
+ this.name = charStyle.name;
124
+ this.ownerBase = charStyle.ownerBase;
125
+ this.type = charStyle.type;
126
+ this.next = charStyle.next;
127
+ this.basedOn = charStyle.basedOn;
128
+ this.characterFormat.copyFormat(charStyle.characterFormat);
129
+ };
130
+ return WCharacterStyle;
131
+ }(WStyle));
132
+ export { WCharacterStyle };
133
+ /**
134
+ * @private
135
+ */
136
+ var WTableStyle = /** @class */ (function (_super) {
137
+ __extends(WTableStyle, _super);
138
+ function WTableStyle(node) {
139
+ var _this = _super.call(this) || this;
140
+ _this.ownerBase = node;
141
+ return _this;
142
+ }
143
+ /**
144
+ * Disposes the internal objects which are maintained.
145
+ *
146
+ * @private
147
+ * @returns {void}
148
+ */
149
+ WTableStyle.prototype.destroy = function () {
150
+ this.ownerBase = undefined;
151
+ this.name = undefined;
152
+ this.next = undefined;
153
+ this.basedOn = undefined;
154
+ this.link = undefined;
155
+ };
156
+ return WTableStyle;
157
+ }(WStyle));
158
+ export { WTableStyle };
159
+ /**
160
+ * @private
161
+ */
162
+ var WStyles = /** @class */ (function () {
163
+ function WStyles() {
164
+ this.collection = [];
165
+ /* eslint-enable @typescript-eslint/no-explicit-any */
166
+ }
167
+ Object.defineProperty(WStyles.prototype, "length", {
168
+ get: function () {
169
+ return this.collection.length;
170
+ },
171
+ enumerable: true,
172
+ configurable: true
173
+ });
174
+ WStyles.prototype.remove = function (item) {
175
+ this.collection = this.collection.filter(function (a) { return (a.name !== item.name); });
176
+ };
177
+ WStyles.prototype.push = function (item) {
178
+ if (item != null && item !== undefined) {
179
+ this.collection.push(item);
180
+ }
181
+ return 1;
182
+ };
183
+ WStyles.prototype.getItem = function (index) {
184
+ if (this.collection.length > index) {
185
+ return this.collection[parseInt(index.toString(), 10)];
186
+ }
187
+ return null;
188
+ };
189
+ WStyles.prototype.indexOf = function (item) {
190
+ return this.collection.indexOf(item);
191
+ };
192
+ WStyles.prototype.contains = function (item) {
193
+ var index = this.collection.indexOf(item);
194
+ return index > -1 && index < this.collection.length;
195
+ };
196
+ WStyles.prototype.clear = function () {
197
+ if (this.collection && this.collection.length > 0) {
198
+ for (var i = 0; i < this.collection.length; i++) {
199
+ var style = this.collection[parseInt(i.toString(), 10)];
200
+ if (style instanceof WCharacterStyle) {
201
+ style.clear();
202
+ }
203
+ else if (style instanceof WParagraphStyle) {
204
+ style.clear();
205
+ }
206
+ }
207
+ }
208
+ this.collection = [];
209
+ };
210
+ WStyles.prototype.findByName = function (name, type) {
211
+ var returnStyle;
212
+ for (var _i = 0, _a = this.collection; _i < _a.length; _i++) {
213
+ var value = _a[_i];
214
+ if (value.name === name) {
215
+ returnStyle = value;
216
+ if (!isNullOrUndefined(type)) {
217
+ if (value.type !== type) {
218
+ returnStyle = undefined;
219
+ }
220
+ }
221
+ }
222
+ }
223
+ return returnStyle;
224
+ };
225
+ WStyles.prototype.getStyleNames = function (type) {
226
+ return this.collection.filter(function (a) { return (a.type === type); }).map(function (a) {
227
+ return a.name;
228
+ });
229
+ };
230
+ /* eslint-disable @typescript-eslint/no-explicit-any */
231
+ WStyles.prototype.getStyles = function (type) {
232
+ var styles = this.collection.filter(function (a) { return (a.type === type); }).map(function (a) {
233
+ return a;
234
+ });
235
+ var styleObjects = [];
236
+ for (var _i = 0, styles_1 = styles; _i < styles_1.length; _i++) {
237
+ var style = styles_1[_i];
238
+ var returnStyle = {};
239
+ var returnStyleObject = {};
240
+ if (type === 'Paragraph') {
241
+ returnStyleObject.paragraphFormat = {};
242
+ LayoutHelperMethods.writeParagraphFormat(returnStyleObject.paragraphFormat, true, style.paragraphFormat);
243
+ }
244
+ if (type !== 'Table') {
245
+ returnStyleObject.characterFormat = {};
246
+ LayoutHelperMethods.writeCharacterFormat(returnStyleObject.characterFormat, true, style.characterFormat);
247
+ }
248
+ returnStyle.name = style.name;
249
+ returnStyle.style = JSON.stringify(returnStyleObject);
250
+ if (!isNullOrUndefined(type)) {
251
+ returnStyle.type = type;
252
+ if (returnStyle.type === 'Paragraph' && !isNullOrUndefined(style.link)) {
253
+ returnStyle.type = 'Linked';
254
+ }
255
+ }
256
+ styleObjects.push(returnStyle);
257
+ }
258
+ return styleObjects;
259
+ };
260
+ /**
261
+ * Disposes the internal objects which are maintained.
262
+ *
263
+ * @private
264
+ * @returns {void}
265
+ */
266
+ WStyles.prototype.destroy = function () {
267
+ if (this.collection && this.collection.length > 0) {
268
+ for (var i = 0; i < this.collection.length; i++) {
269
+ var style = this.collection[parseInt(i.toString(), 10)];
270
+ if (style instanceof WCharacterStyle) {
271
+ style.destroy();
272
+ }
273
+ else if (style instanceof WParagraphStyle) {
274
+ style.destroy();
275
+ }
276
+ else if (style instanceof WTableStyle) {
277
+ style.destroy();
278
+ }
279
+ }
280
+ }
281
+ this.collection = [];
282
+ this.collection = undefined;
283
+ };
284
+ return WStyles;
285
+ }());
286
+ export { WStyles };
@@ -0,0 +1,51 @@
1
+ import { TableAlignment, WidthType, HorizontalAlignment } from '../base/types';
2
+ import { WBorders } from './borders';
3
+ import { WShading } from './shading';
4
+ import { TableWidget } from '../page';
5
+ /**
6
+ * @private
7
+ */
8
+ export declare class WTableFormat {
9
+ private uniqueTableFormat;
10
+ private static uniqueTableFormats;
11
+ private static uniqueFormatType;
12
+ borders: WBorders;
13
+ shading: WShading;
14
+ private _title;
15
+ _description: string;
16
+ ownerBase: TableWidget;
17
+ private _styleName;
18
+ /**
19
+ * @private
20
+ */
21
+ isRTFTable: boolean;
22
+ title: string;
23
+ description: string;
24
+ allowAutoFit: boolean;
25
+ cellSpacing: number;
26
+ leftMargin: number;
27
+ topMargin: number;
28
+ rightMargin: number;
29
+ bottomMargin: number;
30
+ tableAlignment: TableAlignment;
31
+ leftIndent: number;
32
+ preferredWidth: number;
33
+ preferredWidthType: WidthType;
34
+ bidi: boolean;
35
+ horizontalPositionAbs: HorizontalAlignment;
36
+ horizontalPosition: number;
37
+ styleName: string;
38
+ constructor(owner?: TableWidget);
39
+ getPropertyValue(property: string): Object;
40
+ private setPropertyValue;
41
+ private initializeUniqueTableFormat;
42
+ private addUniqueTableFormat;
43
+ private static getPropertyDefaultValue;
44
+ private assignTableMarginValue;
45
+ initializeTableBorders(): void;
46
+ destroy(): void;
47
+ cloneFormat(): WTableFormat;
48
+ hasValue(property: string): boolean;
49
+ copyFormat(format: WTableFormat): void;
50
+ static clear(): void;
51
+ }