@pageboard/html 0.13.3 → 0.13.5
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/elements/layout.js +31 -0
- package/package.json +1 -1
- package/ui/form.css +4 -0
- package/ui/form.js +4 -4
package/elements/layout.js
CHANGED
|
@@ -137,6 +137,35 @@ exports.layout = {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
|
+
padding: {
|
|
141
|
+
title: 'Padding',
|
|
142
|
+
type: 'object',
|
|
143
|
+
nullable: true,
|
|
144
|
+
properties: {
|
|
145
|
+
inline: {
|
|
146
|
+
title: 'Inline (em)',
|
|
147
|
+
type: 'number',
|
|
148
|
+
default: 0,
|
|
149
|
+
minimum: 0,
|
|
150
|
+
multipleOf: 0.1,
|
|
151
|
+
nullable: true
|
|
152
|
+
},
|
|
153
|
+
inlineUnits: {
|
|
154
|
+
const: 'em'
|
|
155
|
+
},
|
|
156
|
+
block: {
|
|
157
|
+
title: 'Block (rem)',
|
|
158
|
+
type: 'number',
|
|
159
|
+
default: 0,
|
|
160
|
+
minimum: 0,
|
|
161
|
+
multipleOf: 0.1,
|
|
162
|
+
nullable: true
|
|
163
|
+
},
|
|
164
|
+
blockUnits: {
|
|
165
|
+
const: 'rem'
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
140
169
|
background: {
|
|
141
170
|
title: 'Background',
|
|
142
171
|
type: 'object',
|
|
@@ -314,6 +343,8 @@ exports.layout = {
|
|
|
314
343
|
data-crop="[background.crop.x];[background.crop.y];[background.crop.width];[background.crop.height];[background.crop.zoom]"
|
|
315
344
|
style-margin-block="[margins.block|fail:][margins.blockUnits]"
|
|
316
345
|
style-margin-inline="[margins.inline|fail:][margins.inlineUnits]"
|
|
346
|
+
style-padding-block="[padding.block|fail:][padding.blockUnits]"
|
|
347
|
+
style-padding-inline="[padding.inline|fail:][padding.inlineUnits]"
|
|
317
348
|
style-height="[height|fail:][heightUnits]"
|
|
318
349
|
style-background-color="[background.color]"
|
|
319
350
|
style-background-size="[background.size]"
|
package/package.json
CHANGED
package/ui/form.css
CHANGED
package/ui/form.js
CHANGED
|
@@ -175,8 +175,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
175
175
|
let val = node.value;
|
|
176
176
|
if (val == "") val = null;
|
|
177
177
|
let defVal = node.defaultValue;
|
|
178
|
-
if (defVal
|
|
179
|
-
else if (type == "select-one" && defVal === undefined) defVal = null;
|
|
178
|
+
if (defVal === "" || defVal === undefined) defVal = null;
|
|
180
179
|
|
|
181
180
|
switch (type) {
|
|
182
181
|
case "file":
|
|
@@ -192,7 +191,7 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
192
191
|
}
|
|
193
192
|
}
|
|
194
193
|
break;
|
|
195
|
-
case "checkbox":
|
|
194
|
+
case "checkbox":
|
|
196
195
|
if (withDefaults) {
|
|
197
196
|
if (query[name] === undefined) {
|
|
198
197
|
query[name] = null;
|
|
@@ -338,8 +337,9 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
338
337
|
this.toggleMessages(status);
|
|
339
338
|
}
|
|
340
339
|
async postMethod(e, state) {
|
|
341
|
-
if (e.type != "submit") return;
|
|
342
340
|
const form = this;
|
|
341
|
+
if (e.type != "submit" && form.elements.find(item => item.type == "submit")) return;
|
|
342
|
+
|
|
343
343
|
form.classList.add('loading');
|
|
344
344
|
|
|
345
345
|
await Promise.all(
|