@loadbare/app 0.21.0 → 0.23.0
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/README.md +18 -0
- package/dist/build/assemble.d.ts.map +1 -1
- package/dist/build/assemble.js +8 -3
- package/dist/build/assemble.js.map +1 -1
- package/dist/build/build.d.ts +78 -0
- package/dist/build/build.d.ts.map +1 -0
- package/dist/build/build.js +220 -0
- package/dist/build/build.js.map +1 -0
- package/dist/build/cli.d.ts +6 -1
- package/dist/build/cli.d.ts.map +1 -1
- package/dist/build/cli.js +25 -78
- package/dist/build/cli.js.map +1 -1
- package/dist/build/declared.d.ts.map +1 -1
- package/dist/build/declared.js +3 -0
- package/dist/build/declared.js.map +1 -1
- package/dist/build/skills-cli.d.ts +2 -1
- package/dist/build/skills-cli.d.ts.map +1 -1
- package/dist/build/skills-cli.js +8 -1
- package/dist/build/skills-cli.js.map +1 -1
- package/dist/build/skills.d.ts +2 -0
- package/dist/build/skills.d.ts.map +1 -1
- package/dist/build/skills.js +2 -0
- package/dist/build/skills.js.map +1 -1
- package/dist/core/lb-constants.d.ts +14 -0
- package/dist/core/lb-constants.d.ts.map +1 -1
- package/dist/core/lb-constants.js +25 -0
- package/dist/core/lb-constants.js.map +1 -1
- package/dist/dev/lb-dev.d.ts +128 -0
- package/dist/dev/lb-dev.d.ts.map +1 -0
- package/dist/dev/lb-dev.js +289 -0
- package/dist/dev/lb-dev.js.map +1 -0
- package/dist/hub/lb-apply.d.ts.map +1 -1
- package/dist/hub/lb-apply.js +12 -6
- package/dist/hub/lb-apply.js.map +1 -1
- package/dist/hub/lb-hub.browser.d.ts.map +1 -1
- package/dist/hub/lb-hub.browser.js +119 -15
- package/dist/hub/lb-hub.browser.js.map +1 -1
- package/docs/comparison.md +4 -3
- package/docs/miswarts.md +3 -2
- package/docs/reference/builder.md +12 -4
- package/docs/reference/chrome.md +52 -1
- package/docs/reference/data-binding.md +28 -18
- package/docs/reference/dev-server.md +178 -0
- package/docs/reference/names.md +14 -1
- package/docs/reference/overview.md +1 -0
- package/docs/reference/server.md +8 -3
- package/docs/reference/widgets.md +10 -277
- package/docs/temp-proposals.md +251 -0
- package/docs/testing.md +2 -1
- package/docs/tutorials/000-getting-started.md +1 -1
- package/docs/tutorials/040-displaying-data.md +1 -1
- package/docs/tutorials/090-using-widget-libraries.md +1 -1
- package/package.json +4 -2
- package/skills/loadbare-app/SKILL.md +30 -11
- package/skills/loadbare-app/references/builder.md +12 -4
- package/skills/loadbare-app/references/chrome.md +52 -1
- package/skills/loadbare-app/references/data-binding.md +28 -18
- package/skills/loadbare-app/references/dev-server.md +178 -0
- package/skills/loadbare-app/references/miswarts.md +3 -2
- package/skills/loadbare-app/references/names.md +14 -1
- package/skills/loadbare-app/references/overview.md +1 -0
- package/skills/loadbare-app/references/server.md +8 -3
- package/skills/loadbare-app/references/widgets.md +10 -277
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# The Basic Widget Library
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`lb-master`, `lb-checkbox`, `lb-number` and `lb-date`. Every one of them is an ordinary custom element, written
|
|
3
|
+
`@loadbare/widgets` is the basic widget set: controls, a table, dialogs, and
|
|
4
|
+
elements that format a value. Every one of them is an ordinary custom element, written
|
|
6
5
|
against the contracts in [Custom Elements](./custom-elements.md#html) for its
|
|
7
6
|
definition and [Custom Elements](./custom-elements.md#code) for its class.
|
|
8
7
|
|
|
@@ -30,282 +29,16 @@ see [Being a control](./custom-elements.md#being-a-control). Each passes a
|
|
|
30
29
|
refusal's message for its column to the native control inside it; see
|
|
31
30
|
[Refusals](./data-binding.md#refusals).
|
|
32
31
|
|
|
33
|
-
##
|
|
32
|
+
## Each widget
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
Each widget's parameters, the attributes it reads, and what a change sends
|
|
35
|
+
are documented once, in the package that ships it: one page per widget,
|
|
36
|
+
which the loadbare-widgets skill carries. Install that skill beside this one:
|
|
37
37
|
|
|
38
|
-
```html
|
|
39
|
-
<lb-input lb-column="name" lb-request="lb-row-update" exp-label="Name"></lb-input>
|
|
40
38
|
```
|
|
41
|
-
|
|
42
|
-
Inside a form, leave `lb-request` off. The form gathers the widget on submit
|
|
43
|
-
like any other control, so a widget that also sent its own request would
|
|
44
|
-
write the same edit twice.
|
|
45
|
-
|
|
46
|
-
| Parameter | Fills |
|
|
47
|
-
|----------------|----------------------------------|
|
|
48
|
-
| `exp-label` | The visible `<label>` text |
|
|
49
|
-
| `exp-type` | The input's `type`, `text` when absent |
|
|
50
|
-
| `exp-readonly` | The input's `readonly` attribute |
|
|
51
|
-
|
|
52
|
-
## `lb-select`
|
|
53
|
-
|
|
54
|
-
Wraps a `<select>` whose `<option>`s the page writes inside the tag:
|
|
55
|
-
|
|
56
|
-
```html
|
|
57
|
-
<lb-select lb-column="team" lb-request="lb-row-update" exp-label="Team">
|
|
58
|
-
<option value="">No team</option>
|
|
59
|
-
<option value="Engines">Engines</option>
|
|
60
|
-
</lb-select>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
| Parameter | Fills |
|
|
64
|
-
|-------------|----------------------------|
|
|
65
|
-
| `exp-label` | The visible `<label>` text |
|
|
66
|
-
|
|
67
|
-
## `lb-options`
|
|
68
|
-
|
|
69
|
-
A `<select>` whose `<option>`s are the rows of the query it names. The page
|
|
70
|
-
writes the row template inside the widget:
|
|
71
|
-
|
|
72
|
-
```html
|
|
73
|
-
<lb-options lb-query="statuses" lb-column="status" lb-request="lb-row-update" exp-label="Status">
|
|
74
|
-
<template><option lb-column="label"></option></template>
|
|
75
|
-
</lb-options>
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
| Parameter | Fills |
|
|
79
|
-
|-------------|----------------------------|
|
|
80
|
-
| `exp-label` | The visible `<label>` text |
|
|
81
|
-
| `exp-size` | The `<select>`'s `size`, an open list rather than a drop-down |
|
|
82
|
-
|
|
83
|
-
- Each option's `value` is its row's key, the `lb-key-value` the hub stamps
|
|
84
|
-
on the live row, so the widget holds a key and shows a label.
|
|
85
|
-
- A group template holding an `<optgroup>` puts the options in groups, one
|
|
86
|
-
per run of the query's order's leading term. The widget labels each
|
|
87
|
-
`<optgroup>` from the `lb-group-value` the hub stamps on it:
|
|
88
|
-
|
|
89
|
-
```html
|
|
90
|
-
<template lb-group>
|
|
91
|
-
<optgroup><template><option lb-column="label"></option></template></optgroup>
|
|
92
|
-
</template>
|
|
93
|
-
```
|
|
94
|
-
- A heading option marked `data-group-label` in the `<optgroup>`, `hidden`
|
|
95
|
-
and `disabled`, labels the group with its text instead, so the label can
|
|
96
|
-
be a column of the group's first row.
|
|
97
|
-
- Its `value` selects the option with that key, including an option that
|
|
98
|
-
arrives after the value did.
|
|
99
|
-
|
|
100
|
-
`lb-picker` is the same class with the row template supplied by its
|
|
101
|
-
definition.
|
|
102
|
-
|
|
103
|
-
## `lb-picker`
|
|
104
|
-
|
|
105
|
-
`lb-options`, with the row template built in, for a list where every row is
|
|
106
|
-
one option showing one column:
|
|
107
|
-
|
|
108
|
-
```html
|
|
109
|
-
<lb-picker
|
|
110
|
-
lb-query="statuses"
|
|
111
|
-
lb-column="status"
|
|
112
|
-
lb-request="lb-row-update"
|
|
113
|
-
exp-label="Status"
|
|
114
|
-
exp-column="label"
|
|
115
|
-
></lb-picker>
|
|
39
|
+
npx loadbare-widgets skills install
|
|
116
40
|
```
|
|
117
41
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
| `exp-column` | The column each option shows |
|
|
122
|
-
|
|
123
|
-
An option built from two columns, a row with a second element, or options
|
|
124
|
-
in groups, is `lb-options` with the page's own templates.
|
|
125
|
-
|
|
126
|
-
## `lb-table`
|
|
127
|
-
|
|
128
|
-
A `<table>` that supplies its own scaffolding. The page supplies the heading
|
|
129
|
-
row, the row template, and optionally a footer, each as a `<template>`:
|
|
130
|
-
|
|
131
|
-
```html
|
|
132
|
-
<lb-table lb-query="ledger" exp-caption="Ledger">
|
|
133
|
-
<template lb-exp-template="head">
|
|
134
|
-
<tr><th>Date</th><th>Amount</th></tr>
|
|
135
|
-
</template>
|
|
136
|
-
<template lb-group>
|
|
137
|
-
<tr><th colspan="2" lb-column="month"></th></tr>
|
|
138
|
-
<template>
|
|
139
|
-
<tr><td lb-column="date"></td><td lb-column="amount"></td></tr>
|
|
140
|
-
</template>
|
|
141
|
-
</template>
|
|
142
|
-
<template lb-exp-template="foot">
|
|
143
|
-
<tr><td>Total</td><td lb-sum="amount"></td></tr>
|
|
144
|
-
</template>
|
|
145
|
-
</lb-table>
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
| Parameter | Fills |
|
|
149
|
-
|---------------|----------------------|
|
|
150
|
-
| `exp-caption` | The `<caption>` text |
|
|
151
|
-
|
|
152
|
-
| Template | Fills |
|
|
153
|
-
|-----------------------------------|-----------------------------------------|
|
|
154
|
-
| `<template lb-exp-template="head">` | The `<thead>` |
|
|
155
|
-
| `<template lb-exp-template="foot">` | The `<tfoot>` |
|
|
156
|
-
| Any other `<template>` | The row or group template, in the `<tbody>` |
|
|
157
|
-
|
|
158
|
-
- The hub places the rows by the query's order and builds its groups, and
|
|
159
|
-
leaves them where they stand for an edit from inside the table; see
|
|
160
|
-
[Rows the user is working in](./data-binding.md#rows-the-user-is-working-in). The
|
|
161
|
-
rows land in the one `<tbody>`, so a group here is a heading row with its
|
|
162
|
-
rows after it.
|
|
163
|
-
- `lb-order` and `lb-filter` go on the `lb-table` itself, beside
|
|
164
|
-
`lb-query`; see [Order](./data-binding.md#order) and
|
|
165
|
-
[Filters](./data-binding.md#filters).
|
|
166
|
-
- The footer is not a row of `ledger`. An aggregate there covers every row
|
|
167
|
-
showing;
|
|
168
|
-
a figure that is not a sum of the rows, such as a budget, is a `<tr>`
|
|
169
|
-
naming a `row` query of its own.
|
|
170
|
-
- A `<template lb-exp-template="ghost">` is a blank row for entering a new
|
|
171
|
-
one, in a `<tbody>` of its own. The widget joins its controls to a form
|
|
172
|
-
outside the table, since a `<form>` cannot wrap a `<tr>`, and puts the
|
|
173
|
-
cursor back in it once an insert from it succeeds.
|
|
174
|
-
- After rows land, the widget scrolls the row the page's own request created
|
|
175
|
-
or moved into view.
|
|
176
|
-
- Text selected in a cell whose `lb-column` the table's `lb-filter` names
|
|
177
|
-
becomes that column's filter in `lb-choices`: `=` for the whole text,
|
|
178
|
-
`^=` from its start, `$=` up to its end, `*=` otherwise.
|
|
179
|
-
- The heading of the order's leading column carries a triangle for the
|
|
180
|
-
direction, read from [`lb-query-order`](./data-binding.md#order). A
|
|
181
|
-
heading's column is the `lb-column` in the cell at its position in the row
|
|
182
|
-
template. While rows stand out of order the triangle carries
|
|
183
|
-
`data-unsorted` and a click on its heading re-sorts. With `lb-order`, a
|
|
184
|
-
click on the sorted heading reverses the order and a click on another
|
|
185
|
-
sorts by its column. Not on a grouped table.
|
|
186
|
-
|
|
187
|
-
## `lb-confirm`
|
|
188
|
-
|
|
189
|
-
A button that asks before it sends. The page writes the question inside the
|
|
190
|
-
tag, and the request goes on the dialog's confirm button, so nothing reaches
|
|
191
|
-
the hub until the user says yes:
|
|
192
|
-
|
|
193
|
-
```html
|
|
194
|
-
<lb-confirm exp-label="Delete" exp-request="lb-row-delete">
|
|
195
|
-
Delete <b lb-column="name"></b>?
|
|
196
|
-
</lb-confirm>
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
| Parameter | Fills |
|
|
200
|
-
|---------------|--------------------------------------------------|
|
|
201
|
-
| `exp-label` | The text of the button that opens the dialog |
|
|
202
|
-
| `exp-request` | The confirm button's `lb-request` |
|
|
203
|
-
| `exp-confirm` | The confirm button's text, `Confirm` when absent |
|
|
204
|
-
|
|
205
|
-
The widget closes the dialog once the request succeeds, and leaves it open
|
|
206
|
-
on a refusal.
|
|
207
|
-
|
|
208
|
-
## `lb-form`
|
|
209
|
-
|
|
210
|
-
A `<form>` over one row's controls. A row with a key saves each control's
|
|
211
|
-
column on `change`; a row whose key is empty is new, and the hub sends no
|
|
212
|
-
update for it, so its controls wait for a submit. A definition only.
|
|
213
|
-
|
|
214
|
-
| Parameter | Fills |
|
|
215
|
-
|-----------|-----------------|
|
|
216
|
-
| `exp-id` | The form's `id` |
|
|
217
|
-
|
|
218
|
-
## `lb-insert-dialog`
|
|
219
|
-
|
|
220
|
-
A row entered in a modal dialog, written once outside every row and opened
|
|
221
|
-
with `commandfor` and `command="show-modal"`. Save is the form's
|
|
222
|
-
`lb-row-insert`; on success the widget chooses the new row in the nearest
|
|
223
|
-
`lb-options` around the button that opened it, and closes. The handler
|
|
224
|
-
answers with a patch holding the new row.
|
|
225
|
-
|
|
226
|
-
While open, the button that opened it carries `insert-dialog-opener` and the
|
|
227
|
-
widget carries `anchored`, for a stylesheet to place the dialog beside the
|
|
228
|
-
button with CSS anchor positioning.
|
|
229
|
-
|
|
230
|
-
| Parameter | Fills |
|
|
231
|
-
|-------------|---------------------------------------------------|
|
|
232
|
-
| `exp-id` | The dialog's `id` |
|
|
233
|
-
| `exp-title` | The dialog's heading |
|
|
234
|
-
| `exp-query` | The form's `lb-query`, which it inserts into |
|
|
235
|
-
| `exp-save` | The Save button's text, `Save` when absent |
|
|
236
|
-
|
|
237
|
-
## `lb-master`
|
|
238
|
-
|
|
239
|
-
A set, one of its rows, and the buttons that act on the set: New, Copy,
|
|
240
|
-
Delete, Save new and Cancel, each shown only for a row on record or a new
|
|
241
|
-
one. A definition only, built from `lb-form` and `lb-confirm`. New sends
|
|
242
|
-
`new` and Copy sends `copy`, requests the page declares; `new` returns
|
|
243
|
-
`url()` emptying the parm that names the row.
|
|
244
|
-
|
|
245
|
-
| Parameter | Fills |
|
|
246
|
-
|---------------|--------------------------------------------|
|
|
247
|
-
| `exp-row` | The `lb-query` of the row the form shows |
|
|
248
|
-
| `exp-form-id` | The form's `id`, `master-form` when absent |
|
|
249
|
-
|
|
250
|
-
## `lb-checkbox`
|
|
251
|
-
|
|
252
|
-
A checkbox and its label as one element, for an application to style. A
|
|
253
|
-
definition only: a native checkbox is already a control (see
|
|
254
|
-
[Checkboxes](./data-binding.md#checkboxes)), so the widget is the markup, a
|
|
255
|
-
`<label>` holding the `<input type="checkbox">` and a `<span>` with the
|
|
256
|
-
text. The column and request go on the checkbox inside, so they arrive as
|
|
257
|
-
expansion attributes.
|
|
258
|
-
|
|
259
|
-
Unlike `lb-input`, it has no script making the tag the control. A value
|
|
260
|
-
that lands before a widget's script has loaded arrives only as the string
|
|
261
|
-
stamp `lb-column-value`, and a script checkbox would read `"false"` as
|
|
262
|
-
checked. The hub sets a native checkbox's `checked` directly.
|
|
263
|
-
|
|
264
|
-
| Parameter | Fills |
|
|
265
|
-
|---------------|-----------------------------------------------|
|
|
266
|
-
| `exp-column` | The checkbox's `lb-column` |
|
|
267
|
-
| `exp-label` | The label's text |
|
|
268
|
-
| `exp-request` | The checkbox's `lb-request`, none when absent |
|
|
269
|
-
|
|
270
|
-
## `lb-number` and `lb-date`
|
|
271
|
-
|
|
272
|
-
A number shown by the browser's `Intl.NumberFormat`, and a date or time
|
|
273
|
-
shown by `Intl.DateTimeFormat`. Neither is a control: `lb-column` goes on
|
|
274
|
-
the tag, and the widget renders the `lb-column-value` the hub stamps; see
|
|
275
|
-
[Receiving a value](./custom-elements.md#receiving-a-value).
|
|
276
|
-
|
|
277
|
-
```html
|
|
278
|
-
<lb-number lb-column="balance" exp-style="currency" exp-currency="USD"></lb-number>
|
|
279
|
-
<lb-date lb-column="due" exp-date-style="medium"></lb-date>
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
Each parameter is one of Intl's options in kebab-case, as `exp-currency-sign`
|
|
283
|
-
for `currencySign`, plus `exp-locale`. A value that is no number or date
|
|
284
|
-
shows as it arrived, and a date alone, `YYYY-MM-DD`, shows as that day in
|
|
285
|
-
every time zone. The stamp keeps the raw value, so a stylesheet selects on
|
|
286
|
-
it:
|
|
287
|
-
|
|
288
|
-
```css
|
|
289
|
-
lb-number[lb-column-value^="-"] { color: var(--negative); }
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
## `lb-unknown-page`
|
|
293
|
-
|
|
294
|
-
The chrome's dialog for a URL that names no page, as one tag:
|
|
295
|
-
|
|
296
|
-
```html
|
|
297
|
-
<lb-hub>
|
|
298
|
-
<nav>...</nav>
|
|
299
|
-
<main></main>
|
|
300
|
-
<lb-unknown-page></lb-unknown-page>
|
|
301
|
-
</lb-hub>
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
It expands to a `<dialog lb-url-unknown lb-query="lb-url">` showing
|
|
305
|
-
`lb-path`, and the hub opens it when no page's stub matches the path. See
|
|
306
|
-
[An unknown page](./chrome.md#an-unknown-page) for the same dialog written
|
|
307
|
-
by hand.
|
|
308
|
-
|
|
309
|
-
| Parameter | Fills |
|
|
310
|
-
|-------------------|------------------------------------------|
|
|
311
|
-
| `exp-button-text` | The text of the button that closes it, `OK` by default |
|
|
42
|
+
For a reader without the skill, the package's
|
|
43
|
+
[README](https://gitlab.com/kendowns/loadbare/-/blob/main/packages/widgets/README.md)
|
|
44
|
+
lists the widgets and links each page.
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# Proposals
|
|
2
|
+
|
|
3
|
+
Working notes for changes not yet made. Not part of the skill.
|
|
4
|
+
|
|
5
|
+
## The mental model
|
|
6
|
+
|
|
7
|
+
A `row` maps to an HTML form. It supports select, insert, update and delete.
|
|
8
|
+
The hub handles the basics, such as resetting a form after an insert, and
|
|
9
|
+
lifecycle methods let a custom element add behavior of its own.
|
|
10
|
+
|
|
11
|
+
`rows` treats each of its rows as a `row`, and allows insert, update and
|
|
12
|
+
delete of several rows at once. It also places its rows by sorting and
|
|
13
|
+
filtering, each with an automatic or a manual flag.
|
|
14
|
+
|
|
15
|
+
A form sends a parent `row` with its nested `rows` in one submit, and the
|
|
16
|
+
handler writes them together. This is the foreign key.
|
|
17
|
+
|
|
18
|
+
The URL names the page, and its query parms are the server's filters. The
|
|
19
|
+
user's own sorts and filters are choices, held in `lb-choices`.
|
|
20
|
+
|
|
21
|
+
Requests go up, from the element that committed through its ancestors to the
|
|
22
|
+
hub, which completes them from what surrounds the element. Commands go
|
|
23
|
+
sideways, by id to the element they name, carrying the button that sent them,
|
|
24
|
+
and never reach the server. Lifecycle methods go down, from the hub to the
|
|
25
|
+
custom elements it placed.
|
|
26
|
+
|
|
27
|
+
What lies past this belongs to the application. It reaches the hub as fields
|
|
28
|
+
a custom element supplies on a request, and through lifecycle methods the hub
|
|
29
|
+
calls on a custom element.
|
|
30
|
+
|
|
31
|
+
## 1. Values kept across inserts
|
|
32
|
+
|
|
33
|
+
Package: `@loadbare/widgets`. No change to `@loadbare/app`.
|
|
34
|
+
|
|
35
|
+
### Today
|
|
36
|
+
|
|
37
|
+
After an insert succeeds, the hub resets the form the insert was gathered
|
|
38
|
+
from, then calls `lbRequestDone` on the attached custom elements from the
|
|
39
|
+
committing element outward. `detail.request.values` holds the values the
|
|
40
|
+
insert sent, by column. A ghost row starts over empty, and each control
|
|
41
|
+
returns to its HTML default.
|
|
42
|
+
|
|
43
|
+
A page that wants some columns to carry over to the next row, such as a date
|
|
44
|
+
or an account during a run of entries, has no way to say so.
|
|
45
|
+
|
|
46
|
+
### Proposal
|
|
47
|
+
|
|
48
|
+
A widget around the list, `lb-keep` or similar, names the columns to keep:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<lb-keep exp-columns="date, account">
|
|
52
|
+
<lb-table lb-query="entries">
|
|
53
|
+
...
|
|
54
|
+
</lb-table>
|
|
55
|
+
</lb-keep>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
In `lbRequestDone`, after a successful `lb-row-insert`, the widget sets each
|
|
59
|
+
named column's control in the committing row back to the value the insert
|
|
60
|
+
sent. The hub's reset and the refill run in one synchronous stretch, so the
|
|
61
|
+
empty row is never painted.
|
|
62
|
+
|
|
63
|
+
- A column not named returns to its HTML default: `value` on an input,
|
|
64
|
+
`selected` on an option. A control with no default comes back blank.
|
|
65
|
+
- A reset the user asks for, with a reset button, sends no request and is
|
|
66
|
+
not followed by `lbRequestDone`. It clears every column.
|
|
67
|
+
- Kept values live in the controls. A reload starts the row empty.
|
|
68
|
+
|
|
69
|
+
### Open
|
|
70
|
+
|
|
71
|
+
- A starting value taken from the page, not from the last insert: ef's
|
|
72
|
+
paychecks page enters a paycheck while showing a series, and the new
|
|
73
|
+
paycheck's series is the one showing. A possible form is a default named
|
|
74
|
+
as `query.column`.
|
|
75
|
+
- Whether every wrapped control in `@loadbare/widgets` takes an HTML
|
|
76
|
+
default.
|
|
77
|
+
|
|
78
|
+
## 2. Sorted and filtered placement
|
|
79
|
+
|
|
80
|
+
Package: `@loadbare/app`.
|
|
81
|
+
|
|
82
|
+
### Today
|
|
83
|
+
|
|
84
|
+
When a patch lands on a list, the hub either places the rows by the order and
|
|
85
|
+
the filter, or holds them where they stand. It holds them when the request
|
|
86
|
+
was sent from inside the list: the list is the nearest element carrying
|
|
87
|
+
`lb-query` around the element that committed, or the request came from a form
|
|
88
|
+
that `--lb-edit` pointed at one of its rows.
|
|
89
|
+
|
|
90
|
+
Where the committing element sits is the only input to that decision. Two
|
|
91
|
+
cases in ef come out wrong:
|
|
92
|
+
|
|
93
|
+
- Matching. "Create rule and apply it" is a form in a side panel. Its answer
|
|
94
|
+
patches the rows the rule matched, and under the filter "Unmatched only"
|
|
95
|
+
they disappear. The user wants them to stay showing for review. An offset
|
|
96
|
+
chosen with the form `--lb-edit` points at a row is held, so the two ways of
|
|
97
|
+
matching a transaction behave differently.
|
|
98
|
+
- Paychecks. "Change from here…" is a form pointed with `--lb-edit`, so its
|
|
99
|
+
answer is held. The answer replaces the rest of the year, and the new
|
|
100
|
+
paychecks land after the last row of the series, out of date order. The
|
|
101
|
+
page carries a Re-sort button for this.
|
|
102
|
+
|
|
103
|
+
Neither table has edits in its rows. Every edit on both is made in a form
|
|
104
|
+
outside the table.
|
|
105
|
+
|
|
106
|
+
### Proposal
|
|
107
|
+
|
|
108
|
+
The element carrying `lb-query` declares each kind of placement, `auto` or
|
|
109
|
+
`manual`. Both default to `auto`. Spelling is open; for illustration:
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<lb-table lb-query="entries" lb-order="entries_order"
|
|
113
|
+
lb-filter="description, txn_date, is_unmatched"
|
|
114
|
+
lb-order-placement="manual" lb-filter-placement="manual">
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The rule about where a request was sent from is removed.
|
|
118
|
+
|
|
119
|
+
Each line of today's held behavior falls under one flag:
|
|
120
|
+
|
|
121
|
+
| The answer | `manual` | Flag |
|
|
122
|
+
| -------------------------------------- | ---------------------------------- | ------ |
|
|
123
|
+
| Changes a column the order reads | The row stays where it stands | order |
|
|
124
|
+
| Creates a row | The row goes last in its group | order |
|
|
125
|
+
| Changes the column its group breaks on | The row stays under its heading | order |
|
|
126
|
+
| Changes a row so the filter hides it | The row stays showing | filter |
|
|
127
|
+
| Drops a row | The row leaves, under either value | — |
|
|
128
|
+
|
|
129
|
+
Under `auto`, the rows are placed by the order and the filter on every
|
|
130
|
+
landing.
|
|
131
|
+
|
|
132
|
+
Every combination has a use:
|
|
133
|
+
|
|
134
|
+
| Order | Filter | Example |
|
|
135
|
+
| -------- | -------- | -------------------------------------------------------- |
|
|
136
|
+
| `auto` | `auto` | Paychecks: a regenerated schedule lands in date order |
|
|
137
|
+
| `manual` | `manual` | Matching: answered rows stay in place for review |
|
|
138
|
+
| `auto` | `manual` | Answered rows stay showing and move into the order |
|
|
139
|
+
| `manual` | `auto` | A to-do list: an edit does not move a row, done hides it |
|
|
140
|
+
|
|
141
|
+
A row left where the order or the filter would not leave it is stamped, as
|
|
142
|
+
`lb-row-unsorted` is today, and counted in `lb-query-unsorted-count`. The rows
|
|
143
|
+
are placed by both again when the page loads, when the user's order or filter
|
|
144
|
+
changes, and on `--lb-sort`.
|
|
145
|
+
|
|
146
|
+
### The command
|
|
147
|
+
|
|
148
|
+
`--lb-sort` today places the rows by both the order and the filter, so a row
|
|
149
|
+
kept despite the filter leaves on it. Under the flags it is renamed for what
|
|
150
|
+
it does, `--lb-place` or similar.
|
|
151
|
+
|
|
152
|
+
A side set to `auto` is in place after every landing, so one command does
|
|
153
|
+
what each list needs:
|
|
154
|
+
|
|
155
|
+
| Order | Filter | The command |
|
|
156
|
+
| -------- | -------- | ----------------- |
|
|
157
|
+
| `manual` | `auto` | Sorts |
|
|
158
|
+
| `auto` | `manual` | Filters |
|
|
159
|
+
| `manual` | `manual` | Sorts and filters |
|
|
160
|
+
| `auto` | `auto` | Changes nothing |
|
|
161
|
+
|
|
162
|
+
Separate `--lb-sort` and `--lb-filter` differ from it only when both sides are
|
|
163
|
+
`manual` and the user applies one without the other. No case for that is in
|
|
164
|
+
hand.
|
|
165
|
+
|
|
166
|
+
### Effect on ef
|
|
167
|
+
|
|
168
|
+
- Matching declares both `manual`. The rule's answer and the offset form
|
|
169
|
+
behave alike, wherever the form sits.
|
|
170
|
+
- Paychecks declares nothing. The Re-sort button and its comment are removed.
|
|
171
|
+
|
|
172
|
+
### Effect on other pages
|
|
173
|
+
|
|
174
|
+
A list that relies on being held today, such as an editable `lb-table` with a
|
|
175
|
+
ghost row, declares `manual` to keep its behavior. Under `auto`, a row edited
|
|
176
|
+
in place moves into the order, and a row entered in the ghost row is placed by
|
|
177
|
+
the order.
|
|
178
|
+
|
|
179
|
+
### Open
|
|
180
|
+
|
|
181
|
+
- The attribute names.
|
|
182
|
+
- One stamp for both kinds of out-of-place row, or one for each, so a page can
|
|
183
|
+
style a row out of order apart from a row kept despite the filter. The
|
|
184
|
+
commands follow the stamps. One stamp has one count, one button shown while
|
|
185
|
+
it is not 0, and one command. Two stamps let a page show Re-sort and
|
|
186
|
+
Re-filter apart, each with its own command, `--lb-sort` and `--lb-filter`,
|
|
187
|
+
beside the one for both. Every name carries the `--` prefix, or the
|
|
188
|
+
browser ignores it.
|
|
189
|
+
|
|
190
|
+
## 3. Child rows entered with their parent
|
|
191
|
+
|
|
192
|
+
Package: `@loadbare/app`.
|
|
193
|
+
|
|
194
|
+
### Today
|
|
195
|
+
|
|
196
|
+
A form gathers the live rows of a query nested in its own, and sends them in
|
|
197
|
+
`rows` beside its own `values`. The handler writes the parent and its child
|
|
198
|
+
rows together. A live row is one the nested query answered, so the child rows
|
|
199
|
+
exist before the form is sent: ef's paycheck form sends one amount per
|
|
200
|
+
deduction type, and the types come from the database.
|
|
201
|
+
|
|
202
|
+
A row not yet entered, carrying `lb-key-value=""`, arises only as a single
|
|
203
|
+
row: a `row` query answering with an empty key, or a form pointed by
|
|
204
|
+
`--lb-new`. A list holds no row not yet entered.
|
|
205
|
+
|
|
206
|
+
ptracking's flight page enters a flight, then its arrivals. The arrivals
|
|
207
|
+
section shows once the flight is on record, and each arrival is its own
|
|
208
|
+
`lb-row-insert` from the ghost row, keyed by the `flight_id` parm. The
|
|
209
|
+
arrivals handler refuses an insert with no flight: "Save the flight first."
|
|
210
|
+
Most flights have one arrival, and pattern work is one arrival with a
|
|
211
|
+
quantity, so the usual entry is two saves and a second form.
|
|
212
|
+
|
|
213
|
+
### Proposal
|
|
214
|
+
|
|
215
|
+
A list may hold rows not yet entered.
|
|
216
|
+
|
|
217
|
+
1. Inside a parent not yet entered, the list's Add puts a row not yet entered
|
|
218
|
+
into the list, and sends nothing.
|
|
219
|
+
2. The parent's form gathers those rows with its insert, each with no key,
|
|
220
|
+
under the nested query's name in `rows`.
|
|
221
|
+
3. The parent's handler inserts the parent and its child rows in one
|
|
222
|
+
transaction, and answers both. The rows not yet entered are replaced by
|
|
223
|
+
the rows the answer lands.
|
|
224
|
+
4. Once the parent is on record, the list's Add inserts as it does today.
|
|
225
|
+
|
|
226
|
+
A row not yet entered in a list follows the existing rules for one:
|
|
227
|
+
|
|
228
|
+
- Its controls carrying `lb-request="lb-row-update"` send nothing and hold
|
|
229
|
+
what the parent's submit gathers. Once the row is on record, they save as
|
|
230
|
+
they change.
|
|
231
|
+
- A delete from it sends nothing. The row is removed from the list.
|
|
232
|
+
- A refusal of the parent's insert leaves it in place, and a column's message
|
|
233
|
+
goes on its control, as for any control the request gathered.
|
|
234
|
+
|
|
235
|
+
### Effect on ptracking
|
|
236
|
+
|
|
237
|
+
- The arrivals list moves inside the flight's form, and loses
|
|
238
|
+
`lb-show="on_record"`.
|
|
239
|
+
- The flight's `rowInsert` accepts `rows.arrivals` and inserts both.
|
|
240
|
+
`detailCrud` writes the parent alone today.
|
|
241
|
+
- A flight with one arrival is one save. A flight with three approaches is
|
|
242
|
+
three rows not yet entered and one save.
|
|
243
|
+
|
|
244
|
+
### Open
|
|
245
|
+
|
|
246
|
+
- The command that adds a row not yet entered: the ghost row's insert,
|
|
247
|
+
changing meaning while the parent is not on record, or a command of its own.
|
|
248
|
+
- `lb-table` joins the ghost row's controls to a form of its own, outside the
|
|
249
|
+
table, with the `form` attribute. A ghost row inside a parent's form then
|
|
250
|
+
belongs to the ghost row's form, not the parent's.
|
|
251
|
+
- One level only, as for a form over a set of rows today.
|
package/docs/testing.md
CHANGED
|
@@ -274,7 +274,8 @@ What the hub is tested for here:
|
|
|
274
274
|
a pending element is ignored
|
|
275
275
|
- a round trip the server never answers is aborted at the ten-second
|
|
276
276
|
deadline, under mocked timers, and fails the way any round trip fails
|
|
277
|
-
- a successful insert gathered from a form resets the form
|
|
277
|
+
- a successful insert gathered from a form resets the form, unless the
|
|
278
|
+
answer landed the new row on it
|
|
278
279
|
- a path with no page reports, lands `lb-page-unknown`, and opens the
|
|
279
280
|
`lb-url-unknown` dialog; two pages for one stub report and take the first
|
|
280
281
|
- `lb-url` lands with the path, the page's `lb-page-title` or stub as
|
|
@@ -90,7 +90,7 @@ publication — that's the same class shape
|
|
|
90
90
|
[Committing a Control](./080-widget-requests.md) already wrote, packaged and
|
|
91
91
|
given an import specifier instead of living in an application's `src/`.
|
|
92
92
|
It doesn't cover `lb-table`'s footer destination or `lb-picker`'s
|
|
93
|
-
expansion parameters, which
|
|
93
|
+
expansion parameters, which each widget's own page covers; see
|
|
94
94
|
[The Basic Widget Library](../reference/widgets.md).
|
|
95
95
|
|
|
96
96
|
---
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadbare/app",
|
|
3
3
|
"description": "High performance web app framework for server-bound applications",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"./constants": "./dist/core/lb-constants.js",
|
|
23
23
|
"./types": "./dist/core/lb-types.js",
|
|
24
24
|
"./server": "./dist/server/lb-server.js",
|
|
25
|
-
"./express": "./dist/server/lb-express.js"
|
|
25
|
+
"./express": "./dist/server/lb-express.js",
|
|
26
|
+
"./build": "./dist/build/build.js",
|
|
27
|
+
"./dev": "./dist/dev/lb-dev.js"
|
|
26
28
|
},
|
|
27
29
|
"scripts": {
|
|
28
30
|
"prepublishOnly": "npm run typecheck && npm run test && npm run build",
|