@cainiaofe/cn-ui-m
Version:
44 lines (43 loc) • 1.91 kB
JavaScript
import { __assign } from "tslib";
import React, { useMemo, useRef } from 'react';
import { CnCardItems, CnDemoPage } from "../../../..";
export var 外层卡片字段控制 = function () {
var ref = useRef(null);
var operateColumn = useMemo(function () { return ({
buttons: [
{
children: '编辑',
onClick: function (event, record, index) {
var _a;
console.log('编辑', event, record, index);
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.refreshAsync();
},
},
{
children: '详情',
onClick: function (event, record, index) {
var _a;
console.log('详情', event, record, index);
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.currentPageRefreshAsync();
},
},
],
}); }, []);
return (React.createElement(CnDemoPage, { title: "\u5916\u5C42\u5361\u7247\u5B57\u6BB5\u63A7\u5236" },
React.createElement(CnCardItems, { ref: ref, primaryKey: "id", operateColumn: operateColumn, requestConfig: {
url: 'https://oneapi.alibaba-inc.com/mock/cn-ui/table',
formatResult: function (res) {
return {
paging: res.data.paging,
tableColumns: res.data.tableColumns.map(function (column, index) {
if (index < 2) {
return __assign(__assign({}, column), { outerHidden: true });
}
return column;
}),
tableData: res.data.tableData,
};
},
} })));
};
export default { title: 'demo/CnCardItems' };