@teamix/pro 1.4.14 → 1.4.17
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 +440 -114
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/card/index.js +49 -6
- package/es/card/index.scss +8 -0
- package/es/form/ProForm/index.js +14 -32
- package/es/form/ProForm/index.scss +9 -2
- package/es/form/ProForm/useAutoLayout.d.ts +9 -0
- package/es/form/ProForm/useAutoLayout.js +114 -0
- package/es/form/SchemaForm/initializeArrayTable.js +42 -7
- package/es/form/typing.d.ts +4 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/baseInfo/index.js +9 -3
- package/es/info/components/headerInfo/index.js +11 -3
- package/es/info/components/tableInfo/index.js +6 -3
- package/es/info/typing.d.ts +2 -0
- package/es/info/utils/index.d.ts +8 -0
- package/es/info/utils/index.js +28 -1
- package/es/nocode/index.scss +2 -2
- package/es/nocode/pages/playground.js +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/nocode/playground.js +1 -1
- package/es/sidebar/components/tree-node/index.js +15 -6
- package/es/sidebar/components/tree-node/index.scss +9 -5
- package/es/sidebar/index.js +2 -2
- package/es/sidebar/index.scss +13 -1
- package/es/sidebar/typing.d.ts +4 -2
- package/es/sidebar/utils/index.d.ts +278 -0
- package/es/sidebar/utils/index.js +55 -14
- package/es/table/components/Layout/index.js +12 -6
- package/es/table/components/QuickAction/index.js +1 -1
- package/es/table/index.js +36 -11
- package/es/table/index.scss +8 -0
- package/lib/card/index.js +58 -6
- package/lib/card/index.scss +8 -0
- package/lib/form/ProForm/index.js +13 -31
- package/lib/form/ProForm/index.scss +9 -2
- package/lib/form/ProForm/useAutoLayout.d.ts +9 -0
- package/lib/form/ProForm/useAutoLayout.js +124 -0
- package/lib/form/SchemaForm/initializeArrayTable.js +42 -7
- package/lib/form/typing.d.ts +4 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/baseInfo/index.js +8 -2
- package/lib/info/components/headerInfo/index.js +10 -2
- package/lib/info/components/tableInfo/index.js +5 -2
- package/lib/info/typing.d.ts +2 -0
- package/lib/info/utils/index.d.ts +8 -0
- package/lib/info/utils/index.js +29 -0
- package/lib/nocode/index.scss +2 -2
- package/lib/nocode/pages/playground.js +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/nocode/playground.js +1 -1
- package/lib/sidebar/components/tree-node/index.js +16 -6
- package/lib/sidebar/components/tree-node/index.scss +9 -5
- package/lib/sidebar/index.js +2 -2
- package/lib/sidebar/index.scss +13 -1
- package/lib/sidebar/typing.d.ts +4 -2
- package/lib/sidebar/utils/index.d.ts +278 -0
- package/lib/sidebar/utils/index.js +56 -14
- package/lib/table/components/Layout/index.js +12 -6
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/index.js +35 -10
- package/lib/table/index.scss +8 -0
- package/package.json +1 -1
@@ -10,7 +10,21 @@ exports.getAllNodeKey = getAllNodeKey;
|
|
10
10
|
exports.getTreeLevel = getTreeLevel;
|
11
11
|
exports.getTreeLevelKey = getTreeLevelKey;
|
12
12
|
exports.getTreeNodeLevel = getTreeNodeLevel;
|
13
|
+
exports.getTreeNodeProps = getTreeNodeProps;
|
13
14
|
exports.loop = loop;
|
15
|
+
var _excluded = ["selectable", "checkable", "editable", "draggable", "disabled", "checkboxDisabled", "isLeaf", "treeNodeProps"];
|
16
|
+
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
18
|
+
|
19
|
+
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."); }
|
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
|
+
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; }
|
26
|
+
|
27
|
+
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; }
|
14
28
|
|
15
29
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
16
30
|
|
@@ -28,19 +42,12 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
28
42
|
|
29
43
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
30
44
|
|
31
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(
|
45
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
32
46
|
|
33
47
|
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); }
|
34
48
|
|
35
49
|
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; }
|
36
50
|
|
37
|
-
/**
|
38
|
-
* 深度遍历节点
|
39
|
-
* @param data 数据
|
40
|
-
* @param func 处理方法
|
41
|
-
* @param aliasMap 标识
|
42
|
-
* @param level 深度
|
43
|
-
*/
|
44
51
|
function loop(data, func, aliasMap) {
|
45
52
|
var level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
46
53
|
|
@@ -207,19 +214,15 @@ function getTreeLevel(data, aliasMap) {
|
|
207
214
|
_ref6$children = _ref6.children,
|
208
215
|
children = _ref6$children === void 0 ? 'children' : _ref6$children;
|
209
216
|
|
210
|
-
var result =
|
217
|
+
var result = 0;
|
211
218
|
loop(data, function (item, level) {
|
212
219
|
if (result < level) {
|
213
220
|
result = level;
|
214
221
|
}
|
215
|
-
|
216
|
-
if ('children' in item) {
|
217
|
-
result += 1;
|
218
|
-
}
|
219
222
|
}, {
|
220
223
|
children: children
|
221
224
|
});
|
222
|
-
return result;
|
225
|
+
return result + 1;
|
223
226
|
}
|
224
227
|
/**
|
225
228
|
* 获取树层级对应的所有 key
|
@@ -304,4 +307,43 @@ function filterTreeData(nodes, predicate, aliasMap) {
|
|
304
307
|
return {
|
305
308
|
filterTreeValue: filterTreeValue
|
306
309
|
};
|
310
|
+
}
|
311
|
+
/**
|
312
|
+
* 获取TreeNodeProps
|
313
|
+
* @param item
|
314
|
+
*/
|
315
|
+
|
316
|
+
|
317
|
+
function getTreeNodeProps(item) {
|
318
|
+
var selectable = item.selectable,
|
319
|
+
checkable = item.checkable,
|
320
|
+
editable = item.editable,
|
321
|
+
draggable = item.draggable,
|
322
|
+
disabled = item.disabled,
|
323
|
+
checkboxDisabled = item.checkboxDisabled,
|
324
|
+
isLeaf = item.isLeaf,
|
325
|
+
_item$treeNodeProps = item.treeNodeProps,
|
326
|
+
treeNodeProps = _item$treeNodeProps === void 0 ? {} : _item$treeNodeProps,
|
327
|
+
others = _objectWithoutProperties(item, _excluded);
|
328
|
+
|
329
|
+
var nodeProps = _objectSpread({
|
330
|
+
selectable: selectable,
|
331
|
+
checkable: checkable,
|
332
|
+
editable: editable,
|
333
|
+
draggable: draggable,
|
334
|
+
disabled: disabled,
|
335
|
+
checkboxDisabled: checkboxDisabled,
|
336
|
+
isLeaf: isLeaf
|
337
|
+
}, treeNodeProps);
|
338
|
+
|
339
|
+
return {
|
340
|
+
nodeProps: Object.fromEntries(Object.entries(nodeProps).filter(function (_ref9) {
|
341
|
+
var _ref10 = _slicedToArray(_ref9, 2),
|
342
|
+
_ = _ref10[0],
|
343
|
+
v = _ref10[1];
|
344
|
+
|
345
|
+
return v !== undefined;
|
346
|
+
})),
|
347
|
+
labelProps: others
|
348
|
+
};
|
307
349
|
}
|
@@ -143,14 +143,20 @@ var Layout = function Layout(props) {
|
|
143
143
|
}
|
144
144
|
} else if (mainAction) {
|
145
145
|
// 没传 dataFilter 但是传了 mainAction
|
146
|
-
return /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, {
|
146
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, {
|
147
147
|
addonBefore: renderMainAction(),
|
148
|
-
addonAfter: renderAddonAfter()
|
149
|
-
|
148
|
+
addonAfter: renderAddonAfter(),
|
149
|
+
children: afterDataFilter ? /*#__PURE__*/_react.default.createElement("div", {
|
150
|
+
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
151
|
+
}, afterDataFilter) : null
|
152
|
+
}));
|
150
153
|
} else {
|
151
|
-
return /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, {
|
152
|
-
addonAfter: renderAddonAfter()
|
153
|
-
|
154
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_form.QueryFilterLayout, {
|
155
|
+
addonAfter: renderAddonAfter(),
|
156
|
+
children: afterDataFilter ? /*#__PURE__*/_react.default.createElement("div", {
|
157
|
+
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
158
|
+
}, afterDataFilter) : null
|
159
|
+
}));
|
154
160
|
}
|
155
161
|
}; // 区域组合渲染
|
156
162
|
|
@@ -26,7 +26,7 @@ var QuickAction = function QuickAction(props) {
|
|
26
26
|
actionRef = props.actionRef,
|
27
27
|
rowSelection = props.rowSelection; // 如果传对象的话,默认为主要文字类型的 ProActionButton
|
28
28
|
|
29
|
-
if (_typeof(quickAction) === 'object') {
|
29
|
+
if (_typeof(quickAction) === 'object' && (quickAction === null || quickAction === void 0 ? void 0 : quickAction.config)) {
|
30
30
|
// 默认 context
|
31
31
|
var defaultContext = {
|
32
32
|
action: actionRef.current,
|
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", "afterDataFilter", "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", "context", "fixedTableBody"];
|
58
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "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", "context", "fixedTableBody", "isTree"];
|
59
59
|
|
60
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
61
61
|
|
@@ -219,6 +219,7 @@ var ProTable = function ProTable(props) {
|
|
219
219
|
context = props.context,
|
220
220
|
_props$fixedTableBody = props.fixedTableBody,
|
221
221
|
fixedTableBody = _props$fixedTableBody === void 0 ? false : _props$fixedTableBody,
|
222
|
+
isTree = props.isTree,
|
222
223
|
otherProps = _objectWithoutProperties(props, _excluded);
|
223
224
|
|
224
225
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -360,7 +361,11 @@ var ProTable = function ProTable(props) {
|
|
360
361
|
}, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
361
362
|
|
362
363
|
var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
|
363
|
-
var _tableDom$getElements, _tableDom$getElements2;
|
364
|
+
var _tableDom$getElements, _tableDom$getElements2, _document$querySelect, _document$querySelect2, _document$querySelect3;
|
365
|
+
|
366
|
+
if (!fixedTableBody) {
|
367
|
+
return;
|
368
|
+
}
|
364
369
|
|
365
370
|
var tableDom = tableRef.current;
|
366
371
|
var headerDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements = tableDom.getElementsByClassName('teamix-pro-table-layout')) === null || _tableDom$getElements === void 0 ? void 0 : _tableDom$getElements[0];
|
@@ -370,8 +375,9 @@ var ProTable = function ProTable(props) {
|
|
370
375
|
var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName(basePrefix('table-header-inner'))) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
|
371
376
|
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
372
377
|
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
373
|
-
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
374
|
-
|
378
|
+
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer'); // 这边不能直接取 next-table-body
|
379
|
+
|
380
|
+
var tableBodyDom = (_document$querySelect = document.querySelector('.teamix-pro-table')) === null || _document$querySelect === void 0 ? void 0 : (_document$querySelect2 = _document$querySelect.getElementsByTagName('table')) === null || _document$querySelect2 === void 0 ? void 0 : (_document$querySelect3 = _document$querySelect2[1]) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.parentNode;
|
375
381
|
var headerFixedTopSectionDom = document.querySelector('.teamix-pro-page-container-fixed-top');
|
376
382
|
setTimeout(function () {
|
377
383
|
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
@@ -389,9 +395,8 @@ var ProTable = function ProTable(props) {
|
|
389
395
|
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0; // 1 为预留值,js无法取出精确高度,会被四舍五入
|
390
396
|
|
391
397
|
var offsetHeaderHeight = headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0) + 1;
|
392
|
-
var clientTableBodyHeight = document.body.clientHeight - offsetHeaderHeight;
|
393
398
|
|
394
|
-
if (tableBodyDom.clientHeight <
|
399
|
+
if (tableBodyDom.clientHeight < tableBodyDom.scrollHeight) {
|
395
400
|
setFooterSuctionState(true);
|
396
401
|
} else {
|
397
402
|
setFooterSuctionState(false);
|
@@ -449,6 +454,10 @@ var ProTable = function ProTable(props) {
|
|
449
454
|
|
450
455
|
|
451
456
|
var getFooterSuctionState = function getFooterSuctionState() {
|
457
|
+
if (!footerSuction) {
|
458
|
+
return;
|
459
|
+
}
|
460
|
+
|
452
461
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
453
462
|
|
454
463
|
if (containerDom) {
|
@@ -847,7 +856,7 @@ var ProTable = function ProTable(props) {
|
|
847
856
|
if (Number.isInteger(time) && time >= 1000) {
|
848
857
|
autoRefreshTimerRef.current = setTimeout(function () {
|
849
858
|
// 自动刷新不显示 loading
|
850
|
-
_request(
|
859
|
+
_request(requestData, true);
|
851
860
|
}, Number(time));
|
852
861
|
}
|
853
862
|
});
|
@@ -944,8 +953,10 @@ var ProTable = function ProTable(props) {
|
|
944
953
|
columns: (0, _genProColumnToColumn.default)(filteredColumns, showSkeleton, actionRef, context),
|
945
954
|
loading: getTableLoading(),
|
946
955
|
className: (0, _classnames.default)('teamix-pro-table', tableClassName, {
|
947
|
-
'with-row-select': rowSelection
|
956
|
+
'with-row-select': rowSelection,
|
957
|
+
'teamix-pro-tree-table': isTree
|
948
958
|
}),
|
959
|
+
isTree: isTree,
|
949
960
|
size: size,
|
950
961
|
onSort: onSort,
|
951
962
|
sort: sort,
|
@@ -1083,8 +1094,22 @@ var ProTable = function ProTable(props) {
|
|
1083
1094
|
className: cls('footer-right-wrapper')
|
1084
1095
|
}, showSkeleton ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Footer.Pagination, null) : footer));
|
1085
1096
|
}
|
1086
|
-
};
|
1097
|
+
}; // 判断是否需要吸底
|
1087
1098
|
|
1099
|
+
|
1100
|
+
var fixFooterState = (0, _react.useMemo)(function () {
|
1101
|
+
if (fullscreenState) {
|
1102
|
+
return false;
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
if (fixedTableBody || footerSuction) {
|
1106
|
+
if (footerSuctionState) {
|
1107
|
+
return true;
|
1108
|
+
}
|
1109
|
+
}
|
1110
|
+
|
1111
|
+
return false;
|
1112
|
+
}, [fullscreenState, fixedTableBody, footerSuction, footerSuctionState]);
|
1088
1113
|
return /*#__PURE__*/_react.default.createElement(_Fullscreen.default, {
|
1089
1114
|
visible: fullscreenState,
|
1090
1115
|
actionRef: actionRef
|
@@ -1096,7 +1121,7 @@ var ProTable = function ProTable(props) {
|
|
1096
1121
|
|
1097
1122
|
}),
|
1098
1123
|
ref: tableRef
|
1099
|
-
}, renderTable(isFullScreen),
|
1124
|
+
}, renderTable(isFullScreen), fixFooterState && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !fixFooterState && renderFooter());
|
1100
1125
|
});
|
1101
1126
|
};
|
1102
1127
|
|
package/lib/table/index.scss
CHANGED