@protobase/cli 0.24.0 → 0.24.1
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/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@hono/node-server": "^2.1.3",
|
|
37
37
|
"@hono/vite-dev-server": "^0.26.1",
|
|
38
|
-
"@protobase/layout": "0.24.
|
|
39
|
-
"@protobase/query": "0.24.
|
|
40
|
-
"@protobase/schema": "0.24.
|
|
41
|
-
"@protobase/server": "0.24.
|
|
42
|
-
"@protobase/ui": "0.24.
|
|
38
|
+
"@protobase/layout": "0.24.1",
|
|
39
|
+
"@protobase/query": "0.24.1",
|
|
40
|
+
"@protobase/schema": "0.24.1",
|
|
41
|
+
"@protobase/server": "0.24.1",
|
|
42
|
+
"@protobase/ui": "0.24.1",
|
|
43
43
|
"@react-email/render": "^2.1.0",
|
|
44
44
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
45
45
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -207,6 +207,7 @@ Nothing in a list moves by dragging unless its `.list(...)` says so with `drag`,
|
|
|
207
207
|
| --- | --- |
|
|
208
208
|
| `rank: true` | The records of a resource with a [`.position(...)`](#reordering-by-hand) and no `within`, at any time: the table's rows by their handles while the list shows every record in the position's order, ascending, without a filter or search, instead of after **Reorder**; and a [board's](#boards) cards to their place in a column. |
|
|
209
209
|
| `board: true` | A board's card to another column, which saves the record with that column's value. |
|
|
210
|
+
| `rule: 'name'` | Where the table's rows may land when re-ranked, by **Reorder** or `rank`: the drop rule of that name in the UI config's `dropRules`. See [Drop rules](#drop-rules). |
|
|
210
211
|
|
|
211
212
|
```ts
|
|
212
213
|
.list((r, d) => ({ columns: [r.title, r.status], sort: [[r.rank, 'asc']], displays: [d.board({ by: r.status })], drag: { rank: true, board: true } }))
|
|
@@ -216,6 +217,24 @@ A board may let cards move between columns without re-ranking (`board` alone), o
|
|
|
216
217
|
|
|
217
218
|
On a touch screen a card or a row's handle lifts only after a short hold, a quarter of a second, so a swipe across the board scrolls it instead of moving a card; a mouse or trackpad drags it straight away. Every saved drag says so in a toast with **Undo**, which puts back what it changed, the column and every position it renumbered, with the ETags the save gave the records, so a record changed again since is refused rather than overwritten. Only the latest drag can be undone: a new one replaces the toast.
|
|
218
219
|
|
|
220
|
+
#### Drop rules
|
|
221
|
+
|
|
222
|
+
Some orders must hold, such as a task never ranked above one it waits for. A drop rule, a function in `protobase.ui.tsx` under `dropRules`, gets the dropped record, the records in the order the drop would leave them and the record's place among them, 0 the first, as the API gives them, every field the user may read; it returns why the record may not be there, or nothing when it may:
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
export default defineUi({
|
|
226
|
+
dropRules: {
|
|
227
|
+
afterWhatItWaitsFor: ({ record, order, index }) => {
|
|
228
|
+
const waited = order.find((task) => task.id === record.waits_for_id)
|
|
229
|
+
if (!waited || order.indexOf(waited) < index) return undefined
|
|
230
|
+
return `${record.title} waits for ${waited.title}.`
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
})
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
The list names it with `drag: { rank: true, rule: 'afterWhatItWaitsFor' }`. A drop the rule refuses lands in the first place below that it allows, and a warning says where with the rule's reason; with no such place the row stays where it was, with the same warning. The rule only guides the drag: the server's access rules and `validate` still decide what is saved. A list naming a rule the UI config does not register says so in place of its rows.
|
|
237
|
+
|
|
219
238
|
## A filter the list opens with
|
|
220
239
|
|
|
221
240
|
```ts
|