vap1 0.1.2 → 0.1.4
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/components/Box/Box.js +8 -5
- package/components/Box/SelectBar.js +1 -1
- package/components/Tables/ApiTable.js +2 -6
- package/components/Tables/ApiTableModal.js +1 -1
- package/components/Tables/VTable.js +25 -27
- package/components/Tables/index.d.ts +1 -1
- package/components/Trees/ActionTree.d.ts +5 -7
- package/components/Trees/ActionTree.js +10 -14
- package/components/Trees/DTree.d.ts +3 -3
- package/components/Trees/FTree.d.ts +6 -4
- package/components/Trees/index.d.ts +2 -2
- package/components/UForm/UForm.d.ts +2 -2
- package/components/UForm/UForm.js +21 -27
- package/components/UForm/UFormModal.js +1 -4
- package/components/UForm/index.d.ts +1 -1
- package/components/_adapt/Col.js +3 -1
- package/components/_adapt/Input.d.ts +2 -2
- package/components/_adapt/Input.js +11 -1
- package/components/_adapt/Row.js +1 -1
- package/components/_setup/SelectBar/SelectTree.js +25 -5
- package/deps/_editor/tools/_TxtButton.js +1 -1
- package/index.d.ts +3 -2
- package/package.json +1 -1
- package/screen/render.js +0 -1
package/components/Box/Box.js
CHANGED
|
@@ -64,7 +64,7 @@ const BoxContext = (0, react_1.createContext)(null);
|
|
|
64
64
|
* */
|
|
65
65
|
const useBox = () => (0, react_1.useContext)(BoxContext);
|
|
66
66
|
exports.useBox = useBox;
|
|
67
|
-
exports.Box = react_1.
|
|
67
|
+
exports.Box = (0, react_1.forwardRef)((props, ref) => {
|
|
68
68
|
const app = (0, hooks_1.useApp)();
|
|
69
69
|
const [state, setState] = (0, hooks_1.useSetState)(null);
|
|
70
70
|
const _layoutRef = (0, react_1.useRef)(null); // 向下兼容
|
|
@@ -96,6 +96,11 @@ exports.Box = react_1.default.forwardRef((props, ref) => {
|
|
|
96
96
|
style.height = '100%';
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
+
(0, react_1.useEffect)(() => {
|
|
100
|
+
if (state && state.height && contextRef && contextRef.current) {
|
|
101
|
+
contextRef.current.style.height = (state.height + 'px');
|
|
102
|
+
}
|
|
103
|
+
}, [state === null || state === void 0 ? void 0 : state.height]);
|
|
99
104
|
const resize = () => {
|
|
100
105
|
if (props.mode == undefined || props.mode == 'common' || app == null) {
|
|
101
106
|
if (state === null)
|
|
@@ -125,11 +130,9 @@ exports.Box = react_1.default.forwardRef((props, ref) => {
|
|
|
125
130
|
document.body.classList.remove('v-resizing');
|
|
126
131
|
};
|
|
127
132
|
(0, react_1.useEffect)(() => { setTimeout(resize, 2); }, [app === null || app === void 0 ? void 0 : app.theme.contentHeight]);
|
|
133
|
+
(0, react_1.useImperativeHandle)(ref, () => ({ resize }), []);
|
|
128
134
|
(0, react_1.useLayoutEffect)(() => {
|
|
129
|
-
|
|
130
|
-
ref.current = { resize };
|
|
131
|
-
}
|
|
132
|
-
setTimeout(resize, 1);
|
|
135
|
+
setTimeout(resize, 5);
|
|
133
136
|
}, []);
|
|
134
137
|
let paginationProps = {};
|
|
135
138
|
// if (props.pagination && props.mode == 'inner') {
|
|
@@ -35,7 +35,7 @@ const utils_1 = require("../../utils");
|
|
|
35
35
|
const _register_1 = require("./_register");
|
|
36
36
|
const Const_1 = require("../_setup/Const");
|
|
37
37
|
const Icon_1 = require("../_adapt/Icon");
|
|
38
|
-
exports.SelectBar = react_1.
|
|
38
|
+
exports.SelectBar = (0, react_1.forwardRef)((props, ref) => {
|
|
39
39
|
const [keyword, setKeyword] = (0, react_1.useState)(null);
|
|
40
40
|
const [collapsed, setCollapsed] = (0, hooks_1.useToggle)(false);
|
|
41
41
|
// const setKeyword = _.debounce(_setKeyword, 100);
|
|
@@ -27,7 +27,7 @@ exports.ApiTable = void 0;
|
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const useApi_1 = require("../../hooks/useApi");
|
|
29
29
|
const VTable_1 = require("./VTable");
|
|
30
|
-
exports.ApiTable = react_1.
|
|
30
|
+
exports.ApiTable = (0, react_1.forwardRef)((props, ref) => {
|
|
31
31
|
const option = {
|
|
32
32
|
api: props.api,
|
|
33
33
|
rowKey: props.rowKey,
|
|
@@ -39,10 +39,6 @@ exports.ApiTable = react_1.default.forwardRef((props, ref) => {
|
|
|
39
39
|
if (props.pagination && props.pagination.pageSize)
|
|
40
40
|
option.pageSize = props.pagination.pageSize;
|
|
41
41
|
const model = (0, useApi_1.useApi)(option);
|
|
42
|
-
(0, react_1.
|
|
43
|
-
if (ref) {
|
|
44
|
-
ref.current = model;
|
|
45
|
-
}
|
|
46
|
-
}, [ref]);
|
|
42
|
+
(0, react_1.useImperativeHandle)(ref, () => model, []);
|
|
47
43
|
return react_1.default.createElement(VTable_1.VTable, Object.assign({}, props, { model: model }));
|
|
48
44
|
});
|
|
@@ -36,7 +36,7 @@ const API_TABLE_PROPERTIES = [
|
|
|
36
36
|
'api', 'aop', 'tipDisabled', 'tipField',
|
|
37
37
|
'mode', 'columns', 'showIndex', 'rowKey', 'select', 'selectDisabled', 'actionBar', 'selectBar', 'searchBar', 'default', 'autoLoad'
|
|
38
38
|
];
|
|
39
|
-
exports.ApiTableModal = react_1.
|
|
39
|
+
exports.ApiTableModal = (0, react_1.forwardRef)((props, ref) => {
|
|
40
40
|
const modalProps = lodash_1.default.omit(props, API_TABLE_PROPERTIES);
|
|
41
41
|
const tableProps = lodash_1.default.pick(props, API_TABLE_PROPERTIES);
|
|
42
42
|
const [tableKey, updateKey] = (0, react_1.useState)(utils_1.StringUtil.genKey());
|
|
@@ -48,10 +48,10 @@ const getHeightByTagName = (root, tagName) => {
|
|
|
48
48
|
return 0;
|
|
49
49
|
};
|
|
50
50
|
exports.getHeightByTagName = getHeightByTagName;
|
|
51
|
-
const _VTable = react_1.
|
|
51
|
+
const _VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
52
52
|
const update = (0, hooks_1.useUpdate)();
|
|
53
53
|
const { state, root, resize } = (0, Box_1.useBox)();
|
|
54
|
-
const [scroll, setScroll] =
|
|
54
|
+
// const [scroll, setScroll] = useState<TableProps<PlainObject>['scroll']>(undefined);
|
|
55
55
|
const { rowKey, list, isQuerying, pageNo, pageSize, orderBy, query, total } = props.model;
|
|
56
56
|
let start = (0, react_1.useRef)(0);
|
|
57
57
|
const tableProps = {};
|
|
@@ -132,19 +132,18 @@ const _VTable = react_1.default.forwardRef((props, ref) => {
|
|
|
132
132
|
query(props.default || {});
|
|
133
133
|
}, []);
|
|
134
134
|
// 更新高度 table 需要把 head 排除设置滚动
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}, [state === null || state === void 0 ? void 0 : state.height]);
|
|
135
|
+
// useEffect(() => {
|
|
136
|
+
// if (props.scroll === null) return;
|
|
137
|
+
// if (props.mode == undefined || props.mode == 'common') return;
|
|
138
|
+
// let height = state?.height;
|
|
139
|
+
// if (!height) return;
|
|
140
|
+
// // VAP1.5 scroll table bug
|
|
141
|
+
// root.current.style.height = height + 'px';
|
|
142
|
+
// // setTimeout(() => {
|
|
143
|
+
// // height -= getHeightByTagName(root.current, 'thead');
|
|
144
|
+
// // setScroll({ y: Math.ceil(height), x: true })
|
|
145
|
+
// // }, 2);
|
|
146
|
+
// }, [state?.height]);
|
|
148
147
|
// @ts-ignore
|
|
149
148
|
const effectKey = props.model.effect;
|
|
150
149
|
(0, react_1.useEffect)(() => {
|
|
@@ -183,7 +182,8 @@ const _VTable = react_1.default.forwardRef((props, ref) => {
|
|
|
183
182
|
},
|
|
184
183
|
};
|
|
185
184
|
}
|
|
186
|
-
return react_1.default.createElement(Table_1.Table, Object.assign({ rowKey: props.rowKey || rowKey,
|
|
185
|
+
return react_1.default.createElement(Table_1.Table, Object.assign({ rowKey: props.rowKey || rowKey,
|
|
186
|
+
// scroll={scroll}
|
|
187
187
|
// tableLayout="fixed"
|
|
188
188
|
// showSorterTooltip={false}
|
|
189
189
|
size: utils_1.GLOBAL.CONFIG.TABLE.SIZE }, props, tableProps, { className: utils_1.StringUtil.className(['c-table'], props.className), pagination: false, columns: columns, locale: { emptyText: react_1.default.createElement(antd_1.Empty, { style: { marginTop: 24 } }) }, dataSource: list, loading: isQuerying, onChange: (x, y, field) => {
|
|
@@ -195,21 +195,19 @@ const _VTable = react_1.default.forwardRef((props, ref) => {
|
|
|
195
195
|
}
|
|
196
196
|
} }));
|
|
197
197
|
});
|
|
198
|
-
exports.VTable = react_1.
|
|
198
|
+
exports.VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
199
199
|
const { isQuerying, pageNo, pageSize, total, totalAcc, param, pageTo, query, cost } = props.model;
|
|
200
200
|
// 通过 ref 方式交互,后续扩展方法实现定制联页选择
|
|
201
201
|
const selectedRef = (0, react_1.useRef)({ selected: [[], []], onSelected: () => { }, });
|
|
202
202
|
// 对外提供getSelected方法获取当前选择的数据
|
|
203
|
-
(0, react_1.useImperativeHandle)(ref, () => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
};
|
|
212
|
-
});
|
|
203
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
204
|
+
getSelected() {
|
|
205
|
+
return selectedRef.current.selected;
|
|
206
|
+
},
|
|
207
|
+
getParams: () => {
|
|
208
|
+
return props.model.param;
|
|
209
|
+
}
|
|
210
|
+
}), []);
|
|
213
211
|
let boxProps = lodash_1.default.pick(props, ['selectBar', 'style', 'className', 'default', 'mode']);
|
|
214
212
|
if (props.searchBar) {
|
|
215
213
|
boxProps.searchBar = Object.assign(Object.assign({}, props.searchBar), { disabled: isQuerying, onSearch: (data) => {
|
|
@@ -13,7 +13,7 @@ export type TableColumn = BaseItem & ColumnProps<PlainObject>;
|
|
|
13
13
|
* 说明:为保持各应用 一致性 与 简单性
|
|
14
14
|
* 所有VAP组装 Table 排除一些自定义属性
|
|
15
15
|
*/
|
|
16
|
-
export type TableDefine = Omit<TableProps<PlainObject>, 'size' | 'columns' | 'dataSource' | 'bordered' | '
|
|
16
|
+
export type TableDefine = Omit<TableProps<PlainObject>, 'size' | 'columns' | 'dataSource' | 'bordered' | 'rowKey' | 'title' | 'loading' | 'onChange' | 'rowSelection' | 'getPopupContainer' | 'sortDirections' | 'showSorterTooltip' | 'internalHooks' | 'transformColumns' | 'internalRefs'>;
|
|
17
17
|
export type BaseTableProps = TableDefine & {
|
|
18
18
|
mode?: BoxMode;
|
|
19
19
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { BaseTreeState } from './BaseTree';
|
|
3
|
-
import type { BaseTreeProps,
|
|
3
|
+
import type { BaseTreeProps, BaseActionTreeProps, ActionTreeRef } from './index';
|
|
4
4
|
import type { PlainObject, Key } from '../../basetype';
|
|
5
5
|
import type { ReactNode } from 'react';
|
|
6
6
|
declare enum INSER_POS {
|
|
@@ -10,7 +10,7 @@ declare enum INSER_POS {
|
|
|
10
10
|
TOP = 3,
|
|
11
11
|
BOTTOM = 4
|
|
12
12
|
}
|
|
13
|
-
type ActionTreeProps = BaseTreeProps &
|
|
13
|
+
type ActionTreeProps = BaseTreeProps & BaseActionTreeProps;
|
|
14
14
|
export type CacheTree = {
|
|
15
15
|
/**
|
|
16
16
|
* 清理缓存方法
|
|
@@ -22,7 +22,7 @@ export type CacheTree = {
|
|
|
22
22
|
getChildren?: Function;
|
|
23
23
|
};
|
|
24
24
|
type ActionTreeContext = {
|
|
25
|
-
action:
|
|
25
|
+
action: BaseActionTreeProps;
|
|
26
26
|
showAdd: (pos: INSER_POS, node: PlainObject, position: number[]) => void;
|
|
27
27
|
showEdit: (node: PlainObject, position: number[]) => void;
|
|
28
28
|
del: (node: PlainObject, position: number[]) => void;
|
|
@@ -45,12 +45,10 @@ export declare const ActionTree: React.ForwardRefExoticComponent<import("../../u
|
|
|
45
45
|
defaultExpandAll?: boolean;
|
|
46
46
|
mustSelect?: boolean;
|
|
47
47
|
disabled?: boolean;
|
|
48
|
-
disabledNode?: (node: PlainObject) => boolean;
|
|
49
|
-
* 清理缓存方法
|
|
50
|
-
*/
|
|
48
|
+
disabledNode?: (node: PlainObject) => boolean;
|
|
51
49
|
onSelect?: (key: Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
|
|
52
50
|
searchValue?: string;
|
|
53
|
-
} &
|
|
51
|
+
} & BaseActionTreeProps & CacheTree & React.RefAttributes<ActionTreeRef>>;
|
|
54
52
|
export declare const renderRoot: (props: ActionTreeProps, state: BaseTreeState, context: ActionTreeContext) => ReactNode;
|
|
55
53
|
export declare const getResponseList: (resp: PlainObject, sortField?: string) => PlainObject[];
|
|
56
54
|
export {};
|
|
@@ -108,21 +108,17 @@ const _Actiontree = (0, react_1.forwardRef)((props, ref) => {
|
|
|
108
108
|
if (props.canSort && treeState.sortField)
|
|
109
109
|
action.canSort = true;
|
|
110
110
|
}
|
|
111
|
-
(0, react_1.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
add(data, { pos: INSER_POS.INNER, node, position });
|
|
122
|
-
}
|
|
123
|
-
};
|
|
111
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
112
|
+
updateData, update, del, add: (data, position) => {
|
|
113
|
+
let nodePath = position.map(i => `[${i}]`).join('.children');
|
|
114
|
+
const { treeData } = treeState;
|
|
115
|
+
let node = lodash_1.default.get(treeData, nodePath);
|
|
116
|
+
if (node == null) {
|
|
117
|
+
antd_1.message.error('No parent found');
|
|
118
|
+
}
|
|
119
|
+
add(data, { pos: INSER_POS.INNER, node, position });
|
|
124
120
|
}
|
|
125
|
-
}, [treeState.treeData]);
|
|
121
|
+
}), [treeState.treeData]);
|
|
126
122
|
(0, react_1.useLayoutEffect)(() => {
|
|
127
123
|
if (props.formFields) {
|
|
128
124
|
FIELDS.current = props.formFields;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { BaseTreeProps,
|
|
2
|
+
import type { BaseTreeProps, BaseActionTreeProps, ActionTreeRef } from './index';
|
|
3
3
|
import type { Key, PlainObject } from '../../basetype';
|
|
4
4
|
export type DTreeFetch = {
|
|
5
5
|
/**
|
|
@@ -19,7 +19,7 @@ export type DTreeFetch = {
|
|
|
19
19
|
*/
|
|
20
20
|
childApi: string | ((parentId: Key) => Promise<PlainObject[]>);
|
|
21
21
|
};
|
|
22
|
-
export type DTreeProps = BaseTreeProps &
|
|
22
|
+
export type DTreeProps = BaseTreeProps & BaseActionTreeProps & DTreeFetch;
|
|
23
23
|
/**
|
|
24
24
|
* 动态树
|
|
25
25
|
* CRUD : 支持
|
|
@@ -45,4 +45,4 @@ export declare const DTree: React.MemoExoticComponent<React.ForwardRefExoticComp
|
|
|
45
45
|
disabledNode?: (node: PlainObject) => boolean;
|
|
46
46
|
onSelect?: (key: Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
|
|
47
47
|
searchValue?: string;
|
|
48
|
-
} &
|
|
48
|
+
} & BaseActionTreeProps & DTreeFetch & React.RefAttributes<ActionTreeRef>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TreeUtil } from '../../utils';
|
|
3
|
-
import type { BaseTreeProps,
|
|
3
|
+
import type { BaseTreeProps, BaseActionTreeProps, ActionTreeRef } from './index';
|
|
4
4
|
import type { PlainObject } from '../../basetype';
|
|
5
5
|
type FTreeFetch = {
|
|
6
6
|
/**
|
|
@@ -8,7 +8,7 @@ type FTreeFetch = {
|
|
|
8
8
|
*/
|
|
9
9
|
fetchApi?: string;
|
|
10
10
|
};
|
|
11
|
-
export type FTreeProps = BaseTreeProps &
|
|
11
|
+
export type FTreeProps = BaseTreeProps & BaseActionTreeProps & FTreeFetch;
|
|
12
12
|
/**
|
|
13
13
|
* 动态树
|
|
14
14
|
* CRUD : 支持
|
|
@@ -17,7 +17,9 @@ export type FTreeProps = BaseTreeProps & ActionProps & FTreeFetch;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const FTree: React.MemoExoticComponent<React.ForwardRefExoticComponent<TreeUtil.BaseTreeOpts & {
|
|
19
19
|
className?: string;
|
|
20
|
-
iconField?: string | ((item: any) => React.ReactNode);
|
|
20
|
+
iconField?: string | ((item: any) => React.ReactNode); /**
|
|
21
|
+
* 获取全部节点的API,如果不传,刚用 API 的GET模式代替
|
|
22
|
+
*/
|
|
21
23
|
titleField: string | {
|
|
22
24
|
zhCN?: string;
|
|
23
25
|
enUS?: string;
|
|
@@ -29,5 +31,5 @@ export declare const FTree: React.MemoExoticComponent<React.ForwardRefExoticComp
|
|
|
29
31
|
disabledNode?: (node: PlainObject) => boolean;
|
|
30
32
|
onSelect?: (key: import("../../basetype").Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
|
|
31
33
|
searchValue?: string;
|
|
32
|
-
} &
|
|
34
|
+
} & BaseActionTreeProps & FTreeFetch & React.RefAttributes<ActionTreeRef>>>;
|
|
33
35
|
export {};
|
|
@@ -66,7 +66,7 @@ export type BaseTreeProps = BaseTreeOpts & {
|
|
|
66
66
|
*/
|
|
67
67
|
searchValue?: string;
|
|
68
68
|
};
|
|
69
|
-
export type
|
|
69
|
+
export type BaseActionTreeProps = {
|
|
70
70
|
/**
|
|
71
71
|
* 对象的 Label
|
|
72
72
|
*/
|
|
@@ -131,7 +131,7 @@ export type ActionProps = {
|
|
|
131
131
|
* 说明 针对节点进行操作
|
|
132
132
|
* 说明,节点信息,位置信息,可通过 onSelect 方法的第五个参数可以拿到
|
|
133
133
|
*/
|
|
134
|
-
export type
|
|
134
|
+
export type ActionTreeRef = {
|
|
135
135
|
updateData: (node: PlainObject, pos: number[]) => void;
|
|
136
136
|
update: (node: PlainObject, pos: number[]) => Promise<void>;
|
|
137
137
|
del: (node: PlainObject, pos: number[]) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { UFromProps,
|
|
2
|
+
import type { UFromProps, UFormRef } from './index';
|
|
3
3
|
import type { FormState } from './FormWrapper';
|
|
4
4
|
export declare const initValue: (props: UFromProps & {
|
|
5
5
|
state: FormState;
|
|
@@ -14,4 +14,4 @@ export declare const initValue: (props: UFromProps & {
|
|
|
14
14
|
* 3. 支持 ref 控制方法
|
|
15
15
|
* 4. filed 支持更多提示,验证方法
|
|
16
16
|
*/
|
|
17
|
-
export declare const UForm: React.ForwardRefExoticComponent<UFromProps & React.RefAttributes<
|
|
17
|
+
export declare const UForm: React.ForwardRefExoticComponent<UFromProps & React.RefAttributes<UFormRef>>;
|
|
@@ -40,8 +40,6 @@ const react_1 = __importStar(require("react"));
|
|
|
40
40
|
const lodash_1 = __importDefault(require("lodash"));
|
|
41
41
|
const utils_1 = require("../../utils");
|
|
42
42
|
const antd_1 = require("antd");
|
|
43
|
-
const Row_1 = require("../_adapt/Row");
|
|
44
|
-
const Col_1 = require("../_adapt/Col");
|
|
45
43
|
const Popconfirm_1 = require("../_adapt/Popconfirm");
|
|
46
44
|
const Popover_1 = require("../_adapt/Popover");
|
|
47
45
|
const Button_1 = require("../_adapt/Button");
|
|
@@ -220,7 +218,7 @@ const renderFormField = (state, field, form, update, data) => {
|
|
|
220
218
|
itemProps.wrapperCol = { span: 24 - label };
|
|
221
219
|
}
|
|
222
220
|
}
|
|
223
|
-
return react_1.default.createElement(
|
|
221
|
+
return react_1.default.createElement(antd_1.Col, Object.assign({}, colProps),
|
|
224
222
|
react_1.default.createElement(antd_1.Form.Item, Object.assign({}, itemProps), form.getFieldDecorator(field.field, options)(react_1.default.createElement(input.component, {
|
|
225
223
|
form,
|
|
226
224
|
field,
|
|
@@ -239,10 +237,10 @@ const renderFormActions = (state, buttons, form, initRef) => {
|
|
|
239
237
|
if (btns.length == 0)
|
|
240
238
|
return utils_1.Const.NONE;
|
|
241
239
|
var labelWidth = (state.labelSpan / 24) * (1 / state.cols) * 100;
|
|
242
|
-
return react_1.default.createElement(
|
|
243
|
-
react_1.default.createElement(
|
|
244
|
-
react_1.default.createElement(
|
|
245
|
-
react_1.default.createElement(
|
|
240
|
+
return react_1.default.createElement(antd_1.Col, { span: 24, className: 'c-form-buttons' },
|
|
241
|
+
react_1.default.createElement(antd_1.Row, null,
|
|
242
|
+
react_1.default.createElement(antd_1.Col, { style: { width: utils_1.Format.formatPercent(labelWidth) } }),
|
|
243
|
+
react_1.default.createElement(antd_1.Col, { style: { width: utils_1.Format.formatPercent(99 - labelWidth) }, className: 'c-form-actions' }, btns.map(btn => {
|
|
246
244
|
if (btn.roleCode && !utils_1.PageUtil.hasRole(btn.roleCode))
|
|
247
245
|
return utils_1.Const.NONE;
|
|
248
246
|
let onClick;
|
|
@@ -394,7 +392,7 @@ const _FormGroup = (props) => {
|
|
|
394
392
|
if (group == null || group === false)
|
|
395
393
|
return utils_1.Const.NONE;
|
|
396
394
|
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
397
|
-
react_1.default.createElement(
|
|
395
|
+
react_1.default.createElement(antd_1.Col, { span: 24, className: "c-form-group-title" }, utils_1.i18n.getText(group.ik, group.title)),
|
|
398
396
|
group.fields.map(field => {
|
|
399
397
|
if (field == null || field === false)
|
|
400
398
|
return utils_1.Const.NONE;
|
|
@@ -407,24 +405,22 @@ const _UForm = (0, react_1.forwardRef)((props, ref) => {
|
|
|
407
405
|
const { form } = props;
|
|
408
406
|
const [checked, setChecked] = (0, react_1.useState)(false);
|
|
409
407
|
const initRef = (0, react_1.useRef)(null);
|
|
408
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
409
|
+
validate: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
410
|
+
return new Promise((r, j) => {
|
|
411
|
+
form.validateFields((err, result) => {
|
|
412
|
+
if (err) {
|
|
413
|
+
console.error(err);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
r(getValue(state.multipleFields.current, result, initRef));
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
}),
|
|
420
|
+
reset: () => form.resetFields(),
|
|
421
|
+
data: () => getValue(state.multipleFields.current, form.getFieldsValue(), initRef),
|
|
422
|
+
}), []);
|
|
410
423
|
(0, react_1.useLayoutEffect)(() => {
|
|
411
|
-
if (ref != null) {
|
|
412
|
-
ref.current = {
|
|
413
|
-
validate: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
414
|
-
return new Promise((r, j) => {
|
|
415
|
-
form.validateFields((err, result) => {
|
|
416
|
-
if (err) {
|
|
417
|
-
console.error(err);
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
r(getValue(state.multipleFields.current, result, initRef));
|
|
421
|
-
});
|
|
422
|
-
});
|
|
423
|
-
}),
|
|
424
|
-
reset: () => form.resetFields(),
|
|
425
|
-
data: () => getValue(state.multipleFields.current, form.getFieldsValue(), initRef),
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
424
|
const checkMultiple = (field) => {
|
|
429
425
|
// @ts-ignore
|
|
430
426
|
if (field == null || field == false)
|
|
@@ -449,11 +445,9 @@ const _UForm = (0, react_1.forwardRef)((props, ref) => {
|
|
|
449
445
|
if (!checked)
|
|
450
446
|
return utils_1.Const.NONE;
|
|
451
447
|
return react_1.default.createElement(antd_1.Form
|
|
452
|
-
// defaultValue={initRef.current}
|
|
453
448
|
// initialValues={props.default}
|
|
454
449
|
// size={props.size || GLOBAL.CONFIG.FORM.SIZE}
|
|
455
450
|
, {
|
|
456
|
-
// defaultValue={initRef.current}
|
|
457
451
|
// initialValues={props.default}
|
|
458
452
|
// size={props.size || GLOBAL.CONFIG.FORM.SIZE}
|
|
459
453
|
className: state.isGroup ? 'c-form c-form-group' : 'c-form', style: { width: state.width }, form: form },
|
|
@@ -48,9 +48,6 @@ const FormWrapper_1 = require("./FormWrapper");
|
|
|
48
48
|
const FORM_FIELDS = ['layout', 'fields', 'groupType', 'isEdit', 'tip', 'default', 'data', 'mode', 'size'];
|
|
49
49
|
const UFormModal = (props) => {
|
|
50
50
|
const ref = (0, react_1.useRef)(null);
|
|
51
|
-
const [open, afterClose] = (0, Modal_1.useDestoryModal)(props);
|
|
52
|
-
if (!open)
|
|
53
|
-
return utils_1.Const.NONE;
|
|
54
51
|
let modalProps = {
|
|
55
52
|
onOk: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
53
|
const result = yield ref.current.validate();
|
|
@@ -146,7 +143,7 @@ const UFormModal = (props) => {
|
|
|
146
143
|
});
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
|
-
return react_1.default.createElement(Modal_1.Modal, Object.assign({ maskClosable: utils_1.GLOBAL.CONFIG.FORM.maskClosable, destroyOnClose: true
|
|
146
|
+
return react_1.default.createElement(Modal_1.Modal, Object.assign({ maskClosable: utils_1.GLOBAL.CONFIG.FORM.maskClosable, destroyOnClose: true }, lodash_1.default.omit(props, FORM_FIELDS), { className: utils_1.StringUtil.className(['u-form-modal'], props.className), onCancel: () => props.onCancel() }, modalProps),
|
|
150
147
|
react_1.default.createElement(UForm_1.UForm, Object.assign({}, lodash_1.default.pick(props, FORM_FIELDS), { ref: ref })));
|
|
151
148
|
};
|
|
152
149
|
exports.UFormModal = UFormModal;
|
package/components/_adapt/Col.js
CHANGED
|
@@ -40,7 +40,9 @@ const Col = (props) => {
|
|
|
40
40
|
if (props.className) {
|
|
41
41
|
clazz.push(props.className);
|
|
42
42
|
}
|
|
43
|
-
if (lodash_1.default.has(props, 'span') || lodash_1.default.has(props, 'width') || lodash_1.default.has(props, 'height')
|
|
43
|
+
if (lodash_1.default.has(props, 'span') || lodash_1.default.has(props, 'width') || lodash_1.default.has(props, 'height')
|
|
44
|
+
|| lodash_1.default.has(props, 'sm') || lodash_1.default.has(props, 'md') || lodash_1.default.has(props, 'lg')
|
|
45
|
+
|| (lodash_1.default.has(props, 'style') && (lodash_1.default.has(props.style, 'width') || lodash_1.default.has(props.style, 'height')))) {
|
|
44
46
|
clazz.push('v-col-fix');
|
|
45
47
|
}
|
|
46
48
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Input as AntdInput } from 'antd';
|
|
2
|
-
import type { InputProps } from 'antd/es/input';
|
|
2
|
+
import type { InputProps, PasswordProps } from 'antd/es/input';
|
|
3
3
|
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
4
4
|
export interface InputRef {
|
|
5
5
|
input: HTMLInputElement | null;
|
|
@@ -11,7 +11,7 @@ type InputComponent = ForwardRefExoticComponent<InputProps & RefAttributes<Input
|
|
|
11
11
|
Group: typeof AntdInput.Group;
|
|
12
12
|
Search: typeof AntdInput.Search;
|
|
13
13
|
TextArea: typeof AntdInput.TextArea;
|
|
14
|
-
Password:
|
|
14
|
+
Password: ForwardRefExoticComponent<PasswordProps & RefAttributes<InputRef>>;
|
|
15
15
|
};
|
|
16
16
|
export declare const Input: InputComponent;
|
|
17
17
|
export {};
|
|
@@ -40,4 +40,14 @@ exports.Input = _Input;
|
|
|
40
40
|
exports.Input.Group = antd_1.Input.Group;
|
|
41
41
|
exports.Input.Search = antd_1.Input.Search;
|
|
42
42
|
exports.Input.TextArea = antd_1.Input.TextArea;
|
|
43
|
-
exports.Input.Password = antd_1.Input.Password
|
|
43
|
+
exports.Input.Password = (0, react_1.forwardRef)((props, ref) => react_1.default.createElement(antd_1.Input.Password, Object.assign({}, props, { ref: aInput => {
|
|
44
|
+
if (aInput && ref) {
|
|
45
|
+
ref.current = {
|
|
46
|
+
input: aInput.input,
|
|
47
|
+
focus: aInput.focus,
|
|
48
|
+
blur: aInput.blur,
|
|
49
|
+
select: aInput.select,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
} })));
|
|
53
|
+
// ;
|
package/components/_adapt/Row.js
CHANGED
|
@@ -8,7 +8,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const antd_1 = require("antd");
|
|
9
9
|
const Global_1 = require("../../utils/Global");
|
|
10
10
|
const Row = (props) => {
|
|
11
|
-
let clazz = ['v-row'];
|
|
11
|
+
let clazz = ['ant-row', 'v-row'];
|
|
12
12
|
if (props.className)
|
|
13
13
|
clazz.push(props.className);
|
|
14
14
|
if (props.wrap)
|
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 =
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
7
27
|
const _register_1 = require("../../Box/_register");
|
|
8
28
|
const Trees_1 = require("../../Trees");
|
|
9
29
|
(0, _register_1.registerSelectBar)('stree', (props) => react_1.default.createElement(Trees_1.STree, Object.assign({}, props.config, { onSelect: props.onSelect, searchValue: props.searchValue })));
|
|
10
|
-
(0, _register_1.registerSelectBar)('ftree', react_1.
|
|
11
|
-
(0, _register_1.registerSelectBar)('dtree', react_1.
|
|
30
|
+
(0, _register_1.registerSelectBar)('ftree', (0, react_1.forwardRef)((props, ref) => react_1.default.createElement(Trees_1.FTree, Object.assign({}, props.config, { onSelect: props.onSelect, searchValue: props.searchValue, ref: ref }))));
|
|
31
|
+
(0, _register_1.registerSelectBar)('dtree', (0, react_1.forwardRef)((props, ref) => react_1.default.createElement(Trees_1.DTree, Object.assign({}, props.config, { onSelect: props.onSelect, searchValue: props.searchValue, ref: ref }))));
|
|
@@ -13,10 +13,10 @@ const Popover_1 = require("../../../components/_adapt/Popover");
|
|
|
13
13
|
const Slider_1 = require("../../../components/_adapt/Slider");
|
|
14
14
|
const Button_1 = require("../../../components/_adapt/Button");
|
|
15
15
|
const Select_1 = require("../../../components/_adapt/Select");
|
|
16
|
+
const ColorPicker_1 = require("../../../components/_adapt/ColorPicker");
|
|
16
17
|
const UForm_1 = require("../../../components/UForm");
|
|
17
18
|
const Icon_1 = require("../../../components/_adapt/Icon");
|
|
18
19
|
const hooks_1 = require("../../../hooks");
|
|
19
|
-
const ColorPicker_1 = require("../../../components/_adapt/ColorPicker");
|
|
20
20
|
const markValue = (editor, cmd) => {
|
|
21
21
|
const marks = slate_1.Editor.marks(editor);
|
|
22
22
|
if (marks && marks[cmd]) {
|
package/index.d.ts
CHANGED
|
@@ -132,9 +132,9 @@ export { VTable, ApiTable, ApiTableModal, STable, TopTable, TopTableModal } from
|
|
|
132
132
|
export { STree, DTree, FTree } from './components/Trees';
|
|
133
133
|
export { UploadFile, UploadImage, UploadModal } from './components/Upload';
|
|
134
134
|
export { SList } from './components/Lists/SList';
|
|
135
|
-
export type { UFromProps, UModalProps, UFormField, UFormFieldGroup, LinkResult, UDescriptionsProps,
|
|
135
|
+
export type { UFromProps, UModalProps, UFormField, UFormFieldGroup, LinkResult, UDescriptionsProps, UFormRef } from './components/UForm';
|
|
136
136
|
export type { TableColumn } from './components/Tables/index';
|
|
137
|
-
export type { VTableProps } from './components/Tables/VTable';
|
|
137
|
+
export type { VTableProps, VTableRef } from './components/Tables/VTable';
|
|
138
138
|
export type { ApiTableProps } from './components/Tables/ApiTable';
|
|
139
139
|
export type { ApiTableModalProps } from './components/Tables/ApiTableModal';
|
|
140
140
|
export type { STableProps } from './components/Tables/STable';
|
|
@@ -143,6 +143,7 @@ export type { TopTableModalProps } from './components/Tables/TopTableModal';
|
|
|
143
143
|
export type { UploadModalProps } from './components/Upload/UploadModal';
|
|
144
144
|
export type { UploadImageProps } from './components/Upload/UploadImage';
|
|
145
145
|
export type { BaseUploadProps } from './components/Upload';
|
|
146
|
+
export type { ActionTreeRef } from './components/Trees';
|
|
146
147
|
export type { STreeProps } from './components/Trees/STree';
|
|
147
148
|
export type { DTreeProps } from './components/Trees/DTree';
|
|
148
149
|
export type { FTreeProps } from './components/Trees/FTree';
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"vap1","version":"0.1.
|
|
1
|
+
{"name":"vap1","version":"0.1.4","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|
package/screen/render.js
CHANGED