@teamix/pro 1.1.7 → 1.1.8
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/212.js +2 -2
- package/dist/pro.css +1 -1
- package/dist/pro.js +1963 -658
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/form/Components/ProField/index.d.ts +8 -0
- package/es/form/ProForm/index.js +9 -2
- package/es/form/ProForm/index.scss +33 -6
- package/es/form/SchemaForm/adapterType.js +2 -0
- package/es/form/SchemaForm/index.js +6 -3
- package/es/form/SchemaForm/initializeArrayIcon.js +7 -2
- package/es/form/SchemaForm/initializeFormButton.js +35 -38
- package/es/form/SchemaForm/initializeFormStep.d.ts +3 -1
- package/es/form/SchemaForm/initializeFormStep.js +21 -7
- package/es/form/SchemaForm/initializeProField.js +2 -0
- package/es/form/index.d.ts +2 -1
- package/es/form/index.js +2 -1
- package/es/form/typing.d.ts +1 -1
- package/es/index.d.ts +3 -3
- package/es/index.js +3 -3
- package/es/nocode/index.scss +1 -4
- package/es/page-header/index.d.ts +2 -0
- package/es/page-header/index.js +22 -6
- package/es/page-header/index.scss +4 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +77 -17
- package/es/table/components/ToolBar/index.scss +10 -0
- package/es/table/index.js +68 -36
- package/es/table/typing.d.ts +3 -1
- package/lib/form/Components/ProField/index.d.ts +8 -0
- package/lib/form/ProForm/index.js +10 -2
- package/lib/form/ProForm/index.scss +33 -6
- package/lib/form/SchemaForm/adapterType.js +2 -0
- package/lib/form/SchemaForm/index.js +7 -3
- package/lib/form/SchemaForm/initializeArrayIcon.js +7 -2
- package/lib/form/SchemaForm/initializeFormButton.js +35 -38
- package/lib/form/SchemaForm/initializeFormStep.d.ts +3 -1
- package/lib/form/SchemaForm/initializeFormStep.js +21 -7
- package/lib/form/SchemaForm/initializeProField.js +2 -0
- package/lib/form/index.d.ts +2 -1
- package/lib/form/index.js +35 -0
- package/lib/form/typing.d.ts +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -3
- package/lib/nocode/index.scss +1 -4
- package/lib/page-header/index.d.ts +2 -0
- package/lib/page-header/index.js +23 -6
- package/lib/page-header/index.scss +4 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +75 -16
- package/lib/table/components/ToolBar/index.scss +10 -0
- package/lib/table/index.js +67 -37
- package/lib/table/typing.d.ts +3 -1
- package/package.json +1 -1
@@ -19,14 +19,16 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
19
19
|
/**
|
20
20
|
* 筛选列
|
21
21
|
*/
|
22
|
-
import { Button, Dropdown, Menu } from '@alicloudfe/components';
|
22
|
+
import { Button, Dropdown, Menu, Dialog, Grid, Checkbox } from '@alicloudfe/components';
|
23
23
|
import TeamixIcon from '@teamix/icon';
|
24
24
|
import { baseClass, getMessage } from '@teamix/utils';
|
25
25
|
import React, { useState, useEffect } from 'react';
|
26
26
|
import { cloneDeep } from '../../utils';
|
27
27
|
import './index.scss';
|
28
|
-
|
29
|
-
|
28
|
+
import { Ellipsis } from '@teamix/utils';
|
29
|
+
var CheckboxItem = Menu.CheckboxItem;
|
30
|
+
var Row = Grid.Row,
|
31
|
+
Col = Grid.Col;
|
30
32
|
var cls = baseClass('teamix-pro-table-toolbar-filter-column');
|
31
33
|
|
32
34
|
var processColumns = function processColumns(columns) {
|
@@ -126,6 +128,13 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
126
128
|
return item;
|
127
129
|
});
|
128
130
|
notifyTableRender(keyNewColumns);
|
131
|
+
}; // 修改:dialog
|
132
|
+
|
133
|
+
|
134
|
+
var onChangeColumnsForDialog = function onChangeColumnsForDialog() {
|
135
|
+
var keyNewColumns = cloneDeep(newColumns);
|
136
|
+
notifyTableRender(keyNewColumns);
|
137
|
+
setDropdownVisible(false);
|
129
138
|
}; // 向上
|
130
139
|
|
131
140
|
|
@@ -265,20 +274,71 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
265
274
|
})))));
|
266
275
|
};
|
267
276
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
277
|
+
var renderDialog = function renderDialog() {
|
278
|
+
// 对话框关闭
|
279
|
+
var dialogOnClose = function dialogOnClose() {
|
280
|
+
setDropdownVisible(false);
|
281
|
+
};
|
282
|
+
|
283
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
284
|
+
iconSize: "small",
|
285
|
+
className: "teamix-pro-table-toolbar-icon",
|
286
|
+
onClick: function onClick() {
|
287
|
+
setDropdownVisible(!dropdownVisible);
|
288
|
+
}
|
289
|
+
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
290
|
+
size: "small",
|
291
|
+
type: "set-line"
|
292
|
+
})), /*#__PURE__*/React.createElement(Dialog, {
|
293
|
+
title: getMessage('customColumnSetting'),
|
294
|
+
visible: dropdownVisible,
|
295
|
+
onOk: onChangeColumnsForDialog,
|
296
|
+
onCancel: dialogOnClose,
|
297
|
+
onClose: dialogOnClose,
|
298
|
+
style: {
|
299
|
+
width: '440px'
|
300
|
+
}
|
301
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
302
|
+
gutter: 20,
|
303
|
+
wrap: true,
|
304
|
+
className: cls('row')
|
305
|
+
}, newColumns.map(function (item, index) {
|
306
|
+
var _newColumns$find2;
|
307
|
+
|
308
|
+
var dataIndex = item.dataIndex,
|
309
|
+
title = item.title,
|
310
|
+
columnFiltersDisabled = item.columnFiltersDisabled;
|
311
|
+
return /*#__PURE__*/React.createElement(Col, {
|
312
|
+
span: 8,
|
313
|
+
key: index,
|
314
|
+
className: cls('col')
|
315
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
316
|
+
checked: (_newColumns$find2 = newColumns.find(function (_ref5) {
|
317
|
+
var key = _ref5.dataIndex;
|
318
|
+
return key === dataIndex;
|
319
|
+
})) === null || _newColumns$find2 === void 0 ? void 0 : _newColumns$find2.columnFilters,
|
320
|
+
onChange: function onChange(check) {
|
321
|
+
var columnsList = cloneDeep(newColumns).map(function (item) {
|
322
|
+
if (item.dataIndex === dataIndex) {
|
323
|
+
item.columnFilters = check;
|
324
|
+
}
|
325
|
+
|
326
|
+
return item;
|
327
|
+
});
|
328
|
+
setNewColumns(columnsList);
|
329
|
+
},
|
330
|
+
disabled: columnFiltersDisabled
|
331
|
+
}, /*#__PURE__*/React.createElement(Ellipsis, {
|
332
|
+
tooltip: false
|
333
|
+
}, title)));
|
334
|
+
}))));
|
335
|
+
};
|
336
|
+
|
337
|
+
if (newColumns.length > 10) {
|
338
|
+
return renderDialog();
|
339
|
+
}
|
340
|
+
|
341
|
+
return renderDropdown();
|
282
342
|
};
|
283
343
|
|
284
344
|
export default FilterColumnIcon;
|
@@ -66,8 +66,18 @@
|
|
66
66
|
}
|
67
67
|
}
|
68
68
|
}
|
69
|
+
|
70
|
+
|
71
|
+
}
|
72
|
+
.teamix-pro-table-toolbar-filter-column-col {
|
73
|
+
height: 28px;
|
74
|
+
.next-checkbox-wrapper {
|
75
|
+
display: flex;
|
76
|
+
align-items: center;
|
77
|
+
}
|
69
78
|
}
|
70
79
|
|
80
|
+
|
71
81
|
// fullscreen
|
72
82
|
.teamix-pro-table-full-screen {
|
73
83
|
width: 100vw;
|
package/es/table/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "quickAction", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction"];
|
1
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "quickAction", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh"];
|
2
2
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
4
|
|
@@ -50,8 +50,8 @@ import debounce from 'lodash.debounce';
|
|
50
50
|
import classNames from 'classnames';
|
51
51
|
export * from './typing'; // 导出 ProActions 组件
|
52
52
|
|
53
|
-
export * from '../actions';
|
54
|
-
|
53
|
+
export * from '../actions'; // import { useSize } from 'ahooks';
|
54
|
+
|
55
55
|
var cls = baseClass('teamix-pro-table');
|
56
56
|
var toJS = formilyReactive.toJS;
|
57
57
|
/**
|
@@ -127,6 +127,10 @@ var ProTable = function ProTable(props) {
|
|
127
127
|
filterDebounce = _props$filterDebounce === void 0 ? 300 : _props$filterDebounce,
|
128
128
|
_props$footerSuction = props.footerSuction,
|
129
129
|
footerSuction = _props$footerSuction === void 0 ? false : _props$footerSuction,
|
130
|
+
_props$autoRefresh = props.autoRefresh,
|
131
|
+
autoRefresh = _props$autoRefresh === void 0 ? function () {
|
132
|
+
return false;
|
133
|
+
} : _props$autoRefresh,
|
130
134
|
otherProps = _objectWithoutProperties(props, _excluded);
|
131
135
|
|
132
136
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -177,8 +181,15 @@ var ProTable = function ProTable(props) {
|
|
177
181
|
var _useState15 = useState('medium'),
|
178
182
|
_useState16 = _slicedToArray(_useState15, 2),
|
179
183
|
size = _useState16[0],
|
180
|
-
_setSize = _useState16[1];
|
184
|
+
_setSize = _useState16[1];
|
185
|
+
|
186
|
+
var _useState17 = useState(true),
|
187
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
188
|
+
showLoading = _useState18[0],
|
189
|
+
setShowLoading = _useState18[1]; // 存储定时器 id
|
190
|
+
|
181
191
|
|
192
|
+
var autoRefreshTimerRef = useRef(); // 获取header高度,用作全屏吸底吸顶高度计算
|
182
193
|
|
183
194
|
var getHeaderHeight = function getHeaderHeight() {
|
184
195
|
var _tableDom$getElements, _tableDom$getElements2;
|
@@ -199,30 +210,30 @@ var ProTable = function ProTable(props) {
|
|
199
210
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
200
211
|
|
201
212
|
|
202
|
-
var
|
203
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
204
|
-
headerHeight = _useState18[0],
|
205
|
-
setHeaderHeight = _useState18[1]; // 全屏显示 className
|
206
|
-
|
207
|
-
|
208
|
-
var _useState19 = useState(false),
|
213
|
+
var _useState19 = useState(0),
|
209
214
|
_useState20 = _slicedToArray(_useState19, 2),
|
210
|
-
|
211
|
-
|
215
|
+
headerHeight = _useState20[0],
|
216
|
+
setHeaderHeight = _useState20[1]; // 全屏显示 className
|
212
217
|
|
213
218
|
|
214
|
-
var _useState21 = useState(),
|
219
|
+
var _useState21 = useState(false),
|
215
220
|
_useState22 = _slicedToArray(_useState21, 2),
|
216
|
-
|
217
|
-
|
221
|
+
fullscreenState = _useState22[0],
|
222
|
+
setFullscreenState = _useState22[1]; // 父元素位置。用作非全屏模式下的吸底
|
223
|
+
|
224
|
+
|
225
|
+
var _useState23 = useState(),
|
226
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
227
|
+
parentPosition = _useState24[0],
|
228
|
+
setParentPosition = _useState24[1];
|
218
229
|
/** 筛选区域 form */
|
219
230
|
|
220
231
|
|
221
232
|
var dataFilterForm = useMemo(function () {
|
222
233
|
return createForm();
|
223
234
|
}, []); // 获取表格大小
|
224
|
-
|
225
|
-
|
235
|
+
// const tableSize = useSize(tableRef);
|
236
|
+
// 获取父元素位置
|
226
237
|
|
227
238
|
var getParentPosition = function getParentPosition() {
|
228
239
|
// 暂时仅支持使用全家桶
|
@@ -236,12 +247,12 @@ var ProTable = function ProTable(props) {
|
|
236
247
|
});
|
237
248
|
}
|
238
249
|
}; // 监听表格大小动态改变吸底footer大小
|
250
|
+
// useEffect(() => {
|
251
|
+
// getParentPosition();
|
252
|
+
// }, [tableSize]);
|
253
|
+
// rowSelection 相关
|
239
254
|
|
240
255
|
|
241
|
-
useEffect(function () {
|
242
|
-
getParentPosition();
|
243
|
-
}, [tableSize]); // rowSelection 相关
|
244
|
-
|
245
256
|
var rowSelectionHook = useTableSelection(_objectSpread(_objectSpread({}, propsRowSelection), {}, {
|
246
257
|
onChange: onChangeRowSelection
|
247
258
|
}), primaryKey);
|
@@ -353,6 +364,25 @@ var ProTable = function ProTable(props) {
|
|
353
364
|
|
354
365
|
if (propsActionRef) {
|
355
366
|
propsActionRef.current = actionRef.current;
|
367
|
+
}
|
368
|
+
|
369
|
+
function onFormatResult(next) {
|
370
|
+
var _next$data;
|
371
|
+
|
372
|
+
props.onFormatResult && props.onFormatResult(next);
|
373
|
+
var time = autoRefresh ? autoRefresh(next.data) : false;
|
374
|
+
|
375
|
+
if (Number.isInteger(time) && time >= 1000) {
|
376
|
+
autoRefreshTimerRef.current = setTimeout(function () {
|
377
|
+
// 自动刷新不显示 loading
|
378
|
+
_request({}, true);
|
379
|
+
}, Number(time));
|
380
|
+
} // 设置 dataSource、total
|
381
|
+
|
382
|
+
|
383
|
+
setData(next.data || []);
|
384
|
+
setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
|
385
|
+
setShowSkeleton(false);
|
356
386
|
} // 请求表格数据工具函数
|
357
387
|
|
358
388
|
|
@@ -383,16 +413,6 @@ var ProTable = function ProTable(props) {
|
|
383
413
|
}
|
384
414
|
}
|
385
415
|
|
386
|
-
function onFormatResult(next) {
|
387
|
-
var _next$data;
|
388
|
-
|
389
|
-
props.onFormatResult && props.onFormatResult(next); // 设置 dataSource、total
|
390
|
-
|
391
|
-
setData(next.data || []);
|
392
|
-
setTotal(next.total || ((_next$data = next.data) === null || _next$data === void 0 ? void 0 : _next$data.length));
|
393
|
-
setShowSkeleton(false);
|
394
|
-
}
|
395
|
-
|
396
416
|
if (nextData instanceof Promise) {
|
397
417
|
nextData.then(function (res) {
|
398
418
|
onFormatResult(res);
|
@@ -414,10 +434,12 @@ var ProTable = function ProTable(props) {
|
|
414
434
|
}
|
415
435
|
}); // 请求函数
|
416
436
|
|
417
|
-
function _request(params) {
|
437
|
+
function _request(params, noLoading) {
|
418
438
|
var _actionRef$current, _actionRef$current$se, _objectSpread2;
|
419
439
|
|
420
|
-
|
440
|
+
var nextShowLoading = !noLoading;
|
441
|
+
nextShowLoading !== showLoading && setShowLoading(nextShowLoading); // 请求前需要优先清空列过滤条件
|
442
|
+
|
421
443
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setFilterRules) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, {});
|
422
444
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
423
445
|
|
@@ -426,7 +448,11 @@ var ProTable = function ProTable(props) {
|
|
426
448
|
var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams) : _objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams)), params));
|
427
449
|
|
428
450
|
if (requestData) {
|
429
|
-
|
451
|
+
if (autoRefreshTimerRef.current) {
|
452
|
+
clearTimeout(autoRefreshTimerRef.current);
|
453
|
+
autoRefreshTimerRef.current = null;
|
454
|
+
}
|
455
|
+
|
430
456
|
getData.run(requestData);
|
431
457
|
}
|
432
458
|
}
|
@@ -435,6 +461,12 @@ var ProTable = function ProTable(props) {
|
|
435
461
|
if (requestWhenMount) {
|
436
462
|
_request();
|
437
463
|
}
|
464
|
+
|
465
|
+
return function () {
|
466
|
+
if (autoRefreshTimerRef.current) {
|
467
|
+
clearTimeout(autoRefreshTimerRef.current);
|
468
|
+
}
|
469
|
+
};
|
438
470
|
}, []);
|
439
471
|
|
440
472
|
function onSort(dataIndex, order) {
|
@@ -480,7 +512,7 @@ var ProTable = function ProTable(props) {
|
|
480
512
|
hasBorder: false,
|
481
513
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
482
514
|
columns: genProColumnToColumn(filteredColumns, showSkeleton, actionRef),
|
483
|
-
loading: !showSkeleton && (getData.loading || props.loading),
|
515
|
+
loading: showLoading && !showSkeleton && (getData.loading || props.loading),
|
484
516
|
className: classNames('teamix-pro-table', tableClassName, {
|
485
517
|
'with-row-select': rowSelection
|
486
518
|
}),
|
package/es/table/typing.d.ts
CHANGED
@@ -103,8 +103,10 @@ export declare type ProTableProps = {
|
|
103
103
|
skeletonSize?: number;
|
104
104
|
/** 表格主题 className */
|
105
105
|
tableClassName?: string;
|
106
|
-
/** 非全屏模式下是否吸底 默认状态下取用 ProPageContainer 作为参照物。如果传入了Dom,则取用Dom作为参照物 */
|
106
|
+
/** 非全屏模式下是否吸底 默认状态下取用 ProPageContainer 作为参照物。如果传入了 Dom,则取用 Dom 作为参照物 */
|
107
107
|
footerSuction?: boolean | Element;
|
108
|
+
/** 当满足条件时开启自动刷新,返回值为自动刷新间隔时间,如果返回 0 或 false 则停止自动刷新,每次触发翻页、搜索都将重置时间 */
|
109
|
+
autoRefresh?: (dataSource: any[]) => number | boolean;
|
108
110
|
} & Omit<TableProps, 'columns'> & ProTableTopAreaProps;
|
109
111
|
export declare type rowSelectionType = {
|
110
112
|
getProps?: (record: any, index: number) => any;
|
@@ -139,6 +139,14 @@ declare const _default: React.ForwardRefExoticComponent<(Partial<import("@teamix
|
|
139
139
|
type: "search";
|
140
140
|
} & {
|
141
141
|
children?: React.ReactNode;
|
142
|
+
}> | Partial<import("@teamix/pro-field/lib/components/FieldTagFilter").IProFieldTagFilter & {
|
143
|
+
type: "tagFilter";
|
144
|
+
} & {
|
145
|
+
children?: React.ReactNode;
|
146
|
+
}> | Partial<import("@teamix/pro-field/lib/components/FieldMenuSelect").IProFieldMenuSelect & {
|
147
|
+
type: "menuSelect";
|
148
|
+
} & {
|
149
|
+
children?: React.ReactNode;
|
142
150
|
}> | Pick<Partial<{
|
143
151
|
[key: string]: any;
|
144
152
|
type: string;
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
9
9
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
11
11
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
|
12
14
|
var _core = require("@formily/core");
|
13
15
|
|
14
16
|
var _reactive = require("@formily/reactive");
|
@@ -25,7 +27,7 @@ var _utils2 = require("../utils");
|
|
25
27
|
|
26
28
|
require("./index.scss");
|
27
29
|
|
28
|
-
var _excluded = ["form", "initialValues", "schema", "scope", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed"];
|
30
|
+
var _excluded = ["form", "initialValues", "schema", "scope", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "className"];
|
29
31
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31
33
|
|
@@ -59,11 +61,13 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
59
61
|
onChange = _ref.onChange,
|
60
62
|
onSubmit = _ref.onSubmit,
|
61
63
|
onSubmitFailed = _ref.onSubmitFailed,
|
64
|
+
className = _ref.className,
|
62
65
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
63
66
|
|
64
67
|
var form = (0, _react.useMemo)(function () {
|
65
68
|
return outerForm || (0, _core.createForm)();
|
66
69
|
}, []);
|
70
|
+
var prefix = 'teamix-pro-form';
|
67
71
|
var getTeamixLayout = (0, _react.useMemo)(function () {
|
68
72
|
return breakpoints ? {
|
69
73
|
breakpoints: breakpoints,
|
@@ -107,7 +111,11 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
107
111
|
return outerForm === false ?
|
108
112
|
/*#__PURE__*/
|
109
113
|
// 特殊表单,无需渲染form实例,例如FormDialog等
|
110
|
-
_react.default.createElement(_formily.FormLayout, _objectSpread(_objectSpread({
|
114
|
+
_react.default.createElement(_formily.FormLayout, _objectSpread(_objectSpread({
|
115
|
+
className: (0, _classnames.default)(prefix, className)
|
116
|
+
}, otherProps), getTeamixLayout), formChildren) : /*#__PURE__*/_react.default.createElement(_formily.Form, _objectSpread(_objectSpread(_objectSpread({
|
117
|
+
className: (0, _classnames.default)(prefix, className)
|
118
|
+
}, otherProps), getTeamixLayout), {}, {
|
111
119
|
form: form,
|
112
120
|
onAutoSubmit: onSubmit,
|
113
121
|
onAutoSubmitFailed: onSubmitFailed
|
@@ -1,6 +1,13 @@
|
|
1
1
|
@import '~@alifd/next/lib/core/index-noreset.scss';
|
2
2
|
|
3
3
|
$form-item-cls: #{$css-prefix}formily-item;
|
4
|
+
$teamix-pro-form: teamix-pro-form;
|
5
|
+
|
6
|
+
.#{$teamix-pro-form} {
|
7
|
+
.next-affix {
|
8
|
+
top: auto !important; // todo 待pro-page-containe修复后移除
|
9
|
+
}
|
10
|
+
}
|
4
11
|
|
5
12
|
// FormItem 样式重写
|
6
13
|
.#{$form-item-cls} {
|
@@ -38,6 +45,7 @@ $form-item-cls: #{$css-prefix}formily-item;
|
|
38
45
|
.teamix-pro-field-radio,
|
39
46
|
.teamix-pro-field-switch,
|
40
47
|
.teamix-pro-field-colorradio,
|
48
|
+
.teamix-pro-field-range,
|
41
49
|
.#{$css-prefix}btn-text {
|
42
50
|
line-height: var(--form-element-medium-height, 32px);
|
43
51
|
}
|
@@ -91,6 +99,9 @@ $form-item-cls: #{$css-prefix}formily-item;
|
|
91
99
|
.#{$form-item-cls}-extra {
|
92
100
|
color: var(--color-text1-8, #848484);
|
93
101
|
}
|
102
|
+
.#{$form-item-cls}-error-help {
|
103
|
+
color: var(--color-error-5, #e84738);
|
104
|
+
}
|
94
105
|
|
95
106
|
// 前缀 后缀
|
96
107
|
.#{$form-item-cls}-control {
|
@@ -224,14 +235,16 @@ $inset-font-weight-medium: calc(
|
|
224
235
|
}
|
225
236
|
}
|
226
237
|
|
227
|
-
.#{$
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
238
|
+
.#{$teamix-pro-form}-button-affix.#{$css-prefix}affix {
|
239
|
+
left: 0;
|
240
|
+
right: 0;
|
241
|
+
width: 100% !important;
|
242
|
+
height: 56px !important;
|
243
|
+
padding-left: 24px;
|
244
|
+
background: var(--color-fill1-1, #fff) !important;
|
232
245
|
box-shadow: 0 -1px 5px 0 rgba(38, 38, 38, 0.14);
|
233
246
|
.#{$css-prefix}formily-button-group {
|
234
|
-
margin-
|
247
|
+
margin-bottom: 12px;
|
235
248
|
}
|
236
249
|
}
|
237
250
|
|
@@ -252,3 +265,17 @@ $inset-font-weight-medium: calc(
|
|
252
265
|
}
|
253
266
|
}
|
254
267
|
}
|
268
|
+
|
269
|
+
// ArrayItems
|
270
|
+
.#{$css-prefix}formily-array-items {
|
271
|
+
.#{$css-prefix}formily-grid-layout {
|
272
|
+
> div:last-child {
|
273
|
+
display: flex;
|
274
|
+
justify-content: flex-end;
|
275
|
+
align-items: center;
|
276
|
+
}
|
277
|
+
}
|
278
|
+
.#{$css-prefix}formily-array-base-remove {
|
279
|
+
cursor: pointer;
|
280
|
+
}
|
281
|
+
}
|
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
12
12
|
var _react2 = require("@formily/react");
|
13
13
|
|
14
|
+
var _components = require("@alicloudfe/components");
|
15
|
+
|
14
16
|
var _formily = require("@teamix/formily");
|
15
17
|
|
16
18
|
var _ProField = _interopRequireDefault(require("../Components/ProField"));
|
@@ -96,7 +98,6 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
96
98
|
var SchemaField = (0, _react.useMemo)(function () {
|
97
99
|
return (0, _react2.createSchemaField)({
|
98
100
|
components: {
|
99
|
-
Upload: _formily.Upload,
|
100
101
|
ProField: _ProField.default,
|
101
102
|
FormLayout: _formily.FormLayout,
|
102
103
|
FormItem: _formily.FormItem,
|
@@ -120,7 +121,9 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
120
121
|
EditablePopover: _Editable.EditablePopover,
|
121
122
|
FormGroup: _FormGroup.default,
|
122
123
|
Search: _Search.default,
|
123
|
-
QueryFilter: _QueryFilter.default
|
124
|
+
QueryFilter: _QueryFilter.default,
|
125
|
+
Upload: _formily.Upload,
|
126
|
+
Affix: _components.Affix
|
124
127
|
}
|
125
128
|
});
|
126
129
|
}, []); // 合并schema中request的scope
|
@@ -291,7 +294,8 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
291
294
|
type: 'object',
|
292
295
|
properties: formatSchema(schema)
|
293
296
|
};
|
294
|
-
}, [formatSchema, schema]);
|
297
|
+
}, [formatSchema, schema]); // console.log(schemaPro);
|
298
|
+
|
295
299
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(SchemaField, {
|
296
300
|
schema: schemaPro,
|
297
301
|
components: components,
|
@@ -10,7 +10,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
11
11
|
|
12
12
|
var _excluded = ["component", "props"],
|
13
|
-
_excluded2 = ["icon"]
|
13
|
+
_excluded2 = ["icon"],
|
14
|
+
_excluded3 = ["text", "type"];
|
14
15
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
17
|
|
@@ -54,7 +55,11 @@ var initialize = function initialize(item) {
|
|
54
55
|
return _objectSpread(_objectSpread({}, other), {}, {
|
55
56
|
component: component,
|
56
57
|
props: _objectSpread({
|
57
|
-
icon: function icon(
|
58
|
+
icon: function icon(_ref) {
|
59
|
+
var text = _ref.text,
|
60
|
+
type = _ref.type,
|
61
|
+
props = _objectWithoutProperties(_ref, _excluded3);
|
62
|
+
|
58
63
|
return /*#__PURE__*/_react.default.createElement(_icon.default, _objectSpread(_objectSpread({}, props), {}, {
|
59
64
|
type: iconType,
|
60
65
|
size: "small"
|
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
var _excluded = ["
|
8
|
-
|
7
|
+
var _excluded = ["sticky"];
|
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; }
|
9
12
|
|
10
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
11
14
|
|
@@ -13,10 +16,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
13
16
|
|
14
17
|
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; }
|
15
18
|
|
16
|
-
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; }
|
17
|
-
|
18
|
-
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; }
|
19
|
-
|
20
19
|
var buttonTextMap = {
|
21
20
|
Submit: '提交',
|
22
21
|
Reset: '重置'
|
@@ -24,58 +23,56 @@ var buttonTextMap = {
|
|
24
23
|
|
25
24
|
var initializeButton = function initializeButton(item) {
|
26
25
|
var component = item.component,
|
27
|
-
props = item.props,
|
28
|
-
|
29
|
-
|
30
|
-
return _objectSpread({
|
26
|
+
_item$props = item.props,
|
27
|
+
props = _item$props === void 0 ? {} : _item$props;
|
28
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
31
29
|
component: component,
|
32
30
|
props: _objectSpread({
|
33
31
|
children: buttonTextMap[component]
|
34
32
|
}, props)
|
35
|
-
}
|
33
|
+
});
|
36
34
|
};
|
37
35
|
|
38
36
|
var initialize = function initialize(item) {
|
39
|
-
var
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
var component = item.component,
|
38
|
+
_item$props2 = item.props,
|
39
|
+
props = _item$props2 === void 0 ? {} : _item$props2,
|
40
|
+
_item$decoratorProps = item.decoratorProps,
|
41
|
+
decoratorProps = _item$decoratorProps === void 0 ? {} : _item$decoratorProps;
|
43
42
|
|
44
43
|
var sticky = props.sticky,
|
45
|
-
|
46
|
-
|
47
|
-
var alignProps = align ? {
|
48
|
-
align: align
|
49
|
-
} : {};
|
50
|
-
var gutterProps = gutter ? {
|
51
|
-
gutter: gutter
|
52
|
-
} : {};
|
44
|
+
otherProps = _objectWithoutProperties(props, _excluded); // 单个按钮
|
45
|
+
|
53
46
|
|
54
47
|
if (component && ['Submit', 'Reset'].includes(component)) {
|
55
48
|
return initializeButton(item);
|
56
49
|
}
|
57
50
|
|
58
|
-
var
|
59
|
-
title: ' '
|
51
|
+
var commonMode = _objectSpread(_objectSpread({
|
52
|
+
title: ' '
|
53
|
+
}, item), {}, {
|
54
|
+
component: component,
|
55
|
+
props: otherProps,
|
60
56
|
decorator: 'FormButtonGroup.FormItem',
|
61
|
-
decoratorProps: {
|
57
|
+
decoratorProps: _objectSpread({
|
62
58
|
inset: false
|
63
|
-
},
|
64
|
-
|
65
|
-
|
59
|
+
}, decoratorProps)
|
60
|
+
}); // 吸底模式
|
61
|
+
|
66
62
|
|
67
63
|
if (sticky) {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
64
|
+
return {
|
65
|
+
component: 'Affix',
|
66
|
+
props: {
|
67
|
+
offsetBottom: 0,
|
68
|
+
className: 'teamix-pro-form-button-affix'
|
69
|
+
},
|
70
|
+
children: [commonMode]
|
73
71
|
};
|
74
|
-
}
|
72
|
+
} // 普通模式
|
73
|
+
|
75
74
|
|
76
|
-
return
|
77
|
-
component: component
|
78
|
-
}, decoratorTemp), otherProps);
|
75
|
+
return commonMode;
|
79
76
|
};
|
80
77
|
|
81
78
|
var _default = initialize;
|