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({ export default OakComponent({
isList: false, isList: false,
data: { data: {
slideWidth: 0, //小程序使用 slideWidth: 0,
slideLeft: 0, //小程序使用 slideLeft: 0,
slideShow: false, //小程序使用 slideShow: false,
commonAction: [ commonAction: [
'create', 'create',
'update', 'update',

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,6 @@
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
color: rgba(42, 46, 54, 0.88); color: rgba(42, 46, 54, 0.88);
font-weight: bolder;
padding-left: 10px; 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 { OakAbsAttrDef, onActionFnDef, OakExtraActionProps, ListButtonProps, ED, OakAbsAttrJudgeDef } from '../../types/AbstractComponent';
import { RowWithActions } from '../../types/Page'; import { RowWithActions } from '../../types/Page';
type Props<ED2 extends ED, T extends keyof ED2> = { type Props<ED2 extends ED, T extends keyof ED2> = {
title?: string; title?: string | React.ReactNode;
extraContent?: React.ReactNode;
hideDefaultButtons?: boolean;
buttonGroup?: ListButtonProps[]; buttonGroup?: ListButtonProps[];
onReload?: () => void; onReload?: () => void;
entity: T; entity: T;

View File

@ -15,7 +15,7 @@ export const TableContext = createContext({
onReset: undefined, onReset: undefined,
}); });
const ProList = (props) => { 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 features = useFeatures();
const [tableAttributes, setTableAttributes] = useState([]); const [tableAttributes, setTableAttributes] = useState([]);
const [schema, setSchema] = useState(undefined); const [schema, setSchema] = useState(undefined);
@ -68,7 +68,7 @@ const ProList = (props) => {
}, },
}}> }}>
<div className={Style.container}> <div className={Style.container}>
{!isMobile && (<ToolBar title={title} buttonGroup={buttonGroup} reload={() => { {!isMobile && !hideDefaultButtons && (<ToolBar title={title} extraContent={extraContent} buttonGroup={buttonGroup} reload={() => {
onReload && onReload(); onReload && onReload();
}}/>)} }}/>)}
{isMobile && <ButtonGroup items={buttonGroup}/>} {isMobile && <ButtonGroup items={buttonGroup}/>}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,6 @@
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
color: rgba(42, 46, 54, 0.88); color: rgba(42, 46, 54, 0.88);
font-weight: bolder;
padding-left: 10px; 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 = { type buttonProps = {
label: string; label: string;
type?: ButtonProps['type'] type?: ButtonProps['type'];
onClick: () => void; onClick: () => void;
} }
type ToolBarProps = { type ToolBarProps = {
title?: string; title?: React.ReactNode;
buttonGroup?: buttonProps[]; buttonGroup?: buttonProps[];
extraContent?: React.ReactNode;
reload: () => void; reload: () => void;
} }
function ToolBar(props: ToolBarProps) { function ToolBar(props: ToolBarProps) {
const { title, buttonGroup, reload } = props; const { title, buttonGroup, reload, extraContent } = props;
const features = useFeatures<{ locales: Locales<any, any, any, any> }>(); const features = useFeatures<{ locales: Locales<any, any, any, any> }>();
return ( return (
@ -30,6 +31,7 @@ function ToolBar(props: ToolBarProps) {
<div className={Style.title}>{title}</div> <div className={Style.title}>{title}</div>
<div className={Style.toolbarRight}> <div className={Style.toolbarRight}>
<Space> <Space>
{extraContent}
{buttonGroup && buttonGroup.length > 0 && ( {buttonGroup && buttonGroup.length > 0 && (
<ButtonGroup items={buttonGroup} /> <ButtonGroup items={buttonGroup} />
)} )}

View File

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