@teamix/pro 1.3.11 → 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 +1380 -1086
- 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 +94 -174
- package/es/form/ProForm/index.d.ts +2 -3
- package/es/form/ProForm/index.js +78 -29
- 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 +5 -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/index.js +5 -3
- 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 +93 -173
- package/lib/form/ProForm/index.d.ts +2 -3
- package/lib/form/ProForm/index.js +82 -26
- 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 +5 -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/index.js +5 -3
- 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
@@ -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?: {
|
@@ -67,11 +67,15 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
67
67
|
initialRequest?: ProFormRequestConfig;
|
68
68
|
previewTextPlaceholder?: ReactNode;
|
69
69
|
validateFirst?: boolean;
|
70
|
+
onChangeType?: 'form';
|
70
71
|
onChange?: (values: any, fieldValue?: any, fieldName?: any) => any;
|
71
72
|
onSubmit?: ((values: any) => any) | CommonRequestConfig;
|
72
73
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
73
74
|
onInitialComplete?: (form: FormType) => void;
|
74
75
|
}
|
76
|
+
export declare type ComposedProForm = React.FC<ProFormProps> & {
|
77
|
+
Field?: React.FC<any>;
|
78
|
+
};
|
75
79
|
export interface FilterProps extends ProFormProps {
|
76
80
|
form: FormType;
|
77
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
|
};
|
package/es/table/index.js
CHANGED
@@ -752,12 +752,14 @@ var ProTable = function ProTable(props) {
|
|
752
752
|
mode: 'inline',
|
753
753
|
forceClear: true
|
754
754
|
}, propsDataFilter), {}, {
|
755
|
-
onInit: function
|
755
|
+
onInit: (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) || requestWhenMount ? function (values) {
|
756
|
+
var _propsDataFilter$onIn;
|
757
|
+
|
756
758
|
// 表单初始化请求处理
|
757
|
-
|
759
|
+
propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$onIn = propsDataFilter.onInit) === null || _propsDataFilter$onIn === void 0 ? void 0 : _propsDataFilter$onIn.call(propsDataFilter, values);
|
758
760
|
!fullscreenState && requestWhenMount && _request({}, false, values);
|
759
761
|
return true;
|
760
|
-
},
|
762
|
+
} : undefined,
|
761
763
|
onFilter: function onFilter(values) {
|
762
764
|
var _actionRef$current6, _actionRef$current6$c;
|
763
765
|
|
@@ -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;
|
@@ -0,0 +1,201 @@
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
6
|
+
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
8
|
+
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
|
+
|
11
|
+
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."); }
|
12
|
+
|
13
|
+
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); }
|
14
|
+
|
15
|
+
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; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
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; }
|
24
|
+
|
25
|
+
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; }
|
26
|
+
|
27
|
+
/**
|
28
|
+
* 渲染列的逻辑函数,用于非 ProTable 比如 selectTable
|
29
|
+
*/
|
30
|
+
import React from 'react';
|
31
|
+
import { getTargetValue, LabelIconTip } from '@teamix/utils';
|
32
|
+
import ProField from '../../field';
|
33
|
+
/**
|
34
|
+
* 增加了 icon 的功能 render title
|
35
|
+
*/
|
36
|
+
|
37
|
+
export var renderColumnsTitle = function renderColumnsTitle(item) {
|
38
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LabelIconTip, {
|
39
|
+
label: item.title,
|
40
|
+
tooltip: item.tooltip,
|
41
|
+
icon: item.tooltipIcon
|
42
|
+
}));
|
43
|
+
};
|
44
|
+
/**
|
45
|
+
* 负责单元格的具体渲染
|
46
|
+
*/
|
47
|
+
|
48
|
+
export var renderCell = function renderCell(value, item, index, record) {
|
49
|
+
var _item$valueType = item.valueType,
|
50
|
+
valueType = _item$valueType === void 0 ? 'text' : _item$valueType,
|
51
|
+
render = item.render,
|
52
|
+
dataIndex = item.dataIndex,
|
53
|
+
format = item.format; // 如果没传 dataIndex,返回 null
|
54
|
+
|
55
|
+
if (!dataIndex) {
|
56
|
+
value = null;
|
57
|
+
} // 处理 dataIndex 为数组的情况
|
58
|
+
|
59
|
+
|
60
|
+
if (Array.isArray(dataIndex)) {
|
61
|
+
value = dataIndex.map(function (item) {
|
62
|
+
return getTargetValue("{{".concat(item, "}}"), _objectSpread(_objectSpread({}, record), {}, {
|
63
|
+
record: record
|
64
|
+
}));
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
var newRender = null;
|
69
|
+
var newDataSource = null;
|
70
|
+
var props = item.props; // 如果 render 直接传函数
|
71
|
+
|
72
|
+
if (typeof render === 'function') {
|
73
|
+
newRender = function newRender() {
|
74
|
+
return render === null || render === void 0 ? void 0 : render(value, index, record);
|
75
|
+
};
|
76
|
+
} else {
|
77
|
+
newRender = processBuriedPoint(processRenderFunction(render, value, index, record), record, value, index);
|
78
|
+
|
79
|
+
if (valueType === 'selectGroup') {
|
80
|
+
newRender = _objectSpread(_objectSpread({
|
81
|
+
maxShowNumber: 'auto',
|
82
|
+
foldText: 'more',
|
83
|
+
editOnClick: function editOnClick() {},
|
84
|
+
edit: true
|
85
|
+
}, newRender), {}, {
|
86
|
+
ellipsis: false
|
87
|
+
});
|
88
|
+
props = _objectSpread({
|
89
|
+
valueAlias: {
|
90
|
+
value: 'TagValue',
|
91
|
+
key: 'TagKey'
|
92
|
+
}
|
93
|
+
}, props);
|
94
|
+
}
|
95
|
+
|
96
|
+
if ((render === null || render === void 0 ? void 0 : render.type) === 'step') {
|
97
|
+
newRender = _objectSpread(_objectSpread({}, newRender), {}, {
|
98
|
+
ellipsis: false
|
99
|
+
});
|
100
|
+
}
|
101
|
+
} // dataSource可传函数
|
102
|
+
|
103
|
+
|
104
|
+
if (typeof item.dataSource === 'function') {
|
105
|
+
var _item$dataSource;
|
106
|
+
|
107
|
+
newDataSource = (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.call(item, value, index, record);
|
108
|
+
} else {
|
109
|
+
var _item$dataSource2;
|
110
|
+
|
111
|
+
newDataSource = ((_item$dataSource2 = item.dataSource) !== null && _item$dataSource2 !== void 0 ? _item$dataSource2 : []).map(function (item) {
|
112
|
+
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
113
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
114
|
+
k = _ref2[0],
|
115
|
+
v = _ref2[1];
|
116
|
+
|
117
|
+
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
118
|
+
record: record,
|
119
|
+
value: value,
|
120
|
+
index: index
|
121
|
+
}))];
|
122
|
+
}));
|
123
|
+
});
|
124
|
+
} // 渲染 ProField
|
125
|
+
|
126
|
+
|
127
|
+
return /*#__PURE__*/React.createElement(ProField, _objectSpread({
|
128
|
+
type: valueType || 'text',
|
129
|
+
value: value,
|
130
|
+
render: newRender,
|
131
|
+
dataSource: newDataSource,
|
132
|
+
format: format
|
133
|
+
}, props));
|
134
|
+
};
|
135
|
+
/**
|
136
|
+
* 处理 render 配置项是函数的情况
|
137
|
+
* @param render ProFieldRender
|
138
|
+
* @param value table cell value
|
139
|
+
* @param index table cell index
|
140
|
+
* @param record table cell record
|
141
|
+
* @returns
|
142
|
+
*/
|
143
|
+
|
144
|
+
var processRenderFunction = function processRenderFunction() {
|
145
|
+
var render = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
146
|
+
var value = arguments.length > 1 ? arguments[1] : undefined;
|
147
|
+
var index = arguments.length > 2 ? arguments[2] : undefined;
|
148
|
+
var record = arguments.length > 3 ? arguments[3] : undefined;
|
149
|
+
// 当 ProField render 类型为 function 时。需要表格预先处理以塞入 record
|
150
|
+
var external = ['linkOnClick', 'link', 'value', 'renderEdit', 'descriptionRenderEdit', 'editPopConfirmProps', 'descriptionEditPopConfirmProps', 'editOnClick', 'descriptionEditOnClick', 'extra', 'prefixExtra'];
|
151
|
+
return Object.fromEntries(Object.entries(render).map(function (_ref3) {
|
152
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
153
|
+
k = _ref4[0],
|
154
|
+
v = _ref4[1];
|
155
|
+
|
156
|
+
if (typeof v === 'function') {
|
157
|
+
var _v;
|
158
|
+
|
159
|
+
if (external.includes(k)) {
|
160
|
+
return [k, function () {
|
161
|
+
for (var _len = arguments.length, others = new Array(_len), _key = 0; _key < _len; _key++) {
|
162
|
+
others[_key] = arguments[_key];
|
163
|
+
}
|
164
|
+
|
165
|
+
return v === null || v === void 0 ? void 0 : v.apply(void 0, [value, index, record].concat(others));
|
166
|
+
}];
|
167
|
+
}
|
168
|
+
|
169
|
+
return [k, (_v = v === null || v === void 0 ? void 0 : v(value, index, record)) !== null && _v !== void 0 ? _v : ''];
|
170
|
+
}
|
171
|
+
|
172
|
+
return [k, v];
|
173
|
+
}));
|
174
|
+
};
|
175
|
+
/**
|
176
|
+
* 处理 render 数据,取出 {{xxx}} 匹配值
|
177
|
+
* @param render ProFieldRender
|
178
|
+
* @param record table cell record
|
179
|
+
* @returns
|
180
|
+
*/
|
181
|
+
|
182
|
+
|
183
|
+
var processBuriedPoint = function processBuriedPoint() {
|
184
|
+
var render = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
185
|
+
var record = arguments.length > 1 ? arguments[1] : undefined;
|
186
|
+
var value = arguments.length > 2 ? arguments[2] : undefined;
|
187
|
+
var index = arguments.length > 3 ? arguments[3] : undefined;
|
188
|
+
return Object.fromEntries([// 默认 ellipsis、descriptionEllipsis 为 true
|
189
|
+
// emptyText 默认为 '-'
|
190
|
+
['ellipsis', true], ['descriptionEllipsis', true], ['emptyText', '-']].concat(_toConsumableArray(Object.entries(render).map(function (_ref5) {
|
191
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
192
|
+
k = _ref6[0],
|
193
|
+
v = _ref6[1];
|
194
|
+
|
195
|
+
return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
|
196
|
+
record: record,
|
197
|
+
value: value,
|
198
|
+
index: index
|
199
|
+
}))];
|
200
|
+
}))));
|
201
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { ProTableColumnProps } from '../typing';
|
2
|
+
import { ColumnProps } from '@alicloudfe/components/types/table';
|
3
|
+
/**
|
4
|
+
* ProColumn => Column,去掉操作列,过滤器相关逻辑
|
5
|
+
* 用于非 ProTable 比如 selectTable
|
6
|
+
*/
|
7
|
+
export default function genProColumnToColumn(columns: ProTableColumnProps[]): ColumnProps[];
|
@@ -0,0 +1,36 @@
|
|
1
|
+
var _excluded = ["filters", "dataIndex"];
|
2
|
+
|
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
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
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; }
|
10
|
+
|
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
|
+
|
13
|
+
import { renderColumnsTitle, renderCell } from './pureColumnRender';
|
14
|
+
/**
|
15
|
+
* ProColumn => Column,去掉操作列,过滤器相关逻辑
|
16
|
+
* 用于非 ProTable 比如 selectTable
|
17
|
+
*/
|
18
|
+
|
19
|
+
export default function genProColumnToColumn(columns) {
|
20
|
+
return columns.map(function (columnProps) {
|
21
|
+
var filters = columnProps.filters,
|
22
|
+
dataIndex = columnProps.dataIndex,
|
23
|
+
others = _objectWithoutProperties(columnProps, _excluded);
|
24
|
+
|
25
|
+
return _objectSpread(_objectSpread({
|
26
|
+
// 金钱样式默认右对齐
|
27
|
+
align: columnProps.valueType === 'money' ? 'right' : 'left'
|
28
|
+
}, others), {}, {
|
29
|
+
dataIndex: dataIndex === null || dataIndex === void 0 ? void 0 : dataIndex.toString(),
|
30
|
+
title: renderColumnsTitle(columnProps),
|
31
|
+
cell: function cell(value, index, record) {
|
32
|
+
return renderCell(value, columnProps, index, record);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
});
|
36
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["_comment", "_shape", "status", "image", "icon", "title", "subTitle", "timeLeft", "content", "animation", "discription", "tags", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "dotRender"];
|
1
|
+
var _excluded = ["_comment", "_shape", "status", "image", "icon", "title", "subTitle", "time", "timeLeft", "content", "animation", "discription", "tags", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "dotRender"];
|
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
|
|
@@ -43,6 +43,7 @@ var ProTimeLineItem = function ProTimeLineItem(props) {
|
|
43
43
|
icon = props.icon,
|
44
44
|
title = props.title,
|
45
45
|
subTitle = props.subTitle,
|
46
|
+
time = props.time,
|
46
47
|
timeLeft = props.timeLeft,
|
47
48
|
content = props.content,
|
48
49
|
animation = props.animation,
|
@@ -54,8 +55,10 @@ var ProTimeLineItem = function ProTimeLineItem(props) {
|
|
54
55
|
onCollapse = props.onCollapse,
|
55
56
|
dotRender = props.dotRender,
|
56
57
|
others = _objectWithoutProperties(props, _excluded);
|
57
|
-
/** 内容去折叠相关 */
|
58
58
|
|
59
|
+
var timeRight = time !== null && time !== void 0 ? time : subTitle; // 兼容 subTitle
|
60
|
+
|
61
|
+
/** 内容去折叠相关 */
|
59
62
|
|
60
63
|
var _useState = useState(defaultCollapsed !== undefined ? defaultCollapsed : false),
|
61
64
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -165,9 +168,9 @@ var ProTimeLineItem = function ProTimeLineItem(props) {
|
|
165
168
|
}))
|
166
169
|
}, title), tags && /*#__PURE__*/React.createElement("div", {
|
167
170
|
className: classnames(cls('wrapper-right-top-tag-info'))
|
168
|
-
}, renderTag()),
|
171
|
+
}, renderTag()), timeRight && /*#__PURE__*/React.createElement("div", {
|
169
172
|
className: classnames(cls('wrapper-right-top-subTitle-info'))
|
170
|
-
}, formatTime(
|
173
|
+
}, formatTime(timeRight))), discription && /*#__PURE__*/React.createElement("div", {
|
171
174
|
className: classnames(cls('wrapper-right-discribe-info'))
|
172
175
|
}, discription), /*#__PURE__*/React.createElement("div", {
|
173
176
|
className: classnames(cls('wrapper-right-content-info'))
|
@@ -177,7 +180,7 @@ var ProTimeLineItem = function ProTimeLineItem(props) {
|
|
177
180
|
'wrapper-right-content-info-open': showContent
|
178
181
|
}))
|
179
182
|
}, content))));
|
180
|
-
}, [_shape, timeLeft, image, title, tags,
|
183
|
+
}, [_shape, timeLeft, image, title, tags, timeRight, discription, content, collapsible, collapsed, defaultCollapsed, onCollapseChanged]);
|
181
184
|
/**
|
182
185
|
* 重新渲染 timeline 节点
|
183
186
|
* */
|