@molecule/app-query-angular 1.2.0 → 1.3.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 +39 -15
- package/dist/index.d.ts +21 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/dist/query-content.component.d.ts +3 -1
- package/dist/query-content.component.d.ts.map +1 -1
- package/dist/query-content.component.js +6 -2
- package/dist/query-content.component.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-16T21:21:08.774Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-query-angular
|
|
@@ -44,8 +44,8 @@ with a new options object.
|
|
|
44
44
|
|
|
45
45
|
```typescript
|
|
46
46
|
import { Component, OnChanges, computed, input } from '@angular/core'
|
|
47
|
+
import { useTranslation } from '@molecule/app-angular'
|
|
47
48
|
import { getClient, isHttpError } from '@molecule/app-http'
|
|
48
|
-
import { t } from '@molecule/app-i18n'
|
|
49
49
|
import { intentPrefetchProps, useQuery } from '@molecule/app-query-angular'
|
|
50
50
|
|
|
51
51
|
interface PackageDocument {
|
|
@@ -115,8 +115,8 @@ export class PackageLink implements OnChanges {
|
|
|
115
115
|
`,
|
|
116
116
|
})
|
|
117
117
|
export class PackagePage {
|
|
118
|
-
//
|
|
119
|
-
protected readonly t = t
|
|
118
|
+
// The binding's t re-runs the template on a locale switch.
|
|
119
|
+
protected readonly t = useTranslation().t
|
|
120
120
|
readonly name = input('')
|
|
121
121
|
|
|
122
122
|
readonly query = useQuery<PackageDocument | null>(
|
|
@@ -141,8 +141,8 @@ restoring a session never swaps a key that already rendered rows.
|
|
|
141
141
|
|
|
142
142
|
```typescript
|
|
143
143
|
import { Component, computed, input } from '@angular/core'
|
|
144
|
+
import { useTranslation } from '@molecule/app-angular'
|
|
144
145
|
import { getClient, unwrapList } from '@molecule/app-http'
|
|
145
|
-
import { t } from '@molecule/app-i18n'
|
|
146
146
|
import { useQuery } from '@molecule/app-query-angular'
|
|
147
147
|
|
|
148
148
|
interface Invoice {
|
|
@@ -175,8 +175,8 @@ interface Invoice {
|
|
|
175
175
|
`,
|
|
176
176
|
})
|
|
177
177
|
export class InvoiceList {
|
|
178
|
-
//
|
|
179
|
-
protected readonly t = t
|
|
178
|
+
// The binding's t re-runs the template on a locale switch.
|
|
179
|
+
protected readonly t = useTranslation().t
|
|
180
180
|
// The viewer whose invoices these are (also in the key).
|
|
181
181
|
readonly viewer = input('anonymous')
|
|
182
182
|
// The page to show.
|
|
@@ -208,8 +208,8 @@ explicit `fetch()` retries into the mounted page.
|
|
|
208
208
|
|
|
209
209
|
```typescript
|
|
210
210
|
import { Component, input } from '@angular/core'
|
|
211
|
+
import { useTranslation } from '@molecule/app-angular'
|
|
211
212
|
import { getClient } from '@molecule/app-http'
|
|
212
|
-
import { t } from '@molecule/app-i18n'
|
|
213
213
|
import { getQueryClient } from '@molecule/app-query'
|
|
214
214
|
|
|
215
215
|
// The key names what the document actually depends on — here the signed-in
|
|
@@ -243,8 +243,8 @@ async function setFollowing(principal: string, authorId: string, follow: boolean
|
|
|
243
243
|
host: { type: 'button', '(click)': 'retry()' },
|
|
244
244
|
})
|
|
245
245
|
export class FeedRetry {
|
|
246
|
-
//
|
|
247
|
-
protected readonly t = t
|
|
246
|
+
// The binding's t re-runs the template on a locale switch.
|
|
247
|
+
protected readonly t = useTranslation().t
|
|
248
248
|
readonly principal = input.required<string>()
|
|
249
249
|
|
|
250
250
|
retry(): void {
|
|
@@ -270,8 +270,8 @@ the saved record and is the `commit` of `OptimisticToggleButton` (from
|
|
|
270
270
|
|
|
271
271
|
```typescript
|
|
272
272
|
import { Component, computed, input } from '@angular/core'
|
|
273
|
+
import { useTranslation } from '@molecule/app-angular'
|
|
273
274
|
import { getClient, unwrapList, unwrapSingle } from '@molecule/app-http'
|
|
274
|
-
import { t } from '@molecule/app-i18n'
|
|
275
275
|
import { OptimisticToggleButton } from '@molecule/app-ui-angular'
|
|
276
276
|
import { createQueryResource, QueryContent, useQuery } from '@molecule/app-query-angular'
|
|
277
277
|
|
|
@@ -309,7 +309,8 @@ export const invoices = createQueryResource<Invoice>({
|
|
|
309
309
|
export class InvoiceFlagControl {
|
|
310
310
|
readonly invoice = input.required<Invoice>()
|
|
311
311
|
readonly viewer = input.required<string>()
|
|
312
|
-
|
|
312
|
+
// The binding's t re-runs the template on a locale switch.
|
|
313
|
+
protected readonly t = useTranslation().t
|
|
313
314
|
|
|
314
315
|
readonly save = async (flagged: boolean): Promise<boolean> =>
|
|
315
316
|
(await invoices.toggle(this.viewer(), this.invoice().id, 'flag', flagged)).flagged
|
|
@@ -350,8 +351,8 @@ export class InvoiceFlagControl {
|
|
|
350
351
|
imports: [QueryContent, InvoiceFlagControl],
|
|
351
352
|
})
|
|
352
353
|
export class InvoicePage {
|
|
353
|
-
//
|
|
354
|
-
protected readonly t = t
|
|
354
|
+
// The binding's t re-runs the template on a locale switch.
|
|
355
|
+
protected readonly t = useTranslation().t
|
|
355
356
|
readonly id = input('')
|
|
356
357
|
readonly viewer = input('')
|
|
357
358
|
|
|
@@ -482,6 +483,8 @@ interface QueryResource<T, Create = Partial<T>, Update = Partial<T>> {
|
|
|
482
483
|
/**
|
|
483
484
|
* `useQuery` options for the collection. `viewer` is who the answer is for (the signed-in id,
|
|
484
485
|
* or `'anonymous'`); a page or filter change keeps the rows on screen until the next answer.
|
|
486
|
+
* One record per URL identity, retaining the first occurrence. Equal values without an
|
|
487
|
+
* addressable id remain separate. Writes already refresh the collection.
|
|
485
488
|
*/
|
|
486
489
|
list(viewer: string, params?: Record<string, unknown>): QueryOptions<T[]>
|
|
487
490
|
/**
|
|
@@ -620,6 +623,16 @@ A loaded document owns its controls; absent documents expose only status content
|
|
|
620
623
|
|
|
621
624
|
```typescript
|
|
622
625
|
interface QueryContentProps<T> {
|
|
626
|
+
/**
|
|
627
|
+
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
628
|
+
* loaded document (an array or an application-owned envelope); render selects the
|
|
629
|
+
* current view's message and recovery action. Omit it to keep empty arrays as data.
|
|
630
|
+
*/
|
|
631
|
+
empty?: {
|
|
632
|
+
when: (data: NonNullable<T>) => boolean
|
|
633
|
+
render: NonNullable<QueryContentProps<T>['children']>
|
|
634
|
+
}
|
|
635
|
+
|
|
623
636
|
/** State from useQuery, or any compatible query observer. */
|
|
624
637
|
query: Pick<QueryState<T>, 'data' | 'status' | 'error'>
|
|
625
638
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
@@ -689,7 +702,7 @@ error value (`let-error`), and `pending`/`missing` render without a context.
|
|
|
689
702
|
selector: 'mol-query-content',
|
|
690
703
|
standalone: true,
|
|
691
704
|
template: '<ng-container #outlet></ng-container>',
|
|
692
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error'],
|
|
705
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
693
706
|
host: {
|
|
694
707
|
'data-parity-unwrap': '',
|
|
695
708
|
style: 'display: contents',
|
|
@@ -704,6 +717,8 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
704
717
|
pending: TemplateRef<unknown> | null = null
|
|
705
718
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
706
719
|
missing: TemplateRef<unknown> | null = null
|
|
720
|
+
/** One empty collection template, exclusive with the loaded children. */
|
|
721
|
+
empty: QueryContentProps<T>['empty'] = undefined
|
|
707
722
|
/** A failed initial read. Cached data stays visible if its refresh fails. */
|
|
708
723
|
error: TemplateRef<QueryContentErrorContext> | null = null
|
|
709
724
|
|
|
@@ -756,6 +771,8 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
756
771
|
: { template: this.pending ?? null, context: {} }
|
|
757
772
|
}
|
|
758
773
|
if (query.data === null) return { template: this.missing ?? null, context: {} }
|
|
774
|
+
if (this.empty?.when(query.data))
|
|
775
|
+
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } }
|
|
759
776
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } }
|
|
760
777
|
}
|
|
761
778
|
|
|
@@ -1054,3 +1071,10 @@ read the record, not "Loading…".
|
|
|
1054
1071
|
Keep every resource identity in the query key. A boundary cannot correct a query that supplies
|
|
1055
1072
|
another record's cached data. For a list, map real rows inside the children template; never
|
|
1056
1073
|
style a status placeholder as a row.
|
|
1074
|
+
|
|
1075
|
+
For a collection, `QueryContent` also accepts one `empty` branch:
|
|
1076
|
+
`{ when: page => page.rows.length === 0, render: page => selectedEmptyState }`.
|
|
1077
|
+
It is exclusive with loaded children, so a selected view chooses its message and
|
|
1078
|
+
recovery action once rather than rendering a general empty message beside it.
|
|
1079
|
+
`when` receives a loaded document; empty arrays remain data when this prop is omitted.
|
|
1080
|
+
The render value uses this framework's existing children function, snippet or template.
|
package/dist/index.d.ts
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* @example
|
|
31
31
|
* ```typescript
|
|
32
32
|
* import { Component, OnChanges, computed, input } from '@angular/core'
|
|
33
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
33
34
|
* import { getClient, isHttpError } from '@molecule/app-http'
|
|
34
|
-
* import { t } from '@molecule/app-i18n'
|
|
35
35
|
* import { intentPrefetchProps, useQuery } from '@molecule/app-query-angular'
|
|
36
36
|
*
|
|
37
37
|
* interface PackageDocument {
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
* `,
|
|
97
97
|
* })
|
|
98
98
|
* export class PackagePage {
|
|
99
|
-
* //
|
|
100
|
-
* protected readonly t = t
|
|
99
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
100
|
+
* protected readonly t = useTranslation().t
|
|
101
101
|
* readonly name = input('')
|
|
102
102
|
*
|
|
103
103
|
* readonly query = useQuery<PackageDocument | null>(
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
*
|
|
124
124
|
* ```typescript
|
|
125
125
|
* import { Component, computed, input } from '@angular/core'
|
|
126
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
126
127
|
* import { getClient, unwrapList } from '@molecule/app-http'
|
|
127
|
-
* import { t } from '@molecule/app-i18n'
|
|
128
128
|
* import { useQuery } from '@molecule/app-query-angular'
|
|
129
129
|
*
|
|
130
130
|
* interface Invoice {
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
* `,
|
|
154
154
|
* })
|
|
155
155
|
* export class InvoiceList {
|
|
156
|
-
* //
|
|
157
|
-
* protected readonly t = t
|
|
156
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
157
|
+
* protected readonly t = useTranslation().t
|
|
158
158
|
* // The viewer whose invoices these are (also in the key).
|
|
159
159
|
* readonly viewer = input('anonymous')
|
|
160
160
|
* // The page to show.
|
|
@@ -187,8 +187,8 @@
|
|
|
187
187
|
*
|
|
188
188
|
* ```typescript
|
|
189
189
|
* import { Component, input } from '@angular/core'
|
|
190
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
190
191
|
* import { getClient } from '@molecule/app-http'
|
|
191
|
-
* import { t } from '@molecule/app-i18n'
|
|
192
192
|
* import { getQueryClient } from '@molecule/app-query'
|
|
193
193
|
*
|
|
194
194
|
* // The key names what the document actually depends on — here the signed-in
|
|
@@ -222,8 +222,8 @@
|
|
|
222
222
|
* host: { type: 'button', '(click)': 'retry()' },
|
|
223
223
|
* })
|
|
224
224
|
* export class FeedRetry {
|
|
225
|
-
* //
|
|
226
|
-
* protected readonly t = t
|
|
225
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
226
|
+
* protected readonly t = useTranslation().t
|
|
227
227
|
* readonly principal = input.required<string>()
|
|
228
228
|
*
|
|
229
229
|
* retry(): void {
|
|
@@ -250,8 +250,8 @@
|
|
|
250
250
|
*
|
|
251
251
|
* ```typescript
|
|
252
252
|
* import { Component, computed, input } from '@angular/core'
|
|
253
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
253
254
|
* import { getClient, unwrapList, unwrapSingle } from '@molecule/app-http'
|
|
254
|
-
* import { t } from '@molecule/app-i18n'
|
|
255
255
|
* import { OptimisticToggleButton } from '@molecule/app-ui-angular'
|
|
256
256
|
* import { createQueryResource, QueryContent, useQuery } from '@molecule/app-query-angular'
|
|
257
257
|
*
|
|
@@ -287,7 +287,8 @@
|
|
|
287
287
|
* export class InvoiceFlagControl {
|
|
288
288
|
* readonly invoice = input.required<Invoice>()
|
|
289
289
|
* readonly viewer = input.required<string>()
|
|
290
|
-
*
|
|
290
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
291
|
+
* protected readonly t = useTranslation().t
|
|
291
292
|
*
|
|
292
293
|
* readonly save = async (flagged: boolean): Promise<boolean> =>
|
|
293
294
|
* (await invoices.toggle(this.viewer(), this.invoice().id, 'flag', flagged)).flagged
|
|
@@ -324,8 +325,8 @@
|
|
|
324
325
|
* imports: [QueryContent, InvoiceFlagControl],
|
|
325
326
|
* })
|
|
326
327
|
* export class InvoicePage {
|
|
327
|
-
* //
|
|
328
|
-
* protected readonly t = t
|
|
328
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
329
|
+
* protected readonly t = useTranslation().t
|
|
329
330
|
* readonly id = input('')
|
|
330
331
|
* readonly viewer = input('')
|
|
331
332
|
*
|
|
@@ -454,6 +455,13 @@
|
|
|
454
455
|
* another record's cached data. For a list, map real rows inside the children template; never
|
|
455
456
|
* style a status placeholder as a row.
|
|
456
457
|
*
|
|
458
|
+
* For a collection, `QueryContent` also accepts one `empty` branch:
|
|
459
|
+
* `{ when: page => page.rows.length === 0, render: page => selectedEmptyState }`.
|
|
460
|
+
* It is exclusive with loaded children, so a selected view chooses its message and
|
|
461
|
+
* recovery action once rather than rendering a general empty message beside it.
|
|
462
|
+
* `when` receives a loaded document; empty arrays remain data when this prop is omitted.
|
|
463
|
+
* The render value uses this framework's existing children function, snippet or template.
|
|
464
|
+
*
|
|
457
465
|
* @module
|
|
458
466
|
*/
|
|
459
467
|
export * from './list-query.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAidG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* @example
|
|
31
31
|
* ```typescript
|
|
32
32
|
* import { Component, OnChanges, computed, input } from '@angular/core'
|
|
33
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
33
34
|
* import { getClient, isHttpError } from '@molecule/app-http'
|
|
34
|
-
* import { t } from '@molecule/app-i18n'
|
|
35
35
|
* import { intentPrefetchProps, useQuery } from '@molecule/app-query-angular'
|
|
36
36
|
*
|
|
37
37
|
* interface PackageDocument {
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
* `,
|
|
97
97
|
* })
|
|
98
98
|
* export class PackagePage {
|
|
99
|
-
* //
|
|
100
|
-
* protected readonly t = t
|
|
99
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
100
|
+
* protected readonly t = useTranslation().t
|
|
101
101
|
* readonly name = input('')
|
|
102
102
|
*
|
|
103
103
|
* readonly query = useQuery<PackageDocument | null>(
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
*
|
|
124
124
|
* ```typescript
|
|
125
125
|
* import { Component, computed, input } from '@angular/core'
|
|
126
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
126
127
|
* import { getClient, unwrapList } from '@molecule/app-http'
|
|
127
|
-
* import { t } from '@molecule/app-i18n'
|
|
128
128
|
* import { useQuery } from '@molecule/app-query-angular'
|
|
129
129
|
*
|
|
130
130
|
* interface Invoice {
|
|
@@ -153,8 +153,8 @@
|
|
|
153
153
|
* `,
|
|
154
154
|
* })
|
|
155
155
|
* export class InvoiceList {
|
|
156
|
-
* //
|
|
157
|
-
* protected readonly t = t
|
|
156
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
157
|
+
* protected readonly t = useTranslation().t
|
|
158
158
|
* // The viewer whose invoices these are (also in the key).
|
|
159
159
|
* readonly viewer = input('anonymous')
|
|
160
160
|
* // The page to show.
|
|
@@ -187,8 +187,8 @@
|
|
|
187
187
|
*
|
|
188
188
|
* ```typescript
|
|
189
189
|
* import { Component, input } from '@angular/core'
|
|
190
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
190
191
|
* import { getClient } from '@molecule/app-http'
|
|
191
|
-
* import { t } from '@molecule/app-i18n'
|
|
192
192
|
* import { getQueryClient } from '@molecule/app-query'
|
|
193
193
|
*
|
|
194
194
|
* // The key names what the document actually depends on — here the signed-in
|
|
@@ -222,8 +222,8 @@
|
|
|
222
222
|
* host: { type: 'button', '(click)': 'retry()' },
|
|
223
223
|
* })
|
|
224
224
|
* export class FeedRetry {
|
|
225
|
-
* //
|
|
226
|
-
* protected readonly t = t
|
|
225
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
226
|
+
* protected readonly t = useTranslation().t
|
|
227
227
|
* readonly principal = input.required<string>()
|
|
228
228
|
*
|
|
229
229
|
* retry(): void {
|
|
@@ -250,8 +250,8 @@
|
|
|
250
250
|
*
|
|
251
251
|
* ```typescript
|
|
252
252
|
* import { Component, computed, input } from '@angular/core'
|
|
253
|
+
* import { useTranslation } from '@molecule/app-angular'
|
|
253
254
|
* import { getClient, unwrapList, unwrapSingle } from '@molecule/app-http'
|
|
254
|
-
* import { t } from '@molecule/app-i18n'
|
|
255
255
|
* import { OptimisticToggleButton } from '@molecule/app-ui-angular'
|
|
256
256
|
* import { createQueryResource, QueryContent, useQuery } from '@molecule/app-query-angular'
|
|
257
257
|
*
|
|
@@ -287,7 +287,8 @@
|
|
|
287
287
|
* export class InvoiceFlagControl {
|
|
288
288
|
* readonly invoice = input.required<Invoice>()
|
|
289
289
|
* readonly viewer = input.required<string>()
|
|
290
|
-
*
|
|
290
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
291
|
+
* protected readonly t = useTranslation().t
|
|
291
292
|
*
|
|
292
293
|
* readonly save = async (flagged: boolean): Promise<boolean> =>
|
|
293
294
|
* (await invoices.toggle(this.viewer(), this.invoice().id, 'flag', flagged)).flagged
|
|
@@ -324,8 +325,8 @@
|
|
|
324
325
|
* imports: [QueryContent, InvoiceFlagControl],
|
|
325
326
|
* })
|
|
326
327
|
* export class InvoicePage {
|
|
327
|
-
* //
|
|
328
|
-
* protected readonly t = t
|
|
328
|
+
* // The binding's t re-runs the template on a locale switch.
|
|
329
|
+
* protected readonly t = useTranslation().t
|
|
329
330
|
* readonly id = input('')
|
|
330
331
|
* readonly viewer = input('')
|
|
331
332
|
*
|
|
@@ -454,6 +455,13 @@
|
|
|
454
455
|
* another record's cached data. For a list, map real rows inside the children template; never
|
|
455
456
|
* style a status placeholder as a row.
|
|
456
457
|
*
|
|
458
|
+
* For a collection, `QueryContent` also accepts one `empty` branch:
|
|
459
|
+
* `{ when: page => page.rows.length === 0, render: page => selectedEmptyState }`.
|
|
460
|
+
* It is exclusive with loaded children, so a selected view chooses its message and
|
|
461
|
+
* recovery action once rather than rendering a general empty message beside it.
|
|
462
|
+
* `when` receives a loaded document; empty arrays remain data when this prop is omitted.
|
|
463
|
+
* The render value uses this framework's existing children function, snippet or template.
|
|
464
|
+
*
|
|
457
465
|
* @module
|
|
458
466
|
*/
|
|
459
467
|
export * from './list-query.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAidG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,8BAA8B,CAAA;AAC5C,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
|
@@ -30,6 +30,8 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
30
30
|
pending: TemplateRef<unknown> | null;
|
|
31
31
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
32
32
|
missing: TemplateRef<unknown> | null;
|
|
33
|
+
/** One empty collection template, exclusive with the loaded children. */
|
|
34
|
+
empty: QueryContentProps<T>['empty'];
|
|
33
35
|
/** A failed initial read. Cached data stays visible if its refresh fails. */
|
|
34
36
|
error: TemplateRef<QueryContentErrorContext> | null;
|
|
35
37
|
/** Where the chosen branch renders. */
|
|
@@ -68,6 +70,6 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
68
70
|
*/
|
|
69
71
|
private update;
|
|
70
72
|
static ɵfac: i0.ɵɵFactoryDeclaration<QueryContent<any>, never>;
|
|
71
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<QueryContent<any>, "mol-query-content", never, { "query": { "alias": "query"; "required": false; }; "pending": { "alias": "pending"; "required": false; }; "missing": { "alias": "missing"; "required": false; }; "children": { "alias": "children"; "required": false; }; "error": { "alias": "error"; "required": false; }; }, {}, never, never, true, never>;
|
|
73
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<QueryContent<any>, "mol-query-content", never, { "query": { "alias": "query"; "required": false; }; "pending": { "alias": "pending"; "required": false; }; "missing": { "alias": "missing"; "required": false; }; "children": { "alias": "children"; "required": false; }; "error": { "alias": "error"; "required": false; }; "empty": { "alias": "empty"; "required": false; }; }, {}, never, never, true, never>;
|
|
72
74
|
}
|
|
73
75
|
//# sourceMappingURL=query-content.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-content.component.d.ts","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAGL,KAAK,OAAO,EAIZ,KAAK,SAAS,EAEd,KAAK,WAAW,EAIjB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;;AAQlG;;;;;;;;;;;GAWG;AACH,qBAUa,YAAY,CAAC,CAAC,GAAG,OAAO,CAAE,YAAW,OAAO,EAAE,SAAS;IAClE,6DAA6D;IAC7D,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAwD;IAC5F,kFAAkF;IAClF,QAAQ,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAO;IAC3D,2FAA2F;IAC3F,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAO;IAC3C,qFAAqF;IACrF,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAO;IAC3C,6EAA6E;IAC7E,KAAK,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAO;IAE1D,uCAAuC;IAEvC,OAAO,CAAC,MAAM,CAAmB;IACjC,sEAAsE;IACtE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,yFAAyF;IACzF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoD;IAC7E,sCAAsC;IACtC,OAAO,CAAC,OAAO,CAAoC;IACnD,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,2DAA2D;IAC3D,OAAO,CAAC,IAAI,CAAC,CAA0B;;IAsBvC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A0B;;IAsBvC;;;OAGG;IACH,OAAO,CAAC,MAAM;IAgBd;;;OAGG;IACH,WAAW,IAAI,IAAI;IAInB;;;;OAIG;IACH,SAAS,IAAI,IAAI;IAIjB;;;;OAIG;IACH,OAAO,CAAC,MAAM;yCA1FH,YAAY;2CAAZ,YAAY;CAwGxB"}
|
|
@@ -30,6 +30,8 @@ export class QueryContent {
|
|
|
30
30
|
pending = null;
|
|
31
31
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
32
32
|
missing = null;
|
|
33
|
+
/** One empty collection template, exclusive with the loaded children. */
|
|
34
|
+
empty = undefined;
|
|
33
35
|
/** A failed initial read. Cached data stays visible if its refresh fails. */
|
|
34
36
|
error = null;
|
|
35
37
|
/** Where the chosen branch renders. */
|
|
@@ -80,6 +82,8 @@ export class QueryContent {
|
|
|
80
82
|
}
|
|
81
83
|
if (query.data === null)
|
|
82
84
|
return { template: this.missing ?? null, context: {} };
|
|
85
|
+
if (this.empty?.when(query.data))
|
|
86
|
+
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } };
|
|
83
87
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } };
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
@@ -124,7 +128,7 @@ export class QueryContent {
|
|
|
124
128
|
} if (rf & 2) {
|
|
125
129
|
let _t;
|
|
126
130
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.outlet = _t.first);
|
|
127
|
-
} }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { query: "query", pending: "pending", missing: "missing", children: "children", error: "error" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["outlet", ""]], template: function QueryContent_Template(rf, ctx) { if (rf & 1) {
|
|
131
|
+
} }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { query: "query", pending: "pending", missing: "missing", children: "children", error: "error", empty: "empty" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["outlet", ""]], template: function QueryContent_Template(rf, ctx) { if (rf & 1) {
|
|
128
132
|
i0.ɵɵdomElementContainer(0, null, 0);
|
|
129
133
|
} }, encapsulation: 2 });
|
|
130
134
|
}
|
|
@@ -134,7 +138,7 @@ export class QueryContent {
|
|
|
134
138
|
selector: 'mol-query-content',
|
|
135
139
|
standalone: true,
|
|
136
140
|
template: '<ng-container #outlet></ng-container>',
|
|
137
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error'],
|
|
141
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
138
142
|
host: {
|
|
139
143
|
'data-parity-unwrap': '',
|
|
140
144
|
style: 'display: contents',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-content.component.js","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,iBAAiB,EACjB,SAAS,EAET,MAAM,EAEN,MAAM,EAEN,MAAM,EAEN,SAAS,EACT,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAA;;;AAUtB;;;;;;;;;;;GAWG;AAWH,MAAM,OAAO,YAAY;IACvB,6DAA6D;IAC7D,KAAK,GAAkC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IAC5F,kFAAkF;IAClF,QAAQ,GAA+C,IAAI,CAAA;IAC3D,2FAA2F;IAC3F,OAAO,GAAgC,IAAI,CAAA;IAC3C,qFAAqF;IACrF,OAAO,GAAgC,IAAI,CAAA;IAC3C,6EAA6E;IAC7E,KAAK,GAAiD,IAAI,CAAA;IAE1D,uCAAuC;IAE/B,MAAM,CAAmB;IACjC,sEAAsE;IACrD,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA;IAC3D,yFAAyF;IACxE,QAAQ,GAAG,MAAM,CAAgC,IAAI,CAAC,KAAK;iFAAC,CAAA;IAC7E,sCAAs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,EAAE;oBACxB,KAAK,EAAE,mBAAmB;iBAC3B;aACF;;kBAgBE,SAAS;mBAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;;kFAflD,YAAY"}
|
package/dist/types.d.ts
CHANGED
|
@@ -56,6 +56,15 @@ export interface QueryContentErrorContext {
|
|
|
56
56
|
}
|
|
57
57
|
/** A loaded document owns its controls; absent documents expose only status content. */
|
|
58
58
|
export interface QueryContentProps<T> {
|
|
59
|
+
/**
|
|
60
|
+
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
61
|
+
* loaded document (an array or an application-owned envelope); render selects the
|
|
62
|
+
* current view's message and recovery action. Omit it to keep empty arrays as data.
|
|
63
|
+
*/
|
|
64
|
+
empty?: {
|
|
65
|
+
when: (data: NonNullable<T>) => boolean;
|
|
66
|
+
render: NonNullable<QueryContentProps<T>['children']>;
|
|
67
|
+
};
|
|
59
68
|
/** State from useQuery, or any compatible query observer. */
|
|
60
69
|
query: Pick<QueryState<T>, 'data' | 'status' | 'error'>;
|
|
61
70
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACtD;;;;;;;;;OASG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,IAAI,CAAA;IAC1E;;;;;OAKG;IACH,OAAO,EA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AwB,CAAC,GAAG,IAAI,CAAA;CACrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-query-angular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Angular hooks for @molecule/app-query — read a cached document synchronously, observe it, and prefetch on intent",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-query-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"@angular/compiler-cli": "22.2.3",
|
|
57
57
|
"@angular/core": "22.2.3",
|
|
58
58
|
"@angular/platform-browser": "22.2.3",
|
|
59
|
-
"@molecule/app-angular": "3.
|
|
59
|
+
"@molecule/app-angular": "3.7.1",
|
|
60
60
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
61
|
-
"@molecule/app-i18n": "1.2.
|
|
61
|
+
"@molecule/app-i18n": "1.2.2",
|
|
62
62
|
"@molecule/app-icons": "1.0.4",
|
|
63
|
-
"@molecule/app-query": "1.
|
|
64
|
-
"@molecule/app-query-memory": "1.0
|
|
65
|
-
"@molecule/app-query-tanstack": "1.0
|
|
66
|
-
"@molecule/app-ui": "1.
|
|
67
|
-
"@molecule/app-ui-angular": "1.
|
|
63
|
+
"@molecule/app-query": "1.3.1",
|
|
64
|
+
"@molecule/app-query-memory": "1.1.0",
|
|
65
|
+
"@molecule/app-query-tanstack": "1.1.0",
|
|
66
|
+
"@molecule/app-ui": "1.4.0",
|
|
67
|
+
"@molecule/app-ui-angular": "1.2.0",
|
|
68
68
|
"@types/node": "26.6.5",
|
|
69
69
|
"jsdom": "30.1.3",
|
|
70
70
|
"rxjs": "7.8.2",
|