@webx-ui/module-admin 0.3.0 → 0.4.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/dist/AdminNav.d.ts +3 -0
- package/dist/Screen.d.ts +39 -0
- package/dist/admin.d.ts +18 -1
- package/dist/createAdmin.d.ts +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +415 -307
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +27 -0
- package/package.json +3 -2
package/dist/AdminNav.d.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* The menu, built from the manifest rather than written out. What the panel offers is what the
|
|
3
3
|
* installation actually has — adding a module on the server and installing its front end is
|
|
4
4
|
* the whole of "adding a section".
|
|
5
|
+
*
|
|
6
|
+
* Sections come first, then the groups the server declared — "System" for what keeps the
|
|
7
|
+
* panel running — each as a branch that opens on its own when a section under it is current.
|
|
5
8
|
*/
|
|
6
9
|
type __VLS_Props = {
|
|
7
10
|
collapsed?: boolean;
|
package/dist/Screen.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ScreenModel, ScreenNode } from '@webx-ui/schema';
|
|
2
|
+
/**
|
|
3
|
+
* A screen of the panel, by name.
|
|
4
|
+
*
|
|
5
|
+
* Fetches the tree the server hands out — patched, permission-filtered, translated — lays the
|
|
6
|
+
* project's own patch over it, and draws it with the renderer against the panel's registry,
|
|
7
|
+
* dictionary and permissions. It does not load values and does not save: that is the page's
|
|
8
|
+
* business, the way it is for any form.
|
|
9
|
+
*/
|
|
10
|
+
type __VLS_Props = {
|
|
11
|
+
/** `<module>.<screen>`, e.g. `settings.index`. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Server validation errors by field name, shown under the fields. */
|
|
14
|
+
errors?: Record<string, string[]>;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
labelPosition?: 'top' | 'left';
|
|
17
|
+
labelWidth?: string;
|
|
18
|
+
size?: 'sm' | 'md' | 'lg';
|
|
19
|
+
};
|
|
20
|
+
declare function load(): Promise<void>;
|
|
21
|
+
type __VLS_PublicProps = {
|
|
22
|
+
modelValue?: ScreenModel;
|
|
23
|
+
} & __VLS_Props;
|
|
24
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
25
|
+
reload: typeof load;
|
|
26
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
27
|
+
loaded: (root: ScreenNode[]) => any;
|
|
28
|
+
"update:modelValue": (value: ScreenModel) => any;
|
|
29
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
30
|
+
onLoaded?: ((root: ScreenNode[]) => any) | undefined;
|
|
31
|
+
"onUpdate:modelValue"?: ((value: ScreenModel) => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
size: "sm" | "md" | "lg";
|
|
34
|
+
errors: Record<string, string[]>;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
labelPosition: "top" | "left";
|
|
37
|
+
labelWidth: string;
|
|
38
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
39
|
+
export default _default;
|
package/dist/admin.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { App, ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
import { Patch, ScreenNode, TypeRegistry } from '@webx-ui/schema';
|
|
2
3
|
import { Http } from './http';
|
|
3
4
|
import { I18n } from './i18n';
|
|
4
|
-
import { AdminModule, AdminStatus, AdminUser, Manifest, NavEntry } from './types';
|
|
5
|
+
import { AdminModule, AdminStatus, AdminUser, Manifest, NavEntry, NavGroup } from './types';
|
|
5
6
|
export interface AdminContext {
|
|
6
7
|
/** The panel's own backend. */
|
|
7
8
|
readonly http: Http;
|
|
@@ -16,6 +17,13 @@ export interface AdminContext {
|
|
|
16
17
|
readonly modules: readonly AdminModule[];
|
|
17
18
|
/** Navigation, in the order the server gave, for the modules that exist on both sides. */
|
|
18
19
|
readonly nav: ComputedRef<NavEntry[]>;
|
|
20
|
+
/** The same navigation, with the top-level entries first and then each group's. */
|
|
21
|
+
readonly groups: ComputedRef<{
|
|
22
|
+
top: NavEntry[];
|
|
23
|
+
groups: NavGroup[];
|
|
24
|
+
}>;
|
|
25
|
+
/** Node types every screen is drawn with: the modules' and the project's, over the core. */
|
|
26
|
+
readonly types: TypeRegistry;
|
|
19
27
|
/** Ask the server what the panel is and who is signed in again. */
|
|
20
28
|
reload(): Promise<void>;
|
|
21
29
|
/**
|
|
@@ -32,6 +40,13 @@ export interface AdminContext {
|
|
|
32
40
|
*/
|
|
33
41
|
useSessionLoader(loader: () => Promise<AdminUser | null>): void;
|
|
34
42
|
can(permission: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* A screen by name, as the server hands it out — patched, cut to this administrator's
|
|
45
|
+
* permissions, translated. Fetched once per name and language for the session.
|
|
46
|
+
*/
|
|
47
|
+
loadScreen(name: string): Promise<ScreenNode[]>;
|
|
48
|
+
/** The project's own operations over a screen, from `createAdmin({ screens })`. */
|
|
49
|
+
screenPatch(name: string): Patch;
|
|
35
50
|
}
|
|
36
51
|
export interface AdminState {
|
|
37
52
|
status: AdminStatus;
|
|
@@ -54,5 +69,7 @@ export declare function createAdminContext(options: {
|
|
|
54
69
|
i18n: I18n;
|
|
55
70
|
loadManifest: () => Promise<Manifest>;
|
|
56
71
|
loadDictionary?: (locale: string) => Promise<void>;
|
|
72
|
+
types?: TypeRegistry;
|
|
73
|
+
screens?: Record<string, Patch>;
|
|
57
74
|
}): AdminContext;
|
|
58
75
|
export declare function provideAdmin(app: App, admin: AdminContext): void;
|
package/dist/createAdmin.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Router, RouteRecordRaw } from 'vue-router';
|
|
|
3
3
|
import { AdminContext } from './admin';
|
|
4
4
|
import { Http } from './http';
|
|
5
5
|
import { I18n } from './i18n';
|
|
6
|
+
import { Patch, TypeRegistry } from '@webx-ui/schema';
|
|
6
7
|
import { AdminModule } from './types';
|
|
7
8
|
export interface CreateAdminOptions {
|
|
8
9
|
/** Where to mount. Defaults to `#webx-app`, which is what the Blade shell renders. */
|
|
@@ -39,6 +40,17 @@ export interface CreateAdminOptions {
|
|
|
39
40
|
* narrows it to a language the panel actually has.
|
|
40
41
|
*/
|
|
41
42
|
locale?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Screen node types the project adds — `{ map: { component: WxMapField, kind: 'field' } }` —
|
|
45
|
+
* over the core's and the modules'.
|
|
46
|
+
*/
|
|
47
|
+
types?: TypeRegistry;
|
|
48
|
+
/**
|
|
49
|
+
* The project's patches over the screens modules ship, by screen name, applied on the
|
|
50
|
+
* client on top of what the server hands out. What a patch cannot do from here is open a
|
|
51
|
+
* key for writing: the server decides what is saved.
|
|
52
|
+
*/
|
|
53
|
+
screens?: Record<string, Patch>;
|
|
42
54
|
/** Swappable for tests. */
|
|
43
55
|
http?: Http;
|
|
44
56
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { createHttp, readCookie, HttpError, type Http, type HttpOptions, type Re
|
|
|
6
6
|
export type { AdminModule, AdminStatus, AdminUser, Manifest, ManifestModule, NavEntry, } from './types';
|
|
7
7
|
export { default as AdminShell } from './AdminShell';
|
|
8
8
|
export { default as AdminNav } from './AdminNav';
|
|
9
|
+
export { default as WxScreen } from './Screen';
|