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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
- Initial standalone package extracted from the verified ADMIN embedded module.
|
|
6
|
+
- Includes Setting runtime and `SettingsPage`.
|
|
7
|
+
- Includes Shortcut runtime and `ShortcutsPage` with the 54-action default catalog.
|
|
8
|
+
- Includes JSON import/export for Setting management.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ES
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# es-application-template
|
|
2
|
+
|
|
3
|
+
Shared Setting and Shortcut infrastructure for ES applications.
|
|
4
|
+
|
|
5
|
+
The package layout/build convention follows `client/es-document-template`: `src/index.tsx`, `src/package/index.ts`, `rollup.config.mjs`, one package `tsconfig.json`, CJS + ESM + declaration + extracted CSS output.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install es-application-template
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Host applications provide the peer dependencies declared in `package.json`, including React 18, TanStack React Query and `es-grid-template >=1.9.72 <2`.
|
|
14
|
+
|
|
15
|
+
Package CSS is emitted at:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
dist/styles/index.css
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Provider
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { AppProvider } from 'es-application-template'
|
|
25
|
+
|
|
26
|
+
<AppProvider>
|
|
27
|
+
<App />
|
|
28
|
+
</AppProvider>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The package uses the host `QueryClientProvider`; it does not create its own `QueryClient`.
|
|
32
|
+
|
|
33
|
+
## Setting
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { setting } from 'es-application-template'
|
|
37
|
+
|
|
38
|
+
const visible = setting.get(
|
|
39
|
+
'PurchaseRequest.ui.form.field.Code.visible',
|
|
40
|
+
true
|
|
41
|
+
)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The public Setting contract remains `setting.get(key[, fallback])`. No public `useSetting()` API is added.
|
|
45
|
+
|
|
46
|
+
## Shortcut
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import {
|
|
50
|
+
Shortcuts,
|
|
51
|
+
SHORTCUT_ACTION,
|
|
52
|
+
type ShortcutActions
|
|
53
|
+
} from 'es-application-template'
|
|
54
|
+
|
|
55
|
+
const actions: ShortcutActions = {
|
|
56
|
+
[SHORTCUT_ACTION.RECORD_EDIT]: {
|
|
57
|
+
handler: handleEdit,
|
|
58
|
+
enabled: canEdit
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
<Shortcuts actions={actions} />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Management pages
|
|
66
|
+
|
|
67
|
+
The management screens stay independent:
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import {
|
|
71
|
+
SettingsPage,
|
|
72
|
+
ShortcutsPage
|
|
73
|
+
} from 'es-application-template'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The host owns routing/menu placement. These are full management pages, not modal content.
|
|
77
|
+
|
|
78
|
+
## Public API
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
AppProvider
|
|
82
|
+
|
|
83
|
+
setting
|
|
84
|
+
SettingsPage
|
|
85
|
+
|
|
86
|
+
ShortcutsPage
|
|
87
|
+
Shortcuts
|
|
88
|
+
SHORTCUT_ACTION
|
|
89
|
+
ShortcutTooltip
|
|
90
|
+
ShortcutOverlayScope
|
|
91
|
+
useShortcutHint
|
|
92
|
+
|
|
93
|
+
ShortcutActionId
|
|
94
|
+
ShortcutActions
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Deliberate differences from es-document-template
|
|
98
|
+
|
|
99
|
+
The package follows its package/build skeleton, but does not copy unrelated document dependencies. In particular this package does not use:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
@esvndev/becoxy-ui
|
|
103
|
+
@syncfusion/ej2-react-dropdowns
|
|
104
|
+
react-custom-scrollbars
|
|
105
|
+
rollup-plugin-dts
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The Setting Feature tree selector is package-owned and implemented with `react-select` while preserving hierarchy/search/expand-collapse behavior.
|
|
109
|
+
|
|
110
|
+
## Build
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
yarn install
|
|
114
|
+
yarn typecheck
|
|
115
|
+
yarn test
|
|
116
|
+
yarn build
|
|
117
|
+
npm pack
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Expected output:
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
dist/index.js
|
|
124
|
+
dist/index.mjs
|
|
125
|
+
dist/index.d.ts
|
|
126
|
+
dist/styles/index.css
|
|
127
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IConfig, IParamsConfigByCode } from '../domain/models/IConfig';
|
|
2
|
+
import { IFListBoxResourceProductDeployParams } from '../domain/models/IProductsDeploy';
|
|
3
|
+
export declare const configApi: {
|
|
4
|
+
getConfigByCodeApi: (params: IParamsConfigByCode) => Promise<any>;
|
|
5
|
+
updateApi: (params: IConfig) => Promise<any>;
|
|
6
|
+
deleteApi: (id: string) => Promise<any>;
|
|
7
|
+
};
|
|
8
|
+
export declare const settingCatalogApi: {
|
|
9
|
+
getResourceByTenantApi: (params: IFListBoxResourceProductDeployParams) => Promise<any>;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: {
|
|
12
|
+
configApi: {
|
|
13
|
+
getConfigByCodeApi: (params: IParamsConfigByCode) => Promise<any>;
|
|
14
|
+
updateApi: (params: IConfig) => Promise<any>;
|
|
15
|
+
deleteApi: (id: string) => Promise<any>;
|
|
16
|
+
};
|
|
17
|
+
settingCatalogApi: {
|
|
18
|
+
getResourceByTenantApi: (params: IFListBoxResourceProductDeployParams) => Promise<any>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Control, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
export type SwitchInputProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
4
|
+
control?: Control<TFieldValues>;
|
|
5
|
+
name?: Path<TFieldValues>;
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
value?: boolean;
|
|
11
|
+
onChange?: (checked: boolean) => void;
|
|
12
|
+
callback?: (checked: boolean) => void;
|
|
13
|
+
rules?: RegisterOptions<TFieldValues>;
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
suffix?: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
inputClassName?: string;
|
|
18
|
+
labelClassName?: string;
|
|
19
|
+
descriptionClassName?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
declare const SwitchInput: <TFieldValues extends FieldValues = FieldValues>({ control, name, label, description, disabled, checked, value, onChange, callback, rules, compact, suffix, className, inputClassName, labelClassName, descriptionClassName, id, ...rest }: SwitchInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export default SwitchInput;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { InputType } from 'reactstrap/types/lib/Input';
|
|
2
|
+
type ControlledTextValue = string | number | readonly string[] | undefined;
|
|
3
|
+
type TextInputProps = {
|
|
4
|
+
control?: any;
|
|
5
|
+
name?: string;
|
|
6
|
+
type?: InputType;
|
|
7
|
+
label?: string;
|
|
8
|
+
labelClassName?: string;
|
|
9
|
+
labelSize?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
errors?: any;
|
|
12
|
+
classes?: string;
|
|
13
|
+
height?: number | string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
row?: number;
|
|
16
|
+
isLabel?: boolean;
|
|
17
|
+
inLine?: boolean;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
widthInput?: number | string;
|
|
20
|
+
AlignRight?: boolean;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
callback?: (event: any) => void;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
handleBlur?: (value: string) => void;
|
|
25
|
+
description?: string;
|
|
26
|
+
rules?: any;
|
|
27
|
+
value?: ControlledTextValue;
|
|
28
|
+
onChange?: (value: string) => void;
|
|
29
|
+
size?: 'sm' | 'lg';
|
|
30
|
+
id?: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
declare const TextInput: ({ control, name, type, label, labelClassName, labelSize, required, errors, classes, height, disabled, row, isLabel, inLine, autoFocus, widthInput, AlignRight, placeholder, callback, readOnly, handleBlur, description, rules, value, onChange, size, id, className, ...rest }: TextInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export default TextInput;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type SelectOption = {
|
|
2
|
+
value: any;
|
|
3
|
+
label: string;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
type SelectBoxProps = {
|
|
7
|
+
control?: any;
|
|
8
|
+
name?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
options: SelectOption[];
|
|
12
|
+
label?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
isLabel?: boolean;
|
|
15
|
+
labelSize?: string;
|
|
16
|
+
classes?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
errors?: any;
|
|
19
|
+
isMulti?: boolean;
|
|
20
|
+
isClearable?: boolean;
|
|
21
|
+
labelComponent?: any;
|
|
22
|
+
callback?: (option: any) => void;
|
|
23
|
+
onInputChange?: any;
|
|
24
|
+
fieldValue?: string;
|
|
25
|
+
inLine?: boolean;
|
|
26
|
+
selectRef?: any;
|
|
27
|
+
menuPosition?: 'fixed' | 'absolute';
|
|
28
|
+
rules?: any;
|
|
29
|
+
value?: any;
|
|
30
|
+
onChange?: (value: any) => void;
|
|
31
|
+
className?: string;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
declare const SelectBox: ({ control, name, placeholder, disabled, options, label, description, isLabel, labelSize, classes, required, errors, isMulti, isClearable, labelComponent, callback, onInputChange, fieldValue, inLine, selectRef, menuPosition, rules, value, onChange, className, ...rest }: SelectBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export default SelectBox;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface IFDataProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
children: any;
|
|
4
|
+
toggleSidebar: any;
|
|
5
|
+
width?: string | number;
|
|
6
|
+
keyboard?: boolean;
|
|
7
|
+
hiddenBackground?: boolean;
|
|
8
|
+
hiddenFullScreenButton?: boolean;
|
|
9
|
+
backdropClassName?: string;
|
|
10
|
+
panelClassName?: string;
|
|
11
|
+
zIndex?: number;
|
|
12
|
+
}
|
|
13
|
+
declare const Sidebar: (props: IFDataProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default Sidebar;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const CONFIG_CACHE_POLICY: {
|
|
2
|
+
readonly FEATURE_FLAG: {
|
|
3
|
+
readonly staleTime: number;
|
|
4
|
+
readonly gcTime: number;
|
|
5
|
+
readonly persist: false;
|
|
6
|
+
readonly localStorageTtl: 0;
|
|
7
|
+
readonly refetchOnWindowFocus: true;
|
|
8
|
+
readonly refetchOnReconnect: true;
|
|
9
|
+
};
|
|
10
|
+
readonly SECURITY: {
|
|
11
|
+
readonly staleTime: number;
|
|
12
|
+
readonly gcTime: number;
|
|
13
|
+
readonly persist: false;
|
|
14
|
+
readonly localStorageTtl: 0;
|
|
15
|
+
readonly refetchOnWindowFocus: true;
|
|
16
|
+
readonly refetchOnReconnect: true;
|
|
17
|
+
};
|
|
18
|
+
readonly PRODUCT_RUNTIME: {
|
|
19
|
+
readonly staleTime: number;
|
|
20
|
+
readonly gcTime: number;
|
|
21
|
+
readonly persist: true;
|
|
22
|
+
readonly localStorageTtl: number;
|
|
23
|
+
readonly refetchOnWindowFocus: false;
|
|
24
|
+
readonly refetchOnReconnect: true;
|
|
25
|
+
};
|
|
26
|
+
readonly SETTING: {
|
|
27
|
+
readonly staleTime: number;
|
|
28
|
+
readonly gcTime: number;
|
|
29
|
+
readonly persist: false;
|
|
30
|
+
readonly localStorageTtl: 0;
|
|
31
|
+
readonly refetchOnWindowFocus: true;
|
|
32
|
+
readonly refetchOnReconnect: true;
|
|
33
|
+
};
|
|
34
|
+
readonly APPEARANCE: {
|
|
35
|
+
readonly staleTime: number;
|
|
36
|
+
readonly gcTime: number;
|
|
37
|
+
readonly persist: true;
|
|
38
|
+
readonly localStorageTtl: any;
|
|
39
|
+
readonly refetchOnWindowFocus: true;
|
|
40
|
+
readonly refetchOnReconnect: true;
|
|
41
|
+
};
|
|
42
|
+
readonly USER_PREFERENCE: {
|
|
43
|
+
readonly staleTime: number;
|
|
44
|
+
readonly gcTime: number;
|
|
45
|
+
readonly persist: true;
|
|
46
|
+
readonly localStorageTtl: number;
|
|
47
|
+
readonly refetchOnWindowFocus: false;
|
|
48
|
+
readonly refetchOnReconnect: true;
|
|
49
|
+
};
|
|
50
|
+
readonly USER_FREQUENT: {
|
|
51
|
+
readonly staleTime: number;
|
|
52
|
+
readonly gcTime: number;
|
|
53
|
+
readonly persist: true;
|
|
54
|
+
readonly localStorageTtl: number;
|
|
55
|
+
readonly refetchOnWindowFocus: true;
|
|
56
|
+
readonly refetchOnReconnect: true;
|
|
57
|
+
};
|
|
58
|
+
readonly ADMIN_RARE: {
|
|
59
|
+
readonly staleTime: number;
|
|
60
|
+
readonly gcTime: number;
|
|
61
|
+
readonly persist: false;
|
|
62
|
+
readonly localStorageTtl: 0;
|
|
63
|
+
readonly refetchOnWindowFocus: false;
|
|
64
|
+
readonly refetchOnReconnect: true;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type ConfigCachePolicyName = keyof typeof CONFIG_CACHE_POLICY;
|
|
68
|
+
export declare const configQueryKeys: {
|
|
69
|
+
byCodeRoot: (code: string) => readonly [string, string];
|
|
70
|
+
byCode: (code: string, productCode?: string | null, userId?: string | null) => readonly [string, string, string, string];
|
|
71
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigCachePolicyName } from './config-cache';
|
|
2
|
+
type UseConfigDocumentOptions = {
|
|
3
|
+
productCode?: string | null;
|
|
4
|
+
userId?: string | null;
|
|
5
|
+
policy?: ConfigCachePolicyName;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const useConfigDocument: <T extends Record<string, unknown>>(code: string, defaults: T, name?: string, normalize?: (value: T) => T, options?: UseConfigDocumentOptions) => {
|
|
9
|
+
value: T;
|
|
10
|
+
setValue: (next: T) => void;
|
|
11
|
+
patch: <K extends keyof T>(key: K, next: T[K]) => void;
|
|
12
|
+
save: (nextValue?: T) => Promise<boolean>;
|
|
13
|
+
reset: () => Promise<boolean>;
|
|
14
|
+
retry: () => Promise<void>;
|
|
15
|
+
discard: () => T;
|
|
16
|
+
ready: boolean;
|
|
17
|
+
loading: boolean;
|
|
18
|
+
fetching: boolean;
|
|
19
|
+
error: Error;
|
|
20
|
+
saving: boolean;
|
|
21
|
+
dirty: boolean;
|
|
22
|
+
remoteId: string;
|
|
23
|
+
exists: boolean;
|
|
24
|
+
dataMode: string;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IConfigIdentity } from '../domain/models/IConfig';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
export type ConfigSnapshot<T> = {
|
|
4
|
+
version: number;
|
|
5
|
+
code: string;
|
|
6
|
+
productCode: string | null;
|
|
7
|
+
userId: string | null;
|
|
8
|
+
cachedAt: number;
|
|
9
|
+
value: T;
|
|
10
|
+
};
|
|
11
|
+
export declare const saveConfigSnapshot: <T>(code: string, identity: IConfigIdentity, value: T) => void;
|
|
12
|
+
export declare const loadConfigSnapshot: <T>(code: string, identity: IConfigIdentity, ttl?: number | null) => ConfigSnapshot<T> | null;
|
|
13
|
+
export declare const removeConfigSnapshot: (code: string, identity: IConfigIdentity) => void;
|
|
14
|
+
export declare const removeUserConfigSnapshots: (userId?: string | null) => void;
|
|
15
|
+
export declare const registerConfigStorageSync: (queryClient: QueryClient) => () => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IConfig } from '../domain/models/IConfig';
|
|
2
|
+
export declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
3
|
+
export declare const unwrapConfig: (response: unknown) => IConfig | undefined;
|
|
4
|
+
export declare const deepMerge: <T>(defaults: T, stored: unknown) => T;
|
|
5
|
+
export declare const parseConfigValue: <T>(serialized: string | null | undefined, defaults: T) => T;
|
|
6
|
+
export declare const businessSucceeded: (response: unknown) => boolean;
|
|
7
|
+
export declare const getHttpStatus: (error: unknown) => number | undefined;
|
|
8
|
+
export declare const buildConfigOverride: (baseValue?: string | null, currentValue?: string | null) => string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IConfig } from '../domain/models/IConfig';
|
|
2
|
+
export declare const isSystemSettingsMockMode: () => boolean;
|
|
3
|
+
export declare const mockConfigStore: {
|
|
4
|
+
get(code: string, productCode?: string | null, userId?: string | null): Promise<IConfig | undefined>;
|
|
5
|
+
save(payload: IConfig): Promise<IConfig & {
|
|
6
|
+
isValid: true;
|
|
7
|
+
}>;
|
|
8
|
+
remove(code: string, productCode?: string | null, userId?: string | null): Promise<{
|
|
9
|
+
isValid: true;
|
|
10
|
+
}>;
|
|
11
|
+
listByPrefix(prefix: string): Promise<IConfig[]>;
|
|
12
|
+
removeById(id: string): Promise<{
|
|
13
|
+
isValid: true;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
export declare const mockEntityStore: {
|
|
17
|
+
ensure<T extends {
|
|
18
|
+
id: string;
|
|
19
|
+
}>(key: string, initial: T[]): void;
|
|
20
|
+
list<T extends {
|
|
21
|
+
id: string;
|
|
22
|
+
}>(key: string): Promise<T[]>;
|
|
23
|
+
create<T extends {
|
|
24
|
+
id: string;
|
|
25
|
+
}>(key: string, row: T): Promise<T & {
|
|
26
|
+
isValid: true;
|
|
27
|
+
}>;
|
|
28
|
+
update<T extends {
|
|
29
|
+
id: string;
|
|
30
|
+
}>(key: string, id: string, patch: Partial<T>): Promise<T & {
|
|
31
|
+
isValid: true;
|
|
32
|
+
}>;
|
|
33
|
+
remove(key: string, id: string): Promise<{
|
|
34
|
+
isValid: true;
|
|
35
|
+
}>;
|
|
36
|
+
reset<T extends {
|
|
37
|
+
id: string;
|
|
38
|
+
}>(key: string, rows: T[]): Promise<{
|
|
39
|
+
isValid: true;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IConfig, IConfigIdentity } from '../domain/models/IConfig';
|
|
2
|
+
import { ConfigCachePolicyName } from './config-cache';
|
|
3
|
+
type UseRuntimeConfigOptions<T> = {
|
|
4
|
+
code: string;
|
|
5
|
+
defaults: T;
|
|
6
|
+
identity: IConfigIdentity;
|
|
7
|
+
policy: ConfigCachePolicyName;
|
|
8
|
+
normalize?: (value: T) => T;
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const useRuntimeConfig: <T extends Record<string, unknown>>({ code, defaults, identity, policy, normalize, enabled }: UseRuntimeConfigOptions<T>) => {
|
|
12
|
+
value: T;
|
|
13
|
+
ready: boolean;
|
|
14
|
+
config: IConfig;
|
|
15
|
+
loading: false;
|
|
16
|
+
fetching: boolean;
|
|
17
|
+
error: Error;
|
|
18
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<any, Error>>;
|
|
19
|
+
dataMode: string;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const BASE_URL: string;
|
|
2
|
+
export declare const PRODUCTDEPLOY: {
|
|
3
|
+
URL_API: {
|
|
4
|
+
GET_RESOURCE_API: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const CONFIG: {
|
|
8
|
+
ACTION_TYPES: {
|
|
9
|
+
GET_BY_CODE: string;
|
|
10
|
+
UPDATE: string;
|
|
11
|
+
DELETE: string;
|
|
12
|
+
};
|
|
13
|
+
URL_API: {
|
|
14
|
+
GET_BY_CODE_API: string;
|
|
15
|
+
UPDATE_API: string;
|
|
16
|
+
DELETE_API: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface IConfig {
|
|
2
|
+
id?: string | null;
|
|
3
|
+
code: string;
|
|
4
|
+
name?: string | null;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
value?: string | null;
|
|
7
|
+
status?: number | null;
|
|
8
|
+
displayOrder?: number | null;
|
|
9
|
+
groupId?: string | null;
|
|
10
|
+
groupName?: string | null;
|
|
11
|
+
createdBy?: string | null;
|
|
12
|
+
createdDate?: string | null;
|
|
13
|
+
updatedBy?: string | null;
|
|
14
|
+
updatedDate?: string | null;
|
|
15
|
+
updatedByName?: string | null;
|
|
16
|
+
createdByName?: string | null;
|
|
17
|
+
productCode?: string | null;
|
|
18
|
+
userId?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export type IParamsConfigByCode = {
|
|
21
|
+
code: string;
|
|
22
|
+
productCode?: string | null;
|
|
23
|
+
userId?: string | null;
|
|
24
|
+
};
|
|
25
|
+
export type IConfigIdentity = {
|
|
26
|
+
productCode: string | null;
|
|
27
|
+
userId: string | null;
|
|
28
|
+
};
|
package/dist/index.d.ts
ADDED