@teamix/pro 1.3.13 → 1.3.14
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 +632 -185
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/index.js +40 -4
- package/es/form/Filter/LightFilter.js +7 -5
- package/es/form/Filter/index.js +2 -2
- package/es/form/ProForm/index.d.ts +2 -3
- package/es/form/ProForm/index.js +47 -8
- package/es/form/ProForm/index.scss +7 -0
- package/es/form/ProForm/useFieldSchema.d.ts +7 -0
- package/es/form/ProForm/useFieldSchema.js +88 -0
- package/es/form/SchemaForm/index.js +2 -38
- package/es/form/SchemaForm/initializeSelectTable.js +80 -6
- package/es/form/typing.d.ts +4 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/ToolBar/Fullscreen.d.ts +1 -1
- package/es/table/utils/pureColumnRender.d.ts +9 -0
- package/es/table/utils/pureColumnRender.js +201 -0
- package/es/table/utils/pureGenProColumnToColumn.d.ts +7 -0
- package/es/table/utils/pureGenProColumnToColumn.js +36 -0
- package/es/timeline/ProTimeLineItem/index.js +8 -5
- package/es/timeline/typing.d.ts +5 -0
- package/lib/actions/index.js +40 -4
- package/lib/form/Filter/LightFilter.js +7 -6
- package/lib/form/Filter/index.js +2 -2
- package/lib/form/ProForm/index.d.ts +2 -3
- package/lib/form/ProForm/index.js +53 -7
- package/lib/form/ProForm/index.scss +7 -0
- package/lib/form/ProForm/useFieldSchema.d.ts +7 -0
- package/lib/form/ProForm/useFieldSchema.js +97 -0
- package/lib/form/SchemaForm/index.js +2 -45
- package/lib/form/SchemaForm/initializeSelectTable.js +85 -6
- package/lib/form/typing.d.ts +4 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/ToolBar/Fullscreen.d.ts +1 -1
- package/lib/table/utils/pureColumnRender.d.ts +9 -0
- package/lib/table/utils/pureColumnRender.js +215 -0
- package/lib/table/utils/pureGenProColumnToColumn.d.ts +7 -0
- package/lib/table/utils/pureGenProColumnToColumn.js +43 -0
- package/lib/timeline/ProTimeLineItem/index.js +8 -5
- package/lib/timeline/typing.d.ts +5 -0
- package/package.json +1 -1
package/es/actions/index.js
CHANGED
@@ -193,8 +193,18 @@ export var ProActionButton = function ProActionButton(props) {
|
|
193
193
|
}, tooltipProps);
|
194
194
|
|
195
195
|
if (tooltip || disabledTooltip) {
|
196
|
-
|
197
|
-
|
196
|
+
if (tooltip && !disabledTooltip) {
|
197
|
+
if (!disabled) {
|
198
|
+
content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), tooltip);
|
199
|
+
}
|
200
|
+
} else if (!tooltip && disabledTooltip) {
|
201
|
+
if (disabled) {
|
202
|
+
content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), disabledTooltip);
|
203
|
+
}
|
204
|
+
} else if (tooltip && disabledTooltip) {
|
205
|
+
var showToolTip = disabled ? disabledTooltip : tooltip;
|
206
|
+
content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), showToolTip);
|
207
|
+
}
|
198
208
|
}
|
199
209
|
|
200
210
|
return content;
|
@@ -208,7 +218,10 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
|
|
208
218
|
_onClick2 = action.onClick,
|
209
219
|
children = action.children,
|
210
220
|
icon = action.icon,
|
211
|
-
disabled = action.disabled
|
221
|
+
disabled = action.disabled,
|
222
|
+
tooltip = action.tooltip,
|
223
|
+
disabledTooltip = action.disabledTooltip,
|
224
|
+
tooltipProps = action.tooltipProps;
|
212
225
|
var menuItemActionConfig = Object.assign({}, config, {
|
213
226
|
trigger: 'onClick'
|
214
227
|
});
|
@@ -222,9 +235,32 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
|
|
222
235
|
return _onClick2(e, context);
|
223
236
|
}
|
224
237
|
}) : _objectSpread({}, menuItemProps);
|
238
|
+
var content = buttonContent(children, icon, undefined, context);
|
239
|
+
|
240
|
+
var baseToolTipProps = _objectSpread({
|
241
|
+
triggerType: 'hover',
|
242
|
+
align: 't',
|
243
|
+
trigger: content
|
244
|
+
}, tooltipProps);
|
245
|
+
|
246
|
+
if (tooltip || disabledTooltip) {
|
247
|
+
if (tooltip && !disabledTooltip) {
|
248
|
+
if (!disabled) {
|
249
|
+
content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), tooltip);
|
250
|
+
}
|
251
|
+
} else if (!tooltip && disabledTooltip) {
|
252
|
+
if (disabled) {
|
253
|
+
content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), disabledTooltip);
|
254
|
+
}
|
255
|
+
} else if (tooltip && disabledTooltip) {
|
256
|
+
var showToolTip = disabled ? disabledTooltip : tooltip;
|
257
|
+
content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), showToolTip);
|
258
|
+
}
|
259
|
+
}
|
260
|
+
|
225
261
|
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
226
262
|
className: cls('teamix-pro-action-menu-item', "".concat(usePrefixCls(), "menu-item"), _defineProperty({}, "".concat(usePrefixCls(), "disabled"), disabled))
|
227
|
-
}, buttonProps),
|
263
|
+
}, buttonProps), content);
|
228
264
|
};
|
229
265
|
|
230
266
|
function renderCommonActionButtonMenuItem(action, key, context) {
|
@@ -15,9 +15,6 @@ import cls from 'classnames';
|
|
15
15
|
import { observable } from '@formily/reactive';
|
16
16
|
import { usePrefixCls } from '@teamix/utils';
|
17
17
|
import ProForm from '../ProForm';
|
18
|
-
var lightFilterObs = observable({
|
19
|
-
onFilter: function onFilter() {}
|
20
|
-
});
|
21
18
|
/**
|
22
19
|
* 轻量筛选
|
23
20
|
*/
|
@@ -34,10 +31,15 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
34
31
|
activeFilterValueRef = props.activeFilterValueRef,
|
35
32
|
otherProps = _objectWithoutProperties(props, _excluded);
|
36
33
|
|
37
|
-
var filterValue = useRef(defaultFilterValue || ((_schema$ = schema[0]) === null || _schema$ === void 0 ? void 0 : _schema$.name));
|
34
|
+
var filterValue = useRef(defaultFilterValue || (schema === null || schema === void 0 ? void 0 : (_schema$ = schema[0]) === null || _schema$ === void 0 ? void 0 : _schema$.name));
|
38
35
|
var prefixCls = usePrefixCls('', {
|
39
36
|
prefix: 'teamix-pro-form-query-filter-light'
|
40
37
|
});
|
38
|
+
var lightFilterObs = useMemo(function () {
|
39
|
+
return observable({
|
40
|
+
onFilter: function onFilter() {}
|
41
|
+
});
|
42
|
+
}, []);
|
41
43
|
useEffect(function () {
|
42
44
|
if (activeFilterValueRef) {
|
43
45
|
activeFilterValueRef.current = filterValue.current;
|
@@ -88,7 +90,7 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
|
|
88
90
|
}, [schema, onFilterChange, defaultFilterValue]);
|
89
91
|
useEffect(function () {
|
90
92
|
lightFilterObs.onFilter = onFilter;
|
91
|
-
}, [
|
93
|
+
}, [onFilter]);
|
92
94
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
93
95
|
scope: _objectSpread(_objectSpread({}, otherProps === null || otherProps === void 0 ? void 0 : otherProps.scope), {}, {
|
94
96
|
lightFilterObs: lightFilterObs
|
package/es/form/Filter/index.js
CHANGED
@@ -313,7 +313,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
313
313
|
debounceFun(onSimpleFilter, values);
|
314
314
|
}
|
315
315
|
}
|
316
|
-
}, [onChange]); // 轻量搜索Filter
|
316
|
+
}, [onChange, onSimpleFilter]); // 轻量搜索Filter
|
317
317
|
|
318
318
|
var onLightFilter = useCallback(function (values) {
|
319
319
|
var _Object$keys;
|
@@ -338,7 +338,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
|
|
338
338
|
debounceFun(onLightFilter, values);
|
339
339
|
}
|
340
340
|
}
|
341
|
-
}, [onChange]); // 高级搜索Filter
|
341
|
+
}, [onChange, onLightFilter]); // 高级搜索Filter
|
342
342
|
|
343
343
|
var onAdvancedFilter = useCallback(function (values) {
|
344
344
|
setCurrentForm('advanced');
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import type { ProFormProps } from '../typing';
|
1
|
+
import type { ComposedProForm } from '../typing';
|
3
2
|
import './index.scss';
|
4
|
-
declare const ProForm:
|
3
|
+
declare const ProForm: ComposedProForm;
|
5
4
|
export default ProForm;
|
package/es/form/ProForm/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["form", "initialValues", "initialRequest", "
|
1
|
+
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst"];
|
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
|
|
@@ -12,26 +12,59 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
12
12
|
|
13
13
|
import React, { memo, useMemo } from 'react';
|
14
14
|
import cls from 'classnames';
|
15
|
+
import { usePrefixCls, getLanguage, getGlobalConfig } from '@teamix/utils';
|
15
16
|
import { createForm, onFieldValueChange, onFormValuesChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
16
17
|
import { toJS } from '@formily/reactive';
|
17
|
-
import { Form } from '@teamix/formily';
|
18
|
-
import {
|
18
|
+
import { Form, Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
19
|
+
import { Affix } from '@alicloudfe/components';
|
20
|
+
import ProFieldComponents from '../Components/ProField';
|
21
|
+
import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
|
22
|
+
import FormGroup from '../Components/FormGroup';
|
23
|
+
import LightFilter from '../Components/LightFilter';
|
24
|
+
import Text from '../Components/Text/index';
|
19
25
|
import SchemaForm from '../SchemaForm';
|
20
26
|
import { mergeArrayValue } from '../utils';
|
21
27
|
import useAutoSubmit from './useAutoSubmit';
|
22
28
|
import useInitialRequest from './useInitialRequest';
|
29
|
+
import useFieldSchema from './useFieldSchema';
|
23
30
|
import validateLocale from '../locales/validate';
|
24
31
|
import './index.scss';
|
25
32
|
registerValidateLocale(validateLocale);
|
33
|
+
var formilyComponents = {
|
34
|
+
FormLayout: FormLayout,
|
35
|
+
FormItem: FormItem,
|
36
|
+
ArrayCollapse: ArrayCollapse,
|
37
|
+
ArrayCards: ArrayCards,
|
38
|
+
ArrayItems: ArrayItems,
|
39
|
+
ArrayTable: ArrayTable,
|
40
|
+
Space: Space,
|
41
|
+
FormGrid: FormGrid,
|
42
|
+
FormTab: FormTab,
|
43
|
+
FormCollapse: FormCollapse,
|
44
|
+
FormStep: FormStep,
|
45
|
+
Editable: Editable,
|
46
|
+
FormDialogFooter: FormDialog.Footer,
|
47
|
+
FormDrawerFooter: FormDrawer.Footer,
|
48
|
+
FormButtonGroup: FormButtonGroup,
|
49
|
+
Submit: Submit,
|
50
|
+
Reset: Reset,
|
51
|
+
EditableDialog: EditableDialog,
|
52
|
+
EditableDrawer: EditableDrawer,
|
53
|
+
EditablePopover: EditablePopover,
|
54
|
+
FormGroup: FormGroup,
|
55
|
+
Upload: Upload,
|
56
|
+
SelectTable: SelectTable,
|
57
|
+
Affix: Affix,
|
58
|
+
LightFilter: LightFilter,
|
59
|
+
Text: Text
|
60
|
+
};
|
26
61
|
var ProForm = /*#__PURE__*/memo(function (_ref) {
|
27
62
|
var outerForm = _ref.form,
|
28
63
|
initialValues = _ref.initialValues,
|
29
64
|
initialRequest = _ref.initialRequest,
|
30
|
-
schema = _ref.schema,
|
31
65
|
scope = _ref.scope,
|
32
66
|
context = _ref.context,
|
33
67
|
components = _ref.components,
|
34
|
-
children = _ref.children,
|
35
68
|
layout = _ref.layout,
|
36
69
|
labelAlign = _ref.labelAlign,
|
37
70
|
wrapperAlign = _ref.wrapperAlign,
|
@@ -66,7 +99,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
66
99
|
}); // context需要实名不能解构
|
67
100
|
|
68
101
|
|
69
|
-
var mergedComponents = _objectSpread(_objectSpread({}, globalComponents), components);
|
102
|
+
var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), ProFieldComponents);
|
70
103
|
|
71
104
|
var onAutoSubmit = useAutoSubmit(onSubmit); // todo 需要formily支持断点下的属性更新
|
72
105
|
|
@@ -87,6 +120,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
87
120
|
wrapperCol: mergeArrayValue([24], wrapperCol)
|
88
121
|
};
|
89
122
|
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
123
|
+
var schema = useFieldSchema(otherProps);
|
90
124
|
useMemo(function () {
|
91
125
|
// 配置表单默认值
|
92
126
|
if (initialValues) {
|
@@ -130,12 +164,17 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
130
164
|
form: form,
|
131
165
|
onAutoSubmit: onAutoSubmit,
|
132
166
|
onAutoSubmitFailed: onSubmitFailed
|
133
|
-
}), /*#__PURE__*/React.createElement(SchemaForm, {
|
167
|
+
}), schema ? /*#__PURE__*/React.createElement(SchemaForm, {
|
134
168
|
schema: schema,
|
135
169
|
scope: mergedScope,
|
136
170
|
components: mergedComponents
|
137
|
-
}), children);
|
171
|
+
}) : null, otherProps === null || otherProps === void 0 ? void 0 : otherProps.children);
|
138
172
|
});
|
173
|
+
|
174
|
+
ProForm.Field = function () {
|
175
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
176
|
+
};
|
177
|
+
|
139
178
|
ProForm.defaultProps = {
|
140
179
|
colon: false,
|
141
180
|
labelAlign: 'left',
|
@@ -317,6 +317,13 @@
|
|
317
317
|
}
|
318
318
|
}
|
319
319
|
|
320
|
+
// SelectTable
|
321
|
+
.#{$teamix-pro-form}-select-table-column-tree
|
322
|
+
> .#{$css-prefix}table-cell-wrapper {
|
323
|
+
display: flex;
|
324
|
+
align-items: center;
|
325
|
+
}
|
326
|
+
|
320
327
|
/* hack todo remove */
|
321
328
|
.#{$form-item-cls}-control-content-component {
|
322
329
|
.#{$teamix-pro-field}-tooltip.#{$teamix-pro-field}-checkbox {
|
@@ -0,0 +1,88 @@
|
|
1
|
+
var _excluded = ["id", "children", "reactions"],
|
2
|
+
_excluded2 = ["id", "children", "reactions"];
|
3
|
+
|
4
|
+
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; }
|
5
|
+
|
6
|
+
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; }
|
7
|
+
|
8
|
+
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; }
|
9
|
+
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
11
|
+
|
12
|
+
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; }
|
13
|
+
|
14
|
+
import { getValueByValue, deepMerge } from '@teamix/utils';
|
15
|
+
/**
|
16
|
+
* 合并 Field 字段 props 和 ProForm schema 配置,生成完整的 Field 字段 schema
|
17
|
+
* @param field Field 字段
|
18
|
+
* @param extra 额外的 schema 配置(存在递归,可能是子级 schema )
|
19
|
+
* @param wholeExtra 完整的额外 schema 配置
|
20
|
+
* @returns schema 配置
|
21
|
+
*/
|
22
|
+
|
23
|
+
var getMergedSchema = function getMergedSchema(field, extra, wholeExtra) {
|
24
|
+
return field.reduce(function (prev, curr, index) {
|
25
|
+
var _ref = curr.props || {},
|
26
|
+
id = _ref.id,
|
27
|
+
_ref$children = _ref.children,
|
28
|
+
children = _ref$children === void 0 ? [] : _ref$children,
|
29
|
+
_ref$reactions = _ref.reactions,
|
30
|
+
reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded); // 获取字段额外的 schema 配置(From ProForm)
|
32
|
+
|
33
|
+
|
34
|
+
var extraFieldProps = extra[index] || {};
|
35
|
+
|
36
|
+
if (id !== extraFieldProps.id) {
|
37
|
+
// 索引不匹配,通过 id 查找获取
|
38
|
+
extraFieldProps = getValueByValue(extra, id, {
|
39
|
+
inputKey: 'id',
|
40
|
+
outputKey: '__whole__'
|
41
|
+
}) || getValueByValue(wholeExtra, id, {
|
42
|
+
inputKey: 'id',
|
43
|
+
outputKey: '__whole__'
|
44
|
+
});
|
45
|
+
|
46
|
+
if (extraFieldProps) {
|
47
|
+
console.warn("Field id \"".concat(id, "\" is not found by index in ProForm schema props, Please pay attention to the order."));
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
var _ref2 = extraFieldProps || {},
|
52
|
+
extraId = _ref2.id,
|
53
|
+
_ref2$children = _ref2.children,
|
54
|
+
extraChildren = _ref2$children === void 0 ? [] : _ref2$children,
|
55
|
+
_ref2$reactions = _ref2.reactions,
|
56
|
+
extraReactions = _ref2$reactions === void 0 ? [] : _ref2$reactions,
|
57
|
+
extraRest = _objectWithoutProperties(_ref2, _excluded2);
|
58
|
+
|
59
|
+
prev.push(_objectSpread(_objectSpread({}, deepMerge(rest, extraRest)), {}, {
|
60
|
+
reactions: [].concat(reactions, extraReactions),
|
61
|
+
children: (children === null || children === void 0 ? void 0 : children.length) ? getMergedSchema(children, extraChildren, wholeExtra) : []
|
62
|
+
}));
|
63
|
+
return prev;
|
64
|
+
}, []);
|
65
|
+
};
|
66
|
+
/**
|
67
|
+
* 获取 ProForm 的 schema 配置,通过合并 Field 字段 或者 schema 配置
|
68
|
+
* @param props ProForm 组件的 props
|
69
|
+
* @returns schema 配置
|
70
|
+
*/
|
71
|
+
|
72
|
+
|
73
|
+
export default (function (_ref3) {
|
74
|
+
var children = _ref3.children,
|
75
|
+
schema = _ref3.schema;
|
76
|
+
var field = [].concat(children !== null && children !== void 0 ? children : []).filter(function (item) {
|
77
|
+
var _item$type, _item$props;
|
78
|
+
|
79
|
+
return (item === null || item === void 0 ? void 0 : (_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.name) === '' && (item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.component);
|
80
|
+
}); // 如果 ProForm 的 children 含有 Field 字段,则优先使用 Field 渲染表单(仅合并 ProForm 的 schema 属性 )
|
81
|
+
|
82
|
+
if (field.length) {
|
83
|
+
return getMergedSchema(field, schema !== null && schema !== void 0 ? schema : [], schema !== null && schema !== void 0 ? schema : []);
|
84
|
+
} // 正常使用 ProForm 的 schema 渲染表单
|
85
|
+
|
86
|
+
|
87
|
+
return schema;
|
88
|
+
});
|
@@ -32,13 +32,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
32
32
|
|
33
33
|
import React, { memo, useCallback, useRef, useMemo } from 'react';
|
34
34
|
import { createSchemaField } from '@formily/react';
|
35
|
-
import { Affix } from '@alicloudfe/components';
|
36
|
-
import { Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
37
|
-
import ProFieldComponents from '../Components/ProField';
|
38
|
-
import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
|
39
|
-
import FormGroup from '../Components/FormGroup';
|
40
|
-
import LightFilter from '../Components/LightFilter';
|
41
|
-
import Text from '../Components/Text/index';
|
42
35
|
import adapterType from './adapterType';
|
43
36
|
import adapterComponent from './adapterComponent';
|
44
37
|
import adapterDecorator from './adapterDecorator';
|
@@ -64,39 +57,10 @@ export default /*#__PURE__*/memo(function (_ref) {
|
|
64
57
|
var schema = _ref.schema,
|
65
58
|
scope = _ref.scope,
|
66
59
|
components = _ref.components;
|
67
|
-
var schemaScopeRef = useRef({}); // 创建 SchemaField
|
60
|
+
var schemaScopeRef = useRef({}); // 创建 SchemaField
|
68
61
|
|
69
62
|
var SchemaField = useMemo(function () {
|
70
|
-
return createSchemaField(
|
71
|
-
components: _objectSpread(_objectSpread({}, ProFieldComponents), {}, {
|
72
|
-
FormLayout: FormLayout,
|
73
|
-
FormItem: FormItem,
|
74
|
-
ArrayCollapse: ArrayCollapse,
|
75
|
-
ArrayCards: ArrayCards,
|
76
|
-
ArrayItems: ArrayItems,
|
77
|
-
ArrayTable: ArrayTable,
|
78
|
-
Space: Space,
|
79
|
-
FormGrid: FormGrid,
|
80
|
-
FormTab: FormTab,
|
81
|
-
FormCollapse: FormCollapse,
|
82
|
-
FormStep: FormStep,
|
83
|
-
Editable: Editable,
|
84
|
-
FormDialogFooter: FormDialog.Footer,
|
85
|
-
FormDrawerFooter: FormDrawer.Footer,
|
86
|
-
FormButtonGroup: FormButtonGroup,
|
87
|
-
Submit: Submit,
|
88
|
-
Reset: Reset,
|
89
|
-
EditableDialog: EditableDialog,
|
90
|
-
EditableDrawer: EditableDrawer,
|
91
|
-
EditablePopover: EditablePopover,
|
92
|
-
FormGroup: FormGroup,
|
93
|
-
Upload: Upload,
|
94
|
-
SelectTable: SelectTable,
|
95
|
-
Affix: Affix,
|
96
|
-
LightFilter: LightFilter,
|
97
|
-
Text: Text
|
98
|
-
})
|
99
|
-
});
|
63
|
+
return createSchemaField();
|
100
64
|
}, []); // 格式化 schema
|
101
65
|
|
102
66
|
var formatSchema = useCallback(function (schema) {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["name", "
|
1
|
+
var _excluded = ["name", "children", "props"];
|
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
|
|
@@ -10,25 +10,99 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
10
10
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
14
|
+
|
15
|
+
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."); }
|
16
|
+
|
17
|
+
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); }
|
18
|
+
|
19
|
+
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; }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
24
|
+
|
25
|
+
import cls from 'classnames';
|
26
|
+
import { usePrefixCls, isStr, isPlainObj, isArr } from '@teamix/utils';
|
27
|
+
import pureGenProColumnToColumn from '../../table/utils/pureGenProColumnToColumn';
|
28
|
+
/**
|
29
|
+
* 将可被 ProForm 识别的上下文转换为仅被 ProTable 识别的上下文
|
30
|
+
* @param value
|
31
|
+
* @returns
|
32
|
+
*/
|
33
|
+
|
34
|
+
var adapterContext = function adapterContext(value) {
|
35
|
+
if (isStr(value)) {
|
36
|
+
var contextReg = /^\{\{.*?\}\}$/;
|
37
|
+
|
38
|
+
if (contextReg.test(value)) {
|
39
|
+
return "\0".concat(value, "\0");
|
40
|
+
}
|
41
|
+
|
42
|
+
return value;
|
43
|
+
}
|
44
|
+
|
45
|
+
if (isPlainObj(value)) {
|
46
|
+
var temp = {};
|
47
|
+
Object.entries(value).forEach(function (_ref) {
|
48
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
49
|
+
key = _ref2[0],
|
50
|
+
val = _ref2[1];
|
51
|
+
|
52
|
+
temp[key] = adapterContext(val);
|
53
|
+
});
|
54
|
+
return temp;
|
55
|
+
}
|
56
|
+
|
57
|
+
if (isArr(value)) {
|
58
|
+
return value.map(function (item) {
|
59
|
+
return adapterContext(item);
|
60
|
+
});
|
61
|
+
}
|
62
|
+
|
63
|
+
return value;
|
64
|
+
};
|
65
|
+
|
13
66
|
var initializeTableColumn = function initializeTableColumn(item) {
|
14
67
|
var name = item.name,
|
15
|
-
title = item.title,
|
16
68
|
children = item.children,
|
69
|
+
props = item.props,
|
17
70
|
otherProps = _objectWithoutProperties(item, _excluded);
|
18
71
|
|
19
72
|
return {
|
20
73
|
name: name,
|
21
|
-
title: title,
|
22
74
|
component: 'SelectTable.Column',
|
23
|
-
children: children
|
24
|
-
|
75
|
+
children: children === null || children === void 0 ? void 0 : children.map(function (item) {
|
76
|
+
return initializeTableColumn(item);
|
77
|
+
}),
|
78
|
+
props: _objectSpread(_objectSpread({}, otherProps), props)
|
25
79
|
};
|
26
80
|
};
|
27
81
|
|
28
82
|
var initialize = function initialize(item) {
|
83
|
+
var _props$columns;
|
84
|
+
|
29
85
|
var _item$children = item.children,
|
30
|
-
children = _item$children === void 0 ? [] : _item$children
|
86
|
+
children = _item$children === void 0 ? [] : _item$children,
|
87
|
+
props = item.props;
|
88
|
+
var prefixCls = usePrefixCls('', {
|
89
|
+
prefix: 'teamix-pro-form-select-table-column-tree'
|
90
|
+
});
|
91
|
+
var columns = props === null || props === void 0 ? void 0 : (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.map(function (value, index) {
|
92
|
+
var column = adapterContext(value);
|
93
|
+
|
94
|
+
if ((props === null || props === void 0 ? void 0 : props.isTree) && index === 0) {
|
95
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
96
|
+
className: cls(column.className, prefixCls)
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
return column;
|
101
|
+
});
|
31
102
|
return _objectSpread(_objectSpread({}, item), {}, {
|
103
|
+
props: _objectSpread(_objectSpread({}, props), {}, {
|
104
|
+
columns: columns && pureGenProColumnToColumn(columns)
|
105
|
+
}),
|
32
106
|
children: children.map(function (item) {
|
33
107
|
return initializeTableColumn(item);
|
34
108
|
})
|
package/es/form/typing.d.ts
CHANGED
@@ -56,7 +56,7 @@ export interface ProFormSchemaItem {
|
|
56
56
|
export declare type ProFormSchema = ProFormSchemaItem[];
|
57
57
|
export interface ProFormProps extends IFormLayoutProps {
|
58
58
|
form?: FormType | false;
|
59
|
-
schema
|
59
|
+
schema?: ProFormSchema;
|
60
60
|
scope?: any;
|
61
61
|
context?: any;
|
62
62
|
components?: {
|
@@ -73,6 +73,9 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
73
73
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
74
74
|
onInitialComplete?: (form: FormType) => void;
|
75
75
|
}
|
76
|
+
export declare type ComposedProForm = React.FC<ProFormProps> & {
|
77
|
+
Field?: React.FC<any>;
|
78
|
+
};
|
76
79
|
export interface FilterProps extends ProFormProps {
|
77
80
|
form: FormType;
|
78
81
|
defaultFilterValue?: string;
|
package/es/index.d.ts
CHANGED
@@ -26,5 +26,5 @@ export * from './table';
|
|
26
26
|
export * from './sidebar';
|
27
27
|
export * from './utils';
|
28
28
|
export * from './timeline';
|
29
|
-
declare const version = "1.3.
|
29
|
+
declare const version = "1.3.14";
|
30
30
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -31,6 +31,6 @@ export * from './sidebar';
|
|
31
31
|
export * from './utils'; // export * from './sidebar';
|
32
32
|
|
33
33
|
export * from './timeline';
|
34
|
-
var version = '1.3.
|
34
|
+
var version = '1.3.14';
|
35
35
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
36
36
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils };
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
import './index.scss';
|
3
3
|
import { ProTableActionType } from '../../typing';
|
4
4
|
declare type ProTableFullScreenProps = {
|
5
|
-
children: React.ReactNode;
|
5
|
+
children: (isFullScreen: boolean) => React.ReactNode | React.ReactNode;
|
6
6
|
visible: boolean;
|
7
7
|
actionRef: React.MutableRefObject<ProTableActionType | undefined>;
|
8
8
|
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ProTableColumnProps } from '../typing';
|
2
|
+
/**
|
3
|
+
* 增加了 icon 的功能 render title
|
4
|
+
*/
|
5
|
+
export declare const renderColumnsTitle: (item: ProTableColumnProps) => JSX.Element;
|
6
|
+
/**
|
7
|
+
* 负责单元格的具体渲染
|
8
|
+
*/
|
9
|
+
export declare const renderCell: (value: any, item: ProTableColumnProps, index: number, record: any) => JSX.Element;
|