vap1 0.6.6 → 0.6.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/components/Box/Box.d.ts +14 -2
- package/components/Box/Box.js +3 -3
- package/components/Lists/VList.js +2 -2
- package/components/Lists/components/SearchTool.d.ts +1 -1
- package/components/Lists/components/SearchTool.js +2 -2
- package/components/Lists/index.d.ts +2 -1
- package/components/SearchTool/SearchBand/hooks.js +1 -1
- package/components/SearchTool/SearchBand/type.d.ts +2 -2
- package/components/SearchTool/SearchBar/ActionButtons.d.ts +2 -2
- package/components/SearchTool/SearchBar/ByField.js +3 -3
- package/components/SearchTool/SearchBar/type.d.ts +8 -2
- package/components/Tables/ApiTable.d.ts +1 -1
- package/components/Tables/ApiTable.js +1 -1
- package/components/Tables/ApiTableModal.d.ts +1 -1
- package/components/Tables/ApiTableModal.js +1 -1
- package/components/Tables/Components/useTableContext.d.ts +1 -1
- package/components/Tables/Components/useTableContext.js +1 -4
- package/components/Tables/VTable.d.ts +1 -1
- package/components/Tables/VTable.js +7 -3
- package/components/Tables/index.d.ts +1 -1
- package/components/UForm/UForm.js +3 -3
- package/components/UForm/UFormModal.js +1 -1
- package/components/UForm/UInfoModal.js +1 -1
- package/components/UForm/_FormUtils.d.ts +1 -1
- package/components/UForm/_input.js +1 -1
- package/components/UForm/_register.d.ts +1 -1
- package/components/UForm/index.d.ts +9 -3
- package/components/_common/AutoComplete.d.ts +1 -1
- package/components/_common/AutoComplete.js +1 -1
- package/package.json +1 -1
- package/uform/panel/Propreties/Component/LinkAsyncFunction.js +1 -1
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +1 -1
- package/uform/utils/Convert.js +1 -1
- package/utils/Renders/FileRender.d.ts +1 -1
- package/utils/Renders/FileRender.js +1 -1
package/components/Box/Box.d.ts
CHANGED
|
@@ -107,9 +107,15 @@ export type BoxProps = SearchTool & {
|
|
|
107
107
|
*/
|
|
108
108
|
overflowAuto?: true;
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* @deprecated
|
|
111
|
+
* 说明:在一些极端场景下编译,可能会有Bug,
|
|
112
|
+
* 统一使用 defaultParam 替代,后续版本会移除
|
|
111
113
|
*/
|
|
112
114
|
default?: PlainObject;
|
|
115
|
+
/**
|
|
116
|
+
* 默认查询条件
|
|
117
|
+
*/
|
|
118
|
+
defaultParam?: PlainObject;
|
|
113
119
|
/**
|
|
114
120
|
* 在部分皮肤下有效,强制不显示背景
|
|
115
121
|
*/
|
|
@@ -145,9 +151,15 @@ export declare const Box: React.ForwardRefExoticComponent<SearchTool & {
|
|
|
145
151
|
*/
|
|
146
152
|
overflowAuto?: true;
|
|
147
153
|
/**
|
|
148
|
-
*
|
|
154
|
+
* @deprecated
|
|
155
|
+
* 说明:在一些极端场景下编译,可能会有Bug,
|
|
156
|
+
* 统一使用 defaultParam 替代,后续版本会移除
|
|
149
157
|
*/
|
|
150
158
|
default?: PlainObject;
|
|
159
|
+
/**
|
|
160
|
+
* 默认查询条件
|
|
161
|
+
*/
|
|
162
|
+
defaultParam?: PlainObject;
|
|
151
163
|
/**
|
|
152
164
|
* 在部分皮肤下有效,强制不显示背景
|
|
153
165
|
*/
|
package/components/Box/Box.js
CHANGED
|
@@ -207,7 +207,7 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
207
207
|
// const isFix = _.isBoolean(props.searchBand.fixMode) ? props.searchBand.fixMode : CONFIG.SEARCHBAND.FIX_MODE;
|
|
208
208
|
// return <SearchBand
|
|
209
209
|
// {...props.searchBand}
|
|
210
|
-
//
|
|
210
|
+
// defaultParam={props.defaultParam || props.default}
|
|
211
211
|
// className={HEIGHT_OMIT}
|
|
212
212
|
// extraAction={null}
|
|
213
213
|
// onSearch={(data) => {
|
|
@@ -217,7 +217,7 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
217
217
|
// >{action}</SearchBand>
|
|
218
218
|
// }
|
|
219
219
|
if (hasBar) {
|
|
220
|
-
return react_1.default.createElement(SearchBar_1.SearchBar, __assign({}, props.searchBar, {
|
|
220
|
+
return react_1.default.createElement(SearchBar_1.SearchBar, __assign({}, props.searchBar, { defaultParam: props.defaultParam || props.default, className: HEIGHT_OMIT, onExpand: function (isExpand) {
|
|
221
221
|
resize();
|
|
222
222
|
if (lodash_1.default.isFunction(props.searchBar.onExpand)) {
|
|
223
223
|
props.searchBar.onExpand(isExpand);
|
|
@@ -225,7 +225,7 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
225
225
|
} }), action);
|
|
226
226
|
}
|
|
227
227
|
if (action) {
|
|
228
|
-
return react_1.default.createElement(SearchBar_1.SearchBar, { onSearch: LOOP,
|
|
228
|
+
return react_1.default.createElement(SearchBar_1.SearchBar, { onSearch: LOOP, defaultParam: props.defaultParam || props.default, className: HEIGHT_OMIT, onExpand: LOOP }, action);
|
|
229
229
|
}
|
|
230
230
|
return utils_1.Const.NONE;
|
|
231
231
|
}, [props.actionBar, props.searchBar,
|
|
@@ -60,7 +60,7 @@ var VList = function (props) {
|
|
|
60
60
|
var model = props.model;
|
|
61
61
|
var app = (0, useApp_1.useApp)();
|
|
62
62
|
var _a = (0, LayoutSwitcher_1.useListLayout)(props), layout = _a.layout, layouts = _a.layouts, setLayout = _a.setLayout;
|
|
63
|
-
(0, react_1.useLayoutEffect)(function () { model.query(props.
|
|
63
|
+
(0, react_1.useLayoutEffect)(function () { model.query(props.defaultParam || {}); }, []);
|
|
64
64
|
var extraAction = (0, react_1.useMemo)(function () {
|
|
65
65
|
if (layouts.length <= 1)
|
|
66
66
|
return null;
|
|
@@ -85,7 +85,7 @@ var VList = function (props) {
|
|
|
85
85
|
return classNames.join(' ');
|
|
86
86
|
}, [props.className]);
|
|
87
87
|
return react_1.default.createElement("div", { style: style, className: clazz },
|
|
88
|
-
react_1.default.createElement(SearchTool_1.SearchTool, __assign({}, props, { onSearch: function (data) { return model.query(data, true); },
|
|
88
|
+
react_1.default.createElement(SearchTool_1.SearchTool, __assign({}, props, { onSearch: function (data) { return model.query(data, true); }, defaultParam: props.defaultParam, extraAction: extraAction, children: lodash_1.default.isEmpty(props.actionBar) ? undefined : (lodash_1.default.isArray(props.actionBar) ? react_1.default.createElement(ActionButtons_1.ActionButtons, { buttons: props.actionBar }) : props.actionBar) })),
|
|
89
89
|
react_1.default.createElement(BaseList_1.BaseList, __assign({}, props, { layout: layout, style: null, className: null, dataSource: model.list, loading: model.isQuerying })),
|
|
90
90
|
props.pagination !== false && react_1.default.createElement(Upagination_1.UPagination, __assign({}, (0, Upagination_1.defaultPaginationProps)(props.pagination), { disabled: model.isQuerying, total: model.total, totalAcc: model.totalAcc, onChange: model.pageTo })));
|
|
91
91
|
};
|
|
@@ -26,9 +26,9 @@ var SearchTool = function (props) {
|
|
|
26
26
|
return react_1.default.createElement(SearchTool_1.SearchBar, { onSearch: function () { }, children: props.children });
|
|
27
27
|
}
|
|
28
28
|
if (props.searchBand)
|
|
29
|
-
return react_1.default.createElement(SearchTool_1.SearchBand, __assign({}, props.searchBand, {
|
|
29
|
+
return react_1.default.createElement(SearchTool_1.SearchBand, __assign({}, props.searchBand, { defaultParam: props.defaultParam, onSearch: props.onSearch, children: props.children, extraAction: props.extraAction }));
|
|
30
30
|
if (props.searchBar)
|
|
31
|
-
return react_1.default.createElement(SearchTool_1.SearchBar, __assign({}, props.searchBar, {
|
|
31
|
+
return react_1.default.createElement(SearchTool_1.SearchBar, __assign({}, props.searchBar, { defaultParam: props.defaultParam, onSearch: props.onSearch, children: props.children }));
|
|
32
32
|
return Const_1.NONE;
|
|
33
33
|
};
|
|
34
34
|
exports.SearchTool = SearchTool;
|
|
@@ -123,7 +123,8 @@ export type ListRenderDefine = {
|
|
|
123
123
|
export type ListLayoutType = keyof ListRenderDefine;
|
|
124
124
|
type CommonListProps = Pick<ListProps<PlainObject>, 'rowKey' | 'className' | 'style'> & ListRenderDefine & {
|
|
125
125
|
defaultLayout?: ListLayoutType;
|
|
126
|
+
onLayoutChange?: (layout: ListLayoutType) => void;
|
|
126
127
|
};
|
|
127
128
|
export type BaseListProps = CommonListProps & Pick<ListProps<PlainObject>, 'dataSource' | 'loading'>;
|
|
128
|
-
export type VListProps = CommonListProps & SearchToolProps & Pick<VTableProps, '
|
|
129
|
+
export type VListProps = CommonListProps & SearchToolProps & Pick<VTableProps, 'defaultParam' | 'model' | 'mode' | 'pagination' | 'actionBar'>;
|
|
129
130
|
export {};
|
|
@@ -129,7 +129,7 @@ var useTableColumns = function (props, labelWidth, data, fixMode) {
|
|
|
129
129
|
}, [data]);
|
|
130
130
|
};
|
|
131
131
|
var useSearchBand = function (props, fixMode) {
|
|
132
|
-
var _a = __read((0, react_1.useState)(props.
|
|
132
|
+
var _a = __read((0, react_1.useState)(props.defaultParam || {}), 2), state = _a[0], setState = _a[1];
|
|
133
133
|
var isFristMount = (0, hooks_1.useFirstMountState)();
|
|
134
134
|
var labelWidth = (0, react_1.useMemo)(function () {
|
|
135
135
|
if (lodash_1.default.isNumber(props.labelWidth))
|
|
@@ -42,9 +42,9 @@ export type ActButton = {
|
|
|
42
42
|
/**
|
|
43
43
|
* 说明 : 最多支持2级子菜单,不能递归
|
|
44
44
|
*/
|
|
45
|
-
children?: ActButton
|
|
45
|
+
children?: Array<ActButton>;
|
|
46
46
|
};
|
|
47
47
|
export declare const ActionButtons: FC<{
|
|
48
|
-
buttons:
|
|
48
|
+
buttons: Array<ActButton | null | false>;
|
|
49
49
|
size?: ButtonSize;
|
|
50
50
|
}>;
|
|
@@ -75,15 +75,15 @@ var SearchField_1 = require("./SearchField");
|
|
|
75
75
|
var _register_1 = require("./_register");
|
|
76
76
|
exports.InnerSearchBarByField = (0, react_1.forwardRef)(function (props, ref) {
|
|
77
77
|
var isAwaysExpand = utils_1.GLOBAL.CONFIG.SEARCHBAR.AWAYS_EXPAND || props.__innerExpand;
|
|
78
|
-
var _a = __read((0, react_1.useState)(props.default || {}), 2), data = _a[0], setData = _a[1];
|
|
78
|
+
var _a = __read((0, react_1.useState)(props.defaultParam || props.default || {}), 2), data = _a[0], setData = _a[1];
|
|
79
79
|
var _b = __read((0, react_1.useState)(isAwaysExpand), 2), isExpand = _b[0], _setIsExpand = _b[1];
|
|
80
80
|
var clear = (0, react_1.useCallback)(function () { return setData(function (prev) {
|
|
81
81
|
var data = {};
|
|
82
82
|
lodash_1.default.keys(prev).map(function (item) {
|
|
83
83
|
data[item] = null;
|
|
84
84
|
});
|
|
85
|
-
if (props.default) {
|
|
86
|
-
return lodash_1.default.extend({}, data, props.default);
|
|
85
|
+
if (props.defaultParam || props.default) {
|
|
86
|
+
return lodash_1.default.extend({}, data, props.defaultParam || props.default);
|
|
87
87
|
}
|
|
88
88
|
return data;
|
|
89
89
|
}); }, []);
|
|
@@ -48,9 +48,15 @@ export type SearchBarByFieldProps = {
|
|
|
48
48
|
*/
|
|
49
49
|
onExpand?: (isShowMore: boolean) => void;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* @deprecated
|
|
52
|
+
* 说明:在一些极端场景下编译,可能会有Bug,
|
|
53
|
+
* 统一使用 defaultParam 替代,后续版本会移除
|
|
52
54
|
*/
|
|
53
|
-
default?:
|
|
55
|
+
default?: PlainObject;
|
|
56
|
+
/**
|
|
57
|
+
* 默认参数
|
|
58
|
+
*/
|
|
59
|
+
defaultParam?: PlainObject;
|
|
54
60
|
/**
|
|
55
61
|
* 用于单独使用时,不需要按钮的情况
|
|
56
62
|
*/
|
|
@@ -3,7 +3,7 @@ import type { BaseTableProps } from './index';
|
|
|
3
3
|
import type { ApiModel } from '../../hooks/_list';
|
|
4
4
|
import type { ApiOption } from '../../hooks/useApiBase';
|
|
5
5
|
export type ApiTableProps = BaseTableProps & Pick<ApiOption, 'api' | 'aop' | 'tipDisabled' | 'tipField'>;
|
|
6
|
-
export declare const ApiTable: React.ForwardRefExoticComponent<import("./index").TableDefine & Pick<import("../..").BoxProps, "default" | "mode" | "selectBar"> & {
|
|
6
|
+
export declare const ApiTable: React.ForwardRefExoticComponent<import("./index").TableDefine & Pick<import("../..").BoxProps, "default" | "mode" | "selectBar" | "defaultParam"> & {
|
|
7
7
|
searchBar?: Omit<import("../SearchTool").SearchBarProps, "onChange" | "onSearch">;
|
|
8
8
|
} & {
|
|
9
9
|
columns: import("./index").TableCol[];
|
|
@@ -52,7 +52,7 @@ exports.ApiTable = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
52
52
|
var option = {
|
|
53
53
|
api: props.api,
|
|
54
54
|
rowKey: props.rowKey,
|
|
55
|
-
param: props.default,
|
|
55
|
+
param: props.defaultParam || props.default || {},
|
|
56
56
|
aop: props.aop,
|
|
57
57
|
tipDisabled: props.tipDisabled,
|
|
58
58
|
tipField: props.tipField,
|
|
@@ -3,7 +3,7 @@ import type { ModalProps } from '../_adapt/Modal';
|
|
|
3
3
|
import type { ApiTableProps } from './ApiTable';
|
|
4
4
|
import type { ApiModel } from '../../hooks/_list';
|
|
5
5
|
export type ApiTableModalProps = ApiTableProps & ModalProps;
|
|
6
|
-
export declare const ApiTableModal: React.ForwardRefExoticComponent<import(".").TableDefine & Pick<import("../..").BoxProps, "default" | "mode" | "selectBar"> & {
|
|
6
|
+
export declare const ApiTableModal: React.ForwardRefExoticComponent<import(".").TableDefine & Pick<import("../..").BoxProps, "default" | "mode" | "selectBar" | "defaultParam"> & {
|
|
7
7
|
searchBar?: Omit<import("../SearchTool").SearchBarProps, "onChange" | "onSearch">;
|
|
8
8
|
} & {
|
|
9
9
|
columns: import(".").TableCol[];
|
|
@@ -71,7 +71,7 @@ var ApiTable_1 = require("./ApiTable");
|
|
|
71
71
|
var utils_1 = require("../../utils");
|
|
72
72
|
var API_TABLE_PROPERTIES = [
|
|
73
73
|
'api', 'aop', 'tipDisabled', 'tipField',
|
|
74
|
-
'mode', 'columns', 'showIndex', 'rowKey', 'select', 'selectDisabled', 'actionBar', 'selectBar', 'searchBar', 'default', 'autoLoad'
|
|
74
|
+
'mode', 'columns', 'showIndex', 'rowKey', 'select', 'selectDisabled', 'actionBar', 'selectBar', 'searchBar', 'default', 'defaultParam', 'autoLoad'
|
|
75
75
|
];
|
|
76
76
|
exports.ApiTableModal = (0, react_1.forwardRef)(function (props, ref) {
|
|
77
77
|
var modalProps = lodash_1.default.omit(props, API_TABLE_PROPERTIES);
|
|
@@ -11,6 +11,6 @@ type TableAction = {
|
|
|
11
11
|
initObjects: (List: Array<any>) => void;
|
|
12
12
|
reflushPage: (List: Array<any>) => void;
|
|
13
13
|
};
|
|
14
|
-
export declare const TableContextWrapper: FC<PropsWithChildren<Pick<VTableProps, '
|
|
14
|
+
export declare const TableContextWrapper: FC<PropsWithChildren<Pick<VTableProps, 'defaultParam' | 'defaultSelectedKeys' | 'rowKey'>>>;
|
|
15
15
|
export declare const useTableContext: () => TableContext & TableAction;
|
|
16
16
|
export {};
|
|
@@ -73,14 +73,11 @@ var TableContextWrapper = function (props) {
|
|
|
73
73
|
var DEFAULT = {
|
|
74
74
|
selectedRowKeys: [],
|
|
75
75
|
selectedObjects: [],
|
|
76
|
-
param: {},
|
|
76
|
+
param: props.defaultParam || {},
|
|
77
77
|
};
|
|
78
78
|
if (lodash_1.default.isArray(props.defaultSelectedKeys)) {
|
|
79
79
|
DEFAULT.selectedRowKeys = props.defaultSelectedKeys;
|
|
80
80
|
}
|
|
81
|
-
if (props.default) {
|
|
82
|
-
DEFAULT.param = __assign({}, props.default);
|
|
83
|
-
}
|
|
84
81
|
return DEFAULT;
|
|
85
82
|
}), 2), state = _a[0], setState = _a[1];
|
|
86
83
|
var setSelection = (0, react_1.useCallback)(function (selectedRowKeys, selectedObjects) {
|
|
@@ -27,7 +27,7 @@ export type VTableProps = BaseTableProps & {
|
|
|
27
27
|
*/
|
|
28
28
|
onSelectedChange?: (selectedRowKeys: Key[], selectedRows?: any[]) => void;
|
|
29
29
|
};
|
|
30
|
-
export declare const VTable: React.ForwardRefExoticComponent<import("./index").TableDefine & Pick<BoxProps, "default" | "mode" | "selectBar"> & {
|
|
30
|
+
export declare const VTable: React.ForwardRefExoticComponent<import("./index").TableDefine & Pick<BoxProps, "default" | "mode" | "selectBar" | "defaultParam"> & {
|
|
31
31
|
searchBar?: Omit<import("../SearchTool").SearchBarProps, "onChange" | "onSearch">;
|
|
32
32
|
} & {
|
|
33
33
|
columns: import("./index").TableCol[];
|
|
@@ -128,7 +128,7 @@ var _VTable = (0, react_1.forwardRef)(function (props) {
|
|
|
128
128
|
return;
|
|
129
129
|
if (lodash_1.default.isFunction((_b = props.selectBar) === null || _b === void 0 ? void 0 : _b.onSelect)) {
|
|
130
130
|
var param = (_a = props.selectBar).onSelect.apply(_a, __spreadArray([], __read(state.selected), false));
|
|
131
|
-
query(__assign(__assign({}, props.default), param));
|
|
131
|
+
query(__assign(__assign({}, (props.defaultParam || props.default)), param));
|
|
132
132
|
}
|
|
133
133
|
}, [state.selected]);
|
|
134
134
|
// 更新页数
|
|
@@ -162,7 +162,7 @@ var _VTable = (0, react_1.forwardRef)(function (props) {
|
|
|
162
162
|
return;
|
|
163
163
|
if (lodash_1.default.has(props.selectBar, 'config.mustSelect') && props.selectBar.config.mustSelect == true)
|
|
164
164
|
return;
|
|
165
|
-
query(props.default || {});
|
|
165
|
+
query(props.defaultParam || props.default || {});
|
|
166
166
|
}, []);
|
|
167
167
|
// 更新高度 table 需要把 head 排除设置滚动
|
|
168
168
|
// useEffect(() => {
|
|
@@ -316,7 +316,11 @@ var VTableRoot = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
316
316
|
});
|
|
317
317
|
exports.VTable = (0, react_1.forwardRef)(function (props, ref) {
|
|
318
318
|
var _a;
|
|
319
|
-
var initValue = (0, react_1.useMemo)(function () {
|
|
319
|
+
var initValue = (0, react_1.useMemo)(function () {
|
|
320
|
+
var initProps = lodash_1.default.pick(props, ['defaultSelectedKeys', 'rowKey']);
|
|
321
|
+
initProps.defaultParam = props.defaultParam || props.default || {};
|
|
322
|
+
return initProps;
|
|
323
|
+
}, []);
|
|
320
324
|
return react_1.default.createElement(useTableContext_1.TableContextWrapper, __assign({}, initValue, { rowKey: ((_a = props.model) === null || _a === void 0 ? void 0 : _a.rowKey) || props.rowKey || 'id' }),
|
|
321
325
|
react_1.default.createElement(VTableRoot, __assign({}, props, { ref: ref })));
|
|
322
326
|
});
|
|
@@ -22,7 +22,7 @@ type SearchToolProps = {
|
|
|
22
22
|
* 所有VAP组装 Table 排除一些自定义属性
|
|
23
23
|
*/
|
|
24
24
|
export type TableDefine = Omit<TableProps<PlainObject>, 'size' | 'columns' | 'dataSource' | 'bordered' | 'rowKey' | 'title' | 'loading' | 'onChange' | 'rowSelection' | 'getPopupContainer' | 'sortDirections' | 'showSorterTooltip' | 'internalHooks' | 'transformColumns' | 'internalRefs'>;
|
|
25
|
-
export type BaseTableProps = TableDefine & Pick<BoxProps, 'mode' | 'selectBar' | 'default'> & SearchToolProps & {
|
|
25
|
+
export type BaseTableProps = TableDefine & Pick<BoxProps, 'mode' | 'selectBar' | 'defaultParam' | 'default'> & SearchToolProps & {
|
|
26
26
|
/**
|
|
27
27
|
* 列
|
|
28
28
|
*/
|
|
@@ -413,7 +413,7 @@ var getValue = function (multipleFields, values, initRef) {
|
|
|
413
413
|
};
|
|
414
414
|
var initValue = function (props) {
|
|
415
415
|
var e_1, _a;
|
|
416
|
-
var values = __assign(__assign({}, props.default), props.data);
|
|
416
|
+
var values = __assign(__assign({}, (props.defaultValue || props.default)), props.data);
|
|
417
417
|
var _loop_1 = function (key) {
|
|
418
418
|
var fields = key.split(',').map(lodash_1.default.trim);
|
|
419
419
|
if (fields.length == 1) {
|
|
@@ -564,10 +564,10 @@ var _UForm = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
564
564
|
if (state.isGroup)
|
|
565
565
|
clazz.push('c-form-group');
|
|
566
566
|
return react_1.default.createElement(antd_1.Form
|
|
567
|
-
// initialValues={props.default}
|
|
567
|
+
// initialValues={props.defaultValue || props.default}
|
|
568
568
|
// size={props.size || GLOBAL.CONFIG.FORM.SIZE}
|
|
569
569
|
, {
|
|
570
|
-
// initialValues={props.default}
|
|
570
|
+
// initialValues={props.defaultValue || props.default}
|
|
571
571
|
// size={props.size || GLOBAL.CONFIG.FORM.SIZE}
|
|
572
572
|
className: clazz.join(' '), style: { width: state.width }, form: form },
|
|
573
573
|
props.tip && react_1.default.createElement("div", { className: 'c-form-tip' }, props.tip),
|
|
@@ -93,7 +93,7 @@ var UForm_1 = require("./UForm");
|
|
|
93
93
|
var utils_1 = require("../../utils");
|
|
94
94
|
var _i18n_1 = require("../_i18n");
|
|
95
95
|
var FormWrapper_1 = require("./FormWrapper");
|
|
96
|
-
var FORM_FIELDS = ['layout', 'fields', 'groupType', 'isEdit', 'tip', 'default', 'data', 'mode', 'size', 'width'];
|
|
96
|
+
var FORM_FIELDS = ['layout', 'fields', 'groupType', 'isEdit', 'tip', 'default', 'defaultValue', 'data', 'mode', 'size', 'width'];
|
|
97
97
|
var UFormModal = function (props) {
|
|
98
98
|
var ref = (0, react_1.useRef)(null);
|
|
99
99
|
var modalProps = {
|
|
@@ -22,7 +22,7 @@ var utils_1 = require("../../utils");
|
|
|
22
22
|
var UInfo_1 = require("./UInfo");
|
|
23
23
|
var _i18n_1 = require("../_i18n");
|
|
24
24
|
var FormWrapper_1 = require("./FormWrapper");
|
|
25
|
-
var FORM_FIELDS = ['layout', 'fields', 'groupType', 'isEdit', 'tip', 'default', 'data', 'mode', 'hideBorder', 'theme'];
|
|
25
|
+
var FORM_FIELDS = ['layout', 'fields', 'groupType', 'isEdit', 'tip', 'default', 'defaultValue', 'data', 'mode', 'hideBorder', 'theme'];
|
|
26
26
|
var UInfoModal = function (props) {
|
|
27
27
|
var param = lodash_1.default.omit(props, FORM_FIELDS);
|
|
28
28
|
if (!lodash_1.default.has(props, 'title') && lodash_1.default.has(props, 'autoTitle')) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UFormField } from './index';
|
|
2
2
|
import type { BaseOption } from '../../basetype';
|
|
3
3
|
import type { ValidationRule } from 'antd/es/form/Form';
|
|
4
|
-
export declare const requireStatus: (field: UFormField, required: Map<string, boolean>, disabled: Set<string>, hiden: Set<string>) => [boolean, ValidationRule
|
|
4
|
+
export declare const requireStatus: (field: UFormField, required: Map<string, boolean>, disabled: Set<string>, hiden: Set<string>) => [boolean, Array<ValidationRule>];
|
|
5
5
|
export declare const getOptions: (items: BaseOption[], field: UFormField, data: any) => BaseOption[];
|
|
@@ -159,7 +159,7 @@ var builderApiTableSerletor = function (options, nameIdx) { return function (pro
|
|
|
159
159
|
};
|
|
160
160
|
return react_1.default.createElement(react_1.Fragment, null,
|
|
161
161
|
values[0] != undefined ? react_1.default.createElement(Button_1.Button, __assign({}, params, { icon: 'select', onClick: function () { return setOpen(true); } }), getTip(values)) : react_1.default.createElement(Button_1.Button, __assign({}, params, { icon: 'select', onClick: function () { return setOpen(true); } }), (0, exports.getPlaceholder)(field, true)),
|
|
162
|
-
react_1.default.createElement(Tables_1.ApiTableModal, __assign({ title: options.title, searchBar: options.searchBar, width: options.width || 720 }, field.config, { api: options.api,
|
|
162
|
+
react_1.default.createElement(Tables_1.ApiTableModal, __assign({ title: options.title, searchBar: options.searchBar, width: options.width || 720 }, field.config, { api: options.api, defaultParam: defaultParam, columns: __spreadArray(__spreadArray([], __read(options.columns), false), [
|
|
163
163
|
Tables_1.ApiTable.COL_OPERACTION({ render: function (data) { return react_1.default.createElement(Tables_1.ApiTable.ACTION, { title: "\u9009\u62E9", icon: "select", onClick: function () { return onSelect(data); } }); } })
|
|
164
164
|
], false), open: open, onCancel: function () { return setOpen(false); } })));
|
|
165
165
|
}; };
|
|
@@ -69,7 +69,7 @@ export type FormFieldOptions = {
|
|
|
69
69
|
* 校验规则
|
|
70
70
|
* 支持传Rule, Rule数组,及一个方法,接收一个数组
|
|
71
71
|
*/
|
|
72
|
-
rules?: ValidationRule | ValidationRule
|
|
72
|
+
rules?: ValidationRule | Array<ValidationRule> | ((field: UFormField) => ValidationRule | Array<ValidationRule>);
|
|
73
73
|
};
|
|
74
74
|
export type FormField = FormFieldOptions & {
|
|
75
75
|
component: FormFieldComponent;
|
|
@@ -172,12 +172,12 @@ export type UFormField = BaseItem & {
|
|
|
172
172
|
/**
|
|
173
173
|
* rules 用法: https://github.com/yiminghe/async-validator
|
|
174
174
|
*/
|
|
175
|
-
rules?: ValidationRule
|
|
175
|
+
rules?: Array<ValidationRule>;
|
|
176
176
|
/**
|
|
177
177
|
* 字段联动,目前只支持 `text` `select` 类型,受影响的字段只能是具有 `options` 属性的类型
|
|
178
178
|
*
|
|
179
179
|
*/
|
|
180
|
-
link?: Link
|
|
180
|
+
link?: Array<Link>;
|
|
181
181
|
/**
|
|
182
182
|
* (试验中,暂不要使用)
|
|
183
183
|
* 在复杂类型中使用时,可使用dataType定义类型
|
|
@@ -266,9 +266,15 @@ export type UFromProps = {
|
|
|
266
266
|
*/
|
|
267
267
|
tip?: ReactNode;
|
|
268
268
|
/**
|
|
269
|
-
*
|
|
269
|
+
* @deprecated
|
|
270
|
+
* 说明:在一些极端场景下编译,可能会有Bug,
|
|
271
|
+
* 统一使用 defaultValue 替代,后续版本会移除
|
|
270
272
|
*/
|
|
271
273
|
default?: PlainObject;
|
|
274
|
+
/**
|
|
275
|
+
* 默认值
|
|
276
|
+
*/
|
|
277
|
+
defaultValue?: PlainObject;
|
|
272
278
|
/**
|
|
273
279
|
* 数据
|
|
274
280
|
*/
|
|
@@ -141,7 +141,7 @@ var IAutoComplete = function (props) {
|
|
|
141
141
|
setOptions(cacheRef.current.get(text));
|
|
142
142
|
return [2 /*return*/];
|
|
143
143
|
}
|
|
144
|
-
param = lodash_1.default.merge({ start_: 0, count_: 15 }, props.
|
|
144
|
+
param = lodash_1.default.merge({ start_: 0, count_: 15 }, props.defaultParam);
|
|
145
145
|
if (text) {
|
|
146
146
|
param[paramField] = text;
|
|
147
147
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"vap1","version":"0.6.
|
|
1
|
+
{"name":"vap1","version":"0.6.7","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|
|
@@ -102,7 +102,7 @@ var LinkAsyncFunction = function (props) {
|
|
|
102
102
|
react_1.default.createElement("b", null, "dayjs")),
|
|
103
103
|
react_1.default.createElement("li", { style: { listStyle: 'none' } },
|
|
104
104
|
"\u65B9\u6CD5\u8FD4\u56DE\u6253\u5370 \uFF1A",
|
|
105
|
-
react_1.default.createElement("b", null, "print"))) }), title: props.isEdit ? '编辑联动方法' : '添加联动方法',
|
|
105
|
+
react_1.default.createElement("b", null, "print"))) }), title: props.isEdit ? '编辑联动方法' : '添加联动方法', defaultValue: { method: 'GET', url: '/api/${value}' }, fields: [
|
|
106
106
|
{ field: 'field', title: '被联动字段', required: true, options: targetOptions, type: 'select' },
|
|
107
107
|
{
|
|
108
108
|
field: 'url,method', title: '请求',
|
|
@@ -64,7 +64,7 @@ var ValidateAsyncFunction = function (props) { return react_1.default.createElem
|
|
|
64
64
|
"\u652F\u6301 lodash \u53D8\u91CF\u540D \uFF1A",
|
|
65
65
|
react_1.default.createElement("b", null, "_")),
|
|
66
66
|
react_1.default.createElement("li", { style: { listStyle: 'none' } },
|
|
67
|
-
react_1.default.createElement(index_1.Alert, { type: "error", message: "\u8BF4\u660E2\uFF1A\u5F02\u6B65\u9A8C\u8BC1\u4EC5\u652F\u6301 VAP2, \u6682\u4E0D\u652F\u6301 VAP1" }))) }), title: props.isEdit ? '编辑校验方法' : '添加校验方法',
|
|
67
|
+
react_1.default.createElement(index_1.Alert, { type: "error", message: "\u8BF4\u660E2\uFF1A\u5F02\u6B65\u9A8C\u8BC1\u4EC5\u652F\u6301 VAP2, \u6682\u4E0D\u652F\u6301 VAP1" }))) }), title: props.isEdit ? '编辑校验方法' : '添加校验方法', defaultValue: { method: 'GET', url: '/api/${value}' }, fields: [
|
|
68
68
|
{
|
|
69
69
|
field: 'url,method', title: '请求',
|
|
70
70
|
type: 'input-with-select',
|
package/uform/utils/Convert.js
CHANGED
|
@@ -311,7 +311,7 @@ var schemaToForm = function (schema) {
|
|
|
311
311
|
if (schema.size)
|
|
312
312
|
uformProps.size = schema.size;
|
|
313
313
|
if (lodash_1.default.keys(defaultValue).length > 0)
|
|
314
|
-
uformProps.
|
|
314
|
+
uformProps.defaultValue = defaultValue;
|
|
315
315
|
return uformProps;
|
|
316
316
|
};
|
|
317
317
|
exports.schemaToForm = schemaToForm;
|
|
@@ -5,7 +5,7 @@ type ImgRenderOptions = {
|
|
|
5
5
|
style?: CSSProperties;
|
|
6
6
|
width?: number;
|
|
7
7
|
height?: number;
|
|
8
|
-
|
|
8
|
+
defaultValue?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const ImgRender: (option?: ImgRenderOptions) => (link: string) => React.JSX.Element;
|
|
11
11
|
export declare const imgRender: (link: string) => React.JSX.Element;
|
|
@@ -98,7 +98,7 @@ var ImgRender = function (option) {
|
|
|
98
98
|
style.height = 80;
|
|
99
99
|
style.width = 80;
|
|
100
100
|
}
|
|
101
|
-
var defaultValue = (option === null || option === void 0 ? void 0 : option.
|
|
101
|
+
var defaultValue = (option === null || option === void 0 ? void 0 : option.defaultValue) || null;
|
|
102
102
|
if (lodash_1.default.has(option, 'style')) {
|
|
103
103
|
style = __assign(__assign({}, style), option.style);
|
|
104
104
|
}
|