jqx-es 1.2.8 → 1.3.0
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 +14 -14
- package/Bundle/jqx.min.js +14 -14
- package/Resource/Common/DOM.js +1 -0
- package/Resource/Common/HandlerFactory.js +104 -75
- package/Resource/Common/Popup.js +28 -6
- package/Resource/Common/Utilities.js +30 -4
- package/Resource/Common/WebComponentFactory.min.js +11 -0
- package/Resource/Common/_HandlerFactory.js +85 -0
- package/Resource/Common/cright.css +40 -0
- package/Resource/Common/css.min.js +31 -0
- package/Resource/Common/highlight.min.js +418 -0
- package/Resource/Common/javascript.min.js +81 -0
- package/Resource/Common/rainbow.min.css +1 -0
- package/Resource/Common/xml.min.js +29 -0
- package/package.json +1 -1
- package/src/JQxCreatorFactory.js +36 -23
- package/src/JQxInstanceMethods.js +10 -3
- package/src/JQxUtilities.js +3 -3
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,
|
|
4
|
+
cleanupHtml, PopupFactory, tagLib, HandlerFactory, getHandlerName,
|
|
5
5
|
} from "./JQxUtilities.js";
|
|
6
6
|
import allMethodsFactory from "./JQxInstanceMethods.js";
|
|
7
7
|
|
|
@@ -156,39 +156,48 @@ function delegateFactory(listen) {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
/* region __WIP */
|
|
160
|
+
function delegateCaptureFactory(handlerWrapper) {
|
|
160
161
|
return function(spec) {
|
|
161
|
-
let {type, origin, selector, handlers, name, capture, once,
|
|
162
|
+
let {type, types, origin, selector, handler, handlers, node, name, capture, once, about} = spec;
|
|
163
|
+
// <legacy>
|
|
164
|
+
handler = handlers || handler;
|
|
165
|
+
type = types || type;
|
|
166
|
+
selector = origin || selector;
|
|
167
|
+
// </legacy>
|
|
162
168
|
const typesResolved = resolveEventTypeParameter(type);
|
|
163
169
|
const specifiedName = name;
|
|
164
|
-
|
|
165
|
-
canRemove = IS(canRemove, Boolean) ? canRemove : false;
|
|
170
|
+
handler = IS(handler, Function) ? [handler] : handler;
|
|
166
171
|
const params = {
|
|
167
|
-
|
|
168
|
-
name: specifiedName, once,
|
|
169
|
-
|
|
172
|
+
type: typesResolved, selector: selector || origin, capture,
|
|
173
|
+
name: specifiedName, once, node, about };
|
|
174
|
+
|
|
170
175
|
switch(true) {
|
|
171
176
|
case IS(typesResolved, Array) && typesResolved.length > 0:
|
|
172
177
|
for (const type of typesResolved) {
|
|
173
|
-
params.
|
|
174
|
-
assignListeners(
|
|
178
|
+
params.type = type;
|
|
179
|
+
assignListeners(handler, params, handlerWrapper);
|
|
175
180
|
}
|
|
176
181
|
break;
|
|
177
|
-
default: return assignListeners(
|
|
182
|
+
default: return assignListeners(handler, params, handlerWrapper);
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
}
|
|
181
186
|
|
|
182
|
-
function assignListeners(
|
|
183
|
-
for (const handler of
|
|
184
|
-
|
|
187
|
+
function assignListeners(handlerFns, params, handlerWrapper) {
|
|
188
|
+
for (const handler of handlerFns) {
|
|
189
|
+
params.name = getHandlerName(params.name || handler.name);
|
|
190
|
+
handlerWrapper.listen({...params, handler});
|
|
185
191
|
}
|
|
186
192
|
}
|
|
193
|
+
/* endregion __WIP */
|
|
187
194
|
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
195
|
+
function getNamedListenerFactory(jqx) {
|
|
196
|
+
return function(type, name) {
|
|
197
|
+
name = isNonEmptyString(name) && name;
|
|
198
|
+
type = isNonEmptyString(type) && type;
|
|
199
|
+
return name && type && jqx.listenerStore[type][name];
|
|
200
|
+
};
|
|
192
201
|
}
|
|
193
202
|
|
|
194
203
|
function popupGetter(jqx) {
|
|
@@ -207,19 +216,21 @@ function getSelectedStaticMethods(jqx) {
|
|
|
207
216
|
const createStyle = id => styleFactory({createWithId: id || `jqx${randomString()}`});
|
|
208
217
|
const editCssRules = (...rules) => { for (const rule of rules) { cssRuleEdit(rule); } };
|
|
209
218
|
const allowProhibit = allowances(jqx);
|
|
210
|
-
const
|
|
211
|
-
const capturedHandling = delegateCaptureFactory(
|
|
219
|
+
const handlerWrapper = HandlerFactory(jqx);
|
|
220
|
+
const capturedHandling = delegateCaptureFactory(handlerWrapper);
|
|
212
221
|
const log = (...line) => systemLog.on.log(...line).off;
|
|
213
|
-
return {
|
|
222
|
+
return {
|
|
223
|
+
editCssRule, createStyle, editCssRules, allowProhibit, handle: capturedHandling, capturedHandling,
|
|
224
|
+
log, handlerWrapper};
|
|
214
225
|
}
|
|
215
226
|
|
|
216
227
|
function staticMethodsFactory(jqx) {
|
|
217
228
|
const { factoryExtensions, instanceExtensions } = allMethodsFactory(jqx);
|
|
218
229
|
instanceGetters = factoryExtensions;
|
|
219
230
|
instanceMethods = instanceExtensions;
|
|
220
|
-
const { editCssRule, createStyle, editCssRules, allowProhibit, handle, capturedHandling, log } =
|
|
231
|
+
const { editCssRule, createStyle, editCssRules, allowProhibit, handle, capturedHandling, log, handlerWrapper } =
|
|
221
232
|
getSelectedStaticMethods(jqx);
|
|
222
|
-
|
|
233
|
+
const getNamedListener = getNamedListenerFactory(jqx);
|
|
223
234
|
return {
|
|
224
235
|
log,
|
|
225
236
|
editCssRules,
|
|
@@ -240,11 +251,13 @@ function staticMethodsFactory(jqx) {
|
|
|
240
251
|
get delegate() { return delegateFactory(capturedHandling); },
|
|
241
252
|
get delegateCaptured() { return capturedHandling; } ,
|
|
242
253
|
get handle() { return capturedHandling; },
|
|
254
|
+
get listen() { return handlerWrapper.listen; },
|
|
243
255
|
get at() { return insertPositions; },
|
|
244
256
|
get setStyle() { /*deprecated*/return editCssRule; },
|
|
245
257
|
get fn() { return addFn; },
|
|
246
258
|
get lenient() { return tagLib.allowUnknownHtmlTags; },
|
|
247
259
|
get IS() { return IS; },
|
|
248
260
|
get Popup() { return popupGetter(jqx); },
|
|
261
|
+
get listenerStore() { return handlerWrapper.ListenerStore; },
|
|
249
262
|
};
|
|
250
263
|
}
|
|
@@ -305,13 +305,20 @@ function instanceExtensionsFactory(jqx) {
|
|
|
305
305
|
nth$: (instance, indexOrSelector) => instance.single(indexOrSelector),
|
|
306
306
|
on: (instance, type, ...callback) => {
|
|
307
307
|
if (instance.collection.length && IS(type, String, Array)) {
|
|
308
|
-
if (type
|
|
309
|
-
|
|
310
|
-
jqx.handle({type, selector: cssSelector4Handler, handlers: callback});
|
|
308
|
+
if (!isNonEmptyString(type) || callback.length < 1) { return instance; }
|
|
309
|
+
jqx.handle({type, node: instance.node, handlers: callback});
|
|
311
310
|
}
|
|
312
311
|
|
|
313
312
|
return instance;
|
|
314
313
|
},
|
|
314
|
+
once: (instance, type, ...callback) => {
|
|
315
|
+
if (instance.collection.length && IS(type, String, Array)) {
|
|
316
|
+
if (!isNonEmptyString(type) || callback.length < 1) { return instance; }
|
|
317
|
+
jqx.handle({type, once: true, node: instance.node, handlers: callback});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return instance;
|
|
321
|
+
},
|
|
315
322
|
prepend: (instance, ...elems2Prepend) => {
|
|
316
323
|
if (!instance.is.empty && elems2Prepend) {
|
|
317
324
|
const shouldMove = instance.length === 1;
|
package/src/JQxUtilities.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isNode, isNonEmptyString, isText, isVisible, isWritable, logTime, maybe, randomNr, randomString,
|
|
6
6
|
resolveEventTypeParameter, setData, styleFactory, systemLog, tagFNFactory, toCamelcase, toDashedNotation,
|
|
7
7
|
truncate2SingleStr, truncateHtmlStr, createElementFromHtmlString, inject2DOMTree, cleanupHtml,
|
|
8
|
-
PopupFactory, tagLib,
|
|
8
|
+
PopupFactory, tagLib, HandlerFactory, getHandlerName,
|
|
9
9
|
} from "../Resource/Common/Utilities.js"
|
|
10
10
|
|
|
11
11
|
export {
|
|
@@ -15,7 +15,7 @@ export {
|
|
|
15
15
|
isHtmlString, isNode, isNonEmptyString, logTime, loop, maybe, randomNr, randomString, resolveEventTypeParameter,
|
|
16
16
|
selectedFactoryHelpers, setCollectionFromCssSelector, setData, styleFactory, systemLog, tagFNFactory,
|
|
17
17
|
toCamelcase, toDashedNotation, truncate2SingleStr, truncateHtmlStr, createElementFromHtmlString, inject2DOMTree,
|
|
18
|
-
cleanupHtml, PopupFactory, tagLib,
|
|
18
|
+
cleanupHtml, PopupFactory, tagLib, HandlerFactory, getHandlerName,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
function loop(instance, callback) {
|
|
@@ -40,7 +40,7 @@ function setCollectionFromCssSelector(input, root, self) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function addHandlerId(instance) {
|
|
43
|
-
const handleId =
|
|
43
|
+
const handleId = `anonymous_${Math.random().toString(36).slice(2)}`;
|
|
44
44
|
instance.data.add({hid: handleId});
|
|
45
45
|
return `[data-hid="${handleId}"]`;
|
|
46
46
|
}
|