@quazardous/qdadm 1.19.4 → 1.19.6
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/package.json +1 -1
- package/src/components/edit/FormPage.vue +1 -0
- package/src/components/lists/ListPage.vue +1 -8
- package/src/composables/useEntityItemFormPage.types.ts +1 -0
- package/src/composables/useListPage.types.ts +1 -0
- package/src/composables/useOptionsLookup.ts +2 -1
- package/src/entity/EntityManager.cache.ts +2 -2
- package/src/gen/generateManagers.test.js +6 -3
- package/src/gen/generateManagers.ts +2 -2
- package/src/generated/managers/testManager.js +0 -45
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ import Button from 'primevue/button'
|
|
|
25
25
|
import Select from 'primevue/select'
|
|
26
26
|
import AutoComplete from 'primevue/autocomplete'
|
|
27
27
|
import SplitButton from 'primevue/splitbutton'
|
|
28
|
-
import type { FilterConfig, CardConfig, ResolvedAction, ResolvedHeaderAction
|
|
28
|
+
import type { FilterConfig, CardConfig, ResolvedAction, ResolvedHeaderAction } from '../../composables/useListPage'
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Header action state for label function (matches useListPage)
|
|
@@ -41,13 +41,6 @@ interface HeaderActionState {
|
|
|
41
41
|
*/
|
|
42
42
|
type LabelType = string | ((state: HeaderActionState) => string)
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* Extended header action with optional size property used in template
|
|
46
|
-
*/
|
|
47
|
-
interface ResolvedHeaderAction extends BaseResolvedHeaderAction {
|
|
48
|
-
size?: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
44
|
/**
|
|
52
45
|
* Autocomplete event interface
|
|
53
46
|
*/
|
|
@@ -79,6 +79,7 @@ export interface ActionConfig {
|
|
|
79
79
|
label: string
|
|
80
80
|
icon?: string
|
|
81
81
|
severity?: string
|
|
82
|
+
size?: string
|
|
82
83
|
onClick: () => void | Promise<void>
|
|
83
84
|
visible?: (ctx: { isEdit: boolean; dirty: boolean }) => boolean
|
|
84
85
|
disabled?: (ctx: { dirty: boolean; saving: boolean }) => boolean
|
|
@@ -146,6 +146,7 @@ export interface HeaderActionConfig {
|
|
|
146
146
|
label: string | ((state: HeaderActionState) => string)
|
|
147
147
|
icon?: string
|
|
148
148
|
severity?: string
|
|
149
|
+
size?: string
|
|
149
150
|
onClick: () => void | Promise<void>
|
|
150
151
|
visible?: (state: HeaderActionState) => boolean
|
|
151
152
|
loading?: (state: HeaderActionState) => boolean
|
|
@@ -291,7 +291,8 @@ export function useOptionsLookup(config: UseOptionsLookupConfig): UseOptionsLook
|
|
|
291
291
|
)
|
|
292
292
|
// When query exactly matches a single option (e.g. dropdown click with
|
|
293
293
|
// current value), show all options so the user can browse alternatives
|
|
294
|
-
|
|
294
|
+
const sole = filtered.length === 1 ? filtered[0] : undefined
|
|
295
|
+
result = (sole !== undefined && sole.toLowerCase() === q)
|
|
295
296
|
? encodedStrings
|
|
296
297
|
: filtered
|
|
297
298
|
}
|
|
@@ -163,8 +163,8 @@ export function applyCacheMethods(EntityManagerClass: { prototype: any }): void
|
|
|
163
163
|
// Evict oldest entries by loadedAt
|
|
164
164
|
const entries = [...items.entries()].sort((a, b) => a[1].loadedAt - b[1].loadedAt)
|
|
165
165
|
const toRemove = entries.length - maxSize
|
|
166
|
-
for (
|
|
167
|
-
items.delete(
|
|
166
|
+
for (const [key] of entries.slice(0, toRemove)) {
|
|
167
|
+
items.delete(key)
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -427,9 +427,12 @@ describe('generateManagers', () => {
|
|
|
427
427
|
// Storage must be parameterized in class mode too — same TS2322
|
|
428
428
|
// assignability problem as instance mode if we drop the generic.
|
|
429
429
|
expect(content).toContain('new ApiStorage<UsersEntity>(')
|
|
430
|
-
// Constructor signature
|
|
431
|
-
|
|
432
|
-
expect(content).toContain(
|
|
430
|
+
// Constructor signature delegates to the parent's options type so
|
|
431
|
+
// `fields: Record<string, FieldConfig>` doesn't widen on spread (TS2345).
|
|
432
|
+
expect(content).toContain("import type { EntityRecord, EntityManagerOptions } from '@quazardous/qdadm'")
|
|
433
|
+
expect(content).toContain('options: Partial<EntityManagerOptions<UsersEntity>>')
|
|
434
|
+
expect(content).not.toContain('Record<string, unknown>')
|
|
435
|
+
expect(content).not.toContain('[key: string]: unknown')
|
|
433
436
|
})
|
|
434
437
|
})
|
|
435
438
|
|
|
@@ -241,7 +241,7 @@ function generateManagerSource(
|
|
|
241
241
|
*/
|
|
242
242
|
|
|
243
243
|
import { EntityManager } from '@quazardous/qdadm'
|
|
244
|
-
import type { EntityRecord,
|
|
244
|
+
import type { EntityRecord, EntityManagerOptions } from '@quazardous/qdadm'
|
|
245
245
|
import { ${storageClass} } from '${storageImport}'
|
|
246
246
|
|
|
247
247
|
${entityInterface}
|
|
@@ -252,7 +252,7 @@ ${entityInterface}
|
|
|
252
252
|
* @extends EntityManager
|
|
253
253
|
*/
|
|
254
254
|
export class Generated${className}Manager extends EntityManager<${className}Entity> {
|
|
255
|
-
constructor(options: Partial<
|
|
255
|
+
constructor(options: Partial<EntityManagerOptions<${className}Entity>> = {}) {
|
|
256
256
|
super({
|
|
257
257
|
...${serializeValue(managerOptions, 2)},
|
|
258
258
|
storage: new ${storageClass}<${className}Entity>(${serializeValue(fullStorageOptions, 2)}),
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TestManager - Auto-generated EntityManager
|
|
3
|
-
*
|
|
4
|
-
* Generated by qdadm/gen/generateManagers
|
|
5
|
-
* DO NOT EDIT MANUALLY - Changes will be overwritten
|
|
6
|
-
*
|
|
7
|
-
* Entity: test
|
|
8
|
-
* Endpoint: /test
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { EntityManager } from '@quazardous/qdadm'
|
|
12
|
-
import { ApiStorage } from '@quazardous/qdadm'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Schema definition for test
|
|
16
|
-
* @type {import('qdadm/gen').UnifiedEntitySchema}
|
|
17
|
-
*/
|
|
18
|
-
export const testSchema = {
|
|
19
|
-
name: "test",
|
|
20
|
-
endpoint: "/test",
|
|
21
|
-
fields: {}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Storage options for test
|
|
26
|
-
*/
|
|
27
|
-
const storageOptions = {
|
|
28
|
-
endpoint: "/test"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* TestManager instance
|
|
33
|
-
*
|
|
34
|
-
* Provides CRUD operations for test entity.
|
|
35
|
-
*
|
|
36
|
-
* @type {EntityManager}
|
|
37
|
-
*/
|
|
38
|
-
export const testManager = new EntityManager({
|
|
39
|
-
...{
|
|
40
|
-
name: "test",
|
|
41
|
-
idField: "id",
|
|
42
|
-
fields: {}
|
|
43
|
-
},
|
|
44
|
-
storage: new ApiStorage(storageOptions)
|
|
45
|
-
})
|