@wavemaker/app-runtime-wm-build 11.4.1-next.24709 → 11.4.1-next.24710
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.
|
@@ -23185,17 +23185,17 @@
|
|
|
23185
23185
|
var defaultTreeIconClass = "plus-minus";
|
|
23186
23186
|
var TreeComponent = function(_super) {
|
|
23187
23187
|
__extends(TreeComponent, _super);
|
|
23188
|
-
function TreeComponent(inj, bindnodeid) {
|
|
23188
|
+
function TreeComponent(inj, binddatavalue, bindnodelabel, bindnodeicon, bindnodechildren, bindnodeid) {
|
|
23189
23189
|
var _this = _super.call(this, inj, WIDGET_INFO) || this;
|
|
23190
|
+
_this.binddatavalue = binddatavalue;
|
|
23191
|
+
_this.bindnodelabel = bindnodelabel;
|
|
23192
|
+
_this.bindnodeicon = bindnodeicon;
|
|
23193
|
+
_this.bindnodechildren = bindnodechildren;
|
|
23190
23194
|
_this.bindnodeid = bindnodeid;
|
|
23191
23195
|
_this.setting = {
|
|
23192
23196
|
data: {
|
|
23193
23197
|
simpleData: {
|
|
23194
23198
|
enable: false
|
|
23195
|
-
},
|
|
23196
|
-
key: {
|
|
23197
|
-
children: "children",
|
|
23198
|
-
name: "label"
|
|
23199
23199
|
}
|
|
23200
23200
|
},
|
|
23201
23201
|
view: {
|
|
@@ -23209,53 +23209,53 @@
|
|
|
23209
23209
|
callback: {}
|
|
23210
23210
|
};
|
|
23211
23211
|
base.styler(_this.nativeElement, _this, base.APPLY_STYLES_TYPE.CONTAINER);
|
|
23212
|
+
_this.setting.view["nodeClasses"] = _this.setNodeClasses;
|
|
23213
|
+
_this.setting.callback["onClick"] = _this.onClick.bind(_this);
|
|
23214
|
+
_this.setting.callback["onExpand"] = _this.onExpand.bind(_this);
|
|
23215
|
+
_this.setting.callback["onCollapse"] = _this.onCollapse.bind(_this);
|
|
23212
23216
|
return _this;
|
|
23213
23217
|
}
|
|
23214
23218
|
TreeComponent.prototype.onPropertyChange = function(key, nv, ov) {
|
|
23215
23219
|
switch (key) {
|
|
23216
23220
|
case "dataset":
|
|
23217
23221
|
this.nodes = this.getNodes(nv);
|
|
23218
|
-
if (this.level > 0) {
|
|
23219
|
-
this.expandTree(this.level, this.nodes, 0);
|
|
23220
|
-
}
|
|
23221
23222
|
this.renderTree();
|
|
23222
23223
|
break;
|
|
23223
23224
|
|
|
23224
23225
|
case "levels":
|
|
23225
|
-
|
|
23226
|
-
this.level = nv;
|
|
23227
|
-
}
|
|
23226
|
+
this.level = nv;
|
|
23228
23227
|
this.renderTree();
|
|
23229
23228
|
break;
|
|
23230
23229
|
|
|
23231
|
-
case "
|
|
23232
|
-
this.
|
|
23230
|
+
case "nodeicon":
|
|
23231
|
+
this.nodeicon = nv;
|
|
23233
23232
|
this.renderTree();
|
|
23234
23233
|
break;
|
|
23235
23234
|
|
|
23236
23235
|
case "nodelabel":
|
|
23237
|
-
this.
|
|
23236
|
+
this.nodelabel = nv;
|
|
23238
23237
|
this.renderTree();
|
|
23239
23238
|
break;
|
|
23240
23239
|
|
|
23241
23240
|
case "nodechildren":
|
|
23242
|
-
this.
|
|
23241
|
+
this.nodechildren = nv;
|
|
23243
23242
|
this.renderTree();
|
|
23244
23243
|
break;
|
|
23245
23244
|
|
|
23246
|
-
case "
|
|
23247
|
-
this.
|
|
23245
|
+
case "orderby":
|
|
23246
|
+
this.orderby = nv;
|
|
23248
23247
|
this.renderTree();
|
|
23249
23248
|
break;
|
|
23250
23249
|
|
|
23251
|
-
case "
|
|
23250
|
+
case "treeicons":
|
|
23251
|
+
this.treeicons = nv;
|
|
23252
23252
|
this.renderTree();
|
|
23253
23253
|
break;
|
|
23254
23254
|
|
|
23255
23255
|
case "class":
|
|
23256
23256
|
this.treeClass = nv;
|
|
23257
|
+
this.setTreeTemplate(this.treeClass);
|
|
23257
23258
|
this.renderTree();
|
|
23258
|
-
break;
|
|
23259
23259
|
|
|
23260
23260
|
default:
|
|
23261
23261
|
_super.prototype.onPropertyChange.call(this, key, nv, ov);
|
|
@@ -23265,9 +23265,9 @@
|
|
|
23265
23265
|
TreeComponent.prototype.expandTree = function(level, node, childLevel) {
|
|
23266
23266
|
var _this = this;
|
|
23267
23267
|
node.map((function(childNode) {
|
|
23268
|
-
var children =
|
|
23269
|
-
if (children &&
|
|
23270
|
-
childNode
|
|
23268
|
+
var children = childNode.children;
|
|
23269
|
+
if (children && childLevel < level) {
|
|
23270
|
+
childNode.open = true;
|
|
23271
23271
|
_this.expandTree(level, children, childLevel + 1);
|
|
23272
23272
|
} else {
|
|
23273
23273
|
childLevel = 0;
|
|
@@ -23276,12 +23276,13 @@
|
|
|
23276
23276
|
}));
|
|
23277
23277
|
};
|
|
23278
23278
|
TreeComponent.prototype.setTreeTemplate = function(value) {
|
|
23279
|
-
|
|
23279
|
+
var classList = value.split(" ");
|
|
23280
|
+
if (classList.includes("Classic")) {
|
|
23280
23281
|
this.setting.check["enable"] = false;
|
|
23281
|
-
} else if (
|
|
23282
|
+
} else if (classList.includes("Checkbox")) {
|
|
23282
23283
|
this.setting.check["enable"] = true;
|
|
23283
23284
|
this.setting.check["chkStyle"] = "checkbox";
|
|
23284
|
-
} else if (
|
|
23285
|
+
} else if (classList.includes("Radio")) {
|
|
23285
23286
|
this.setting.check["enable"] = true;
|
|
23286
23287
|
this.setting.check["chkStyle"] = "radio";
|
|
23287
23288
|
this.setting.check["radioType"] = "all";
|
|
@@ -23308,48 +23309,11 @@
|
|
|
23308
23309
|
}
|
|
23309
23310
|
return nodes;
|
|
23310
23311
|
};
|
|
23311
|
-
TreeComponent.prototype.
|
|
23312
|
+
TreeComponent.prototype.setNodeClasses = function(treeId, treeNode) {
|
|
23312
23313
|
return treeNode.icon ? {
|
|
23313
23314
|
add: [ "" + treeNode.icon ]
|
|
23314
23315
|
} : "";
|
|
23315
23316
|
};
|
|
23316
|
-
TreeComponent.prototype.setNodeData = function(nodes, depth, level, parentNode, type) {
|
|
23317
|
-
var _this = this;
|
|
23318
|
-
if (depth === 0) {
|
|
23319
|
-
nodes.map((function(node) {
|
|
23320
|
-
var children = _this.getChildren(node);
|
|
23321
|
-
if (children) {
|
|
23322
|
-
_this.setNodeData(children, depth, level, parentNode, type);
|
|
23323
|
-
}
|
|
23324
|
-
if (node.icon && _this.nodelabel == "icon") {
|
|
23325
|
-
node[type] = node.icon;
|
|
23326
|
-
} else if (node.name && _this.nodelabel == "name") {
|
|
23327
|
-
node[type] = node.name;
|
|
23328
|
-
} else {
|
|
23329
|
-
return;
|
|
23330
|
-
}
|
|
23331
|
-
}));
|
|
23332
|
-
} else {
|
|
23333
|
-
nodes.map((function(node) {
|
|
23334
|
-
var children = _this.getChildren(node);
|
|
23335
|
-
if (children && level > 1) {
|
|
23336
|
-
if (depth === level) {
|
|
23337
|
-
parentNode = node;
|
|
23338
|
-
}
|
|
23339
|
-
_this.setNodeData(children, depth, level - 1, parentNode, type);
|
|
23340
|
-
}
|
|
23341
|
-
if (level === 1 && (type === "name" ? _this.nodelabel.includes("label") || _this.nodelabel.includes("name") : _this.nodeicon.includes("label") || _this.nodeicon.includes("name"))) {
|
|
23342
|
-
parentNode[type] = node.name || node.label;
|
|
23343
|
-
return;
|
|
23344
|
-
} else if (level === 1 && node.icon !== undefined && (type === "name" ? _this.nodelabel.includes("icon") : _this.nodeicon.includes("icon"))) {
|
|
23345
|
-
parentNode[type] = node.icon;
|
|
23346
|
-
return;
|
|
23347
|
-
} else {
|
|
23348
|
-
return;
|
|
23349
|
-
}
|
|
23350
|
-
}));
|
|
23351
|
-
}
|
|
23352
|
-
};
|
|
23353
23317
|
TreeComponent.prototype.changeTreeIcons = function(nv) {
|
|
23354
23318
|
var eleClose = $('ul[name="' + this.name + '"] li span.button.switch');
|
|
23355
23319
|
$(eleClose).map((function(idx, ele) {
|
|
@@ -23363,15 +23327,15 @@
|
|
|
23363
23327
|
};
|
|
23364
23328
|
TreeComponent.prototype.getPath = function(treeNode, path) {
|
|
23365
23329
|
if (treeNode.getParentNode() === null) {
|
|
23366
|
-
path = "/" + treeNode
|
|
23330
|
+
path = "/" + treeNode.name + path;
|
|
23367
23331
|
} else {
|
|
23368
|
-
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode
|
|
23332
|
+
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode.name;
|
|
23369
23333
|
}
|
|
23370
23334
|
return path;
|
|
23371
23335
|
};
|
|
23372
23336
|
TreeComponent.prototype.onClick = function(event, treeId, treeNode, clickFlag) {
|
|
23373
23337
|
if (this.nodeclick === "expand") {
|
|
23374
|
-
var nodes = this.
|
|
23338
|
+
var nodes = this.zTree.getSelectedNodes();
|
|
23375
23339
|
if (nodes.length > 0) {
|
|
23376
23340
|
this.expandNode(nodes[0], !nodes[0].open, true);
|
|
23377
23341
|
}
|
|
@@ -23383,18 +23347,18 @@
|
|
|
23383
23347
|
var path = this.getPath(treeNode, "");
|
|
23384
23348
|
var eventParams = {
|
|
23385
23349
|
$event: event,
|
|
23386
|
-
$item: treeNode,
|
|
23350
|
+
$item: core.getClonedObject(treeNode.data),
|
|
23387
23351
|
$path: path
|
|
23388
23352
|
};
|
|
23389
23353
|
this.invokeEventCallback("expand", eventParams);
|
|
23390
|
-
var children =
|
|
23354
|
+
var children = treeNode.children;
|
|
23391
23355
|
children === null || children === void 0 ? void 0 : children.map((function(el) {
|
|
23392
23356
|
if (el.isParent) {
|
|
23393
23357
|
var ele_1 = $("#" + el.tId + "_switch");
|
|
23394
|
-
$(ele_1).addClass(self.
|
|
23358
|
+
$(ele_1).addClass(self.treeicons || defaultTreeIconClass);
|
|
23395
23359
|
$(ele_1).on("click", (function(e) {
|
|
23396
23360
|
setTimeout((function() {
|
|
23397
|
-
$(ele_1).addClass(self.
|
|
23361
|
+
$(ele_1).addClass(self.treeicons || defaultTreeIconClass);
|
|
23398
23362
|
}), 0);
|
|
23399
23363
|
}));
|
|
23400
23364
|
}
|
|
@@ -23404,150 +23368,69 @@
|
|
|
23404
23368
|
var path = this.getPath(treeNode, "");
|
|
23405
23369
|
var eventParams = {
|
|
23406
23370
|
$event: event,
|
|
23407
|
-
$item: treeNode,
|
|
23371
|
+
$item: core.getClonedObject(treeNode.data),
|
|
23408
23372
|
$path: path
|
|
23409
23373
|
};
|
|
23410
23374
|
this.invokeEventCallback("collapse", eventParams);
|
|
23411
23375
|
};
|
|
23412
|
-
TreeComponent.prototype.
|
|
23413
|
-
return node[this.childrenKey];
|
|
23414
|
-
};
|
|
23415
|
-
Object.defineProperty(TreeComponent.prototype, "childrenKey", {
|
|
23416
|
-
get: function() {
|
|
23417
|
-
if (!this.nodechildren) {
|
|
23418
|
-
return "children";
|
|
23419
|
-
}
|
|
23420
|
-
var depth = this.countDepth(this.nodechildren);
|
|
23421
|
-
return depth ? this.nodechildren.split(".").pop() : this.nodechildren;
|
|
23422
|
-
},
|
|
23423
|
-
enumerable: false,
|
|
23424
|
-
configurable: true
|
|
23425
|
-
});
|
|
23426
|
-
Object.defineProperty(TreeComponent.prototype, "labelKey", {
|
|
23427
|
-
get: function() {
|
|
23428
|
-
if (!this.nodelabel) {
|
|
23429
|
-
return "label";
|
|
23430
|
-
}
|
|
23431
|
-
var depth = this.countDepth(this.nodelabel);
|
|
23432
|
-
return depth ? this.nodelabel.split(".").pop() : this.nodelabel;
|
|
23433
|
-
},
|
|
23434
|
-
enumerable: false,
|
|
23435
|
-
configurable: true
|
|
23436
|
-
});
|
|
23437
|
-
Object.defineProperty(TreeComponent.prototype, "iconKey", {
|
|
23438
|
-
get: function() {
|
|
23439
|
-
if (!this.nodeicon) {
|
|
23440
|
-
return "icon";
|
|
23441
|
-
}
|
|
23442
|
-
var depth = this.countDepth(this.nodeicon);
|
|
23443
|
-
return depth ? this.nodeicon.split(".").pop() : this.nodeicon;
|
|
23444
|
-
},
|
|
23445
|
-
enumerable: false,
|
|
23446
|
-
configurable: true
|
|
23447
|
-
});
|
|
23448
|
-
Object.defineProperty(TreeComponent.prototype, "treeObj", {
|
|
23449
|
-
get: function() {
|
|
23450
|
-
return $.fn.zTree.getZTreeObj("" + this.name);
|
|
23451
|
-
},
|
|
23452
|
-
enumerable: false,
|
|
23453
|
-
configurable: true
|
|
23454
|
-
});
|
|
23455
|
-
TreeComponent.prototype.modifyObjects = function(array) {
|
|
23376
|
+
TreeComponent.prototype.constructZTreeData = function(data, zTreeData) {
|
|
23456
23377
|
var _this = this;
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
var
|
|
23460
|
-
|
|
23461
|
-
_this.
|
|
23378
|
+
data.forEach((function(node) {
|
|
23379
|
+
var zNode = {};
|
|
23380
|
+
var name = base.getEvaluatedData(node, {
|
|
23381
|
+
field: _this.nodelabel,
|
|
23382
|
+
bindExpression: _this.bindnodelabel
|
|
23383
|
+
}, _this.viewParent) || node.label;
|
|
23384
|
+
var icon = base.getEvaluatedData(node, {
|
|
23385
|
+
field: _this.nodeicon,
|
|
23386
|
+
bindExpression: _this.bindnodeicon
|
|
23387
|
+
}, _this.viewParent) || node.icon;
|
|
23388
|
+
var nodeId = base.getEvaluatedData(node, {
|
|
23389
|
+
field: _this.nodeid,
|
|
23390
|
+
bindExpression: _this.bindnodeid
|
|
23391
|
+
}, _this.viewParent);
|
|
23392
|
+
var children = base.getEvaluatedData(node, {
|
|
23393
|
+
field: _this.nodechildren,
|
|
23394
|
+
bindExpression: _this.bindnodechildren
|
|
23395
|
+
}, _this.viewParent) || node.children;
|
|
23396
|
+
zNode["name"] = name;
|
|
23397
|
+
zNode["icon"] = icon;
|
|
23398
|
+
zNode["nodeId"] = nodeId;
|
|
23399
|
+
zNode["data"] = core.getClonedObject(node);
|
|
23400
|
+
if (_.isArray(children) && children.length) {
|
|
23401
|
+
zNode["children"] = [];
|
|
23402
|
+
_this.constructZTreeData(children, zNode["children"]);
|
|
23462
23403
|
}
|
|
23404
|
+
zTreeData.push(zNode);
|
|
23463
23405
|
}));
|
|
23464
23406
|
};
|
|
23465
|
-
TreeComponent.prototype.setNodeChildren = function(nodes, depth, level, parentNode) {
|
|
23466
|
-
var _this = this;
|
|
23467
|
-
if (depth <= 0) {
|
|
23468
|
-
return nodes;
|
|
23469
|
-
}
|
|
23470
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
23471
|
-
var node = nodes[i];
|
|
23472
|
-
if (depth === level) {
|
|
23473
|
-
parentNode = nodes[i];
|
|
23474
|
-
}
|
|
23475
|
-
var children = this.getChildren(node);
|
|
23476
|
-
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
23477
|
-
if (level === 1) {
|
|
23478
|
-
parentNode[this.childrenKey] = children.map((function(child) {
|
|
23479
|
-
var _a;
|
|
23480
|
-
return _a = {}, _a[_this.labelKey] = child[_this.labelKey], _a[_this.childrenKey] = _this.getChildren(child),
|
|
23481
|
-
_a.icon = child[_this.iconKey], _a;
|
|
23482
|
-
}));
|
|
23483
|
-
return;
|
|
23484
|
-
} else {
|
|
23485
|
-
this.setNodeChildren(children, depth, level - 1, parentNode);
|
|
23486
|
-
}
|
|
23487
|
-
}
|
|
23488
|
-
}
|
|
23489
|
-
return nodes;
|
|
23490
|
-
};
|
|
23491
|
-
TreeComponent.prototype.countDepth = function(str) {
|
|
23492
|
-
var e_1, _a;
|
|
23493
|
-
var regex = /\[.*?\]/g;
|
|
23494
|
-
var matches = str.match(regex);
|
|
23495
|
-
var count = 1;
|
|
23496
|
-
if (matches === null) return count;
|
|
23497
|
-
try {
|
|
23498
|
-
for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
23499
|
-
var match = matches_1_1.value;
|
|
23500
|
-
count++;
|
|
23501
|
-
}
|
|
23502
|
-
} catch (e_1_1) {
|
|
23503
|
-
e_1 = {
|
|
23504
|
-
error: e_1_1
|
|
23505
|
-
};
|
|
23506
|
-
} finally {
|
|
23507
|
-
try {
|
|
23508
|
-
if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
|
|
23509
|
-
} finally {
|
|
23510
|
-
if (e_1) throw e_1.error;
|
|
23511
|
-
}
|
|
23512
|
-
}
|
|
23513
|
-
return count;
|
|
23514
|
-
};
|
|
23515
23407
|
TreeComponent.prototype.renderTree = function() {
|
|
23516
|
-
|
|
23408
|
+
var _a;
|
|
23409
|
+
this.zTreeNodes = [];
|
|
23410
|
+
if ((_a = this.nodes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
23517
23411
|
this.nativeElement.setAttribute("id", this.name);
|
|
23518
|
-
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
this.setTreeTemplate(this.treeClass);
|
|
23522
|
-
if (this.nodelabel) {
|
|
23523
|
-
var depth = 0;
|
|
23524
|
-
if (this.nodelabel.includes("children")) {
|
|
23525
|
-
depth = this.countDepth(this.nodelabel);
|
|
23526
|
-
}
|
|
23527
|
-
this.setNodeData(this.nodes, depth, depth, null, "name");
|
|
23528
|
-
}
|
|
23529
|
-
if (this.nodeicon) {
|
|
23530
|
-
var depth = 0;
|
|
23531
|
-
if (this.nodeicon.includes("children")) {
|
|
23532
|
-
depth = this.countDepth(this.nodeicon);
|
|
23533
|
-
}
|
|
23534
|
-
this.setNodeData(this.nodes, depth, depth, null, "icon");
|
|
23535
|
-
}
|
|
23536
|
-
if (this.nodechildren) {
|
|
23537
|
-
var depth = this.countDepth(this.nodechildren);
|
|
23538
|
-
if (depth > 1) {
|
|
23539
|
-
this.nodes = this.setNodeChildren(this.nodes, depth, depth, null);
|
|
23540
|
-
}
|
|
23412
|
+
this.constructZTreeData(this.nodes, this.zTreeNodes);
|
|
23413
|
+
if (this.level > 0) {
|
|
23414
|
+
this.expandTree(this.level, this.zTreeNodes, 0);
|
|
23541
23415
|
}
|
|
23542
23416
|
}
|
|
23543
|
-
this.
|
|
23544
|
-
this.
|
|
23545
|
-
this.setting.callback["onExpand"] = this.onExpand.bind(this);
|
|
23546
|
-
this.setting.callback["onCollapse"] = this.onCollapse.bind(this);
|
|
23547
|
-
var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
|
|
23548
|
-
$.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
|
|
23417
|
+
this.zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.zTreeNodes);
|
|
23418
|
+
$.fn.zTreeKeyboardNavigation(this.zTree, $('ul[name="' + this.name + '"]'), null, this.treeicons || defaultTreeIconClass);
|
|
23549
23419
|
this.postRenderTree();
|
|
23550
23420
|
};
|
|
23421
|
+
TreeComponent.prototype.setChecked = function(zNode, node) {
|
|
23422
|
+
var _this = this;
|
|
23423
|
+
node.checked = zNode.checked;
|
|
23424
|
+
var children = base.getEvaluatedData(node, {
|
|
23425
|
+
field: this.nodechildren,
|
|
23426
|
+
bindExpression: this.bindnodechildren
|
|
23427
|
+
}, this.viewParent) || node.children;
|
|
23428
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
23429
|
+
children.forEach((function(node, index) {
|
|
23430
|
+
_this.setChecked(zNode.children[index], node);
|
|
23431
|
+
}));
|
|
23432
|
+
}
|
|
23433
|
+
};
|
|
23551
23434
|
TreeComponent.prototype.selectNode = function(event, node) {
|
|
23552
23435
|
var deSelectElm = $(".app-tree[name=" + this.name + "] li[treenode].selected");
|
|
23553
23436
|
deSelectElm.removeClass("selected");
|
|
@@ -23556,27 +23439,35 @@
|
|
|
23556
23439
|
}
|
|
23557
23440
|
var selectElm = $("#" + node.tId + ":has(.curSelectedNode)");
|
|
23558
23441
|
selectElm.addClass("selected");
|
|
23442
|
+
var classList = (this.treeClass || "").split(" ");
|
|
23443
|
+
if (classList.includes("Checkbox") || classList.includes("Radio")) {
|
|
23444
|
+
this.setChecked(node, node.data);
|
|
23445
|
+
}
|
|
23559
23446
|
var path = this.getPath(node, "");
|
|
23560
|
-
this.selecteditem = core.getClonedObject(node) || {};
|
|
23447
|
+
this.selecteditem = core.getClonedObject(node.data) || {};
|
|
23561
23448
|
this.selecteditem.path = path;
|
|
23562
23449
|
var eventParams = {
|
|
23563
23450
|
$event: event,
|
|
23564
|
-
$item: node,
|
|
23451
|
+
$item: core.getClonedObject(node.data),
|
|
23565
23452
|
$path: path
|
|
23566
23453
|
};
|
|
23454
|
+
var nodeAction = node.data[this.nodeaction || "action"];
|
|
23455
|
+
if (nodeAction) {
|
|
23456
|
+
core.$parseEvent(nodeAction)(this);
|
|
23457
|
+
}
|
|
23567
23458
|
this.invokeEventCallback("select", eventParams);
|
|
23568
23459
|
};
|
|
23569
23460
|
TreeComponent.prototype.expandNode = function(node, expand, eventFlag) {
|
|
23570
|
-
this.
|
|
23461
|
+
this.zTree.expandNode(node, expand, false, false, eventFlag);
|
|
23571
23462
|
var el = $("#" + node.tId + "_switch");
|
|
23572
|
-
$(el).addClass(this.
|
|
23463
|
+
$(el).addClass(this.treeicons || defaultTreeIconClass);
|
|
23573
23464
|
};
|
|
23574
23465
|
TreeComponent.prototype.postRenderTree = function() {
|
|
23575
23466
|
var _this = this;
|
|
23576
23467
|
setTimeout((function() {
|
|
23577
|
-
_this.changeTreeIcons(_this.
|
|
23468
|
+
_this.changeTreeIcons(_this.treeicons || defaultTreeIconClass);
|
|
23578
23469
|
if (_this.datavalue && !_this.selecteditem) {
|
|
23579
|
-
var nodes = _this.
|
|
23470
|
+
var nodes = _this.zTree.getNodes();
|
|
23580
23471
|
var node = void 0;
|
|
23581
23472
|
if (nodes.length) {
|
|
23582
23473
|
if (_this.datavalue === "FirstNode") {
|
|
@@ -23587,7 +23478,7 @@
|
|
|
23587
23478
|
}
|
|
23588
23479
|
}
|
|
23589
23480
|
if (node) {
|
|
23590
|
-
_this.
|
|
23481
|
+
_this.zTree.selectNode(node, false);
|
|
23591
23482
|
_this.selectNode(undefined, node);
|
|
23592
23483
|
_this.expandNode(node, true, false);
|
|
23593
23484
|
}
|
|
@@ -23595,16 +23486,13 @@
|
|
|
23595
23486
|
}), 200);
|
|
23596
23487
|
};
|
|
23597
23488
|
TreeComponent.prototype.selectById = function(value) {
|
|
23598
|
-
var
|
|
23599
|
-
var simpleNodes = this.
|
|
23600
|
-
var node = simpleNodes.find((function(node) {
|
|
23601
|
-
return value ===
|
|
23602
|
-
field: _this.nodeid,
|
|
23603
|
-
bindExpression: _this.bindnodeid
|
|
23604
|
-
}, _this.viewParent);
|
|
23489
|
+
var _a;
|
|
23490
|
+
var simpleNodes = (_a = this.zTree) === null || _a === void 0 ? void 0 : _a.transformToArray(this.zTree.getNodes());
|
|
23491
|
+
var node = simpleNodes === null || simpleNodes === void 0 ? void 0 : simpleNodes.find((function(node) {
|
|
23492
|
+
return value === node.nodeId;
|
|
23605
23493
|
}));
|
|
23606
23494
|
if (node) {
|
|
23607
|
-
this.
|
|
23495
|
+
this.zTree.selectNode(node, false);
|
|
23608
23496
|
this.selectNode(undefined, node);
|
|
23609
23497
|
}
|
|
23610
23498
|
};
|
|
@@ -23627,6 +23515,30 @@
|
|
|
23627
23515
|
TreeComponent.ctorParameters = function() {
|
|
23628
23516
|
return [ {
|
|
23629
23517
|
type: core$1.Injector
|
|
23518
|
+
}, {
|
|
23519
|
+
type: undefined,
|
|
23520
|
+
decorators: [ {
|
|
23521
|
+
type: core$1.Attribute,
|
|
23522
|
+
args: [ "datavalue.bind" ]
|
|
23523
|
+
} ]
|
|
23524
|
+
}, {
|
|
23525
|
+
type: undefined,
|
|
23526
|
+
decorators: [ {
|
|
23527
|
+
type: core$1.Attribute,
|
|
23528
|
+
args: [ "nodelabel.bind" ]
|
|
23529
|
+
} ]
|
|
23530
|
+
}, {
|
|
23531
|
+
type: undefined,
|
|
23532
|
+
decorators: [ {
|
|
23533
|
+
type: core$1.Attribute,
|
|
23534
|
+
args: [ "nodeicon.bind" ]
|
|
23535
|
+
} ]
|
|
23536
|
+
}, {
|
|
23537
|
+
type: undefined,
|
|
23538
|
+
decorators: [ {
|
|
23539
|
+
type: core$1.Attribute,
|
|
23540
|
+
args: [ "nodechildren.bind" ]
|
|
23541
|
+
} ]
|
|
23630
23542
|
}, {
|
|
23631
23543
|
type: undefined,
|
|
23632
23544
|
decorators: [ {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
125
125
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
126
126
|
PERFORMANCE OF THIS SOFTWARE.
|
|
127
|
-
***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,a=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,a=t.length;o<a;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},p={widgetType:"wm-tree",hostClass:"app-tree"},d="plus-minus",u=function(e){function t(t,n){var o=e.call(this,t,p)||this;return o.bindnodeid=n,o.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(o.nativeElement,o,i.APPLY_STYLES_TYPE.CONTAINER),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.level>0&&this.expandTree(this.level,this.nodes,0),this.renderTree();break;case"levels":n>0&&(this.level=n),this.renderTree();break;case"treeicons":this.treeicon=n,this.renderTree();break;case"nodelabel":this.setting.data.key.name=this.labelKey,this.renderTree();break;case"nodechildren":this.setting.data.key.children=this.childrenKey,this.renderTree();break;case"nodeicon":this.nodeicon=this.iconKey,this.renderTree();break;case"orderby":this.renderTree();break;case"class":this.treeClass=n,this.renderTree();break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=i.getChildren(t);o&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){"Classic"===e?this.setting.check.enable=!1:"Checkbox"===e?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):"Radio"===e&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeclasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.setNodeData=function(e,t,n,i,o){var a=this;0===t?e.map((function(e){var r=a.getChildren(e);if(r&&a.setNodeData(r,t,n,i,o),e.icon&&"icon"==a.nodelabel)e[o]=e.icon;else{if(!e.name||"name"!=a.nodelabel)return;e[o]=e.name}})):e.map((function(e){var r=a.getChildren(e);return r&&n>1&&(t===n&&(i=e),a.setNodeData(r,t,n-1,i,o)),1===n&&("name"===o?a.nodelabel.includes("label")||a.nodelabel.includes("name"):a.nodeicon.includes("label")||a.nodeicon.includes("name"))?void(i[o]=e.name||e.label):1===n&&void 0!==e.icon&&("name"===o?a.nodelabel.includes("icon"):a.nodeicon.includes("icon"))?void(i[o]=e.icon):void 0}))},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e[this.labelKey]+t:this.getPath(e.getParentNode(),t)+"/"+e[this.labelKey]},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.treeObj.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o);var a=this.getChildren(n);null==a||a.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||d),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||d)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.getChildren=function(e){return e[this.childrenKey]},Object.defineProperty(t.prototype,"childrenKey",{get:function(){return this.nodechildren?this.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren:"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.nodelabel?this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel:"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return this.nodeicon?this.countDepth(this.nodeicon)?this.nodeicon.split(".").pop():this.nodeicon:"icon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"treeObj",{get:function(){return $.fn.zTree.getZTreeObj(""+this.name)},enumerable:!1,configurable:!0}),t.prototype.modifyObjects=function(e){var t=this;e.forEach((function(e){e.icon=e[t.nodeicon];var n=t.getChildren(e);(null==n?void 0:n.length)&&t.modifyObjects(n)}))},t.prototype.setNodeChildren=function(e,t,n,i){var o=this;if(t<=0)return e;for(var a=0;a<e.length;a++){var r=e[a];t===n&&(i=e[a]);var s=this.getChildren(r);if(null==s?void 0:s.length){if(1===n)return void(i[this.childrenKey]=s.map((function(e){var t;return(t={})[o.labelKey]=e[o.labelKey],t[o.childrenKey]=o.getChildren(e),t.icon=e[o.iconKey],t})));this.setNodeChildren(s,t,n-1,i)}}return e},t.prototype.countDepth=function(e){var t,n,i=e.match(/\[.*?\]/g),o=1;if(null===i)return o;try{for(var a=r(i),s=a.next();!s.done;s=a.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodeicon&&"icon"!==this.nodeicon&&this.modifyObjects(this.nodes),this.setTreeTemplate(this.treeClass),this.nodelabel){var e=0;this.nodelabel.includes("children")&&(e=this.countDepth(this.nodelabel)),this.setNodeData(this.nodes,e,e,null,"name")}if(this.nodeicon){e=0;this.nodeicon.includes("children")&&(e=this.countDepth(this.nodeicon)),this.setNodeData(this.nodes,e,e,null,"icon")}if(this.nodechildren)(e=this.countDepth(this.nodechildren))>1&&(this.nodes=this.setNodeChildren(this.nodes,e,e,null))}this.setting.view.nodeClasses=this.setNodeclasses,this.setting.callback.onClick=this.onClick.bind(this),this.setting.callback.onExpand=this.onExpand.bind(this),this.setting.callback.onCollapse=this.onCollapse.bind(this);var t=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.nodes);$.fn.zTreeKeyboardNavigation(t,$('ul[name="'+this.name+'"]'),null,this.treeicon||d),this.postRenderTree()},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=this.getPath(t,"");this.selecteditem=o.getClonedObject(t)||{},this.selecteditem.path=n;var i={$event:e,$item:t,$path:n};this.invokeEventCallback("select",i)}},t.prototype.expandNode=function(e,t,n){this.treeObj.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicon||d)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||d),e.datavalue&&!e.selecteditem){var t=e.treeObj.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.treeObj.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t=this,n=this.treeObj.transformToArray(this.treeObj.getNodes()).find((function(n){return e===i.getEvaluatedData(n,{field:t.nodeid,bindExpression:t.bindnodeid},t.viewParent)}));n&&(this.treeObj.selectNode(n,!1),this.selectNode(void 0,n))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);u.initializeProps=c(),u.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(u)],encapsulation:t.ViewEncapsulation.None}]}],u.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var h=[u],m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(h)),exports:l([],s(h)),entryComponents:[]}]}],e.TreeComponent=u,e.TreeModule=m,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,a,r){"use strict";
|
|
127
|
+
***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,a=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}function s(e,t,n){if(n||2===arguments.length)for(var i,o=0,a=t.length;o<a;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var l=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},c={widgetType:"wm-tree",hostClass:"app-tree"},p="plus-minus",d=function(e){function t(t,n,o,a,r,s){var l=e.call(this,t,c)||this;return l.binddatavalue=n,l.bindnodelabel=o,l.bindnodeicon=a,l.bindnodechildren=r,l.bindnodeid=s,l.setting={data:{simpleData:{enable:!1}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(l.nativeElement,l,i.APPLY_STYLES_TYPE.CONTAINER),l.setting.view.nodeClasses=l.setNodeClasses,l.setting.callback.onClick=l.onClick.bind(l),l.setting.callback.onExpand=l.onExpand.bind(l),l.setting.callback.onCollapse=l.onCollapse.bind(l),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.renderTree();break;case"levels":this.level=n,this.renderTree();break;case"nodeicon":this.nodeicon=n,this.renderTree();break;case"nodelabel":this.nodelabel=n,this.renderTree();break;case"nodechildren":this.nodechildren=n,this.renderTree();break;case"orderby":this.orderby=n,this.renderTree();break;case"treeicons":this.treeicons=n,this.renderTree();break;case"class":this.treeClass=n,this.setTreeTemplate(this.treeClass),this.renderTree();default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=t.children;o&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){var t=e.split(" ");t.includes("Classic")?this.setting.check.enable=!1:t.includes("Checkbox")?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):t.includes("Radio")&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeClasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e.name+t:this.getPath(e.getParentNode(),t)+"/"+e.name},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.zTree.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,a=this.getPath(n,""),r={$event:e,$item:o.getClonedObject(n.data),$path:a};this.invokeEventCallback("expand",r);var s=n.children;null==s||s.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicons||p),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicons||p)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i=this.getPath(n,""),a={$event:e,$item:o.getClonedObject(n.data),$path:i};this.invokeEventCallback("collapse",a)},t.prototype.constructZTreeData=function(e,t){var n=this;e.forEach((function(e){var a={},r=i.getEvaluatedData(e,{field:n.nodelabel,bindExpression:n.bindnodelabel},n.viewParent)||e.label,s=i.getEvaluatedData(e,{field:n.nodeicon,bindExpression:n.bindnodeicon},n.viewParent)||e.icon,l=i.getEvaluatedData(e,{field:n.nodeid,bindExpression:n.bindnodeid},n.viewParent),c=i.getEvaluatedData(e,{field:n.nodechildren,bindExpression:n.bindnodechildren},n.viewParent)||e.children;a.name=r,a.icon=s,a.nodeId=l,a.data=o.getClonedObject(e),_.isArray(c)&&c.length&&(a.children=[],n.constructZTreeData(c,a.children)),t.push(a)}))},t.prototype.renderTree=function(){var e;this.zTreeNodes=[],(null===(e=this.nodes)||void 0===e?void 0:e.length)&&(this.nativeElement.setAttribute("id",this.name),this.constructZTreeData(this.nodes,this.zTreeNodes),this.level>0&&this.expandTree(this.level,this.zTreeNodes,0)),this.zTree=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.zTreeNodes),$.fn.zTreeKeyboardNavigation(this.zTree,$('ul[name="'+this.name+'"]'),null,this.treeicons||p),this.postRenderTree()},t.prototype.setChecked=function(e,t){var n=this;t.checked=e.checked;var o=i.getEvaluatedData(t,{field:this.nodechildren,bindExpression:this.bindnodechildren},this.viewParent)||t.children;(null==o?void 0:o.length)&&o.forEach((function(t,i){n.setChecked(e.children[i],t)}))},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=(this.treeClass||"").split(" ");(n.includes("Checkbox")||n.includes("Radio"))&&this.setChecked(t,t.data);var i=this.getPath(t,"");this.selecteditem=o.getClonedObject(t.data)||{},this.selecteditem.path=i;var a={$event:e,$item:o.getClonedObject(t.data),$path:i},r=t.data[this.nodeaction||"action"];r&&o.$parseEvent(r)(this),this.invokeEventCallback("select",a)}},t.prototype.expandNode=function(e,t,n){this.zTree.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicons||p)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicons||p),e.datavalue&&!e.selecteditem){var t=e.zTree.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.zTree.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t,n=null===(t=this.zTree)||void 0===t?void 0:t.transformToArray(this.zTree.getNodes()),i=null==n?void 0:n.find((function(t){return e===t.nodeId}));i&&(this.zTree.selectNode(i,!1),this.selectNode(void 0,i))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);d.initializeProps=l(),d.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(d)],encapsulation:t.ViewEncapsulation.None}]}],d.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["datavalue.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodelabel.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodeicon.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodechildren.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var u=[d],h=function(){};h.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:s([],r(u)),exports:s([],r(u)),entryComponents:[]}]}],e.TreeComponent=d,e.TreeModule=h,e["\u0275a"]=l,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,a,r){"use strict";
|
|
128
128
|
/*! *****************************************************************************
|
|
129
129
|
Copyright (c) Microsoft Corporation.
|
|
130
130
|
|
|
@@ -23185,17 +23185,17 @@
|
|
|
23185
23185
|
var defaultTreeIconClass = "plus-minus";
|
|
23186
23186
|
var TreeComponent = function(_super) {
|
|
23187
23187
|
__extends(TreeComponent, _super);
|
|
23188
|
-
function TreeComponent(inj, bindnodeid) {
|
|
23188
|
+
function TreeComponent(inj, binddatavalue, bindnodelabel, bindnodeicon, bindnodechildren, bindnodeid) {
|
|
23189
23189
|
var _this = _super.call(this, inj, WIDGET_INFO) || this;
|
|
23190
|
+
_this.binddatavalue = binddatavalue;
|
|
23191
|
+
_this.bindnodelabel = bindnodelabel;
|
|
23192
|
+
_this.bindnodeicon = bindnodeicon;
|
|
23193
|
+
_this.bindnodechildren = bindnodechildren;
|
|
23190
23194
|
_this.bindnodeid = bindnodeid;
|
|
23191
23195
|
_this.setting = {
|
|
23192
23196
|
data: {
|
|
23193
23197
|
simpleData: {
|
|
23194
23198
|
enable: false
|
|
23195
|
-
},
|
|
23196
|
-
key: {
|
|
23197
|
-
children: "children",
|
|
23198
|
-
name: "label"
|
|
23199
23199
|
}
|
|
23200
23200
|
},
|
|
23201
23201
|
view: {
|
|
@@ -23209,53 +23209,53 @@
|
|
|
23209
23209
|
callback: {}
|
|
23210
23210
|
};
|
|
23211
23211
|
base.styler(_this.nativeElement, _this, base.APPLY_STYLES_TYPE.CONTAINER);
|
|
23212
|
+
_this.setting.view["nodeClasses"] = _this.setNodeClasses;
|
|
23213
|
+
_this.setting.callback["onClick"] = _this.onClick.bind(_this);
|
|
23214
|
+
_this.setting.callback["onExpand"] = _this.onExpand.bind(_this);
|
|
23215
|
+
_this.setting.callback["onCollapse"] = _this.onCollapse.bind(_this);
|
|
23212
23216
|
return _this;
|
|
23213
23217
|
}
|
|
23214
23218
|
TreeComponent.prototype.onPropertyChange = function(key, nv, ov) {
|
|
23215
23219
|
switch (key) {
|
|
23216
23220
|
case "dataset":
|
|
23217
23221
|
this.nodes = this.getNodes(nv);
|
|
23218
|
-
if (this.level > 0) {
|
|
23219
|
-
this.expandTree(this.level, this.nodes, 0);
|
|
23220
|
-
}
|
|
23221
23222
|
this.renderTree();
|
|
23222
23223
|
break;
|
|
23223
23224
|
|
|
23224
23225
|
case "levels":
|
|
23225
|
-
|
|
23226
|
-
this.level = nv;
|
|
23227
|
-
}
|
|
23226
|
+
this.level = nv;
|
|
23228
23227
|
this.renderTree();
|
|
23229
23228
|
break;
|
|
23230
23229
|
|
|
23231
|
-
case "
|
|
23232
|
-
this.
|
|
23230
|
+
case "nodeicon":
|
|
23231
|
+
this.nodeicon = nv;
|
|
23233
23232
|
this.renderTree();
|
|
23234
23233
|
break;
|
|
23235
23234
|
|
|
23236
23235
|
case "nodelabel":
|
|
23237
|
-
this.
|
|
23236
|
+
this.nodelabel = nv;
|
|
23238
23237
|
this.renderTree();
|
|
23239
23238
|
break;
|
|
23240
23239
|
|
|
23241
23240
|
case "nodechildren":
|
|
23242
|
-
this.
|
|
23241
|
+
this.nodechildren = nv;
|
|
23243
23242
|
this.renderTree();
|
|
23244
23243
|
break;
|
|
23245
23244
|
|
|
23246
|
-
case "
|
|
23247
|
-
this.
|
|
23245
|
+
case "orderby":
|
|
23246
|
+
this.orderby = nv;
|
|
23248
23247
|
this.renderTree();
|
|
23249
23248
|
break;
|
|
23250
23249
|
|
|
23251
|
-
case "
|
|
23250
|
+
case "treeicons":
|
|
23251
|
+
this.treeicons = nv;
|
|
23252
23252
|
this.renderTree();
|
|
23253
23253
|
break;
|
|
23254
23254
|
|
|
23255
23255
|
case "class":
|
|
23256
23256
|
this.treeClass = nv;
|
|
23257
|
+
this.setTreeTemplate(this.treeClass);
|
|
23257
23258
|
this.renderTree();
|
|
23258
|
-
break;
|
|
23259
23259
|
|
|
23260
23260
|
default:
|
|
23261
23261
|
_super.prototype.onPropertyChange.call(this, key, nv, ov);
|
|
@@ -23265,9 +23265,9 @@
|
|
|
23265
23265
|
TreeComponent.prototype.expandTree = function(level, node, childLevel) {
|
|
23266
23266
|
var _this = this;
|
|
23267
23267
|
node.map((function(childNode) {
|
|
23268
|
-
var children =
|
|
23269
|
-
if (children &&
|
|
23270
|
-
childNode
|
|
23268
|
+
var children = childNode.children;
|
|
23269
|
+
if (children && childLevel < level) {
|
|
23270
|
+
childNode.open = true;
|
|
23271
23271
|
_this.expandTree(level, children, childLevel + 1);
|
|
23272
23272
|
} else {
|
|
23273
23273
|
childLevel = 0;
|
|
@@ -23276,12 +23276,13 @@
|
|
|
23276
23276
|
}));
|
|
23277
23277
|
};
|
|
23278
23278
|
TreeComponent.prototype.setTreeTemplate = function(value) {
|
|
23279
|
-
|
|
23279
|
+
var classList = value.split(" ");
|
|
23280
|
+
if (classList.includes("Classic")) {
|
|
23280
23281
|
this.setting.check["enable"] = false;
|
|
23281
|
-
} else if (
|
|
23282
|
+
} else if (classList.includes("Checkbox")) {
|
|
23282
23283
|
this.setting.check["enable"] = true;
|
|
23283
23284
|
this.setting.check["chkStyle"] = "checkbox";
|
|
23284
|
-
} else if (
|
|
23285
|
+
} else if (classList.includes("Radio")) {
|
|
23285
23286
|
this.setting.check["enable"] = true;
|
|
23286
23287
|
this.setting.check["chkStyle"] = "radio";
|
|
23287
23288
|
this.setting.check["radioType"] = "all";
|
|
@@ -23308,48 +23309,11 @@
|
|
|
23308
23309
|
}
|
|
23309
23310
|
return nodes;
|
|
23310
23311
|
};
|
|
23311
|
-
TreeComponent.prototype.
|
|
23312
|
+
TreeComponent.prototype.setNodeClasses = function(treeId, treeNode) {
|
|
23312
23313
|
return treeNode.icon ? {
|
|
23313
23314
|
add: [ "" + treeNode.icon ]
|
|
23314
23315
|
} : "";
|
|
23315
23316
|
};
|
|
23316
|
-
TreeComponent.prototype.setNodeData = function(nodes, depth, level, parentNode, type) {
|
|
23317
|
-
var _this = this;
|
|
23318
|
-
if (depth === 0) {
|
|
23319
|
-
nodes.map((function(node) {
|
|
23320
|
-
var children = _this.getChildren(node);
|
|
23321
|
-
if (children) {
|
|
23322
|
-
_this.setNodeData(children, depth, level, parentNode, type);
|
|
23323
|
-
}
|
|
23324
|
-
if (node.icon && _this.nodelabel == "icon") {
|
|
23325
|
-
node[type] = node.icon;
|
|
23326
|
-
} else if (node.name && _this.nodelabel == "name") {
|
|
23327
|
-
node[type] = node.name;
|
|
23328
|
-
} else {
|
|
23329
|
-
return;
|
|
23330
|
-
}
|
|
23331
|
-
}));
|
|
23332
|
-
} else {
|
|
23333
|
-
nodes.map((function(node) {
|
|
23334
|
-
var children = _this.getChildren(node);
|
|
23335
|
-
if (children && level > 1) {
|
|
23336
|
-
if (depth === level) {
|
|
23337
|
-
parentNode = node;
|
|
23338
|
-
}
|
|
23339
|
-
_this.setNodeData(children, depth, level - 1, parentNode, type);
|
|
23340
|
-
}
|
|
23341
|
-
if (level === 1 && (type === "name" ? _this.nodelabel.includes("label") || _this.nodelabel.includes("name") : _this.nodeicon.includes("label") || _this.nodeicon.includes("name"))) {
|
|
23342
|
-
parentNode[type] = node.name || node.label;
|
|
23343
|
-
return;
|
|
23344
|
-
} else if (level === 1 && node.icon !== undefined && (type === "name" ? _this.nodelabel.includes("icon") : _this.nodeicon.includes("icon"))) {
|
|
23345
|
-
parentNode[type] = node.icon;
|
|
23346
|
-
return;
|
|
23347
|
-
} else {
|
|
23348
|
-
return;
|
|
23349
|
-
}
|
|
23350
|
-
}));
|
|
23351
|
-
}
|
|
23352
|
-
};
|
|
23353
23317
|
TreeComponent.prototype.changeTreeIcons = function(nv) {
|
|
23354
23318
|
var eleClose = $('ul[name="' + this.name + '"] li span.button.switch');
|
|
23355
23319
|
$(eleClose).map((function(idx, ele) {
|
|
@@ -23363,15 +23327,15 @@
|
|
|
23363
23327
|
};
|
|
23364
23328
|
TreeComponent.prototype.getPath = function(treeNode, path) {
|
|
23365
23329
|
if (treeNode.getParentNode() === null) {
|
|
23366
|
-
path = "/" + treeNode
|
|
23330
|
+
path = "/" + treeNode.name + path;
|
|
23367
23331
|
} else {
|
|
23368
|
-
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode
|
|
23332
|
+
path = this.getPath(treeNode.getParentNode(), path) + "/" + treeNode.name;
|
|
23369
23333
|
}
|
|
23370
23334
|
return path;
|
|
23371
23335
|
};
|
|
23372
23336
|
TreeComponent.prototype.onClick = function(event, treeId, treeNode, clickFlag) {
|
|
23373
23337
|
if (this.nodeclick === "expand") {
|
|
23374
|
-
var nodes = this.
|
|
23338
|
+
var nodes = this.zTree.getSelectedNodes();
|
|
23375
23339
|
if (nodes.length > 0) {
|
|
23376
23340
|
this.expandNode(nodes[0], !nodes[0].open, true);
|
|
23377
23341
|
}
|
|
@@ -23383,18 +23347,18 @@
|
|
|
23383
23347
|
var path = this.getPath(treeNode, "");
|
|
23384
23348
|
var eventParams = {
|
|
23385
23349
|
$event: event,
|
|
23386
|
-
$item: treeNode,
|
|
23350
|
+
$item: core.getClonedObject(treeNode.data),
|
|
23387
23351
|
$path: path
|
|
23388
23352
|
};
|
|
23389
23353
|
this.invokeEventCallback("expand", eventParams);
|
|
23390
|
-
var children =
|
|
23354
|
+
var children = treeNode.children;
|
|
23391
23355
|
children === null || children === void 0 ? void 0 : children.map((function(el) {
|
|
23392
23356
|
if (el.isParent) {
|
|
23393
23357
|
var ele_1 = $("#" + el.tId + "_switch");
|
|
23394
|
-
$(ele_1).addClass(self.
|
|
23358
|
+
$(ele_1).addClass(self.treeicons || defaultTreeIconClass);
|
|
23395
23359
|
$(ele_1).on("click", (function(e) {
|
|
23396
23360
|
setTimeout((function() {
|
|
23397
|
-
$(ele_1).addClass(self.
|
|
23361
|
+
$(ele_1).addClass(self.treeicons || defaultTreeIconClass);
|
|
23398
23362
|
}), 0);
|
|
23399
23363
|
}));
|
|
23400
23364
|
}
|
|
@@ -23404,150 +23368,69 @@
|
|
|
23404
23368
|
var path = this.getPath(treeNode, "");
|
|
23405
23369
|
var eventParams = {
|
|
23406
23370
|
$event: event,
|
|
23407
|
-
$item: treeNode,
|
|
23371
|
+
$item: core.getClonedObject(treeNode.data),
|
|
23408
23372
|
$path: path
|
|
23409
23373
|
};
|
|
23410
23374
|
this.invokeEventCallback("collapse", eventParams);
|
|
23411
23375
|
};
|
|
23412
|
-
TreeComponent.prototype.
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
}
|
|
23420
|
-
var
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23424
|
-
|
|
23425
|
-
|
|
23426
|
-
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
if (!this.nodeicon) {
|
|
23440
|
-
return "icon";
|
|
23441
|
-
}
|
|
23442
|
-
var depth = this.countDepth(this.nodeicon);
|
|
23443
|
-
return depth ? this.nodeicon.split(".").pop() : this.nodeicon;
|
|
23444
|
-
},
|
|
23445
|
-
enumerable: false,
|
|
23446
|
-
configurable: true
|
|
23447
|
-
});
|
|
23448
|
-
Object.defineProperty(TreeComponent.prototype, "treeObj", {
|
|
23449
|
-
get: function() {
|
|
23450
|
-
return $.fn.zTree.getZTreeObj("" + this.name);
|
|
23451
|
-
},
|
|
23452
|
-
enumerable: false,
|
|
23453
|
-
configurable: true
|
|
23454
|
-
});
|
|
23455
|
-
TreeComponent.prototype.modifyObjects = function(array) {
|
|
23456
|
-
var _this = this;
|
|
23457
|
-
array.forEach((function(obj) {
|
|
23458
|
-
obj.icon = obj[_this.nodeicon];
|
|
23459
|
-
var children = _this.getChildren(obj);
|
|
23460
|
-
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
23461
|
-
_this.modifyObjects(children);
|
|
23376
|
+
TreeComponent.prototype.constructZTreeData = function(data, zTreeData) {
|
|
23377
|
+
var _this = this;
|
|
23378
|
+
data.forEach((function(node) {
|
|
23379
|
+
var zNode = {};
|
|
23380
|
+
var name = base.getEvaluatedData(node, {
|
|
23381
|
+
field: _this.nodelabel,
|
|
23382
|
+
bindExpression: _this.bindnodelabel
|
|
23383
|
+
}, _this.viewParent) || node.label;
|
|
23384
|
+
var icon = base.getEvaluatedData(node, {
|
|
23385
|
+
field: _this.nodeicon,
|
|
23386
|
+
bindExpression: _this.bindnodeicon
|
|
23387
|
+
}, _this.viewParent) || node.icon;
|
|
23388
|
+
var nodeId = base.getEvaluatedData(node, {
|
|
23389
|
+
field: _this.nodeid,
|
|
23390
|
+
bindExpression: _this.bindnodeid
|
|
23391
|
+
}, _this.viewParent);
|
|
23392
|
+
var children = base.getEvaluatedData(node, {
|
|
23393
|
+
field: _this.nodechildren,
|
|
23394
|
+
bindExpression: _this.bindnodechildren
|
|
23395
|
+
}, _this.viewParent) || node.children;
|
|
23396
|
+
zNode["name"] = name;
|
|
23397
|
+
zNode["icon"] = icon;
|
|
23398
|
+
zNode["nodeId"] = nodeId;
|
|
23399
|
+
zNode["data"] = core.getClonedObject(node);
|
|
23400
|
+
if (_.isArray(children) && children.length) {
|
|
23401
|
+
zNode["children"] = [];
|
|
23402
|
+
_this.constructZTreeData(children, zNode["children"]);
|
|
23462
23403
|
}
|
|
23404
|
+
zTreeData.push(zNode);
|
|
23463
23405
|
}));
|
|
23464
23406
|
};
|
|
23465
|
-
TreeComponent.prototype.setNodeChildren = function(nodes, depth, level, parentNode) {
|
|
23466
|
-
var _this = this;
|
|
23467
|
-
if (depth <= 0) {
|
|
23468
|
-
return nodes;
|
|
23469
|
-
}
|
|
23470
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
23471
|
-
var node = nodes[i];
|
|
23472
|
-
if (depth === level) {
|
|
23473
|
-
parentNode = nodes[i];
|
|
23474
|
-
}
|
|
23475
|
-
var children = this.getChildren(node);
|
|
23476
|
-
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
23477
|
-
if (level === 1) {
|
|
23478
|
-
parentNode[this.childrenKey] = children.map((function(child) {
|
|
23479
|
-
var _a;
|
|
23480
|
-
return _a = {}, _a[_this.labelKey] = child[_this.labelKey], _a[_this.childrenKey] = _this.getChildren(child),
|
|
23481
|
-
_a.icon = child[_this.iconKey], _a;
|
|
23482
|
-
}));
|
|
23483
|
-
return;
|
|
23484
|
-
} else {
|
|
23485
|
-
this.setNodeChildren(children, depth, level - 1, parentNode);
|
|
23486
|
-
}
|
|
23487
|
-
}
|
|
23488
|
-
}
|
|
23489
|
-
return nodes;
|
|
23490
|
-
};
|
|
23491
|
-
TreeComponent.prototype.countDepth = function(str) {
|
|
23492
|
-
var e_1, _a;
|
|
23493
|
-
var regex = /\[.*?\]/g;
|
|
23494
|
-
var matches = str.match(regex);
|
|
23495
|
-
var count = 1;
|
|
23496
|
-
if (matches === null) return count;
|
|
23497
|
-
try {
|
|
23498
|
-
for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
|
|
23499
|
-
var match = matches_1_1.value;
|
|
23500
|
-
count++;
|
|
23501
|
-
}
|
|
23502
|
-
} catch (e_1_1) {
|
|
23503
|
-
e_1 = {
|
|
23504
|
-
error: e_1_1
|
|
23505
|
-
};
|
|
23506
|
-
} finally {
|
|
23507
|
-
try {
|
|
23508
|
-
if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
|
|
23509
|
-
} finally {
|
|
23510
|
-
if (e_1) throw e_1.error;
|
|
23511
|
-
}
|
|
23512
|
-
}
|
|
23513
|
-
return count;
|
|
23514
|
-
};
|
|
23515
23407
|
TreeComponent.prototype.renderTree = function() {
|
|
23516
|
-
|
|
23408
|
+
var _a;
|
|
23409
|
+
this.zTreeNodes = [];
|
|
23410
|
+
if ((_a = this.nodes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
23517
23411
|
this.nativeElement.setAttribute("id", this.name);
|
|
23518
|
-
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
this.setTreeTemplate(this.treeClass);
|
|
23522
|
-
if (this.nodelabel) {
|
|
23523
|
-
var depth = 0;
|
|
23524
|
-
if (this.nodelabel.includes("children")) {
|
|
23525
|
-
depth = this.countDepth(this.nodelabel);
|
|
23526
|
-
}
|
|
23527
|
-
this.setNodeData(this.nodes, depth, depth, null, "name");
|
|
23528
|
-
}
|
|
23529
|
-
if (this.nodeicon) {
|
|
23530
|
-
var depth = 0;
|
|
23531
|
-
if (this.nodeicon.includes("children")) {
|
|
23532
|
-
depth = this.countDepth(this.nodeicon);
|
|
23533
|
-
}
|
|
23534
|
-
this.setNodeData(this.nodes, depth, depth, null, "icon");
|
|
23535
|
-
}
|
|
23536
|
-
if (this.nodechildren) {
|
|
23537
|
-
var depth = this.countDepth(this.nodechildren);
|
|
23538
|
-
if (depth > 1) {
|
|
23539
|
-
this.nodes = this.setNodeChildren(this.nodes, depth, depth, null);
|
|
23540
|
-
}
|
|
23412
|
+
this.constructZTreeData(this.nodes, this.zTreeNodes);
|
|
23413
|
+
if (this.level > 0) {
|
|
23414
|
+
this.expandTree(this.level, this.zTreeNodes, 0);
|
|
23541
23415
|
}
|
|
23542
23416
|
}
|
|
23543
|
-
this.
|
|
23544
|
-
this.
|
|
23545
|
-
this.setting.callback["onExpand"] = this.onExpand.bind(this);
|
|
23546
|
-
this.setting.callback["onCollapse"] = this.onCollapse.bind(this);
|
|
23547
|
-
var zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.nodes);
|
|
23548
|
-
$.fn.zTreeKeyboardNavigation(zTree, $('ul[name="' + this.name + '"]'), null, this.treeicon || defaultTreeIconClass);
|
|
23417
|
+
this.zTree = $.fn.zTree.init($('ul[name="' + this.name + '"]'), this.setting, this.zTreeNodes);
|
|
23418
|
+
$.fn.zTreeKeyboardNavigation(this.zTree, $('ul[name="' + this.name + '"]'), null, this.treeicons || defaultTreeIconClass);
|
|
23549
23419
|
this.postRenderTree();
|
|
23550
23420
|
};
|
|
23421
|
+
TreeComponent.prototype.setChecked = function(zNode, node) {
|
|
23422
|
+
var _this = this;
|
|
23423
|
+
node.checked = zNode.checked;
|
|
23424
|
+
var children = base.getEvaluatedData(node, {
|
|
23425
|
+
field: this.nodechildren,
|
|
23426
|
+
bindExpression: this.bindnodechildren
|
|
23427
|
+
}, this.viewParent) || node.children;
|
|
23428
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
23429
|
+
children.forEach((function(node, index) {
|
|
23430
|
+
_this.setChecked(zNode.children[index], node);
|
|
23431
|
+
}));
|
|
23432
|
+
}
|
|
23433
|
+
};
|
|
23551
23434
|
TreeComponent.prototype.selectNode = function(event, node) {
|
|
23552
23435
|
var deSelectElm = $(".app-tree[name=" + this.name + "] li[treenode].selected");
|
|
23553
23436
|
deSelectElm.removeClass("selected");
|
|
@@ -23556,27 +23439,35 @@
|
|
|
23556
23439
|
}
|
|
23557
23440
|
var selectElm = $("#" + node.tId + ":has(.curSelectedNode)");
|
|
23558
23441
|
selectElm.addClass("selected");
|
|
23442
|
+
var classList = (this.treeClass || "").split(" ");
|
|
23443
|
+
if (classList.includes("Checkbox") || classList.includes("Radio")) {
|
|
23444
|
+
this.setChecked(node, node.data);
|
|
23445
|
+
}
|
|
23559
23446
|
var path = this.getPath(node, "");
|
|
23560
|
-
this.selecteditem = core.getClonedObject(node) || {};
|
|
23447
|
+
this.selecteditem = core.getClonedObject(node.data) || {};
|
|
23561
23448
|
this.selecteditem.path = path;
|
|
23562
23449
|
var eventParams = {
|
|
23563
23450
|
$event: event,
|
|
23564
|
-
$item: node,
|
|
23451
|
+
$item: core.getClonedObject(node.data),
|
|
23565
23452
|
$path: path
|
|
23566
23453
|
};
|
|
23454
|
+
var nodeAction = node.data[this.nodeaction || "action"];
|
|
23455
|
+
if (nodeAction) {
|
|
23456
|
+
core.$parseEvent(nodeAction)(this);
|
|
23457
|
+
}
|
|
23567
23458
|
this.invokeEventCallback("select", eventParams);
|
|
23568
23459
|
};
|
|
23569
23460
|
TreeComponent.prototype.expandNode = function(node, expand, eventFlag) {
|
|
23570
|
-
this.
|
|
23461
|
+
this.zTree.expandNode(node, expand, false, false, eventFlag);
|
|
23571
23462
|
var el = $("#" + node.tId + "_switch");
|
|
23572
|
-
$(el).addClass(this.
|
|
23463
|
+
$(el).addClass(this.treeicons || defaultTreeIconClass);
|
|
23573
23464
|
};
|
|
23574
23465
|
TreeComponent.prototype.postRenderTree = function() {
|
|
23575
23466
|
var _this = this;
|
|
23576
23467
|
setTimeout((function() {
|
|
23577
|
-
_this.changeTreeIcons(_this.
|
|
23468
|
+
_this.changeTreeIcons(_this.treeicons || defaultTreeIconClass);
|
|
23578
23469
|
if (_this.datavalue && !_this.selecteditem) {
|
|
23579
|
-
var nodes = _this.
|
|
23470
|
+
var nodes = _this.zTree.getNodes();
|
|
23580
23471
|
var node = void 0;
|
|
23581
23472
|
if (nodes.length) {
|
|
23582
23473
|
if (_this.datavalue === "FirstNode") {
|
|
@@ -23587,7 +23478,7 @@
|
|
|
23587
23478
|
}
|
|
23588
23479
|
}
|
|
23589
23480
|
if (node) {
|
|
23590
|
-
_this.
|
|
23481
|
+
_this.zTree.selectNode(node, false);
|
|
23591
23482
|
_this.selectNode(undefined, node);
|
|
23592
23483
|
_this.expandNode(node, true, false);
|
|
23593
23484
|
}
|
|
@@ -23595,16 +23486,13 @@
|
|
|
23595
23486
|
}), 200);
|
|
23596
23487
|
};
|
|
23597
23488
|
TreeComponent.prototype.selectById = function(value) {
|
|
23598
|
-
var
|
|
23599
|
-
var simpleNodes = this.
|
|
23600
|
-
var node = simpleNodes.find((function(node) {
|
|
23601
|
-
return value ===
|
|
23602
|
-
field: _this.nodeid,
|
|
23603
|
-
bindExpression: _this.bindnodeid
|
|
23604
|
-
}, _this.viewParent);
|
|
23489
|
+
var _a;
|
|
23490
|
+
var simpleNodes = (_a = this.zTree) === null || _a === void 0 ? void 0 : _a.transformToArray(this.zTree.getNodes());
|
|
23491
|
+
var node = simpleNodes === null || simpleNodes === void 0 ? void 0 : simpleNodes.find((function(node) {
|
|
23492
|
+
return value === node.nodeId;
|
|
23605
23493
|
}));
|
|
23606
23494
|
if (node) {
|
|
23607
|
-
this.
|
|
23495
|
+
this.zTree.selectNode(node, false);
|
|
23608
23496
|
this.selectNode(undefined, node);
|
|
23609
23497
|
}
|
|
23610
23498
|
};
|
|
@@ -23627,6 +23515,30 @@
|
|
|
23627
23515
|
TreeComponent.ctorParameters = function() {
|
|
23628
23516
|
return [ {
|
|
23629
23517
|
type: core$1.Injector
|
|
23518
|
+
}, {
|
|
23519
|
+
type: undefined,
|
|
23520
|
+
decorators: [ {
|
|
23521
|
+
type: core$1.Attribute,
|
|
23522
|
+
args: [ "datavalue.bind" ]
|
|
23523
|
+
} ]
|
|
23524
|
+
}, {
|
|
23525
|
+
type: undefined,
|
|
23526
|
+
decorators: [ {
|
|
23527
|
+
type: core$1.Attribute,
|
|
23528
|
+
args: [ "nodelabel.bind" ]
|
|
23529
|
+
} ]
|
|
23530
|
+
}, {
|
|
23531
|
+
type: undefined,
|
|
23532
|
+
decorators: [ {
|
|
23533
|
+
type: core$1.Attribute,
|
|
23534
|
+
args: [ "nodeicon.bind" ]
|
|
23535
|
+
} ]
|
|
23536
|
+
}, {
|
|
23537
|
+
type: undefined,
|
|
23538
|
+
decorators: [ {
|
|
23539
|
+
type: core$1.Attribute,
|
|
23540
|
+
args: [ "nodechildren.bind" ]
|
|
23541
|
+
} ]
|
|
23630
23542
|
}, {
|
|
23631
23543
|
type: undefined,
|
|
23632
23544
|
decorators: [ {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
125
125
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
126
126
|
PERFORMANCE OF THIS SOFTWARE.
|
|
127
|
-
***************************************************************************** */var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},p={widgetType:"wm-tree",hostClass:"app-tree"},u="plus-minus",d=function(e){function t(t,n){var o=e.call(this,t,p)||this;return o.bindnodeid=n,o.setting={data:{simpleData:{enable:!1},key:{children:"children",name:"label"}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(o.nativeElement,o,i.APPLY_STYLES_TYPE.CONTAINER),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.level>0&&this.expandTree(this.level,this.nodes,0),this.renderTree();break;case"levels":n>0&&(this.level=n),this.renderTree();break;case"treeicons":this.treeicon=n,this.renderTree();break;case"nodelabel":this.setting.data.key.name=this.labelKey,this.renderTree();break;case"nodechildren":this.setting.data.key.children=this.childrenKey,this.renderTree();break;case"nodeicon":this.nodeicon=this.iconKey,this.renderTree();break;case"orderby":this.renderTree();break;case"class":this.treeClass=n,this.renderTree();break;default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=i.getChildren(t);o&&!("open"in t)&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){"Classic"===e?this.setting.check.enable=!1:"Checkbox"===e?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):"Radio"===e&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeclasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.setNodeData=function(e,t,n,i,o){var r=this;0===t?e.map((function(e){var a=r.getChildren(e);if(a&&r.setNodeData(a,t,n,i,o),e.icon&&"icon"==r.nodelabel)e[o]=e.icon;else{if(!e.name||"name"!=r.nodelabel)return;e[o]=e.name}})):e.map((function(e){var a=r.getChildren(e);return a&&n>1&&(t===n&&(i=e),r.setNodeData(a,t,n-1,i,o)),1===n&&("name"===o?r.nodelabel.includes("label")||r.nodelabel.includes("name"):r.nodeicon.includes("label")||r.nodeicon.includes("name"))?void(i[o]=e.name||e.label):1===n&&void 0!==e.icon&&("name"===o?r.nodelabel.includes("icon"):r.nodeicon.includes("icon"))?void(i[o]=e.icon):void 0}))},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e[this.labelKey]+t:this.getPath(e.getParentNode(),t)+"/"+e[this.labelKey]},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.treeObj.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,o={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("expand",o);var r=this.getChildren(n);null==r||r.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicon||u),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicon||u)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i={$event:e,$item:n,$path:this.getPath(n,"")};this.invokeEventCallback("collapse",i)},t.prototype.getChildren=function(e){return e[this.childrenKey]},Object.defineProperty(t.prototype,"childrenKey",{get:function(){return this.nodechildren?this.countDepth(this.nodechildren)?this.nodechildren.split(".").pop():this.nodechildren:"children"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"labelKey",{get:function(){return this.nodelabel?this.countDepth(this.nodelabel)?this.nodelabel.split(".").pop():this.nodelabel:"label"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconKey",{get:function(){return this.nodeicon?this.countDepth(this.nodeicon)?this.nodeicon.split(".").pop():this.nodeicon:"icon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"treeObj",{get:function(){return $.fn.zTree.getZTreeObj(""+this.name)},enumerable:!1,configurable:!0}),t.prototype.modifyObjects=function(e){var t=this;e.forEach((function(e){e.icon=e[t.nodeicon];var n=t.getChildren(e);(null==n?void 0:n.length)&&t.modifyObjects(n)}))},t.prototype.setNodeChildren=function(e,t,n,i){var o=this;if(t<=0)return e;for(var r=0;r<e.length;r++){var a=e[r];t===n&&(i=e[r]);var s=this.getChildren(a);if(null==s?void 0:s.length){if(1===n)return void(i[this.childrenKey]=s.map((function(e){var t;return(t={})[o.labelKey]=e[o.labelKey],t[o.childrenKey]=o.getChildren(e),t.icon=e[o.iconKey],t})));this.setNodeChildren(s,t,n-1,i)}}return e},t.prototype.countDepth=function(e){var t,n,i=e.match(/\[.*?\]/g),o=1;if(null===i)return o;try{for(var r=a(i),s=r.next();!s.done;s=r.next()){s.value;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return o},t.prototype.renderTree=function(){if(this.nodes){if(this.nativeElement.setAttribute("id",this.name),this.nodeicon&&"icon"!==this.nodeicon&&this.modifyObjects(this.nodes),this.setTreeTemplate(this.treeClass),this.nodelabel){var e=0;this.nodelabel.includes("children")&&(e=this.countDepth(this.nodelabel)),this.setNodeData(this.nodes,e,e,null,"name")}if(this.nodeicon){e=0;this.nodeicon.includes("children")&&(e=this.countDepth(this.nodeicon)),this.setNodeData(this.nodes,e,e,null,"icon")}if(this.nodechildren)(e=this.countDepth(this.nodechildren))>1&&(this.nodes=this.setNodeChildren(this.nodes,e,e,null))}this.setting.view.nodeClasses=this.setNodeclasses,this.setting.callback.onClick=this.onClick.bind(this),this.setting.callback.onExpand=this.onExpand.bind(this),this.setting.callback.onCollapse=this.onCollapse.bind(this);var t=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.nodes);$.fn.zTreeKeyboardNavigation(t,$('ul[name="'+this.name+'"]'),null,this.treeicon||u),this.postRenderTree()},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=this.getPath(t,"");this.selecteditem=o.getClonedObject(t)||{},this.selecteditem.path=n;var i={$event:e,$item:t,$path:n};this.invokeEventCallback("select",i)}},t.prototype.expandNode=function(e,t,n){this.treeObj.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicon||u)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicon||u),e.datavalue&&!e.selecteditem){var t=e.treeObj.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.treeObj.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t=this,n=this.treeObj.transformToArray(this.treeObj.getNodes()).find((function(n){return e===i.getEvaluatedData(n,{field:t.nodeid,bindExpression:t.bindnodeid},t.viewParent)}));n&&(this.treeObj.selectNode(n,!1),this.selectNode(void 0,n))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);d.initializeProps=c(),d.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(d)],encapsulation:t.ViewEncapsulation.None}]}],d.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var h=[d],m=function(){};m.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(h)),exports:l([],s(h)),entryComponents:[]}]}],e.TreeComponent=d,e.TreeModule=m,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,r,a){"use strict";
|
|
127
|
+
***************************************************************************** */var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function s(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var l=function(){i.register("wm-tree",new Map([["class",i.PROP_STRING],["dataset",Object.assign({value:"node1, node2, node3"},i.PROP_ANY)],["datavalue",i.PROP_STRING],["levels",Object.assign({value:0},i.PROP_NUMBER)],["name",i.PROP_STRING],["nodeaction",i.PROP_STRING],["nodechildren",i.PROP_STRING],["nodeclick",Object.assign({value:"none"},i.PROP_STRING)],["nodeicon",i.PROP_STRING],["nodeid",i.PROP_STRING],["nodelabel",i.PROP_STRING],["orderby",i.PROP_STRING],["show",Object.assign({value:!0},i.PROP_BOOLEAN)],["tabindex",Object.assign({value:0},i.PROP_NUMBER)],["treeicons",i.PROP_STRING]]))},c={widgetType:"wm-tree",hostClass:"app-tree"},p="plus-minus",u=function(e){function t(t,n,o,r,a,s){var l=e.call(this,t,c)||this;return l.binddatavalue=n,l.bindnodelabel=o,l.bindnodeicon=r,l.bindnodechildren=a,l.bindnodeid=s,l.setting={data:{simpleData:{enable:!1}},view:{dblClickExpand:!1,fontCss:{"font-awesome":!0},switchIcon:{}},check:{},callback:{}},i.styler(l.nativeElement,l,i.APPLY_STYLES_TYPE.CONTAINER),l.setting.view.nodeClasses=l.setNodeClasses,l.setting.callback.onClick=l.onClick.bind(l),l.setting.callback.onExpand=l.onExpand.bind(l),l.setting.callback.onCollapse=l.onCollapse.bind(l),l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onPropertyChange=function(t,n,i){switch(t){case"dataset":this.nodes=this.getNodes(n),this.renderTree();break;case"levels":this.level=n,this.renderTree();break;case"nodeicon":this.nodeicon=n,this.renderTree();break;case"nodelabel":this.nodelabel=n,this.renderTree();break;case"nodechildren":this.nodechildren=n,this.renderTree();break;case"orderby":this.orderby=n,this.renderTree();break;case"treeicons":this.treeicons=n,this.renderTree();break;case"class":this.treeClass=n,this.setTreeTemplate(this.treeClass),this.renderTree();default:e.prototype.onPropertyChange.call(this,t,n,i)}},t.prototype.expandTree=function(e,t,n){var i=this;t.map((function(t){var o=t.children;o&&n<e?(t.open=!0,i.expandTree(e,o,n+1)):n=0}))},t.prototype.setTreeTemplate=function(e){var t=e.split(" ");t.includes("Classic")?this.setting.check.enable=!1:t.includes("Checkbox")?(this.setting.check.enable=!0,this.setting.check.chkStyle="checkbox"):t.includes("Radio")&&(this.setting.check.enable=!0,this.setting.check.chkStyle="radio",this.setting.check.radioType="all")},t.prototype.getNodesFromString=function(e){return e.split(",").map((function(e){return{label:e&&e.trim()}}))},t.prototype.getNodes=function(e){var t;return _.isArray(e)?t=i.getOrderedDataset(e,this.orderby):_.isObject(e)?t=[e]:_.isString(e)&&!_.isEmpty(e)&&(e=e.trim())&&(t=this.getNodesFromString(e)),t},t.prototype.setNodeClasses=function(e,t){return t.icon?{add:[""+t.icon]}:""},t.prototype.changeTreeIcons=function(e){var t=$('ul[name="'+this.name+'"] li span.button.switch');$(t).map((function(t,n){$(n).addClass(e),$(n).on("click",(function(t){setTimeout((function(){$(n).addClass(e)}),0)}))}))},t.prototype.getPath=function(e,t){return t=null===e.getParentNode()?"/"+e.name+t:this.getPath(e.getParentNode(),t)+"/"+e.name},t.prototype.onClick=function(e,t,n,i){if("expand"===this.nodeclick){var o=this.zTree.getSelectedNodes();o.length>0&&this.expandNode(o[0],!o[0].open,!0)}this.selectNode(e,n)},t.prototype.onExpand=function(e,t,n){var i=this,r=this.getPath(n,""),a={$event:e,$item:o.getClonedObject(n.data),$path:r};this.invokeEventCallback("expand",a);var s=n.children;null==s||s.map((function(e){if(e.isParent){var t=$("#"+e.tId+"_switch");$(t).addClass(i.treeicons||p),$(t).on("click",(function(e){setTimeout((function(){$(t).addClass(i.treeicons||p)}),0)}))}}))},t.prototype.onCollapse=function(e,t,n){var i=this.getPath(n,""),r={$event:e,$item:o.getClonedObject(n.data),$path:i};this.invokeEventCallback("collapse",r)},t.prototype.constructZTreeData=function(e,t){var n=this;e.forEach((function(e){var r={},a=i.getEvaluatedData(e,{field:n.nodelabel,bindExpression:n.bindnodelabel},n.viewParent)||e.label,s=i.getEvaluatedData(e,{field:n.nodeicon,bindExpression:n.bindnodeicon},n.viewParent)||e.icon,l=i.getEvaluatedData(e,{field:n.nodeid,bindExpression:n.bindnodeid},n.viewParent),c=i.getEvaluatedData(e,{field:n.nodechildren,bindExpression:n.bindnodechildren},n.viewParent)||e.children;r.name=a,r.icon=s,r.nodeId=l,r.data=o.getClonedObject(e),_.isArray(c)&&c.length&&(r.children=[],n.constructZTreeData(c,r.children)),t.push(r)}))},t.prototype.renderTree=function(){var e;this.zTreeNodes=[],(null===(e=this.nodes)||void 0===e?void 0:e.length)&&(this.nativeElement.setAttribute("id",this.name),this.constructZTreeData(this.nodes,this.zTreeNodes),this.level>0&&this.expandTree(this.level,this.zTreeNodes,0)),this.zTree=$.fn.zTree.init($('ul[name="'+this.name+'"]'),this.setting,this.zTreeNodes),$.fn.zTreeKeyboardNavigation(this.zTree,$('ul[name="'+this.name+'"]'),null,this.treeicons||p),this.postRenderTree()},t.prototype.setChecked=function(e,t){var n=this;t.checked=e.checked;var o=i.getEvaluatedData(t,{field:this.nodechildren,bindExpression:this.bindnodechildren},this.viewParent)||t.children;(null==o?void 0:o.length)&&o.forEach((function(t,i){n.setChecked(e.children[i],t)}))},t.prototype.selectNode=function(e,t){if($(".app-tree[name="+this.name+"] li[treenode].selected").removeClass("selected"),t){$("#"+t.tId+":has(.curSelectedNode)").addClass("selected");var n=(this.treeClass||"").split(" ");(n.includes("Checkbox")||n.includes("Radio"))&&this.setChecked(t,t.data);var i=this.getPath(t,"");this.selecteditem=o.getClonedObject(t.data)||{},this.selecteditem.path=i;var r={$event:e,$item:o.getClonedObject(t.data),$path:i},a=t.data[this.nodeaction||"action"];a&&o.$parseEvent(a)(this),this.invokeEventCallback("select",r)}},t.prototype.expandNode=function(e,t,n){this.zTree.expandNode(e,t,!1,!1,n);var i=$("#"+e.tId+"_switch");$(i).addClass(this.treeicons||p)},t.prototype.postRenderTree=function(){var e=this;setTimeout((function(){if(e.changeTreeIcons(e.treeicons||p),e.datavalue&&!e.selecteditem){var t=e.zTree.getNodes(),n=void 0;t.length&&("FirstNode"===e.datavalue&&(n=t[0]),"LastNode"===e.datavalue&&(n=t[t.length-1])),n&&(e.zTree.selectNode(n,!1),e.selectNode(void 0,n),e.expandNode(n,!0,!1))}}),200)},t.prototype.selectById=function(e){var t,n=null===(t=this.zTree)||void 0===t?void 0:t.transformToArray(this.zTree.getNodes()),i=null==n?void 0:n.find((function(t){return e===t.nodeId}));i&&(this.zTree.selectNode(i,!1),this.selectNode(void 0,i))},t.prototype.deselectById=function(e){this.selecteditem={},this.selectById()},t}(i.StylableComponent);u.initializeProps=l(),u.decorators=[{type:t.Component,args:[{selector:"ul[wmTree]",template:'<ul #wmTree class="ztree" id="ztree"></ul> ',providers:[i.provideAsWidgetRef(u)],encapsulation:t.ViewEncapsulation.None}]}],u.ctorParameters=function(){return[{type:t.Injector},{type:void 0,decorators:[{type:t.Attribute,args:["datavalue.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodelabel.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodeicon.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodechildren.bind"]}]},{type:void 0,decorators:[{type:t.Attribute,args:["nodeid.bind"]}]}]};var d=[u],h=function(){};h.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:s([],a(d)),exports:s([],a(d)),entryComponents:[]}]}],e.TreeComponent=u,e.TreeModule=h,e["\u0275a"]=l,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-bootstrap/datepicker"),require("@wm/core"),require("@wm/components/base")):"function"==typeof define&&define.amd?define("@wm/components/input/calendar",["exports","@angular/core","@angular/common","@angular/forms","ngx-bootstrap/datepicker","@wm/core","@wm/components/base"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.components=e.wm.components||{},e.wm.components.input=e.wm.components.input||{},e.wm.components.input.calendar={}),e.ng.core,e.ng.common,e.ng.forms,e["ngx-bootstrap"].datepicker,e.wm.core,e.wm.components.base)}(this,(function(e,t,n,i,o,r,a){"use strict";
|
|
128
128
|
/*! *****************************************************************************
|
|
129
129
|
Copyright (c) Microsoft Corporation.
|
|
130
130
|
|