sdc_client 0.57.15 → 0.57.17
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/dist/index.js +26 -26
- package/dist/ugly.index.js +1 -1
- package/gulp/gulp.jsx +85 -78
- package/package.json +4 -6
- package/src/simpleDomControl/AbstractSDC.js +2 -2
- package/src/simpleDomControl/sdc_dom_events.js +17 -1
- package/src/simpleDomControl/sdc_params.js +67 -52
- package/src/simpleDomControl/sdc_socket.js +744 -716
- package/src/simpleDomControl/sdc_utils.js +1 -1
- package/src/simpleDomControl/sdc_view.js +39 -36
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
runControlFlowFunctions,
|
|
5
5
|
updateEventAndTriggerOnRefresh
|
|
6
6
|
} from "./sdc_controller.js";
|
|
7
|
-
import {getUrlParam} from "./sdc_params.js";
|
|
7
|
+
import {getUrlParam, prepareData} from "./sdc_params.js";
|
|
8
8
|
import {app} from "./sdc_main.js";
|
|
9
9
|
import {trigger} from "./sdc_events.js";
|
|
10
10
|
|
|
@@ -89,7 +89,7 @@ function replacePlaceholderController(controller, url, urlValues) {
|
|
|
89
89
|
* @param {object} args - get args.
|
|
90
90
|
* @param tag - a normalized tag-name as string.
|
|
91
91
|
* @param hardReload - true if the file has to be reloaded every time.
|
|
92
|
-
* @returns {Promise<Boolean>} - waits for the file to be loaded.
|
|
92
|
+
* @returns {Promise<jQuery|Boolean>} - waits for the file to be loaded.
|
|
93
93
|
*/
|
|
94
94
|
function loadHTMLFile(path, args, tag, hardReload) {
|
|
95
95
|
if (!path) {
|
|
@@ -136,7 +136,7 @@ function replaceAllTagElementsInContainer($container, parentController, process
|
|
|
136
136
|
* correct URL. Also parses the url parameter
|
|
137
137
|
*
|
|
138
138
|
* @param {AbstractSDC} controller - controller object
|
|
139
|
-
* @returns {
|
|
139
|
+
* @returns {{url: String, args: Array}} - the correct URL with prefix.
|
|
140
140
|
*/
|
|
141
141
|
function parseContentUrl(controller) {
|
|
142
142
|
let url = controller.contentUrl;
|
|
@@ -187,7 +187,7 @@ export function getController($elem) {
|
|
|
187
187
|
export function loadFilesFromController(controller) {
|
|
188
188
|
let getElements = {args: {}};
|
|
189
189
|
if (controller.contentUrl) {
|
|
190
|
-
getElements = parseContentUrl(controller
|
|
190
|
+
getElements = parseContentUrl(controller);
|
|
191
191
|
controller.contentUrl = getElements.url;
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -219,7 +219,7 @@ export function loadFilesFromController(controller) {
|
|
|
219
219
|
*/
|
|
220
220
|
export function reloadHTMLController(controller) {
|
|
221
221
|
if (controller.contentUrl) {
|
|
222
|
-
let getElements = parseContentUrl(controller
|
|
222
|
+
let getElements = parseContentUrl(controller);
|
|
223
223
|
controller.contentUrl = getElements.url;
|
|
224
224
|
return loadHTMLFile(controller.contentUrl, getElements.args, controller._tagName, controller.contentReload);
|
|
225
225
|
}
|
|
@@ -330,9 +330,10 @@ function _reloadMethodHTML(controller, $dom, process) {
|
|
|
330
330
|
|
|
331
331
|
|
|
332
332
|
if (typeof result === 'function') {
|
|
333
|
-
|
|
333
|
+
const newData = prepareData($this.data());
|
|
334
|
+
result = result.bind(controller)(newData);
|
|
334
335
|
}
|
|
335
|
-
if (result
|
|
336
|
+
if (result) {
|
|
336
337
|
plist.push(Promise.resolve(result).then((x) => {
|
|
337
338
|
let $newContent = $(`<div></div>`);
|
|
338
339
|
$newContent.append(x);
|
|
@@ -376,7 +377,7 @@ function reconcileTree({$element, id = [], parent = null}) {
|
|
|
376
377
|
idx: 0,
|
|
377
378
|
getRealParent: () => parent,
|
|
378
379
|
getIdx: function () {
|
|
379
|
-
this.idx = (this.getRealParent()?.getIdx() ?? -1) + $element.index() + 1;
|
|
380
|
+
this.idx = Math.max(0, (this.getRealParent()?.getIdx() ?? -1) + $element.index() + 1);
|
|
380
381
|
return this.idx;
|
|
381
382
|
},
|
|
382
383
|
op: null,
|
|
@@ -405,38 +406,40 @@ export function reconcile($virtualNode, $realNode) {
|
|
|
405
406
|
window.OPS = op_steps;
|
|
406
407
|
|
|
407
408
|
op_steps.forEach((op_step, i) => {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
409
|
+
const {op, $element, idx} = op_step;
|
|
410
|
+
|
|
411
|
+
if (op.type === 'keep_counterpart') {
|
|
412
|
+
let cIdx = op.counterpart.getIdx();
|
|
413
|
+
if (cIdx !== idx) {
|
|
414
|
+
const elemBefore = op_step.getBefore();
|
|
415
|
+
if (!elemBefore) {
|
|
416
|
+
op_step.getRealParent().$element.prepend(op.counterpart.$element);
|
|
417
|
+
} else {
|
|
418
|
+
op.counterpart.$element.insertAfter(elemBefore.$element);
|
|
419
|
+
}
|
|
418
420
|
}
|
|
419
|
-
}
|
|
420
421
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
422
|
+
syncAttributes(op.counterpart.$element, $element);
|
|
423
|
+
if ($element.hasClass(CONTROLLER_CLASS)) {
|
|
424
|
+
$element.data(DATA_CONTROLLER_KEY).$container = op.counterpart.$element;
|
|
425
|
+
$element.data(DATA_CONTROLLER_KEY, null);
|
|
426
|
+
}
|
|
426
427
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
428
|
+
toRemove.push($element);
|
|
429
|
+
} else if (op.type === 'delete') {
|
|
430
|
+
$element.safeRemove();
|
|
431
|
+
} else if (op.type === 'insert') {
|
|
432
|
+
const {after, target} = op_step.op;
|
|
433
|
+
if (after) {
|
|
434
|
+
$element.insertAfter(after.$element);
|
|
435
|
+
} else if (target) {
|
|
436
|
+
target.$element.prepend($element);
|
|
437
|
+
}
|
|
437
438
|
|
|
439
|
+
}
|
|
438
440
|
}
|
|
439
|
-
|
|
441
|
+
)
|
|
442
|
+
;
|
|
440
443
|
|
|
441
444
|
toRemove.forEach(($element) => $element.safeRemove());
|
|
442
445
|
}
|
|
@@ -572,7 +575,7 @@ export function refresh($dom, leafController, process = null) {
|
|
|
572
575
|
$dom ??= leafController.$container;
|
|
573
576
|
|
|
574
577
|
return replaceTagElementsInContainer(app.tagNames, $dom, leafController, process).then(() => {
|
|
575
|
-
reloadMethodHTML(leafController, $dom, refreshProcess).then(() => {
|
|
578
|
+
return reloadMethodHTML(leafController, $dom, refreshProcess).then(() => {
|
|
576
579
|
if (!isRunningProcess) {
|
|
577
580
|
updateEventAndTriggerOnRefresh(refreshProcess);
|
|
578
581
|
}
|