listpro 支持title extraContent传入组件

This commit is contained in:
梁朝伟 2024-01-24 18:11:34 +08:00
parent 0aac7f3645
commit e7c3c2e522
17 changed files with 35 additions and 26 deletions

View File

@ -1,9 +1,9 @@
export default OakComponent({
isList: false,
data: {
slideWidth: 0, //小程序使用
slideLeft: 0, //小程序使用
slideShow: false, //小程序使用
slideWidth: 0,
slideLeft: 0,
slideShow: false,
commonAction: [
'create',
'update',

View File

@ -63,7 +63,7 @@ export default OakComponent({
let currentUrl = event.currentTarget.dataset.src;
let urlList = event.currentTarget.dataset.list;
wx.previewImage({
current: currentUrl, // 当前显示图片的http链接
current: currentUrl,
urls: urlList, // 需要预览的图片http链接列表
});
},

View File

@ -90,7 +90,7 @@ export default OakComponent({
attribute: {},
options: [],
inputType: '',
timeStartStr: '', // 小程序选择时间显示
timeStartStr: '',
timeEndStr: '',
selectedLabel: '',
minDateMp: new Date(1980, 1, 1).getTime(),

View File

@ -6,8 +6,9 @@ type buttonProps = {
onClick: () => void;
};
type ToolBarProps = {
title?: string;
title?: React.ReactNode;
buttonGroup?: buttonProps[];
extraContent?: React.ReactNode;
reload: () => void;
};
declare function ToolBar(props: ToolBarProps): React.JSX.Element;

View File

@ -6,12 +6,13 @@ import ColumnSetting from '../columnSetting';
import { useFeatures } from '../../../platforms/web';
import Style from './index.module.less';
function ToolBar(props) {
const { title, buttonGroup, reload } = props;
const { title, buttonGroup, reload, extraContent } = props;
const features = useFeatures();
return (<div className={Style.toolbarContainer}>
<div className={Style.title}>{title}</div>
<div className={Style.toolbarRight}>
<Space>
{extraContent}
{buttonGroup && buttonGroup.length > 0 && (<ButtonGroup items={buttonGroup}/>)}
<Tooltip title={features.locales.t('reload')}>
<div className={Style.reloadIconBox} onClick={() => {

View File

@ -19,7 +19,6 @@
align-items: center;
justify-content: flex-start;
color: rgba(42, 46, 54, 0.88);
font-weight: bolder;
padding-left: 10px;
font-size: var(--oak-font-size-title-large);
font-size: var(--oak-font-size-title-small);
}

View File

@ -4,7 +4,9 @@ import { StorageSchema } from 'oak-domain/lib/types/Storage';
import { OakAbsAttrDef, onActionFnDef, OakExtraActionProps, ListButtonProps, ED, OakAbsAttrJudgeDef } from '../../types/AbstractComponent';
import { RowWithActions } from '../../types/Page';
type Props<ED2 extends ED, T extends keyof ED2> = {
title?: string;
title?: string | React.ReactNode;
extraContent?: React.ReactNode;
hideDefaultButtons?: boolean;
buttonGroup?: ListButtonProps[];
onReload?: () => void;
entity: T;

View File

@ -15,7 +15,7 @@ export const TableContext = createContext({
onReset: undefined,
});
const ProList = (props) => {
const { title, buttonGroup, entity, extraActions, onAction, disabledOp, attributes, data, loading, tablePagination, rowSelection, onReload, disableSerialNumber, } = props;
const { buttonGroup, entity, extraActions, onAction, disabledOp, attributes, data, loading, tablePagination, rowSelection, onReload, disableSerialNumber, title, hideDefaultButtons = false, extraContent, } = props;
const features = useFeatures();
const [tableAttributes, setTableAttributes] = useState([]);
const [schema, setSchema] = useState(undefined);
@ -68,7 +68,7 @@ const ProList = (props) => {
},
}}>
<div className={Style.container}>
{!isMobile && (<ToolBar title={title} buttonGroup={buttonGroup} reload={() => {
{!isMobile && !hideDefaultButtons && (<ToolBar title={title} extraContent={extraContent} buttonGroup={buttonGroup} reload={() => {
onReload && onReload();
}}/>)}
{isMobile && <ButtonGroup items={buttonGroup}/>}

View File

@ -9,7 +9,7 @@ export default OakComponent({
multiple: false,
entityId: '',
entityIds: [],
pickerRender: {}, // OakAbsRefAttrPickerRender
pickerRender: {},
onChange: (() => undefined),
},
formData() {

View File

@ -5,7 +5,7 @@ export default OakComponent({
return this.props.entity;
},
properties: {
helps: {}, // Record<string, string>;
helps: {},
entity: '',
attributes: [],
layout: 'horizontal',

View File

@ -322,7 +322,7 @@ export class Cache extends Feature {
opers.forEach((oper) => {
const { entity, operation } = oper;
this.cacheStore.operate(entity, operation, this.context, {
checkerTypes: ['logical'], // 这里不能检查data不然在数据没填完前会有大量异常
checkerTypes: ['logical'],
dontCollect: true,
dontCreateOper: true,
dontCreateModi: true,

View File

@ -1,7 +1,7 @@
import React from 'react';
export const keys = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
export const values = {
xs: 576, //小于576
xs: 576,
sm: 576,
md: 768,
lg: 992,

View File

@ -325,7 +325,7 @@ class Cache extends Feature_1.Feature {
opers.forEach((oper) => {
const { entity, operation } = oper;
this.cacheStore.operate(entity, operation, this.context, {
checkerTypes: ['logical'], // 这里不能检查data不然在数据没填完前会有大量异常
checkerTypes: ['logical'],
dontCollect: true,
dontCreateOper: true,
dontCreateModi: true,

View File

@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
exports.keys = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
exports.values = {
xs: 576, //小于576
xs: 576,
sm: 576,
md: 768,
lg: 992,

View File

@ -19,7 +19,6 @@
align-items: center;
justify-content: flex-start;
color: rgba(42, 46, 54, 0.88);
font-weight: bolder;
padding-left: 10px;
font-size: var(--oak-font-size-title-large);
font-size: var(--oak-font-size-title-small);
}

View File

@ -11,18 +11,19 @@ import Style from './index.module.less';
type buttonProps = {
label: string;
type?: ButtonProps['type']
type?: ButtonProps['type'];
onClick: () => void;
}
type ToolBarProps = {
title?: string;
title?: React.ReactNode;
buttonGroup?: buttonProps[];
extraContent?: React.ReactNode;
reload: () => void;
}
function ToolBar(props: ToolBarProps) {
const { title, buttonGroup, reload } = props;
const { title, buttonGroup, reload, extraContent } = props;
const features = useFeatures<{ locales: Locales<any, any, any, any> }>();
return (
@ -30,6 +31,7 @@ function ToolBar(props: ToolBarProps) {
<div className={Style.title}>{title}</div>
<div className={Style.toolbarRight}>
<Space>
{extraContent}
{buttonGroup && buttonGroup.length > 0 && (
<ButtonGroup items={buttonGroup} />
)}

View File

@ -20,7 +20,9 @@ import { useFeatures } from '../../platforms/web';
import { Locales } from '../../features/locales';
type Props<ED2 extends ED, T extends keyof ED2> = {
title?: string;
title?: string | React.ReactNode,
extraContent?: React.ReactNode,
hideDefaultButtons?: boolean;
buttonGroup?: ListButtonProps[];
onReload?: () => void;
entity: T;
@ -70,7 +72,6 @@ export const TableContext = createContext<{
const ProList = <ED2 extends ED, T extends keyof ED2>(props: Props<ED2, T>) => {
const {
title,
buttonGroup,
entity,
extraActions,
@ -83,6 +84,9 @@ const ProList = <ED2 extends ED, T extends keyof ED2>(props: Props<ED2, T>) => {
rowSelection,
onReload,
disableSerialNumber,
title,
hideDefaultButtons = false,
extraContent,
} = props;
const features = useFeatures<{
locales: Locales<any, any, any, any>;
@ -153,9 +157,10 @@ const ProList = <ED2 extends ED, T extends keyof ED2>(props: Props<ED2, T>) => {
}}
>
<div className={Style.container}>
{!isMobile && (
{!isMobile && !hideDefaultButtons && (
<ToolBar
title={title}
extraContent={extraContent}
buttonGroup={buttonGroup}
reload={() => {
onReload && onReload();