aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/importBox/ImportElementBox.tsx
blob: a5d21cc8e2db5e05caab5b67f821dd5a49f584f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { observer } from "mobx-react";
import { ViewBoxBaseComponent } from "../../DocComponent";
import { FieldView, FieldViewProps } from "../FieldView";
import { computed } from "mobx";
import { Id } from "../../../../fields/FieldSymbols";
import React from "react";
import { EditableView } from "../../EditableView";
import { DocListCast } from "../../../../fields/Doc";
import { StrCast } from "../../../../fields/Types";


@observer
export class ImportElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
    public static LayoutString(fieldKey: string) {
        return FieldView.LayoutString(ImportElementBox, fieldKey);
    }

    private _itemRef: React.RefObject<HTMLDivElement> = React.createRef();
    private _dragRef: React.RefObject<HTMLDivElement> = React.createRef();
    private _titleRef: React.RefObject<EditableView> = React.createRef();

    @computed importBoxVoew() {
        return this.props.DocumentView?.()?.props.docViewPath().lastElement()?.ComponentView as PresBox;
    }
    
    @computed get indexInPres() {
        return DocListCast(this.presBox?.[StrCast(this.presBox.presFieldKey, 'data')]).indexOf(this.rootDoc);
    }
    
    @computed get presBox() {
        return this.props.DocumentView?.().props.docViewPath().lastElement()?.rootDoc;
    }

    // @computed get selectedArray() {
    //     return this.presBoxView?.selectedArray;
    // }

@computed get mainItem() {
    const isCurrent: boolean = this.presBox?._itemIndex === this.indexInPres;
    //const isSelected: boolean = this.selectedArray?.has(this.rootDoc) ? true : false;
  //  const activeItem: Doc = this.rootDoc;

    return(
        <div
            className = {`presItem-container`}
            // key={this.props.Document[Id] + this.indexInPres}
            style = {{backgroundColor: 'pink'}}
            
        >
            <div
                ref = {this._dragRef}
                className = {`presItem-slide ${isCurrent ? 'active' : ''}`}
                style = {{
                    backgroundColor: 'green'
                }}>
                    <div
                        className="presItem-number"
                        title = "select without navigation"
                    
                    >
                         {/* <EditableView ref={this._titleRef} oneLine={true} editing={!isSelected ? false : undefined} contents={activeItem.title} overflow={'ellipsis'} GetValue={() => StrCast(activeItem.title)} SetValue={this.onSetValue} /> */}

                    </div>
            </div>

        </div>
    )
}

}