@cloudbase/weda-ui 3.7.11 → 3.7.12
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/web/components/listView/index.js +2 -2
- package/dist/web/components/wd-cascader/cascader.js +2 -0
- package/dist/web/components/wd-table/utils/index.d.ts +1 -0
- package/dist/web/components/wd-table/utils/index.js +5 -0
- package/dist/web/components/wd-table/wd-table.js +4 -2
- package/package.json +1 -1
|
@@ -58,8 +58,8 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
58
58
|
const [_status, setStatus] = useState(''); // 查询状态
|
|
59
59
|
const status = useMemo(() => {
|
|
60
60
|
let s = _status;
|
|
61
|
-
if (dataSourceType === 'expression') {
|
|
62
|
-
s =
|
|
61
|
+
if (dataSourceType === 'expression' && loading) {
|
|
62
|
+
s = 'loading';
|
|
63
63
|
}
|
|
64
64
|
return s;
|
|
65
65
|
}, [dataSourceType, loading, _status]); // 表达式强制使用 loading 展示加载
|
|
@@ -91,8 +91,10 @@ export const WdCascader = forwardRef(function WdCascader(props, ref) {
|
|
|
91
91
|
debouncedTriggerSearchEvent(v);
|
|
92
92
|
}, [debouncedTriggerSearchEvent]);
|
|
93
93
|
const handleChange = (v, { options }) => {
|
|
94
|
+
var _a;
|
|
94
95
|
setSelectedOptions(options);
|
|
95
96
|
onChange === null || onChange === void 0 ? void 0 : onChange(v);
|
|
97
|
+
(_a = delayEvents === null || delayEvents === void 0 ? void 0 : delayEvents.change) === null || _a === void 0 ? void 0 : _a.call(delayEvents, { value: v });
|
|
96
98
|
};
|
|
97
99
|
if (!visible)
|
|
98
100
|
return null;
|
|
@@ -46,3 +46,4 @@ export declare const getRecordKey: ({ dataSourceType, dataSourceData, key }: {
|
|
|
46
46
|
export declare const getWhereParam: (relatedKey: any, rowId: any) => {
|
|
47
47
|
relateWhere: {};
|
|
48
48
|
};
|
|
49
|
+
export declare const getCurrentPageData: (data: any[], pageNo: any, pageSize: any) => any[];
|
|
@@ -602,3 +602,8 @@ export const getWhereParam = (relatedKey, rowId) => {
|
|
|
602
602
|
};
|
|
603
603
|
return whereList;
|
|
604
604
|
};
|
|
605
|
+
export const getCurrentPageData = (data = [], pageNo, pageSize) => {
|
|
606
|
+
const records = [].concat(data);
|
|
607
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
608
|
+
return records.slice((pageNo - 1) * pageSize, pageNo * pageSize) || []; // 当前页的数据
|
|
609
|
+
};
|
|
@@ -17,7 +17,7 @@ import { useTableData } from './hooks/useTableData';
|
|
|
17
17
|
import { useViewFields } from './hooks/useViewFields';
|
|
18
18
|
import { useQueryParams } from './hooks/useQueryParams';
|
|
19
19
|
import { WdCompError } from '../../utils/error';
|
|
20
|
-
import { getSlots, getFilterFields, getSelectedView, getSortColumns, mapTableDataWithView, checkSupport, DataSourceType, getRecordKey, } from './utils';
|
|
20
|
+
import { getSlots, getFilterFields, getSelectedView, getSortColumns, mapTableDataWithView, checkSupport, DataSourceType, getRecordKey, getCurrentPageData, } from './utils';
|
|
21
21
|
import { Mock } from './mock';
|
|
22
22
|
import { getTableColumns, slotRender, mapColumKey, } from './components/FieldRender';
|
|
23
23
|
import Modal from '../modal';
|
|
@@ -548,7 +548,9 @@ export const WdTable = forwardRef(function TableComp(tableProps, ref) {
|
|
|
548
548
|
}
|
|
549
549
|
},
|
|
550
550
|
// 当前页数据
|
|
551
|
-
records:
|
|
551
|
+
records: isExpression
|
|
552
|
+
? getCurrentPageData(dataRef.current.tableRecords, query.pageNo, query.pageSize)
|
|
553
|
+
: dataRef.current.tableRecords,
|
|
552
554
|
// 当前总数
|
|
553
555
|
total: total,
|
|
554
556
|
pageNo: query.pageNo,
|