aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2023-04-12 20:55:14 -0400
committermehekj <mehek.jethani@gmail.com>2023-04-12 20:55:14 -0400
commitfb9ec75c46bc237bc6c8df24ee998e6de90168a1 (patch)
tree691c2cca5a019fd2153b100deda8a65f0d948d0d /src/client/views/collections/collectionSchema/SchemaTableCell.tsx
parent12e832da09870c1b08020f3feab327b506893175 (diff)
readonly fields and schema key info display
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaTableCell.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/SchemaTableCell.tsx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index 13e45963e..42c9f9d48 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -9,9 +9,11 @@ import { KeyValueBox } from '../../nodes/KeyValueBox';
import { DefaultStyleProvider } from '../../StyleProvider';
import { CollectionSchemaView } from './CollectionSchemaView';
import './CollectionSchemaView.scss';
+import { computed } from 'mobx';
export interface SchemaTableCellProps {
Document: Doc;
+ schemaView: CollectionSchemaView | undefined;
fieldKey: string;
columnWidth: number;
isRowActive: () => boolean | undefined;
@@ -20,6 +22,10 @@ export interface SchemaTableCellProps {
@observer
export class SchemaTableCell extends React.Component<SchemaTableCellProps> {
+ get readOnly() {
+ return this.props.schemaView?.keyInfos[this.props.fieldKey].readOnly;
+ }
+
render() {
const props: FieldViewProps = {
Document: this.props.Document,
@@ -50,7 +56,7 @@ export class SchemaTableCell extends React.Component<SchemaTableCellProps> {
return (
<div className="schema-table-cell" style={{ width: this.props.columnWidth }}>
- <div className="schemacell-edit-wrapper" style={this.props.isRowActive() ? { cursor: 'text', pointerEvents: 'auto' } : { cursor: 'default', pointerEvents: 'none' }}>
+ <div className="schemacell-edit-wrapper" style={this.props.isRowActive() && !this.readOnly ? { cursor: 'text', pointerEvents: 'auto' } : { cursor: 'default', pointerEvents: 'none' }}>
<EditableView
contents={<FieldView {...props} />}
GetValue={() => Field.toKeyValueString(this.props.Document, this.props.fieldKey)}