vap1 0.2.0 → 0.2.1
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/package.json +1 -1
- package/uform/FormViewer.d.ts +4 -4
- package/uform/FormViewer.js +6 -7
- package/utils/Global.d.ts +12 -0
- package/utils/Global.js +1 -0
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"vap1","version":"0.2.
|
|
1
|
+
{"name":"vap1","version":"0.2.1","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|
package/uform/FormViewer.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { FormSchema } from './schema';
|
|
3
|
-
import type {
|
|
2
|
+
import type { RefAttributes, ForwardRefExoticComponent, FC } from 'react';
|
|
3
|
+
import type { UModalProps, UFormRef, PlainObject } from '../index';
|
|
4
4
|
type ModalProps = Pick<UModalProps, 'open' | 'onOk' | 'onCancel' | 'title' | 'data'>;
|
|
5
5
|
type FormViewProps = {
|
|
6
6
|
schema: FormSchema | string;
|
|
7
7
|
data?: PlainObject;
|
|
8
8
|
};
|
|
9
9
|
export declare const initSchama: (data: string | FormSchema) => FormSchema;
|
|
10
|
-
export declare const FormViewer:
|
|
11
|
-
export declare const FormModal:
|
|
10
|
+
export declare const FormViewer: ForwardRefExoticComponent<FormViewProps & RefAttributes<UFormRef>>;
|
|
11
|
+
export declare const FormModal: FC<FormViewProps & ModalProps>;
|
|
12
12
|
export {};
|
package/uform/FormViewer.js
CHANGED
|
@@ -49,21 +49,20 @@ const initSchama = (data) => {
|
|
|
49
49
|
return DEFAULT;
|
|
50
50
|
};
|
|
51
51
|
exports.initSchama = initSchama;
|
|
52
|
-
const _FormRender = props => {
|
|
52
|
+
const _FormRender = (0, react_1.forwardRef)((props, ref) => {
|
|
53
53
|
const uformProps = (0, react_1.useMemo)(() => (0, Convert_1.schemaToForm)(props.schema), [props]);
|
|
54
|
-
return react_1.default.createElement(index_1.UForm, Object.assign({}, uformProps, { data: props.data }));
|
|
55
|
-
};
|
|
54
|
+
return react_1.default.createElement(index_1.UForm, Object.assign({}, uformProps, { data: props.data, ref: ref }));
|
|
55
|
+
});
|
|
56
56
|
const _ModalRender = props => {
|
|
57
57
|
const uformProps = (0, react_1.useMemo)(() => (0, Convert_1.schemaToForm)(props.schema), [props]);
|
|
58
58
|
let modalProps = {};
|
|
59
59
|
modalProps.title = props.title || props.schema.title || '';
|
|
60
60
|
return react_1.default.createElement(index_1.UFormModal, Object.assign({}, uformProps, modalProps, { data: props.data, open: props.open, onOk: props.onOk, onCancel: props.onCancel }));
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
exports.FormViewer = (0, react_1.forwardRef)((props, ref) => {
|
|
63
63
|
const schema = (0, react_1.useMemo)(() => (0, exports.initSchama)(props.schema), [props.schema]);
|
|
64
|
-
return react_1.default.createElement(_FormRender, { schema: schema, data: props.data });
|
|
65
|
-
};
|
|
66
|
-
exports.FormViewer = FormViewer;
|
|
64
|
+
return react_1.default.createElement(_FormRender, { schema: schema, data: props.data, ref: ref });
|
|
65
|
+
});
|
|
67
66
|
const FormModal = props => {
|
|
68
67
|
const schema = (0, react_1.useMemo)(() => (0, exports.initSchama)(props.schema), [props.schema]);
|
|
69
68
|
return react_1.default.createElement(_ModalRender, Object.assign({}, props, { schema: schema }));
|
package/utils/Global.d.ts
CHANGED
|
@@ -16,8 +16,20 @@ export type GlobalSetting = {
|
|
|
16
16
|
* 应用相关参数:
|
|
17
17
|
*/
|
|
18
18
|
APP: {
|
|
19
|
+
/**
|
|
20
|
+
* 默认语言,默认简体中文
|
|
21
|
+
*/
|
|
19
22
|
LANG: Language;
|
|
23
|
+
/**
|
|
24
|
+
* 显示:回到首页,默认为 true
|
|
25
|
+
*/
|
|
26
|
+
USER_MENU_HOMEPAGE: boolean;
|
|
20
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* 基础API设置,
|
|
30
|
+
* 说明,如果只是前缀与通用版不同,则只需设置 PREFIX 即可,
|
|
31
|
+
* 其它还有不同的可单独设置
|
|
32
|
+
*/
|
|
21
33
|
BASIC: {
|
|
22
34
|
PREFIX: string;
|
|
23
35
|
SYSTEM: string;
|