1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-07 21:47:02 +09:00

JS-7004: wip

This commit is contained in:
Mike Mhlv 2025-06-06 12:44:28 +01:00
parent 26a6f95540
commit 758e5be07e
2 changed files with 56 additions and 28 deletions

View file

@ -12,6 +12,13 @@
.cellContent:not(.isName) { display: none; }
}
.sides { display: flex; align-items: center; justify-content: space-between; gap: 0px 16px; }
.sides {
.side.right {
.cellContent:first-child::before { display: none; }
}
}
.dropTarget { height: 100%; padding: 0px 0px 10px 0px; }
.cellContent {
@ -108,4 +115,4 @@
.row { padding-left: 0px !important; height: 34px !important; }
}
}
}
}

View file

@ -12,16 +12,29 @@ const Row = observer(class Row extends React.Component<Props> {
_isMounted = false;
node: any = null;
refNames: any[] = [];
render () {
const { rootId, block, recordId, getRecord, getView, onRef, style, onContext, getIdPrefix, isInline, isCollection, onDragRecordStart, onSelectToggle } = this.props;
const view = getView();
const relations = view.getVisibleRelations();
const idPrefix = getIdPrefix();
const subId = S.Record.getSubId(rootId, block.id);
const record = getRecord(recordId);
const cn = [ 'row' ];
const relations = view.getVisibleRelations();
const nameIndex = relations.findIndex(it => it.relationKey == 'name');
const left = [];
const right = [];
relations.forEach((el, idx) => {
if (idx <= nameIndex) {
left.push(el);
} else {
right.push(el);
};
});
// Subscriptions
const { hideIcon } = view;
const { done } = record;
@ -30,33 +43,41 @@ const Row = observer(class Row extends React.Component<Props> {
cn.push('isDone');
};
let content = (
<>
{relations.map((vr: any, i: number) => {
const relation = S.Record.getRelationByKey(vr.relationKey);
const id = Relation.cellId(idPrefix, relation.relationKey, record.id);
const mapper = (vr: any, i: number) => {
const relation = S.Record.getRelationByKey(vr.relationKey);
const id = Relation.cellId(idPrefix, relation.relationKey, record.id);
return (
<Cell
key={'list-cell-' + relation.relationKey}
elementId={id}
ref={ref => onRef(ref, id)}
{...this.props}
getRecord={() => record}
subId={subId}
relationKey={relation.relationKey}
viewType={I.ViewType.List}
idPrefix={idPrefix}
onClick={e => this.onCellClick(e, relation)}
isInline={true}
tooltipParam={{ text: relation.name, typeX: I.MenuDirection.Left, offsetX: 14 }}
arrayLimit={2}
iconSize={relation.relationKey == 'name' ? 24 : 18}
withName={true}
/>
);
})}
</>
return (
<Cell
key={'list-cell-' + relation.relationKey}
elementId={id}
ref={ref => onRef(ref, id)}
{...this.props}
getRecord={() => record}
subId={subId}
relationKey={relation.relationKey}
viewType={I.ViewType.List}
idPrefix={idPrefix}
onClick={e => this.onCellClick(e, relation)}
isInline={true}
tooltipParam={{ text: relation.name, typeX: I.MenuDirection.Left, offsetX: 14 }}
arrayLimit={2}
iconSize={relation.relationKey == 'name' ? 24 : 18}
withName={true}
/>
);
};
let content = (
<div className="sides">
<div className="side left">
{left.map(mapper)}
</div>
<div className="side right">
{right.map(mapper)}
</div>
{/*{relations.map(mapper)}*/}
</div>
);
if (!isInline) {