|
|
|
@ -19,6 +19,7 @@ import { bbsEditorStore, TotalTabbarTitlesInfos } from '../../Store/BBSEditorSto
|
|
|
|
|
import { LinesType } from '../../Store/BoardInterface';
|
|
|
|
|
import { ToasterInput } from '../Toaster';
|
|
|
|
|
import { IBoardInfoOptions } from './BoardInfosList';
|
|
|
|
|
import { BBSBoardData } from './LookOverBoardInfos';
|
|
|
|
|
|
|
|
|
|
export interface SortBtnData
|
|
|
|
|
{
|
|
|
|
@ -33,8 +34,8 @@ interface ITitleBannerProps
|
|
|
|
|
sortBtnData: SortBtnData[],
|
|
|
|
|
style: any,
|
|
|
|
|
handleOrder: Function,
|
|
|
|
|
AutoWidth: (title: [string, string]) => void,
|
|
|
|
|
TitleResize: (e: React.PointerEvent<HTMLDivElement>, title: string) => void;
|
|
|
|
|
searchRes: BBSBoardData;
|
|
|
|
|
}
|
|
|
|
|
@observer
|
|
|
|
|
export class TitleBanner extends React.Component<ITitleBannerProps>
|
|
|
|
@ -78,6 +79,38 @@ export class TitleBanner extends React.Component<ITitleBannerProps>
|
|
|
|
|
width: userConfig.titleWidthMap.has(title) ? userConfig.titleWidthMap.get(title) : "auto"
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
AutoWidth = (title: [string, string]) =>
|
|
|
|
|
{
|
|
|
|
|
if (bbsEditorStore.noResize.some(i => TotalTabbarTitlesInfos[i][1] === title[1])) return;
|
|
|
|
|
let currentTitle = document.getElementsByClassName(title[1]);
|
|
|
|
|
let maxLenght: number = 5;
|
|
|
|
|
|
|
|
|
|
this.props.searchRes.dataBr.forEach(br =>
|
|
|
|
|
{
|
|
|
|
|
let content: string | number;
|
|
|
|
|
let contentLenght: number;
|
|
|
|
|
if ([2, 3, 4, 5, 15, 16, 17, 18].includes(TotalTabbarTitlesInfos.indexOf(title)))
|
|
|
|
|
content = br[title[1]];
|
|
|
|
|
else
|
|
|
|
|
content = br.BoardProcessOption[title[1]];
|
|
|
|
|
|
|
|
|
|
const REG_CH = /[\u4E00-\u9FA5]/g;
|
|
|
|
|
let chineseNum = content.toString().match(REG_CH)?.length ?? 0; //判断中文个数
|
|
|
|
|
contentLenght = Math.ceil(chineseNum + (content.toString().length - chineseNum) / 2);
|
|
|
|
|
|
|
|
|
|
if (contentLenght >= maxLenght)
|
|
|
|
|
maxLenght = contentLenght;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < currentTitle.length; i++)
|
|
|
|
|
{
|
|
|
|
|
(currentTitle[i] as HTMLDivElement).style.width = (maxLenght + 2) * 12 + "px";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (userConfig.titleWidthMap.get(title[1]) !== (maxLenght + 2) * 12)
|
|
|
|
|
userConfig.titleWidthMap.set(title[1], (maxLenght + 2) * 12);
|
|
|
|
|
};
|
|
|
|
|
render()
|
|
|
|
|
{
|
|
|
|
|
return (
|
|
|
|
@ -152,7 +185,7 @@ export class TitleBanner extends React.Component<ITitleBannerProps>
|
|
|
|
|
className='title-resize'
|
|
|
|
|
style={{ cursor: bbsEditorStore.noResize.includes(index) ? "auto" : "col-resize" }}
|
|
|
|
|
onPointerDown={(e) => { this.props.TitleResize(e, TotalTabbarTitlesInfos[index][1]); }}
|
|
|
|
|
onDoubleClick={(e) => { this.props.AutoWidth(TotalTabbarTitlesInfos[index]); }}
|
|
|
|
|
onDoubleClick={(e) => { this.AutoWidth(TotalTabbarTitlesInfos[index]); }}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
@ -639,52 +672,49 @@ export class BBSProcessGroupItem extends React.Component<IBBSProcessGroupItemPro
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface IBBSRemarksComponentProps extends IBBSSealingComponentProps
|
|
|
|
|
{
|
|
|
|
|
getCalcStyles: (key: string) => React.CSSProperties;
|
|
|
|
|
}
|
|
|
|
|
@observer
|
|
|
|
|
export class BBSRemarksComponent extends React.Component<IBBSRemarksComponentProps>
|
|
|
|
|
export class BBSRemarksComponent extends React.Component<IBBSSealingComponentProps>
|
|
|
|
|
{
|
|
|
|
|
render()
|
|
|
|
|
{
|
|
|
|
|
const { board, option, index, click } = this.props;
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div
|
|
|
|
|
className="bbs-list-td bbs-td remarks"
|
|
|
|
|
style={{
|
|
|
|
|
padding: "0 1px",
|
|
|
|
|
width: userConfig.titleWidthMap.get("remarks")
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{
|
|
|
|
|
option.remarks.length === 0 ?
|
|
|
|
|
<div className="bbs-list-td bbs-td remarks" style={this.props.getCalcStyles("remarks")}>
|
|
|
|
|
<input
|
|
|
|
|
className="bp3-input "
|
|
|
|
|
value=""
|
|
|
|
|
readOnly={true}
|
|
|
|
|
onClick={() => { click("remarks"); }}
|
|
|
|
|
/> :
|
|
|
|
|
<Tooltip
|
|
|
|
|
usePortal={false}
|
|
|
|
|
content={
|
|
|
|
|
<ul>
|
|
|
|
|
{
|
|
|
|
|
option.remarks.map((d, i) => <li key={i}>{d[0]} : {d[1]}</li>)
|
|
|
|
|
}
|
|
|
|
|
</ul>
|
|
|
|
|
}
|
|
|
|
|
position={Position.RIGHT}
|
|
|
|
|
intent={Intent.PRIMARY}
|
|
|
|
|
>
|
|
|
|
|
<input
|
|
|
|
|
className="bp3-input "
|
|
|
|
|
value=""
|
|
|
|
|
className="bp3-input"
|
|
|
|
|
value={option.remarks.reduce((s, r) => s += `${r[0]}:${r[1]} `, "")}
|
|
|
|
|
readOnly={true}
|
|
|
|
|
onClick={() => { click("remarks"); }}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
:
|
|
|
|
|
<div className="bbs-list-td bbs-td remarks" style={this.props.getCalcStyles("remarks")} >
|
|
|
|
|
<Tooltip
|
|
|
|
|
usePortal={false}
|
|
|
|
|
content={
|
|
|
|
|
<ul>
|
|
|
|
|
{
|
|
|
|
|
option.remarks.map((d, i) => <li key={i}>{d[0]} : {d[1]}</li>)
|
|
|
|
|
}
|
|
|
|
|
</ul>
|
|
|
|
|
}
|
|
|
|
|
position={Position.RIGHT}
|
|
|
|
|
intent={Intent.PRIMARY}
|
|
|
|
|
>
|
|
|
|
|
<input
|
|
|
|
|
className="bp3-input"
|
|
|
|
|
value={option.remarks.reduce((s, r) => s += `${r[0]}:${r[1]} `, "")}
|
|
|
|
|
readOnly={true}
|
|
|
|
|
onClick={() => { click("remarks"); }}
|
|
|
|
|
/>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</div>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
}
|
|
|
|
|
</>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|