listpro 支持title extraContent传入组件
This commit is contained in:
parent
0aac7f3645
commit
e7c3c2e522
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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链接列表
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export default OakComponent({
|
|||
attribute: {},
|
||||
options: [],
|
||||
inputType: '',
|
||||
timeStartStr: '', // 小程序选择时间显示
|
||||
timeStartStr: '',
|
||||
timeEndStr: '',
|
||||
selectedLabel: '',
|
||||
minDateMp: new Date(1980, 1, 1).getTime(),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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={() => {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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}/>}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default OakComponent({
|
|||
multiple: false,
|
||||
entityId: '',
|
||||
entityIds: [],
|
||||
pickerRender: {}, // OakAbsRefAttrPickerRender
|
||||
pickerRender: {},
|
||||
onChange: (() => undefined),
|
||||
},
|
||||
formData() {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export default OakComponent({
|
|||
return this.props.entity;
|
||||
},
|
||||
properties: {
|
||||
helps: {}, // Record<string, string>;
|
||||
helps: {},
|
||||
entity: '',
|
||||
attributes: [],
|
||||
layout: 'horizontal',
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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} />
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue