@syncfusion/ej2-base 19.2.55 → 19.3.47
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.
- package/.eslintrc.json +1 -1
- package/CHANGELOG.md +1 -89
- package/README.md +1 -1
- package/dist/ej2-base.umd.min.js +2 -2
- package/dist/ej2-base.umd.min.js.map +1 -1
- package/dist/es6/ej2-base.es2015.js +2650 -2401
- package/dist/es6/ej2-base.es2015.js.map +1 -1
- package/dist/es6/ej2-base.es5.js +3186 -2948
- package/dist/es6/ej2-base.es5.js.map +1 -1
- package/dist/global/ej2-base.min.js +2 -2
- package/dist/global/ej2-base.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/e2e/crypto.js +1 -1
- package/e2e/index.d.ts +0 -3
- package/e2e/m.protractor.config.js +1 -1
- package/e2e/protractor.config.js +1 -1
- package/helpers/e2e/base.js +3 -3
- package/package.json +7 -64
- package/src/ajax.d.ts +24 -10
- package/src/ajax.js +14 -6
- package/src/animation-model.d.ts +12 -4
- package/src/animation.d.ts +37 -12
- package/src/animation.js +48 -22
- package/src/base.d.ts +31 -11
- package/src/base.js +34 -16
- package/src/browser.d.ts +63 -25
- package/src/browser.js +60 -15
- package/src/child-property.d.ts +21 -10
- package/src/child-property.js +23 -13
- package/src/component-model.d.ts +4 -1
- package/src/component.d.ts +42 -5
- package/src/component.js +52 -35
- package/src/dom.d.ts +76 -25
- package/src/dom.js +128 -124
- package/src/draggable-model.d.ts +5 -0
- package/src/draggable.d.ts +4 -1
- package/src/draggable.js +8 -2
- package/src/droppable-model.d.ts +7 -4
- package/src/droppable.d.ts +7 -3
- package/src/droppable.js +1 -0
- package/src/event-handler.d.ts +10 -6
- package/src/event-handler.js +11 -7
- package/src/hijri-parser.d.ts +12 -0
- package/src/hijri-parser.js +111 -90
- package/src/internationalization.d.ts +54 -21
- package/src/internationalization.js +55 -18
- package/src/intl/date-formatter.d.ts +19 -8
- package/src/intl/date-formatter.js +36 -13
- package/src/intl/date-parser.d.ts +30 -23
- package/src/intl/date-parser.js +61 -42
- package/src/intl/intl-base.d.ts +123 -46
- package/src/intl/intl-base.js +451 -377
- package/src/intl/number-formatter.d.ts +45 -34
- package/src/intl/number-formatter.js +47 -35
- package/src/intl/number-parser.d.ts +11 -8
- package/src/intl/number-parser.js +14 -11
- package/src/intl/parser-base.d.ts +38 -13
- package/src/intl/parser-base.js +45 -16
- package/src/keyboard-model.d.ts +5 -2
- package/src/keyboard.d.ts +26 -8
- package/src/keyboard.js +24 -9
- package/src/l10n.d.ts +16 -7
- package/src/l10n.js +16 -7
- package/src/module-loader.d.ts +13 -8
- package/src/module-loader.js +13 -9
- package/src/notify-property-change.d.ts +19 -7
- package/src/notify-property-change.js +140 -24
- package/src/observer.d.ts +17 -5
- package/src/observer.js +19 -7
- package/src/sanitize-helper.d.ts +1 -0
- package/src/sanitize-helper.js +1 -1
- package/src/template-engine.d.ts +30 -4
- package/src/template-engine.js +37 -12
- package/src/template.d.ts +8 -3
- package/src/template.js +67 -19
- package/src/touch-model.d.ts +11 -4
- package/src/touch.d.ts +51 -9
- package/src/touch.js +45 -13
- package/src/util.d.ts +67 -37
- package/src/util.js +99 -49
- package/styles/_bootstrap-definition.scss +0 -1
- package/styles/_bootstrap5-dark-definition.scss +10 -0
- package/styles/_bootstrap5-definition.scss +9 -0
- package/styles/_fabric-dark-definition.scss +0 -1
- package/styles/_highcontrast-light-definition.scss +1 -0
- package/styles/_material-definition.scss +1 -0
- package/styles/bootstrap-dark.css +2613 -32
- package/styles/bootstrap.css +2613 -32
- package/styles/bootstrap4.css +2149 -32
- package/styles/bootstrap5-dark.css +2157 -0
- package/styles/bootstrap5-dark.scss +3 -0
- package/styles/bootstrap5.css +2157 -0
- package/styles/bootstrap5.scss +3 -0
- package/styles/common/_core.scss +28 -63
- package/styles/definition/_bootstrap-dark.scss +3 -3
- package/styles/definition/_bootstrap.scss +1 -1
- package/styles/definition/_bootstrap5-dark.scss +357 -0
- package/styles/definition/_bootstrap5.scss +356 -0
- package/styles/definition/_material-dark.scss +1 -1
- package/styles/definition/_tailwind-dark.scss +18 -1
- package/styles/definition/_tailwind.scss +17 -0
- package/styles/fabric-dark.css +2589 -32
- package/styles/fabric.css +2589 -32
- package/styles/highcontrast-light.css +2573 -32
- package/styles/highcontrast.css +2573 -32
- package/styles/material-dark.css +2549 -32
- package/styles/material.css +2549 -32
- package/styles/tailwind-dark.css +2221 -32
- package/styles/tailwind.css +2221 -32
- package/src/virtual-dom.d.ts +0 -32
- package/src/virtual-dom.js +0 -449
package/src/dom.js
CHANGED
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { EventHandler } from './event-handler';
|
|
5
5
|
import { isNullOrUndefined, getValue, setValue, isObject, extend } from './util';
|
|
6
|
-
import { VirtualDOM } from './virtual-dom';
|
|
7
6
|
var SVG_REG = /^svg|^path|^g/;
|
|
8
7
|
/**
|
|
9
8
|
* Function to create Html element.
|
|
10
|
-
*
|
|
11
|
-
* @param
|
|
12
|
-
* @param properties
|
|
13
|
-
* @param properties.
|
|
14
|
-
* @param properties.
|
|
15
|
-
* @param properties.
|
|
16
|
-
* @param properties.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} tagName - Name of the tag, id and class names.
|
|
11
|
+
* @param {ElementProperties} properties - Object to set properties in the element.
|
|
12
|
+
* @param {ElementProperties} properties.id - To set the id to the created element.
|
|
13
|
+
* @param {ElementProperties} properties.className - To add classes to the element.
|
|
14
|
+
* @param {ElementProperties} properties.innerHTML - To set the innerHTML to element.
|
|
15
|
+
* @param {ElementProperties} properties.styles - To set the some custom styles to element.
|
|
16
|
+
* @param {ElementProperties} properties.attrs - To set the attributes to element.
|
|
17
|
+
* @returns {any} ?
|
|
17
18
|
* @private
|
|
18
19
|
*/
|
|
19
20
|
export function createElement(tagName, properties) {
|
|
20
|
-
//tslint:disable-next-line
|
|
21
21
|
var element = (SVG_REG.test(tagName) ? document.createElementNS('http://www.w3.org/2000/svg', tagName) : document.createElement(tagName));
|
|
22
22
|
if (typeof (properties) === 'undefined') {
|
|
23
23
|
return element;
|
|
@@ -39,8 +39,10 @@ export function createElement(tagName, properties) {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* The function used to add the classes to array of elements
|
|
42
|
+
*
|
|
42
43
|
* @param {Element[]|NodeList} elements - An array of elements that need to add a list of classes
|
|
43
44
|
* @param {string|string[]} classes - String or array of string that need to add an individual element as a class
|
|
45
|
+
* @returns {any} .
|
|
44
46
|
* @private
|
|
45
47
|
*/
|
|
46
48
|
export function addClass(elements, classes) {
|
|
@@ -69,8 +71,10 @@ export function addClass(elements, classes) {
|
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
73
|
* The function used to add the classes to array of elements
|
|
74
|
+
*
|
|
72
75
|
* @param {Element[]|NodeList} elements - An array of elements that need to remove a list of classes
|
|
73
76
|
* @param {string|string[]} classes - String or array of string that need to add an individual element as a class
|
|
77
|
+
* @returns {any} .
|
|
74
78
|
* @private
|
|
75
79
|
*/
|
|
76
80
|
export function removeClass(elements, classes) {
|
|
@@ -82,7 +86,6 @@ export function removeClass(elements, classes) {
|
|
|
82
86
|
if (canRemove) {
|
|
83
87
|
for (var _b = 0, classList_2 = classList; _b < classList_2.length; _b++) {
|
|
84
88
|
var className = classList_2[_b];
|
|
85
|
-
/* istanbul ignore next */
|
|
86
89
|
if (flag) {
|
|
87
90
|
var classes_1 = getValue('attributes.className', ele);
|
|
88
91
|
var classArr = classes_1.split(' ');
|
|
@@ -100,6 +103,13 @@ export function removeClass(elements, classes) {
|
|
|
100
103
|
}
|
|
101
104
|
return elements;
|
|
102
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* The function used to get classlist.
|
|
108
|
+
*
|
|
109
|
+
* @param {string | string[]} classes - An element the need to check visibility
|
|
110
|
+
* @returns {string[]} ?
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
103
113
|
function getClassList(classes) {
|
|
104
114
|
var classList = [];
|
|
105
115
|
if (typeof classes === 'string') {
|
|
@@ -112,7 +122,9 @@ function getClassList(classes) {
|
|
|
112
122
|
}
|
|
113
123
|
/**
|
|
114
124
|
* The function used to check element is visible or not.
|
|
125
|
+
*
|
|
115
126
|
* @param {Element|Node} element - An element the need to check visibility
|
|
127
|
+
* @returns {boolean} ?
|
|
116
128
|
* @private
|
|
117
129
|
*/
|
|
118
130
|
export function isVisible(element) {
|
|
@@ -121,54 +133,51 @@ export function isVisible(element) {
|
|
|
121
133
|
}
|
|
122
134
|
/**
|
|
123
135
|
* The function used to insert an array of elements into a first of the element.
|
|
136
|
+
*
|
|
124
137
|
* @param {Element[]|NodeList} fromElements - An array of elements that need to prepend.
|
|
125
138
|
* @param {Element} toElement - An element that is going to prepend.
|
|
139
|
+
* @param {boolean} isEval - ?
|
|
140
|
+
* @returns {Element[] | NodeList} ?
|
|
126
141
|
* @private
|
|
127
142
|
*/
|
|
128
143
|
export function prepend(fromElements, toElement, isEval) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
144
|
+
var docFrag = document.createDocumentFragment();
|
|
145
|
+
for (var _i = 0, _a = fromElements; _i < _a.length; _i++) {
|
|
146
|
+
var ele = _a[_i];
|
|
147
|
+
docFrag.appendChild(ele);
|
|
132
148
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var ele = _a[_i];
|
|
137
|
-
docFrag.appendChild(ele);
|
|
138
|
-
}
|
|
139
|
-
toElement.insertBefore(docFrag, toElement.firstElementChild);
|
|
140
|
-
if (isEval) {
|
|
141
|
-
executeScript(toElement);
|
|
142
|
-
}
|
|
149
|
+
toElement.insertBefore(docFrag, toElement.firstElementChild);
|
|
150
|
+
if (isEval) {
|
|
151
|
+
executeScript(toElement);
|
|
143
152
|
}
|
|
144
153
|
return fromElements;
|
|
145
154
|
}
|
|
146
155
|
/**
|
|
147
156
|
* The function used to insert an array of elements into last of the element.
|
|
157
|
+
*
|
|
148
158
|
* @param {Element[]|NodeList} fromElements - An array of elements that need to append.
|
|
149
159
|
* @param {Element} toElement - An element that is going to prepend.
|
|
160
|
+
* @param {boolean} isEval - ?
|
|
161
|
+
* @returns {Element[] | NodeList} ?
|
|
150
162
|
* @private
|
|
151
163
|
*/
|
|
152
164
|
export function append(fromElements, toElement, isEval) {
|
|
153
|
-
|
|
154
|
-
|
|
165
|
+
var docFrag = document.createDocumentFragment();
|
|
166
|
+
for (var _i = 0, _a = fromElements; _i < _a.length; _i++) {
|
|
167
|
+
var ele = _a[_i];
|
|
168
|
+
docFrag.appendChild(ele);
|
|
155
169
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var ele = _a[_i];
|
|
160
|
-
docFrag.appendChild(ele);
|
|
161
|
-
}
|
|
162
|
-
toElement.appendChild(docFrag);
|
|
163
|
-
if (isEval) {
|
|
164
|
-
executeScript(toElement);
|
|
165
|
-
}
|
|
170
|
+
toElement.appendChild(docFrag);
|
|
171
|
+
if (isEval) {
|
|
172
|
+
executeScript(toElement);
|
|
166
173
|
}
|
|
167
174
|
return fromElements;
|
|
168
175
|
}
|
|
169
176
|
/**
|
|
170
177
|
* The function is used to evaluate script from Ajax request
|
|
171
|
-
*
|
|
178
|
+
*
|
|
179
|
+
* @param {Element} ele - An element is going to evaluate the script
|
|
180
|
+
* @returns {void} ?
|
|
172
181
|
*/
|
|
173
182
|
function executeScript(ele) {
|
|
174
183
|
var eleArray = ele.querySelectorAll('script');
|
|
@@ -180,49 +189,45 @@ function executeScript(ele) {
|
|
|
180
189
|
});
|
|
181
190
|
}
|
|
182
191
|
/**
|
|
183
|
-
* The function used to remove the element from
|
|
192
|
+
* The function used to remove the element from parentnode
|
|
193
|
+
*
|
|
184
194
|
* @param {Element|Node|HTMLElement} element - An element that is going to detach from the Dom
|
|
195
|
+
* @returns {any} ?
|
|
185
196
|
* @private
|
|
186
197
|
*/
|
|
198
|
+
// eslint-disable-next-line
|
|
187
199
|
export function detach(element) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
else {
|
|
192
|
-
var parentNode = element.parentNode;
|
|
193
|
-
if (parentNode) {
|
|
194
|
-
return parentNode.removeChild(element);
|
|
195
|
-
}
|
|
200
|
+
var parentNode = element.parentNode;
|
|
201
|
+
if (parentNode) {
|
|
202
|
+
return parentNode.removeChild(element);
|
|
196
203
|
}
|
|
197
204
|
}
|
|
198
|
-
//tslint: enable:no-any
|
|
199
205
|
/**
|
|
200
206
|
* The function used to remove the element from Dom also clear the bounded events
|
|
207
|
+
*
|
|
201
208
|
* @param {Element|Node|HTMLElement} element - An element remove from the Dom
|
|
209
|
+
* @returns {void} ?
|
|
202
210
|
* @private
|
|
203
211
|
*/
|
|
204
212
|
export function remove(element) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
else {
|
|
209
|
-
var parentNode = element.parentNode;
|
|
210
|
-
EventHandler.clearEvents(element);
|
|
211
|
-
parentNode.removeChild(element);
|
|
212
|
-
}
|
|
213
|
+
var parentNode = element.parentNode;
|
|
214
|
+
EventHandler.clearEvents(element);
|
|
215
|
+
parentNode.removeChild(element);
|
|
213
216
|
}
|
|
214
217
|
/**
|
|
215
218
|
* The function helps to set multiple attributes to an element
|
|
219
|
+
*
|
|
216
220
|
* @param {Element|Node} element - An element that need to set attributes.
|
|
217
|
-
* @param {
|
|
221
|
+
* @param {string} attributes - JSON Object that is going to as attributes.
|
|
222
|
+
* @returns {Element} ?
|
|
218
223
|
* @private
|
|
219
224
|
*/
|
|
225
|
+
// eslint-disable-next-line
|
|
220
226
|
export function attributes(element, attributes) {
|
|
221
227
|
var keys = Object.keys(attributes);
|
|
222
228
|
var ele = element;
|
|
223
229
|
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
224
230
|
var key = keys_1[_i];
|
|
225
|
-
/* istanbul ignore next */
|
|
226
231
|
if (isObject(ele)) {
|
|
227
232
|
var iKey = key;
|
|
228
233
|
if (key === 'tabindex') {
|
|
@@ -238,43 +243,44 @@ export function attributes(element, attributes) {
|
|
|
238
243
|
}
|
|
239
244
|
/**
|
|
240
245
|
* The function selects the element from giving context.
|
|
241
|
-
*
|
|
242
|
-
* @param {
|
|
246
|
+
*
|
|
247
|
+
* @param {string} selector - Selector string need fetch element
|
|
248
|
+
* @param {Document|Element} context - It is an optional type, That specifies a Dom context.
|
|
249
|
+
* @param {boolean} needsVDOM ?
|
|
250
|
+
* @returns {any} ?
|
|
243
251
|
* @private
|
|
244
252
|
*/
|
|
245
|
-
//
|
|
253
|
+
// eslint-disable-next-line
|
|
246
254
|
export function select(selector, context, needsVDOM) {
|
|
247
255
|
if (context === void 0) { context = document; }
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return VirtualDOM.vDomSelector({ ele: context, selector: selector, selectAll: false });
|
|
251
|
-
}
|
|
252
|
-
else {
|
|
253
|
-
selector = querySelectId(selector);
|
|
254
|
-
return context.querySelector(selector);
|
|
255
|
-
}
|
|
256
|
+
selector = querySelectId(selector);
|
|
257
|
+
return context.querySelector(selector);
|
|
256
258
|
}
|
|
257
259
|
/**
|
|
258
260
|
* The function selects an array of element from the given context.
|
|
259
|
-
*
|
|
260
|
-
* @param {
|
|
261
|
+
*
|
|
262
|
+
* @param {string} selector - Selector string need fetch element
|
|
263
|
+
* @param {Document|Element} context - It is an optional type, That specifies a Dom context.
|
|
264
|
+
* @param {boolean} needsVDOM ?
|
|
265
|
+
* @returns {HTMLElement[]} ?
|
|
261
266
|
* @private
|
|
262
267
|
*/
|
|
268
|
+
// eslint-disable-next-line
|
|
263
269
|
export function selectAll(selector, context, needsVDOM) {
|
|
264
270
|
if (context === void 0) { context = document; }
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
selector = querySelectId(selector);
|
|
271
|
-
var nodeList = context.querySelectorAll(selector);
|
|
272
|
-
return nodeList;
|
|
273
|
-
}
|
|
271
|
+
selector = querySelectId(selector);
|
|
272
|
+
var nodeList = context.querySelectorAll(selector);
|
|
273
|
+
return nodeList;
|
|
274
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* The function selects an id of element from the given context.
|
|
277
|
+
*
|
|
278
|
+
* @param {string} selector - Selector string need fetch element
|
|
279
|
+
* @returns {string} ?
|
|
280
|
+
* @private
|
|
281
|
+
*/
|
|
275
282
|
function querySelectId(selector) {
|
|
276
|
-
|
|
277
|
-
if (selector.match(/#[0-9]/g) || selector.match(charRegex)) {
|
|
283
|
+
if (selector.match(/#[0-9]/g)) {
|
|
278
284
|
var idList = selector.split(',');
|
|
279
285
|
for (var i = 0; i < idList.length; i++) {
|
|
280
286
|
var list = idList[i].split(' ');
|
|
@@ -282,7 +288,7 @@ function querySelectId(selector) {
|
|
|
282
288
|
if (list[j].indexOf('#') > -1) {
|
|
283
289
|
if (!list[j].match(/\[.*\]/)) {
|
|
284
290
|
var splitId = list[j].split('#');
|
|
285
|
-
if (splitId[1].match(/^\d/)
|
|
291
|
+
if (splitId[1].match(/^\d/)) {
|
|
286
292
|
var setId = list[j].split('.');
|
|
287
293
|
setId[0] = setId[0].replace(/#/, '[id=\'') + '\']';
|
|
288
294
|
list[j] = setId.join('.');
|
|
@@ -298,8 +304,10 @@ function querySelectId(selector) {
|
|
|
298
304
|
}
|
|
299
305
|
/**
|
|
300
306
|
* Returns single closest parent element based on class selector.
|
|
307
|
+
*
|
|
301
308
|
* @param {Element} element - An element that need to find the closest element.
|
|
302
309
|
* @param {string} selector - A classSelector of closest element.
|
|
310
|
+
* @returns {Element} ?
|
|
303
311
|
* @private
|
|
304
312
|
*/
|
|
305
313
|
export function closest(element, selector) {
|
|
@@ -307,7 +315,6 @@ export function closest(element, selector) {
|
|
|
307
315
|
if (typeof el.closest === 'function') {
|
|
308
316
|
return el.closest(selector);
|
|
309
317
|
}
|
|
310
|
-
/* istanbul ignore next */
|
|
311
318
|
while (el && el.nodeType === 1) {
|
|
312
319
|
if (matches(el, selector)) {
|
|
313
320
|
return el;
|
|
@@ -318,7 +325,9 @@ export function closest(element, selector) {
|
|
|
318
325
|
}
|
|
319
326
|
/**
|
|
320
327
|
* Returns all sibling elements of the given element.
|
|
328
|
+
*
|
|
321
329
|
* @param {Element|Node} element - An element that need to get siblings.
|
|
330
|
+
* @returns {Element[]} ?
|
|
322
331
|
* @private
|
|
323
332
|
*/
|
|
324
333
|
export function siblings(element) {
|
|
@@ -334,12 +343,13 @@ export function siblings(element) {
|
|
|
334
343
|
}
|
|
335
344
|
/**
|
|
336
345
|
* set the value if not exist. Otherwise set the existing value
|
|
346
|
+
*
|
|
337
347
|
* @param {HTMLElement} element - An element to which we need to set value.
|
|
338
348
|
* @param {string} property - Property need to get or set.
|
|
339
349
|
* @param {string} value - value need to set.
|
|
350
|
+
* @returns {string} ?
|
|
340
351
|
* @private
|
|
341
352
|
*/
|
|
342
|
-
/* istanbul ignore next */
|
|
343
353
|
export function getAttributeOrDefault(element, property, value) {
|
|
344
354
|
var attrVal;
|
|
345
355
|
var isObj = isObject(element);
|
|
@@ -362,31 +372,27 @@ export function getAttributeOrDefault(element, property, value) {
|
|
|
362
372
|
}
|
|
363
373
|
/**
|
|
364
374
|
* Set the style attributes to Html element.
|
|
375
|
+
*
|
|
365
376
|
* @param {HTMLElement} element - Element which we want to set attributes
|
|
366
377
|
* @param {any} attrs - Set the given attributes to element
|
|
367
|
-
* @
|
|
378
|
+
* @returns {void} ?
|
|
368
379
|
* @private
|
|
369
380
|
*/
|
|
370
381
|
export function setStyleAttribute(element, attrs) {
|
|
371
382
|
if (attrs !== undefined) {
|
|
372
|
-
|
|
373
|
-
//
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
Object.keys(attrs).forEach(function (key) {
|
|
378
|
-
// tslint:disable-next-line:no-any
|
|
379
|
-
element.style[key] = attrs[key];
|
|
380
|
-
});
|
|
381
|
-
}
|
|
383
|
+
Object.keys(attrs).forEach(function (key) {
|
|
384
|
+
// eslint-disable-next-line
|
|
385
|
+
element.style[key] = attrs[key];
|
|
386
|
+
});
|
|
382
387
|
}
|
|
383
388
|
}
|
|
384
389
|
/**
|
|
385
390
|
* Method for add and remove classes to a dom element.
|
|
391
|
+
*
|
|
386
392
|
* @param {Element} element - Element for add and remove classes
|
|
387
393
|
* @param {string[]} addClasses - List of classes need to be add to the element
|
|
388
394
|
* @param {string[]} removeClasses - List of classes need to be remove from the element
|
|
389
|
-
* @
|
|
395
|
+
* @returns {void} ?
|
|
390
396
|
* @private
|
|
391
397
|
*/
|
|
392
398
|
export function classList(element, addClasses, removeClasses) {
|
|
@@ -395,13 +401,14 @@ export function classList(element, addClasses, removeClasses) {
|
|
|
395
401
|
}
|
|
396
402
|
/**
|
|
397
403
|
* Method to check whether the element matches the given selector.
|
|
404
|
+
*
|
|
398
405
|
* @param {Element} element - Element to compare with the selector.
|
|
399
406
|
* @param {string} selector - String selector which element will satisfy.
|
|
400
|
-
* @
|
|
407
|
+
* @returns {void} ?
|
|
401
408
|
* @private
|
|
402
409
|
*/
|
|
403
410
|
export function matches(element, selector) {
|
|
404
|
-
//
|
|
411
|
+
// eslint-disable-next-line
|
|
405
412
|
var matches = element.matches || element.msMatchesSelector || element.webkitMatchesSelector;
|
|
406
413
|
if (matches) {
|
|
407
414
|
return matches.call(element, selector);
|
|
@@ -410,29 +417,29 @@ export function matches(element, selector) {
|
|
|
410
417
|
return [].indexOf.call(document.querySelectorAll(selector), element) !== -1;
|
|
411
418
|
}
|
|
412
419
|
}
|
|
413
|
-
|
|
420
|
+
/**
|
|
421
|
+
* Method to get the html text from DOM.
|
|
422
|
+
*
|
|
423
|
+
* @param {HTMLElement} ele - Element to compare with the selector.
|
|
424
|
+
* @param {string} innerHTML - String selector which element will satisfy.
|
|
425
|
+
* @returns {void} ?
|
|
426
|
+
* @private
|
|
427
|
+
*/
|
|
414
428
|
export function includeInnerHTML(ele, innerHTML) {
|
|
415
|
-
|
|
416
|
-
if (innerHTML === '') {
|
|
417
|
-
ele.children = [];
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
var res = VirtualDOM.ConvertHTMLToJSon(innerHTML);
|
|
421
|
-
if (res.length) {
|
|
422
|
-
VirtualDOM.assignParent(res, ele);
|
|
423
|
-
ele.children = res;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
ele.innerHTML = innerHTML;
|
|
429
|
-
}
|
|
429
|
+
ele.innerHTML = innerHTML;
|
|
430
430
|
}
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Method to get the containsclass.
|
|
433
|
+
*
|
|
434
|
+
* @param {HTMLElement} ele - Element to compare with the selector.
|
|
435
|
+
* @param {string} className - String selector which element will satisfy.
|
|
436
|
+
* @returns {any} ?
|
|
437
|
+
* @private
|
|
438
|
+
*/
|
|
439
|
+
// eslint-disable-next-line
|
|
433
440
|
export function containsClass(ele, className) {
|
|
434
441
|
if (isObject(ele)) {
|
|
435
|
-
//
|
|
442
|
+
// eslint-disable-next-line
|
|
436
443
|
return new RegExp('\\b' + className + '\\b', 'i').test(ele.attributes.className);
|
|
437
444
|
}
|
|
438
445
|
else {
|
|
@@ -441,21 +448,18 @@ export function containsClass(ele, className) {
|
|
|
441
448
|
}
|
|
442
449
|
/**
|
|
443
450
|
* Method to check whether the element matches the given selector.
|
|
444
|
-
*
|
|
445
|
-
* @param {
|
|
446
|
-
* @
|
|
451
|
+
*
|
|
452
|
+
* @param {Object} element - Element to compare with the selector.
|
|
453
|
+
* @param {boolean} deep ?
|
|
454
|
+
* @returns {any} ?
|
|
447
455
|
* @private
|
|
448
456
|
*/
|
|
449
|
-
|
|
450
|
-
//tslint:disable:no-any
|
|
457
|
+
// eslint-disable-next-line
|
|
451
458
|
export function cloneNode(element, deep) {
|
|
452
459
|
if (isObject(element)) {
|
|
453
460
|
if (deep) {
|
|
454
461
|
return extend({}, {}, element, true);
|
|
455
462
|
}
|
|
456
|
-
else {
|
|
457
|
-
return { tagName: element.tagName, attributes: element.attributes };
|
|
458
|
-
}
|
|
459
463
|
}
|
|
460
464
|
else {
|
|
461
465
|
return element.cloneNode(deep);
|
package/src/draggable-model.d.ts
CHANGED
package/src/draggable.d.ts
CHANGED
|
@@ -272,6 +272,10 @@ export declare class Draggable extends Base<HTMLElement> implements INotifyPrope
|
|
|
272
272
|
* @private
|
|
273
273
|
*/
|
|
274
274
|
tapHoldThreshold: number;
|
|
275
|
+
/**
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
enableScrollHandler: boolean;
|
|
275
279
|
private target;
|
|
276
280
|
/**
|
|
277
281
|
* @private
|
|
@@ -297,7 +301,6 @@ export declare class Draggable extends Base<HTMLElement> implements INotifyPrope
|
|
|
297
301
|
private tapHoldTimer;
|
|
298
302
|
private dragElePosition;
|
|
299
303
|
currentStateTarget: any;
|
|
300
|
-
enableScrollHandler: boolean;
|
|
301
304
|
private externalInitialize;
|
|
302
305
|
private diffY;
|
|
303
306
|
private pageY;
|
package/src/draggable.js
CHANGED
|
@@ -76,7 +76,6 @@ var Draggable = /** @class */ (function (_super) {
|
|
|
76
76
|
_this.dragProcessStarted = false;
|
|
77
77
|
/* tslint:disable no-any */
|
|
78
78
|
_this.tapHoldTimer = 0;
|
|
79
|
-
_this.enableScrollHandler = false;
|
|
80
79
|
_this.externalInitialize = false;
|
|
81
80
|
_this.diffY = 0;
|
|
82
81
|
_this.parentScrollX = 0;
|
|
@@ -299,6 +298,10 @@ var Draggable = /** @class */ (function (_super) {
|
|
|
299
298
|
if (this.clone && marginTop !== 0) {
|
|
300
299
|
pos.top += marginTop;
|
|
301
300
|
}
|
|
301
|
+
if (this.enableScrollHandler && !this.clone) {
|
|
302
|
+
pos.top -= this.parentScrollY;
|
|
303
|
+
pos.left -= this.parentScrollX;
|
|
304
|
+
}
|
|
302
305
|
var posValue = this.getProcessedPositionValue({
|
|
303
306
|
top: (pos.top - this.diffY) + 'px',
|
|
304
307
|
left: (pos.left - this.diffX) + 'px'
|
|
@@ -662,7 +665,7 @@ var Draggable = /** @class */ (function (_super) {
|
|
|
662
665
|
pageX = this.clone ? intCoord.pageX : (intCoord.pageX + window.pageXOffset) - this.relativeXPosition;
|
|
663
666
|
pageY = this.clone ? intCoord.pageY : (intCoord.pageY + window.pageYOffset) - this.relativeYPosition;
|
|
664
667
|
}
|
|
665
|
-
if (!this.clone && this.dragArea) {
|
|
668
|
+
if (!this.clone && this.dragArea && !isdragscroll) {
|
|
666
669
|
this.getScrollableValues();
|
|
667
670
|
pageY -= this.tempScrollHeight ? this.parentScrollY : 0;
|
|
668
671
|
pageX -= this.tempScrollWidth ? this.parentScrollX : 0;
|
|
@@ -801,6 +804,9 @@ var Draggable = /** @class */ (function (_super) {
|
|
|
801
804
|
__decorate([
|
|
802
805
|
Property(750)
|
|
803
806
|
], Draggable.prototype, "tapHoldThreshold", void 0);
|
|
807
|
+
__decorate([
|
|
808
|
+
Property(false)
|
|
809
|
+
], Draggable.prototype, "enableScrollHandler", void 0);
|
|
804
810
|
Draggable = Draggable_1 = __decorate([
|
|
805
811
|
NotifyPropertyChanges
|
|
806
812
|
], Draggable);
|
package/src/droppable-model.d.ts
CHANGED
|
@@ -12,26 +12,29 @@ export interface DroppableModel {
|
|
|
12
12
|
accept?: string;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Defines the scope value to group sets of draggable and droppable items.
|
|
15
|
+
* Defines the scope value to group sets of draggable and droppable items.
|
|
16
16
|
* A draggable with the same scope value will only be accepted by the droppable.
|
|
17
17
|
*/
|
|
18
18
|
scope?: string;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Specifies the callback function, which will be triggered while drag element is dropped in droppable.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* @event drop
|
|
23
24
|
*/
|
|
24
25
|
drop?: (args: DropEventArgs) => void;
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Specifies the callback function, which will be triggered while drag element is moved over droppable element.
|
|
28
|
-
*
|
|
29
|
+
*
|
|
30
|
+
* @event over
|
|
29
31
|
*/
|
|
30
32
|
over?: Function;
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* Specifies the callback function, which will be triggered while drag element is moved out of droppable element.
|
|
34
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* @event bind
|
|
35
38
|
*/
|
|
36
39
|
out?: Function;
|
|
37
40
|
|
package/src/droppable.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DroppableModel } from './droppable-model';
|
|
|
4
4
|
import { DropInfo } from './draggable';
|
|
5
5
|
/**
|
|
6
6
|
* Droppable arguments in drop callback.
|
|
7
|
+
*
|
|
7
8
|
* @private
|
|
8
9
|
*/
|
|
9
10
|
export interface DropData {
|
|
@@ -67,17 +68,20 @@ export declare class Droppable extends Base<HTMLElement> implements INotifyPrope
|
|
|
67
68
|
scope: string;
|
|
68
69
|
/**
|
|
69
70
|
* Specifies the callback function, which will be triggered while drag element is dropped in droppable.
|
|
70
|
-
*
|
|
71
|
+
*
|
|
72
|
+
* @event drop
|
|
71
73
|
*/
|
|
72
74
|
drop: (args: DropEventArgs) => void;
|
|
73
75
|
/**
|
|
74
76
|
* Specifies the callback function, which will be triggered while drag element is moved over droppable element.
|
|
75
|
-
*
|
|
77
|
+
*
|
|
78
|
+
* @event over
|
|
76
79
|
*/
|
|
77
80
|
over: Function;
|
|
78
81
|
/**
|
|
79
82
|
* Specifies the callback function, which will be triggered while drag element is moved out of droppable element.
|
|
80
|
-
*
|
|
83
|
+
*
|
|
84
|
+
* @event bind
|
|
81
85
|
*/
|
|
82
86
|
out: Function;
|
|
83
87
|
private mouseOver;
|
package/src/droppable.js
CHANGED
|
@@ -55,6 +55,7 @@ var Droppable = /** @class */ (function (_super) {
|
|
|
55
55
|
EventHandler.add(this.element, Browser.touchEndEvent, this.intDrop, this);
|
|
56
56
|
};
|
|
57
57
|
// triggers when property changed
|
|
58
|
+
// eslint-disable-next-line
|
|
58
59
|
Droppable.prototype.onPropertyChanged = function (newProp, oldProp) {
|
|
59
60
|
//No Code to handle
|
|
60
61
|
};
|
package/src/event-handler.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* EventHandler class provides option to add, remove, clear and trigger events to a HTML DOM element
|
|
3
|
-
* @private
|
|
4
3
|
* ```html
|
|
5
4
|
* <div id="Eventdiv"> </div>
|
|
6
5
|
* <script>
|
|
@@ -22,40 +21,45 @@ export declare class EventHandler {
|
|
|
22
21
|
private static addOrGetEventData;
|
|
23
22
|
/**
|
|
24
23
|
* Add an event to the specified DOM element.
|
|
24
|
+
*
|
|
25
25
|
* @param {any} element - Target HTML DOM element
|
|
26
26
|
* @param {string} eventName - A string that specifies the name of the event
|
|
27
27
|
* @param {Function} listener - Specifies the function to run when the event occurs
|
|
28
28
|
* @param {Object} bindTo - A object that binds 'this' variable in the event handler
|
|
29
|
-
* @param {number}
|
|
30
|
-
* @
|
|
29
|
+
* @param {number} intDebounce - Specifies at what interval given event listener should be triggered.
|
|
30
|
+
* @returns {Function} ?
|
|
31
31
|
*/
|
|
32
32
|
static add(element: Element | HTMLElement | Document, eventName: string, listener: Function, bindTo?: Object, intDebounce?: number): Function;
|
|
33
33
|
/**
|
|
34
34
|
* Remove an event listener that has been attached before.
|
|
35
|
+
*
|
|
35
36
|
* @param {any} element - Specifies the target html element to remove the event
|
|
36
37
|
* @param {string} eventName - A string that specifies the name of the event to remove
|
|
37
38
|
* @param {Function} listener - Specifies the function to remove
|
|
38
|
-
* @
|
|
39
|
+
* @returns {void} ?
|
|
39
40
|
*/
|
|
40
41
|
static remove(element: Element | HTMLElement | Document, eventName: string, listener: Function): void;
|
|
41
42
|
/**
|
|
42
43
|
* Clear all the event listeners that has been previously attached to the element.
|
|
44
|
+
*
|
|
43
45
|
* @param {any} element - Specifies the target html element to clear the events
|
|
44
|
-
* @
|
|
46
|
+
* @returns {void} ?
|
|
45
47
|
*/
|
|
46
48
|
static clearEvents(element: Element): void;
|
|
47
49
|
/**
|
|
48
50
|
* Trigger particular event of the element.
|
|
51
|
+
*
|
|
49
52
|
* @param {any} element - Specifies the target html element to trigger the events
|
|
50
53
|
* @param {string} eventName - Specifies the event to trigger for the specified element.
|
|
51
54
|
* Can be a custom event, or any of the standard events.
|
|
52
55
|
* @param {any} eventProp - Additional parameters to pass on to the event properties
|
|
53
|
-
* @
|
|
56
|
+
* @returns {void} ?
|
|
54
57
|
*/
|
|
55
58
|
static trigger(element: HTMLElement, eventName: string, eventProp?: Object): void;
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* Common Event argument for all base Essential JavaScript 2 Events.
|
|
62
|
+
*
|
|
59
63
|
* @private
|
|
60
64
|
*/
|
|
61
65
|
export interface BaseEventArgs {
|