@teamix/pro 1.2.34 → 1.3.2
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 +1542 -1149
- 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/Components/ProField/mapDateFormat.d.ts +3 -0
- package/es/form/Components/ProField/mapDateFormat.js +113 -0
- package/es/form/Filter/AdvancedFilter.js +4 -4
- package/es/form/Filter/LightFilter.js +22 -15
- package/es/form/Filter/index.js +171 -133
- package/es/form/Filter/useSpecialProps.d.ts +1 -1
- package/es/form/Filter/useSpecialProps.js +9 -9
- package/es/form/ProForm/customComponent.js +2 -1
- package/es/form/ProForm/index.scss +8 -8
- package/es/form/SchemaForm/index.js +2 -2
- package/es/form/SchemaForm/initializeRequest.js +1 -2
- package/es/form/SchemaForm/reactions.d.ts +2 -2
- package/es/form/SchemaForm/reactions.js +32 -21
- package/es/form/fieldTypeMap.d.ts +3 -0
- package/es/form/fieldTypeMap.js +3 -0
- package/es/form/typing.d.ts +8 -1
- package/es/index.d.ts +4 -4
- package/es/index.js +4 -4
- package/es/nocode/configurators/PageHeader.js +2 -2
- package/es/page-header/index.js +7 -3
- package/es/table/components/Layout/index.js +2 -2
- package/es/table/components/Pagination/index.js +11 -1
- package/es/table/components/ToolBar/DensityIcon.js +5 -3
- package/es/table/components/ToolBar/FilterColumnIcon.js +12 -3
- package/es/table/components/ToolBar/Fullscreen.js +6 -6
- package/es/table/components/ToolBar/index.scss +2 -2
- package/es/table/index.js +40 -21
- package/es/table/index.scss +6 -0
- package/es/table/typing.d.ts +13 -6
- package/es/table/utils/columnRender.js +6 -0
- package/es/timeline/ProTimeLineItem/index.d.ts +5 -0
- package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +59 -72
- package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
- package/es/timeline/index.d.ts +10 -0
- package/es/{step → timeline}/index.js +33 -57
- package/es/timeline/index.scss +7 -0
- package/es/timeline/typing.d.ts +101 -0
- package/es/{step → timeline}/typing.js +0 -0
- package/lib/actions/dialog-form.d.ts +9 -4
- package/lib/actions/dialog-form.js +16 -9
- package/lib/form/Components/ProField/mapDateFormat.d.ts +3 -0
- package/lib/form/Components/ProField/mapDateFormat.js +125 -0
- package/lib/form/Filter/AdvancedFilter.js +4 -4
- package/lib/form/Filter/LightFilter.js +21 -15
- package/lib/form/Filter/index.js +170 -132
- package/lib/form/Filter/useSpecialProps.d.ts +1 -1
- package/lib/form/Filter/useSpecialProps.js +8 -8
- package/lib/form/ProForm/customComponent.js +3 -1
- package/lib/form/ProForm/index.scss +8 -8
- package/lib/form/SchemaForm/index.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +1 -2
- package/lib/form/SchemaForm/reactions.d.ts +2 -2
- package/lib/form/SchemaForm/reactions.js +31 -20
- package/lib/form/fieldTypeMap.d.ts +3 -0
- package/lib/form/fieldTypeMap.js +5 -1
- package/lib/form/typing.d.ts +8 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +10 -10
- package/lib/nocode/configurators/PageHeader.js +2 -2
- package/lib/page-header/index.js +6 -2
- package/lib/table/components/Layout/index.js +2 -2
- package/lib/table/components/Pagination/index.js +10 -0
- package/lib/table/components/ToolBar/DensityIcon.js +5 -3
- package/lib/table/components/ToolBar/FilterColumnIcon.js +11 -2
- package/lib/table/components/ToolBar/Fullscreen.js +6 -6
- package/lib/table/components/ToolBar/index.scss +2 -2
- package/lib/table/index.js +40 -21
- package/lib/table/index.scss +6 -0
- package/lib/table/typing.d.ts +13 -6
- package/lib/table/utils/columnRender.js +6 -0
- package/lib/timeline/ProTimeLineItem/index.d.ts +5 -0
- package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +58 -72
- package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
- package/lib/timeline/index.d.ts +10 -0
- package/lib/{step → timeline}/index.js +38 -58
- package/lib/timeline/index.scss +7 -0
- package/lib/timeline/typing.d.ts +101 -0
- package/lib/{step → timeline}/typing.js +0 -0
- package/package.json +1 -1
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
- package/es/step/ProStepItem/components/HozStepItem/index.js +0 -235
- package/es/step/ProStepItem/components/HozStepItem/index.scss +0 -279
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
- package/es/step/ProStepItem/index.d.ts +0 -4
- package/es/step/ProStepItem/index.js +0 -57
- package/es/step/index.d.ts +0 -9
- package/es/step/typing.d.ts +0 -96
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
- package/lib/step/ProStepItem/components/HozStepItem/index.js +0 -258
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +0 -279
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
- package/lib/step/ProStepItem/index.d.ts +0 -4
- package/lib/step/ProStepItem/index.js +0 -69
- package/lib/step/index.d.ts +0 -9
- package/lib/step/typing.d.ts +0 -96
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["
|
1
|
+
var _excluded = ["items", "comment", "shape", "fold", "children"];
|
2
2
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
4
|
|
@@ -11,91 +11,67 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
12
12
|
|
13
13
|
import React, { useMemo } from 'react';
|
14
|
-
import {
|
15
|
-
import
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
import { Timeline } from '@alicloudfe/components';
|
15
|
+
import ProTimeLineItem from './ProTimeLineItem';
|
16
|
+
import { baseClass } from '@teamix/utils';
|
17
|
+
import classNames from 'classnames';
|
18
|
+
import './index.scss';
|
19
|
+
var cls = baseClass('teamix-pro-timeline');
|
20
|
+
|
21
|
+
var ProTimeline = function ProTimeline(props) {
|
22
|
+
var items = props.items,
|
23
|
+
comment = props.comment,
|
20
24
|
shape = props.shape,
|
25
|
+
fold = props.fold,
|
21
26
|
children = props.children,
|
22
|
-
others = _objectWithoutProperties(props, _excluded);
|
27
|
+
others = _objectWithoutProperties(props, _excluded); // 判断渲染组件是不是 ProTimelineItem, 并返回筛选后的children
|
23
28
|
|
24
|
-
var current = props.current,
|
25
|
-
labelPlacement = props.labelPlacement,
|
26
|
-
readOnly = props.readOnly,
|
27
|
-
animation = props.animation,
|
28
|
-
size = props.size;
|
29
|
-
var fold = props.fold; // 判断渲染组件是不是 ProStepItem, 并返回筛选后的children
|
30
29
|
|
31
30
|
var renderChildren = useMemo(function () {
|
32
|
-
return React.Children.map(children, function (child
|
31
|
+
return React.Children.map(children, function (child) {
|
33
32
|
var childElement = child;
|
34
33
|
var displayName = childElement.type.displayName;
|
35
34
|
|
36
|
-
if (displayName === '
|
35
|
+
if (displayName === 'ProTimeLineItem') {
|
37
36
|
return /*#__PURE__*/React.cloneElement(childElement, {
|
38
|
-
|
39
|
-
|
40
|
-
_index: index,
|
41
|
-
_current: current,
|
42
|
-
_shape: shape
|
37
|
+
_shape: shape,
|
38
|
+
_comment: comment
|
43
39
|
});
|
44
|
-
}
|
40
|
+
}
|
45
41
|
|
46
|
-
|
47
|
-
console.error('Warning: ProStep has a child which is not a ProStepItem component');
|
42
|
+
console.error('Warning: ProTimeline has a child which is not a ProTimelineItem component');
|
48
43
|
});
|
49
|
-
}, [children]);
|
50
|
-
|
51
|
-
var shapeMap = function shapeMap() {
|
52
|
-
if (shape === 'arrow') return 'arrow';
|
53
|
-
return 'circle';
|
54
|
-
}; // 渲染 ProStepItem
|
55
|
-
|
44
|
+
}, [children]);
|
56
45
|
|
57
46
|
var renderItem = function renderItem() {
|
58
47
|
// 传递了 item 采用 item 渲染数组的方式
|
59
48
|
if (items) {
|
60
49
|
return items.map(function (item, index) {
|
61
|
-
return /*#__PURE__*/React.createElement(
|
50
|
+
return /*#__PURE__*/React.createElement(ProTimeLineItem, _objectSpread({
|
62
51
|
key: index,
|
63
|
-
_mode: mode,
|
64
52
|
_shape: shape,
|
65
|
-
|
66
|
-
_current: current,
|
67
|
-
_size: size
|
53
|
+
_comment: comment
|
68
54
|
}, item));
|
69
55
|
});
|
70
56
|
} else {
|
71
57
|
return renderChildren;
|
72
58
|
}
|
73
|
-
}; // 渲染
|
74
|
-
|
59
|
+
}; // 渲染 ProTimelineItem
|
75
60
|
|
76
|
-
var renderProStep = function renderProStep() {
|
77
|
-
if (mode === 'ver') {
|
78
|
-
return /*#__PURE__*/React.createElement(Timeline, _objectSpread({
|
79
|
-
fold: fold
|
80
|
-
}, others), renderItem());
|
81
|
-
}
|
82
61
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
labelPlacement: labelPlacement,
|
87
|
-
readOnly: readOnly,
|
88
|
-
animation: animation
|
62
|
+
var renderProTimeline = function renderProTimeline() {
|
63
|
+
return /*#__PURE__*/React.createElement(Timeline, _objectSpread({
|
64
|
+
fold: fold
|
89
65
|
}, others), renderItem());
|
90
66
|
};
|
91
67
|
|
92
68
|
return /*#__PURE__*/React.createElement("div", {
|
93
|
-
className:
|
94
|
-
|
69
|
+
className: classNames(cls({
|
70
|
+
'': true,
|
71
|
+
comment: comment
|
72
|
+
}))
|
73
|
+
}, renderProTimeline());
|
95
74
|
};
|
96
75
|
|
97
|
-
|
98
|
-
|
99
|
-
mode: 'hoz'
|
100
|
-
};
|
101
|
-
export { ProStep, ProStepItem };
|
76
|
+
ProTimeline.Item = ProTimeLineItem;
|
77
|
+
export { ProTimeline, ProTimeLineItem };
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { ProTagItem } from '@teamix/utils';
|
3
|
+
export declare type ProTimeLineItemStatus = 'success' | 'fail' | 'process' | 'warning' | 'wait';
|
4
|
+
export declare type FoldProps = {
|
5
|
+
/**
|
6
|
+
* 折叠区域
|
7
|
+
*/
|
8
|
+
foldArea: [number, number];
|
9
|
+
/**
|
10
|
+
* 是否展示折叠图标
|
11
|
+
*/
|
12
|
+
foldShow: boolean;
|
13
|
+
};
|
14
|
+
export declare type ProTimeLineProps = {
|
15
|
+
/**
|
16
|
+
* 时间线:节点展示类型
|
17
|
+
*/
|
18
|
+
shape?: 'circle' | 'dot';
|
19
|
+
/**
|
20
|
+
* 内部渲染自组件
|
21
|
+
*/
|
22
|
+
items?: ProTimeLineItemProps[];
|
23
|
+
/**
|
24
|
+
* 时间线: 自定义折叠选项
|
25
|
+
*/
|
26
|
+
fold?: FoldProps[];
|
27
|
+
/**
|
28
|
+
* 是否为评论型 timeline
|
29
|
+
*/
|
30
|
+
comment?: boolean;
|
31
|
+
};
|
32
|
+
export declare type ProTimeLineItemProps = {
|
33
|
+
/**
|
34
|
+
* 是否为评论型 timeline
|
35
|
+
*/
|
36
|
+
_comment?: boolean;
|
37
|
+
/**
|
38
|
+
* 时间线:节点展示类型
|
39
|
+
*/
|
40
|
+
_shape?: 'circle' | 'dot';
|
41
|
+
/**
|
42
|
+
* 节点状态
|
43
|
+
*/
|
44
|
+
status?: string | ProTimeLineItemStatus;
|
45
|
+
/**
|
46
|
+
* 图标
|
47
|
+
*/
|
48
|
+
icon?: string;
|
49
|
+
/**
|
50
|
+
* 节点的内容
|
51
|
+
*/
|
52
|
+
content?: ReactNode;
|
53
|
+
/**
|
54
|
+
* 节点标题
|
55
|
+
*/
|
56
|
+
title?: ReactNode;
|
57
|
+
/**
|
58
|
+
* 自定义渲染
|
59
|
+
*/
|
60
|
+
dotRender?: (index?: number, status?: string) => ReactNode;
|
61
|
+
/**
|
62
|
+
* 节点副标题
|
63
|
+
*/
|
64
|
+
subTitle?: ReactNode;
|
65
|
+
/**
|
66
|
+
* 节点对应描述
|
67
|
+
*/
|
68
|
+
discription?: ReactNode;
|
69
|
+
/**
|
70
|
+
* 节点的标签
|
71
|
+
*/
|
72
|
+
tags?: ProTagItem[] | ReactNode;
|
73
|
+
/**
|
74
|
+
* 左侧展示时间
|
75
|
+
*/
|
76
|
+
timeLeft?: ReactNode;
|
77
|
+
/**
|
78
|
+
* 头像
|
79
|
+
*/
|
80
|
+
image?: string | ReactNode;
|
81
|
+
/**
|
82
|
+
* animation 动画
|
83
|
+
*/
|
84
|
+
animation?: boolean;
|
85
|
+
/**
|
86
|
+
* 卡片是否可折叠
|
87
|
+
*/
|
88
|
+
collapsible?: boolean;
|
89
|
+
/**
|
90
|
+
* 默认是否折叠,用于非受控模式
|
91
|
+
*/
|
92
|
+
defaultCollapsed?: boolean;
|
93
|
+
/**
|
94
|
+
* 是否折叠,受控模式
|
95
|
+
*/
|
96
|
+
collapsed?: boolean;
|
97
|
+
/**
|
98
|
+
* 折叠状态改变的回调函数
|
99
|
+
*/
|
100
|
+
onCollapse?: (collapsed: boolean) => void;
|
101
|
+
};
|
File without changes
|
@@ -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
|
}
|
@@ -0,0 +1,125 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _shared = require("@formily/shared");
|
9
|
+
|
10
|
+
var _utils = require("@teamix/utils");
|
11
|
+
|
12
|
+
var _moment = _interopRequireDefault(require("moment"));
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
17
|
+
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
|
+
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
21
|
+
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
23
|
+
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
25
|
+
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
27
|
+
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
29
|
+
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
31
|
+
|
32
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
33
|
+
|
34
|
+
var moment = function moment(date, format) {
|
35
|
+
return (0, _moment.default)((date === null || date === void 0 ? void 0 : date.toDate) ? date.toDate() : date, format);
|
36
|
+
};
|
37
|
+
|
38
|
+
var momentable = function momentable(value, format) {
|
39
|
+
return Array.isArray(value) ? value.map(function (val) {
|
40
|
+
return moment(val, format);
|
41
|
+
}) : value ? moment(value, format) : value;
|
42
|
+
};
|
43
|
+
|
44
|
+
var formatMomentValue = function formatMomentValue(value, format, placeholder) {
|
45
|
+
var formatDate = function formatDate(date, format) {
|
46
|
+
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
47
|
+
if (!date) return placeholder;
|
48
|
+
|
49
|
+
if ((0, _utils.isArr)(format)) {
|
50
|
+
var _format = format[i];
|
51
|
+
|
52
|
+
if ((0, _utils.isFn)(_format)) {
|
53
|
+
return _format(date);
|
54
|
+
}
|
55
|
+
|
56
|
+
if ((0, _shared.isEmpty)(_format)) {
|
57
|
+
return date;
|
58
|
+
}
|
59
|
+
|
60
|
+
return moment(date).format(_format);
|
61
|
+
} else {
|
62
|
+
if ((0, _utils.isFn)(format)) {
|
63
|
+
return format(date);
|
64
|
+
}
|
65
|
+
|
66
|
+
if ((0, _shared.isEmpty)(format)) {
|
67
|
+
return date;
|
68
|
+
}
|
69
|
+
|
70
|
+
return moment(date).format(format);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
if ((0, _utils.isArr)(value)) {
|
75
|
+
return value.map(function (val, index) {
|
76
|
+
return formatDate(val, format, index);
|
77
|
+
});
|
78
|
+
} else {
|
79
|
+
return value ? formatDate(value, format) : value || placeholder;
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
var mapDateFormatDatePicker2 = function mapDateFormatDatePicker2(type) {
|
84
|
+
var getDefaultFormat = function getDefaultFormat(props) {
|
85
|
+
var _type = props['type'] || type;
|
86
|
+
|
87
|
+
if (_type === 'month') {
|
88
|
+
return 'YYYY-MM';
|
89
|
+
} else if (_type === 'quarter') {
|
90
|
+
return 'YYYY-\\QQ';
|
91
|
+
} else if (_type === 'year') {
|
92
|
+
return 'YYYY';
|
93
|
+
} else if (_type === 'week') {
|
94
|
+
return 'YYYY-wo';
|
95
|
+
}
|
96
|
+
|
97
|
+
return props['showTime'] ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
|
98
|
+
};
|
99
|
+
|
100
|
+
return function (props) {
|
101
|
+
var format = props['format'] || getDefaultFormat(props);
|
102
|
+
var _onChange = props.onChange;
|
103
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
104
|
+
format: format === 'YYYY-MM-DD HH:mm:ss' ? 'YYYY-MM-DD' : format,
|
105
|
+
value: momentable(props.value, format === 'YYYY-wo' ? 'YYYY-w' : format),
|
106
|
+
onChange: function onChange(value) {
|
107
|
+
if (_onChange) {
|
108
|
+
_onChange(formatMomentValue(value, format));
|
109
|
+
}
|
110
|
+
}
|
111
|
+
});
|
112
|
+
};
|
113
|
+
};
|
114
|
+
|
115
|
+
var mapDateFormat = function mapDateFormat(props, field) {
|
116
|
+
var _ref = field.component || [],
|
117
|
+
_ref2 = _slicedToArray(_ref, 1),
|
118
|
+
component = _ref2[0];
|
119
|
+
|
120
|
+
console.log(component);
|
121
|
+
return {};
|
122
|
+
};
|
123
|
+
|
124
|
+
var _default = mapDateFormat;
|
125
|
+
exports.default = _default;
|
@@ -17,7 +17,7 @@ var _ProForm = _interopRequireDefault(require("../ProForm"));
|
|
17
17
|
|
18
18
|
var _utils2 = require("../utils");
|
19
19
|
|
20
|
-
var _excluded = ["schema", "onSubmit", "onReset", "
|
20
|
+
var _excluded = ["schema", "onSubmit", "onReset", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "forceClear"];
|
21
21
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
23
|
|
@@ -54,12 +54,12 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
54
54
|
var schema = props.schema,
|
55
55
|
onSubmit = props.onSubmit,
|
56
56
|
onReset = props.onReset,
|
57
|
-
onResetClick = props.onResetClick,
|
58
57
|
layout = props.layout,
|
59
58
|
labelAlign = props.labelAlign,
|
60
59
|
wrapperAlign = props.wrapperAlign,
|
61
60
|
labelCol = props.labelCol,
|
62
61
|
wrapperCol = props.wrapperCol,
|
62
|
+
forceClear = props.forceClear,
|
63
63
|
otherProps = _objectWithoutProperties(props, _excluded);
|
64
64
|
|
65
65
|
var prefixCls = (0, _utils.usePrefixCls)('', {
|
@@ -90,7 +90,7 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
90
90
|
component: 'Reset',
|
91
91
|
props: {
|
92
92
|
onResetValidateSuccess: onReset,
|
93
|
-
|
93
|
+
forceClear: !!forceClear,
|
94
94
|
children: (0, _utils.getMessage)('reset')
|
95
95
|
}
|
96
96
|
}, {
|
@@ -105,7 +105,7 @@ var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
105
105
|
}]
|
106
106
|
}])
|
107
107
|
}];
|
108
|
-
}, [schema, onReset
|
108
|
+
}, [schema, onReset]);
|
109
109
|
var getTeamixLayout = (0, _react.useMemo)(function () {
|
110
110
|
return {
|
111
111
|
breakpoints: [990],
|
@@ -11,13 +11,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
13
13
|
|
14
|
-
var _reactive = require("@formily/reactive");
|
15
|
-
|
16
14
|
var _utils = require("@teamix/utils");
|
17
15
|
|
18
16
|
var _ProForm = _interopRequireDefault(require("../ProForm"));
|
19
17
|
|
20
|
-
var _excluded = ["form", "schema", "onSubmit", "onChange", "defaultFilterValue"];
|
18
|
+
var _excluded = ["form", "schema", "onSubmit", "onChange", "defaultFilterValue", "activeFilterValueRef"];
|
21
19
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23
21
|
|
@@ -46,24 +44,32 @@ var LightFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
46
44
|
onSubmit = props.onSubmit,
|
47
45
|
onChange = props.onChange,
|
48
46
|
defaultFilterValue = props.defaultFilterValue,
|
47
|
+
activeFilterValueRef = props.activeFilterValueRef,
|
49
48
|
otherProps = _objectWithoutProperties(props, _excluded);
|
50
49
|
|
51
50
|
var filterValue = (0, _react.useRef)(defaultFilterValue || ((_schema$ = schema[0]) === null || _schema$ === void 0 ? void 0 : _schema$.name));
|
52
51
|
var prefixCls = (0, _utils.usePrefixCls)('', {
|
53
52
|
prefix: 'teamix-pro-form-query-filter-light'
|
54
|
-
});
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
});
|
54
|
+
(0, _react.useEffect)(function () {
|
55
|
+
if (activeFilterValueRef) {
|
56
|
+
activeFilterValueRef.current = filterValue.current;
|
57
|
+
}
|
58
|
+
}, []); // 筛选提交切换
|
59
59
|
|
60
60
|
var onFilterChange = (0, _react.useCallback)(function (value) {
|
61
61
|
filterValue.current = value;
|
62
|
-
}, [form]); // onChange
|
63
62
|
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
if (activeFilterValueRef) {
|
64
|
+
activeFilterValueRef.current = value;
|
65
|
+
}
|
66
|
+
}, [form]); // 实际输出onFilter
|
67
|
+
|
68
|
+
var onFilter = (0, _react.useCallback)(function () {
|
69
|
+
var key = filterValue.current;
|
70
|
+
var value = form.values[key];
|
71
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_defineProperty({}, key, value));
|
72
|
+
}, [onChange]);
|
67
73
|
var LightSchema = (0, _react.useMemo)(function () {
|
68
74
|
return [{
|
69
75
|
component: 'LightFilter',
|
@@ -71,7 +77,7 @@ var LightFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
71
77
|
defaultFilterValue: defaultFilterValue,
|
72
78
|
onFilterChange: onFilterChange,
|
73
79
|
buttonProps: {
|
74
|
-
onClick:
|
80
|
+
onClick: onFilter
|
75
81
|
}
|
76
82
|
},
|
77
83
|
children: schema
|
@@ -83,7 +89,7 @@ var LightFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
83
89
|
}
|
84
90
|
}
|
85
91
|
}];
|
86
|
-
}, [schema,
|
92
|
+
}, [schema, onFilter, onFilterChange, defaultFilterValue]);
|
87
93
|
return /*#__PURE__*/_react.default.createElement(_ProForm.default, _objectSpread(_objectSpread({}, otherProps), {}, {
|
88
94
|
form: form,
|
89
95
|
className: (0, _classnames.default)(prefixCls, props.className),
|
@@ -92,7 +98,7 @@ var LightFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
92
98
|
breakpoints: [],
|
93
99
|
bordered: false,
|
94
100
|
onSubmit: onSubmit,
|
95
|
-
onChange:
|
101
|
+
onChange: onFilter
|
96
102
|
}));
|
97
103
|
});
|
98
104
|
var _default = LightFilter;
|