@yongdall/web 0.4.5 → 0.5.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/boot.mjs +1 -1
- package/boot.mjs.map +1 -1
- package/index.d.mts +53 -22
- package/index.mjs +14 -14
- package/index.mjs.map +1 -1
- package/package.json +4 -4
- package/yongdall.plugin.yml +1 -0
package/boot.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{application as e,findPluginIdRegex as t,importStyle as n,importWidget as r,start as i}from"@yongdall/web";async function a(){let{theme:a,route:o,authenticator:s,skin:c}=e;async function
|
|
1
|
+
import{application as e,findPluginIdRegex as t,importStyle as n,importWidget as r,start as i}from"@yongdall/web";async function a(){let{theme:a,route:o,authenticator:s,skin:c,type:l}=e;c&&await n(c).catch(()=>null);async function u(){if(!s||typeof s!=`string`)return{};let e=await r(s);if(typeof e==`function`&&(e=await e()),!e)return{};let n=t.exec(s)?.groups?.pluginId;return!n||!e.styleFiles?.length?{...e,styleFiles:[]}:{...e,styleFiles:[...e.styleFiles||[]].map(e=>[e,n])}}if(l===`authenticator`||!a||typeof a!=`string`){i(u);return}async function d(){if(!a||typeof a!=`string`)return{};let e=await r(a);if(typeof e==`function`&&(e=await e()),!e)return{};let n=t.exec(a)?.groups?.pluginId;return!n||!e.styleFiles?.length?{...e,styleFiles:[]}:{...e,styleFiles:[...e.styleFiles||[]].map(e=>[e,n])}}async function f(){return o?r(o):null}i(u,d,f)}a();
|
|
2
2
|
//# sourceMappingURL=boot.mjs.map
|
package/boot.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boot.mjs","names":[],"sources":["../../packages/web/boot.mjs"],"sourcesContent":["/** @import { Authenticator, Theme } from './typesDefine.mjs' */\nimport { application, start } from '@yongdall/web';\nimport { importWidget, importStyle } from '@yongdall/web';\nimport { findPluginIdRegex } from '@yongdall/web';\n\n/** @typedef {[file: string, plugin: string]} uiStyle */\n\n\n\n\n\nasync function init() {\n\n\n\tconst { theme, route, authenticator, skin } = application;\n\n\t/** @returns {Promise<Partial<Omit<Authenticator, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadAuthenticator() {\n\t\tif (!authenticator || typeof authenticator !== 'string') { return {}; }\n\t\t/** @type {Partial<Authenticator> | (() => Partial<Authenticator> | PromiseLike<Partial<Authenticator>>) | undefined} */\n\t\tlet authenticatorWidget = await importWidget(authenticator);\n\t\tif (typeof authenticatorWidget === 'function') { authenticatorWidget = await authenticatorWidget(); }\n\t\tif (!authenticatorWidget) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(authenticator)?.groups?.pluginId;\n\t\tif (!pluginId || !authenticatorWidget.styleFiles?.length) { return { ...authenticatorWidget, styleFiles: [] }; }\n\t\treturn { ...authenticatorWidget, styleFiles: [...authenticatorWidget.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\t/** @returns {Promise<Partial<Omit<Theme, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadTheme() {\n\t\tif (!theme || typeof theme !== 'string') { return {}; }\n\t\t/** @type {Partial<Theme> | (() => Partial<Theme> | PromiseLike<Partial<Theme>>) | undefined} */\n\t\tlet uis = await importWidget(theme);\n\t\tif (typeof uis === 'function') { uis = await uis(); }\n\t\tif (!uis) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(theme)?.groups?.pluginId;\n\t\tif (!pluginId || !uis.styleFiles?.length) { return { ...uis, styleFiles: [] }; }\n\t\treturn { ...uis, styleFiles: [...uis.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\n\tasync function _loadRoute() {\n\t\tif (!route) { return null; }\n\t\treturn importWidget(route);\n\t}\n\
|
|
1
|
+
{"version":3,"file":"boot.mjs","names":[],"sources":["../../packages/web/boot.mjs"],"sourcesContent":["/** @import { Authenticator, Theme } from './typesDefine.mjs' */\nimport { application, start } from '@yongdall/web';\nimport { importWidget, importStyle } from '@yongdall/web';\nimport { findPluginIdRegex } from '@yongdall/web';\n\n/** @typedef {[file: string, plugin: string]} uiStyle */\n\n\n\n\n\nasync function init() {\n\n\n\tconst { theme, route, authenticator, skin, type } = application;\n\tif (skin) { await importStyle(skin).catch(() => null); }\n\n\t/** @returns {Promise<Partial<Omit<Authenticator, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadAuthenticator() {\n\t\tif (!authenticator || typeof authenticator !== 'string') { return {}; }\n\t\t/** @type {Partial<Authenticator> | (() => Partial<Authenticator> | PromiseLike<Partial<Authenticator>>) | undefined} */\n\t\tlet authenticatorWidget = await importWidget(authenticator);\n\t\tif (typeof authenticatorWidget === 'function') { authenticatorWidget = await authenticatorWidget(); }\n\t\tif (!authenticatorWidget) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(authenticator)?.groups?.pluginId;\n\t\tif (!pluginId || !authenticatorWidget.styleFiles?.length) { return { ...authenticatorWidget, styleFiles: [] }; }\n\t\treturn { ...authenticatorWidget, styleFiles: [...authenticatorWidget.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\tif (type === 'authenticator' || !theme || typeof theme !== 'string') {\n\t\tstart(_loadAuthenticator);\n\t\treturn;\n\t}\n\t/** @returns {Promise<Partial<Omit<Theme, 'styleFiles'> & Record<'styleFiles', uiStyle[]>>>} */\n\tasync function _loadTheme() {\n\t\tif (!theme || typeof theme !== 'string') { return {}; }\n\t\t/** @type {Partial<Theme> | (() => Partial<Theme> | PromiseLike<Partial<Theme>>) | undefined} */\n\t\tlet uis = await importWidget(theme);\n\t\tif (typeof uis === 'function') { uis = await uis(); }\n\t\tif (!uis) { return {}; }\n\t\tconst pluginId = findPluginIdRegex.exec(theme)?.groups?.pluginId;\n\t\tif (!pluginId || !uis.styleFiles?.length) { return { ...uis, styleFiles: [] }; }\n\t\treturn { ...uis, styleFiles: [...uis.styleFiles || []].map(s => [s, pluginId]) };\n\t}\n\n\tasync function _loadRoute() {\n\t\tif (!route)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AAM,CADL,KAGtB,EAAM,EAAoB,EAAY,EAAW,CAGlD,GAAM"}
|
package/index.d.mts
CHANGED
|
@@ -1502,6 +1502,7 @@ type User = {
|
|
|
1502
1502
|
plugins?: Record<string, Record<string, any>> | undefined;
|
|
1503
1503
|
};
|
|
1504
1504
|
declare namespace User {
|
|
1505
|
+
const visitor: boolean;
|
|
1505
1506
|
const multi: boolean;
|
|
1506
1507
|
const single: boolean;
|
|
1507
1508
|
const session: User | null;
|
|
@@ -1713,6 +1714,29 @@ declare namespace DataSource {
|
|
|
1713
1714
|
};
|
|
1714
1715
|
}
|
|
1715
1716
|
//#endregion
|
|
1717
|
+
//#region packages/web/request.d.mts
|
|
1718
|
+
/**
|
|
1719
|
+
* @callback ErrorAlerter
|
|
1720
|
+
* @param {*} error
|
|
1721
|
+
* @returns {PromiseLike<void> | void}
|
|
1722
|
+
*/
|
|
1723
|
+
/**
|
|
1724
|
+
* @param {*} error
|
|
1725
|
+
* @returns {PromiseLike<void> | void}
|
|
1726
|
+
*/
|
|
1727
|
+
declare function ErrorAlerter(error: any): PromiseLike<void> | void;
|
|
1728
|
+
type ErrorAlerter = (error: any) => PromiseLike<void> | void;
|
|
1729
|
+
declare class ARequest extends DotRequest$1 {
|
|
1730
|
+
/**
|
|
1731
|
+
*
|
|
1732
|
+
* @param {string} method
|
|
1733
|
+
* @param {string} [path]
|
|
1734
|
+
* @returns
|
|
1735
|
+
*/
|
|
1736
|
+
method(method: string, path?: string): this;
|
|
1737
|
+
}
|
|
1738
|
+
declare const request: ARequest;
|
|
1739
|
+
//#endregion
|
|
1716
1740
|
//#region packages/web/typesDefine.d.mts
|
|
1717
1741
|
interface CurrentPage {
|
|
1718
1742
|
title: string;
|
|
@@ -1908,7 +1932,7 @@ interface Authenticator {
|
|
|
1908
1932
|
elements: Element | Element[];
|
|
1909
1933
|
/** 添加到根节点上的类名 */
|
|
1910
1934
|
rootClassName: string;
|
|
1911
|
-
login(signal: AbortSignal): PromiseLike<void> | void;
|
|
1935
|
+
login(signal: AbortSignal, onlyAuthenticator: boolean): PromiseLike<void> | void;
|
|
1912
1936
|
}
|
|
1913
1937
|
interface Theme {
|
|
1914
1938
|
title(page: CurrentPage): string;
|
|
@@ -1917,6 +1941,7 @@ interface Theme {
|
|
|
1917
1941
|
updatePath: (path: string, search: string, hash: string, page: (PageIdent & {
|
|
1918
1942
|
path: string;
|
|
1919
1943
|
}) | null) => void;
|
|
1944
|
+
alertError: ErrorAlerter;
|
|
1920
1945
|
/** 自动加载的样式文件 */
|
|
1921
1946
|
styleFiles: string[];
|
|
1922
1947
|
/** 添加到 <body> 上的类名 */
|
|
@@ -2504,17 +2529,35 @@ declare namespace pathRoots {
|
|
|
2504
2529
|
declare function createModelDefault(model: ModelScriptConfiguration | ModelConfiguration, params: Record<string, any> | [key: string, value: any][], defaultValue?: Record<string, any>): any;
|
|
2505
2530
|
//#endregion
|
|
2506
2531
|
//#region packages/web/model/createDocumentInModal.d.mts
|
|
2532
|
+
/**
|
|
2533
|
+
*
|
|
2534
|
+
* @param {Modal} modal
|
|
2535
|
+
* @param {ModelScriptConfiguration} model
|
|
2536
|
+
* @param {ReturnType<typeof modelService> | string} currentModel
|
|
2537
|
+
* @param {FormLayout?} [layout]
|
|
2538
|
+
* @param {Record<string, any> | [key: string, value: any][] | null} [newParams]
|
|
2539
|
+
*/
|
|
2540
|
+
declare function createDocumentInModal(modal: Modal, model: ModelScriptConfiguration, currentModel: ReturnType<typeof modelService> | string, layout?: FormLayout | null, newParams?: Record<string, any> | [key: string, value: any][] | null): Promise<any>;
|
|
2541
|
+
//#endregion
|
|
2542
|
+
//#region packages/web/model/showDocumentInModal.d.mts
|
|
2507
2543
|
/** @import { Modal } from '../dom/index.mjs' */
|
|
2508
|
-
/** @import { ModelScriptConfiguration, modelService } from '../services/model.mjs' */
|
|
2509
2544
|
/**
|
|
2510
2545
|
*
|
|
2511
2546
|
* @param {Modal} modal
|
|
2512
2547
|
* @param {ModelScriptConfiguration} model
|
|
2513
2548
|
* @param {ReturnType<typeof modelService>} currentModel
|
|
2549
|
+
* @param {string} id
|
|
2514
2550
|
* @param {FormLayout?} [layout]
|
|
2515
|
-
* @param {
|
|
2551
|
+
* @param {object} [options]
|
|
2552
|
+
* @param {string} [options.href]
|
|
2553
|
+
* @param {boolean} [options.editable]
|
|
2554
|
+
* @param {boolean} [options.destroyable]
|
|
2516
2555
|
*/
|
|
2517
|
-
declare function
|
|
2556
|
+
declare function showDocumentInModal(modal: Modal, model: ModelScriptConfiguration, currentModel: ReturnType<typeof modelService>, id: string, layout?: FormLayout | null, options?: {
|
|
2557
|
+
href?: string | undefined;
|
|
2558
|
+
editable?: boolean | undefined;
|
|
2559
|
+
destroyable?: boolean | undefined;
|
|
2560
|
+
}): Promise<void>;
|
|
2518
2561
|
//#endregion
|
|
2519
2562
|
//#region packages/web/model/index.d.mts
|
|
2520
2563
|
/**
|
|
@@ -2697,18 +2740,6 @@ declare function stringify(a: PageIdent): string;
|
|
|
2697
2740
|
*/
|
|
2698
2741
|
declare function stringifyPaths(a: PageIdent): Iterable<string>;
|
|
2699
2742
|
//#endregion
|
|
2700
|
-
//#region packages/web/request.d.mts
|
|
2701
|
-
declare class ARequest extends DotRequest$1 {
|
|
2702
|
-
/**
|
|
2703
|
-
*
|
|
2704
|
-
* @param {string} method
|
|
2705
|
-
* @param {string} [path]
|
|
2706
|
-
* @returns
|
|
2707
|
-
*/
|
|
2708
|
-
method(method: string, path?: string): this;
|
|
2709
|
-
}
|
|
2710
|
-
declare const request: ARequest;
|
|
2711
|
-
//#endregion
|
|
2712
2743
|
//#region packages/web/ResponseError.d.mts
|
|
2713
2744
|
declare class ResponseError extends Error {
|
|
2714
2745
|
/**
|
|
@@ -2831,16 +2862,15 @@ declare function buildPlugin(pluginId: string): {
|
|
|
2831
2862
|
/**
|
|
2832
2863
|
*
|
|
2833
2864
|
* @param {typeof loadAuthenticator} _loadAuthenticator
|
|
2834
|
-
* @param {
|
|
2835
|
-
* @param {() => MaybePromise<PageIdent.Router?>} _loadRoute
|
|
2865
|
+
* @param {() => MaybePromise<Partial<WorkbenchTheme>>} [_loadTheme]
|
|
2866
|
+
* @param {() => MaybePromise<PageIdent.Router?>} [_loadRoute]
|
|
2836
2867
|
* @returns
|
|
2837
2868
|
*/
|
|
2838
|
-
declare function start(_loadAuthenticator: typeof loadAuthenticator, _loadTheme
|
|
2869
|
+
declare function start(_loadAuthenticator: typeof loadAuthenticator, _loadTheme?: () => MaybePromise<Partial<WorkbenchTheme>>, _loadRoute?: () => MaybePromise<PageIdent.Router | null>): Promise<void>;
|
|
2839
2870
|
type uiStyle = [file: string, plugin: string];
|
|
2871
|
+
type WorkbenchTheme = Omit<Theme, "styleFiles"> & Record<"styleFiles", uiStyle[]>;
|
|
2840
2872
|
/** @type {() => MaybePromise<Partial<Omit<Authenticator, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>} */
|
|
2841
2873
|
declare let loadAuthenticator: () => MaybePromise<Partial<Omit<Authenticator, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>;
|
|
2842
|
-
/** @type {() => MaybePromise<Partial<Omit<Theme, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>} */
|
|
2843
|
-
declare let loadTheme: () => MaybePromise<Partial<Omit<Theme, "styleFiles"> & Record<"styleFiles", uiStyle[]>>>;
|
|
2844
2874
|
//#endregion
|
|
2845
2875
|
//#region packages/web/configuration.d.mts
|
|
2846
2876
|
/** @type {Record<string, Plugin>} */
|
|
@@ -2852,6 +2882,7 @@ declare namespace application {
|
|
|
2852
2882
|
export const theme: string | undefined;
|
|
2853
2883
|
export const route: string | undefined;
|
|
2854
2884
|
export const authenticator: string | undefined;
|
|
2885
|
+
export const type: string | undefined;
|
|
2855
2886
|
export const skin: string | undefined;
|
|
2856
2887
|
export const menus: any[];
|
|
2857
2888
|
export const userMenus: any[];
|
|
@@ -2916,4 +2947,4 @@ declare function updateHooks(hooks: Record<string, Hook.Define<Hooks>>): void;
|
|
|
2916
2947
|
/** @type {Hook<Hooks>} */
|
|
2917
2948
|
declare const allHooks: Hook<Hooks>;
|
|
2918
2949
|
//#endregion
|
|
2919
|
-
export { ArrayStore, Authenticator, BindObjectStore, code128_d_exports as Code128, Command, ConfiguratorComponent, ConfiguratorContext, type ContinuationDefine, CurrentPage, type DataSource, DotRequest, FieldComponent, FieldComponentEvent, FieldComponents, FieldContext, FieldDefine, FieldFilter, FieldFilterComponent, FieldFilterContext, FieldFilterFns, FieldFilterOptions, FieldFilterStyle, type FieldScript, type FieldScriptConfiguration, FieldShowHandle, FieldStyle, FilterFns, FormFieldHook, FromRenderer, GeneralContext, type HomeContext, Hooks, IconDefine, Ident_d_exports as Ident, List, type Match, Menu, Modal, ModalFooter, ModalHeader, type ModelConfiguration, ModelIndicator, type ModelScript, type ModelScriptConfiguration, ObjectStore, Page, type PageConfiguration, type PageContext, type PageError, PageFooter, PageFrame, type PageHandle, PageHeader, PageIdent, type PageManager, type PageRenderer, PageSection, PageSectionParam, PageSider, Pagination, type Print, ResponseError, type Schema, Signal$1 as Signal, State, Store, type StoreLayout, SubmodelsLayoutEvent, Theme, User, UserHook, VerifyContext, VerifyError, type WorkspaceDefine, addManager, allHooks, application, buildDataSource, buildPlugin, createComputed, createDeeply, createDialog, createDocumentInModal, createFilters, createFrame, createIcon, createModal, createModelDefault, createQuickFilters, createShowField, createState, createStore, createStoreField, createTick, effect, enumerationsService, execScript, filterPermission, flatPermission, formLayoutsService, getAllFilterFns, getAuthorizations, getField, getFieldFilter, getFieldFilterOperators, getFilterFns, getPages, getPermissionFields, getPrimaryFields, hasField, hasFieldFilter, importStyle, importWidget, isMac, isPluginId, loadMenu, modelService, neverAbortedSignal, pathRoots, _default as permissionsService, plugins, _default$1 as renderForm, renderStore, _default$2 as renderStoreForm, request, root$1 as root, selectFile, setIcon, showFilterDialog, start, testPermission, testPermissionConstraints, testPermissions, toFileLink, toFileURL, toId, toPermissionFilter, toSchema, toUrl, updateHooks, waitAbortSignal, watch };
|
|
2950
|
+
export { ArrayStore, Authenticator, BindObjectStore, code128_d_exports as Code128, Command, ConfiguratorComponent, ConfiguratorContext, type ContinuationDefine, CurrentPage, type DataSource, DotRequest, ErrorAlerter, FieldComponent, FieldComponentEvent, FieldComponents, FieldContext, FieldDefine, FieldFilter, FieldFilterComponent, FieldFilterContext, FieldFilterFns, FieldFilterOptions, FieldFilterStyle, type FieldScript, type FieldScriptConfiguration, FieldShowHandle, FieldStyle, FilterFns, FormFieldHook, FromRenderer, GeneralContext, type HomeContext, Hooks, IconDefine, Ident_d_exports as Ident, List, type Match, Menu, Modal, ModalFooter, ModalHeader, type ModelConfiguration, ModelIndicator, type ModelScript, type ModelScriptConfiguration, ObjectStore, Page, type PageConfiguration, type PageContext, type PageError, PageFooter, PageFrame, type PageHandle, PageHeader, PageIdent, type PageManager, type PageRenderer, PageSection, PageSectionParam, PageSider, Pagination, type Print, ResponseError, type Schema, Signal$1 as Signal, State, Store, type StoreLayout, SubmodelsLayoutEvent, Theme, User, UserHook, VerifyContext, VerifyError, type WorkspaceDefine, addManager, allHooks, application, buildDataSource, buildPlugin, createComputed, createDeeply, createDialog, createDocumentInModal, createFilters, createFrame, createIcon, createModal, createModelDefault, createQuickFilters, createShowField, createState, createStore, createStoreField, createTick, effect, enumerationsService, execScript, filterPermission, flatPermission, formLayoutsService, getAllFilterFns, getAuthorizations, getField, getFieldFilter, getFieldFilterOperators, getFilterFns, getPages, getPermissionFields, getPrimaryFields, hasField, hasFieldFilter, importStyle, importWidget, isMac, isPluginId, loadMenu, modelService, neverAbortedSignal, pathRoots, _default as permissionsService, plugins, _default$1 as renderForm, renderStore, _default$2 as renderStoreForm, request, root$1 as root, selectFile, setIcon, showDocumentInModal, showFilterDialog, start, testPermission, testPermissionConstraints, testPermissions, toFileLink, toFileURL, toId, toPermissionFilter, toSchema, toUrl, updateHooks, waitAbortSignal, watch };
|