@pageboard/html 0.14.31 → 0.14.33
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/form.js +3 -21
- package/package.json +1 -1
- package/ui/form.js +3 -0
- package/ui/pagination.js +4 -5
package/elements/form.js
CHANGED
|
@@ -98,26 +98,8 @@ exports.api_form = {
|
|
|
98
98
|
},
|
|
99
99
|
action: {
|
|
100
100
|
title: 'Action',
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
properties: {
|
|
104
|
-
method: {
|
|
105
|
-
title: 'Method',
|
|
106
|
-
nullable: true,
|
|
107
|
-
type: "string",
|
|
108
|
-
pattern: /^(\w+\.\w+)?$/.source
|
|
109
|
-
},
|
|
110
|
-
parameters: {
|
|
111
|
-
title: 'Parameters',
|
|
112
|
-
nullable: true,
|
|
113
|
-
type: "object"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
$filter: {
|
|
117
|
-
name: 'service',
|
|
118
|
-
action: "write"
|
|
119
|
-
},
|
|
120
|
-
$helper: 'service',
|
|
101
|
+
description: 'Choose a service',
|
|
102
|
+
$ref: '/services?$action=write'
|
|
121
103
|
},
|
|
122
104
|
redirection: {
|
|
123
105
|
title: 'Success',
|
|
@@ -178,7 +160,7 @@ exports.api_form = {
|
|
|
178
160
|
contents: 'block+',
|
|
179
161
|
tag: 'form[method="post"]',
|
|
180
162
|
html: `<form is="element-form" method="post" name="[name]" masked="[masked]"
|
|
181
|
-
action="/.api/form/[
|
|
163
|
+
action="/.api/form/[name|else:$id]"
|
|
182
164
|
parameters="[$expr?.action?.parameters|as:expressions]"
|
|
183
165
|
success="[redirection.url][redirection.parameters|as:query]"
|
|
184
166
|
badrequest="[badrequest.url][badrequest.parameters|as:query]"
|
package/package.json
CHANGED
package/ui/form.js
CHANGED
|
@@ -320,6 +320,9 @@ class HTMLElementForm extends Page.create(HTMLFormElement) {
|
|
|
320
320
|
for (const node of prelist) {
|
|
321
321
|
await node.presubmit(state);
|
|
322
322
|
}
|
|
323
|
+
form.enable();
|
|
324
|
+
scope.$request = form.read(true, e.submitter);
|
|
325
|
+
form.disable();
|
|
323
326
|
form.classList.add('loading');
|
|
324
327
|
scope.$response = await state.fetch(form.method, Page.format({
|
|
325
328
|
pathname: form.getAttribute('action'),
|
package/ui/pagination.js
CHANGED
|
@@ -14,13 +14,12 @@ class HTMLElementPagination extends Page.create(HTMLAnchorElement) {
|
|
|
14
14
|
console.warn("pagination does not find fetch node", this.dataset.fetch);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const name = node.dataset.
|
|
18
|
-
const
|
|
19
|
-
const stop = parseInt(node.dataset.stop) || 0;
|
|
17
|
+
const name = node.dataset.offsetName;
|
|
18
|
+
const offset = parseInt(node.dataset.offset) || 0;
|
|
20
19
|
const limit = parseInt(node.dataset.limit) || 10;
|
|
21
20
|
const count = parseInt(node.dataset.count) || 0;
|
|
22
21
|
const sign = this.dataset.dir == "-" ? -1 : +1;
|
|
23
|
-
const cur = sign > 0 ?
|
|
22
|
+
const cur = sign > 0 ? offset : (offset - 2 * limit);
|
|
24
23
|
|
|
25
24
|
this.setAttribute('href', Page.format({
|
|
26
25
|
pathname: state.pathname,
|
|
@@ -29,7 +28,7 @@ class HTMLElementPagination extends Page.create(HTMLAnchorElement) {
|
|
|
29
28
|
[name]: cur || undefined
|
|
30
29
|
}
|
|
31
30
|
}));
|
|
32
|
-
this.disabled = sign < 0 &&
|
|
31
|
+
this.disabled = sign < 0 && offset <= limit || sign > 0 && offset >= count;
|
|
33
32
|
}
|
|
34
33
|
handleClick(e) {
|
|
35
34
|
if (this.disabled) {
|