@teamix/pro 1.3.1 → 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 +734 -113
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/form/Components/ProField/mapDateFormat.d.ts +3 -0
- package/es/form/Components/ProField/mapDateFormat.js +113 -0
- package/es/form/ProForm/customComponent.js +2 -1
- package/es/form/SchemaForm/index.js +2 -2
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/reactions.d.ts +1 -1
- package/es/form/SchemaForm/reactions.js +33 -33
- package/es/form/fieldTypeMap.d.ts +3 -0
- package/es/form/fieldTypeMap.js +3 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/ToolBar/DensityIcon.js +5 -3
- package/es/table/components/ToolBar/FilterColumnIcon.js +12 -3
- package/es/table/components/ToolBar/index.scss +2 -2
- package/es/table/index.js +8 -4
- package/es/table/index.scss +1 -1
- package/es/table/typing.d.ts +4 -0
- package/es/table/utils/columnRender.js +6 -0
- package/lib/form/Components/ProField/mapDateFormat.d.ts +3 -0
- package/lib/form/Components/ProField/mapDateFormat.js +125 -0
- package/lib/form/ProForm/customComponent.js +3 -1
- package/lib/form/SchemaForm/index.js +2 -2
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/reactions.d.ts +1 -1
- package/lib/form/SchemaForm/reactions.js +33 -33
- package/lib/form/fieldTypeMap.d.ts +3 -0
- package/lib/form/fieldTypeMap.js +5 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/ToolBar/DensityIcon.js +5 -3
- package/lib/table/components/ToolBar/FilterColumnIcon.js +11 -2
- package/lib/table/components/ToolBar/index.scss +2 -2
- package/lib/table/index.js +8 -4
- package/lib/table/index.scss +1 -1
- package/lib/table/typing.d.ts +4 -0
- package/lib/table/utils/columnRender.js +6 -0
- package/package.json +1 -1
@@ -244,10 +244,10 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
244
244
|
|
245
245
|
var _initializeRequest = (0, _initializeRequest2.default)(request, "".concat(suffix, "r")),
|
246
246
|
requestReactions = _initializeRequest.reactions,
|
247
|
-
requestScope = _initializeRequest.scope; // 初始化dataSource
|
247
|
+
requestScope = _initializeRequest.scope; // 初始化dataSource
|
248
248
|
|
249
249
|
|
250
|
-
var _initializeDataSource = (0, _initializeDataSource2.default)(dataSource, "".concat(suffix, "d")
|
250
|
+
var _initializeDataSource = (0, _initializeDataSource2.default)(dataSource, "".concat(suffix, "d")),
|
251
251
|
defaultDataSource = _initializeDataSource.dataSource,
|
252
252
|
dataSourceReactions = _initializeDataSource.reactions,
|
253
253
|
dataSourceScope = _initializeDataSource.scope; // 初始化rules validator
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ProFormRequestConfig } from '../typing';
|
2
2
|
interface IInitializeDataSource {
|
3
|
-
(requestConfig?: ProFormRequestConfig | any, suffix?: string
|
3
|
+
(requestConfig?: ProFormRequestConfig | any, suffix?: string): {
|
4
4
|
dataSource?: any[];
|
5
5
|
reactions: any[];
|
6
6
|
scope: {
|
@@ -9,12 +9,12 @@ var _utils = require("@teamix/utils");
|
|
9
9
|
|
10
10
|
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; }
|
11
11
|
|
12
|
-
var initializeDataSource = function initializeDataSource(dataSource, suffix
|
12
|
+
var initializeDataSource = function initializeDataSource(dataSource, suffix) {
|
13
13
|
if ((0, _utils.isPlainObj)(dataSource)) {
|
14
14
|
var requestConfig = dataSource;
|
15
15
|
var requestConfigName = "$requestConfig_".concat(suffix);
|
16
16
|
return {
|
17
|
-
reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context
|
17
|
+
reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context)}}")],
|
18
18
|
scope: _defineProperty({}, requestConfigName, requestConfig)
|
19
19
|
};
|
20
20
|
}
|
@@ -2,5 +2,5 @@ import type { ProFormRequestConfig } from '../typing';
|
|
2
2
|
declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any, type: 'request' | 'validator' | 'dataSource') => Promise<unknown>;
|
3
3
|
declare const $common: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
|
4
4
|
declare const $validator: (services: any, requestConfig: ProFormRequestConfig, context: any) => (value: any, rules: any, { field }: any) => any;
|
5
|
-
declare const $dataSource: (services: any, requestConfig: ProFormRequestConfig, context: any
|
5
|
+
declare const $dataSource: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
|
6
6
|
export { $request, $common, $dataSource, $validator };
|
@@ -17,18 +17,19 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
17
17
|
var $request = function $request(field, requestConfig, context, type) {
|
18
18
|
var _field$data;
|
19
19
|
|
20
|
-
var
|
20
|
+
var params = requestConfig.params,
|
21
|
+
beforeRequest = requestConfig.beforeRequest,
|
21
22
|
onSuccess = requestConfig.onSuccess;
|
22
23
|
var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field, context) : {};
|
23
24
|
/**
|
24
|
-
*
|
25
|
+
* 主动触发的请求刷新
|
25
26
|
*/
|
26
27
|
// 触发所有配置的请求
|
27
28
|
|
28
29
|
var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
|
29
30
|
var refreshResult = (0, _utils.isPureObj)(refresh) ? refresh : {};
|
30
31
|
return (0, _utils.doCommonRequest)(_objectSpread(_objectSpread({}, requestConfig), {}, {
|
31
|
-
params: _objectSpread(_objectSpread(_objectSpread({},
|
32
|
+
params: _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult),
|
32
33
|
beforeRequest: function beforeRequest() {
|
33
34
|
return beforeRequestResult;
|
34
35
|
},
|
@@ -44,7 +45,9 @@ exports.$request = $request;
|
|
44
45
|
var $common = function $common(services, requestConfig, context) {
|
45
46
|
return function (field) {
|
46
47
|
return services(field, requestConfig, context, 'request').then(function (res) {
|
47
|
-
|
48
|
+
var _requestConfig$onComp;
|
49
|
+
|
50
|
+
return (_requestConfig$onComp = requestConfig.onComplete) === null || _requestConfig$onComp === void 0 ? void 0 : _requestConfig$onComp.call(requestConfig, res, field, context);
|
48
51
|
});
|
49
52
|
};
|
50
53
|
}; // 配置校验
|
@@ -56,7 +59,9 @@ var $validator = function $validator(services, requestConfig, context) {
|
|
56
59
|
return function (value, rules, _ref) {
|
57
60
|
var field = _ref.field;
|
58
61
|
return services(field, requestConfig, context, 'validator').then(function (res) {
|
59
|
-
|
62
|
+
var _requestConfig$onComp2;
|
63
|
+
|
64
|
+
return (_requestConfig$onComp2 = requestConfig.onComplete) === null || _requestConfig$onComp2 === void 0 ? void 0 : _requestConfig$onComp2.call(requestConfig, res, field, context);
|
60
65
|
});
|
61
66
|
};
|
62
67
|
}; // 配置DataSource
|
@@ -64,41 +69,36 @@ var $validator = function $validator(services, requestConfig, context) {
|
|
64
69
|
|
65
70
|
exports.$validator = $validator;
|
66
71
|
|
67
|
-
var $dataSource = function $dataSource(services, requestConfig, context
|
72
|
+
var $dataSource = function $dataSource(services, requestConfig, context) {
|
68
73
|
return function (field) {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
|
74
|
+
field.setState({
|
75
|
+
loading: true
|
76
|
+
});
|
77
|
+
field.setComponentProps({
|
78
|
+
readOnly: true
|
79
|
+
});
|
76
80
|
return services(field, requestConfig, context, 'dataSource').then(function (res) {
|
81
|
+
var _requestConfig$onComp3;
|
82
|
+
|
77
83
|
var isValueInDataSource = (0, _utils.getValueByValue)(res, field.value);
|
78
84
|
var clearValue = isValueInDataSource ? {} : {
|
79
85
|
value: undefined
|
80
86
|
};
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
field.setState({
|
90
|
-
dataSource: res
|
91
|
-
});
|
92
|
-
}
|
93
|
-
|
94
|
-
return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
|
87
|
+
field.setState(_objectSpread({
|
88
|
+
dataSource: res,
|
89
|
+
loading: false
|
90
|
+
}, clearValue));
|
91
|
+
field.setComponentProps({
|
92
|
+
readOnly: false
|
93
|
+
});
|
94
|
+
return (_requestConfig$onComp3 = requestConfig.onComplete) === null || _requestConfig$onComp3 === void 0 ? void 0 : _requestConfig$onComp3.call(requestConfig, res, field, context);
|
95
95
|
}).catch(function () {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
}
|
96
|
+
field.setState({
|
97
|
+
loading: false
|
98
|
+
});
|
99
|
+
field.setComponentProps({
|
100
|
+
readOnly: false
|
101
|
+
});
|
102
102
|
});
|
103
103
|
};
|
104
104
|
};
|
package/lib/form/fieldTypeMap.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default = void 0;
|
6
|
+
exports.timePicker2TypeArray = exports.default = exports.datePicker2TypeArray = void 0;
|
7
7
|
var fieldTypeMap = {
|
8
8
|
Input: 'text',
|
9
9
|
Password: 'password',
|
@@ -46,5 +46,9 @@ var fieldTypeMap = {
|
|
46
46
|
Search: 'search',
|
47
47
|
SelectGroup: 'selectGroup'
|
48
48
|
};
|
49
|
+
var datePicker2TypeArray = ['DatePicker', 'DateTimePicker', 'WeekPicker', 'MonthPicker', 'YearPicker', 'QuarterPicker', 'DateRangePicker', 'DateTimeRangePicker', 'WeekRangePicker', 'MonthRangePicker', 'YearRangePicker', 'QuarterRangePicker'];
|
50
|
+
exports.datePicker2TypeArray = datePicker2TypeArray;
|
51
|
+
var timePicker2TypeArray = ['TimePicker', 'TimeRangePicker'];
|
52
|
+
exports.timePicker2TypeArray = timePicker2TypeArray;
|
49
53
|
var _default = fieldTypeMap;
|
50
54
|
exports.default = _default;
|
package/lib/index.d.ts
CHANGED
@@ -24,5 +24,5 @@ export * from './skeleton';
|
|
24
24
|
export * from './table';
|
25
25
|
export * from './utils';
|
26
26
|
export * from './timeline';
|
27
|
-
declare const version = "1.3.
|
27
|
+
declare const version = "1.3.2";
|
28
28
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProTimeline, hooks, nocode, templates, utils, };
|
package/lib/index.js
CHANGED
@@ -39,9 +39,11 @@ var RadioItem = _components.Menu.RadioItem;
|
|
39
39
|
var cls = (0, _utils.baseClass)('teamix-pro-table-toolbar-icon');
|
40
40
|
|
41
41
|
var DensityIcon = function DensityIcon(props) {
|
42
|
+
var _actionRef$current;
|
43
|
+
|
42
44
|
var actionRef = props.actionRef;
|
43
45
|
|
44
|
-
var _useState = (0, _react.useState)('medium'),
|
46
|
+
var _useState = (0, _react.useState)(((_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : _actionRef$current.size) || 'medium'),
|
45
47
|
_useState2 = _slicedToArray(_useState, 2),
|
46
48
|
size = _useState2[0],
|
47
49
|
setSize = _useState2[1]; // const [fullscreen, setFullscreen] = useState<boolean>(false);
|
@@ -61,10 +63,10 @@ var DensityIcon = function DensityIcon(props) {
|
|
61
63
|
|
62
64
|
|
63
65
|
var radioOnchange = function radioOnchange(mode) {
|
64
|
-
var _actionRef$
|
66
|
+
var _actionRef$current2, _actionRef$current2$s;
|
65
67
|
|
66
68
|
setSize(mode);
|
67
|
-
(_actionRef$
|
69
|
+
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setSize) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, mode);
|
68
70
|
}; // // 销毁监听函数
|
69
71
|
// useEffect(() => {
|
70
72
|
// return () => {
|
@@ -54,9 +54,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
54
54
|
var CheckboxItem = _components.Menu.CheckboxItem;
|
55
55
|
var Row = _components.Grid.Row,
|
56
56
|
Col = _components.Grid.Col;
|
57
|
-
var cls = (0, _utils.baseClass)('teamix-pro-table-toolbar-filter-column');
|
57
|
+
var cls = (0, _utils.baseClass)('teamix-pro-table-toolbar-filter-column'); // 判断是否是 root 组织
|
58
|
+
|
59
|
+
var isRoot = (0, _utils.getCookie)('organizationId') === '1';
|
58
60
|
|
59
61
|
var processColumns = function processColumns(columns) {
|
62
|
+
if (isRoot) {
|
63
|
+
// root 组织下不显示标签管理
|
64
|
+
columns = columns.filter(function (item) {
|
65
|
+
return item.valueType !== 'selectGroup';
|
66
|
+
});
|
67
|
+
}
|
68
|
+
|
60
69
|
return columns.map(function (item) {
|
61
70
|
if (item.columnFilters === false) {
|
62
71
|
return item;
|
@@ -313,7 +322,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
313
322
|
return onChangeColumns(check, dataIndex);
|
314
323
|
},
|
315
324
|
disabled: columnFiltersDisabled
|
316
|
-
}, title, !lock && /*#__PURE__*/_react.default.createElement("div", {
|
325
|
+
}, title, !lock && !columnFiltersDisabled && /*#__PURE__*/_react.default.createElement("div", {
|
317
326
|
className: cls({
|
318
327
|
sort: true
|
319
328
|
})
|
@@ -29,7 +29,7 @@
|
|
29
29
|
}
|
30
30
|
&-reset {
|
31
31
|
position: absolute;
|
32
|
-
right:
|
32
|
+
right: 0px;
|
33
33
|
top: 6px;
|
34
34
|
}
|
35
35
|
// .next-menu {
|
@@ -59,7 +59,7 @@
|
|
59
59
|
.teamix-pro-table-toolbar-filter-column-sort {
|
60
60
|
visibility: hidden;
|
61
61
|
position: absolute;
|
62
|
-
right:
|
62
|
+
right: 0px;
|
63
63
|
top: 0;
|
64
64
|
color: var(--color-text1-7);
|
65
65
|
i {
|
package/lib/table/index.js
CHANGED
@@ -55,7 +55,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
55
55
|
}
|
56
56
|
});
|
57
57
|
});
|
58
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords"];
|
58
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll"];
|
59
59
|
|
60
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
61
61
|
|
@@ -222,6 +222,9 @@ var ProTable = function ProTable(props) {
|
|
222
222
|
defaultFilterParams = props.defaultFilterParams,
|
223
223
|
_props$reserveSelecte = props.reserveSelectedRecords,
|
224
224
|
reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
|
225
|
+
_props$size = props.size,
|
226
|
+
propsSize = _props$size === void 0 ? 'medium' : _props$size,
|
227
|
+
disableSelectAll = props.disableSelectAll,
|
225
228
|
otherProps = _objectWithoutProperties(props, _excluded);
|
226
229
|
|
227
230
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -275,7 +278,7 @@ var ProTable = function ProTable(props) {
|
|
275
278
|
filteredColumns = _useState16[0],
|
276
279
|
setFilteredColumns = _useState16[1];
|
277
280
|
|
278
|
-
var _useState17 = (0, _react.useState)(
|
281
|
+
var _useState17 = (0, _react.useState)(propsSize),
|
279
282
|
_useState18 = _slicedToArray(_useState17, 2),
|
280
283
|
size = _useState18[0],
|
281
284
|
_setSize = _useState18[1];
|
@@ -398,7 +401,7 @@ var ProTable = function ProTable(props) {
|
|
398
401
|
result = propsRowSelection.titleProps();
|
399
402
|
}
|
400
403
|
|
401
|
-
if (showSkeleton) {
|
404
|
+
if (showSkeleton || disableSelectAll) {
|
402
405
|
result.disabled = true;
|
403
406
|
}
|
404
407
|
|
@@ -433,7 +436,7 @@ var ProTable = function ProTable(props) {
|
|
433
436
|
return selectedRowKeys.includes(k);
|
434
437
|
});
|
435
438
|
return {
|
436
|
-
disabled: showLoading && !showSkeleton && (getData.loading || props.loading),
|
439
|
+
disabled: disableSelectAll || showLoading && !showSkeleton && (getData.loading || props.loading),
|
437
440
|
onChange: function onChange(check) {
|
438
441
|
if (check) {
|
439
442
|
var result = selectedRowKeys.concat([]);
|
@@ -537,6 +540,7 @@ var ProTable = function ProTable(props) {
|
|
537
540
|
(0, _utils2.emit)('refreshFilterState', newColumns);
|
538
541
|
}
|
539
542
|
},
|
543
|
+
size: size,
|
540
544
|
setSize: function setSize(mode) {
|
541
545
|
_setSize(mode);
|
542
546
|
},
|
package/lib/table/index.scss
CHANGED
package/lib/table/typing.d.ts
CHANGED
@@ -135,6 +135,8 @@ export declare type ProTableProps = {
|
|
135
135
|
defaultFilterParams?: {
|
136
136
|
[key: string]: any[] | any;
|
137
137
|
};
|
138
|
+
/** 禁用掉批量选择中的全选 */
|
139
|
+
disableSelectAll?: boolean;
|
138
140
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
139
141
|
export declare type rowSelectionType = {
|
140
142
|
getProps?: (record: any, index: number) => any;
|
@@ -160,6 +162,8 @@ export declare type ProTableActionType = {
|
|
160
162
|
fullScreen?: () => boolean;
|
161
163
|
/** 设置显示列 */
|
162
164
|
setColumn?: (newColumns: ProColumnProps[], update?: boolean) => void;
|
165
|
+
/** 表格尺寸 */
|
166
|
+
size?: 'small' | 'medium';
|
163
167
|
/** 设置表格大小 */
|
164
168
|
setSize?: (mode: 'small' | 'medium') => void;
|
165
169
|
/** 刷新表格 */
|
@@ -171,6 +171,12 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
|
|
171
171
|
}
|
172
172
|
}, props);
|
173
173
|
}
|
174
|
+
|
175
|
+
if ((render === null || render === void 0 ? void 0 : render.type) === 'step') {
|
176
|
+
newRender = _objectSpread(_objectSpread({}, newRender), {}, {
|
177
|
+
ellipsis: false
|
178
|
+
});
|
179
|
+
}
|
174
180
|
} // 渲染操作组
|
175
181
|
|
176
182
|
|