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 | 1×
1×
1×
1×
154×
154×
2×
2×
154×
2×
2×
2×
2×
2×
2×
2×
2×
154×
1×
14468×
1×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
1×
11×
11×
11×
11×
10×
11×
8×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
11×
1×
209×
11×
10×
11×
209×
11×
10×
11×
209×
11×
11×
209×
11×
11×
209×
209×
209×
209×
209×
11×
10×
11×
11×
1×
209×
11×
11×
209×
11×
11×
209×
11×
11×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-inputs", "@syncfusion/ej2-base", "@syncfusion/ej2-popups"], function (require, exports, ej2_inputs_1, ej2_base_1, ej2_popups_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var TableDialog = (function () {
function TableDialog(documentHelper) {
var _this = this;
this.onCancelButtonClick = function () {
_this.documentHelper.dialog.hide();
_this.documentHelper.updateFocus();
};
this.onInsertTableClick = function () {
Iif (_this.columnValueTexBox.value < 1 || _this.columnValueTexBox.value
> _this.documentHelper.owner.documentEditorSettings.maximumColumns) {
var columnAlertPopup = _this.localeValue.getConstant('Number of columns must be between') + ' 1 ' + _this.localeValue.getConstant('and') + ' ' + _this.documentHelper.owner.documentEditorSettings.maximumColumns.toString();
ej2_popups_1.DialogUtility.alert(columnAlertPopup).enableRtl = _this.documentHelper.owner.enableRtl;
return;
}
Iif (_this.rowValueTextBox.value < 1 || _this.rowValueTextBox.value > _this.documentHelper.owner.documentEditorSettings.maximumRows) {
var rowAlertPopup = _this.localeValue.getConstant('Number of rows must be between') + ' 1 ' + _this.localeValue.getConstant('and') + ' ' + _this.documentHelper.owner.documentEditorSettings.maximumColumns.toString();
ej2_popups_1.DialogUtility.alert(rowAlertPopup).enableRtl = _this.documentHelper.owner.enableRtl;
return;
}
Eif (_this.rowValueTextBox.value <= _this.documentHelper.owner.documentEditorSettings.maximumRows
&& _this.columnValueTexBox.value <= _this.documentHelper.owner.documentEditorSettings.maximumColumns) {
var rowCount = _this.rowValueTextBox.value;
var columnCount = _this.columnValueTexBox.value;
Eif (!(ej2_base_1.isNullOrUndefined(rowCount) && ej2_base_1.isNullOrUndefined(columnCount))) {
_this.documentHelper.owner.editorModule.insertTable(rowCount, columnCount);
}
_this.documentHelper.hideDialog();
}
};
this.documentHelper = documentHelper;
}
TableDialog.prototype.getModuleName = function () {
return 'TableDialog';
};
TableDialog.prototype.initTableDialog = function (localValue) {
this.target = ej2_base_1.createElement('div', { className: 'e-de-insert-table' });
this.parentDiv = ej2_base_1.createElement('div');
this.columnValue = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
this.columnsCountBox = ej2_base_1.createElement('input', {
attrs: { type: 'text' }
});
this.columnValue.appendChild(this.columnsCountBox);
this.columnsCountBox.setAttribute('aria-labelledby', localValue.getConstant('Insert Table'));
this.rowValue = ej2_base_1.createElement('div');
this.rowsCountBox = ej2_base_1.createElement('input', {
attrs: { type: 'text' }
});
this.rowValue.appendChild(this.rowsCountBox);
this.parentDiv.appendChild(this.columnValue);
this.parentDiv.appendChild(this.rowValue);
this.target.appendChild(this.parentDiv);
this.rowValueTextBox = new ej2_inputs_1.NumericTextBox({
format: '#',
value: 2,
min: 1,
strictMode: true,
enablePersistence: false,
placeholder: localValue.getConstant('Number of rows'),
floatLabelType: 'Always'
});
this.rowValueTextBox.appendTo(this.rowsCountBox);
this.rowsCountBox.setAttribute('aria-labelledby', localValue.getConstant('Number of rows'));
this.columnValueTexBox = new ej2_inputs_1.NumericTextBox({
format: '#',
value: 2,
min: 1,
strictMode: true,
enablePersistence: false,
placeholder: localValue.getConstant('Number of columns'),
floatLabelType: 'Always'
});
this.columnsCountBox.setAttribute('aria-labelledby', localValue.getConstant('Number of columns'));
this.parentDiv.setAttribute('aria-labelledby', localValue.getConstant('Insert Table'));
this.parentDiv.setAttribute('aria-describedby', localValue.getConstant('Insert Table'));
this.columnValueTexBox.appendTo(this.columnsCountBox);
};
TableDialog.prototype.show = function () {
var localValue = new ej2_base_1.L10n('documenteditor', this.documentHelper.owner.defaultLocale);
localValue.setLocale(this.documentHelper.owner.locale);
this.localeValue = localValue;
if (!this.target) {
this.initTableDialog(localValue);
}
if (this.documentHelper.selection.caret.style.display !== 'none') {
this.documentHelper.selection.caret.style.display = 'none';
}
this.documentHelper.dialog.header = localValue.getConstant('Insert Table');
this.documentHelper.dialog.height = 'auto';
this.documentHelper.dialog.width = 'auto';
this.documentHelper.dialog.content = this.target;
this.documentHelper.dialog.beforeOpen = this.documentHelper.updateFocus;
this.documentHelper.dialog.buttons = [{
click: this.onInsertTableClick,
buttonModel: { content: localValue.getConstant('Ok'), cssClass: 'e-flat e-table-ok', isPrimary: true }
},
{
click: this.onCancelButtonClick,
buttonModel: { content: localValue.getConstant('Cancel'), cssClass: 'e-flat e-table-cancel' }
}];
this.rowValueTextBox.value = 2;
this.columnValueTexBox.value = 2;
this.documentHelper.dialog.close = this.documentHelper.updateFocus;
this.documentHelper.dialog.dataBind();
this.columnValueTexBox.focusIn();
this.documentHelper.dialog.show();
};
TableDialog.prototype.destroy = function () {
if (this.columnsCountBox) {
if (this.columnsCountBox.parentElement) {
this.columnsCountBox.parentElement.removeChild(this.columnsCountBox);
}
this.columnsCountBox = undefined;
}
if (this.rowsCountBox) {
if (this.rowsCountBox.parentElement) {
this.rowsCountBox.parentElement.removeChild(this.rowsCountBox);
}
this.rowsCountBox = undefined;
}
if (this.columnValueTexBox) {
this.columnValueTexBox.destroy();
this.columnValueTexBox = undefined;
}
if (this.rowValueTextBox) {
this.rowValueTextBox.destroy();
this.rowValueTextBox = undefined;
}
this.columnsCountBox = undefined;
this.rowsCountBox = undefined;
this.documentHelper = undefined;
this.removeElements();
if (!ej2_base_1.isNullOrUndefined(this.target)) {
if (this.target.parentElement) {
this.target.parentElement.removeChild(this.target);
}
for (var i = 0; i < this.target.childNodes.length; i++) {
this.target.removeChild(this.target.childNodes[parseInt(i.toString(), 10)]);
i--;
}
this.target = undefined;
}
};
TableDialog.prototype.removeElements = function () {
if (this.parentDiv) {
this.parentDiv.remove();
this.parentDiv = undefined;
}
if (this.columnValue) {
this.columnValue.remove();
this.columnValue = undefined;
}
if (this.rowValue) {
this.rowValue.remove();
this.rowValue = undefined;
}
};
return TableDialog;
}());
exports.TableDialog = TableDialog;
});
|