@cyprnet/node-red-contrib-uibuilder-formgen 0.5.2 → 0.5.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/CHANGELOG.md +4 -0
- package/nodes/uibuilder-formgen-v3.html +12 -0
- package/nodes/uibuilder-formgen-v3.js +24 -1
- package/nodes/uibuilder-formgen.html +12 -0
- package/nodes/uibuilder-formgen.js +24 -1
- package/package.json +1 -1
- package/templates/index.html.mustache +9 -2
- package/templates/index.v3.html.mustache +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.5.3
|
|
6
|
+
|
|
7
|
+
- FormGen node: added **Logo height/width** options (defaults to **252h x 1100w**) with per-message override support.
|
|
8
|
+
|
|
5
9
|
## 0.5.2
|
|
6
10
|
|
|
7
11
|
- Schema Builder: added **Generate Schema (Plain JSON)** to auto-create a PortalSmith schema from a plain JSON config object and load it into the builder for editing.
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
themeMode: { value: "auto" },
|
|
13
13
|
logoPath: { value: "" },
|
|
14
14
|
logoAlt: { value: "Logo" },
|
|
15
|
+
logoHeight: { value: 252 },
|
|
16
|
+
logoWidth: { value: 1100 },
|
|
15
17
|
licenseConfig: { value: "", type: "portalsmith-license", required: false },
|
|
16
18
|
submitMode: { value: "uibuilder" },
|
|
17
19
|
submitUrl: { value: "" },
|
|
@@ -127,6 +129,16 @@
|
|
|
127
129
|
<input type="text" id="node-input-logoAlt" placeholder="Logo" />
|
|
128
130
|
</div>
|
|
129
131
|
|
|
132
|
+
<div class="form-row">
|
|
133
|
+
<label for="node-input-logoHeight"><i class="fa fa-arrows-v"></i> Logo height (px)</label>
|
|
134
|
+
<input type="number" id="node-input-logoHeight" min="1" placeholder="252" />
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div class="form-row">
|
|
138
|
+
<label for="node-input-logoWidth"><i class="fa fa-arrows-h"></i> Logo width (px)</label>
|
|
139
|
+
<input type="number" id="node-input-logoWidth" min="1" placeholder="1100" />
|
|
140
|
+
</div>
|
|
141
|
+
|
|
130
142
|
<hr/>
|
|
131
143
|
<div class="form-row">
|
|
132
144
|
<strong>Licensing (offline-first)</strong>
|
|
@@ -14,6 +14,17 @@ module.exports = function(RED) {
|
|
|
14
14
|
const https = require("https");
|
|
15
15
|
const licensing = require("../lib/licensing");
|
|
16
16
|
|
|
17
|
+
const DEFAULT_LOGO_MAX_HEIGHT_PX = 252;
|
|
18
|
+
const DEFAULT_LOGO_MAX_WIDTH_PX = 1100;
|
|
19
|
+
|
|
20
|
+
function toPositiveIntOrDefault(value, defaultValue) {
|
|
21
|
+
const n = Number(value);
|
|
22
|
+
if (!Number.isFinite(n)) return defaultValue;
|
|
23
|
+
const i = Math.round(n);
|
|
24
|
+
if (i <= 0) return defaultValue;
|
|
25
|
+
return i;
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
// Register admin endpoints once (used by the editor UI to show license status)
|
|
18
29
|
let _adminRegistered = false;
|
|
19
30
|
function registerAdminEndpoints() {
|
|
@@ -358,6 +369,14 @@ module.exports = function(RED) {
|
|
|
358
369
|
const logoRequested = isNonEmptyString(msg.options?.logoPath ?? config.logoPath ?? "");
|
|
359
370
|
let logoPathRaw = msg.options?.logoPath ?? config.logoPath ?? "";
|
|
360
371
|
const logoAltRaw = msg.options?.logoAlt ?? config.logoAlt ?? "Logo";
|
|
372
|
+
const logoMaxHeightPx = toPositiveIntOrDefault(
|
|
373
|
+
msg.options?.logoHeight ?? config.logoHeight ?? DEFAULT_LOGO_MAX_HEIGHT_PX,
|
|
374
|
+
DEFAULT_LOGO_MAX_HEIGHT_PX
|
|
375
|
+
);
|
|
376
|
+
const logoMaxWidthPx = toPositiveIntOrDefault(
|
|
377
|
+
msg.options?.logoWidth ?? config.logoWidth ?? DEFAULT_LOGO_MAX_WIDTH_PX,
|
|
378
|
+
DEFAULT_LOGO_MAX_WIDTH_PX
|
|
379
|
+
);
|
|
361
380
|
if (isNonEmptyString(logoPathRaw) && licensePublic.brandingLocked) {
|
|
362
381
|
node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
|
|
363
382
|
licensePublic.brandingAttempted = Boolean(logoRequested);
|
|
@@ -403,6 +422,8 @@ module.exports = function(RED) {
|
|
|
403
422
|
themeMode: themeMode,
|
|
404
423
|
logoUrl: logoUrl,
|
|
405
424
|
logoAlt: logoAlt,
|
|
425
|
+
logoMaxHeightPx: logoMaxHeightPx,
|
|
426
|
+
logoMaxWidthPx: logoMaxWidthPx,
|
|
406
427
|
licensed: licensePublic.licensed
|
|
407
428
|
};
|
|
408
429
|
|
|
@@ -434,7 +455,7 @@ module.exports = function(RED) {
|
|
|
434
455
|
await fs.writeJson(targetSchema, schema, { spaces: 2 });
|
|
435
456
|
|
|
436
457
|
const runtimeData = {
|
|
437
|
-
generatorVersion: "0.5.
|
|
458
|
+
generatorVersion: "0.5.3",
|
|
438
459
|
generatorNode: "uibuilder-formgen-v3",
|
|
439
460
|
timestamp: new Date().toISOString(),
|
|
440
461
|
instanceName: instanceName,
|
|
@@ -443,6 +464,8 @@ module.exports = function(RED) {
|
|
|
443
464
|
themeMode: themeMode,
|
|
444
465
|
logoUrl: logoUrl || "",
|
|
445
466
|
logoAlt: logoAlt || "",
|
|
467
|
+
logoMaxHeightPx: logoMaxHeightPx,
|
|
468
|
+
logoMaxWidthPx: logoMaxWidthPx,
|
|
446
469
|
submitMode: submitMode,
|
|
447
470
|
submitUrl: submitUrl,
|
|
448
471
|
license: licensePublic,
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
themeMode: { value: "auto" },
|
|
13
13
|
logoPath: { value: "" },
|
|
14
14
|
logoAlt: { value: "Logo" },
|
|
15
|
+
logoHeight: { value: 252 },
|
|
16
|
+
logoWidth: { value: 1100 },
|
|
15
17
|
licenseConfig: { value: "", type: "portalsmith-license", required: false },
|
|
16
18
|
submitMode: { value: "uibuilder" },
|
|
17
19
|
submitUrl: { value: "" },
|
|
@@ -139,6 +141,16 @@
|
|
|
139
141
|
<input type="text" id="node-input-logoAlt" placeholder="Logo" />
|
|
140
142
|
</div>
|
|
141
143
|
|
|
144
|
+
<div class="form-row">
|
|
145
|
+
<label for="node-input-logoHeight"><i class="fa fa-arrows-v"></i> Logo height (px)</label>
|
|
146
|
+
<input type="number" id="node-input-logoHeight" min="1" placeholder="252" />
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<div class="form-row">
|
|
150
|
+
<label for="node-input-logoWidth"><i class="fa fa-arrows-h"></i> Logo width (px)</label>
|
|
151
|
+
<input type="number" id="node-input-logoWidth" min="1" placeholder="1100" />
|
|
152
|
+
</div>
|
|
153
|
+
|
|
142
154
|
<hr/>
|
|
143
155
|
<div class="form-row">
|
|
144
156
|
<strong>Licensing (offline-first)</strong>
|
|
@@ -14,6 +14,17 @@ module.exports = function(RED) {
|
|
|
14
14
|
const https = require("https");
|
|
15
15
|
const licensing = require("../lib/licensing");
|
|
16
16
|
|
|
17
|
+
const DEFAULT_LOGO_MAX_HEIGHT_PX = 252;
|
|
18
|
+
const DEFAULT_LOGO_MAX_WIDTH_PX = 1100;
|
|
19
|
+
|
|
20
|
+
function toPositiveIntOrDefault(value, defaultValue) {
|
|
21
|
+
const n = Number(value);
|
|
22
|
+
if (!Number.isFinite(n)) return defaultValue;
|
|
23
|
+
const i = Math.round(n);
|
|
24
|
+
if (i <= 0) return defaultValue;
|
|
25
|
+
return i;
|
|
26
|
+
}
|
|
27
|
+
|
|
17
28
|
// Register admin endpoints once (used by the editor UI to show license status)
|
|
18
29
|
let _adminRegistered = false;
|
|
19
30
|
function registerAdminEndpoints() {
|
|
@@ -362,6 +373,14 @@ module.exports = function(RED) {
|
|
|
362
373
|
const logoRequested = isNonEmptyString(msg.options?.logoPath ?? config.logoPath ?? "");
|
|
363
374
|
let logoPathRaw = msg.options?.logoPath ?? config.logoPath ?? "";
|
|
364
375
|
const logoAltRaw = msg.options?.logoAlt ?? config.logoAlt ?? "Logo";
|
|
376
|
+
const logoMaxHeightPx = toPositiveIntOrDefault(
|
|
377
|
+
msg.options?.logoHeight ?? config.logoHeight ?? DEFAULT_LOGO_MAX_HEIGHT_PX,
|
|
378
|
+
DEFAULT_LOGO_MAX_HEIGHT_PX
|
|
379
|
+
);
|
|
380
|
+
const logoMaxWidthPx = toPositiveIntOrDefault(
|
|
381
|
+
msg.options?.logoWidth ?? config.logoWidth ?? DEFAULT_LOGO_MAX_WIDTH_PX,
|
|
382
|
+
DEFAULT_LOGO_MAX_WIDTH_PX
|
|
383
|
+
);
|
|
365
384
|
if (isNonEmptyString(logoPathRaw) && licensePublic.brandingLocked) {
|
|
366
385
|
node.warn("PortalSmith FormGen: custom logo is disabled in Free mode (watermarked). Using default branding.");
|
|
367
386
|
licensePublic.brandingAttempted = Boolean(logoRequested);
|
|
@@ -425,6 +444,8 @@ module.exports = function(RED) {
|
|
|
425
444
|
themeMode: themeMode,
|
|
426
445
|
logoUrl: logoUrl,
|
|
427
446
|
logoAlt: logoAlt,
|
|
447
|
+
logoMaxHeightPx: logoMaxHeightPx,
|
|
448
|
+
logoMaxWidthPx: logoMaxWidthPx,
|
|
428
449
|
licensed: licensePublic.licensed
|
|
429
450
|
};
|
|
430
451
|
|
|
@@ -463,7 +484,7 @@ module.exports = function(RED) {
|
|
|
463
484
|
|
|
464
485
|
// Write runtime metadata
|
|
465
486
|
const runtimeData = {
|
|
466
|
-
generatorVersion: "0.5.
|
|
487
|
+
generatorVersion: "0.5.3",
|
|
467
488
|
timestamp: new Date().toISOString(),
|
|
468
489
|
instanceName: instanceName,
|
|
469
490
|
storageMode: storageMode,
|
|
@@ -471,6 +492,8 @@ module.exports = function(RED) {
|
|
|
471
492
|
themeMode: themeMode,
|
|
472
493
|
logoUrl: logoUrl || "",
|
|
473
494
|
logoAlt: logoAlt || "",
|
|
495
|
+
logoMaxHeightPx: logoMaxHeightPx,
|
|
496
|
+
logoMaxWidthPx: logoMaxWidthPx,
|
|
474
497
|
submitMode: submitMode,
|
|
475
498
|
submitUrl: submitUrl,
|
|
476
499
|
license: licensePublic,
|
package/package.json
CHANGED
|
@@ -137,6 +137,13 @@
|
|
|
137
137
|
height: auto;
|
|
138
138
|
object-fit: contain;
|
|
139
139
|
}
|
|
140
|
+
.ps-custom-logo {
|
|
141
|
+
max-height: var(--ps-logo-max-height, 252px);
|
|
142
|
+
max-width: var(--ps-logo-max-width, 1100px);
|
|
143
|
+
width: auto;
|
|
144
|
+
height: auto;
|
|
145
|
+
object-fit: contain;
|
|
146
|
+
}
|
|
140
147
|
.ps-watermark {
|
|
141
148
|
position: fixed;
|
|
142
149
|
right: 14px;
|
|
@@ -186,10 +193,10 @@
|
|
|
186
193
|
<body>
|
|
187
194
|
<div id="app">
|
|
188
195
|
<div class="container form-container">
|
|
189
|
-
<div class="ps-header">
|
|
196
|
+
<div class="ps-header" style="--ps-logo-max-height: [[logoMaxHeightPx]]px; --ps-logo-max-width: [[logoMaxWidthPx]]px;">
|
|
190
197
|
<h1 class="mb-0">[[title]]</h1>
|
|
191
198
|
[[#logoUrl]]
|
|
192
|
-
<img class="ps-logo" src="[[logoUrl]]" alt="[[logoAlt]]">
|
|
199
|
+
<img class="ps-custom-logo" src="[[logoUrl]]" alt="[[logoAlt]]">
|
|
193
200
|
[[/logoUrl]]
|
|
194
201
|
[[^logoUrl]]
|
|
195
202
|
[[^licensed]]
|
|
@@ -120,6 +120,13 @@
|
|
|
120
120
|
height: auto;
|
|
121
121
|
object-fit: contain;
|
|
122
122
|
}
|
|
123
|
+
.ps-custom-logo {
|
|
124
|
+
max-height: var(--ps-logo-max-height, 252px);
|
|
125
|
+
max-width: var(--ps-logo-max-width, 1100px);
|
|
126
|
+
width: auto;
|
|
127
|
+
height: auto;
|
|
128
|
+
object-fit: contain;
|
|
129
|
+
}
|
|
123
130
|
.ps-watermark {
|
|
124
131
|
position: fixed;
|
|
125
132
|
right: 14px;
|
|
@@ -169,10 +176,10 @@
|
|
|
169
176
|
<body>
|
|
170
177
|
<div id="app">
|
|
171
178
|
<div class="container form-container">
|
|
172
|
-
<div class="ps-header">
|
|
179
|
+
<div class="ps-header" style="--ps-logo-max-height: [[logoMaxHeightPx]]px; --ps-logo-max-width: [[logoMaxWidthPx]]px;">
|
|
173
180
|
<h1 class="mb-0">[[title]]</h1>
|
|
174
181
|
[[#logoUrl]]
|
|
175
|
-
<img class="ps-logo" src="[[logoUrl]]" alt="[[logoAlt]]">
|
|
182
|
+
<img class="ps-custom-logo" src="[[logoUrl]]" alt="[[logoAlt]]">
|
|
176
183
|
[[/logoUrl]]
|
|
177
184
|
[[^logoUrl]]
|
|
178
185
|
[[^licensed]]
|