jqx-es 1.3.6 → 1.3.8
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/Bundle/jqx.browser.min.js +12 -11
- package/Bundle/jqx.min.js +12 -11
- package/README.md +1 -1
- package/Resource/Common/DOM.js +15 -14
- package/Resource/Common/HandlerFactory.js +1 -1
- package/Resource/Common/Utilities.js +29 -4
- package/package.json +1 -1
- package/src/JQxCreatorFactory.js +2 -1
- package/src/JQxInstanceMethods.js +280 -278
- package/src/JQxUtilities.js +13 -13
package/Resource/Common/DOM.js
CHANGED
|
@@ -15,10 +15,11 @@ function htmlToVirtualElement(htmlString) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function characterDataElement2DOM(elem, root, position) {
|
|
18
|
-
|
|
19
|
-
return root.insertAdjacentHTML(position, `<!--${elem.data}-->`);
|
|
18
|
+
switch(true) {
|
|
19
|
+
case IS(elem, Comment): return root.insertAdjacentHTML(position, `<!--${elem.data}-->`);
|
|
20
|
+
case IS(elem, Text): return root.insertAdjacentText(position, elem.data || elem.textContent);
|
|
21
|
+
default: return;
|
|
20
22
|
}
|
|
21
|
-
return root.insertAdjacentText(position, elem.data);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
function inject2DOMTree( collection = [], root = document.body, position = insertPositions.BeforeEnd ) {
|
|
@@ -39,12 +40,12 @@ function element2DOM(elem, root = document.body, position = insertPositions.Befo
|
|
|
39
40
|
: IS(elem, HTMLElement) ? root.insertAdjacentElement(position, elem) : undefined;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
function createElementFromHtmlString(
|
|
43
|
-
if (IS(
|
|
44
|
-
return
|
|
43
|
+
function createElementFromHtmlString(htmlStrOrText) {
|
|
44
|
+
if (IS(htmlStrOrText, Text, Comment)) {
|
|
45
|
+
return htmlStrOrText;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
const testStr =
|
|
47
|
+
|
|
48
|
+
const testStr = htmlStrOrText?.trim();
|
|
48
49
|
let text = testStr?.split(/<text>|<\/text>/i) ?? [];
|
|
49
50
|
|
|
50
51
|
if (text?.length) {
|
|
@@ -52,17 +53,17 @@ function createElementFromHtmlString(htmlStr) {
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
if (testStr.startsWith(`<!--`) && testStr.endsWith(`-->`)) {
|
|
55
|
-
return document.createComment(
|
|
56
|
+
return document.createComment(htmlStrOrText.replace(/<!--|-->$/g, ''));
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
if (text || !/^<(.+)[^>]+>/m.test(testStr)) {
|
|
59
|
-
return document.createTextNode(text);
|
|
58
|
+
|
|
59
|
+
if (!!text || (IS(testStr, String) && !/^<(.+)[^>]+>/m.test(testStr))) {
|
|
60
|
+
return document.createTextNode(text ?? testStr);
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
const nwElem = htmlToVirtualElement(
|
|
63
|
+
const nwElem = htmlToVirtualElement(htmlStrOrText);
|
|
63
64
|
|
|
64
65
|
if (nwElem.childNodes.length < 1) {
|
|
65
|
-
return createElementFromHtmlString(`<span data-jqxcreationerror="1">${truncateHtmlStr(
|
|
66
|
+
return createElementFromHtmlString(`<span data-jqxcreationerror="1">${truncateHtmlStr(htmlStrOrText, 60)}</span>`);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
return nwElem.children[0];
|
|
@@ -32,8 +32,8 @@ const handlerIdCache = {};
|
|
|
32
32
|
|
|
33
33
|
export {
|
|
34
34
|
after, applyStyle, assignAttrValues, ATTRS, before, checkProp, cleanupHtml, clearAllTimers, cloneAndDestroy,
|
|
35
|
-
createElementFromHtmlString, datasetKeyProxy,
|
|
36
|
-
|
|
35
|
+
convert2Bool, createElementFromHtmlString, datasetKeyProxy, ElemArray2HtmlString, emptyElement, escHtml,
|
|
36
|
+
findParentScrollDistance, getCaptureValue, getHandlerName, HandlerFactory, handlerIdCache, inject2DOMTree,
|
|
37
37
|
input2Collection, insertPositions, IS, isArrayOfHtmlElements, isArrayOfHtmlStrings, isComment, isCommentOrTextNode,
|
|
38
38
|
isHtmlString, isModal, isNode, isNonEmptyString, isText, isVisible, isWritable, logTime, maybe, pad0,
|
|
39
39
|
PopupFactory, randomNr, randomString, resolveEventTypeParameter, setData, styleFactory, systemLog,
|
|
@@ -132,6 +132,12 @@ function systemLogFactory() {
|
|
|
132
132
|
return systemLogger;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
function warn(...args) {
|
|
136
|
+
backLog.unshift(...args.map(arg => `${logTime()} ⚠ ${decodeForConsole(arg)}`));
|
|
137
|
+
console.warn(backLog.slice(0, args.length).join(`\n`));
|
|
138
|
+
return systemLogger;
|
|
139
|
+
}
|
|
140
|
+
|
|
135
141
|
function log(...args) {
|
|
136
142
|
backLog.unshift(...args.map(arg => `${logTime()} ✔ ${decodeForConsole(arg)}`));
|
|
137
143
|
switch(on) {
|
|
@@ -143,6 +149,7 @@ function systemLogFactory() {
|
|
|
143
149
|
Object.defineProperties(systemLogger, {
|
|
144
150
|
log: {value: log, enumerable: false},
|
|
145
151
|
error: {value: error, enumerable: false},
|
|
152
|
+
warn: {value: warn, enumerable: false},
|
|
146
153
|
});
|
|
147
154
|
|
|
148
155
|
return Object.freeze(systemLogger);
|
|
@@ -264,9 +271,14 @@ function randomString() {
|
|
|
264
271
|
}
|
|
265
272
|
|
|
266
273
|
function resolveEventTypeParameter (maybeTypes) {
|
|
267
|
-
maybeTypes = IS(maybeTypes, String) && /,/.test(maybeTypes)
|
|
274
|
+
maybeTypes = IS(maybeTypes, String) && /,/.test(maybeTypes)
|
|
275
|
+
? maybeTypes
|
|
276
|
+
.split(`,`)
|
|
277
|
+
.map(t => t.trim().toLowerCase())
|
|
278
|
+
.filter( t => t.length > 0)
|
|
279
|
+
: maybeTypes;
|
|
268
280
|
return IS(maybeTypes, Array)
|
|
269
|
-
? maybeTypes
|
|
281
|
+
? maybeTypes
|
|
270
282
|
: IS(maybeTypes, String) && maybeTypes?.trim().toLowerCase() || ``;
|
|
271
283
|
}
|
|
272
284
|
|
|
@@ -279,6 +291,19 @@ function isModal(elem) {
|
|
|
279
291
|
return false;
|
|
280
292
|
}
|
|
281
293
|
|
|
294
|
+
function convert2Bool(value, defaultValue) {
|
|
295
|
+
// Valid input values: 0|false|f|1|true|t (case insensitive)
|
|
296
|
+
value = String(value).trim();
|
|
297
|
+
switch (true) {
|
|
298
|
+
case /^(0|false|f)$/i.test(value):
|
|
299
|
+
return false;
|
|
300
|
+
case /^(1|true|t)$/i.test(value):
|
|
301
|
+
return true;
|
|
302
|
+
default:
|
|
303
|
+
return defaultValue;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
282
307
|
/* private */
|
|
283
308
|
function shuffle(array) {
|
|
284
309
|
let i = array.length;
|
package/package.json
CHANGED
package/src/JQxCreatorFactory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
randomString, toDashedNotation, IS, tagFNFactory as $T, styleFactory, toCamelcase, systemLog,
|
|
3
3
|
escHtml, isNonEmptyString, resolveEventTypeParameter, selectedFactoryHelpers, insertPositions,
|
|
4
|
-
cleanupHtml, PopupFactory, tagLib, HandlerFactory, clearAllTimers,
|
|
4
|
+
cleanupHtml, PopupFactory, tagLib, HandlerFactory, clearAllTimers, convert2Bool,
|
|
5
5
|
} from "./JQxUtilities.js";
|
|
6
6
|
import allMethodsFactory from "./JQxInstanceMethods.js";
|
|
7
7
|
|
|
@@ -242,6 +242,7 @@ function staticMethodsFactory(jqx) {
|
|
|
242
242
|
node: (selector, root = document) => root.querySelector(selector, root),
|
|
243
243
|
nodes: (selector, root = document) => [...root.querySelectorAll(selector, root)],
|
|
244
244
|
clearAllTimers,
|
|
245
|
+
get toBool() { return convert2Bool; },
|
|
245
246
|
get getNamedListener() { return getNamedListener; },
|
|
246
247
|
get virtual() { return virtualFactory(jqx); },
|
|
247
248
|
get allowTag() { return allowProhibit.allow; },
|