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 | 1×
1×
1×
1×
1×
560×
560×
560×
560×
560×
80×
80×
560×
560×
560×
560×
560×
1×
400×
400×
400×
400×
400×
400×
400×
1×
80×
80×
80×
80×
80×
80×
1×
1×
5×
5×
5×
1×
5×
5×
30×
30×
30×
30×
1×
6×
6×
6×
6×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
5×
5×
5×
5×
5×
1×
1×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var BulletListHelper = (function () {
function BulletListHelper() {
}
BulletListHelper.createBulletListTag = function (ulTag, iconCss, isNone, localObj) {
var liTag = ej2_base_1.createElement('li', {
styles: 'display:block;',
className: 'e-de-floating-menuitem e-de-floating-bullet-menuitem-md e-de-list-items e-de-list-item-size'
});
var liInnerDiv = ej2_base_1.createElement('div', {
className: 'e-de-bullet-list-header-presetmenu'
});
var spanDiv = ej2_base_1.createElement('div', {
styles: isNone ? 'font-size:8px;text-align: center;top: 8px;line-height:normal' : ''
});
var span = ej2_base_1.createElement('span', {
className: !isNone ? iconCss : ''
});
if (isNone) {
liInnerDiv.style.display = 'inline-table';
span.textContent = localObj.getConstant('None');
}
spanDiv.appendChild(span);
liInnerDiv.appendChild(spanDiv);
liTag.appendChild(liInnerDiv);
ulTag.appendChild(liTag);
return liTag;
};
BulletListHelper.createNumberListTag = function (ulTag, text1, text2, text3) {
var liTag = ej2_base_1.createElement('li', {
styles: 'display:block',
className: 'e-de-floating-menuitem e-de-floating-menuitem-md e-de-list-items e-de-list-item-size'
});
ulTag.appendChild(liTag);
var innerHTML = '<div>' + text1 + '<span class="e-de-list-line"></span></div><div>' + text2 + '<span class="e-de-list-line">';
innerHTML += '</span></div><div>' + text3 + '<span class="e-de-list-line"> </span></div >';
var liInnerDiv = ej2_base_1.createElement('div', {
className: 'e-de-list-header-presetmenu',
innerHTML: innerHTML
});
liTag.appendChild(liInnerDiv);
return liTag;
};
BulletListHelper.createNumberNoneListTag = function (ulTag, localObj) {
var liTag = ej2_base_1.createElement('li', {
styles: 'display:block;',
className: 'e-de-floating-menuitem e-de-floating-menuitem-md e-de-list-items e-de-list-item-size'
});
ulTag.appendChild(liTag);
var innerHTML = '<div><span class="e-de-bullets">' + localObj.getConstant('None') + '</span></div>';
var liInnerDiv = ej2_base_1.createElement('div', {
className: 'e-de-list-header-presetmenu',
styles: 'position:relative;left:11px;top:13px',
innerHTML: innerHTML
});
liTag.appendChild(liInnerDiv);
return liTag;
};
BulletListHelper.updateSelectedBulletListType = function (listText, bulletElements) {
var _a;
var bulletMap = (_a = {},
_a[String.fromCharCode(61623)] = 'dot',
_a[String.fromCharCode(61551) + String.fromCharCode(32)] = 'circle',
_a[String.fromCharCode(61607)] = 'square',
_a[String.fromCharCode(61558)] = 'flower',
_a[String.fromCharCode(61656)] = 'arrow',
_a[String.fromCharCode(61692)] = 'tick',
_a);
var elementKey = bulletMap[listText];
if (bulletElements[elementKey]) {
bulletElements[elementKey].classList.add('de-list-item-selected');
}
};
BulletListHelper.updateSelectedNumberedListType = function (listText, numberElements) {
var patternMap = {
'Arabic': 'number',
'UpRoman': 'uproman',
'UpLetter': 'upletter',
'LowLetter': 'lowletter',
'LowRoman': 'lowroman'
};
var elementKey = patternMap[listText];
Iif (numberElements[elementKey]) {
numberElements[elementKey].classList.add('de-list-item-selected');
}
};
BulletListHelper.removeSelectedList = function (elements) {
var className = 'de-list-item-selected';
for (var key in elements) {
Eif (Object.prototype.hasOwnProperty.call(elements, key)) {
var element = elements[key];
Eif (element) {
element.classList.remove(className);
}
}
}
};
BulletListHelper.getLevelFormatNumber = function (documentEditor) {
var numberFormat = '%';
var levelNumber = documentEditor.selectionModule.paragraphFormat.listLevelNumber;
numberFormat = numberFormat + (((levelNumber <= 0) ? 0 : levelNumber) + 1) + '.';
return numberFormat;
};
BulletListHelper.applyBulletStyle = function (documentEditor, style, appliedBulletStyle) {
Iif (style === 'none') {
BulletListHelper.clearList(documentEditor);
return;
}
var bulletStyle = null;
for (var key in BulletListHelper.BULLET_STYLES) {
Eif (Object.prototype.hasOwnProperty.call(BulletListHelper.BULLET_STYLES, key)) {
var s = BulletListHelper.BULLET_STYLES[key];
Eif (s.style === style) {
bulletStyle = s;
break;
}
}
}
Eif (bulletStyle && !documentEditor.isReadOnly && documentEditor.editorModule) {
appliedBulletStyle.value = style;
documentEditor.editorModule.applyBullet(bulletStyle.char, bulletStyle.font);
setTimeout(function () {
documentEditor.focusIn();
}, 30);
}
};
BulletListHelper.clearList = function (documentEditor) {
Eif (!documentEditor.isReadOnly && documentEditor.editorModule) {
documentEditor.editorModule.clearList();
setTimeout(function () {
documentEditor.focusIn();
}, 30);
}
};
BulletListHelper.applyNumbering = function (documentEditor, pattern, appliedNumberingStyle) {
if (!documentEditor.isReadOnly && documentEditor.editorModule) {
appliedNumberingStyle.value = pattern.toLowerCase();
var format = BulletListHelper.getLevelFormatNumber(documentEditor);
documentEditor.editorModule.applyNumbering(format, pattern);
setTimeout(function () {
documentEditor.focusIn();
}, 30);
}
};
BulletListHelper.getCurrentListPattern = function (documentEditor) {
var levelPattern = 'None';
Eif (!ej2_base_1.isNullOrUndefined(documentEditor.selectionModule.paragraphFormat)) {
Eif (ej2_base_1.isNullOrUndefined(documentEditor.selectionModule.paragraphFormat.listId) ||
documentEditor.selectionModule.paragraphFormat.listId === -1) {
levelPattern = 'None';
}
else {
var list = documentEditor.documentHelper.getListById(documentEditor.selectionModule.paragraphFormat.listId);
var abstractList = documentEditor.documentHelper.getAbstractListById(list.abstractListId);
var startParagraph = documentEditor.selectionModule.isForward ?
documentEditor.selectionModule.start.paragraph : documentEditor.selectionModule.end.paragraph;
var level = abstractList.levels[startParagraph.paragraphFormat.listFormat.listLevelNumber];
levelPattern = level.listLevelPattern;
}
}
return levelPattern;
};
BulletListHelper.getCurrentListText = function (documentEditor) {
if (ej2_base_1.isNullOrUndefined(documentEditor.selectionModule.paragraphFormat.listId) ||
documentEditor.selectionModule.paragraphFormat.listId === -1) {
return documentEditor.selectionModule.paragraphFormat.listText;
}
else {
var startParagraph = documentEditor.selectionModule.isForward ?
documentEditor.selectionModule.start.paragraph : documentEditor.selectionModule.end.paragraph;
return startParagraph.paragraphFormat.listFormat.listLevel.numberFormat;
}
};
BulletListHelper.BULLET_STYLES = {
DOT: { style: 'dot', char: String.fromCharCode(61623), font: 'Symbol' },
CIRCLE: { style: 'circle', char: String.fromCharCode(61551) + String.fromCharCode(32), font: 'Symbol' },
SQUARE: { style: 'square', char: String.fromCharCode(61607), font: 'Wingdings' },
FLOWER: { style: 'flower', char: String.fromCharCode(61558), font: 'Wingdings' },
ARROW: { style: 'arrow', char: String.fromCharCode(61656), font: 'Wingdings' },
TICK: { style: 'tick', char: String.fromCharCode(61692), font: 'Wingdings' }
};
return BulletListHelper;
}());
exports.BulletListHelper = BulletListHelper;
});
|