@aaqu/fromcubes-portal-react 0.1.0-alpha.14 → 0.1.0-alpha.16
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/nodes/lib/assets.js +212 -0
- package/nodes/lib/helpers.js +270 -0
- package/nodes/lib/page-builder.js +210 -0
- package/nodes/portal-react.html +23 -34
- package/nodes/portal-react.js +414 -616
- package/package.json +7 -3
package/nodes/portal-react.html
CHANGED
|
@@ -567,26 +567,6 @@
|
|
|
567
567
|
<label for="node-input-compName"><i class="fa fa-cube"></i> JSX Tag</label>
|
|
568
568
|
<input type="text" id="node-input-compName" placeholder="MyComponent" />
|
|
569
569
|
</div>
|
|
570
|
-
<div class="form-row" style="display:flex;gap:8px;">
|
|
571
|
-
<div style="flex:1">
|
|
572
|
-
<label><i class="fa fa-sign-in"></i> Input fields</label>
|
|
573
|
-
<input
|
|
574
|
-
type="text"
|
|
575
|
-
id="node-input-compInputs"
|
|
576
|
-
placeholder="payload,topic"
|
|
577
|
-
style="width:100%"
|
|
578
|
-
/>
|
|
579
|
-
</div>
|
|
580
|
-
<div style="flex:1">
|
|
581
|
-
<label><i class="fa fa-sign-out"></i> Output fields</label>
|
|
582
|
-
<input
|
|
583
|
-
type="text"
|
|
584
|
-
id="node-input-compOutputs"
|
|
585
|
-
placeholder="payload,topic"
|
|
586
|
-
style="width:100%"
|
|
587
|
-
/>
|
|
588
|
-
</div>
|
|
589
|
-
</div>
|
|
590
570
|
<div class="form-row" style="margin-bottom:4px;">
|
|
591
571
|
<label><i class="fa fa-code"></i> JSX Code</label>
|
|
592
572
|
</div>
|
|
@@ -629,8 +609,6 @@
|
|
|
629
609
|
name: { value: "" },
|
|
630
610
|
compName: { value: "StatusCard", required: true },
|
|
631
611
|
compCode: { value: COMP_STARTER },
|
|
632
|
-
compInputs: { value: "label,value,unit" },
|
|
633
|
-
compOutputs: { value: "" },
|
|
634
612
|
},
|
|
635
613
|
inputs: 0,
|
|
636
614
|
outputs: 0,
|
|
@@ -1176,12 +1154,6 @@
|
|
|
1176
1154
|
return '<code style="background:rgba(128,128,128,.15);padding:0 4px;border-radius:2px;margin-right:3px;">' + p + '</code>';
|
|
1177
1155
|
}).join("") + '</div>');
|
|
1178
1156
|
}
|
|
1179
|
-
var io = [];
|
|
1180
|
-
if ((c.inputs || []).length) io.push("in: " + c.inputs.join(", "));
|
|
1181
|
-
if ((c.outputs || []).length) io.push("out: " + c.outputs.join(", "));
|
|
1182
|
-
if (io.length) {
|
|
1183
|
-
detailParts.push('<div style="font-size:10px;opacity:.4;margin-top:2px;">' + io.join(" • ") + '</div>');
|
|
1184
|
-
}
|
|
1185
1157
|
var hasDetail = detailParts.length > 0;
|
|
1186
1158
|
|
|
1187
1159
|
html +=
|
|
@@ -1479,12 +1451,12 @@ const { data, send, user, portalClient } = useNodeRed();
|
|
|
1479
1451
|
var fileList = $('<div style="padding:0;"></div>').appendTo(content);
|
|
1480
1452
|
|
|
1481
1453
|
// ── Toolbar ──
|
|
1482
|
-
var toolbar = $('<div style="display:flex;align-items:center;gap:
|
|
1454
|
+
var toolbar = $('<div style="display:flex;align-items:center;gap:6px;margin:0 6px;padding:2px 0 0;"></div>');
|
|
1483
1455
|
var fileInput = $('<input type="file" multiple style="display:none;">').appendTo(toolbar);
|
|
1484
|
-
$('<
|
|
1456
|
+
$('<button class="red-ui-button red-ui-button-small" style="flex-shrink:0;"><i class="fa fa-upload"></i> Upload</button>')
|
|
1485
1457
|
.on("click", function (e) { e.preventDefault(); fileInput.trigger("click"); })
|
|
1486
1458
|
.appendTo(toolbar);
|
|
1487
|
-
$('<
|
|
1459
|
+
$('<button class="red-ui-button red-ui-button-small" style="flex-shrink:0;"><i class="fa fa-folder-open"></i> New folder</button>')
|
|
1488
1460
|
.on("click", function (e) { e.preventDefault(); showNewFolderInput(""); })
|
|
1489
1461
|
.appendTo(toolbar);
|
|
1490
1462
|
|
|
@@ -1758,14 +1730,31 @@ const { data, send, user, portalClient } = useNodeRed();
|
|
|
1758
1730
|
return root;
|
|
1759
1731
|
}
|
|
1760
1732
|
|
|
1733
|
+
var ROOT_KEY = "__root__";
|
|
1734
|
+
|
|
1761
1735
|
function renderTree() {
|
|
1762
1736
|
fileList.empty();
|
|
1737
|
+
var isOpen = !collapsed[ROOT_KEY];
|
|
1738
|
+
|
|
1739
|
+
// Root folder row — always visible
|
|
1740
|
+
var rootRow = $('<div style="display:flex;align-items:center;gap:5px;padding:4px 8px;border-bottom:1px solid var(--red-ui-secondary-border-color);"></div>');
|
|
1741
|
+
var rootArrow = $('<i class="fa ' + (isOpen ? 'fa-caret-down' : 'fa-caret-right') + '" style="color:var(--red-ui-secondary-text-color);font-size:11px;width:10px;text-align:center;cursor:pointer;"></i>');
|
|
1742
|
+
rootArrow.on("click", function () { collapsed[ROOT_KEY] = isOpen; renderTree(); });
|
|
1743
|
+
rootRow.append(rootArrow);
|
|
1744
|
+
$('<i class="fa ' + (isOpen ? 'fa-folder-open' : 'fa-folder') + '" style="color:#fbbf24;font-size:12px;width:16px;text-align:center;"></i>').appendTo(rootRow);
|
|
1745
|
+
$('<span style="flex:1;font-size:12px;cursor:pointer;opacity:0.8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"></span>').text(publicBase.replace(/\/$/, ""))
|
|
1746
|
+
.on("click", function () { collapsed[ROOT_KEY] = isOpen; renderTree(); })
|
|
1747
|
+
.appendTo(rootRow);
|
|
1748
|
+
fileList.append(rootRow);
|
|
1749
|
+
|
|
1750
|
+
if (!isOpen) return;
|
|
1751
|
+
|
|
1763
1752
|
if (allEntries.length === 0) {
|
|
1764
1753
|
fileList.append($('<div style="padding:16px;color:var(--red-ui-secondary-text-color);text-align:center;">No files uploaded.<br><span style="font-size:11px;">Drop files here or click Upload.</span></div>'));
|
|
1765
1754
|
return;
|
|
1766
1755
|
}
|
|
1767
1756
|
var tree = buildTree(allEntries);
|
|
1768
|
-
renderNode(tree, "",
|
|
1757
|
+
renderNode(tree, "", 1);
|
|
1769
1758
|
}
|
|
1770
1759
|
|
|
1771
1760
|
function renderNode(node, parentPath, depth) {
|
|
@@ -1800,7 +1789,7 @@ const { data, send, user, portalClient } = useNodeRed();
|
|
|
1800
1789
|
});
|
|
1801
1790
|
row.append(arrow);
|
|
1802
1791
|
$('<i class="fa ' + (isOpen ? 'fa-folder-open' : 'fa-folder') + '" style="color:#fbbf24;font-size:12px;width:16px;text-align:center;"></i>').appendTo(row);
|
|
1803
|
-
$('<span style="flex:1;font-size:12px;cursor:pointer;"></span>').text(name)
|
|
1792
|
+
$('<span style="flex:1;font-size:12px;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="' + fullPath + '"></span>').text(name)
|
|
1804
1793
|
.on("click", function () { collapsed[fullPath] = isOpen; renderTree(); })
|
|
1805
1794
|
.appendTo(row);
|
|
1806
1795
|
|
|
@@ -1862,7 +1851,7 @@ const { data, send, user, portalClient } = useNodeRed();
|
|
|
1862
1851
|
row.attr("draggable", "true").css("cursor", "grab");
|
|
1863
1852
|
$('<span style="width:10px;"></span>').appendTo(row); // spacer for arrow alignment
|
|
1864
1853
|
$('<i class="fa fa-file-o" style="color:var(--red-ui-secondary-text-color);font-size:11px;width:16px;text-align:center;"></i>').appendTo(row);
|
|
1865
|
-
$('<span style="flex:1;font-size:12px;
|
|
1854
|
+
$('<span style="flex:1;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="' + fullPath + '"></span>').text(name).appendTo(row);
|
|
1866
1855
|
$('<span style="font-size:10px;color:var(--red-ui-tertiary-text-color);white-space:nowrap;"></span>').text(formatSize(e.size)).appendTo(row);
|
|
1867
1856
|
|
|
1868
1857
|
row.on("dragstart", function (ev) {
|