total5 0.0.16-3 → 0.0.16-4
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/builders.js +20 -5
- package/changelog.txt +3 -0
- package/cms.js +21 -5
- package/index.js +1 -1
- package/package.json +1 -1
package/builders.js
CHANGED
|
@@ -153,7 +153,13 @@ Options.prototype.promisify = function(fn, a, b, c) {
|
|
|
153
153
|
});
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
-
Options.prototype.status = function() {
|
|
156
|
+
Options.prototype.status = function(a, b, c, d) {
|
|
157
|
+
this.status2?.call(this, a, b, c, d);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
Options.prototype.progress = function(a, b, c, d) {
|
|
161
|
+
this.progress2?.call(this, a, b, c, d);
|
|
162
|
+
};
|
|
157
163
|
|
|
158
164
|
Options.prototype.publish = function(value) {
|
|
159
165
|
var self = this;
|
|
@@ -252,7 +258,7 @@ Options.prototype.callback = Options.prototype.pipe = function(value) {
|
|
|
252
258
|
};
|
|
253
259
|
}
|
|
254
260
|
|
|
255
|
-
self.$callback(self.error.items.length ? self.error : null, value);
|
|
261
|
+
self.$callback.call(self, self.error.items.length ? self.error : null, value);
|
|
256
262
|
};
|
|
257
263
|
|
|
258
264
|
Options.prototype.done = function(arg) {
|
|
@@ -1348,6 +1354,11 @@ ActionCaller.prototype.status = function(fn) {
|
|
|
1348
1354
|
return this;
|
|
1349
1355
|
};
|
|
1350
1356
|
|
|
1357
|
+
ActionCaller.prototype.progress = function(fn) {
|
|
1358
|
+
this.options.progress = fn;
|
|
1359
|
+
return this;
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1351
1362
|
ActionCaller.prototype.exec = function() {
|
|
1352
1363
|
|
|
1353
1364
|
let self = this;
|
|
@@ -1394,6 +1405,7 @@ ActionCaller.prototype.exec = function() {
|
|
|
1394
1405
|
let type = meta.payload || (action.input ? '+' : '-');
|
|
1395
1406
|
let $ = self.$;
|
|
1396
1407
|
|
|
1408
|
+
$.name = action.name;
|
|
1397
1409
|
$.id = action.id;
|
|
1398
1410
|
$.error = self.error;
|
|
1399
1411
|
$.controller = self.controller;
|
|
@@ -1497,7 +1509,10 @@ ActionCaller.prototype.exec = function() {
|
|
|
1497
1509
|
$.payload = payload;
|
|
1498
1510
|
|
|
1499
1511
|
if (self.options.status)
|
|
1500
|
-
$.
|
|
1512
|
+
$.status2 = self.options.status;
|
|
1513
|
+
|
|
1514
|
+
if (self.options.progress)
|
|
1515
|
+
$.progress2 = self.options.progress;
|
|
1501
1516
|
|
|
1502
1517
|
if (action.middleware) {
|
|
1503
1518
|
action.middleware.wait(function(name, next) {
|
|
@@ -1523,9 +1538,9 @@ ActionCaller.prototype.finish = function(value) {
|
|
|
1523
1538
|
if (self.error.length)
|
|
1524
1539
|
$.invalid(self.error);
|
|
1525
1540
|
else
|
|
1526
|
-
$.callback(value === undefined ? self.$.response : value);
|
|
1541
|
+
$.callback.call(self.$, value === undefined ? self.$.response : value);
|
|
1527
1542
|
} else
|
|
1528
|
-
self.options.callback(self.error.length ? self.error : null, value === undefined ? self.$.response : value);
|
|
1543
|
+
self.options.callback.call(self.$, self.error.length ? self.error : null, value === undefined ? self.$.response : value);
|
|
1529
1544
|
|
|
1530
1545
|
self.options.callback = null;
|
|
1531
1546
|
}
|
package/changelog.txt
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
- exended `Total.download()` by adding `size {Number}` property to the response
|
|
16
16
|
- extended FlowStream by adding the ability to execute Total.js actions
|
|
17
17
|
- added a new global event `ON('flowstream', function(instance) {`
|
|
18
|
+
- added new action methods `$.progress(percentage)` and `ACTION().progress(console.log)` to measure percentage
|
|
19
|
+
- fixed Total error handling
|
|
20
|
+
- improved compiling navigation in the CMS compiler
|
|
18
21
|
|
|
19
22
|
========================
|
|
20
23
|
0.0.15
|
package/cms.js
CHANGED
|
@@ -575,14 +575,30 @@ exports.compile = function(html, widgets, used) {
|
|
|
575
575
|
let endindex = html.indexOf('</script>', index);
|
|
576
576
|
let endhead = html.indexOf('>', index);
|
|
577
577
|
let head = html.substring(begindex, endhead);
|
|
578
|
-
let
|
|
578
|
+
let uid = head.match(/id=".*?"/i);
|
|
579
579
|
let template = html.substring(html.indexOf('>', endhead) + 1, endindex);
|
|
580
|
+
let name = '';
|
|
580
581
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
582
|
+
if (uid && uid[0]) {
|
|
583
|
+
uid = uid[0];
|
|
584
|
+
uid = uid.substring(4, uid.length - 1);
|
|
585
|
+
name = uid.capitalize();
|
|
586
|
+
} else {
|
|
587
|
+
uid = head.match(/name=".*?"/i);
|
|
588
|
+
if (uid && uid[0]) {
|
|
589
|
+
uid = uid[0];
|
|
590
|
+
uid = uid.substring(6, uid.length - 1);
|
|
591
|
+
name = uid.capitalize();
|
|
592
|
+
uid = HASH(uid).toString(36); // Backward compatibility with old CMS
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
if (name) {
|
|
597
|
+
html = html.replace(html.substring(begindex, endindex + 9), '~WIDGET#' + response.tangular.length + '~');
|
|
598
|
+
response.tangular.push({ id: uid, name: name, type: 'nav', template: Tangular.compile(template) });
|
|
599
|
+
}
|
|
585
600
|
|
|
601
|
+
index = begindex;
|
|
586
602
|
}
|
|
587
603
|
|
|
588
604
|
index = 0;
|
package/index.js
CHANGED