@cloudbase/weda-ui 3.7.11 → 3.7.13
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-form-obj/base-form-obj.js +7 -3
- 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;
|
|
@@ -138,9 +138,13 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
|
|
|
138
138
|
return value;
|
|
139
139
|
};
|
|
140
140
|
const dealObjChange = (params, objValue) => {
|
|
141
|
-
var _a;
|
|
141
|
+
var _a, _b;
|
|
142
|
+
// 如果设置的是空对象,则认为是覆盖更新
|
|
143
|
+
if (!((_a = Object.keys(params.value)) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
144
|
+
return params.value;
|
|
145
|
+
}
|
|
142
146
|
let value;
|
|
143
|
-
if ((
|
|
147
|
+
if ((_b = Object.keys(objValue || {})) === null || _b === void 0 ? void 0 : _b.length) {
|
|
144
148
|
value = deepClone({ ...objValue, ...params.value });
|
|
145
149
|
}
|
|
146
150
|
return value;
|
|
@@ -204,7 +208,7 @@ export const BaseFormObj = forwardRef(function BaseFormObj(props, ref) {
|
|
|
204
208
|
]);
|
|
205
209
|
const changeDebounce = useDebouncedCallback(useCallback((value, option) => {
|
|
206
210
|
change(value, option);
|
|
207
|
-
}, [change]),
|
|
211
|
+
}, [change]), 300);
|
|
208
212
|
/**
|
|
209
213
|
* 子组件默认值变更,触发嵌套表单值更新
|
|
210
214
|
*/
|
|
@@ -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(deepClone(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 && !enableTotal
|
|
552
|
+
? getCurrentPageData(dataRef.current.tableRecords, query.pageNo, query.pageSize)
|
|
553
|
+
: dataRef.current.tableRecords,
|
|
552
554
|
// 当前总数
|
|
553
555
|
total: total,
|
|
554
556
|
pageNo: query.pageNo,
|