@teamix/pro 1.3.0 → 1.3.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/dist/pro.css +1 -1
- package/dist/pro.js +48 -25
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +9 -4
- package/es/actions/dialog-form.js +16 -9
- package/es/form/SchemaForm/index.js +2 -2
- package/es/form/typing.d.ts +4 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/page-header/index.js +5 -1
- package/es/table/index.js +20 -9
- package/es/table/index.scss +6 -0
- package/es/table/typing.d.ts +8 -7
- package/lib/actions/dialog-form.d.ts +9 -4
- package/lib/actions/dialog-form.js +16 -9
- package/lib/form/SchemaForm/index.js +2 -2
- package/lib/form/typing.d.ts +4 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/page-header/index.js +5 -1
- package/lib/table/index.js +20 -9
- package/lib/table/index.scss +6 -0
- package/lib/table/typing.d.ts +8 -7
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { ProFormProps, ProFormSchema } from '../form';
|
2
|
+
import { ProFormProps, ProFormSchema, ProFormType } from '../form';
|
3
3
|
import { RequestAction } from './request';
|
4
4
|
import { DialogAction } from './dialog';
|
5
5
|
export interface DialogFormAction extends DialogAction {
|
@@ -12,9 +12,14 @@ export interface DialogFormAction extends DialogAction {
|
|
12
12
|
/**
|
13
13
|
* @deprecated 建议使用 schema 配置 ProFormProps 代替
|
14
14
|
*/
|
15
|
-
formProps?: Omit<ProFormProps, 'schema'>;
|
16
|
-
/**
|
17
|
-
|
15
|
+
formProps?: Omit<ProFormProps, 'schema' | 'form'>;
|
16
|
+
/** 同时支持两种配置方式:
|
17
|
+
* 如果想完整定制表单,可使用完整的表单配置项 ProFormProps,但不可以传 form 字段,可以通过 formRef 获取内部 form 实例。
|
18
|
+
* 否则可以只配置 ProFormSchema
|
19
|
+
*/
|
20
|
+
schema: ProFormSchema | Omit<ProFormProps, 'form'>;
|
21
|
+
/** 外部传来的 formRef,用于获取内置 form 实例 */
|
22
|
+
formRef?: React.MutableRefObject<ProFormType | undefined>;
|
18
23
|
}
|
19
24
|
export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
|
20
25
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["schema"],
|
2
|
-
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest"];
|
2
|
+
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest", "formRef"];
|
3
3
|
|
4
4
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
5
5
|
|
@@ -89,7 +89,8 @@ var DialogForm = function DialogForm(props) {
|
|
89
89
|
schema = props.schema,
|
90
90
|
formProps = props.formProps,
|
91
91
|
context = props.context,
|
92
|
-
formRef = props.formRef
|
92
|
+
formRef = props.formRef,
|
93
|
+
innerFormRef = props.innerFormRef;
|
93
94
|
|
94
95
|
var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
|
95
96
|
formSchema = _getSchemaAndFormProp.schema,
|
@@ -106,7 +107,11 @@ var DialogForm = function DialogForm(props) {
|
|
106
107
|
|
107
108
|
var history = useHistory();
|
108
109
|
useEffect(function () {
|
109
|
-
formRef
|
110
|
+
if (formRef) {
|
111
|
+
formRef.current = form;
|
112
|
+
}
|
113
|
+
|
114
|
+
innerFormRef.current = form;
|
110
115
|
|
111
116
|
if (initialRequest) {
|
112
117
|
setLoading(true);
|
@@ -141,9 +146,10 @@ export function useDialogFormAction(action, context) {
|
|
141
146
|
size = _action$size === void 0 ? 'small' : _action$size,
|
142
147
|
_onFinish = action.onFinish,
|
143
148
|
propsBeforeRequest = action.beforeRequest,
|
149
|
+
propsFormRef = action.formRef,
|
144
150
|
others = _objectWithoutProperties(action, _excluded2);
|
145
151
|
|
146
|
-
var
|
152
|
+
var innerFormRef = /*#__PURE__*/createRef();
|
147
153
|
return useDialogAction(Object.assign({
|
148
154
|
size: size,
|
149
155
|
closeable: true,
|
@@ -157,13 +163,14 @@ export function useDialogFormAction(action, context) {
|
|
157
163
|
context: contentContext
|
158
164
|
};
|
159
165
|
return /*#__PURE__*/React.createElement(DialogForm, _objectSpread({
|
160
|
-
|
166
|
+
innerFormRef: innerFormRef,
|
167
|
+
formRef: propsFormRef
|
161
168
|
}, dialogFormProps));
|
162
169
|
},
|
163
170
|
extendParams: useFieldValuesForRequest ? '{{fields}}' : undefined,
|
164
171
|
beforeRequest: function beforeRequest(context) {
|
165
172
|
return new Promise(function (resolve, reject) {
|
166
|
-
|
173
|
+
innerFormRef.current.validate().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
167
174
|
var beforeRequestContext, requestContext;
|
168
175
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
169
176
|
while (1) {
|
@@ -199,7 +206,7 @@ export function useDialogFormAction(action, context) {
|
|
199
206
|
|
200
207
|
case 13:
|
201
208
|
requestContext = Object.assign({
|
202
|
-
fields:
|
209
|
+
fields: innerFormRef.current.values
|
203
210
|
}, _typeof(beforeRequestContext) === 'object' ? beforeRequestContext : {});
|
204
211
|
resolve(requestContext);
|
205
212
|
|
@@ -215,9 +222,9 @@ export function useDialogFormAction(action, context) {
|
|
215
222
|
});
|
216
223
|
},
|
217
224
|
onFinish: function onFinish() {
|
218
|
-
var
|
225
|
+
var _innerFormRef$current;
|
219
226
|
|
220
|
-
_onFinish && _onFinish((
|
227
|
+
_onFinish && _onFinish((_innerFormRef$current = innerFormRef.current) === null || _innerFormRef$current === void 0 ? void 0 : _innerFormRef$current.values);
|
221
228
|
}
|
222
229
|
}, others), context);
|
223
230
|
}
|
@@ -106,10 +106,10 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
106
106
|
}, [scope]); // 格式化 schema
|
107
107
|
|
108
108
|
var formatSchema = useCallback(function (schema) {
|
109
|
-
var
|
109
|
+
var parentSuffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
110
110
|
var schemaProperties = {};
|
111
111
|
schema === null || schema === void 0 ? void 0 : schema.forEach(function (item, index) {
|
112
|
-
suffix = "".concat(
|
112
|
+
var suffix = "".concat(parentSuffix).concat(index);
|
113
113
|
var newItem = warning(item);
|
114
114
|
var _newItem = newItem,
|
115
115
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
package/es/form/typing.d.ts
CHANGED
@@ -10,6 +10,10 @@ declare type FieldDisplayTypes = 'none' | 'hidden' | 'visible';
|
|
10
10
|
export interface ProFormInitializeItem {
|
11
11
|
(item: ProFormSchemaItem, props?: any): ProFormSchemaItem;
|
12
12
|
}
|
13
|
+
/**
|
14
|
+
* ProForm 实例类型
|
15
|
+
*/
|
16
|
+
export declare type ProFormType = FormType;
|
13
17
|
declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker' | 'Percent' | 'Money' | 'Select' | 'MultipleSelect' | 'TreeSelect' | 'Cascader' | 'MultipleCascader' | 'ArbitraryCascader' | 'Radio' | 'Checkbox' | 'Switch' | 'DatePicker' | 'TimePicker' | 'DateTimePicker' | 'WeekPicker' | 'MonthPicker' | 'YearPicker' | 'QuarterPicker' | 'DateRangePicker' | 'TimeRangePicker' | 'DateTimeRangePicker' | 'WeekRangePicker' | 'MonthRangePicker' | 'YearRangePicker' | 'QuarterRangePicker' | 'Transfer' | 'Upload' | 'ColorPicker' | 'ColorRadio' | 'IconPicker' | 'JsonInput' | 'TagPicker' | 'MultipleTagPicker' | 'Range' | 'Search' | 'SelectGroup';
|
14
18
|
declare type IButtonComponent = 'Submit' | 'Reset';
|
15
19
|
declare type IComboComponent = 'ArrayCards' | 'ArrayCards.Addition' | 'ArrayCards.Remove' | 'ArrayCards.MoveUp' | 'ArrayCards.MoveDown' | 'ArrayCards.Index' | 'ArrayCollapse' | 'ArrayCollapse.CollapsePanel' | 'ArrayCollapse.Addition' | 'ArrayCollapse.Remove' | 'ArrayCollapse.MoveUp' | 'ArrayCollapse.MoveDown' | 'ArrayCollapse.Index' | 'ArrayTable' | 'ArrayTable.Column' | 'ArrayTable.SortHandle' | 'ArrayTable.Addition' | 'ArrayTable.Remove' | 'ArrayTable.MoveDown' | 'ArrayTable.MoveUp' | 'ArrayTable.Index' | 'ArrayItems' | 'ArrayItems.Item' | 'ArrayItems.SortHandle' | 'ArrayItems.Addition' | 'ArrayItems.Remove' | 'ArrayItems.MoveDown' | 'ArrayItems.MoveUp' | 'ArrayItems.Index' | 'Editable' | 'Editable.Popover' | 'Editable.Dialog' | 'Editable.Drawer';
|
package/es/index.d.ts
CHANGED
@@ -24,5 +24,5 @@ export * from './skeleton';
|
|
24
24
|
export * from './table';
|
25
25
|
export * from './utils';
|
26
26
|
export * from './timeline';
|
27
|
-
declare const version = "1.3.
|
27
|
+
declare const version = "1.3.1";
|
28
28
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProTimeline, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -30,7 +30,7 @@ export * from './table';
|
|
30
30
|
export * from './utils'; // export * from './sidebar';
|
31
31
|
|
32
32
|
export * from './timeline';
|
33
|
-
var version = '1.3.
|
33
|
+
var version = '1.3.1';
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
35
35
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
36
36
|
ProTimeline, hooks, nocode, templates, utils };
|
package/es/page-header/index.js
CHANGED
@@ -70,7 +70,11 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
|
|
70
70
|
var isBgColorPresetColor = isPresetColor(backgroundColor);
|
71
71
|
var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(getColorClassName(color)), isColorPresetColor), _defineProperty(_classnames, "".concat(getBackgroundColorClassName(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
|
72
72
|
var styleColor = isColorPresetColor ? getColor(color) : color;
|
73
|
-
var styleBgColor = isBgColorPresetColor ? getColor(
|
73
|
+
var styleBgColor = isBgColorPresetColor ? getColor(backgroundColor) : backgroundColor; // debugger;
|
74
|
+
// console.log('color', color);
|
75
|
+
// console.log('backgroundColor', backgroundColor);
|
76
|
+
// console.log('styleBgColor', styleBgColor);
|
77
|
+
|
74
78
|
var style = {
|
75
79
|
color: styleColor,
|
76
80
|
backgroundColor: styleBgColor
|
package/es/table/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams"];
|
1
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords"];
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
4
|
|
@@ -176,6 +176,8 @@ var ProTable = function ProTable(props) {
|
|
176
176
|
_props$filterColumnTy = props.filterColumnType,
|
177
177
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
178
178
|
defaultFilterParams = props.defaultFilterParams,
|
179
|
+
_props$reserveSelecte = props.reserveSelectedRecords,
|
180
|
+
reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
|
179
181
|
otherProps = _objectWithoutProperties(props, _excluded);
|
180
182
|
|
181
183
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -339,7 +341,7 @@ var ProTable = function ProTable(props) {
|
|
339
341
|
result = propsRowSelection.getProps(record, index);
|
340
342
|
}
|
341
343
|
|
342
|
-
if (showSkeleton) {
|
344
|
+
if (showSkeleton && result) {
|
343
345
|
result.disabled = true;
|
344
346
|
}
|
345
347
|
|
@@ -860,21 +862,30 @@ var ProTable = function ProTable(props) {
|
|
860
862
|
|
861
863
|
var renderFooter = function renderFooter() {
|
862
864
|
function onChangePagination(currentPage) {
|
863
|
-
var _actionRef$current7, _actionRef$current7$c;
|
864
|
-
|
865
865
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
866
|
-
|
867
|
-
|
866
|
+
|
867
|
+
// 翻页默认清空选择
|
868
|
+
if (!reserveSelectedRecords) {
|
869
|
+
var _actionRef$current7, _actionRef$current7$c;
|
870
|
+
|
871
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
872
|
+
}
|
873
|
+
|
868
874
|
setCurrentPage(currentPage);
|
869
875
|
|
870
876
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
871
877
|
}
|
872
878
|
|
873
879
|
function onChangePaginationSize(currentPageSize) {
|
874
|
-
var
|
880
|
+
var _request5;
|
881
|
+
|
882
|
+
// 翻页默认清空选择
|
883
|
+
if (!reserveSelectedRecords) {
|
884
|
+
var _actionRef$current8, _actionRef$current8$c;
|
885
|
+
|
886
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
887
|
+
}
|
875
888
|
|
876
|
-
// 翻页暂时先清空选择
|
877
|
-
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
878
889
|
setPageSize(currentPageSize);
|
879
890
|
setCurrentPage(1);
|
880
891
|
|
package/es/table/index.scss
CHANGED
package/es/table/typing.d.ts
CHANGED
@@ -3,13 +3,12 @@
|
|
3
3
|
*/
|
4
4
|
import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
|
5
5
|
import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
|
6
|
-
import { QueryFilterProps } from '../form';
|
6
|
+
import { QueryFilterProps, ProFormType } from '../form';
|
7
7
|
import { ProActionGroupProps, ProActionButtonProps } from '../actions';
|
8
8
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
9
9
|
import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
|
10
10
|
import { Method } from 'axios';
|
11
11
|
import React from 'react';
|
12
|
-
import type { Form as FormType } from '@formily/core';
|
13
12
|
declare type IFieldRenderProps = keyof ProFieldRenderProps;
|
14
13
|
/** 列record函数 */
|
15
14
|
declare type ProTableCellFunProp = (value: any, index: number, record: any, ...others: any) => any;
|
@@ -102,7 +101,7 @@ export declare type ProTableProps = {
|
|
102
101
|
/** 内置 rowSelection 变化时的回调 */
|
103
102
|
onChangeRowSelection?: (selectedRowKeys: string[]) => void;
|
104
103
|
/** 获取内置 rowSelection */
|
105
|
-
getRowSelection?: (rowSelection:
|
104
|
+
getRowSelection?: (rowSelection: innerRowSelectionType) => void;
|
106
105
|
/** 表格底部(左侧)配置 */
|
107
106
|
footerAction?: ProActionGroupProps | React.ReactNode;
|
108
107
|
/** 表格底部(右层)配置 */
|
@@ -130,6 +129,8 @@ export declare type ProTableProps = {
|
|
130
129
|
data: any[];
|
131
130
|
total?: number;
|
132
131
|
}>;
|
132
|
+
/** 翻页时是否保留之前批量选择数据 */
|
133
|
+
reserveSelectedRecords?: boolean;
|
133
134
|
/** 默认漏斗过滤条件 */
|
134
135
|
defaultFilterParams?: {
|
135
136
|
[key: string]: any[] | any;
|
@@ -189,11 +190,11 @@ export declare type ProTableActionType = {
|
|
189
190
|
/** 重置翻页器为1,不发送请求 */
|
190
191
|
resetPage?: () => void;
|
191
192
|
/** 获取数据过滤区表单实例 */
|
192
|
-
dataFilterForm?:
|
193
|
+
dataFilterForm?: ProFormType;
|
193
194
|
/** 用于在 mount 的时候获取到表单 ref */
|
194
|
-
dataFilterFormRef?: React.MutableRefObject<
|
195
|
-
normalDataFilterForm?:
|
196
|
-
fullscreenDataFilterForm?:
|
195
|
+
dataFilterFormRef?: React.MutableRefObject<ProFormType>;
|
196
|
+
normalDataFilterForm?: ProFormType;
|
197
|
+
fullscreenDataFilterForm?: ProFormType;
|
197
198
|
filterEnableRef?: any;
|
198
199
|
/** 表格当前的数据 */
|
199
200
|
data?: any[];
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { ProFormProps, ProFormSchema } from '../form';
|
2
|
+
import { ProFormProps, ProFormSchema, ProFormType } from '../form';
|
3
3
|
import { RequestAction } from './request';
|
4
4
|
import { DialogAction } from './dialog';
|
5
5
|
export interface DialogFormAction extends DialogAction {
|
@@ -12,9 +12,14 @@ export interface DialogFormAction extends DialogAction {
|
|
12
12
|
/**
|
13
13
|
* @deprecated 建议使用 schema 配置 ProFormProps 代替
|
14
14
|
*/
|
15
|
-
formProps?: Omit<ProFormProps, 'schema'>;
|
16
|
-
/**
|
17
|
-
|
15
|
+
formProps?: Omit<ProFormProps, 'schema' | 'form'>;
|
16
|
+
/** 同时支持两种配置方式:
|
17
|
+
* 如果想完整定制表单,可使用完整的表单配置项 ProFormProps,但不可以传 form 字段,可以通过 formRef 获取内部 form 实例。
|
18
|
+
* 否则可以只配置 ProFormSchema
|
19
|
+
*/
|
20
|
+
schema: ProFormSchema | Omit<ProFormProps, 'form'>;
|
21
|
+
/** 外部传来的 formRef,用于获取内置 form 实例 */
|
22
|
+
formRef?: React.MutableRefObject<ProFormType | undefined>;
|
18
23
|
}
|
19
24
|
export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
|
20
25
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
@@ -23,7 +23,7 @@ var _dialog = _interopRequireDefault(require("./dialog"));
|
|
23
23
|
var _utils2 = require("./utils");
|
24
24
|
|
25
25
|
var _excluded = ["schema"],
|
26
|
-
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest"];
|
26
|
+
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest", "formRef"];
|
27
27
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29
29
|
|
@@ -110,7 +110,8 @@ var DialogForm = function DialogForm(props) {
|
|
110
110
|
schema = props.schema,
|
111
111
|
formProps = props.formProps,
|
112
112
|
context = props.context,
|
113
|
-
formRef = props.formRef
|
113
|
+
formRef = props.formRef,
|
114
|
+
innerFormRef = props.innerFormRef;
|
114
115
|
|
115
116
|
var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
|
116
117
|
formSchema = _getSchemaAndFormProp.schema,
|
@@ -127,7 +128,11 @@ var DialogForm = function DialogForm(props) {
|
|
127
128
|
|
128
129
|
var history = (0, _reactRouterDom.useHistory)();
|
129
130
|
(0, _react.useEffect)(function () {
|
130
|
-
formRef
|
131
|
+
if (formRef) {
|
132
|
+
formRef.current = form;
|
133
|
+
}
|
134
|
+
|
135
|
+
innerFormRef.current = form;
|
131
136
|
|
132
137
|
if (initialRequest) {
|
133
138
|
setLoading(true);
|
@@ -162,9 +167,10 @@ function useDialogFormAction(action, context) {
|
|
162
167
|
size = _action$size === void 0 ? 'small' : _action$size,
|
163
168
|
_onFinish = action.onFinish,
|
164
169
|
propsBeforeRequest = action.beforeRequest,
|
170
|
+
propsFormRef = action.formRef,
|
165
171
|
others = _objectWithoutProperties(action, _excluded2);
|
166
172
|
|
167
|
-
var
|
173
|
+
var innerFormRef = /*#__PURE__*/(0, _react.createRef)();
|
168
174
|
return (0, _dialog.default)(Object.assign({
|
169
175
|
size: size,
|
170
176
|
closeable: true,
|
@@ -178,13 +184,14 @@ function useDialogFormAction(action, context) {
|
|
178
184
|
context: contentContext
|
179
185
|
};
|
180
186
|
return /*#__PURE__*/_react.default.createElement(DialogForm, _objectSpread({
|
181
|
-
|
187
|
+
innerFormRef: innerFormRef,
|
188
|
+
formRef: propsFormRef
|
182
189
|
}, dialogFormProps));
|
183
190
|
},
|
184
191
|
extendParams: useFieldValuesForRequest ? '{{fields}}' : undefined,
|
185
192
|
beforeRequest: function beforeRequest(context) {
|
186
193
|
return new Promise(function (resolve, reject) {
|
187
|
-
|
194
|
+
innerFormRef.current.validate().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
188
195
|
var beforeRequestContext, requestContext;
|
189
196
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
190
197
|
while (1) {
|
@@ -220,7 +227,7 @@ function useDialogFormAction(action, context) {
|
|
220
227
|
|
221
228
|
case 13:
|
222
229
|
requestContext = Object.assign({
|
223
|
-
fields:
|
230
|
+
fields: innerFormRef.current.values
|
224
231
|
}, _typeof(beforeRequestContext) === 'object' ? beforeRequestContext : {});
|
225
232
|
resolve(requestContext);
|
226
233
|
|
@@ -236,9 +243,9 @@ function useDialogFormAction(action, context) {
|
|
236
243
|
});
|
237
244
|
},
|
238
245
|
onFinish: function onFinish() {
|
239
|
-
var
|
246
|
+
var _innerFormRef$current;
|
240
247
|
|
241
|
-
_onFinish && _onFinish((
|
248
|
+
_onFinish && _onFinish((_innerFormRef$current = innerFormRef.current) === null || _innerFormRef$current === void 0 ? void 0 : _innerFormRef$current.values);
|
242
249
|
}
|
243
250
|
}, others), context);
|
244
251
|
}
|
@@ -150,10 +150,10 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
150
150
|
}, [scope]); // 格式化 schema
|
151
151
|
|
152
152
|
var formatSchema = (0, _react.useCallback)(function (schema) {
|
153
|
-
var
|
153
|
+
var parentSuffix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
154
154
|
var schemaProperties = {};
|
155
155
|
schema === null || schema === void 0 ? void 0 : schema.forEach(function (item, index) {
|
156
|
-
suffix = "".concat(
|
156
|
+
var suffix = "".concat(parentSuffix).concat(index);
|
157
157
|
var newItem = (0, _warning.default)(item);
|
158
158
|
var _newItem = newItem,
|
159
159
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
package/lib/form/typing.d.ts
CHANGED
@@ -10,6 +10,10 @@ declare type FieldDisplayTypes = 'none' | 'hidden' | 'visible';
|
|
10
10
|
export interface ProFormInitializeItem {
|
11
11
|
(item: ProFormSchemaItem, props?: any): ProFormSchemaItem;
|
12
12
|
}
|
13
|
+
/**
|
14
|
+
* ProForm 实例类型
|
15
|
+
*/
|
16
|
+
export declare type ProFormType = FormType;
|
13
17
|
declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker' | 'Percent' | 'Money' | 'Select' | 'MultipleSelect' | 'TreeSelect' | 'Cascader' | 'MultipleCascader' | 'ArbitraryCascader' | 'Radio' | 'Checkbox' | 'Switch' | 'DatePicker' | 'TimePicker' | 'DateTimePicker' | 'WeekPicker' | 'MonthPicker' | 'YearPicker' | 'QuarterPicker' | 'DateRangePicker' | 'TimeRangePicker' | 'DateTimeRangePicker' | 'WeekRangePicker' | 'MonthRangePicker' | 'YearRangePicker' | 'QuarterRangePicker' | 'Transfer' | 'Upload' | 'ColorPicker' | 'ColorRadio' | 'IconPicker' | 'JsonInput' | 'TagPicker' | 'MultipleTagPicker' | 'Range' | 'Search' | 'SelectGroup';
|
14
18
|
declare type IButtonComponent = 'Submit' | 'Reset';
|
15
19
|
declare type IComboComponent = 'ArrayCards' | 'ArrayCards.Addition' | 'ArrayCards.Remove' | 'ArrayCards.MoveUp' | 'ArrayCards.MoveDown' | 'ArrayCards.Index' | 'ArrayCollapse' | 'ArrayCollapse.CollapsePanel' | 'ArrayCollapse.Addition' | 'ArrayCollapse.Remove' | 'ArrayCollapse.MoveUp' | 'ArrayCollapse.MoveDown' | 'ArrayCollapse.Index' | 'ArrayTable' | 'ArrayTable.Column' | 'ArrayTable.SortHandle' | 'ArrayTable.Addition' | 'ArrayTable.Remove' | 'ArrayTable.MoveDown' | 'ArrayTable.MoveUp' | 'ArrayTable.Index' | 'ArrayItems' | 'ArrayItems.Item' | 'ArrayItems.SortHandle' | 'ArrayItems.Addition' | 'ArrayItems.Remove' | 'ArrayItems.MoveDown' | 'ArrayItems.MoveUp' | 'ArrayItems.Index' | 'Editable' | 'Editable.Popover' | 'Editable.Dialog' | 'Editable.Drawer';
|
package/lib/index.d.ts
CHANGED
@@ -24,5 +24,5 @@ export * from './skeleton';
|
|
24
24
|
export * from './table';
|
25
25
|
export * from './utils';
|
26
26
|
export * from './timeline';
|
27
|
-
declare const version = "1.3.
|
27
|
+
declare const version = "1.3.1";
|
28
28
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProTimeline, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
package/lib/page-header/index.js
CHANGED
@@ -89,7 +89,11 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
|
|
89
89
|
var isBgColorPresetColor = (0, _utils.isPresetColor)(backgroundColor);
|
90
90
|
var className = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "".concat((0, _utils.getColorClassName)(color)), isColorPresetColor), _defineProperty(_classnames, "".concat((0, _utils.getBackgroundColorClassName)(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
|
91
91
|
var styleColor = isColorPresetColor ? (0, _utils.getColor)(color) : color;
|
92
|
-
var styleBgColor = isBgColorPresetColor ? (0, _utils.getColor)(
|
92
|
+
var styleBgColor = isBgColorPresetColor ? (0, _utils.getColor)(backgroundColor) : backgroundColor; // debugger;
|
93
|
+
// console.log('color', color);
|
94
|
+
// console.log('backgroundColor', backgroundColor);
|
95
|
+
// console.log('styleBgColor', styleBgColor);
|
96
|
+
|
93
97
|
var style = {
|
94
98
|
color: styleColor,
|
95
99
|
backgroundColor: styleBgColor
|
package/lib/table/index.js
CHANGED
@@ -55,7 +55,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
55
55
|
}
|
56
56
|
});
|
57
57
|
});
|
58
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams"];
|
58
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords"];
|
59
59
|
|
60
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
61
61
|
|
@@ -220,6 +220,8 @@ var ProTable = function ProTable(props) {
|
|
220
220
|
_props$filterColumnTy = props.filterColumnType,
|
221
221
|
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
222
222
|
defaultFilterParams = props.defaultFilterParams,
|
223
|
+
_props$reserveSelecte = props.reserveSelectedRecords,
|
224
|
+
reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
|
223
225
|
otherProps = _objectWithoutProperties(props, _excluded);
|
224
226
|
|
225
227
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -383,7 +385,7 @@ var ProTable = function ProTable(props) {
|
|
383
385
|
result = propsRowSelection.getProps(record, index);
|
384
386
|
}
|
385
387
|
|
386
|
-
if (showSkeleton) {
|
388
|
+
if (showSkeleton && result) {
|
387
389
|
result.disabled = true;
|
388
390
|
}
|
389
391
|
|
@@ -904,21 +906,30 @@ var ProTable = function ProTable(props) {
|
|
904
906
|
|
905
907
|
var renderFooter = function renderFooter() {
|
906
908
|
function onChangePagination(currentPage) {
|
907
|
-
var _actionRef$current7, _actionRef$current7$c;
|
908
|
-
|
909
909
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
910
|
-
|
911
|
-
|
910
|
+
|
911
|
+
// 翻页默认清空选择
|
912
|
+
if (!reserveSelectedRecords) {
|
913
|
+
var _actionRef$current7, _actionRef$current7$c;
|
914
|
+
|
915
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
916
|
+
}
|
917
|
+
|
912
918
|
setCurrentPage(currentPage);
|
913
919
|
|
914
920
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
915
921
|
}
|
916
922
|
|
917
923
|
function onChangePaginationSize(currentPageSize) {
|
918
|
-
var
|
924
|
+
var _request5;
|
925
|
+
|
926
|
+
// 翻页默认清空选择
|
927
|
+
if (!reserveSelectedRecords) {
|
928
|
+
var _actionRef$current8, _actionRef$current8$c;
|
929
|
+
|
930
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
931
|
+
}
|
919
932
|
|
920
|
-
// 翻页暂时先清空选择
|
921
|
-
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
922
933
|
setPageSize(currentPageSize);
|
923
934
|
setCurrentPage(1);
|
924
935
|
|
package/lib/table/index.scss
CHANGED
package/lib/table/typing.d.ts
CHANGED
@@ -3,13 +3,12 @@
|
|
3
3
|
*/
|
4
4
|
import { ColumnProps, TableProps } from '@alicloudfe/components/types/table';
|
5
5
|
import { ProFieldType, ProFieldRenderProps, ProFieldDataSourceItem } from '../field';
|
6
|
-
import { QueryFilterProps } from '../form';
|
6
|
+
import { QueryFilterProps, ProFormType } from '../form';
|
7
7
|
import { ProActionGroupProps, ProActionButtonProps } from '../actions';
|
8
8
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
9
9
|
import { HeaderProps as ProTableHeaderProps } from '@teamix/utils';
|
10
10
|
import { Method } from 'axios';
|
11
11
|
import React from 'react';
|
12
|
-
import type { Form as FormType } from '@formily/core';
|
13
12
|
declare type IFieldRenderProps = keyof ProFieldRenderProps;
|
14
13
|
/** 列record函数 */
|
15
14
|
declare type ProTableCellFunProp = (value: any, index: number, record: any, ...others: any) => any;
|
@@ -102,7 +101,7 @@ export declare type ProTableProps = {
|
|
102
101
|
/** 内置 rowSelection 变化时的回调 */
|
103
102
|
onChangeRowSelection?: (selectedRowKeys: string[]) => void;
|
104
103
|
/** 获取内置 rowSelection */
|
105
|
-
getRowSelection?: (rowSelection:
|
104
|
+
getRowSelection?: (rowSelection: innerRowSelectionType) => void;
|
106
105
|
/** 表格底部(左侧)配置 */
|
107
106
|
footerAction?: ProActionGroupProps | React.ReactNode;
|
108
107
|
/** 表格底部(右层)配置 */
|
@@ -130,6 +129,8 @@ export declare type ProTableProps = {
|
|
130
129
|
data: any[];
|
131
130
|
total?: number;
|
132
131
|
}>;
|
132
|
+
/** 翻页时是否保留之前批量选择数据 */
|
133
|
+
reserveSelectedRecords?: boolean;
|
133
134
|
/** 默认漏斗过滤条件 */
|
134
135
|
defaultFilterParams?: {
|
135
136
|
[key: string]: any[] | any;
|
@@ -189,11 +190,11 @@ export declare type ProTableActionType = {
|
|
189
190
|
/** 重置翻页器为1,不发送请求 */
|
190
191
|
resetPage?: () => void;
|
191
192
|
/** 获取数据过滤区表单实例 */
|
192
|
-
dataFilterForm?:
|
193
|
+
dataFilterForm?: ProFormType;
|
193
194
|
/** 用于在 mount 的时候获取到表单 ref */
|
194
|
-
dataFilterFormRef?: React.MutableRefObject<
|
195
|
-
normalDataFilterForm?:
|
196
|
-
fullscreenDataFilterForm?:
|
195
|
+
dataFilterFormRef?: React.MutableRefObject<ProFormType>;
|
196
|
+
normalDataFilterForm?: ProFormType;
|
197
|
+
fullscreenDataFilterForm?: ProFormType;
|
197
198
|
filterEnableRef?: any;
|
198
199
|
/** 表格当前的数据 */
|
199
200
|
data?: any[];
|