apextree 1.4.2 → 1.4.3
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/apextree.es.min.js +203 -8
- package/apextree.min.js +1 -1
- package/demo/group_leaf_nodes.html +2 -2
- package/demo/per_node_options.html +2 -5
- package/index.d.ts +4 -1
- package/lib/ApexTree.d.ts +5 -0
- package/package.json +3 -14
- package/.eslintignore +0 -2
- package/.eslintrc +0 -9
- package/.husky/commit-msg +0 -1
- package/.husky/pre-push +0 -1
- package/.prettierrc +0 -5
- package/CHANGELOG.md +0 -25
- package/commitlint.config.js +0 -5
- package/tsconfig.json +0 -28
- package/webpack.common.ts +0 -68
- package/webpack.config.ts +0 -7
- package/webpack.dev.ts +0 -12
- package/webpack.prod.ts +0 -9
package/apextree.es.min.js
CHANGED
|
@@ -400,6 +400,8 @@ const generateStyles = (styleObject = {}) => {
|
|
|
400
400
|
}
|
|
401
401
|
return styles.join(" ");
|
|
402
402
|
};
|
|
403
|
+
function noop$2() {
|
|
404
|
+
}
|
|
403
405
|
class Export {
|
|
404
406
|
constructor(canvas, prefix = "apex") {
|
|
405
407
|
this.canvas = canvas;
|
|
@@ -428,6 +430,131 @@ class Export {
|
|
|
428
430
|
this.triggerDownload(this.svgUrl(), `${this.prefix}-${(/* @__PURE__ */ new Date()).getTime()}.svg`);
|
|
429
431
|
}
|
|
430
432
|
}
|
|
433
|
+
const _LicenseManager = class _LicenseManager {
|
|
434
|
+
/**
|
|
435
|
+
* Decode license data from encoded string
|
|
436
|
+
* This is a simple base64 + JSON approach - you can make it more sophisticated
|
|
437
|
+
*/
|
|
438
|
+
static decodeLicenseData(encodedData) {
|
|
439
|
+
try {
|
|
440
|
+
const decodedString = window.atob(encodedData);
|
|
441
|
+
const data2 = JSON.parse(decodedString);
|
|
442
|
+
if (!data2.issueDate || !data2.expiryDate || !data2.plan) {
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
return {
|
|
446
|
+
expiryDate: data2.expiryDate,
|
|
447
|
+
issueDate: data2.issueDate,
|
|
448
|
+
plan: data2.plan,
|
|
449
|
+
valid: true
|
|
450
|
+
};
|
|
451
|
+
} catch {
|
|
452
|
+
return null;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Generate a license key (for your internal use)
|
|
457
|
+
* You would use this on your server/admin panel to generate keys for customers
|
|
458
|
+
*/
|
|
459
|
+
static generateLicenseKey(issueDate, expiryDate, plan = "standard") {
|
|
460
|
+
const licenseData = {
|
|
461
|
+
expiryDate,
|
|
462
|
+
issueDate,
|
|
463
|
+
plan
|
|
464
|
+
};
|
|
465
|
+
const encodedData = window.btoa(JSON.stringify(licenseData));
|
|
466
|
+
return `APEX-${encodedData}`;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Get current license validation result
|
|
470
|
+
*/
|
|
471
|
+
static getLicenseStatus() {
|
|
472
|
+
if (!this.licenseKey) {
|
|
473
|
+
return { expired: false, valid: false };
|
|
474
|
+
}
|
|
475
|
+
if (!this.validationResult) {
|
|
476
|
+
this.validationResult = this.validateLicense(this.licenseKey);
|
|
477
|
+
}
|
|
478
|
+
return this.validationResult;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Check if current license is valid
|
|
482
|
+
*/
|
|
483
|
+
static isLicenseValid() {
|
|
484
|
+
if (!this.licenseKey) {
|
|
485
|
+
return false;
|
|
486
|
+
}
|
|
487
|
+
if (!this.validationResult) {
|
|
488
|
+
this.validationResult = this.validateLicense(this.licenseKey);
|
|
489
|
+
}
|
|
490
|
+
return this.validationResult.valid;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Set the global license key
|
|
494
|
+
*/
|
|
495
|
+
static setLicense(key) {
|
|
496
|
+
this.licenseKey = key;
|
|
497
|
+
this.validationResult = this.validateLicense(key);
|
|
498
|
+
if (!this.validationResult.valid) {
|
|
499
|
+
console.error(`[Apex] ${this.validationResult.message}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Validate license key format and content
|
|
504
|
+
*/
|
|
505
|
+
static validateLicense(key) {
|
|
506
|
+
try {
|
|
507
|
+
if (!key.startsWith("APEX-")) {
|
|
508
|
+
return {
|
|
509
|
+
expired: false,
|
|
510
|
+
message: 'Invalid license key format. License key must start with "APEX-".',
|
|
511
|
+
valid: false
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
const parts = key.split("-");
|
|
515
|
+
if (parts.length !== 2) {
|
|
516
|
+
return {
|
|
517
|
+
expired: false,
|
|
518
|
+
message: "Invalid license key format. Expected format: APEX-{encoded-data}.",
|
|
519
|
+
valid: false
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
const encodedData = parts[1];
|
|
523
|
+
const licenseData = this.decodeLicenseData(encodedData);
|
|
524
|
+
if (!licenseData) {
|
|
525
|
+
return {
|
|
526
|
+
expired: false,
|
|
527
|
+
message: "Invalid license key. Unable to decode license data.",
|
|
528
|
+
valid: false
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
const now = /* @__PURE__ */ new Date();
|
|
532
|
+
const expiryDate = new Date(licenseData.expiryDate);
|
|
533
|
+
if (expiryDate < now) {
|
|
534
|
+
return {
|
|
535
|
+
data: licenseData,
|
|
536
|
+
expired: true,
|
|
537
|
+
message: `License expired on ${licenseData.expiryDate}. Please renew your license.`,
|
|
538
|
+
valid: false
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
return {
|
|
542
|
+
data: licenseData,
|
|
543
|
+
expired: false,
|
|
544
|
+
valid: true
|
|
545
|
+
};
|
|
546
|
+
} catch {
|
|
547
|
+
return {
|
|
548
|
+
expired: false,
|
|
549
|
+
message: "Invalid license key format or corrupted data.",
|
|
550
|
+
valid: false
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
_LicenseManager.licenseKey = null;
|
|
556
|
+
_LicenseManager.validationResult = null;
|
|
557
|
+
let LicenseManager = _LicenseManager;
|
|
431
558
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
432
559
|
var lodash = { exports: {} };
|
|
433
560
|
/**
|
|
@@ -7436,7 +7563,7 @@ let EventTarget$1 = class EventTarget extends Base$1 {
|
|
|
7436
7563
|
}
|
|
7437
7564
|
};
|
|
7438
7565
|
register$1(EventTarget$1, "EventTarget");
|
|
7439
|
-
function noop$
|
|
7566
|
+
function noop$1() {
|
|
7440
7567
|
}
|
|
7441
7568
|
const timeline$1 = {
|
|
7442
7569
|
duration: 400,
|
|
@@ -10119,8 +10246,8 @@ let Runner$1 = class Runner extends EventTarget$1 {
|
|
|
10119
10246
|
*/
|
|
10120
10247
|
queue(initFn, runFn, retargetFn, isTransform) {
|
|
10121
10248
|
this._queue.push({
|
|
10122
|
-
initialiser: initFn || noop$
|
|
10123
|
-
runner: runFn || noop$
|
|
10249
|
+
initialiser: initFn || noop$1,
|
|
10250
|
+
runner: runFn || noop$1,
|
|
10124
10251
|
retarget: retargetFn,
|
|
10125
10252
|
isTransform,
|
|
10126
10253
|
initialised: false,
|
|
@@ -11416,8 +11543,6 @@ registerMorphableType$1([
|
|
|
11416
11543
|
Point$1
|
|
11417
11544
|
]);
|
|
11418
11545
|
makeMorphable$1();
|
|
11419
|
-
function noop$1() {
|
|
11420
|
-
}
|
|
11421
11546
|
const ExportIcon = "data:image/svg+xml,%3csvg%20fill='%23000000'%20width='20px'%20height='20px'%20viewBox='0%200%2024%2024'%20id='export-2'%20xmlns='http://www.w3.org/2000/svg'%20class='icon%20line'%3e%3cpolyline%20id='primary'%20points='15%203%2021%203%2021%209'%20style='fill:%20none;%20stroke:%20rgb(0,%200,%200);%20stroke-linecap:%20round;%20stroke-linejoin:%20round;%20stroke-width:%201.5;'%3e%3c/polyline%3e%3cpath%20id='primary-2'%20data-name='primary'%20d='M21,13v7a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V4A1,1,0,0,1,4,3h7'%20style='fill:%20none;%20stroke:%20rgb(0,%200,%200);%20stroke-linecap:%20round;%20stroke-linejoin:%20round;%20stroke-width:%201.5;'%3e%3c/path%3e%3cline%20id='primary-3'%20data-name='primary'%20x1='11'%20y1='13'%20x2='21'%20y2='3'%20style='fill:%20none;%20stroke:%20rgb(0,%200,%200);%20stroke-linecap:%20round;%20stroke-linejoin:%20round;%20stroke-width:%201.5;'%3e%3c/line%3e%3c/svg%3e";
|
|
11422
11547
|
const FitScreenIcon = "data:image/svg+xml,%3csvg%20width='20px'%20height='20px'%20viewBox='0%200%2032%2032'%20id='icon'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpolygon%20points='8%202%202%202%202%208%204%208%204%204%208%204%208%202'/%3e%3cpolygon%20points='24%202%2030%202%2030%208%2028%208%2028%204%2024%204%2024%202'/%3e%3cpolygon%20points='8%2030%202%2030%202%2024%204%2024%204%2028%208%2028%208%2030'/%3e%3cpolygon%20points='24%2030%2030%2030%2030%2024%2028%2024%2028%2028%2024%2028%2024%2030'/%3e%3cpath%20d='M24,24H8a2.0023,2.0023,0,0,1-2-2V10A2.0023,2.0023,0,0,1,8,8H24a2.0023,2.0023,0,0,1,2,2V22A2.0023,2.0023,0,0,1,24,24ZM8,10V22H24V10Z'/%3e%3crect%20fill='none'%20width='32'%20height='32'/%3e%3c/svg%3e";
|
|
11423
11548
|
const ZoomInIcon = "data:image/svg+xml,%3csvg%20width='20px'%20height='20px'%20viewBox='0%200%2032%2032'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns:sketch='http://www.bohemiancoding.com/sketch/ns'%3e%3cg%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20transform='translate(-308.000000,%20-1139.000000)'%20fill='%23000000'%3e%3cpath%20d='M321.46,1163.45%20C315.17,1163.45%20310.07,1158.44%20310.07,1152.25%20C310.07,1146.06%20315.17,1141.04%20321.46,1141.04%20C327.75,1141.04%20332.85,1146.06%20332.85,1152.25%20C332.85,1158.44%20327.75,1163.45%20321.46,1163.45%20L321.46,1163.45%20Z%20M339.688,1169.25%20L331.429,1161.12%20C333.592,1158.77%20334.92,1155.67%20334.92,1152.25%20C334.92,1144.93%20328.894,1139%20321.46,1139%20C314.026,1139%20308,1144.93%20308,1152.25%20C308,1159.56%20314.026,1165.49%20321.46,1165.49%20C324.672,1165.49%20327.618,1164.38%20329.932,1162.53%20L338.225,1170.69%20C338.629,1171.09%20339.284,1171.09%20339.688,1170.69%20C340.093,1170.3%20340.093,1169.65%20339.688,1169.25%20L339.688,1169.25%20Z%20M326.519,1151.41%20L322.522,1151.41%20L322.522,1147.41%20C322.522,1146.85%20322.075,1146.41%20321.523,1146.41%20C320.972,1146.41%20320.524,1146.85%20320.524,1147.41%20L320.524,1151.41%20L316.529,1151.41%20C315.978,1151.41%20315.53,1151.59%20315.53,1152.14%20C315.53,1152.7%20315.978,1153.41%20316.529,1153.41%20L320.524,1153.41%20L320.524,1157.41%20C320.524,1157.97%20320.972,1158.41%20321.523,1158.41%20C322.075,1158.41%20322.522,1157.97%20322.522,1157.41%20L322.522,1153.41%20L326.519,1153.41%20C327.07,1153.41%20327.518,1152.96%20327.518,1152.41%20C327.518,1151.86%20327.07,1151.41%20326.519,1151.41%20L326.519,1151.41%20Z'%20/%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
|
|
@@ -11468,9 +11593,9 @@ class Toolbar {
|
|
|
11468
11593
|
enableExport = false,
|
|
11469
11594
|
enableFitscreen = false,
|
|
11470
11595
|
enableZoom = false,
|
|
11471
|
-
onExport = noop$
|
|
11472
|
-
onFitscreen = noop$
|
|
11473
|
-
onZoom = noop$
|
|
11596
|
+
onExport = noop$2,
|
|
11597
|
+
onFitscreen = noop$2,
|
|
11598
|
+
onZoom = noop$2
|
|
11474
11599
|
}) {
|
|
11475
11600
|
var _a;
|
|
11476
11601
|
const container = document.createElement("div");
|
|
@@ -11523,6 +11648,52 @@ class Toolbar {
|
|
|
11523
11648
|
(_a = this.element) == null ? void 0 : _a.append(container);
|
|
11524
11649
|
}
|
|
11525
11650
|
}
|
|
11651
|
+
const _Watermark = class _Watermark {
|
|
11652
|
+
/**
|
|
11653
|
+
* Add watermark to a container element
|
|
11654
|
+
*/
|
|
11655
|
+
static add(container) {
|
|
11656
|
+
this.remove(container);
|
|
11657
|
+
const watermark = document.createElement("div");
|
|
11658
|
+
watermark.className = this.WATERMARK_CLASS;
|
|
11659
|
+
watermark.textContent = this.WATERMARK_TEXT;
|
|
11660
|
+
Object.assign(watermark.style, {
|
|
11661
|
+
bottom: "5px",
|
|
11662
|
+
color: "#666",
|
|
11663
|
+
fontFamily: "Arial, sans-serif",
|
|
11664
|
+
fontSize: "14px",
|
|
11665
|
+
msUserSelect: "none",
|
|
11666
|
+
pointerEvents: "none",
|
|
11667
|
+
position: "absolute",
|
|
11668
|
+
right: "5px",
|
|
11669
|
+
userSelect: "none",
|
|
11670
|
+
webkitUserSelect: "none",
|
|
11671
|
+
zIndex: "1000"
|
|
11672
|
+
});
|
|
11673
|
+
if (getComputedStyle(container).position === "static") {
|
|
11674
|
+
container.style.position = "relative";
|
|
11675
|
+
}
|
|
11676
|
+
container.appendChild(watermark);
|
|
11677
|
+
}
|
|
11678
|
+
/**
|
|
11679
|
+
* Check if watermark exists in container
|
|
11680
|
+
*/
|
|
11681
|
+
static exists(container) {
|
|
11682
|
+
return !!container.querySelector(`.${this.WATERMARK_CLASS}`);
|
|
11683
|
+
}
|
|
11684
|
+
/**
|
|
11685
|
+
* Remove watermark from a container element
|
|
11686
|
+
*/
|
|
11687
|
+
static remove(container) {
|
|
11688
|
+
const existingWatermark = container.querySelector(`.${this.WATERMARK_CLASS}`);
|
|
11689
|
+
if (existingWatermark) {
|
|
11690
|
+
existingWatermark.remove();
|
|
11691
|
+
}
|
|
11692
|
+
}
|
|
11693
|
+
};
|
|
11694
|
+
_Watermark.WATERMARK_CLASS = "apexgantt-watermark";
|
|
11695
|
+
_Watermark.WATERMARK_TEXT = "Powered by apexcharts.com";
|
|
11696
|
+
let Watermark = _Watermark;
|
|
11526
11697
|
var DEFAULT_EDGE_NAME = "\0";
|
|
11527
11698
|
var GRAPH_NODE = "\0";
|
|
11528
11699
|
var EDGE_KEY_DELIM = "";
|
|
@@ -20729,6 +20900,7 @@ class Paper {
|
|
|
20729
20900
|
constructor(element, width2, height2, canvasStyle) {
|
|
20730
20901
|
this.width = width2;
|
|
20731
20902
|
this.height = height2;
|
|
20903
|
+
element.innerHTML = "";
|
|
20732
20904
|
this.canvas = SVG().addTo(element).size("100%", "100%").viewbox(`0 0 ${width2} ${height2}`).panZoom({ zoomFactor: 0.2, zoomMin: 0.1 }).attr({ style: canvasStyle });
|
|
20733
20905
|
}
|
|
20734
20906
|
static drawCircle(attributes = {}) {
|
|
@@ -21244,6 +21416,25 @@ class ApexTree {
|
|
|
21244
21416
|
this.element.style.width = `${calculatedWidth}${isPercentValues ? "%" : "px"}`;
|
|
21245
21417
|
this.element.style.height = `${calculatedHeight}${isPercentValues ? "%" : "px"}`;
|
|
21246
21418
|
this.element.style.position = "relative";
|
|
21419
|
+
this.handleWatermark();
|
|
21420
|
+
}
|
|
21421
|
+
// Static method to set global license
|
|
21422
|
+
static setLicense(key) {
|
|
21423
|
+
LicenseManager.setLicense(key);
|
|
21424
|
+
}
|
|
21425
|
+
/**
|
|
21426
|
+
* Handle watermark display based on license validation
|
|
21427
|
+
*/
|
|
21428
|
+
handleWatermark() {
|
|
21429
|
+
const container = this.element;
|
|
21430
|
+
if (!container) {
|
|
21431
|
+
return;
|
|
21432
|
+
}
|
|
21433
|
+
if (LicenseManager.isLicenseValid()) {
|
|
21434
|
+
Watermark.remove(container);
|
|
21435
|
+
} else {
|
|
21436
|
+
Watermark.add(container);
|
|
21437
|
+
}
|
|
21247
21438
|
}
|
|
21248
21439
|
render(data2) {
|
|
21249
21440
|
if (!this.element) {
|
|
@@ -21265,6 +21456,10 @@ class ApexTree {
|
|
|
21265
21456
|
return this.graph;
|
|
21266
21457
|
}
|
|
21267
21458
|
}
|
|
21459
|
+
if (typeof window !== "undefined") {
|
|
21460
|
+
window.ApexTree = ApexTree;
|
|
21461
|
+
}
|
|
21268
21462
|
export {
|
|
21463
|
+
ApexTree,
|
|
21269
21464
|
ApexTree as default
|
|
21270
21465
|
};
|