@nauticana/sail 0.9.4 → 0.9.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nauticana/sail",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Metadata-driven Angular component library for CRUD admin frontends backed by the keel Go backend. Tables, forms, navigation, OTP/2FA/social auth, billing, payout onboarding.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -63,15 +63,18 @@ export class TableEdit extends BaseForm implements OnInit {
|
|
|
63
63
|
if (rec) Object.assign(this.editableRecord, rec);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Tabs are the table's child relations (rest_api_child metadata), not just
|
|
68
|
+
* whatever array fields the backend happened to embed. Seed an empty array
|
|
69
|
+
* for any child the response omitted so its grid renders (and accepts new rows).
|
|
70
|
+
*/
|
|
66
71
|
private buildTabs() {
|
|
67
|
-
|
|
68
|
-
this.tabFields = [];
|
|
69
|
-
for (const field of
|
|
70
|
-
if (this.isArray(this.editableRecord[field]))
|
|
71
|
-
this.tabCount++;
|
|
72
|
-
this.tabFields.push(field);
|
|
73
|
-
}
|
|
72
|
+
const tableDef = this.cacheService.getTableDefinition(this.tableName());
|
|
73
|
+
this.tabFields = (tableDef?.Children ?? []).map((child) => child.PascalName);
|
|
74
|
+
for (const field of this.tabFields) {
|
|
75
|
+
if (!this.isArray(this.editableRecord[field])) this.editableRecord[field] = [];
|
|
74
76
|
}
|
|
77
|
+
this.tabCount = this.tabFields.length;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/** Re-fetch the row from the backend after a server-side mutation (TableAction success, etc.). */
|
|
@@ -16,6 +16,10 @@ import { CanActivateFn, Router, Routes } from '@angular/router';
|
|
|
16
16
|
import { SAIL_GUI_CONFIG, SailGuiConfig, DEFAULT_CONFIG } from '../config';
|
|
17
17
|
import { BaseRestService } from './base_rest.service';
|
|
18
18
|
|
|
19
|
+
/** Sort dropdown options by their visible label so long lookup lists are scannable. */
|
|
20
|
+
const byCaption = (a: ConstantValue, b: ConstantValue) =>
|
|
21
|
+
(a.Caption ?? '').localeCompare(b.Caption ?? '', undefined, { numeric: true, sensitivity: 'base' });
|
|
22
|
+
|
|
19
23
|
@Injectable()
|
|
20
24
|
export abstract class BaseAuthService extends BaseRestService {
|
|
21
25
|
protected readonly router = inject(Router);
|
|
@@ -416,7 +420,7 @@ export abstract class BaseAuthService extends BaseRestService {
|
|
|
416
420
|
Value: key,
|
|
417
421
|
Caption: domainMap[key],
|
|
418
422
|
[opField]: 'S',
|
|
419
|
-
} as unknown as ConstantValue));
|
|
423
|
+
} as unknown as ConstantValue)).sort(byCaption);
|
|
420
424
|
}
|
|
421
425
|
|
|
422
426
|
getTableValues(tableName: string): ConstantValue[] | undefined {
|
|
@@ -430,7 +434,7 @@ export abstract class BaseAuthService extends BaseRestService {
|
|
|
430
434
|
Value: key,
|
|
431
435
|
Caption: tableMap[key],
|
|
432
436
|
[opField]: 'S',
|
|
433
|
-
} as unknown as ConstantValue));
|
|
437
|
+
} as unknown as ConstantValue)).sort(byCaption);
|
|
434
438
|
}
|
|
435
439
|
|
|
436
440
|
getMenus(): Observable<ApplicationMenu[]> {
|