@nongt/visql 0.5.0 → 0.6.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/README.md CHANGED
@@ -138,6 +138,20 @@ column as a date or time anyway and give its `format`, such as
138
138
  `format: 'YYYYMMDD'`. Users still get a date picker, and the SQL compares in
139
139
  your format when you pass the schema to the SQL functions.
140
140
 
141
+ Key columns are usually there only so tables can be joined. Mark one
142
+ `joinOnly: true` and the editor still uses it to join tables, but leaves it
143
+ out of every column picker, so nobody ends up grouping by an employee key or
144
+ filtering on a surrogate id:
145
+
146
+ ```ts
147
+ { name: 'employee_key', label: 'Employee key', type: 'integer', joinOnly: true }
148
+ ```
149
+
150
+ A sub query can still select a key and group by it, so it can be joined
151
+ back by that key, and outside the sub query that column is join-only too.
152
+ `validateQuery` reports a key used anywhere else as `joinOnlyColumn`, an
153
+ error, so your server refuses what the editor wouldn't offer.
154
+
141
155
  Relations also tell the editor which side of a join has many rows. Joining
142
156
  `orders` to `order_items` repeats each order once per item, so a SUM of the
143
157
  order totals comes out too high without any error. The editor warns about
@@ -302,7 +316,9 @@ Pass objects and functions as stable values (module constants, `useMemo`,
302
316
 
303
317
  ### Running the query
304
318
 
305
- With `onRun`, the editor gets a Run button (and Ctrl/⌘+Enter). It never
319
+ With `onRun`, the editor gets a Run button (and Ctrl/⌘+Enter while you're
320
+ working in the editor; in your page's other inputs the keys stay theirs, as
321
+ Ctrl/⌘+Z for undo does). It never
306
322
  talks to a database itself. Your `onRun` sends the query to your backend
307
323
  and returns the rows, and the editor shows them under the canvas.
308
324
 
@@ -356,7 +372,8 @@ const messages = { addCondition: 'เพิ่มเงื่อนไข', sect
356
372
  <QueryBuilder messages={messages} fontFamily="Kanit, sans-serif" … />
357
373
  ```
358
374
 
359
- Colors are CSS variables on `.qb-root`, or the `theme` prop:
375
+ Colors are CSS variables on `.qb-root`, or the `theme` prop. The canvas's
376
+ own parts (zoom buttons, edges, handles) follow them too:
360
377
 
361
378
  ```css
362
379
  .qb-root { --qb-accent: #e91e63; --qb-canvas-bg: #fafafa; }