es-application-template 0.0.7
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/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/README.md +127 -0
- package/dist/api/index.d.ts +21 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/input-switch/index.d.ts +24 -0
- package/dist/components/input/input-text/index.d.ts +35 -0
- package/dist/components/modal-header/index.d.ts +2 -0
- package/dist/components/notifications/index.d.ts +2 -0
- package/dist/components/select/select/index.d.ts +35 -0
- package/dist/components/sidebar/index.d.ts +14 -0
- package/dist/config/config-cache.d.ts +71 -0
- package/dist/config/config-document.d.ts +26 -0
- package/dist/config/config-storage.d.ts +15 -0
- package/dist/config/config-utils.d.ts +8 -0
- package/dist/config/mock-store.d.ts +41 -0
- package/dist/config/runtime-identity.d.ts +4 -0
- package/dist/config/use-runtime-config.d.ts +21 -0
- package/dist/domain/constants/index.d.ts +18 -0
- package/dist/domain/models/IConfig.d.ts +28 -0
- package/dist/domain/models/IProductsDeploy.d.ts +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6660 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6641 -0
- package/dist/index.mjs.map +1 -0
- package/dist/infra/api/auth/index.d.ts +1 -0
- package/dist/infra/api/requester.d.ts +6 -0
- package/dist/management/components/admin-list-page.d.ts +15 -0
- package/dist/management/setting-keys/config-tree/ConfigTreeGridEditor.d.ts +14 -0
- package/dist/management/setting-keys/config-tree/ConfigTreeJsonDrawer.d.ts +13 -0
- package/dist/management/setting-keys/config-tree/ConfigTreeReviewChrome.d.ts +4 -0
- package/dist/management/setting-keys/config-tree/ConfigTreeRulesDrawer.d.ts +7 -0
- package/dist/management/setting-keys/config-tree/TreeSelect.d.ts +10 -0
- package/dist/management/setting-keys/config-tree/config-tree-value.d.ts +115 -0
- package/dist/management/setting-keys/index.d.ts +2 -0
- package/dist/management/shortcuts/index.d.ts +6 -0
- package/dist/management/shortcuts/shortcut-capture-cell.d.ts +9 -0
- package/dist/management/shortcuts/shortcut-management-utils.d.ts +17 -0
- package/dist/management/shortcuts/use-shortcut-settings-editor.d.ts +21 -0
- package/dist/package/index.d.ts +9 -0
- package/dist/runtime/AppProvider.d.ts +9 -0
- package/dist/settings/core/setting-reader.d.ts +10 -0
- package/dist/settings/core/setting.d.ts +5 -0
- package/dist/settings/core/types.d.ts +14 -0
- package/dist/settings/runtime/SettingRuntime.d.ts +4 -0
- package/dist/settings/runtime/use-setting-document.d.ts +5 -0
- package/dist/shortcuts/core/ShortcutProvider.d.ts +15 -0
- package/dist/shortcuts/core/ShortcutScopes.d.ts +16 -0
- package/dist/shortcuts/core/Shortcuts.d.ts +16 -0
- package/dist/shortcuts/core/advanced.d.ts +4 -0
- package/dist/shortcuts/core/conflict.d.ts +14 -0
- package/dist/shortcuts/core/constants.d.ts +58 -0
- package/dist/shortcuts/core/defaults.d.ts +8 -0
- package/dist/shortcuts/core/index.d.ts +8 -0
- package/dist/shortcuts/core/key-normalizer.d.ts +15 -0
- package/dist/shortcuts/core/migrate.d.ts +6 -0
- package/dist/shortcuts/core/registry.d.ts +134 -0
- package/dist/shortcuts/core/reserved-keys.d.ts +9 -0
- package/dist/shortcuts/core/resolve.d.ts +2 -0
- package/dist/shortcuts/core/runtime.d.ts +17 -0
- package/dist/shortcuts/core/shortcut-binding.d.ts +26 -0
- package/dist/shortcuts/core/shortcut-command.d.ts +44 -0
- package/dist/shortcuts/core/shortcut-config.d.ts +25 -0
- package/dist/shortcuts/core/shortcut-dom-policy.d.ts +13 -0
- package/dist/shortcuts/core/shortcut-platform.d.ts +7 -0
- package/dist/shortcuts/core/shortcut-runtime-context.d.ts +8 -0
- package/dist/shortcuts/core/types.d.ts +54 -0
- package/dist/shortcuts/core/use-shortcut-binding.d.ts +14 -0
- package/dist/shortcuts/core/use-shortcut-context.d.ts +35 -0
- package/dist/shortcuts/runtime/ShortcutGlobalActions.d.ts +7 -0
- package/dist/shortcuts/runtime/ShortcutRuntime.d.ts +9 -0
- package/dist/shortcuts/runtime/ShortcutTooltip.d.ts +11 -0
- package/dist/shortcuts/runtime/app-shortcut-dom-policy.d.ts +2 -0
- package/dist/shortcuts/runtime/constants.d.ts +2 -0
- package/dist/shortcuts/runtime/use-shortcut-runtime-config.d.ts +3 -0
- package/dist/styles/index.css +437 -0
- package/dist/utility/Utils.d.ts +4 -0
- package/dist/utility/hooks/isNullOrUndefined.d.ts +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ShortcutPlatform } from './shortcut-platform';
|
|
2
|
+
import { ShortcutBinding } from './types';
|
|
3
|
+
export declare const shortcutCodeDisplay: (code: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Convert a stored logical binding into the physical modifier set for one OS.
|
|
6
|
+
* Primary => Ctrl on Windows/Linux/other, Meta(Command) on macOS.
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolveShortcutBinding: (binding: ShortcutBinding, platform: ShortcutPlatform) => ShortcutBinding;
|
|
9
|
+
export declare const resolvedBindingKey: (binding: ShortcutBinding | null | undefined, platform: ShortcutPlatform) => string;
|
|
10
|
+
export declare const bindingsConflictOnPlatform: (left: ShortcutBinding, right: ShortcutBinding, platform: ShortcutPlatform) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Shortcut config is portable between products/devices. A binding pair is
|
|
13
|
+
* considered conflicting if it resolves to the same physical shortcut on any
|
|
14
|
+
* supported desktop platform. This prevents a config that works on Windows
|
|
15
|
+
* from becoming ambiguous when the same account opens macOS later.
|
|
16
|
+
*/
|
|
17
|
+
export declare const bindingsConflict: (left: ShortcutBinding, right: ShortcutBinding) => boolean;
|
|
18
|
+
export declare const formatLogicalShortcutBinding: (binding?: ShortcutBinding | null) => string;
|
|
19
|
+
/** Human-friendly display for the device that is currently running ADMIN. */
|
|
20
|
+
export declare const formatShortcutBinding: (binding?: ShortcutBinding | null, platform?: ShortcutPlatform) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Keyboard events are physical (`Ctrl`/`Meta`). Only the settings capture UI
|
|
23
|
+
* translates the platform's main modifier into semantic `Primary`. Existing
|
|
24
|
+
* persisted Ctrl/Meta bindings therefore keep their original meaning.
|
|
25
|
+
*/
|
|
26
|
+
export declare const shortcutBindingFromCaptureEvent: (event: KeyboardEvent, platform?: ShortcutPlatform) => ShortcutBinding | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ShortcutActionId } from './constants';
|
|
3
|
+
import { ShortcutHandler, ShortcutHandlerContext } from './registry';
|
|
4
|
+
export type ShortcutManagedScopeKind = Extract<ShortcutHandlerContext, 'page' | 'grid' | 'form' | 'control' | 'overlay'>;
|
|
5
|
+
export type ShortcutCommand = {
|
|
6
|
+
handler: ShortcutHandler;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type ShortcutCommandMap = Partial<Record<ShortcutActionId, ShortcutCommand>>;
|
|
10
|
+
export type UseShortcutCommandOptions = {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type ManagedShortcutScopeValue = {
|
|
14
|
+
contextId: string;
|
|
15
|
+
kind: ShortcutManagedScopeKind;
|
|
16
|
+
};
|
|
17
|
+
type ManagedShortcutScopeProviderProps = ManagedShortcutScopeValue & {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Compatibility API for screens that still use the old semantic Scope model.
|
|
22
|
+
* Feature code should prefer the <Shortcuts actions={...} /> facade.
|
|
23
|
+
*/
|
|
24
|
+
export declare const useShortcutCommand: (actionId: ShortcutActionId, handler: ShortcutHandler, options: UseShortcutCommandOptions) => void;
|
|
25
|
+
/** Explicit opt-in for application-level commands. */
|
|
26
|
+
export declare const useGlobalShortcutCommand: (actionId: ShortcutActionId, handler: ShortcutHandler, options: UseShortcutCommandOptions) => void;
|
|
27
|
+
/** @internal Compatibility provider used only by the old semantic Scope API. */
|
|
28
|
+
export declare const ManagedShortcutScopeProvider: ({ children, contextId, kind }: ManagedShortcutScopeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
/** @internal Compatibility registrar used only by the old semantic Scope API. */
|
|
30
|
+
export declare const ShortcutCommandRegistrar: ({ commands }: {
|
|
31
|
+
commands?: ShortcutCommandMap;
|
|
32
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
/**
|
|
34
|
+
* Internal auto-context registrar used by the feature-facing <Shortcuts /> facade.
|
|
35
|
+
*
|
|
36
|
+
* Feature code only supplies Action + Handler + Enabled. This registrar reads
|
|
37
|
+
* the real rendered DOM around its anchor and binds each action to the actual
|
|
38
|
+
* Page/Grid/Form/Overlay owner. It never accepts context id, parent id, active
|
|
39
|
+
* state, priority, or modal-stack information from the feature.
|
|
40
|
+
*/
|
|
41
|
+
export declare const ShortcutCommands: ({ commands }: {
|
|
42
|
+
commands?: ShortcutCommandMap;
|
|
43
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ShortcutCatalogItem, ShortcutConfigDocument } from './types';
|
|
2
|
+
type ShortcutActionMap = ShortcutConfigDocument['actions'];
|
|
3
|
+
export declare const mergeShortcutActionMaps: (...maps: Array<ShortcutActionMap | null | undefined>) => ShortcutActionMap;
|
|
4
|
+
export declare const mergeShortcutDocuments: (...documents: Array<ShortcutConfigDocument | null | undefined>) => ShortcutConfigDocument;
|
|
5
|
+
export declare const parseShortcutConfigValue: (serialized: string | null | undefined, defaults: ShortcutConfigDocument) => ShortcutConfigDocument;
|
|
6
|
+
export declare const resolveRuntimeShortcutDocument: (value: unknown, catalog: ShortcutCatalogItem[]) => ShortcutConfigDocument;
|
|
7
|
+
/**
|
|
8
|
+
* Backend hiện trả System + User trong Value. Config mới giữ User intent ở
|
|
9
|
+
* userOverrides; dữ liệu actions cũ được khôi phục bằng diff với System.
|
|
10
|
+
*/
|
|
11
|
+
export declare const extractUserOverrides: (systemDocument: ShortcutConfigDocument, userEffectiveDocument: ShortcutConfigDocument) => ShortcutActionMap;
|
|
12
|
+
export declare const buildUserShortcutSaveDocument: (systemDocument: ShortcutConfigDocument, userOverrides: ShortcutActionMap) => ShortcutConfigDocument;
|
|
13
|
+
export type ShortcutImportIssueCode = 'UNKNOWN_ACTION' | 'RESERVED_BINDING' | 'CONFLICT' | 'INVALID_BINDING' | 'LOCKED_ACTION';
|
|
14
|
+
export type ShortcutImportIssue = {
|
|
15
|
+
actionId?: string;
|
|
16
|
+
binding?: string;
|
|
17
|
+
code: ShortcutImportIssueCode;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
export type ShortcutImportResult = {
|
|
21
|
+
document: ShortcutConfigDocument;
|
|
22
|
+
issues: ShortcutImportIssue[];
|
|
23
|
+
};
|
|
24
|
+
export declare const parseShortcutImport: (value: unknown, catalog: ShortcutCatalogItem[], inheritedDocument: ShortcutConfigDocument) => ShortcutImportResult;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ShortcutDomPolicy = {
|
|
2
|
+
pageBoundarySelector: string;
|
|
3
|
+
gridOwnerSelector: string;
|
|
4
|
+
overlayOwnerSelector: string;
|
|
5
|
+
blockingOverlaySelector: string;
|
|
6
|
+
/** Optional product selectors for rich text/grid editors beyond native form controls. */
|
|
7
|
+
editableTargetSelector?: string;
|
|
8
|
+
/** Optional product selectors for open dropdowns/popups that own Escape. */
|
|
9
|
+
nativePopupSelector?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ShortcutDomPolicyOverride = Partial<ShortcutDomPolicy>;
|
|
12
|
+
export declare const DEFAULT_SHORTCUT_DOM_POLICY: ShortcutDomPolicy;
|
|
13
|
+
export declare const resolveShortcutDomPolicy: (override?: ShortcutDomPolicyOverride) => ShortcutDomPolicy;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ShortcutPlatform = 'windows' | 'mac' | 'linux' | 'other';
|
|
2
|
+
export declare const SUPPORTED_SHORTCUT_PLATFORMS: ShortcutPlatform[];
|
|
3
|
+
/**
|
|
4
|
+
* Detect once at the runtime boundary. Feature code must never branch by OS.
|
|
5
|
+
* `other` intentionally follows the Windows/Linux Primary => Ctrl convention.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getShortcutPlatform: () => ShortcutPlatform;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ShortcutActionId } from './constants';
|
|
2
|
+
import { ShortcutDomPolicy } from './shortcut-dom-policy';
|
|
3
|
+
import { ResolvedShortcutRow } from './types';
|
|
4
|
+
export type ShortcutRuntimeContextValue = {
|
|
5
|
+
rowsByAction: ReadonlyMap<ShortcutActionId, ResolvedShortcutRow>;
|
|
6
|
+
domPolicy: ShortcutDomPolicy;
|
|
7
|
+
};
|
|
8
|
+
export declare const ShortcutRuntimeContext: import("react").Context<ShortcutRuntimeContextValue>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SHORTCUT_SCHEMA_VERSION, ShortcutActionId } from './constants';
|
|
2
|
+
export type ShortcutModifier = 'Primary' | 'Ctrl' | 'Alt' | 'Shift' | 'Meta';
|
|
3
|
+
export type ShortcutCatalogScope = 'global' | 'workspace' | 'module' | 'page' | 'context' | 'grid' | 'form' | 'overlay';
|
|
4
|
+
export type ShortcutGroup = 'system' | 'record' | 'grid' | 'form' | 'data' | 'workflow';
|
|
5
|
+
export type ShortcutCustomizeMode = 'locked' | 'customizable' | 'assignable';
|
|
6
|
+
export type ShortcutBinding = {
|
|
7
|
+
modifiers: ShortcutModifier[];
|
|
8
|
+
code: string;
|
|
9
|
+
display: string;
|
|
10
|
+
};
|
|
11
|
+
export type ShortcutCatalogItem = {
|
|
12
|
+
actionId: ShortcutActionId;
|
|
13
|
+
label: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
/** Nhóm thao tác chung, không phải module nghiệp vụ HRM/PM/MES. */
|
|
16
|
+
group: ShortcutGroup;
|
|
17
|
+
groupLabel: string;
|
|
18
|
+
/**
|
|
19
|
+
* Giữ lại để tương thích runtime hiện tại.
|
|
20
|
+
* Catalog chung dùng COMMON, không tạo shortcut theo từng module.
|
|
21
|
+
*/
|
|
22
|
+
moduleCode: string;
|
|
23
|
+
moduleLabel: string;
|
|
24
|
+
scope: ShortcutCatalogScope;
|
|
25
|
+
defaultBinding?: ShortcutBinding;
|
|
26
|
+
customizeMode: ShortcutCustomizeMode;
|
|
27
|
+
customizable: boolean;
|
|
28
|
+
disableable: boolean;
|
|
29
|
+
locked: boolean;
|
|
30
|
+
dangerous?: boolean;
|
|
31
|
+
allowInEditable?: boolean;
|
|
32
|
+
repeatable?: boolean;
|
|
33
|
+
priority?: number;
|
|
34
|
+
};
|
|
35
|
+
export type ShortcutActionConfig = {
|
|
36
|
+
binding?: ShortcutBinding | null;
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type ShortcutConfigDocument = {
|
|
40
|
+
schemaVersion: typeof SHORTCUT_SCHEMA_VERSION;
|
|
41
|
+
actions: Partial<Record<ShortcutActionId, ShortcutActionConfig>>;
|
|
42
|
+
userOverrides?: Partial<Record<ShortcutActionId, ShortcutActionConfig>>;
|
|
43
|
+
};
|
|
44
|
+
export type ResolvedShortcutRow = ShortcutCatalogItem & {
|
|
45
|
+
currentBinding?: ShortcutBinding;
|
|
46
|
+
effectiveEnabled: boolean;
|
|
47
|
+
inheritedBinding?: ShortcutBinding;
|
|
48
|
+
inheritedEnabled: boolean;
|
|
49
|
+
customized: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type ShortcutAction = ShortcutCatalogItem & {
|
|
52
|
+
id: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ShortcutActionId } from './constants';
|
|
2
|
+
import { ShortcutBinding } from './types';
|
|
3
|
+
export type ShortcutHint = {
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
binding?: ShortcutBinding;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Trả về thông tin hiển thị của một shortcut theo cấu hình effective hiện tại.
|
|
11
|
+
* Hook chỉ đọc state đã resolve trong ShortcutProvider, không gọi API riêng.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useShortcutHint: (actionId: ShortcutActionId) => ShortcutHint;
|
|
14
|
+
export declare const useShortcutBinding: (actionId: ShortcutActionId) => ShortcutBinding | undefined;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FocusEvent as ReactFocusEvent } from 'react';
|
|
2
|
+
import { ShortcutHandlerContext } from './registry';
|
|
3
|
+
export declare const ShortcutParentContext: import("react").Context<string>;
|
|
4
|
+
export type UseShortcutContextOptions = {
|
|
5
|
+
id?: string;
|
|
6
|
+
type?: ShortcutHandlerContext;
|
|
7
|
+
parentId?: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
autoActivate?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** @internal Runtime primitive used by semantic scope components. */
|
|
12
|
+
export declare const useShortcutRuntimeContext: (options?: UseShortcutContextOptions) => {
|
|
13
|
+
id: string;
|
|
14
|
+
contextId: string;
|
|
15
|
+
activate: (event?: {
|
|
16
|
+
currentTarget?: EventTarget | null;
|
|
17
|
+
}) => void;
|
|
18
|
+
deactivate: () => void;
|
|
19
|
+
ref: (owner: HTMLElement | null) => void;
|
|
20
|
+
ownerRef: import("react").MutableRefObject<HTMLElement>;
|
|
21
|
+
scopeProps: {
|
|
22
|
+
ref: (owner: HTMLElement | null) => void;
|
|
23
|
+
'data-shortcut-context-id': string;
|
|
24
|
+
onFocusCapture: (event?: {
|
|
25
|
+
currentTarget?: EventTarget | null;
|
|
26
|
+
}) => void;
|
|
27
|
+
onMouseDownCapture: (event?: {
|
|
28
|
+
currentTarget?: EventTarget | null;
|
|
29
|
+
}) => void;
|
|
30
|
+
onPointerDownCapture: (event?: {
|
|
31
|
+
currentTarget?: EventTarget | null;
|
|
32
|
+
}) => void;
|
|
33
|
+
onBlurCapture: (event: ReactFocusEvent<HTMLElement>) => void;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type ShortcutGlobalActionsProps = {
|
|
2
|
+
dashboardPath?: string;
|
|
3
|
+
shortcutSettingsPath?: string;
|
|
4
|
+
onSearch?: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const ShortcutGlobalActions: ({ dashboardPath, shortcutSettingsPath, onSearch }: ShortcutGlobalActionsProps) => any;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type ShortcutRuntimeProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
dashboardPath?: string;
|
|
5
|
+
shortcutSettingsPath?: string;
|
|
6
|
+
onSearch?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const ShortcutRuntime: ({ children, dashboardPath, shortcutSettingsPath, onSearch }: ShortcutRuntimeProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ShortcutActionId } from '../core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type ShortcutTooltipPlacement = 'auto' | 'top' | 'bottom' | 'left' | 'right';
|
|
4
|
+
type ShortcutTooltipProps = {
|
|
5
|
+
actionId: ShortcutActionId;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
placement?: ShortcutTooltipPlacement;
|
|
8
|
+
};
|
|
9
|
+
/** ADMIN UI adapter for rendering the effective shortcut hint with Reactstrap. */
|
|
10
|
+
export declare const ShortcutTooltip: ({ actionId, children, placement }: ShortcutTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|