efront 4.0.51 → 4.0.54
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/coms/basic/Table.js +1 -1
- package/coms/basic/decodeUTF16.js +1 -1
- package/coms/basic/parseCSV.js +54 -0
- package/coms/basic_/Promise.js +3 -1
- package/coms/basic_/exec_.js +2 -1
- package/coms/compile/autoenum.js +95 -47
- package/coms/compile/autoenum_test.js +11 -0
- package/coms/compile/common.js +6 -1
- package/coms/compile/downLevel.js +39 -18
- package/coms/compile/downLevel_test.js +13 -8
- package/coms/compile/scanner2_test.js +6 -1
- package/coms/compile/unstruct.js +2 -1
- package/coms/compile/unstruct_test.js +3 -0
- package/coms/zimoli/button.less +0 -1
- package/coms/zimoli/contextmenu.less +1 -0
- package/coms/zimoli/model.js +1 -1
- package/coms/zimoli/table.html +2 -2
- package/coms/zimoli/table.js +28 -24
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/table.js
CHANGED
|
@@ -371,28 +371,23 @@ var getTdsOfSameRow = function (td) {
|
|
|
371
371
|
return tds;
|
|
372
372
|
};
|
|
373
373
|
function setContextMenu(thead) {
|
|
374
|
-
var fields = this.
|
|
375
|
-
var
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
var width = thead.scrollWidth / scope.fields.length;
|
|
386
|
-
if (!width || width < 200) width = 200;
|
|
387
|
-
forEachRow(thead, function (tr) {
|
|
388
|
-
for (var td of tr.children) {
|
|
389
|
-
if (td.offsetWidth > width) css(td, { width });
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
setLazyFixedColumn.call(thead.parentNode, true)
|
|
374
|
+
var fields = this.originFields.slice();
|
|
375
|
+
var _do = function () {
|
|
376
|
+
this.checked = !this.checked;
|
|
377
|
+
var f = fields[this.index];
|
|
378
|
+
f.hidden = !this.checked;
|
|
379
|
+
scope.fields = fields.filter(f => !f.hidden);
|
|
380
|
+
var width = thead.scrollWidth / scope.fields.length;
|
|
381
|
+
if (!width || width < 200) width = 200;
|
|
382
|
+
forEachRow(thead, function (tr) {
|
|
383
|
+
for (var td of tr.children) {
|
|
384
|
+
if (td.offsetWidth > width) css(td, { width });
|
|
393
385
|
}
|
|
394
|
-
}
|
|
395
|
-
|
|
386
|
+
});
|
|
387
|
+
setLazyFixedColumn.call(thead.parentNode, true)
|
|
388
|
+
};
|
|
389
|
+
var menuItems = fields.map((f, i) => ({ name: f.name || " ", index: i, width: f.width, key: f.key, checked: !f.hidden, do: _do }));
|
|
390
|
+
var scope = this;
|
|
396
391
|
contextmenu(thead, menuItems);
|
|
397
392
|
}
|
|
398
393
|
function table(elem) {
|
|
@@ -468,11 +463,19 @@ function table(elem) {
|
|
|
468
463
|
};
|
|
469
464
|
vbox(table, 'x');
|
|
470
465
|
};
|
|
471
|
-
care(table, async function (
|
|
466
|
+
care(table, async function (src) {
|
|
467
|
+
if (src instanceof Table) {
|
|
468
|
+
data = src;
|
|
469
|
+
fields = data.fields;
|
|
470
|
+
}
|
|
471
|
+
else if (src instanceof Array) {
|
|
472
|
+
var [fields, data] = src;
|
|
473
|
+
}
|
|
474
|
+
else throw new Error("table组件源数据错误!");
|
|
472
475
|
if (_vbox) _vbox(), _vbox = null;
|
|
473
476
|
watch(table, {
|
|
474
477
|
find(text) {
|
|
475
|
-
if ($scope.data.constructor === Table){
|
|
478
|
+
if ($scope.data.constructor === Table) {
|
|
476
479
|
$scope.data.searchText = text;
|
|
477
480
|
$scope.data.update();
|
|
478
481
|
}
|
|
@@ -485,7 +488,8 @@ function table(elem) {
|
|
|
485
488
|
markedRows = false;
|
|
486
489
|
this.style.display = 'block';
|
|
487
490
|
var $scope = {
|
|
488
|
-
fields,
|
|
491
|
+
originFields: fields,
|
|
492
|
+
fields: fields.filter(f => !f.hidden),
|
|
489
493
|
isEmpty,
|
|
490
494
|
hasFoot: true,
|
|
491
495
|
setContextMenu,
|