@spaethtech/svelte-ui 0.7.1-dev.37.ab40d6b → 0.7.1-dev.38.b73de30
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/components/Query.svelte +32 -12
- package/docs/components.md +2 -1
- package/package.json +1 -1
|
@@ -268,22 +268,42 @@
|
|
|
268
268
|
<div>
|
|
269
269
|
<h4 class="mb-1 font-semibold">Dynamic dates</h4>
|
|
270
270
|
<p class="mb-1 text-xs [color:color-mix(in_srgb,var(--ui-color-text)_70%,transparent)]">
|
|
271
|
-
<code class="font-mono">now()</code> is the current time
|
|
272
|
-
<code class="font-mono">now()±<n><unit></code> — units
|
|
273
|
-
|
|
271
|
+
<code class="font-mono">now()</code> is the current time, resolved when the query runs. Add a
|
|
272
|
+
signed offset <code class="font-mono">now()±<n><unit></code> — units
|
|
273
|
+
<code>s</code> <code>m</code> <code>h</code> <code>d</code> <code>w</code>. Great with a date
|
|
274
|
+
column and <code>>=</code>/<code><</code> or a range.
|
|
274
275
|
</p>
|
|
276
|
+
<table class="w-full text-left">
|
|
277
|
+
<tbody
|
|
278
|
+
class="[&_td]:py-0.5 [&_td:first-child]:whitespace-nowrap [&_td:first-child]:pr-4 [&_td:first-child]:font-mono [&_td:last-child]:text-xs [&_td:last-child]:[color:color-mix(in_srgb,var(--ui-color-text)_65%,transparent)]"
|
|
279
|
+
>
|
|
280
|
+
<tr><td>$created >= now()-7d</td><td>in the last 7 days</td></tr>
|
|
281
|
+
<tr><td>$expires < now()</td><td>already expired</td></tr>
|
|
282
|
+
<tr><td>$due |= [now()..now()+30d]</td><td>due within 30 days</td></tr>
|
|
283
|
+
</tbody>
|
|
284
|
+
</table>
|
|
275
285
|
</div>
|
|
276
286
|
<div>
|
|
277
287
|
<h4 class="mb-1 font-semibold">Examples</h4>
|
|
278
|
-
<
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
<table class="w-full text-left">
|
|
289
|
+
<tbody
|
|
290
|
+
class="[&_td]:py-0.5 [&_td:first-child]:whitespace-nowrap [&_td:first-child]:pr-4 [&_td:first-child]:font-mono [&_td:last-child]:text-xs [&_td:last-child]:[color:color-mix(in_srgb,var(--ui-color-text)_65%,transparent)]"
|
|
291
|
+
>
|
|
292
|
+
<tr><td>$status == active</td><td>exact match</td></tr>
|
|
293
|
+
<tr><td>$name ^= Ada</td><td>starts with “Ada”</td></tr>
|
|
294
|
+
<tr><td>$email ~= @gmail.com</td><td>contains substring</td></tr>
|
|
295
|
+
<tr><td>$email ~= /@gmail\.com$/i</td><td>regex, case-insensitive</td></tr>
|
|
296
|
+
<tr><td>$age >= 30</td><td>numeric compare</td></tr>
|
|
297
|
+
<tr><td>$age |= [21..40)</td><td>range — 21 ≤ age < 40</td></tr>
|
|
298
|
+
<tr><td>$role |= [admin, ops]</td><td>any of a set</td></tr>
|
|
299
|
+
<tr><td>$tags &= [urgent, vip]</td><td>all of (multi-value column)</td></tr>
|
|
300
|
+
<tr><td>$created >= now()-7d</td><td>dynamic date (last 7 days)</td></tr>
|
|
301
|
+
<tr><td>$ip|inet >= 10.0.0.0|inet</td><td>typed IP compare</td></tr>
|
|
302
|
+
<tr><td>!($role == admin)</td><td>negate a group</td></tr>
|
|
303
|
+
<tr><td>$status == open && $priority >= 3</td><td>combine with && / ||</td></tr>
|
|
304
|
+
<tr><td>"lemon balm"</td><td>free-text search (no $)</td></tr>
|
|
305
|
+
</tbody>
|
|
306
|
+
</table>
|
|
287
307
|
</div>
|
|
288
308
|
<p class="text-xs [color:color-mix(in_srgb,var(--ui-color-text)_60%,transparent)]">
|
|
289
309
|
Tip: type <kbd class="rounded border px-1 {bc}">$</kbd> for columns; enum columns suggest
|
package/docs/components.md
CHANGED
|
@@ -232,7 +232,8 @@ Config-driven, responsive 12-column data table over a `DataGrid`.
|
|
|
232
232
|
### Query
|
|
233
233
|
|
|
234
234
|
Filter bar over a `DataSet` — monospace input with `$column` + enum-value autocomplete and a help
|
|
235
|
-
dialog.
|
|
235
|
+
dialog (operators, casts, dynamic `now()` dates, and a worked examples table). The DSL supports
|
|
236
|
+
`now()` / `now()±<n><unit>` dynamic dates — see the help dialog + the data spec.
|
|
236
237
|
|
|
237
238
|
- **Location**: `src/lib/components/Query.svelte`
|
|
238
239
|
- **Props**: `dataset` (`DataSet`), `placeholder`
|