aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/importBox/ImportElementBox.tsx
blob: 9dc0c5180615de6e3704d4a5bab3629ab877f898 (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
import { computed } from 'mobx';
import { observer } from 'mobx-react';
import { Doc } from '../../../../fields/Doc';
import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnTrue } from '../../../../Utils';
import { Transform } from '../../../util/Transform';
import { ViewBoxBaseComponent } from '../../DocComponent';
import { DefaultStyleProvider } from '../../StyleProvider';
import { DocumentView, DocumentViewInternal } from '../DocumentView';
import { FieldView, FieldViewProps } from '../FieldView';
import * as React from 'react';

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

    screenToLocalXf = () => this.props.ScreenToLocalTransform().scale(1 * (this.props.NativeDimScaling?.() || 1));
    @computed get mainItem() {
        return (
            <div style={{ backgroundColor: 'pink' }}>
                <DocumentView
                    {...this.props} //
                    LayoutTemplateString={undefined}
                    Document={this.Document}
                    isContentActive={returnFalse}
                    addDocument={returnFalse}
                    ScreenToLocalTransform={this.screenToLocalXf}
                    hideResizeHandles={true}
                />
            </div>
        );
    }
    render() {
        return !(this.Document instanceof Doc) ? null : this.mainItem;
    }
}