@loadbare/app 0.24.0 → 0.25.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.
@@ -902,18 +902,66 @@ the master and its details together; see [crud](./page-files.md#crud). The
902
902
  server checks that `rows` holds string keys and string values by query, and
903
903
  ignores a request whose `rows` does not.
904
904
 
905
+ #### Rows not yet entered in a list
906
+
907
+ A detail the master does not have yet is entered with it. `--lb-new` aimed
908
+ at the nested list, rather than at a form, puts a row not yet entered into
909
+ it, and sends nothing:
910
+
911
+ ```html
912
+ <form lb-query="flight" lb-request="lb-row-insert">
913
+ <input lb-column="code" />
914
+ <ul id="arrivals" lb-query="arrivals">
915
+ <template>
916
+ <li>
917
+ <input lb-column="gate" />
918
+ <input lb-column="qty" value="1" />
919
+ <button type="button" lb-request="lb-row-delete">Remove</button>
920
+ </li>
921
+ </template>
922
+ </ul>
923
+ <button type="button" commandfor="arrivals" command="--lb-new">Add arrival</button>
924
+ <button type="submit">Save</button>
925
+ </form>
926
+ ```
927
+
928
+ - The row is a live row with the empty key, copied from the row template.
929
+ Its controls start at their HTML defaults, and its `lb-show` branches are
930
+ as for a row whose every column is null.
931
+ - It stands after every row of the list, in the order added, and is not
932
+ ordered, filtered or aggregated, since it holds no data. It counts in
933
+ `lb-query-row-count`.
934
+ - The form's submit carries it in `rows`, with `key: ""`, beside the rows on
935
+ record: an insert while the master is not on record, an update once it
936
+ is. The handler inserts each row with no key.
937
+ - Once the submit succeeds, the rows not yet entered leave, and the rows its
938
+ answer lands take their place. A refusal leaves them, with a column's
939
+ message on its control.
940
+ - A delete from one takes it out of the list and sends nothing, and an
941
+ update from one is not sent, as for any [row not yet
942
+ entered](#a-row-not-yet-entered).
943
+
944
+ The form needs a submit: a row not yet entered never sends on its own, so
945
+ one in a form that only saves control by control waits for nothing. The
946
+ list is a query nested directly in the form's own, as for any set of rows
947
+ the form gathers; the builder refuses `--lb-new` aimed at any other list.
948
+ Aimed at a `<form>`, `--lb-new` points the form, as below.
949
+
905
950
  A nested query answers once for the page, so its rows are the same wherever
906
951
  they show. The form enters a new master with its details, or edits the
907
952
  master the page shows, whose details the nested query reads from the same
908
953
  query parm. A form [pointed at a row](#editing-a-row-in-one-form) fills its
909
- own controls from that row; its nested rows stay the nested query's answer.
954
+ own controls from that row; its nested rows stay the nested query's answer,
955
+ so the pointed row's own details come as its columns.
910
956
 
911
957
  ### A row not yet entered
912
958
 
913
- A row whose key is empty is a new one, not yet entered. It arises two ways:
914
- a `row` query answers with an empty key, as one showing the master a query
915
- parm names does when the parm is empty, or New points a form (see
916
- [Editing a row in one form](#editing-a-row-in-one-form)). Either way the
959
+ A row whose key is empty is a new one, not yet entered. It arises three
960
+ ways: a `row` query answers with an empty key, as one showing the master a
961
+ query parm names does when the parm is empty; New points a form (see
962
+ [Editing a row in one form](#editing-a-row-in-one-form)); or New aimed at a
963
+ list adds one to it (see
964
+ [Rows not yet entered in a list](#rows-not-yet-entered-in-a-list)). Either way the
917
965
  element carries `lb-key-value=""`.
918
966
 
919
967
  | Request | From a row not yet entered |
@@ -999,7 +1047,7 @@ row. Buttons point it with HTML's `commandfor` and `command`:
999
1047
  | Command | On a button | The hub |
1000
1048
  |----------------|-------------------------------------|---------------------------------------------|
1001
1049
  | `--lb-edit` | In a live row of the form's query | Fills the form from that row, keyed by it |
1002
- | `--lb-new` | Anywhere | Starts the form empty, for an insert |
1050
+ | `--lb-new` | Anywhere | Starts the form empty, for an insert; aimed at a list, see [Rows not yet entered in a list](#rows-not-yet-entered-in-a-list) |
1003
1051
  | `--lb-release` | Anywhere | Lets the form go without saving |
1004
1052
 
1005
1053
  HTML requires a custom command to begin with `--`.
@@ -1032,6 +1080,13 @@ round trip, including columns no element in the table shows. The user
1032
1080
  edits a row they can see, so the row is on the page. A row that has to be
1033
1081
  fetched to be edited is another page, with that row as its master.
1034
1082
 
1083
+ A pointed form edits what the row it points at holds. Details the form
1084
+ shows for that row come as columns of the row, one per detail when the
1085
+ details are a fixed set, or from a master the page shows by a query parm,
1086
+ whose nested query reads the same parm. A query nested in a pointed form
1087
+ shows the page's answer, whichever row the form points at; see
1088
+ [A form over a set of rows](#a-form-over-a-set-of-rows).
1089
+
1035
1090
  Pointing a form first empties it: every column it names lands as null, and
1036
1091
  the form resets, so each control returns to its default. Edit then lands
1037
1092
  the row on the form, stamps the form with the row's key, so the form's
@@ -1369,6 +1424,9 @@ expansion, and refuses to build:
1369
1424
  template, or beside `lb-column` or `lb-request`
1370
1425
  - a `command` beginning `--lb-` that is not one of the four commands
1371
1426
  - one of the four commands with no `commandfor`
1427
+ - `--lb-new` aimed at an element the markup holds that is neither a
1428
+ `<form>` nor a list carrying `lb-query` nested directly in a form's own
1429
+ query
1372
1430
  - `lb-group` on anything but a `<template>`, or on one holding no
1373
1431
  `<template>` for its contents
1374
1432
  - an aggregate on a `<template>`, or any but `lb-count` naming no column
@@ -139,7 +139,7 @@ Loadbare/app owns every value of HTML's `command` attribute beginning with
139
139
  | Command | Defined in |
140
140
  | -------------- | ------------------------------------------------------------------------ |
141
141
  | `--lb-edit` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form) |
142
- | `--lb-new` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form) |
142
+ | `--lb-new` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form), [Rows not yet entered in a list](./data-binding.md#rows-not-yet-entered-in-a-list) |
143
143
  | `--lb-release` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form) |
144
144
  | `--lb-place` | [Placing by hand](./data-binding.md#placing-by-hand) |
145
145
 
@@ -273,8 +273,9 @@ reported and ignored. A declared request receives `keys` as it is.
273
273
  `rows` holds the rows of a query nested in the form the request came from,
274
274
  by query name, each with its `key` and the `values` of its own controls; see
275
275
  [A form over a set of rows](./data-binding.md#a-form-over-a-set-of-rows).
276
- The handler writes the master and its details together, deciding what each
277
- row's values mean, such as an empty amount being no row at all:
276
+ A row with `key: ""` is one not yet entered, added by `--lb-new`; insert
277
+ it. The handler writes the master and its details together, deciding what
278
+ each row's values mean, such as an empty amount being no row at all:
278
279
 
279
280
  ```ts
280
281
  rowInsert: {
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.24.0",
4
+ "version": "0.25.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -189,7 +189,14 @@ every outer row; use it for a picker, never for per-row detail. Inside a
189
189
  form, the live rows of a query nested in the form's own are gathered as
190
190
  `rows: { <query>: [{ key, values }] }` beside `values`, so a master and a
191
191
  subtable of its details (one input per type, say) are entered in one
192
- submit, and the master's handler writes both. A new outer
192
+ submit, and the master's handler writes both. A detail not yet entered
193
+ is added by a button with `commandfor` naming the nested list and
194
+ `command="--lb-new"`: it adds a row with the empty key and sends nothing,
195
+ the form's submit carries it as `{ key: "", values }`, the handler inserts
196
+ each row with no key, and it leaves when the submit succeeds. So a master
197
+ and its details are one save, before or after the master is on record; never
198
+ gate the details behind `lb-show` on the master being saved. The form needs
199
+ a submit. A new outer
193
200
  row is filled from the nested query's last answer, whatever order they land
194
201
  in.
195
202
 
@@ -296,7 +303,11 @@ not a form.) The form's `lb-key-value` is the row's key, empty
296
303
  for a new row, absent when not in use, and a stylesheet shows Save or Save
297
304
  new by it. A successful request from the form, or its dialog closing, lets
298
305
  it go. Which row is being edited is never a query parm. A row that must be
299
- fetched to be edited is another page, with that row as its master.
306
+ fetched to be edited is another page, with that row as its master. A
307
+ pointed form edits only what its row holds: a query nested in it shows the
308
+ page's answer, not the pointed row's details, so give the row a column per
309
+ detail when the details are a fixed set, or make the row the page's master
310
+ by a parm.
300
311
 
301
312
  **Three requests are Loadbare's.** `lb-row-insert` needs `query` and
302
313
  `values`, `lb-row-update` needs `query`, `key` and `values`, and
@@ -309,7 +320,8 @@ request the page does not declare. One that arrives anyway, from a script,
309
320
  is warned about on the server console and answered with nothing.
310
321
 
311
322
  **An empty key is a row not yet entered.** A `row` query answering with an
312
- empty key, or a form `--lb-new` pointed, carries `lb-key-value=""`. The hub
323
+ empty key, a form `--lb-new` pointed, or a row `--lb-new` added to a list,
324
+ carries `lb-key-value=""`. The hub
313
325
  sends inserts and declared requests from it with no `key`, and sends no
314
326
  update or delete at all, silently. So a control with
315
327
  `lb-request="lb-row-update"` saves on a row on record and only holds its
@@ -902,18 +902,66 @@ the master and its details together; see [crud](./page-files.md#crud). The
902
902
  server checks that `rows` holds string keys and string values by query, and
903
903
  ignores a request whose `rows` does not.
904
904
 
905
+ #### Rows not yet entered in a list
906
+
907
+ A detail the master does not have yet is entered with it. `--lb-new` aimed
908
+ at the nested list, rather than at a form, puts a row not yet entered into
909
+ it, and sends nothing:
910
+
911
+ ```html
912
+ <form lb-query="flight" lb-request="lb-row-insert">
913
+ <input lb-column="code" />
914
+ <ul id="arrivals" lb-query="arrivals">
915
+ <template>
916
+ <li>
917
+ <input lb-column="gate" />
918
+ <input lb-column="qty" value="1" />
919
+ <button type="button" lb-request="lb-row-delete">Remove</button>
920
+ </li>
921
+ </template>
922
+ </ul>
923
+ <button type="button" commandfor="arrivals" command="--lb-new">Add arrival</button>
924
+ <button type="submit">Save</button>
925
+ </form>
926
+ ```
927
+
928
+ - The row is a live row with the empty key, copied from the row template.
929
+ Its controls start at their HTML defaults, and its `lb-show` branches are
930
+ as for a row whose every column is null.
931
+ - It stands after every row of the list, in the order added, and is not
932
+ ordered, filtered or aggregated, since it holds no data. It counts in
933
+ `lb-query-row-count`.
934
+ - The form's submit carries it in `rows`, with `key: ""`, beside the rows on
935
+ record: an insert while the master is not on record, an update once it
936
+ is. The handler inserts each row with no key.
937
+ - Once the submit succeeds, the rows not yet entered leave, and the rows its
938
+ answer lands take their place. A refusal leaves them, with a column's
939
+ message on its control.
940
+ - A delete from one takes it out of the list and sends nothing, and an
941
+ update from one is not sent, as for any [row not yet
942
+ entered](#a-row-not-yet-entered).
943
+
944
+ The form needs a submit: a row not yet entered never sends on its own, so
945
+ one in a form that only saves control by control waits for nothing. The
946
+ list is a query nested directly in the form's own, as for any set of rows
947
+ the form gathers; the builder refuses `--lb-new` aimed at any other list.
948
+ Aimed at a `<form>`, `--lb-new` points the form, as below.
949
+
905
950
  A nested query answers once for the page, so its rows are the same wherever
906
951
  they show. The form enters a new master with its details, or edits the
907
952
  master the page shows, whose details the nested query reads from the same
908
953
  query parm. A form [pointed at a row](#editing-a-row-in-one-form) fills its
909
- own controls from that row; its nested rows stay the nested query's answer.
954
+ own controls from that row; its nested rows stay the nested query's answer,
955
+ so the pointed row's own details come as its columns.
910
956
 
911
957
  ### A row not yet entered
912
958
 
913
- A row whose key is empty is a new one, not yet entered. It arises two ways:
914
- a `row` query answers with an empty key, as one showing the master a query
915
- parm names does when the parm is empty, or New points a form (see
916
- [Editing a row in one form](#editing-a-row-in-one-form)). Either way the
959
+ A row whose key is empty is a new one, not yet entered. It arises three
960
+ ways: a `row` query answers with an empty key, as one showing the master a
961
+ query parm names does when the parm is empty; New points a form (see
962
+ [Editing a row in one form](#editing-a-row-in-one-form)); or New aimed at a
963
+ list adds one to it (see
964
+ [Rows not yet entered in a list](#rows-not-yet-entered-in-a-list)). Either way the
917
965
  element carries `lb-key-value=""`.
918
966
 
919
967
  | Request | From a row not yet entered |
@@ -999,7 +1047,7 @@ row. Buttons point it with HTML's `commandfor` and `command`:
999
1047
  | Command | On a button | The hub |
1000
1048
  |----------------|-------------------------------------|---------------------------------------------|
1001
1049
  | `--lb-edit` | In a live row of the form's query | Fills the form from that row, keyed by it |
1002
- | `--lb-new` | Anywhere | Starts the form empty, for an insert |
1050
+ | `--lb-new` | Anywhere | Starts the form empty, for an insert; aimed at a list, see [Rows not yet entered in a list](#rows-not-yet-entered-in-a-list) |
1003
1051
  | `--lb-release` | Anywhere | Lets the form go without saving |
1004
1052
 
1005
1053
  HTML requires a custom command to begin with `--`.
@@ -1032,6 +1080,13 @@ round trip, including columns no element in the table shows. The user
1032
1080
  edits a row they can see, so the row is on the page. A row that has to be
1033
1081
  fetched to be edited is another page, with that row as its master.
1034
1082
 
1083
+ A pointed form edits what the row it points at holds. Details the form
1084
+ shows for that row come as columns of the row, one per detail when the
1085
+ details are a fixed set, or from a master the page shows by a query parm,
1086
+ whose nested query reads the same parm. A query nested in a pointed form
1087
+ shows the page's answer, whichever row the form points at; see
1088
+ [A form over a set of rows](#a-form-over-a-set-of-rows).
1089
+
1035
1090
  Pointing a form first empties it: every column it names lands as null, and
1036
1091
  the form resets, so each control returns to its default. Edit then lands
1037
1092
  the row on the form, stamps the form with the row's key, so the form's
@@ -1369,6 +1424,9 @@ expansion, and refuses to build:
1369
1424
  template, or beside `lb-column` or `lb-request`
1370
1425
  - a `command` beginning `--lb-` that is not one of the four commands
1371
1426
  - one of the four commands with no `commandfor`
1427
+ - `--lb-new` aimed at an element the markup holds that is neither a
1428
+ `<form>` nor a list carrying `lb-query` nested directly in a form's own
1429
+ query
1372
1430
  - `lb-group` on anything but a `<template>`, or on one holding no
1373
1431
  `<template>` for its contents
1374
1432
  - an aggregate on a `<template>`, or any but `lb-count` naming no column
@@ -139,7 +139,7 @@ Loadbare/app owns every value of HTML's `command` attribute beginning with
139
139
  | Command | Defined in |
140
140
  | -------------- | ------------------------------------------------------------------------ |
141
141
  | `--lb-edit` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form) |
142
- | `--lb-new` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form) |
142
+ | `--lb-new` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form), [Rows not yet entered in a list](./data-binding.md#rows-not-yet-entered-in-a-list) |
143
143
  | `--lb-release` | [Editing a row in one form](./data-binding.md#editing-a-row-in-one-form) |
144
144
  | `--lb-place` | [Placing by hand](./data-binding.md#placing-by-hand) |
145
145
 
@@ -273,8 +273,9 @@ reported and ignored. A declared request receives `keys` as it is.
273
273
  `rows` holds the rows of a query nested in the form the request came from,
274
274
  by query name, each with its `key` and the `values` of its own controls; see
275
275
  [A form over a set of rows](./data-binding.md#a-form-over-a-set-of-rows).
276
- The handler writes the master and its details together, deciding what each
277
- row's values mean, such as an empty amount being no row at all:
276
+ A row with `key: ""` is one not yet entered, added by `--lb-new`; insert
277
+ it. The handler writes the master and its details together, deciding what
278
+ each row's values mean, such as an empty amount being no row at all:
278
279
 
279
280
  ```ts
280
281
  rowInsert: {
@@ -1,251 +0,0 @@
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.