feat: fix issue

This commit is contained in:
liufree 2025-03-22 19:35:01 +08:00
parent 319b43ee21
commit 4b247eb914
6 changed files with 14 additions and 16 deletions

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021 Michael Brenan
Copyright (c) 2025 liufree
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,2 +0,0 @@
export const SAMPLE_VIEW_TYPE = 'sample_view';
export const VIEW_TYPE = 'react-view';

View file

@ -1,4 +1,4 @@
import dayjs from "dayjs";
import moment from "moment";
export function formatValue(
value: Record<string, any>
@ -7,7 +7,7 @@ export function formatValue(
if (!value) {
return;
}
console.log("format value", value);
// console.log("format value", value);
if (Array.isArray(value)) {
value.map((v) => (typeof v === "object" ? formatObject(v) : v));
res = {type: "array", display: value};
@ -27,11 +27,11 @@ function formatObject(value: any) {
}
if ("path" in value && "display" in value) {
console.log("link value", value);
// console.log("link value", value);
return {type: "link", path: value.path, display: value.display};
}
if ("ts" in value) {
const display= dayjs(value.ts).format("YYYY-MM-DD HH:mm:ss");
const display= moment(value.ts).format("YYYY-MM-DD HH:mm:ss");
return {type: "datetime", display: display};
}
}

View file

@ -18,9 +18,9 @@ const ListView: React.FC<ViewProps> = ({app, source}) => {
const values: Record<string, any> = {};
headers.forEach((header, index) => {
const value = row[index];
console.log("list value", value);
// console.log("list value", value);
const resValue = formatValue(value);
console.log("list resValue", resValue);
// console.log("list resValue", resValue);
values[header] = resValue;
});
rows.push(values);
@ -29,7 +29,7 @@ const ListView: React.FC<ViewProps> = ({app, source}) => {
delete params.current;
delete params.pageSize;
console.log("list rows", rows);
// console.log("list rows", rows);
const filteredData = rows.filter(item => {
return Object.keys(params).every(key => {
@ -100,7 +100,7 @@ const ListView: React.FC<ViewProps> = ({app, source}) => {
title: {
title: 'title',
render: (_, record: any) => {
console.log("list record", record);
// console.log("list record", record);
return <a>{record.File.path}</a>;
}
},

View file

@ -77,7 +77,7 @@ const TableView: React.FC<ViewProps> = ({app, source}) => {
function parseTableResult(value: any, params: any): Array<Record<string, any>> {
const headers: string[] = value.headers;
console.log("headers", headers);
// console.log("headers", headers);
// console.log("valueData", value);
const rows: Array<Record<string, any>> = [];
@ -131,7 +131,7 @@ const TableView: React.FC<ViewProps> = ({app, source}) => {
}
useEffect(() => {
console.log("source", source);
// console.log("source", source);
}, []);
@ -152,7 +152,7 @@ const TableView: React.FC<ViewProps> = ({app, source}) => {
option: {fixed: 'right', disable: true},
},
onChange(value) {
console.log('value: ', value);
// console.log('value: ', value);
},
}}
rowKey="title"
@ -164,7 +164,7 @@ const TableView: React.FC<ViewProps> = ({app, source}) => {
}}
headerTitle="TablieView"
request={async (params, sort, filter) => {
console.log('params:', params);
// console.log('params:', params);
const response = await executeTableQuery(dv, source, params);
const {tableData, columns} = response;

View file

@ -1,3 +1,3 @@
{
"1.0.0": "0.15.0"
"1.0.0": "1.8.0"
}