@sg-front-core/ui-v1 1.0.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/core-ui.js +4486 -0
- package/dist/core-ui.js.map +1 -0
- package/dist/core-ui.umd.cjs +297 -0
- package/dist/core-ui.umd.cjs.map +1 -0
- package/dist/types.d.ts +238 -0
- package/package.json +58 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
5
|
+
import { SegmentedLabeledOption } from 'antd/es/segmented';
|
|
6
|
+
import { SegmentedValue } from 'antd/es/segmented';
|
|
7
|
+
import { SVGAttributes } from 'react';
|
|
8
|
+
import { TooltipPlacement } from 'antd/es/tooltip';
|
|
9
|
+
|
|
10
|
+
export declare type AppContextLike = Record<string, any>;
|
|
11
|
+
|
|
12
|
+
export declare const closeTab: (payload: TabClosePayload) => void;
|
|
13
|
+
|
|
14
|
+
declare const dispatchEvent_2: (eventName: string, payload?: unknown) => void;
|
|
15
|
+
export { dispatchEvent_2 as dispatchEvent }
|
|
16
|
+
|
|
17
|
+
export declare function EmptyMask(props: EmptyMaskProps): JSX_2.Element | null;
|
|
18
|
+
|
|
19
|
+
export declare type EmptyMaskProps = {
|
|
20
|
+
show: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: default_2.CSSProperties;
|
|
23
|
+
children?: default_2.ReactNode;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export declare type EncryptFn = (plaintext: string) => string;
|
|
27
|
+
|
|
28
|
+
export declare class ErrorBoundary extends default_2.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
29
|
+
state: ErrorBoundaryState;
|
|
30
|
+
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
|
|
31
|
+
static getDerivedStateFromProps(props: ErrorBoundaryProps, state: ErrorBoundaryState): {
|
|
32
|
+
hasError: false;
|
|
33
|
+
error: null;
|
|
34
|
+
prevResetKeys: unknown[] | undefined;
|
|
35
|
+
} | null;
|
|
36
|
+
componentDidCatch(error: Error): void;
|
|
37
|
+
reset: () => void;
|
|
38
|
+
render(): string | number | boolean | Iterable<default_2.ReactNode> | JSX_2.Element | null | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare type ErrorBoundaryFallbackRender = (args: {
|
|
42
|
+
error: Error;
|
|
43
|
+
reset: () => void;
|
|
44
|
+
}) => default_2.ReactNode;
|
|
45
|
+
|
|
46
|
+
export declare type ErrorBoundaryProps = {
|
|
47
|
+
children: default_2.ReactNode;
|
|
48
|
+
fallback?: default_2.ReactNode;
|
|
49
|
+
fallbackRender?: ErrorBoundaryFallbackRender;
|
|
50
|
+
resetKeys?: unknown[];
|
|
51
|
+
onError?: (error: Error) => void;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
declare type ErrorBoundaryState = {
|
|
55
|
+
hasError: boolean;
|
|
56
|
+
error: Error | null;
|
|
57
|
+
prevResetKeys: unknown[] | undefined;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare type ExtraElement = default_2.ReactElement;
|
|
61
|
+
|
|
62
|
+
export declare function FormItemHoc(Component: WrappedComponent, extraElement: ExtraElement): (props: any) => JSX_2.Element;
|
|
63
|
+
|
|
64
|
+
export declare function getSgTemplateAppContext<T extends AppContextLike = AppContextLike>(): T;
|
|
65
|
+
|
|
66
|
+
export declare function getSgTemplateEncrypt(): EncryptFn;
|
|
67
|
+
|
|
68
|
+
export declare function getSgTemplateLocal<T extends UiLocalLike = UiLocalLike>(): T;
|
|
69
|
+
|
|
70
|
+
export declare function getSgTemplateRequest(): RequestFn;
|
|
71
|
+
|
|
72
|
+
export declare const Home: FC;
|
|
73
|
+
|
|
74
|
+
export declare function Iconfont(props: IconfontProps): JSX_2.Element;
|
|
75
|
+
|
|
76
|
+
export declare type IconfontProps = default_2.SVGProps<SVGSVGElement> & {
|
|
77
|
+
icon: string;
|
|
78
|
+
size?: number;
|
|
79
|
+
loading?: boolean;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 注入 iconfont 的 SVG sprite 字符串(由 iconfont 脚本产物提供)。
|
|
84
|
+
* - 传入完整的 `<svg>...</svg>` 字符串
|
|
85
|
+
* - 可通过 `id` 控制重复注入
|
|
86
|
+
*/
|
|
87
|
+
export declare function injectIconSprite(svgSprite: string, options?: InjectIconSpriteOptions): void;
|
|
88
|
+
|
|
89
|
+
export declare type InjectIconSpriteOptions = {
|
|
90
|
+
/** 默认插入到 body 开头 */
|
|
91
|
+
position?: 'prepend' | 'append';
|
|
92
|
+
/** 避免重复注入 */
|
|
93
|
+
id?: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export declare function LoadingMask(props: LoadingMaskProps): JSX_2.Element | null;
|
|
97
|
+
|
|
98
|
+
export declare type LoadingMaskProps = {
|
|
99
|
+
show: boolean;
|
|
100
|
+
isFirst: boolean;
|
|
101
|
+
width?: number;
|
|
102
|
+
height?: number;
|
|
103
|
+
className?: string;
|
|
104
|
+
style?: default_2.CSSProperties;
|
|
105
|
+
/** 遮罩层内容(如自定义 skeleton/背景) */
|
|
106
|
+
children?: default_2.ReactNode;
|
|
107
|
+
/** 过渡时长(ms),默认 180 */
|
|
108
|
+
durationMs?: number;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export declare const Loginew: () => JSX_2.Element;
|
|
112
|
+
|
|
113
|
+
export declare function LowcodeCommon(): JSX_2.Element;
|
|
114
|
+
|
|
115
|
+
export declare function LowcodeFlow(): JSX_2.Element;
|
|
116
|
+
|
|
117
|
+
export declare function NotFound(): JSX_2.Element;
|
|
118
|
+
|
|
119
|
+
export declare const openTab: (payload: TabOpenPayload) => void;
|
|
120
|
+
|
|
121
|
+
export declare function PopConfirm(props: PopConfirmProps): JSX_2.Element;
|
|
122
|
+
|
|
123
|
+
export declare type PopConfirmProps = {
|
|
124
|
+
children: default_2.ReactNode;
|
|
125
|
+
title: string;
|
|
126
|
+
onConfirm?: () => void | Promise<void>;
|
|
127
|
+
onCancel?: () => void | Promise<void>;
|
|
128
|
+
placement?: TooltipPlacement;
|
|
129
|
+
okText?: string;
|
|
130
|
+
cancelText?: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
declare type Props<T extends SegmentedValue> = {
|
|
134
|
+
value?: T;
|
|
135
|
+
onChange?: (value: T) => void;
|
|
136
|
+
options: (SegmentedValue | SegmentedLabeledOption)[];
|
|
137
|
+
initialValue?: T;
|
|
138
|
+
extra?: default_2.ReactNode;
|
|
139
|
+
disabled?: boolean;
|
|
140
|
+
disabledText?: string;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export declare const reloadTab: () => void;
|
|
144
|
+
|
|
145
|
+
export declare type RequestFn = <T = unknown>(config: {
|
|
146
|
+
url: string;
|
|
147
|
+
method?: string;
|
|
148
|
+
headers?: Record<string, unknown> | undefined;
|
|
149
|
+
params?: unknown;
|
|
150
|
+
data?: unknown;
|
|
151
|
+
}) => Promise<T>;
|
|
152
|
+
|
|
153
|
+
export declare type RoutePayload = {
|
|
154
|
+
url?: string;
|
|
155
|
+
params?: any;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export declare const routeTo: (payload: RoutePayload) => void;
|
|
159
|
+
|
|
160
|
+
export declare function Search({ onChange, placeholder, className }: SearchProps): JSX_2.Element;
|
|
161
|
+
|
|
162
|
+
export declare interface SearchProps {
|
|
163
|
+
onChange: (value: string) => void;
|
|
164
|
+
placeholder: string;
|
|
165
|
+
className?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export declare function SegmentedStatus<T extends SegmentedValue>(props: Props<T>): JSX_2.Element;
|
|
169
|
+
|
|
170
|
+
export declare function setupSgTemplateUI(options: SetupSgTemplateUIOptions): void;
|
|
171
|
+
|
|
172
|
+
export declare type SetupSgTemplateUIOptions = {
|
|
173
|
+
useSystemStore: UseSystemStoreHook;
|
|
174
|
+
local: UiLocalLike;
|
|
175
|
+
request: RequestFn;
|
|
176
|
+
encrypt: EncryptFn;
|
|
177
|
+
appContext?: AppContextLike;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* SVG 组件:
|
|
182
|
+
* svg 文件放在 `src/assets/icons` 下
|
|
183
|
+
* name 对应 `src/assets/icons` 下的 `目录-文件名`
|
|
184
|
+
*/
|
|
185
|
+
export declare const SvgIcon: default_2.FC<SvgIconProps<SVGSVGElement>>;
|
|
186
|
+
|
|
187
|
+
export declare interface SvgIconProps<T> extends SVGAttributes<T> {
|
|
188
|
+
className?: string;
|
|
189
|
+
style?: CSSProperties;
|
|
190
|
+
prefix?: string;
|
|
191
|
+
/** [dir]-[name] */
|
|
192
|
+
name: string;
|
|
193
|
+
color?: string;
|
|
194
|
+
size?: number | string;
|
|
195
|
+
width?: number | string;
|
|
196
|
+
height?: number | string;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export declare const TAB_EVENTS: {
|
|
200
|
+
readonly CLOSE: "CLOSETABPANE";
|
|
201
|
+
readonly OPEN: "OPENTABPANE";
|
|
202
|
+
readonly ROUTE: "ROUTE";
|
|
203
|
+
readonly RELOAD: "RELOADTAB";
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export declare type TabClosePayload = {
|
|
207
|
+
closeAll?: boolean;
|
|
208
|
+
jumpToHome?: boolean;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export declare type TabOpenPayload = {
|
|
212
|
+
key?: string;
|
|
213
|
+
pageCode?: string;
|
|
214
|
+
query?: string;
|
|
215
|
+
params?: any;
|
|
216
|
+
newWindow?: boolean;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export declare function TransitionFilter({ show, children }: TransitionFilterProps): JSX_2.Element;
|
|
220
|
+
|
|
221
|
+
export declare interface TransitionFilterProps {
|
|
222
|
+
show: boolean;
|
|
223
|
+
children: default_2.ReactNode;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export declare type UiLocalLike = Record<string, any>;
|
|
227
|
+
|
|
228
|
+
export declare function useEvent(eventName: string, handler: (payload: any) => void): void;
|
|
229
|
+
|
|
230
|
+
export declare const UserInfo: () => JSX_2.Element;
|
|
231
|
+
|
|
232
|
+
export declare function useSgSystemStore<T = any>(): T;
|
|
233
|
+
|
|
234
|
+
export declare type UseSystemStoreHook = () => any;
|
|
235
|
+
|
|
236
|
+
declare type WrappedComponent = default_2.FC;
|
|
237
|
+
|
|
238
|
+
export { }
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sg-front-core/ui-v1",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"main": "./dist/core-ui.umd.cjs",
|
|
9
|
+
"module": "./dist/core-ui.js",
|
|
10
|
+
"types": "./dist/types.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/types.d.ts",
|
|
14
|
+
"import": "./dist/core-ui.js",
|
|
15
|
+
"require": "./dist/core-ui.umd.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"browserslist": [
|
|
19
|
+
"> 0.2%",
|
|
20
|
+
"not dead",
|
|
21
|
+
"mot op_mini all"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": ">=18.2.0",
|
|
25
|
+
"react-dom": ">=18.2.0",
|
|
26
|
+
"antd": ">=5.0.0",
|
|
27
|
+
"@ant-design/icons": ">=5.0.0",
|
|
28
|
+
"react-router-dom": ">=6.9.0",
|
|
29
|
+
"sg-lowcode-parser": ">=0.1.0",
|
|
30
|
+
"@sg-front-core/utils-v1": ">=1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=20.19.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"clsx": "^2.1.1",
|
|
37
|
+
"@ant-design/icons": "^5.1.4",
|
|
38
|
+
"@headlessui/react": "^1.7.15",
|
|
39
|
+
"@icon-park/react": "^1.4.2",
|
|
40
|
+
"@types/lodash-es": "^4.17.12",
|
|
41
|
+
"@types/react": "^18.3.27",
|
|
42
|
+
"@types/react-dom": "^18.3.7",
|
|
43
|
+
"ahooks": "^3.9.6",
|
|
44
|
+
"antd": "^5.24.3",
|
|
45
|
+
"dayjs": "^1.11.19",
|
|
46
|
+
"lodash-es": "^4.17.22",
|
|
47
|
+
"react-router-dom": "^6.30.3",
|
|
48
|
+
"sg-lowcode-parser": "^0.1.61",
|
|
49
|
+
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"@sg-front-core/utils-v1": "1.0.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"dev": "vite",
|
|
55
|
+
"build": "tsc && vite build",
|
|
56
|
+
"build:watch": "vite build --watch"
|
|
57
|
+
}
|
|
58
|
+
}
|