|
|
@ -13,6 +13,7 @@ import { ProcessingGroupRecord } from '../../../DatabaseServices/ProcessingGroup
|
|
|
|
import { TemplateLatticeRecord } from '../../../DatabaseServices/Template/ProgramTempate/TemplateLatticeRecord';
|
|
|
|
import { TemplateLatticeRecord } from '../../../DatabaseServices/Template/ProgramTempate/TemplateLatticeRecord';
|
|
|
|
import { TemplateWineRackRecord } from '../../../DatabaseServices/Template/ProgramTempate/TemplateWineRackRecord';
|
|
|
|
import { TemplateWineRackRecord } from '../../../DatabaseServices/Template/ProgramTempate/TemplateWineRackRecord';
|
|
|
|
import { TemplateRecord } from '../../../DatabaseServices/Template/TemplateRecord';
|
|
|
|
import { TemplateRecord } from '../../../DatabaseServices/Template/TemplateRecord';
|
|
|
|
|
|
|
|
import { userConfig } from '../../../Editor/UserConfig';
|
|
|
|
import { IHardwareType } from '../../../Production/Product';
|
|
|
|
import { IHardwareType } from '../../../Production/Product';
|
|
|
|
import { bbsEditorStore, TotalTabbarTitlesInfos } from '../../Store/BBSEditorStore';
|
|
|
|
import { bbsEditorStore, TotalTabbarTitlesInfos } from '../../Store/BBSEditorStore';
|
|
|
|
import { LinesType } from '../../Store/BoardInterface';
|
|
|
|
import { LinesType } from '../../Store/BoardInterface';
|
|
|
@ -27,10 +28,34 @@ export interface SortBtnData
|
|
|
|
|
|
|
|
|
|
|
|
export const SelectElementIndex = [6, 22, 23, 27];
|
|
|
|
export const SelectElementIndex = [6, 22, 23, 27];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface ITitleBannerProps
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sortBtnData: SortBtnData[],
|
|
|
|
|
|
|
|
style: any,
|
|
|
|
|
|
|
|
handleOrder: Function,
|
|
|
|
|
|
|
|
AutoWidth: (title: [string, string]) => void,
|
|
|
|
|
|
|
|
TitleResize: (e: React.PointerEvent<HTMLDivElement>, title: string) => void;
|
|
|
|
|
|
|
|
}
|
|
|
|
@observer
|
|
|
|
@observer
|
|
|
|
export class TitleBanner extends React.Component<{ sortBtnData: SortBtnData[], style: any, handleOrder: Function, AutoWidth: (title: [string, string]) => void, TitleResize: (e: React.PointerEvent<HTMLDivElement>, title: string) => void; }, {}>
|
|
|
|
export class TitleBanner extends React.Component<ITitleBannerProps>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
icon: IconName;
|
|
|
|
icon: IconName;
|
|
|
|
|
|
|
|
titleRef = React.createRef<HTMLDivElement>();
|
|
|
|
|
|
|
|
componentDidMount()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (let index of bbsEditorStore.tabbarIndexs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (bbsEditorStore.noResize.some(i => i === index)) continue;
|
|
|
|
|
|
|
|
let title = TotalTabbarTitlesInfos[index][1];
|
|
|
|
|
|
|
|
if (!userConfig.titleWidthMap.has(title))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let titleElement = this.titleRef.current.getElementsByClassName(title);
|
|
|
|
|
|
|
|
let width = (titleElement[0] as HTMLDivElement).offsetWidth;
|
|
|
|
|
|
|
|
userConfig.titleWidthMap.set(title, width);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getBtnData = (data: string) =>
|
|
|
|
getBtnData = (data: string) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let btn = this.props.sortBtnData.find((d) => d.text === data.trim());
|
|
|
|
let btn = this.props.sortBtnData.find((d) => d.text === data.trim());
|
|
|
@ -39,10 +64,24 @@ export class TitleBanner extends React.Component<{ sortBtnData: SortBtnData[], s
|
|
|
|
this.icon = btn.icon;
|
|
|
|
this.icon = btn.icon;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getWidthStyle = (title: string, index: number): React.CSSProperties =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return SelectElementIndex.includes(index) ?
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
minWidth: 73,
|
|
|
|
|
|
|
|
display: "flex"
|
|
|
|
|
|
|
|
} :
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
minWidth: 62,
|
|
|
|
|
|
|
|
display: "flex",
|
|
|
|
|
|
|
|
width: userConfig.titleWidthMap.has(title) ? userConfig.titleWidthMap.get(title) : "auto"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
render()
|
|
|
|
render()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="bbs-list-tr title" style={{ ...this.props.style, width: "fit-content", position: "relative" }}>
|
|
|
|
<div className="bbs-list-tr title" style={{ ...this.props.style, width: "fit-content", position: "relative" }} ref={this.titleRef}>
|
|
|
|
<div className="bbs-list-th bbs-td" style={{ marginRight: 3 }}>序号</div>
|
|
|
|
<div className="bbs-list-th bbs-td" style={{ marginRight: 3 }}>序号</div>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bbsEditorStore.tabbarIndexs.map((index) =>
|
|
|
|
bbsEditorStore.tabbarIndexs.map((index) =>
|
|
|
@ -95,7 +134,7 @@ export class TitleBanner extends React.Component<{ sortBtnData: SortBtnData[], s
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
className={`bbs-list-th bbs-td ${TotalTabbarTitlesInfos[index][1]}`}
|
|
|
|
className={`bbs-list-th bbs-td ${TotalTabbarTitlesInfos[index][1]}`}
|
|
|
|
key={index}
|
|
|
|
key={index}
|
|
|
|
style={{ minWidth: SelectElementIndex.includes(index) ? 73 : 62, display: "flex" }}
|
|
|
|
style={this.getWidthStyle(key, index)}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.getBtnData(TotalTabbarTitlesInfos[index][0]) ?
|
|
|
|
this.getBtnData(TotalTabbarTitlesInfos[index][0]) ?
|
|
|
|