mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
Store refactoring, recordStore
This commit is contained in:
parent
836e11b343
commit
39f530cd47
84 changed files with 473 additions and 471 deletions
|
@ -3,7 +3,7 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Button, Block, Loader, Icon, Select, IconObject, EmptySearch } from 'Component';
|
||||
import { I, C, M, S, translate, UtilObject, UtilData, UtilSpace } from 'Lib';
|
||||
import { blockStore, extensionStore, menuStore, recordStore } from 'Store';
|
||||
import { blockStore, extensionStore, menuStore } from 'Store';
|
||||
|
||||
interface State {
|
||||
isLoading: boolean;
|
||||
|
@ -155,7 +155,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
onSelect () {
|
||||
const { object } = this.state;
|
||||
const node = $(this.node);
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const filters: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.In, value: UtilObject.getPageLayouts() },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.NotEqual, value: templateType?.id },
|
||||
|
|
|
@ -5,7 +5,7 @@ import arrayMove from 'array-move';
|
|||
import { getRange, setRange } from 'selection-ranges';
|
||||
import { Label, Input, Button, Select, Loader, Error, DragBox, Tag, Icon } from 'Component';
|
||||
import { I, C, S, UtilCommon, UtilData, Relation, keyboard, UtilObject, UtilRouter, Storage, UtilSpace } from 'Lib';
|
||||
import { recordStore, detailStore, menuStore, extensionStore } from 'Store';
|
||||
import { detailStore, menuStore, extensionStore } from 'Store';
|
||||
import Util from '../lib/util';
|
||||
|
||||
interface State {
|
||||
|
@ -237,7 +237,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
};
|
||||
|
||||
getObjects (subId: string) {
|
||||
return recordStore.getRecords(subId);
|
||||
return S.Record.getRecords(subId);
|
||||
};
|
||||
|
||||
getSpaces () {
|
||||
|
@ -272,7 +272,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
};
|
||||
|
||||
getTagsValue () {
|
||||
return recordStore.getRecordIds(Constant.subId.option, '').
|
||||
return S.Record.getRecordIds(Constant.subId.option, '').
|
||||
filter(id => this.details.tag.includes(id)).
|
||||
map(id => detailStore.get(Constant.subId.option, id)).
|
||||
filter(it => it && !it._empty_);
|
||||
|
@ -351,7 +351,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
};
|
||||
|
||||
onFocus () {
|
||||
const relation = recordStore.getRelationByKey('tag');
|
||||
const relation = S.Record.getRelationByKey('tag');
|
||||
const element = '#select-tag';
|
||||
|
||||
menuStore.open('dataviewOptionList', {
|
||||
|
@ -396,7 +396,7 @@ const Create = observer(class Create extends React.Component<I.PageComponent, St
|
|||
};
|
||||
|
||||
setValue (value: string[]) {
|
||||
const relation = recordStore.getRelationByKey('tag');
|
||||
const relation = S.Record.getRelationByKey('tag');
|
||||
|
||||
value = UtilCommon.arrayUnique(value);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import arrayMove from 'array-move';
|
|||
import { observer } from 'mobx-react';
|
||||
import { set } from 'mobx';
|
||||
import { I, C, S, UtilCommon, UtilData, UtilObject, analytics, Dataview, keyboard, Onboarding, Relation, Renderer, focus, translate, Action, UtilDate, Storage } from 'Lib';
|
||||
import { blockStore, menuStore, recordStore, detailStore } from 'Store';
|
||||
import { blockStore, menuStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -96,7 +96,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
render () {
|
||||
const { rootId, block, isPopup, isInline, readonly } = this.props;
|
||||
const { loading } = this.state;
|
||||
const views = recordStore.getViews(rootId, block.id);
|
||||
const views = S.Record.getViews(rootId, block.id);
|
||||
|
||||
if (!views.length) {
|
||||
return null;
|
||||
|
@ -250,7 +250,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
const subId = this.getSubId();
|
||||
|
||||
if (match.params.viewId || viewId) {
|
||||
recordStore.metaSet(subId, '', { viewId: match.params.viewId || viewId });
|
||||
S.Record.metaSet(subId, '', { viewId: match.params.viewId || viewId });
|
||||
};
|
||||
|
||||
this.reloadData();
|
||||
|
@ -269,7 +269,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
};
|
||||
|
||||
componentDidUpdate () {
|
||||
const { viewId } = recordStore.getMeta(this.getSubId(), '');
|
||||
const { viewId } = S.Record.getMeta(this.getSubId(), '');
|
||||
|
||||
if (viewId && (viewId != this.viewId)) {
|
||||
this.loadData(viewId, 0, true);
|
||||
|
@ -364,10 +364,10 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
};
|
||||
|
||||
if (clear) {
|
||||
recordStore.recordsSet(subId, '', []);
|
||||
S.Record.recordsSet(subId, '', []);
|
||||
};
|
||||
|
||||
recordStore.metaSet(subId, '', { offset, viewId });
|
||||
S.Record.metaSet(subId, '', { offset, viewId });
|
||||
|
||||
if (view.type == I.ViewType.Board) {
|
||||
if (this.refView && this.refView.loadGroupList) {
|
||||
|
@ -420,7 +420,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
const view = this.getView();
|
||||
|
||||
if (view) {
|
||||
recordStore.metaSet(this.getSubId(), '', { viewId: view.id, offset: 0, total: 0 });
|
||||
S.Record.metaSet(this.getSubId(), '', { viewId: view.id, offset: 0, total: 0 });
|
||||
this.loadData(view.id, 0, true);
|
||||
};
|
||||
};
|
||||
|
@ -473,12 +473,12 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
getSubId (groupId?: string): string {
|
||||
const { rootId, block } = this.props;
|
||||
|
||||
return groupId ? recordStore.getGroupSubId(rootId, block.id, groupId) : recordStore.getSubId(rootId, block.id);
|
||||
return groupId ? S.Record.getGroupSubId(rootId, block.id, groupId) : S.Record.getSubId(rootId, block.id);
|
||||
};
|
||||
|
||||
getRecords (groupId?: string): string[] {
|
||||
const subId = this.getSubId(groupId);
|
||||
const records = recordStore.getRecordIds(subId, '');
|
||||
const records = S.Record.getRecordIds(subId, '');
|
||||
|
||||
return this.applyObjectOrder('', UtilCommon.objectCopy(records));
|
||||
};
|
||||
|
@ -576,7 +576,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
|
||||
getDefaultTemplateId (typeId?: string): string {
|
||||
const view = this.getView();
|
||||
const type = recordStore.getTypeById(typeId || this.getTypeId());
|
||||
const type = S.Record.getTypeById(typeId || this.getTypeId());
|
||||
|
||||
if (view && view.defaultTemplateId) {
|
||||
return view.defaultTemplateId;
|
||||
|
@ -621,7 +621,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
templateId = this.getDefaultTemplateId(typeId);
|
||||
};
|
||||
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
if (!type) {
|
||||
return;
|
||||
};
|
||||
|
@ -658,9 +658,9 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
};
|
||||
|
||||
if (groupId) {
|
||||
this.objectOrderUpdate([ { viewId: view.id, groupId, objectIds: records } ], records, () => recordStore.recordsSet(subId, '', records));
|
||||
this.objectOrderUpdate([ { viewId: view.id, groupId, objectIds: records } ], records, () => S.Record.recordsSet(subId, '', records));
|
||||
} else {
|
||||
recordStore.recordsSet(subId, '', records);
|
||||
S.Record.recordsSet(subId, '', records);
|
||||
};
|
||||
|
||||
if ([ I.ViewType.Graph ].includes(view.type)) {
|
||||
|
@ -706,7 +706,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
};
|
||||
|
||||
const typeId = this.getTypeId();
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
|
||||
if (type && (type.uniqueKey == Constant.typeKey.bookmark)) {
|
||||
this.onBookmarkMenu(e, dir, groupId, menuParam);
|
||||
|
@ -793,7 +793,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
};
|
||||
|
||||
const typeId = this.getTypeId();
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
|
||||
if (type && (type.uniqueKey == Constant.typeKey.bookmark)) {
|
||||
menuContext.close();
|
||||
|
@ -815,7 +815,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
|
||||
onTemplateAdd (id?: string) {
|
||||
const typeId = id || this.getTypeId();
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
const details: any = {
|
||||
targetObjectType: typeId,
|
||||
layout: type.recommendedLayout,
|
||||
|
@ -856,7 +856,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
};
|
||||
|
||||
const selection = S.Common.getRef('selectionProvider');
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
const id = Relation.cellId(this.getIdPrefix(), relationKey, recordId);
|
||||
const ref = this.refCells.get(id);
|
||||
const record = this.getRecord(recordId);
|
||||
|
@ -888,7 +888,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
|
||||
onCellChange (id: string, relationKey: string, value: any, callBack?: (message: any) => void) {
|
||||
const subId = this.getSubId();
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
if (!relation) {
|
||||
return;
|
||||
|
@ -949,7 +949,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
const { rootId, block, isPopup, isInline } = this.props;
|
||||
const { targetObjectId } = block.content;
|
||||
const isCollection = this.isCollection();
|
||||
const collectionType = recordStore.getCollectionType();
|
||||
const collectionType = S.Record.getCollectionType();
|
||||
const addParam: any = {};
|
||||
|
||||
let filters: I.Filter[] = [];
|
||||
|
@ -1096,7 +1096,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
records = arrayMove(records, oldIndex, targetIndex);
|
||||
});
|
||||
|
||||
recordStore.recordsSet(subId, '', records);
|
||||
S.Record.recordsSet(subId, '', records);
|
||||
this.objectOrderUpdate([ { viewId: view.id, groupId: '', objectIds: records } ], records);
|
||||
};
|
||||
|
||||
|
@ -1112,7 +1112,7 @@ const BlockDataview = observer(class BlockDataview extends React.Component<Props
|
|||
return [];
|
||||
};
|
||||
|
||||
const keys = recordStore.getObjectRelationKeys(rootId, block.id);
|
||||
const keys = S.Record.getObjectRelationKeys(rootId, block.id);
|
||||
return view.getVisibleRelations().filter(it => keys.includes(it.relationKey));
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { observable } from 'mobx';
|
||||
import { I, C, S, analytics, UtilCommon, keyboard, Relation, Renderer, Preview, translate, UtilDate } from 'Lib';
|
||||
import { menuStore, recordStore } from 'Store';
|
||||
import { menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -508,7 +508,7 @@ const Cell = observer(class Cell extends React.Component<Props> {
|
|||
};
|
||||
|
||||
getRelation () {
|
||||
return recordStore.getRelationByKey(this.props.relationKey);
|
||||
return S.Record.getRelationByKey(this.props.relationKey);
|
||||
};
|
||||
|
||||
canCellEdit (relation: any, record: any): boolean {
|
||||
|
|
|
@ -4,9 +4,10 @@ import arrayMove from 'array-move';
|
|||
import { observer } from 'mobx-react';
|
||||
import { getRange, setRange } from 'selection-ranges';
|
||||
import { DragBox } from 'Component';
|
||||
import { I, Relation, UtilObject, translate, UtilCommon, keyboard, analytics } from 'Lib';
|
||||
import { menuStore, detailStore, recordStore } from 'Store';
|
||||
import { I, S, Relation, UtilObject, translate, UtilCommon, keyboard } from 'Lib';
|
||||
import { menuStore, detailStore } from 'Store';
|
||||
import ItemObject from './item/object';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface State {
|
||||
|
@ -188,7 +189,7 @@ const CellObject = observer(class CellObject extends React.Component<I.Cell, Sta
|
|||
};
|
||||
|
||||
// Template type is disabled for opening
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const canOpen = this.props.canOpen && (item.id != templateType.id);
|
||||
|
||||
if (canOpen) {
|
||||
|
|
|
@ -3,8 +3,8 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { observable } from 'mobx';
|
||||
import { Icon, Button, Filter } from 'Component';
|
||||
import { C, I, UtilCommon, analytics, Relation, keyboard, translate, UtilObject, UtilMenu, Dataview } from 'Lib';
|
||||
import { menuStore, recordStore, blockStore } from 'Store';
|
||||
import { C, I, S, UtilCommon, analytics, Relation, keyboard, translate, UtilObject, UtilMenu, Dataview } from 'Lib';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
import { SortableContainer, SortableElement } from 'react-sortable-hoc';
|
||||
import Head from './head';
|
||||
import arrayMove from 'array-move';
|
||||
|
@ -39,10 +39,10 @@ const Controls = observer(class Controls extends React.Component<Props> {
|
|||
render () {
|
||||
const { className, rootId, block, getView, onRecordAdd, onTemplateMenu, isInline, isCollection, getSources, onFilterChange, getTarget, getTypeId, readonly } = this.props;
|
||||
const target = getTarget();
|
||||
const views = recordStore.getViews(rootId, block.id);
|
||||
const views = S.Record.getViews(rootId, block.id);
|
||||
const view = getView();
|
||||
const sortCnt = view.sorts.length;
|
||||
const filters = view.filters.filter(it => recordStore.getRelationByKey(it.relationKey));
|
||||
const filters = view.filters.filter(it => S.Record.getRelationByKey(it.relationKey));
|
||||
const filterCnt = filters.length;
|
||||
const allowedView = !readonly && blockStore.checkFlags(rootId, block.id, [ I.RestrictionDataview.View ]);
|
||||
const cn = [ 'dataviewControls' ];
|
||||
|
@ -228,7 +228,7 @@ const Controls = observer(class Controls extends React.Component<Props> {
|
|||
|
||||
onViewRemove (view) {
|
||||
const { rootId, block, getView, isInline, getTarget } = this.props;
|
||||
const views = recordStore.getViews(rootId, block.id);
|
||||
const views = S.Record.getViews(rootId, block.id);
|
||||
const object = getTarget();
|
||||
const idx = views.findIndex(it => it.id == view.id);
|
||||
const filtered = views.filter(it => it.id != view.id);
|
||||
|
@ -334,7 +334,7 @@ const Controls = observer(class Controls extends React.Component<Props> {
|
|||
return;
|
||||
};
|
||||
|
||||
const view = recordStore.getView(rootId, block.id, message.viewId);
|
||||
const view = S.Record.getView(rootId, block.id, message.viewId);
|
||||
if (!view) {
|
||||
return;
|
||||
};
|
||||
|
@ -352,10 +352,10 @@ const Controls = observer(class Controls extends React.Component<Props> {
|
|||
|
||||
onViewSet (view: any) {
|
||||
const { rootId, block, isInline, getTarget } = this.props;
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const object = getTarget();
|
||||
|
||||
recordStore.metaSet(subId, '', { viewId: view.id });
|
||||
S.Record.metaSet(subId, '', { viewId: view.id });
|
||||
C.BlockDataviewViewSetActive(rootId, block.id, view.id);
|
||||
|
||||
analytics.event('SwitchView', {
|
||||
|
@ -401,11 +401,11 @@ const Controls = observer(class Controls extends React.Component<Props> {
|
|||
const { oldIndex, newIndex } = result;
|
||||
const { rootId, block, isInline, getTarget } = this.props;
|
||||
const object = getTarget();
|
||||
const views = recordStore.getViews(rootId, block.id);
|
||||
const views = S.Record.getViews(rootId, block.id);
|
||||
const view = views[oldIndex];
|
||||
const ids = arrayMove(views.map(it => it.id), oldIndex, newIndex);
|
||||
|
||||
recordStore.viewsSort(rootId, block.id, ids);
|
||||
S.Record.viewsSort(rootId, block.id, ids);
|
||||
|
||||
C.BlockDataviewViewSetPosition(rootId, block.id, view.id, newIndex, () => {
|
||||
analytics.event('RepositionView', {
|
||||
|
|
|
@ -4,7 +4,7 @@ import arrayMove from 'array-move';
|
|||
import $ from 'jquery';
|
||||
import raf from 'raf';
|
||||
import { I, C, S, UtilCommon, Dataview, keyboard, translate } from 'Lib';
|
||||
import { recordStore, detailStore, blockStore } from 'Store';
|
||||
import { detailStore, blockStore } from 'Store';
|
||||
import Empty from '../empty';
|
||||
import Column from './board/column';
|
||||
|
||||
|
@ -36,7 +36,7 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
const { rootId, block, getView, className, onViewSettings } = this.props;
|
||||
const view = getView();
|
||||
const groups = this.getGroups(false);
|
||||
const relation = recordStore.getRelationByKey(view.groupRelationKey);
|
||||
const relation = S.Record.getRelationByKey(view.groupRelationKey);
|
||||
const cn = [ 'viewContent', className ];
|
||||
|
||||
if (!relation || !relation.isInstalled) {
|
||||
|
@ -69,7 +69,7 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
{...group}
|
||||
onDragStartColumn={this.onDragStartColumn}
|
||||
onDragStartCard={this.onDragStartCard}
|
||||
getSubId={() => recordStore.getGroupSubId(rootId, block.id, group.id)}
|
||||
getSubId={() => S.Record.getGroupSubId(rootId, block.id, group.id)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
@ -92,14 +92,14 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
componentWillUnmount () {
|
||||
const { rootId, block } = this.props;
|
||||
const groups = this.getGroups(true);
|
||||
const ids = [ recordStore.getGroupSubId(rootId, block.id, 'groups') ];
|
||||
const ids = [ S.Record.getGroupSubId(rootId, block.id, 'groups') ];
|
||||
|
||||
groups.forEach((it: any) => {
|
||||
ids.push(recordStore.getGroupSubId(rootId, block.id, it.id));
|
||||
ids.push(S.Record.getGroupSubId(rootId, block.id, it.id));
|
||||
});
|
||||
|
||||
C.ObjectSearchUnsubscribe(ids);
|
||||
recordStore.groupsClear(rootId, block.id);
|
||||
S.Record.groupsClear(rootId, block.id);
|
||||
|
||||
this.unbind();
|
||||
};
|
||||
|
@ -121,7 +121,7 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
const object = getTarget();
|
||||
const view = getView();
|
||||
|
||||
recordStore.groupsClear(rootId, block.id);
|
||||
S.Record.groupsClear(rootId, block.id);
|
||||
|
||||
if (!view.groupRelationKey) {
|
||||
this.forceUpdate();
|
||||
|
@ -322,7 +322,7 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
|
||||
let groups = this.getGroups(true);
|
||||
groups = arrayMove(groups, current.index, this.newIndex);
|
||||
recordStore.groupsSet(rootId, block.id, groups);
|
||||
S.Record.groupsSet(rootId, block.id, groups);
|
||||
|
||||
groups.forEach((it: any, i: number) => {
|
||||
update.push({ ...it, groupId: it.id, index: i });
|
||||
|
@ -405,9 +405,9 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
|
||||
const { rootId, block, getView, objectOrderUpdate } = this.props;
|
||||
const view = getView();
|
||||
const oldSubId = recordStore.getGroupSubId(rootId, block.id, current.groupId);
|
||||
const newSubId = recordStore.getGroupSubId(rootId, block.id, this.newGroupId);
|
||||
const newGroup = recordStore.getGroup(rootId, block.id, this.newGroupId);
|
||||
const oldSubId = S.Record.getGroupSubId(rootId, block.id, current.groupId);
|
||||
const newSubId = S.Record.getGroupSubId(rootId, block.id, this.newGroupId);
|
||||
const newGroup = S.Record.getGroup(rootId, block.id, this.newGroupId);
|
||||
const change = current.groupId != this.newGroupId;
|
||||
|
||||
let records: any[] = [];
|
||||
|
@ -417,13 +417,13 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
detailStore.update(newSubId, { id: record.id, details: record }, true);
|
||||
detailStore.delete(oldSubId, record.id, Object.keys(record));
|
||||
|
||||
recordStore.recordDelete(oldSubId, '', record.id);
|
||||
recordStore.recordAdd(newSubId, '', record.id, this.newIndex);
|
||||
S.Record.recordDelete(oldSubId, '', record.id);
|
||||
S.Record.recordAdd(newSubId, '', record.id, this.newIndex);
|
||||
|
||||
C.ObjectListSetDetails([ record.id ], [ { key: view.groupRelationKey, value: newGroup.value } ], () => {
|
||||
orders = [
|
||||
{ viewId: view.id, groupId: current.groupId, objectIds: recordStore.getRecordIds(oldSubId, '') },
|
||||
{ viewId: view.id, groupId: this.newGroupId, objectIds: recordStore.getRecordIds(newSubId, '') }
|
||||
{ viewId: view.id, groupId: current.groupId, objectIds: S.Record.getRecordIds(oldSubId, '') },
|
||||
{ viewId: view.id, groupId: this.newGroupId, objectIds: S.Record.getRecordIds(newSubId, '') }
|
||||
];
|
||||
|
||||
objectOrderUpdate(orders, records);
|
||||
|
@ -437,10 +437,10 @@ const ViewBoard = observer(class ViewBoard extends React.Component<I.ViewCompone
|
|||
this.newIndex -= 1;
|
||||
};
|
||||
|
||||
records = arrayMove(recordStore.getRecordIds(oldSubId, ''), current.index, this.newIndex);
|
||||
records = arrayMove(S.Record.getRecordIds(oldSubId, ''), current.index, this.newIndex);
|
||||
orders = [ { viewId: view.id, groupId: current.groupId, objectIds: records } ];
|
||||
|
||||
objectOrderUpdate(orders, records, () => recordStore.recordsSet(oldSubId, '', records));
|
||||
objectOrderUpdate(orders, records, () => S.Record.recordsSet(oldSubId, '', records));
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { I, S, UtilCommon, UtilData, UtilObject, Relation, keyboard } from 'Lib';
|
||||
import { recordStore, detailStore } from 'Store';
|
||||
import { detailStore } from 'Store';
|
||||
import { Cell, SelectionTarget } from 'Component';
|
||||
|
||||
interface Props extends I.ViewComponent {
|
||||
|
@ -20,7 +20,7 @@ const Card = observer(class Card extends React.Component<Props> {
|
|||
const view = getView();
|
||||
const relations = getVisibleRelations();
|
||||
const idPrefix = getIdPrefix();
|
||||
const subId = recordStore.getGroupSubId(rootId, block.id, groupId);
|
||||
const subId = S.Record.getGroupSubId(rootId, block.id, groupId);
|
||||
const record = detailStore.get(subId, id);
|
||||
const cn = [ 'card', UtilData.layoutClass(record.id, record.layout) ];
|
||||
const { done } = record;
|
||||
|
@ -94,7 +94,7 @@ const Card = observer(class Card extends React.Component<Props> {
|
|||
|
||||
const { rootId, block, groupId, id, onContext } = this.props;
|
||||
const selection = S.Common.getRef('selectionProvider');
|
||||
const subId = recordStore.getGroupSubId(rootId, block.id, groupId);
|
||||
const subId = S.Record.getGroupSubId(rootId, block.id, groupId);
|
||||
const record = detailStore.get(subId, id);
|
||||
const cb = {
|
||||
0: () => {
|
||||
|
@ -116,7 +116,7 @@ const Card = observer(class Card extends React.Component<Props> {
|
|||
onCellClick (e: React.MouseEvent, vr: I.ViewRelation) {
|
||||
const { recordId, getRecord, onCellClick } = this.props;
|
||||
const record = getRecord(recordId);
|
||||
const relation = recordStore.getRelationByKey(vr.relationKey);
|
||||
const relation = S.Record.getRelationByKey(vr.relationKey);
|
||||
|
||||
if (!relation || ![ I.RelationType.Url, I.RelationType.Phone, I.RelationType.Email, I.RelationType.Checkbox ].includes(relation.format)) {
|
||||
return;
|
||||
|
|
|
@ -2,8 +2,8 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Icon, LoadMore } from 'Component';
|
||||
import { I, Relation, UtilData, UtilObject, UtilCommon, translate, Dataview } from 'Lib';
|
||||
import { recordStore, detailStore, menuStore } from 'Store';
|
||||
import { I, S, UtilData, UtilObject, UtilCommon, translate, Dataview } from 'Lib';
|
||||
import { detailStore, menuStore } from 'Store';
|
||||
import Card from './card';
|
||||
import Cell from 'Component/block/dataview/cell';
|
||||
|
||||
|
@ -38,12 +38,12 @@ const Column = observer(class Column extends React.Component<Props> {
|
|||
const target = getTarget();
|
||||
const subId = getSubId();
|
||||
const items = this.getItems();
|
||||
const { total } = recordStore.getMeta(subId, '');
|
||||
const { total } = S.Record.getMeta(subId, '');
|
||||
const limit = getLimit();
|
||||
const head = {};
|
||||
const cn = [ 'column' ];
|
||||
const cnbg = [];
|
||||
const group = recordStore.getGroup(rootId, block.id, id);
|
||||
const group = S.Record.getGroup(rootId, block.id, id);
|
||||
const order = (block.content.groupOrder || []).find(it => it.viewId == view.id);
|
||||
const orderGroup = (order?.groups || []).find(it => it.groupId == id) || {};
|
||||
const isAllowedObject = this.props.isAllowedObject();
|
||||
|
@ -143,7 +143,7 @@ const Column = observer(class Column extends React.Component<Props> {
|
|||
return;
|
||||
};
|
||||
|
||||
const relation = recordStore.getRelationByKey(view.groupRelationKey);
|
||||
const relation = S.Record.getRelationByKey(view.groupRelationKey);
|
||||
if (!relation) {
|
||||
return;
|
||||
};
|
||||
|
@ -183,7 +183,7 @@ const Column = observer(class Column extends React.Component<Props> {
|
|||
ignoreDeleted: true,
|
||||
collectionId: (isCollection ? object.id : ''),
|
||||
}, () => {
|
||||
recordStore.recordsSet(subId, '', applyObjectOrder(id, recordStore.getRecordIds(subId, '')));
|
||||
S.Record.recordsSet(subId, '', applyObjectOrder(id, S.Record.getRecordIds(subId, '')));
|
||||
|
||||
if (clear) {
|
||||
this.setState({ loading: false });
|
||||
|
@ -193,13 +193,13 @@ const Column = observer(class Column extends React.Component<Props> {
|
|||
|
||||
clear () {
|
||||
const { getSubId } = this.props;
|
||||
recordStore.recordsClear(getSubId(), '');
|
||||
S.Record.recordsClear(getSubId(), '');
|
||||
};
|
||||
|
||||
getItems () {
|
||||
const { id, getSubId, applyObjectOrder } = this.props;
|
||||
|
||||
return applyObjectOrder(id, UtilCommon.objectCopy(recordStore.getRecordIds(getSubId(), ''))).map(id => ({ id }));
|
||||
return applyObjectOrder(id, UtilCommon.objectCopy(S.Record.getRecordIds(getSubId(), ''))).map(id => ({ id }));
|
||||
};
|
||||
|
||||
onLoadMore () {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Select, Icon } from 'Component';
|
||||
import { I, UtilData, UtilCommon, UtilDate, UtilObject, translate, Dataview } from 'Lib';
|
||||
import { recordStore, menuStore } from 'Store';
|
||||
import { I, S, UtilData, UtilCommon, UtilDate, UtilObject, translate, Dataview } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
import Item from './calendar/item';
|
||||
|
||||
interface State {
|
||||
|
@ -141,7 +141,7 @@ const ViewCalendar = observer(class ViewCalendar extends React.Component<I.ViewC
|
|||
|
||||
getSubId () {
|
||||
const { rootId, block } = this.props;
|
||||
return recordStore.getSubId(rootId, block.id);
|
||||
return S.Record.getSubId(rootId, block.id);
|
||||
};
|
||||
|
||||
load () {
|
||||
|
@ -152,7 +152,7 @@ const ViewCalendar = observer(class ViewCalendar extends React.Component<I.ViewC
|
|||
return;
|
||||
};
|
||||
|
||||
const relation = recordStore.getRelationByKey(view.groupRelationKey);
|
||||
const relation = S.Record.getRelationByKey(view.groupRelationKey);
|
||||
if (!relation) {
|
||||
return;
|
||||
};
|
||||
|
@ -256,7 +256,7 @@ const ViewCalendar = observer(class ViewCalendar extends React.Component<I.ViewC
|
|||
const { getView } = this.props;
|
||||
const view = getView();
|
||||
|
||||
return recordStore.getRecords(this.getSubId(), [ view.groupRelationKey ]);
|
||||
return S.Record.getRecords(this.getSubId(), [ view.groupRelationKey ]);
|
||||
};
|
||||
|
||||
resize () {
|
||||
|
|
|
@ -2,10 +2,11 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { AutoSizer, WindowScroller, List, CellMeasurer, CellMeasurerCache } from 'react-virtualized';
|
||||
import { I, Relation, UtilData, UtilCommon, UtilObject, Dataview } from 'Lib';
|
||||
import { recordStore, detailStore } from 'Store';
|
||||
import { I, S, Relation, UtilData, UtilCommon, Dataview } from 'Lib';
|
||||
import { detailStore } from 'Store';
|
||||
import { LoadMore } from 'Component';
|
||||
import Card from './gallery/card';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewComponent> {
|
||||
|
@ -38,10 +39,10 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
const { rootId, block, isPopup, isInline, className, getView, getKeys, getLimit, getVisibleRelations, onRecordAdd, getEmpty, getRecords } = this.props;
|
||||
const view = getView();
|
||||
const relations = getVisibleRelations();
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const records = getRecords();
|
||||
const { coverRelationKey, cardSize, hideIcon } = view;
|
||||
const { offset, total } = recordStore.getMeta(subId, '');
|
||||
const { offset, total } = S.Record.getMeta(subId, '');
|
||||
const limit = getLimit();
|
||||
const cn = [ 'viewContent', className ];
|
||||
const cardHeight = this.getCardHeight();
|
||||
|
@ -61,7 +62,7 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
};
|
||||
|
||||
for (const k in item) {
|
||||
const relation = recordStore.getRelationByKey(k);
|
||||
const relation = S.Record.getRelationByKey(k);
|
||||
if (!relation || ![ I.RelationType.Object, I.RelationType.File ].includes(relation.format)) {
|
||||
continue;
|
||||
};
|
||||
|
@ -219,14 +220,14 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
|
||||
loadMoreCards ({ startIndex, stopIndex }) {
|
||||
const { rootId, block, loadData, getView, getLimit } = this.props;
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
let { offset } = recordStore.getMeta(subId, '');
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
let { offset } = S.Record.getMeta(subId, '');
|
||||
const view = getView();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
offset += getLimit();
|
||||
loadData(view.id, offset, false, resolve);
|
||||
recordStore.metaSet(subId, '', { offset });
|
||||
S.Record.metaSet(subId, '', { offset });
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -280,7 +281,7 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
let height = size.padding * 2 + size.margin - 4;
|
||||
|
||||
relations.forEach(it => {
|
||||
const relation = recordStore.getRelationByKey(it.relationKey);
|
||||
const relation = S.Record.getRelationByKey(it.relationKey);
|
||||
|
||||
if (!relation) {
|
||||
return;
|
||||
|
@ -319,7 +320,7 @@ const ViewGallery = observer(class ViewGallery extends React.Component<I.ViewCom
|
|||
return null;
|
||||
};
|
||||
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const record = detailStore.get(subId, id, getKeys(view.id));
|
||||
|
||||
return Dataview.getCoverObject(subId, record, view.coverRelationKey);
|
||||
|
|
|
@ -3,7 +3,6 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Cell, DropTarget, SelectionTarget, ObjectCover } from 'Component';
|
||||
import { I, S, UtilData, UtilObject, Relation, keyboard } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
|
||||
interface Props extends I.ViewComponent {
|
||||
style?: any;
|
||||
|
@ -29,7 +28,7 @@ const Card = observer(class Card extends React.Component<Props> {
|
|||
const relations = getVisibleRelations();
|
||||
const idPrefix = getIdPrefix();
|
||||
const cn = [ 'card', UtilData.layoutClass(record.id, record.layout), UtilData.cardSizeClass(cardSize) ];
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const cover = getCoverObject(recordId);
|
||||
|
||||
if (coverFit) {
|
||||
|
@ -166,7 +165,7 @@ const Card = observer(class Card extends React.Component<Props> {
|
|||
onCellClick (e: React.MouseEvent, vr: I.ViewRelation) {
|
||||
const { onCellClick, recordId, getRecord } = this.props;
|
||||
const record = getRecord(recordId);
|
||||
const relation = recordStore.getRelationByKey(vr.relationKey);
|
||||
const relation = S.Record.getRelationByKey(vr.relationKey);
|
||||
|
||||
if (!relation || ![ I.RelationType.Url, I.RelationType.Phone, I.RelationType.Email, I.RelationType.Checkbox ].includes(relation.format)) {
|
||||
return;
|
||||
|
|
|
@ -4,8 +4,8 @@ import { observer } from 'mobx-react';
|
|||
import arrayMove from 'array-move';
|
||||
import $ from 'jquery';
|
||||
import { Icon, LoadMore } from 'Component';
|
||||
import { I, C, UtilCommon, translate, keyboard, Relation } from 'Lib';
|
||||
import { recordStore, menuStore, blockStore, detailStore } from 'Store';
|
||||
import { I, C, S, UtilCommon, translate, keyboard, Relation } from 'Lib';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
import HeadRow from './grid/head/row';
|
||||
import BodyRow from './grid/body/row';
|
||||
const Constant = require('json/constant.json');
|
||||
|
@ -35,7 +35,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
const view = getView();
|
||||
const relations = getVisibleRelations();
|
||||
const records = getRecords();
|
||||
const { offset, total } = recordStore.getMeta(recordStore.getSubId(rootId, block.id), '');
|
||||
const { offset, total } = S.Record.getMeta(S.Record.getSubId(rootId, block.id), '');
|
||||
const limit = getLimit();
|
||||
const length = records.length;
|
||||
const isAllowedObject = this.props.isAllowedObject();
|
||||
|
@ -205,7 +205,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
const columns: any = {};
|
||||
|
||||
relations.forEach(it => {
|
||||
const relation: any = recordStore.getRelationByKey(it.relationKey) || {};
|
||||
const relation: any = S.Record.getRelationByKey(it.relationKey) || {};
|
||||
const w = relationKey && (it.relationKey == relationKey) ? width : it.width;
|
||||
|
||||
columns[it.relationKey] = Relation.width(w, relation.format);
|
||||
|
@ -283,7 +283,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
node.find('.cellKeyHover').removeClass('cellKeyHover');
|
||||
|
||||
relations.forEach(it => {
|
||||
const relation: any = recordStore.getRelationByKey(it.relationKey) || {};
|
||||
const relation: any = S.Record.getRelationByKey(it.relationKey) || {};
|
||||
if (it.relationKey == relationKey) {
|
||||
it.width = Relation.width(width, relation.format);
|
||||
};
|
||||
|
@ -342,14 +342,14 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
|
||||
loadMoreRows ({ startIndex, stopIndex }) {
|
||||
const { rootId, block, loadData, getView, getLimit } = this.props;
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
let { offset } = recordStore.getMeta(subId, '');
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
let { offset } = S.Record.getMeta(subId, '');
|
||||
const view = getView();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
offset += getLimit();
|
||||
loadData(view.id, offset, false, resolve);
|
||||
recordStore.metaSet(subId, '', { offset });
|
||||
S.Record.metaSet(subId, '', { offset });
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -362,7 +362,7 @@ const ViewGrid = observer(class ViewGrid extends React.Component<I.ViewComponent
|
|||
const grid = node.find('.ReactVirtualized__Grid__innerScrollContainer');
|
||||
const container = UtilCommon.getPageContainer(isPopup);
|
||||
const width = getVisibleRelations().reduce((res: number, current: any) => { return res + current.width; }, Constant.size.blockMenu);
|
||||
const length = recordStore.getRecordIds(recordStore.getSubId(rootId, block.id), '').length;
|
||||
const length = S.Record.getRecordIds(S.Record.getSubId(rootId, block.id), '').length;
|
||||
const cw = container.width();
|
||||
const rh = this.getRowHeight();
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { I, Relation } from 'Lib';
|
||||
import { I, S, Relation } from 'Lib';
|
||||
import { Cell, Icon } from 'Component';
|
||||
import { recordStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface Props {
|
||||
|
@ -34,13 +34,13 @@ const BodyCell = observer(class BodyCell extends React.Component<Props> {
|
|||
render () {
|
||||
const { rootId, block, className, relationKey, readonly, recordId, getRecord, onRef, onCellClick, onCellChange, getIdPrefix, canCellEdit } = this.props;
|
||||
const record = getRecord(recordId);
|
||||
const relation: any = recordStore.getRelationByKey(relationKey) || {};
|
||||
const relation: any = S.Record.getRelationByKey(relationKey) || {};
|
||||
const cn = [ 'cell', `cell-key-${relationKey}`, Relation.className(relation.format), (!readonly ? 'canEdit' : '') ];
|
||||
const idPrefix = getIdPrefix();
|
||||
const id = Relation.cellId(idPrefix, relationKey, record.id);
|
||||
const width = Relation.width(this.props.width, relation.format);
|
||||
const size = Constant.size.dataview.cell;
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const canEdit = canCellEdit(relation, record);
|
||||
|
||||
if (relationKey == 'name') {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import * as React from 'react';
|
||||
import { I, keyboard, Relation, Dataview } from 'Lib';
|
||||
import { I, S, keyboard, Relation, Dataview } from 'Lib';
|
||||
import { SortableElement } from 'react-sortable-hoc';
|
||||
import { menuStore, recordStore, blockStore } from 'Store';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
import { observer } from 'mobx-react';
|
||||
import Handle from './handle';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface Props extends I.ViewComponent, I.ViewRelation {
|
||||
rootId: string;
|
||||
|
@ -25,7 +24,7 @@ const HeadCell = observer(class HeadCell extends React.Component<Props> {
|
|||
|
||||
render () {
|
||||
const { rootId, block, relationKey, index, onResizeStart } = this.props;
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
if (!relation) {
|
||||
return;
|
||||
|
@ -76,7 +75,7 @@ const HeadCell = observer(class HeadCell extends React.Component<Props> {
|
|||
e.stopPropagation();
|
||||
|
||||
const { rootId, block, readonly, loadData, getView, getTarget, relationKey, isInline, isCollection } = this.props;
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
if (!relation || keyboard.isResizing) {
|
||||
return;
|
||||
|
|
|
@ -2,9 +2,8 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { AutoSizer, WindowScroller, List, InfiniteLoader } from 'react-virtualized';
|
||||
import { recordStore, detailStore } from 'Store';
|
||||
import { Icon, LoadMore } from 'Component';
|
||||
import { I, translate, UtilCommon } from 'Lib';
|
||||
import { I, S, translate, UtilCommon } from 'Lib';
|
||||
import Row from './list/row';
|
||||
|
||||
const HEIGHT = 34;
|
||||
|
@ -24,8 +23,8 @@ const ViewList = observer(class ViewList extends React.Component<I.ViewComponent
|
|||
const { rootId, block, className, isPopup, isInline, getView, getKeys, onRecordAdd, getLimit, getEmpty, getRecords } = this.props;
|
||||
const view = getView();
|
||||
const records = getRecords();
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
const { offset, total } = recordStore.getMeta(subId, '');
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const { offset, total } = S.Record.getMeta(subId, '');
|
||||
const limit = getLimit();
|
||||
const length = records.length;
|
||||
const isAllowedObject = this.props.isAllowedObject();
|
||||
|
@ -130,14 +129,14 @@ const ViewList = observer(class ViewList extends React.Component<I.ViewComponent
|
|||
|
||||
loadMoreRows ({ startIndex, stopIndex }) {
|
||||
const { rootId, block, loadData, getView, getLimit } = this.props;
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
let { offset } = recordStore.getMeta(subId, '');
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
let { offset } = S.Record.getMeta(subId, '');
|
||||
const view = getView();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
offset += getLimit();
|
||||
loadData(view.id, offset, false, resolve);
|
||||
recordStore.metaSet(subId, '', { offset });
|
||||
S.Record.metaSet(subId, '', { offset });
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { I, S, keyboard, Relation, UtilObject } from 'Lib';
|
||||
import { Cell, DropTarget, Icon, SelectionTarget } from 'Component';
|
||||
import { recordStore } from 'Store';
|
||||
|
||||
interface Props extends I.ViewComponent {
|
||||
style?: any;
|
||||
|
@ -19,7 +18,7 @@ const Row = observer(class Row extends React.Component<Props> {
|
|||
const view = getView();
|
||||
const relations = view.getVisibleRelations();
|
||||
const idPrefix = getIdPrefix();
|
||||
const subId = recordStore.getSubId(rootId, block.id);
|
||||
const subId = S.Record.getSubId(rootId, block.id);
|
||||
const record = getRecord(recordId);
|
||||
const cn = [ 'row' ];
|
||||
|
||||
|
@ -137,7 +136,7 @@ const Row = observer(class Row extends React.Component<Props> {
|
|||
onCellClick (e: React.MouseEvent, vr: I.ViewRelation) {
|
||||
const { onCellClick, recordId, getRecord } = this.props;
|
||||
const record = getRecord(recordId);
|
||||
const relation = recordStore.getRelationByKey(vr.relationKey);
|
||||
const relation = S.Record.getRelationByKey(vr.relationKey);
|
||||
|
||||
if (!relation || ![ I.RelationType.Url, I.RelationType.Phone, I.RelationType.Email, I.RelationType.Checkbox ].includes(relation.format)) {
|
||||
return;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { observable } from 'mobx';
|
||||
import { ObjectType, Cell } from 'Component';
|
||||
import { I, C, S, UtilData, UtilCommon, UtilObject, UtilDate, Preview, focus, analytics, Relation, Onboarding, history as historyPopup, keyboard, translate } from 'Lib';
|
||||
import { blockStore, detailStore, recordStore, menuStore } from 'Store';
|
||||
import { blockStore, detailStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -69,7 +69,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
|
||||
{items.map((relationKey: any, i: any) => {
|
||||
const id = Relation.cellId(PREFIX + block.id, relationKey, object.id);
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
const value = object[relationKey];
|
||||
const canEdit = allowedValue && !relation.isReadonlyValue;
|
||||
const cn = [ 'cell', (canEdit ? 'canEdit' : '') ];
|
||||
|
@ -366,7 +366,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
'setOf',
|
||||
];
|
||||
|
||||
return (object.featuredRelations || []).filter(it => recordStore.getRelationByKey(it) && !skipIds.includes(it));
|
||||
return (object.featuredRelations || []).filter(it => S.Record.getRelationByKey(it) && !skipIds.includes(it));
|
||||
};
|
||||
|
||||
onFocus () {
|
||||
|
@ -390,7 +390,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
};
|
||||
|
||||
onCellClick (e: any, relationKey: string, recordId: string) {
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
if (!relation || relation.isReadonlyValue) {
|
||||
return;
|
||||
|
@ -407,7 +407,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
onMouseEnter (e: any, relationKey: string, text?: string) {
|
||||
const { rootId } = this.props;
|
||||
const cell = $(`#${Relation.cellId(PREFIX, relationKey, rootId)}`);
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
const show = (text: string) => {
|
||||
Preview.tooltipShow({ text, element: cell });
|
||||
};
|
||||
|
@ -581,7 +581,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
|
||||
const { rootId, isPopup } = this.props;
|
||||
const object = detailStore.get(rootId, rootId, [ 'setOf', 'collectionOf' ]);
|
||||
const type = recordStore.getTypeById(object.type);
|
||||
const type = S.Record.getTypeById(object.type);
|
||||
|
||||
this.menuContext.close();
|
||||
|
||||
|
@ -611,7 +611,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
|
||||
case 'turnCollection':
|
||||
// Add Collection type to details since middleware adds details async
|
||||
const collectionType = recordStore.getCollectionType();
|
||||
const collectionType = S.Record.getCollectionType();
|
||||
if (collectionType) {
|
||||
detailStore.update(rootId, { id: collectionType.id, details: collectionType }, true);
|
||||
};
|
||||
|
@ -666,7 +666,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
const { isPopup, rootId, readonly } = this.props;
|
||||
const storeId = this.getStoreId();
|
||||
const object = detailStore.get(rootId, storeId, [ relationKey ]);
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
if (readonly || !relation || relation.isReadonlyValue) {
|
||||
return;
|
||||
|
@ -791,7 +791,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
const { rootId, block } = this.props;
|
||||
const storeId = this.getStoreId();
|
||||
const object = detailStore.get(rootId, storeId, [ relationKey ]);
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
const elementId = Relation.cellId(PREFIX + block.id, relationKey, object.id);
|
||||
|
||||
if (!relation) {
|
||||
|
@ -837,7 +837,7 @@ const BlockFeatured = observer(class BlockFeatured extends React.Component<Props
|
|||
onLinks (e: React.MouseEvent, relationKey: string) {
|
||||
const { rootId, block } = this.props;
|
||||
const storeId = this.getStoreId();
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
if (!relation) {
|
||||
return;
|
||||
|
|
|
@ -3,7 +3,7 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Icon, IconObject, Loader, ObjectName, Cover } from 'Component';
|
||||
import { I, S, UtilCommon, UtilData, UtilObject, translate, keyboard, focus, Preview } from 'Lib';
|
||||
import { detailStore, blockStore, recordStore } from 'Store';
|
||||
import { detailStore, blockStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -31,7 +31,7 @@ const BlockLink = observer(class BlockLink extends React.Component<I.BlockCompon
|
|||
const readonly = this.props.readonly || !blockStore.isAllowed(object.restrictions, [ I.RestrictionObject.Details ]);
|
||||
const { description, cardStyle, relations } = content;
|
||||
const { size, iconSize } = this.getIconSize();
|
||||
const type = recordStore.getTypeById(object.type);
|
||||
const type = S.Record.getTypeById(object.type);
|
||||
const cn = [ 'focusable', 'c' + block.id, 'resizable' ];
|
||||
|
||||
const canDescription = ![ I.ObjectLayout.Note ].includes(object.layout);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import * as React from 'react';
|
||||
import { Cell, Icon } from 'Component';
|
||||
import { I, C, UtilCommon, focus, analytics, Relation, keyboard, translate } from 'Lib';
|
||||
import { I, C, S, UtilCommon, focus, analytics, Relation, keyboard, translate } from 'Lib';
|
||||
import { observer } from 'mobx-react';
|
||||
import { menuStore, detailStore, recordStore, blockStore } from 'Store';
|
||||
import { menuStore, detailStore, blockStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const BlockRelation = observer(class BlockRelation extends React.Component<I.BlockComponent> {
|
||||
|
@ -27,9 +28,9 @@ const BlockRelation = observer(class BlockRelation extends React.Component<I.Blo
|
|||
const id = Relation.cellId(idPrefix, relationKey, rootId);
|
||||
const cn = [ 'wrap', 'focusable', 'c' + block.id ];
|
||||
|
||||
let relation = recordStore.getRelationByKey(relationKey);
|
||||
let relation = S.Record.getRelationByKey(relationKey);
|
||||
if (!relation) {
|
||||
relation = recordStore.getRelations().find(it => it.relationKey == relationKey);
|
||||
relation = S.Record.getRelations().find(it => it.relationKey == relationKey);
|
||||
};
|
||||
|
||||
const allowedValue = blockStore.checkFlags(rootId, rootId, [ I.RestrictionObject.Details ]) && relation && !relation.isReadonlyValue;
|
||||
|
@ -156,7 +157,7 @@ const BlockRelation = observer(class BlockRelation extends React.Component<I.Blo
|
|||
|
||||
onCellChange (id: string, relationKey: string, value: any, callBack?: (message: any) => void) {
|
||||
const { rootId } = this.props;
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
C.ObjectListSetDetails([ rootId ], [ { key: relationKey, value: Relation.formatValue(relation, value, true) } ], callBack);
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Icon } from 'Component';
|
||||
import { I, C, UtilData, UtilObject, UtilCommon, Onboarding, focus, keyboard, analytics, history as historyPopup, translate, Storage } from 'Lib';
|
||||
import { popupStore, detailStore, blockStore, menuStore, recordStore } from 'Store';
|
||||
import { I, C, S, UtilData, UtilObject, UtilCommon, Onboarding, focus, keyboard, analytics, history as historyPopup, translate } from 'Lib';
|
||||
import { popupStore, detailStore, blockStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const BlockType = observer(class BlockType extends React.Component<I.BlockComponent> {
|
||||
|
@ -240,13 +241,13 @@ const BlockType = observer(class BlockType extends React.Component<I.BlockCompon
|
|||
|
||||
switch (layout) {
|
||||
case I.ObjectLayout.Set: {
|
||||
typeId = recordStore.getSetType()?.id;
|
||||
typeId = S.Record.getSetType()?.id;
|
||||
C.ObjectToSet(rootId, [], cb);
|
||||
break;
|
||||
};
|
||||
|
||||
case I.ObjectLayout.Collection: {
|
||||
typeId = recordStore.getCollectionType()?.id;
|
||||
typeId = S.Record.getCollectionType()?.id;
|
||||
C.ObjectToCollection(rootId, cb);
|
||||
break;
|
||||
};
|
||||
|
@ -255,7 +256,7 @@ const BlockType = observer(class BlockType extends React.Component<I.BlockCompon
|
|||
|
||||
onChange (typeId: any) {
|
||||
const { rootId, isPopup } = this.props;
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
if (!type) {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import $ from 'jquery';
|
||||
import { I, M, UtilCommon, keyboard } from 'Lib';
|
||||
import { blockStore, recordStore } from 'Store';
|
||||
import { I, M, S, UtilCommon, keyboard } from 'Lib';
|
||||
import { blockStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface State {
|
||||
|
@ -123,7 +124,7 @@ class DragLayer extends React.Component<object, State> {
|
|||
|
||||
wrap.addClass('menus').append(add);
|
||||
|
||||
const items = ids.map(relationKey => recordStore.getRelationByKey(relationKey)).filter(it => it);
|
||||
const items = ids.map(relationKey => S.Record.getRelationByKey(relationKey)).filter(it => it);
|
||||
|
||||
items.forEach(item => {
|
||||
const el = $(`#menuBlockRelationView #item-${item.id}`);
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||
import { observer } from 'mobx-react';
|
||||
import { I, C, S, UtilData, Relation, UtilObject, translate, keyboard } from 'Lib';
|
||||
import { IconObject, Pager, ObjectName, Cell, SelectionTarget } from 'Component';
|
||||
import { detailStore, recordStore, menuStore } from 'Store';
|
||||
import { detailStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -39,7 +39,7 @@ const ListObject = observer(class ListObject extends React.Component<Props> {
|
|||
render () {
|
||||
const { subId, rootId, columns } = this.props;
|
||||
const items = this.getItems();
|
||||
const { offset, total } = recordStore.getMeta(subId, '');
|
||||
const { offset, total } = S.Record.getMeta(subId, '');
|
||||
|
||||
let pager = null;
|
||||
if (total && items.length) {
|
||||
|
@ -183,7 +183,7 @@ const ListObject = observer(class ListObject extends React.Component<Props> {
|
|||
};
|
||||
|
||||
getItems () {
|
||||
return recordStore.getRecords(this.props.subId, this.getKeys());
|
||||
return S.Record.getRecords(this.props.subId, this.getKeys());
|
||||
};
|
||||
|
||||
getKeys () {
|
||||
|
@ -197,7 +197,7 @@ const ListObject = observer(class ListObject extends React.Component<Props> {
|
|||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: UtilObject.excludeFromSet() },
|
||||
].concat(this.props.filters || []);
|
||||
|
||||
recordStore.metaSet(subId, '', { offset });
|
||||
S.Record.metaSet(subId, '', { offset });
|
||||
|
||||
UtilData.searchSubscribe({
|
||||
subId,
|
||||
|
|
|
@ -3,8 +3,9 @@ import * as ReactDOM from 'react-dom';
|
|||
import { observer } from 'mobx-react';
|
||||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache, WindowScroller } from 'react-virtualized';
|
||||
import { Checkbox, Filter, Icon, IconObject, Loader, ObjectName, EmptySearch, ObjectDescription, Label } from 'Component';
|
||||
import { UtilData, I, UtilCommon, translate, UtilObject, UtilFile } from 'Lib';
|
||||
import { recordStore, detailStore, menuStore } from 'Store';
|
||||
import { UtilData, I, S, UtilCommon, translate, UtilObject, UtilFile } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface Props {
|
||||
|
@ -246,7 +247,7 @@ const ListObjectManager = observer(class ListObjectManager extends React.Compone
|
|||
|
||||
componentDidUpdate () {
|
||||
const { subId, resize, rowHeight } = this.props;
|
||||
const records = recordStore.getRecordIds(subId, '');
|
||||
const records = S.Record.getRecordIds(subId, '');
|
||||
const items = this.getItems();
|
||||
|
||||
if (!this.cache) {
|
||||
|
@ -304,7 +305,7 @@ const ListObjectManager = observer(class ListObjectManager extends React.Compone
|
|||
e.stopPropagation();
|
||||
|
||||
const { subId } = this.props;
|
||||
const records = recordStore.getRecordIds(subId, '');
|
||||
const records = S.Record.getRecordIds(subId, '');
|
||||
|
||||
if (e.shiftKey) {
|
||||
const idx = records.findIndex(id => id == item.id);
|
||||
|
@ -332,7 +333,7 @@ const ListObjectManager = observer(class ListObjectManager extends React.Compone
|
|||
|
||||
getSelectedIndexes () {
|
||||
const { subId } = this.props;
|
||||
const records = recordStore.getRecordIds(subId, '');
|
||||
const records = S.Record.getRecordIds(subId, '');
|
||||
const indexes = this.selected.map(id => records.findIndex(it => it == id));
|
||||
|
||||
return indexes.filter(idx => idx >= 0);
|
||||
|
@ -345,7 +346,7 @@ const ListObjectManager = observer(class ListObjectManager extends React.Compone
|
|||
|
||||
setSelectedRange (start: number, end: number) {
|
||||
const { subId } = this.props;
|
||||
const records = recordStore.getRecordIds(subId, '');
|
||||
const records = S.Record.getRecordIds(subId, '');
|
||||
|
||||
if (end > records.length) {
|
||||
end = records.length;
|
||||
|
@ -366,7 +367,7 @@ const ListObjectManager = observer(class ListObjectManager extends React.Compone
|
|||
|
||||
selectionAll () {
|
||||
const { subId } = this.props;
|
||||
this.selected = recordStore.getRecordIds(subId, '');
|
||||
this.selected = S.Record.getRecordIds(subId, '');
|
||||
this.forceUpdate();
|
||||
};
|
||||
|
||||
|
@ -410,7 +411,7 @@ const ListObjectManager = observer(class ListObjectManager extends React.Compone
|
|||
getItems () {
|
||||
const { subId, rowLength } = this.props;
|
||||
const ret: any[] = [];
|
||||
const records = recordStore.getRecords(subId);
|
||||
const records = S.Record.getRecords(subId);
|
||||
|
||||
let row = { children: [] };
|
||||
let n = 0;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
import { MenuItemVertical, Icon, Cell } from 'Component';
|
||||
import { I, S, Mark, keyboard, C, focus, Action, UtilCommon, UtilData, UtilMenu, UtilObject, Storage, translate, analytics, Relation } from 'Lib';
|
||||
import { blockStore, recordStore, menuStore, detailStore } from 'Store';
|
||||
import { blockStore, menuStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -271,12 +271,12 @@ const MenuBlockAdd = observer(class MenuBlockAdd extends React.Component<I.Menu>
|
|||
const { config } = S.Common;
|
||||
const object = detailStore.get(rootId, rootId, [ 'targetObjectType' ]);
|
||||
const isTemplate = UtilObject.isTemplate(object.type);
|
||||
const type = recordStore.getTypeById(isTemplate ? object.targetObjectType : object.type);
|
||||
const type = S.Record.getTypeById(isTemplate ? object.targetObjectType : object.type);
|
||||
|
||||
const relations = recordStore.getObjectRelations(rootId, rootId);
|
||||
const relations = S.Record.getObjectRelations(rootId, rootId);
|
||||
const relationKeys = relations.map(it => it.relationKey);
|
||||
const typeRelations = (type ? type.recommendedRelations || [] : []).
|
||||
map(it => recordStore.getRelationById(it)).
|
||||
map(it => S.Record.getRelationById(it)).
|
||||
filter(it => it && it.relationKey && !relationKeys.includes(it.relationKey));
|
||||
|
||||
const ret = relations.concat(typeRelations).filter(it => !config.debug.hiddenObject && it.isHidden ? false : it.isInstalled).sort(UtilData.sortByName);
|
||||
|
@ -622,7 +622,7 @@ const MenuBlockAdd = observer(class MenuBlockAdd extends React.Component<I.Menu>
|
|||
});
|
||||
} else
|
||||
if (item.isObject) {
|
||||
const type = recordStore.getTypeById(item.objectTypeId) || {};
|
||||
const type = S.Record.getTypeById(item.objectTypeId) || {};
|
||||
const details: any = { type: type.id };
|
||||
|
||||
if (UtilObject.isSetLayout(type.recommendedLayout)) {
|
||||
|
|
|
@ -2,8 +2,8 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { MenuItemVertical, Filter, ObjectName } from 'Component';
|
||||
import { I, UtilCommon, keyboard, UtilData, UtilObject, UtilMenu, focus, translate } from 'Lib';
|
||||
import { menuStore, recordStore } from 'Store';
|
||||
import { I, S, UtilCommon, keyboard, UtilData, UtilObject, UtilMenu, focus, translate } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
@ -59,7 +59,7 @@ const MenuBlockLink = observer(class MenuBlockLink extends React.Component<I.Men
|
|||
return null;
|
||||
};
|
||||
|
||||
const type = recordStore.getTypeById(item.type);
|
||||
const type = S.Record.getTypeById(item.type);
|
||||
const cn = [];
|
||||
|
||||
let object = { ...item, id: item.itemId };
|
||||
|
|
|
@ -3,7 +3,6 @@ import { observer } from 'mobx-react';
|
|||
import $ from 'jquery';
|
||||
import { MenuItemVertical, Loader, ObjectName } from 'Component';
|
||||
import { I, S, keyboard, UtilCommon, UtilData, UtilObject, Mark, translate } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
@ -49,7 +48,7 @@ const MenuBlockMention = observer(class MenuBlockMention extends React.Component
|
|||
return null;
|
||||
};
|
||||
|
||||
const type = recordStore.getTypeById(item.type);
|
||||
const type = S.Record.getTypeById(item.type);
|
||||
const cn = [];
|
||||
|
||||
let content = null;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observable } from 'mobx';
|
|||
import { observer } from 'mobx-react';
|
||||
import { I, C, S, analytics, UtilMenu, UtilObject, Preview, translate, keyboard, Relation, UtilCommon } from 'Lib';
|
||||
import { Input, MenuItemVertical, Button, Icon } from 'Component';
|
||||
import { recordStore, menuStore, blockStore, detailStore } from 'Store';
|
||||
import { menuStore, blockStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -74,7 +74,7 @@ const MenuBlockRelationEdit = observer(class MenuBlockRelationEdit extends React
|
|||
if (isObject && !isReadonly && (!relation || !relation.isReadonlyValue)) {
|
||||
const length = this.objectTypes.length;
|
||||
const typeId = length ? this.objectTypes[0] : '';
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
const typeProps: any = {
|
||||
name: translate('menuBlockRelationEditSelectObjectType'),
|
||||
caption: (length > 1 ? '+' + (length - 1) : ''),
|
||||
|
@ -300,13 +300,13 @@ const MenuBlockRelationEdit = observer(class MenuBlockRelationEdit extends React
|
|||
nameAdd: translate('menuBlockRelationEditAddObjectType'),
|
||||
placeholderFocus: translate('menuBlockRelationEditFilterObjectTypes'),
|
||||
value: this.objectTypes,
|
||||
types: [ recordStore.getTypeType()?.id ],
|
||||
types: [ S.Record.getTypeType()?.id ],
|
||||
filters: [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Type },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'recommendedLayout', condition: I.FilterCondition.NotIn, value: UtilObject.getSystemLayouts() },
|
||||
],
|
||||
relation: observable.box(relation),
|
||||
valueMapper: it => recordStore.getTypeById(it.id),
|
||||
valueMapper: it => S.Record.getTypeById(it.id),
|
||||
onChange: (value: any, callBack?: () => void) => {
|
||||
this.objectTypes = value;
|
||||
this.forceUpdate();
|
||||
|
@ -491,7 +491,7 @@ const MenuBlockRelationEdit = observer(class MenuBlockRelationEdit extends React
|
|||
const { data } = param;
|
||||
const { relationId } = data;
|
||||
|
||||
return recordStore.getRelationById(relationId);
|
||||
return S.Record.getRelationById(relationId);
|
||||
};
|
||||
|
||||
isAllowed () {
|
||||
|
|
|
@ -3,7 +3,7 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Icon } from 'Component';
|
||||
import { I, C, S, UtilData, UtilCommon, UtilObject, Relation, analytics, keyboard, translate } from 'Lib';
|
||||
import { blockStore, detailStore, recordStore, menuStore } from 'Store';
|
||||
import { blockStore, detailStore, menuStore } from 'Store';
|
||||
import Item from 'Component/menu/item/relationView';
|
||||
|
||||
const PREFIX = 'menuBlockRelationView';
|
||||
|
@ -152,13 +152,13 @@ const MenuBlockRelationView = observer(class MenuBlockRelationView extends React
|
|||
|
||||
const object = detailStore.get(rootId, rootId);
|
||||
const isTemplate = UtilObject.isTemplate(object.type);
|
||||
const type = recordStore.getTypeById(isTemplate ? object.targetObjectType : object.type);
|
||||
const type = S.Record.getTypeById(isTemplate ? object.targetObjectType : object.type);
|
||||
const featured = Relation.getArrayValue(object.featuredRelations);
|
||||
const relations = recordStore.getObjectRelations(rootId, rootId);
|
||||
const relations = S.Record.getObjectRelations(rootId, rootId);
|
||||
const relationKeys = relations.map(it => it.relationKey);
|
||||
const readonly = this.isReadonly();
|
||||
const typeRelations = (type ? type.recommendedRelations || [] : []).map(it => ({
|
||||
...recordStore.getRelationById(it),
|
||||
...S.Record.getRelationById(it),
|
||||
scope: I.RelationScope.Type,
|
||||
})).filter(it => it && it.relationKey && !relationKeys.includes(it.relationKey));
|
||||
|
||||
|
@ -250,7 +250,7 @@ const MenuBlockRelationView = observer(class MenuBlockRelationView extends React
|
|||
filter: '',
|
||||
ref: 'menu',
|
||||
menuIdEdit: 'blockRelationEdit',
|
||||
skipKeys: recordStore.getObjectRelationKeys(rootId, rootId),
|
||||
skipKeys: S.Record.getObjectRelationKeys(rootId, rootId),
|
||||
addCommand: (rootId: string, blockId: string, relation: any, onChange: (message: any) => void) => {
|
||||
C.ObjectRelationAdd(rootId, [ relation.relationKey ], onChange);
|
||||
},
|
||||
|
@ -262,7 +262,7 @@ const MenuBlockRelationView = observer(class MenuBlockRelationView extends React
|
|||
const { param, getId } = this.props;
|
||||
const { data, classNameWrap } = param;
|
||||
const { rootId, readonly } = data;
|
||||
const relation = recordStore.getRelationById(item.id);
|
||||
const relation = S.Record.getRelationById(item.id);
|
||||
|
||||
if (!relation) {
|
||||
return;
|
||||
|
@ -298,7 +298,7 @@ const MenuBlockRelationView = observer(class MenuBlockRelationView extends React
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { readonly, rootId } = data;
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
if (!relation || readonly || relation.isReadonlyValue) {
|
||||
return;
|
||||
|
@ -316,7 +316,7 @@ const MenuBlockRelationView = observer(class MenuBlockRelationView extends React
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId } = data;
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
|
||||
C.ObjectListSetDetails([ rootId ], [ { key: relationKey, value: Relation.formatValue(relation, value, true) } ], callBack);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import { Icon, IconObject, ObjectName } from 'Component';
|
||||
import { I, UtilObject, keyboard, UtilDate, translate } from 'Lib';
|
||||
import { blockStore, recordStore } from 'Store';
|
||||
import { I, S, UtilObject, keyboard, UtilDate, translate } from 'Lib';
|
||||
import { blockStore } from 'Store';
|
||||
import { observer } from 'mobx-react';
|
||||
|
||||
const MenuCalendarDay = observer(class MenuCalendarDay extends React.Component<I.Menu> {
|
||||
|
@ -125,7 +125,7 @@ const MenuCalendarDay = observer(class MenuCalendarDay extends React.Component<I
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, blockId, d, m, y, relationKey, readonly, onCreate } = data;
|
||||
const items = recordStore.getRecords(recordStore.getSubId(rootId, blockId), [ relationKey ]);
|
||||
const items = S.Record.getRecords(S.Record.getSubId(rootId, blockId), [ relationKey ]);
|
||||
const current = [ d, m, y ].join('-');
|
||||
const ret = items.filter(it => UtilDate.date('j-n-Y', it[relationKey]) == current);
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { MenuItemVertical } from 'Component';
|
||||
import { I, C, keyboard, UtilDate, UtilMenu, translate } from 'Lib';
|
||||
import { menuStore, recordStore } from 'Store';
|
||||
import { I, C, S, keyboard, UtilDate, UtilMenu, translate } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
|
||||
const MenuDataviewDate = observer(class MenuDataviewDate extends React.Component<I.Menu> {
|
||||
|
||||
|
@ -71,7 +71,7 @@ const MenuDataviewDate = observer(class MenuDataviewDate extends React.Component
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { getView, relationId } = data;
|
||||
const relation = recordStore.getRelationById(relationId);
|
||||
const relation = S.Record.getRelationById(relationId);
|
||||
const dateOptions = this.getOptions('dateFormat');
|
||||
const timeOptions = this.getOptions('timeFormat');
|
||||
|
||||
|
@ -163,7 +163,7 @@ const MenuDataviewDate = observer(class MenuDataviewDate extends React.Component
|
|||
view = getView();
|
||||
relation = view.getRelation(relationKey);
|
||||
} else {
|
||||
relation = recordStore.getRelationByKey(relationKey);
|
||||
relation = S.Record.getRelationByKey(relationKey);
|
||||
};
|
||||
|
||||
const options = this.getOptions(item.itemId);
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
import { Filter, MenuItemVertical, Loader, EmptySearch } from 'Component';
|
||||
import { I, S, UtilCommon, Relation, keyboard, UtilData, UtilObject, translate, Action, C } from 'Lib';
|
||||
import { menuStore, recordStore } from 'Store';
|
||||
import { menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -59,7 +59,7 @@ const MenuDataviewFileList = observer(class MenuDataviewFileList extends React.C
|
|||
return null;
|
||||
};
|
||||
|
||||
const type = recordStore.getTypeById(item.type);
|
||||
const type = S.Record.getTypeById(item.type);
|
||||
|
||||
let content = null;
|
||||
if (item.isDiv) {
|
||||
|
|
|
@ -5,11 +5,11 @@ import arrayMove from 'array-move';
|
|||
import { SortableContainer } from 'react-sortable-hoc';
|
||||
import $ from 'jquery';
|
||||
import { Icon } from 'Component';
|
||||
import { recordStore, menuStore, blockStore } from 'Store';
|
||||
import { I, C, UtilCommon, keyboard, analytics, Relation, translate } from 'Lib';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
import { I, C, S, UtilCommon, keyboard, analytics, Relation, translate } from 'Lib';
|
||||
import Item from 'Component/menu/item/filter';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
const HEIGHT = 48;
|
||||
const LIMIT = 20;
|
||||
|
||||
|
@ -41,7 +41,7 @@ const MenuFilterList = observer(class MenuFilterList extends React.Component<I.M
|
|||
return null;
|
||||
};
|
||||
|
||||
const subId = recordStore.getSubId(rootId, blockId);
|
||||
const subId = S.Record.getSubId(rootId, blockId);
|
||||
const isReadonly = this.isReadonly();
|
||||
const filterCnt = view.filters.length;
|
||||
const items = this.getItems();
|
||||
|
@ -309,7 +309,7 @@ const MenuFilterList = observer(class MenuFilterList extends React.Component<I.M
|
|||
return UtilCommon.objectCopy(view.filters || []).map((it: any) => {
|
||||
return {
|
||||
...it,
|
||||
relation: recordStore.getRelationByKey(it.relationKey),
|
||||
relation: S.Record.getRelationByKey(it.relationKey),
|
||||
};
|
||||
}).filter(it => it.relation);
|
||||
};
|
||||
|
|
|
@ -2,9 +2,9 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observable } from 'mobx';
|
||||
import { observer } from 'mobx-react';
|
||||
import { I, UtilCommon, translate, keyboard, analytics, Relation, UtilDate, UtilObject } from 'Lib';
|
||||
import { I, S, UtilCommon, translate, keyboard, analytics, Relation, UtilDate, UtilObject } from 'Lib';
|
||||
import { Select, Tag, Icon, IconObject, Input, MenuItemVertical } from 'Component';
|
||||
import { menuStore, recordStore, detailStore, blockStore } from 'Store';
|
||||
import { menuStore, detailStore, blockStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const TIMEOUT = 1000;
|
||||
|
@ -52,8 +52,8 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
};
|
||||
|
||||
const isReadonly = this.isReadonly();
|
||||
const subId = recordStore.getSubId(rootId, blockId);
|
||||
const relation: any = recordStore.getRelationByKey(item.relationKey) || {};
|
||||
const subId = S.Record.getSubId(rootId, blockId);
|
||||
const relation: any = S.Record.getRelationByKey(item.relationKey) || {};
|
||||
const relationOptions = this.getRelationOptions();
|
||||
const conditionOptions = Relation.filterConditionsByType(relation.format);
|
||||
const checkboxOptions: I.Option[] = [
|
||||
|
@ -135,7 +135,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
case I.RelationType.File:
|
||||
case I.RelationType.Object: {
|
||||
Item = (element: any) => {
|
||||
const type = recordStore.getTypeById(element.type);
|
||||
const type = S.Record.getTypeById(element.type);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
@ -319,7 +319,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
this.props.setActive();
|
||||
|
||||
const item = view.getFilter(itemId);
|
||||
const relation = recordStore.getRelationByKey(item.relationKey);
|
||||
const relation = S.Record.getRelationByKey(item.relationKey);
|
||||
|
||||
if (relation && this.refInput) {
|
||||
const isDate = relation.format == I.RelationType.Date;
|
||||
|
@ -385,7 +385,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
};
|
||||
|
||||
const item = view.getFilter(itemId);
|
||||
const relation: any = recordStore.getRelationByKey(item.relationKey) || {};
|
||||
const relation: any = S.Record.getRelationByKey(item.relationKey) || {};
|
||||
const relationOptions = this.getRelationOptions();
|
||||
const relationOption: any = relationOptions.find(it => it.id == item.relationKey) || {};
|
||||
|
||||
|
@ -491,7 +491,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
return;
|
||||
};
|
||||
|
||||
const relation = recordStore.getRelationByKey(item.relationKey);
|
||||
const relation = S.Record.getRelationByKey(item.relationKey);
|
||||
if (!relation) {
|
||||
return;
|
||||
};
|
||||
|
@ -505,7 +505,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
|
||||
// Remove value when we change relation, filter non unique entries
|
||||
if (k == 'relationKey') {
|
||||
const relation = recordStore.getRelationByKey(v);
|
||||
const relation = S.Record.getRelationByKey(v);
|
||||
const conditions = Relation.filterConditionsByType(relation.format);
|
||||
|
||||
item.condition = conditions.length ? conditions[0].id : I.FilterCondition.None;
|
||||
|
@ -643,7 +643,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
const { data } = param;
|
||||
const { rootId, blockId, getView, itemId } = data;
|
||||
const item = getView().getFilter(itemId);
|
||||
const relation = recordStore.getRelationByKey(item.relationKey);
|
||||
const relation = S.Record.getRelationByKey(item.relationKey);
|
||||
|
||||
menuStore.closeAll([ 'dataviewOptionList', 'select' ], () => {
|
||||
menuStore.open('dataviewOptionList', {
|
||||
|
@ -674,7 +674,7 @@ const MenuDataviewFilterValues = observer(class MenuDataviewFilterValues extends
|
|||
const { param, getId, getSize } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, blockId } = data;
|
||||
const relation = recordStore.getRelationByKey(item.relationKey);
|
||||
const relation = S.Record.getRelationByKey(item.relationKey);
|
||||
const filters = [];
|
||||
|
||||
if (relation.format == I.RelationType.File) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { I, C, Dataview, UtilMenu, keyboard, Relation, translate } from 'Lib';
|
||||
import { I, C, S, Dataview, UtilMenu, keyboard, Relation, translate } from 'Lib';
|
||||
import { MenuItemVertical } from 'Component';
|
||||
import { recordStore } from 'Store';
|
||||
|
||||
const MenuGroupEdit = observer(class MenuGroupEdit extends React.Component<I.Menu> {
|
||||
|
||||
|
@ -51,7 +50,7 @@ const MenuGroupEdit = observer(class MenuGroupEdit extends React.Component<I.Men
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, blockId, groupId } = data;
|
||||
const group = recordStore.getGroup(rootId, blockId, groupId);
|
||||
const group = S.Record.getGroup(rootId, blockId, groupId);
|
||||
|
||||
if (group) {
|
||||
this.color = group.bgColor;
|
||||
|
@ -133,8 +132,8 @@ const MenuGroupEdit = observer(class MenuGroupEdit extends React.Component<I.Men
|
|||
return;
|
||||
};
|
||||
|
||||
const relation = recordStore.getRelationByKey(view.groupRelationKey);
|
||||
const groups = recordStore.getGroups(rootId, blockId);
|
||||
const relation = S.Record.getRelationByKey(view.groupRelationKey);
|
||||
const groups = S.Record.getGroups(rootId, blockId);
|
||||
const update: any[] = [];
|
||||
|
||||
groups.forEach((it: any, i: number) => {
|
||||
|
@ -146,7 +145,7 @@ const MenuGroupEdit = observer(class MenuGroupEdit extends React.Component<I.Men
|
|||
update.push(item);
|
||||
});
|
||||
|
||||
recordStore.groupsSet(rootId, blockId, update);
|
||||
S.Record.groupsSet(rootId, blockId, update);
|
||||
Dataview.groupUpdate(rootId, blockId, view.id, update);
|
||||
C.BlockDataviewGroupOrderUpdate(rootId, blockId, { viewId: view.id, groups: update });
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@ import { SortableContainer, SortableElement, SortableHandle } from 'react-sortab
|
|||
import $ from 'jquery';
|
||||
import { Icon, Switch } from 'Component';
|
||||
import Cell from 'Component/block/dataview/cell';
|
||||
import { I, C, Dataview, keyboard, translate } from 'Lib';
|
||||
import { menuStore, recordStore, blockStore } from 'Store';
|
||||
import { I, C, S, Dataview, keyboard, translate } from 'Lib';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const HEIGHT = 28;
|
||||
|
@ -46,7 +47,7 @@ const MenuGroupList = observer(class MenuGroupList extends React.Component<I.Men
|
|||
const Item = SortableElement((item: any) => {
|
||||
const canHide = allowedView;
|
||||
const canEdit = !readonly && allowedView;
|
||||
const subId = recordStore.getSubId(rootId, [ blockId, item.id ].join(':'));
|
||||
const subId = S.Record.getSubId(rootId, [ blockId, item.id ].join(':'));
|
||||
const cn = [ 'item' ];
|
||||
const head = {};
|
||||
|
||||
|
@ -230,7 +231,7 @@ const MenuGroupList = observer(class MenuGroupList extends React.Component<I.Men
|
|||
const { data } = param;
|
||||
const { rootId, blockId } = data;
|
||||
|
||||
recordStore.groupsSet(rootId, blockId, arrayMove(this.getItems(), oldIndex, newIndex));
|
||||
S.Record.groupsSet(rootId, blockId, arrayMove(this.getItems(), oldIndex, newIndex));
|
||||
this.save();
|
||||
|
||||
keyboard.disableSelection(false);
|
||||
|
@ -256,7 +257,7 @@ const MenuGroupList = observer(class MenuGroupList extends React.Component<I.Men
|
|||
update.push({ ...it, groupId: it.id, index: i });
|
||||
});
|
||||
|
||||
recordStore.groupsSet(rootId, blockId, groups);
|
||||
S.Record.groupsSet(rootId, blockId, groups);
|
||||
Dataview.groupUpdate(rootId, blockId, view.id, update);
|
||||
C.BlockDataviewGroupOrderUpdate(rootId, blockId, { viewId: view.id, groups: update });
|
||||
};
|
||||
|
@ -272,7 +273,7 @@ const MenuGroupList = observer(class MenuGroupList extends React.Component<I.Men
|
|||
const { data } = param;
|
||||
const { rootId, blockId } = data;
|
||||
|
||||
return recordStore.getGroups(rootId, blockId);
|
||||
return S.Record.getGroups(rootId, blockId);
|
||||
};
|
||||
|
||||
resize () {
|
||||
|
|
|
@ -3,8 +3,8 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
import { Filter, MenuItemVertical, Icon, Loader, ObjectName } from 'Component';
|
||||
import { I, UtilCommon, keyboard, UtilData, UtilObject, Relation, translate, analytics } from 'Lib';
|
||||
import { menuStore, recordStore } from 'Store';
|
||||
import { I, S, UtilCommon, keyboard, UtilData, UtilObject, Relation, translate } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface State {
|
||||
|
@ -59,7 +59,7 @@ const MenuDataviewObjectList = observer(class MenuDataviewObjectList extends Rea
|
|||
return null;
|
||||
};
|
||||
|
||||
const type = recordStore.getTypeById(item.type);
|
||||
const type = S.Record.getTypeById(item.type);
|
||||
const name = <ObjectName object={item} />;
|
||||
|
||||
let content = null;
|
||||
|
@ -324,7 +324,7 @@ const MenuDataviewObjectList = observer(class MenuDataviewObjectList extends Rea
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
|
||||
return (data.types || []).map(id => recordStore.getTypeById(id)).filter(it => it);
|
||||
return (data.types || []).map(id => S.Record.getTypeById(id)).filter(it => it);
|
||||
};
|
||||
|
||||
getTypeNames (): string {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
import { Icon, Tag, Filter } from 'Component';
|
||||
import { I, C, S, UtilCommon, UtilMenu, keyboard, Relation, translate } from 'Lib';
|
||||
import { menuStore, recordStore } from 'Store';
|
||||
import { menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -369,7 +369,7 @@ const MenuOptionList = observer(class MenuOptionList extends React.Component<I.M
|
|||
const value = Relation.getArrayValue(data.value);
|
||||
const ret = [];
|
||||
|
||||
let items = Relation.getOptions(recordStore.getRecordIds(Constant.subId.option, '')).filter(it => it.relationKey == relation.relationKey);
|
||||
let items = Relation.getOptions(S.Record.getRecordIds(Constant.subId.option, '')).filter(it => it.relationKey == relation.relationKey);
|
||||
let check = [];
|
||||
|
||||
items.filter(it => !it._empty_ && !it.isArchived && !it.isDeleted);
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { observable } from 'mobx';
|
||||
import { I, C, S, UtilObject, UtilMenu, Relation, translate, Dataview, keyboard, analytics, Preview, UtilCommon } from 'Lib';
|
||||
import { Icon, Input, MenuItemVertical, Button } from 'Component';
|
||||
import { blockStore, recordStore, menuStore, detailStore } from 'Store';
|
||||
import { blockStore, menuStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -46,7 +46,7 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
if (isObject && !isReadonly && (!relation || !relation.isReadonlyValue)) {
|
||||
const length = this.objectTypes.length;
|
||||
const typeId = length ? this.objectTypes[0] : '';
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
const typeProps: any = {
|
||||
name: translate('menuDataviewRelationEditSelectObjectType'),
|
||||
caption: (length > 1 ? '+' + (length - 1) : ''),
|
||||
|
@ -454,13 +454,13 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
nameAdd: translate('menuDataviewRelationEditAddObjectType'),
|
||||
placeholderFocus: translate('menuDataviewRelationEditFilterObjectTypes'),
|
||||
value: this.objectTypes,
|
||||
types: [ recordStore.getTypeType()?.id ],
|
||||
types: [ S.Record.getTypeType()?.id ],
|
||||
filters: [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.Equal, value: I.ObjectLayout.Type },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'recommendedLayout', condition: I.FilterCondition.NotIn, value: UtilObject.getSystemLayouts() },
|
||||
],
|
||||
relation: observable.box(relation),
|
||||
valueMapper: it => recordStore.getTypeById(it.id),
|
||||
valueMapper: it => S.Record.getTypeById(it.id),
|
||||
onChange: (value: any, callBack?: () => void) => {
|
||||
this.objectTypes = value;
|
||||
this.forceUpdate();
|
||||
|
@ -655,7 +655,7 @@ const MenuRelationEdit = observer(class MenuRelationEdit extends React.Component
|
|||
const { data } = param;
|
||||
const { relationId } = data;
|
||||
|
||||
return recordStore.getRelationById(relationId);
|
||||
return S.Record.getRelationById(relationId);
|
||||
};
|
||||
|
||||
getViewRelation (): I.ViewRelation {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { AutoSizer, CellMeasurer, InfiniteLoader, List as VList, CellMeasurerCac
|
|||
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
||||
import { Icon, Switch } from 'Component';
|
||||
import { I, C, S, Relation, keyboard, Dataview, translate } from 'Lib';
|
||||
import { menuStore, recordStore, blockStore } from 'Store';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const HEIGHT = 28;
|
||||
|
@ -268,7 +268,7 @@ const MenuRelationList = observer(class MenuRelationList extends React.Component
|
|||
const { param, getId } = this.props;
|
||||
const { data } = param;
|
||||
const { readonly } = data;
|
||||
const relation = recordStore.getRelationByKey(item.relationKey);
|
||||
const relation = S.Record.getRelationByKey(item.relationKey);
|
||||
|
||||
if (!relation || readonly) {
|
||||
return;
|
||||
|
@ -326,7 +326,7 @@ const MenuRelationList = observer(class MenuRelationList extends React.Component
|
|||
return Dataview.viewGetRelations(rootId, blockId, view).map((it: any) => ({
|
||||
...it,
|
||||
id: it.relationKey,
|
||||
relation: recordStore.getRelationByKey(it.relationKey) || {},
|
||||
relation: S.Record.getRelationByKey(it.relationKey) || {},
|
||||
}));
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ import { AutoSizer, CellMeasurer, InfiniteLoader, List as VList, CellMeasurerCac
|
|||
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
||||
import { Icon, IconObject, Select } from 'Component';
|
||||
import { I, C, S, Relation, UtilCommon, keyboard, analytics, translate } from 'Lib';
|
||||
import { menuStore, recordStore, blockStore } from 'Store';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const HEIGHT = 48;
|
||||
|
@ -57,7 +58,7 @@ const MenuSort = observer(class MenuSort extends React.Component<I.Menu> {
|
|||
));
|
||||
|
||||
const Item = SortableElement((item: any) => {
|
||||
const relation: any = recordStore.getRelationByKey(item.relationKey) || {};
|
||||
const relation: any = S.Record.getRelationByKey(item.relationKey) || {};
|
||||
return (
|
||||
<div
|
||||
id={'item-' + item.id}
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { MenuItemVertical } from 'Component';
|
||||
import { analytics, C, I, S, keyboard, UtilObject, translate, Action, Preview } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
class MenuTemplateContext extends React.Component<I.Menu> {
|
||||
|
@ -91,7 +91,7 @@ class MenuTemplateContext extends React.Component<I.Menu> {
|
|||
|
||||
case 'duplicate': {
|
||||
if (template.id == Constant.templateId.blank) {
|
||||
const type = recordStore.getTypeById(template.targetObjectType);
|
||||
const type = S.Record.getTypeById(template.targetObjectType);
|
||||
if (!type) {
|
||||
break;
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import { Icon, Title, PreviewObject, IconObject } from 'Component';
|
||||
import { C, I, UtilObject, translate, UtilData, UtilCommon, keyboard } from 'Lib';
|
||||
import { recordStore, menuStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
import { C, I, S, UtilObject, translate, UtilData, UtilCommon, keyboard } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
import { observer } from 'mobx-react';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
const TEMPLATE_WIDTH = 230;
|
||||
|
||||
const MenuTemplateList = observer(class MenuTemplateList extends React.Component<I.Menu> {
|
||||
|
@ -38,7 +38,7 @@ const MenuTemplateList = observer(class MenuTemplateList extends React.Component
|
|||
const previewSize = data.previewSize || I.PreviewSize.Small;
|
||||
const templateId = this.getTemplateId();
|
||||
const items = this.getItems();
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
const isAllowed = UtilObject.isAllowedTemplate(typeId);
|
||||
|
||||
const ItemBlank = (item: any) => {
|
||||
|
@ -197,7 +197,7 @@ const MenuTemplateList = observer(class MenuTemplateList extends React.Component
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { typeId } = data;
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
|
||||
const filters: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.Equal, value: templateType?.id },
|
||||
|
@ -244,7 +244,7 @@ const MenuTemplateList = observer(class MenuTemplateList extends React.Component
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { noAdd, typeId } = data;
|
||||
const items = recordStore.getRecords(this.getSubId());
|
||||
const items = S.Record.getRecords(this.getSubId());
|
||||
const isAllowed = UtilObject.isAllowedTemplate(typeId);
|
||||
|
||||
items.unshift({ id: Constant.templateId.blank });
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { I, C, analytics, keyboard, Key, translate, Dataview, UtilMenu, Relation, UtilCommon } from 'Lib';
|
||||
import { I, C, S, analytics, keyboard, translate, Dataview, UtilMenu, Relation, UtilCommon } from 'Lib';
|
||||
import { Label, Icon, MenuItemVertical } from 'Component';
|
||||
import { blockStore, recordStore, menuStore } from 'Store';
|
||||
import { blockStore, menuStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const MenuViewLayout = observer(class MenuViewLayout extends React.Component<I.Menu> {
|
||||
|
|
|
@ -5,9 +5,8 @@ import { observer } from 'mobx-react';
|
|||
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
||||
import { AutoSizer, CellMeasurer, InfiniteLoader, List as VList, CellMeasurerCache } from 'react-virtualized';
|
||||
import { Icon } from 'Component';
|
||||
import { I, C, UtilCommon, keyboard, Relation, analytics, UtilObject, translate, UtilMenu, Dataview } from 'Lib';
|
||||
import { menuStore, recordStore, blockStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
import { I, C, S, UtilCommon, keyboard, Relation, analytics, translate, UtilMenu, Dataview } from 'Lib';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
|
||||
const HEIGHT = 28;
|
||||
const LIMIT = 20;
|
||||
|
@ -201,7 +200,7 @@ const MenuViewList = observer(class MenuViewList extends React.Component<I.Menu>
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, blockId } = data;
|
||||
const items: any[] = UtilCommon.objectCopy(recordStore.getViews(rootId, blockId)).map(it => ({
|
||||
const items: any[] = UtilCommon.objectCopy(S.Record.getViews(rootId, blockId)).map(it => ({
|
||||
...it, name: it.name || translate('defaultNamePage'),
|
||||
}));
|
||||
|
||||
|
@ -238,7 +237,7 @@ const MenuViewList = observer(class MenuViewList extends React.Component<I.Menu>
|
|||
return;
|
||||
};
|
||||
|
||||
const view = recordStore.getView(rootId, blockId, message.viewId);
|
||||
const view = S.Record.getView(rootId, blockId, message.viewId);
|
||||
|
||||
close();
|
||||
window.setTimeout(() => onViewSwitch(view), menuStore.getTimeout());
|
||||
|
@ -280,10 +279,10 @@ const MenuViewList = observer(class MenuViewList extends React.Component<I.Menu>
|
|||
const { close, param } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, blockId, isInline, getTarget } = data;
|
||||
const subId = recordStore.getSubId(rootId, blockId);
|
||||
const subId = S.Record.getSubId(rootId, blockId);
|
||||
const object = getTarget();
|
||||
|
||||
recordStore.metaSet(subId, '', { viewId: item.id });
|
||||
S.Record.metaSet(subId, '', { viewId: item.id });
|
||||
C.BlockDataviewViewSetActive(rootId, blockId, item.id);
|
||||
|
||||
analytics.event('SwitchView', {
|
||||
|
@ -303,7 +302,7 @@ const MenuViewList = observer(class MenuViewList extends React.Component<I.Menu>
|
|||
const { param } = this.props;
|
||||
const { data } = param;
|
||||
const { rootId, blockId } = data;
|
||||
const views = recordStore.getViews(rootId, blockId);
|
||||
const views = S.Record.getViews(rootId, blockId);
|
||||
const oldIndex = result.oldIndex - 1;
|
||||
const newIndex = result.newIndex - 1;
|
||||
const view = views[oldIndex];
|
||||
|
@ -313,7 +312,7 @@ const MenuViewList = observer(class MenuViewList extends React.Component<I.Menu>
|
|||
|
||||
const ids = arrayMove(views.map(it => it.id), oldIndex, newIndex);
|
||||
|
||||
recordStore.viewsSort(rootId, blockId, ids);
|
||||
S.Record.viewsSort(rootId, blockId, ids);
|
||||
C.BlockDataviewViewSetPosition(rootId, blockId, view.id, newIndex);
|
||||
keyboard.disableSelection(false);
|
||||
};
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { I, C, analytics, keyboard, Key, translate, Dataview, UtilMenu, Relation, UtilCommon, UtilData, UtilObject } from 'Lib';
|
||||
import { I, C, S, analytics, keyboard, Key, translate, Dataview, UtilCommon } from 'Lib';
|
||||
import { InputWithLabel, MenuItemVertical } from 'Component';
|
||||
import { blockStore, recordStore, detailStore, menuStore } from 'Store';
|
||||
import { blockStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const MenuViewSettings = observer(class MenuViewSettings extends React.Component<I.Menu> {
|
||||
|
@ -222,16 +223,16 @@ const MenuViewSettings = observer(class MenuViewSettings extends React.Component
|
|||
const { data } = param;
|
||||
const { rootId, blockId } = data;
|
||||
const { id, type } = this.param;
|
||||
const views = recordStore.getViews(rootId, blockId);
|
||||
const views = S.Record.getViews(rootId, blockId);
|
||||
const view = data.view.get();
|
||||
const isReadonly = this.isReadonly();
|
||||
const isBoard = type == I.ViewType.Board;
|
||||
const sortCnt = view.sorts.length;
|
||||
const filters = view.filters.filter(it => recordStore.getRelationByKey(it.relationKey));
|
||||
const filters = view.filters.filter(it => S.Record.getRelationByKey(it.relationKey));
|
||||
const filterCnt = filters.length;
|
||||
|
||||
const relations = view.getVisibleRelations().map((it) => {
|
||||
const relation = recordStore.getRelationByKey(it.relationKey) || {};
|
||||
const relation = S.Record.getRelationByKey(it.relationKey) || {};
|
||||
return relation ? UtilCommon.shorten(relation.name || '', 16) : '';
|
||||
}).filter(it => it);
|
||||
|
||||
|
@ -352,7 +353,7 @@ const MenuViewSettings = observer(class MenuViewSettings extends React.Component
|
|||
};
|
||||
|
||||
case 'remove': {
|
||||
const views = recordStore.getViews(rootId, blockId);
|
||||
const views = S.Record.getViews(rootId, blockId);
|
||||
const idx = views.findIndex(it => it.id == view.id);
|
||||
const filtered = views.filter(it => it.id != view.id);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import arrayMove from 'array-move';
|
|||
import { SortableContainer, SortableElement } from 'react-sortable-hoc';
|
||||
import { IconObject, ObjectName, Icon, Filter } from 'Component';
|
||||
import { analytics, C, I, S, keyboard, UtilObject, UtilMenu, translate, UtilData, UtilCommon, Action, Storage, Preview } from 'Lib';
|
||||
import { recordStore, menuStore, blockStore } from 'Store';
|
||||
import { menuStore, blockStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -307,12 +307,12 @@ class MenuQuickCapture extends React.Component<I.Menu, State> {
|
|||
});
|
||||
};
|
||||
} else {
|
||||
const pinned = pinnedIds.map(id => recordStore.getTypeById(id)).filter(it => it).slice(0, LIMIT_PINNED);
|
||||
const pinned = pinnedIds.map(id => S.Record.getTypeById(id)).filter(it => it).slice(0, LIMIT_PINNED);
|
||||
|
||||
items = UtilData.getObjectTypesForNewObject().filter(it => !pinnedIds.includes(it.id));
|
||||
items = items.slice(0, LIMIT_PINNED - pinned.length);
|
||||
items.push(recordStore.getSetType());
|
||||
items.push(recordStore.getCollectionType());
|
||||
items.push(S.Record.getSetType());
|
||||
items.push(S.Record.getCollectionType());
|
||||
items = [].concat(pinned, items);
|
||||
items = items.filter(it => it);
|
||||
|
||||
|
@ -492,7 +492,7 @@ class MenuQuickCapture extends React.Component<I.Menu, State> {
|
|||
|
||||
const { getId, param } = this.props;
|
||||
const { className, classNameWrap } = param;
|
||||
const type = recordStore.getTypeById(item.itemId);
|
||||
const type = S.Record.getTypeById(item.itemId);
|
||||
const isPinned = Storage.getPinnedTypes().includes(item.itemId);
|
||||
const canPin = type.isInstalled;
|
||||
const canDefault = type.isInstalled && !UtilObject.getSetLayouts().includes(item.recommendedLayout) && (type.id != S.Common.type);
|
||||
|
@ -597,7 +597,7 @@ class MenuQuickCapture extends React.Component<I.Menu, State> {
|
|||
};
|
||||
|
||||
async onPaste () {
|
||||
const type = recordStore.getTypeById(S.Common.type);
|
||||
const type = S.Record.getTypeById(S.Common.type);
|
||||
const data = await this.getClipboardData();
|
||||
|
||||
data.forEach(async item => {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
import { MenuItemVertical, Filter, Loader, ObjectName, EmptySearch } from 'Component';
|
||||
import { I, C, S, keyboard, UtilCommon, UtilData, UtilObject, Preview, analytics, Action, focus, translate, UtilSpace } from 'Lib';
|
||||
import { recordStore, detailStore } from 'Store';
|
||||
import { detailStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface State {
|
||||
|
@ -64,7 +64,7 @@ const MenuSearchObject = observer(class MenuSearchObject extends React.Component
|
|||
return null;
|
||||
};
|
||||
|
||||
const type = recordStore.getTypeById(item.type);
|
||||
const type = S.Record.getTypeById(item.type);
|
||||
const checkbox = value && value.length && value.includes(item.id);
|
||||
const cn = [];
|
||||
|
||||
|
@ -289,7 +289,7 @@ const MenuSearchObject = observer(class MenuSearchObject extends React.Component
|
|||
const { data } = param;
|
||||
const { type, dataMapper, dataSort, dataChange, skipIds, keys, ignoreWorkspace } = data;
|
||||
const filter = String(data.filter || '');
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
|
||||
const filters: any[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: UtilObject.excludeFromSet() },
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
import { Filter, Icon, MenuItemVertical, Loader } from 'Component';
|
||||
import { I, C, S, analytics, keyboard, UtilData, Action, UtilCommon, translate, UtilSpace } from 'Lib';
|
||||
import { detailStore, menuStore, recordStore } from 'Store';
|
||||
import { detailStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -464,7 +464,7 @@ const MenuTypeSuggest = observer(class MenuTypeSuggest extends React.Component<I
|
|||
};
|
||||
|
||||
getLibrarySources () {
|
||||
return recordStore.getTypes().filter(it => (it.spaceId == S.Common.space)).map(it => it.sourceObject).filter(it => it);
|
||||
return S.Record.getTypes().filter(it => (it.spaceId == S.Common.space)).map(it => it.sourceObject).filter(it => it);
|
||||
};
|
||||
|
||||
resize () {
|
||||
|
|
|
@ -2,8 +2,9 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { MenuItemVertical, Button } from 'Component';
|
||||
import { C, I, keyboard, UtilMenu, translate, Action, UtilObject, analytics } from 'Lib';
|
||||
import { blockStore, menuStore, recordStore } from 'Store';
|
||||
import { C, I, S, keyboard, UtilMenu, translate, Action, UtilObject, analytics } from 'Lib';
|
||||
import { blockStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const MenuWidget = observer(class MenuWidget extends React.Component<I.Menu> {
|
||||
|
@ -284,7 +285,7 @@ const MenuWidget = observer(class MenuWidget extends React.Component<I.Menu> {
|
|||
|
||||
switch (item.itemId) {
|
||||
case 'source': {
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const filters: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: UtilObject.getSystemLayouts() },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.NotEqual, value: templateType?.id },
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import * as React from 'react';
|
||||
import $ from 'jquery';
|
||||
import { IconObject, Label, ObjectName } from 'Component';
|
||||
import { I, Action, translate, UtilObject, UtilCommon, C, analytics, Onboarding } from 'Lib';
|
||||
import { recordStore, menuStore } from 'Store';
|
||||
import { I, S, Action, translate, UtilObject, UtilCommon, C, analytics, Onboarding } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface Props {
|
||||
|
@ -39,7 +40,7 @@ class HeaderBanner extends React.Component<Props> {
|
|||
};
|
||||
|
||||
case I.BannerType.IsTemplate: {
|
||||
const targetObjectType = recordStore.getTypeById(object.targetObjectType);
|
||||
const targetObjectType = S.Record.getTypeById(object.targetObjectType);
|
||||
|
||||
label = translate('templateBannner');
|
||||
if (targetObjectType) {
|
||||
|
@ -96,7 +97,7 @@ class HeaderBanner extends React.Component<Props> {
|
|||
onTemplateMenu () {
|
||||
const { object, isPopup } = this.props;
|
||||
const { sourceObject } = object;
|
||||
const type = recordStore.getTypeById(object.type);
|
||||
const type = S.Record.getTypeById(object.type);
|
||||
const templateId = sourceObject || Constant.templateId.blank;
|
||||
const node = $(this.node);
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { IconObject, Block, Button, Editable } from 'Component';
|
||||
import { I, M, Action, UtilData, UtilObject, focus, keyboard, Relation, translate, UtilSpace } from 'Lib';
|
||||
import { blockStore, detailStore, recordStore } from 'Store';
|
||||
import { I, M, S, Action, UtilData, UtilObject, focus, keyboard, Relation, translate, UtilSpace } from 'Lib';
|
||||
import { blockStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface Props {
|
||||
|
@ -277,12 +278,12 @@ const HeadSimple = observer(class Controls extends React.Component<Props> {
|
|||
|
||||
switch (object.layout) {
|
||||
case I.ObjectLayout.Type: {
|
||||
sources = recordStore.getTypes().map(it => it.sourceObject);
|
||||
sources = S.Record.getTypes().map(it => it.sourceObject);
|
||||
break;
|
||||
};
|
||||
|
||||
case I.ObjectLayout.Relation: {
|
||||
sources = recordStore.getRelations().map(it => it.sourceObject);
|
||||
sources = S.Record.getRelations().map(it => it.sourceObject);
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Header, Footer, Loader, ListObject, Deleted } from 'Component';
|
||||
import { I, C, S, Action, UtilCommon, UtilObject, UtilRouter, translate, UtilDate } from 'Lib';
|
||||
import { detailStore, recordStore } from 'Store';
|
||||
import { detailStore } from 'Store';
|
||||
import HeadSimple from 'Component/page/elements/head/simple';
|
||||
|
||||
interface State {
|
||||
|
@ -36,10 +36,10 @@ const PageMainRelation = observer(class PageMainRelation extends React.Component
|
|||
|
||||
const rootId = this.getRootId();
|
||||
const object = detailStore.get(rootId, rootId);
|
||||
const subIdType = recordStore.getSubId(rootId, 'type');
|
||||
const totalType = recordStore.getMeta(subIdType, '').total;
|
||||
const subIdObject = recordStore.getSubId(rootId, 'object');
|
||||
const totalObject = recordStore.getMeta(subIdObject, '').total;
|
||||
const subIdType = S.Record.getSubId(rootId, 'type');
|
||||
const totalType = S.Record.getMeta(subIdType, '').total;
|
||||
const subIdObject = S.Record.getSubId(rootId, 'object');
|
||||
const totalObject = S.Record.getMeta(subIdObject, '').total;
|
||||
const columnsObject: any[] = [
|
||||
{
|
||||
relationKey: 'lastModifiedDate', name: translate('commonUpdated'),
|
||||
|
|
|
@ -4,7 +4,7 @@ import raf from 'raf';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Header, Footer, Loader, Block, Deleted } from 'Component';
|
||||
import { I, M, C, S, UtilData, UtilCommon, Action, UtilSpace, keyboard, UtilRouter, translate, UtilObject } from 'Lib';
|
||||
import { blockStore, detailStore, recordStore, menuStore } from 'Store';
|
||||
import { blockStore, detailStore, menuStore } from 'Store';
|
||||
import Controls from 'Component/page/elements/head/controls';
|
||||
import HeadSimple from 'Component/page/elements/head/simple';
|
||||
|
||||
|
@ -246,7 +246,7 @@ const PageMainSet = observer(class PageMainSet extends React.Component<I.PageCom
|
|||
keyboard.shortcut(`${cmd}+a`, e, () => {
|
||||
e.preventDefault();
|
||||
|
||||
const records = recordStore.getRecordIds(recordStore.getSubId(rootId, Constant.blockId.dataview), '');
|
||||
const records = S.Record.getRecordIds(S.Record.getSubId(rootId, Constant.blockId.dataview), '');
|
||||
selection.set(I.SelectType.Record, records);
|
||||
});
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache, WindowScroller } from 'react-virtualized';
|
||||
import { Title, Icon, IconObject, Header, Footer, Filter, Button, EmptySearch } from 'Component';
|
||||
import { I, C, S, UtilData, UtilObject, UtilCommon, Storage, Onboarding, analytics, Action, keyboard, translate, UtilSpace } from 'Lib';
|
||||
import { recordStore, blockStore, menuStore, popupStore } from 'Store';
|
||||
import { blockStore, menuStore, popupStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -534,7 +534,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
|
||||
if (clear) {
|
||||
this.setState({ isLoading: true });
|
||||
recordStore.recordsSet(Constant.subId.store, '', []);
|
||||
S.Record.recordsSet(Constant.subId.store, '', []);
|
||||
};
|
||||
|
||||
UtilData.searchSubscribe({
|
||||
|
@ -567,7 +567,7 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
|
||||
getItems () {
|
||||
const { isLoading } = this.state;
|
||||
const records = recordStore.getRecords(Constant.subId.store);
|
||||
const records = S.Record.getRecords(Constant.subId.store);
|
||||
const limit = this.getLimit();
|
||||
|
||||
let ret: any[] = [
|
||||
|
@ -625,11 +625,11 @@ const PageMainStore = observer(class PageMainStore extends React.Component<I.Pag
|
|||
|
||||
switch (this.tab) {
|
||||
case I.StoreTab.Type:
|
||||
sources = recordStore.getTypes();
|
||||
sources = S.Record.getTypes();
|
||||
break;
|
||||
|
||||
case I.StoreTab.Relation:
|
||||
sources = recordStore.getRelations();
|
||||
sources = S.Record.getRelations();
|
||||
break;
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import $ from 'jquery';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Icon, Header, Footer, Loader, ListObjectPreview, ListObject, Select, Deleted } from 'Component';
|
||||
import { I, C, S, UtilData, UtilObject, UtilMenu, UtilCommon, focus, Action, analytics, Relation, translate, UtilDate, UtilRouter, UtilSpace } from 'Lib';
|
||||
import { detailStore, recordStore, menuStore, blockStore } from 'Store';
|
||||
import { detailStore, menuStore, blockStore } from 'Store';
|
||||
import Controls from 'Component/page/elements/head/controls';
|
||||
import HeadSimple from 'Component/page/elements/head/simple';
|
||||
|
||||
|
@ -53,7 +53,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
const check = UtilData.checkDetails(rootId);
|
||||
const object = detailStore.get(rootId, rootId);
|
||||
const subIdTemplate = this.getSubIdTemplate();
|
||||
const templates = recordStore.getRecordIds(subIdTemplate, '');
|
||||
const templates = S.Record.getRecordIds(subIdTemplate, '');
|
||||
const canWrite = UtilSpace.canMyParticipantWrite();
|
||||
|
||||
const layout: any = UtilMenu.getLayouts().find(it => it.id == object.recommendedLayout) || {};
|
||||
|
@ -67,7 +67,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
const allowedLayout = object.recommendedLayout != I.ObjectLayout.Bookmark;
|
||||
|
||||
const subIdObject = this.getSubIdObject();
|
||||
const totalObject = recordStore.getMeta(subIdObject, '').total;
|
||||
const totalObject = S.Record.getMeta(subIdObject, '').total;
|
||||
const totalTemplate = templates.length + (allowedTemplate ? 1 : 0);
|
||||
const filtersObject: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'spaceId', condition: I.FilterCondition.Equal, value: this.getSpaceId() },
|
||||
|
@ -77,7 +77,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
recommendedRelations.push('rel-description');
|
||||
};
|
||||
|
||||
const relations = recommendedRelations.map(id => recordStore.getRelationById(id)).filter(it => {
|
||||
const relations = recommendedRelations.map(id => S.Record.getRelationById(id)).filter(it => {
|
||||
if (!it) {
|
||||
return false;
|
||||
};
|
||||
|
@ -155,7 +155,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
<ListObjectPreview
|
||||
key="listTemplate"
|
||||
ref={ref => this.refListPreview = ref}
|
||||
getItems={() => recordStore.getRecords(subIdTemplate, [])}
|
||||
getItems={() => S.Record.getRecords(subIdTemplate, [])}
|
||||
canAdd={allowedTemplate}
|
||||
onAdd={this.onTemplateAdd}
|
||||
onMenu={allowedTemplate ? (e: any, item: any) => this.onMenu(item) : null}
|
||||
|
@ -339,7 +339,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
|
||||
onCreate () {
|
||||
const rootId = this.getRootId();
|
||||
const type = recordStore.getTypeById(rootId);
|
||||
const type = S.Record.getTypeById(rootId);
|
||||
if (!type) {
|
||||
return;
|
||||
};
|
||||
|
@ -381,7 +381,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
|
||||
onObjectAdd () {
|
||||
const rootId = this.getRootId();
|
||||
const type = recordStore.getTypeById(rootId);
|
||||
const type = S.Record.getTypeById(rootId);
|
||||
|
||||
if (!type) {
|
||||
return;
|
||||
|
@ -436,7 +436,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
const rootId = this.getRootId();
|
||||
const object = detailStore.get(rootId, rootId);
|
||||
const skipSystemKeys = [ 'tag', 'description', 'source' ];
|
||||
const recommendedKeys = object.recommendedRelations.map(id => recordStore.getRelationById(id)).map(it => it && it.relationKey);
|
||||
const recommendedKeys = object.recommendedRelations.map(id => S.Record.getRelationById(id)).map(it => it && it.relationKey);
|
||||
const systemKeys = Relation.systemKeys().filter(it => !skipSystemKeys.includes(it));
|
||||
|
||||
menuStore.open('relationSuggest', {
|
||||
|
@ -464,7 +464,7 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
onRelationEdit (e: any, id: string) {
|
||||
const rootId = this.getRootId();
|
||||
const allowed = blockStore.checkFlags(rootId, rootId, [ I.RestrictionObject.Relation ]);
|
||||
const relation = recordStore.getRelationById(id);
|
||||
const relation = S.Record.getRelationById(id);
|
||||
|
||||
menuStore.open('blockRelationEdit', {
|
||||
element: `#page .section.relation #item-${id}`,
|
||||
|
@ -561,11 +561,11 @@ const PageMainType = observer(class PageMainType extends React.Component<I.PageC
|
|||
};
|
||||
|
||||
getSubIdTemplate () {
|
||||
return recordStore.getSubId(this.getRootId(), 'templates');
|
||||
return S.Record.getSubId(this.getRootId(), 'templates');
|
||||
};
|
||||
|
||||
getSubIdObject () {
|
||||
return recordStore.getSubId(this.getRootId(), 'data');
|
||||
return S.Record.getSubId(this.getRootId(), 'data');
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||
import { Icon, Title, Label, Input, IconObject, Button, ProgressBar, Error, ObjectName } from 'Component';
|
||||
import { I, C, S, UtilObject, UtilMenu, UtilCommon, UtilFile, translate, Preview, analytics, UtilDate, Action, UtilSpace } from 'Lib';
|
||||
import { observer } from 'mobx-react';
|
||||
import { menuStore, authStore, recordStore, detailStore, popupStore } from 'Store';
|
||||
import { menuStore, authStore, detailStore, popupStore } from 'Store';
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface State {
|
||||
|
@ -49,7 +49,7 @@ const PopupSettingsSpaceIndex = observer(class PopupSettingsSpaceIndex extends R
|
|||
const space = UtilSpace.getSpaceview();
|
||||
const creator = detailStore.get(Constant.subId.space, space.creator);
|
||||
const home = UtilSpace.getDashboard();
|
||||
const type = recordStore.getTypeById(S.Common.type);
|
||||
const type = S.Record.getTypeById(S.Common.type);
|
||||
const personalSpace = UtilSpace.getSpaceviewBySpaceId(accountSpaceId);
|
||||
const usageCn = [ 'item' ];
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@ import * as React from 'react';
|
|||
import $ from 'jquery';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Title, IconObject, ObjectName, Icon } from 'Component';
|
||||
import { I, UtilSpace, UtilRouter, translate, UtilMenu, analytics } from 'Lib';
|
||||
import { recordStore, detailStore, authStore } from 'Store';
|
||||
import { I, S, UtilSpace, UtilRouter, translate, UtilMenu, analytics } from 'Lib';
|
||||
import { detailStore, authStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const PopupSettingsPageSpacesList = observer(class PopupSettingsPageSpacesList extends React.Component<I.PopupSettings> {
|
||||
|
@ -64,7 +65,7 @@ const PopupSettingsPageSpacesList = observer(class PopupSettingsPageSpacesList e
|
|||
};
|
||||
|
||||
getItems () {
|
||||
const items = recordStore.getRecords(Constant.subId.space);
|
||||
const items = S.Record.getRecords(Constant.subId.space);
|
||||
|
||||
return items.filter(it => !it.isAccountDeleted && it.isLocalOk).map(it => {
|
||||
it.participant = UtilSpace.getMyParticipant(it.targetSpaceId) || {};
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Label, Button, Cell, Error, Icon, EmptySearch, Checkbox } from 'Component';
|
||||
import { I, M, C, S, UtilCommon, Relation, UtilData, translate, Dataview } from 'Lib';
|
||||
import { recordStore, popupStore, menuStore } from 'Store';
|
||||
import { popupStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -158,7 +158,7 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
let depIds = [];
|
||||
|
||||
for (const k in this.details) {
|
||||
const relation = recordStore.getRelationByKey(k);
|
||||
const relation = S.Record.getRelationByKey(k);
|
||||
|
||||
if (relation && Relation.isArrayType(relation.format)) {
|
||||
depIds = depIds.concat(Relation.getArrayValue(this.details[k]));
|
||||
|
@ -214,7 +214,7 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
getRelations (): any[] {
|
||||
const { config } = S.Common;
|
||||
|
||||
let ret = this.getRelationKeys().map(relationKey => recordStore.getRelationByKey(relationKey));
|
||||
let ret = this.getRelationKeys().map(relationKey => S.Record.getRelationByKey(relationKey));
|
||||
|
||||
ret = ret.filter(it => {
|
||||
return (config.debug.hiddenObject ? true : !it.isHidden) && !it.isReadonlyValue;
|
||||
|
@ -228,11 +228,11 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
};
|
||||
|
||||
getObjects () {
|
||||
return recordStore.getRecords(SUB_ID_OBJECT, this.getRelationKeys());
|
||||
return S.Record.getRecords(SUB_ID_OBJECT, this.getRelationKeys());
|
||||
};
|
||||
|
||||
onCellChange (id: string, relationKey: string, value: any, callBack?: (message: any) => void) {
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
if (!relation) {
|
||||
return;
|
||||
};
|
||||
|
@ -286,7 +286,7 @@ const PopupRelation = observer(class PopupRelation extends React.Component<I.Pop
|
|||
const details: any[] = [];
|
||||
|
||||
for (const k in this.details) {
|
||||
const relation = recordStore.getRelationByKey(k);
|
||||
const relation = S.Record.getRelationByKey(k);
|
||||
if (relation) {
|
||||
details.push({ key: k, value: Relation.formatValue(relation, this.details[k], true) });
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, InfiniteLoader, List, CellMeasurerCache } from 'react-virtualized';
|
||||
import { Icon, Loader, IconObject, ObjectName, EmptySearch, Label, Filter } from 'Component';
|
||||
import { C, I, S, UtilCommon, UtilData, UtilObject, UtilRouter, keyboard,focus, translate, analytics, Action, UtilSpace, Relation, Mark } from 'Lib';
|
||||
import { recordStore, popupStore, menuStore, detailStore } from 'Store';
|
||||
import { popupStore, menuStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -67,7 +67,7 @@ const PopupSearch = observer(class PopupSearch extends React.Component<I.Popup,
|
|||
if ([ 'name', 'type' ].includes(relationKey)) {
|
||||
return '';
|
||||
} else {
|
||||
const relation = recordStore.getRelationByKey(relationKey);
|
||||
const relation = S.Record.getRelationByKey(relationKey);
|
||||
key = relation ? <div className="key">{relation.name}:</div> : '';
|
||||
};
|
||||
};
|
||||
|
@ -518,7 +518,7 @@ const PopupSearch = observer(class PopupSearch extends React.Component<I.Popup,
|
|||
const { space } = S.Common;
|
||||
const { backlink } = this.state;
|
||||
const filter = this.getFilter();
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const filters: any[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: UtilObject.getFileAndSystemLayouts() },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.NotEqual, value: templateType?.id },
|
||||
|
@ -598,7 +598,7 @@ const PopupSearch = observer(class PopupSearch extends React.Component<I.Popup,
|
|||
};
|
||||
|
||||
items = items.map(it => {
|
||||
const type = recordStore.getTypeById(it.type);
|
||||
const type = S.Record.getTypeById(it.type);
|
||||
|
||||
return {
|
||||
...it,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import * as React from 'react';
|
||||
import { ObjectName, ObjectDescription, ObjectType, IconObject, Loader } from 'Component';
|
||||
import { recordStore } from 'Store';
|
||||
import { UtilObject } from 'Lib';
|
||||
import { S, UtilObject } from 'Lib';
|
||||
import { observer } from 'mobx-react';
|
||||
|
||||
interface Props {
|
||||
|
@ -35,7 +34,7 @@ const PreviewDefault = observer(class PreviewDefault extends React.Component<Pro
|
|||
const { loading } = this.state;
|
||||
const cn = [ 'previewDefault', className ];
|
||||
const object = this.props.object || this.state.object || {};
|
||||
const type = recordStore.getTypeById(object.type);
|
||||
const type = S.Record.getTypeById(object.type);
|
||||
|
||||
if (UtilObject.isParticipantLayout(object.layout)) {
|
||||
object.name = object.globalName || object.name;
|
||||
|
|
|
@ -4,7 +4,7 @@ import raf from 'raf';
|
|||
import { observer } from 'mobx-react';
|
||||
import { Icon, ObjectName, DropTarget } from 'Component';
|
||||
import { C, I, S, UtilCommon, UtilObject, UtilData, UtilMenu, translate, Storage, Action, analytics, Dataview, UtilDate, UtilSpace, keyboard } from 'Lib';
|
||||
import { blockStore, detailStore, menuStore, recordStore } from 'Store';
|
||||
import { blockStore, detailStore, menuStore } from 'Store';
|
||||
|
||||
import WidgetSpace from './space';
|
||||
import WidgetView from './view';
|
||||
|
@ -366,7 +366,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
|
||||
const view = Dataview.getView(rootId, Constant.blockId.dataview, viewId);
|
||||
const typeId = Dataview.getTypeId(rootId, Constant.blockId.dataview, object.id, viewId);
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
|
||||
if (!view || !type) {
|
||||
return;
|
||||
|
@ -381,7 +381,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
switch (targetBlockId) {
|
||||
default:
|
||||
case Constant.widgetId.favorite: {
|
||||
const type = recordStore.getTypeById(S.Common.type);
|
||||
const type = S.Record.getTypeById(S.Common.type);
|
||||
|
||||
if (!type) {
|
||||
return;
|
||||
|
@ -578,7 +578,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
|
||||
const { targetBlockId } = child.content;
|
||||
const space = UtilSpace.getSpaceview();
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const sorts = [];
|
||||
const filters: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'layout', condition: I.FilterCondition.NotIn, value: UtilObject.getFileAndSystemLayouts() },
|
||||
|
@ -723,7 +723,7 @@ const WidgetIndex = observer(class WidgetIndex extends React.Component<Props> {
|
|||
if (UtilObject.isSetLayout(object.layout)) {
|
||||
const rootId = this.getRootId();
|
||||
const typeId = Dataview.getTypeId(rootId, Constant.blockId.dataview, object.id);
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
|
||||
if (type && UtilObject.isFileLayout(type.recommendedLayout)) {
|
||||
return false;
|
||||
|
|
|
@ -5,7 +5,7 @@ import { observer } from 'mobx-react';
|
|||
import { AutoSizer, CellMeasurer, CellMeasurerCache, InfiniteLoader, List } from 'react-virtualized';
|
||||
import { Loader, Label } from 'Component';
|
||||
import { S, analytics, C, UtilData, I, UtilObject, Relation, Storage, UtilCommon, translate } from 'Lib';
|
||||
import { blockStore, recordStore, detailStore } from 'Store';
|
||||
import { blockStore, detailStore } from 'Store';
|
||||
import Item from './item';
|
||||
|
||||
interface State {
|
||||
|
@ -189,7 +189,7 @@ const WidgetTree = observer(class WidgetTree extends React.Component<I.WidgetCom
|
|||
};
|
||||
|
||||
getDeleted () {
|
||||
const deleted = recordStore.getRecordIds(Constant.subId.deleted, '');
|
||||
const deleted = S.Record.getRecordIds(Constant.subId.deleted, '');
|
||||
const length = deleted.length;
|
||||
|
||||
this.deletedIds = new Set(deleted);
|
||||
|
@ -229,7 +229,7 @@ const WidgetTree = observer(class WidgetTree extends React.Component<I.WidgetCom
|
|||
if (isSystemTarget()) {
|
||||
const subId = this.getSubId(targetBlockId);
|
||||
|
||||
let records = recordStore.getRecordIds(subId, '');
|
||||
let records = S.Record.getRecordIds(subId, '');
|
||||
if (targetBlockId == Constant.widgetId.favorite) {
|
||||
records = sortFavorite(records);
|
||||
};
|
||||
|
@ -299,7 +299,7 @@ const WidgetTree = observer(class WidgetTree extends React.Component<I.WidgetCom
|
|||
|
||||
// return the child nodes details for the given subId
|
||||
getChildNodesDetails (nodeId: string): I.WidgetTreeDetails[] {
|
||||
return recordStore.getRecords(this.getSubId(nodeId), [ 'id', 'layout', 'links' ], true).map(it => this.mapper(it));
|
||||
return S.Record.getRecords(this.getSubId(nodeId), [ 'id', 'layout', 'links' ], true).map(it => this.mapper(it));
|
||||
};
|
||||
|
||||
mapper (item) {
|
||||
|
@ -345,7 +345,7 @@ const WidgetTree = observer(class WidgetTree extends React.Component<I.WidgetCom
|
|||
const { block } = this.props;
|
||||
const { targetBlockId } = block.content;
|
||||
|
||||
return recordStore.getSubId(this.getSubKey(), nodeId || targetBlockId);
|
||||
return S.Record.getSubId(this.getSubKey(), nodeId || targetBlockId);
|
||||
};
|
||||
|
||||
// a composite key for the tree node in the form rootId-parentId-Id-depth
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Icon } from 'Component';
|
||||
import { I, UtilCommon, translate, Dataview, UtilObject, UtilData, Storage } from 'Lib';
|
||||
import { recordStore, detailStore } from 'Store';
|
||||
import { I, S, UtilCommon, translate, Dataview, UtilObject, UtilData, Storage } from 'Lib';
|
||||
import { detailStore } from 'Store';
|
||||
import Cell from 'Component/block/dataview/cell';
|
||||
import Item from './item';
|
||||
|
||||
|
@ -32,7 +32,7 @@ const Group = observer(class Group extends React.Component<Props> {
|
|||
const subId = this.getSubId();
|
||||
const items = this.getItems();
|
||||
const limit = getViewLimit();
|
||||
const { total } = recordStore.getMeta(subId, '');
|
||||
const { total } = S.Record.getMeta(subId, '');
|
||||
const head = {};
|
||||
|
||||
head[view.groupRelationKey] = value;
|
||||
|
@ -107,7 +107,7 @@ const Group = observer(class Group extends React.Component<Props> {
|
|||
return;
|
||||
};
|
||||
|
||||
const relation = recordStore.getRelationByKey(view.groupRelationKey);
|
||||
const relation = S.Record.getRelationByKey(view.groupRelationKey);
|
||||
if (!relation) {
|
||||
return;
|
||||
};
|
||||
|
@ -130,24 +130,24 @@ const Group = observer(class Group extends React.Component<Props> {
|
|||
ignoreDeleted: true,
|
||||
collectionId: (isCollection ? object.id : ''),
|
||||
}, () => {
|
||||
recordStore.recordsSet(subId, '', this.applyObjectOrder(id, recordStore.getRecordIds(subId, '')));
|
||||
S.Record.recordsSet(subId, '', this.applyObjectOrder(id, S.Record.getRecordIds(subId, '')));
|
||||
});
|
||||
};
|
||||
|
||||
clear () {
|
||||
recordStore.recordsClear(this.getSubId(), '');
|
||||
S.Record.recordsClear(this.getSubId(), '');
|
||||
};
|
||||
|
||||
getSubId () {
|
||||
const { rootId, id } = this.props;
|
||||
|
||||
return recordStore.getGroupSubId(rootId, Constant.blockId.dataview, id);
|
||||
return S.Record.getGroupSubId(rootId, Constant.blockId.dataview, id);
|
||||
};
|
||||
|
||||
getItems () {
|
||||
const { id } = this.props;
|
||||
const subId = this.getSubId();
|
||||
const records = UtilCommon.objectCopy(recordStore.getRecordIds(subId, ''));
|
||||
const records = UtilCommon.objectCopy(S.Record.getRecordIds(subId, ''));
|
||||
|
||||
return this.applyObjectOrder(id, records).map(id => ({ id }));
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { I, Dataview } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
import { I, S, Dataview } from 'Lib';
|
||||
import Group from './group';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
@ -46,7 +45,7 @@ const WidgetViewBoard = observer(class WidgetViewBoard extends React.Component<I
|
|||
return;
|
||||
};
|
||||
|
||||
recordStore.groupsClear(rootId, blockId);
|
||||
S.Record.groupsClear(rootId, blockId);
|
||||
|
||||
if (!view.groupRelationKey) {
|
||||
this.forceUpdate();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Select, Icon } from 'Component';
|
||||
import { I, UtilDate } from 'Lib';
|
||||
import { menuStore, recordStore } from 'Store';
|
||||
import { I, S, UtilDate } from 'Lib';
|
||||
import { menuStore } from 'Store';
|
||||
|
||||
interface State {
|
||||
value: number;
|
||||
|
@ -179,7 +179,7 @@ const WidgetViewCalendar = observer(class WidgetViewCalendar extends React.Compo
|
|||
getFilters (): I.Filter[] {
|
||||
const { getView } = this.props;
|
||||
const view = getView();
|
||||
const relation = recordStore.getRelationByKey(view.groupRelationKey);
|
||||
const relation = S.Record.getRelationByKey(view.groupRelationKey);
|
||||
|
||||
if (!relation) {
|
||||
return [];
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as React from 'react';
|
||||
import { observer } from 'mobx-react';
|
||||
import { Select, Label, Button } from 'Component';
|
||||
import { blockStore, recordStore, detailStore } from 'Store';
|
||||
import { Dataview, I, C, M, UtilCommon, Relation, keyboard, translate, UtilRouter, UtilObject } from 'Lib';
|
||||
import { blockStore, detailStore } from 'Store';
|
||||
import { Dataview, I, C, M, S, UtilCommon, Relation, keyboard, translate, UtilRouter, UtilObject } from 'Lib';
|
||||
|
||||
import WidgetViewList from './list';
|
||||
import WidgetViewGallery from './gallery';
|
||||
|
@ -46,7 +46,7 @@ const WidgetView = observer(class WidgetView extends React.Component<I.WidgetCom
|
|||
const subId = this.getSubId();
|
||||
const records = this.getRecordIds();
|
||||
const length = records.length;
|
||||
const views = recordStore.getViews(rootId, Constant.blockId.dataview).map(it => ({ ...it, name: it.name || translate('defaultNamePage') }));
|
||||
const views = S.Record.getViews(rootId, Constant.blockId.dataview).map(it => ({ ...it, name: it.name || translate('defaultNamePage') }));
|
||||
const viewType = this.getViewType();
|
||||
const cn = [ 'innerWrap' ];
|
||||
const showEmpty = ![ I.ViewType.Calendar, I.ViewType.Board ].includes(viewType);
|
||||
|
@ -191,15 +191,15 @@ const WidgetView = observer(class WidgetView extends React.Component<I.WidgetCom
|
|||
updateViews () {
|
||||
const { block } = this.props;
|
||||
const { targetBlockId } = block.content;
|
||||
const views = UtilCommon.objectCopy(recordStore.getViews(targetBlockId, Constant.blockId.dataview)).map(it => new M.View(it));
|
||||
const views = UtilCommon.objectCopy(S.Record.getViews(targetBlockId, Constant.blockId.dataview)).map(it => new M.View(it));
|
||||
const rootId = this.getRootId();
|
||||
|
||||
if (!views.length || (targetBlockId != keyboard.getRootId())) {
|
||||
return;
|
||||
};
|
||||
|
||||
recordStore.viewsClear(rootId, Constant.blockId.dataview);
|
||||
recordStore.viewsSet(rootId, Constant.blockId.dataview, views);
|
||||
S.Record.viewsClear(rootId, Constant.blockId.dataview);
|
||||
S.Record.viewsSet(rootId, Constant.blockId.dataview, views);
|
||||
|
||||
if (this.refSelect) {
|
||||
this.refSelect.setOptions(views);
|
||||
|
@ -207,7 +207,7 @@ const WidgetView = observer(class WidgetView extends React.Component<I.WidgetCom
|
|||
};
|
||||
|
||||
getSubId () {
|
||||
return recordStore.getSubId(this.getRootId(), Constant.blockId.dataview);
|
||||
return S.Record.getSubId(this.getRootId(), Constant.blockId.dataview);
|
||||
};
|
||||
|
||||
getTraceId = (): string => {
|
||||
|
@ -224,7 +224,7 @@ const WidgetView = observer(class WidgetView extends React.Component<I.WidgetCom
|
|||
load (viewId: string) {
|
||||
if (this.refChild && this.refChild.load) {
|
||||
this.refChild.load();
|
||||
recordStore.metaSet(this.getSubId(), '', { viewId });
|
||||
S.Record.metaSet(this.getSubId(), '', { viewId });
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -311,8 +311,8 @@ const WidgetView = observer(class WidgetView extends React.Component<I.WidgetCom
|
|||
const { targetBlockId } = block.content;
|
||||
const rootId = this.getRootId();
|
||||
const subId = this.getSubId();
|
||||
const records = recordStore.getRecordIds(subId, '');
|
||||
const views = recordStore.getViews(rootId, Constant.blockId.dataview);
|
||||
const records = S.Record.getRecordIds(subId, '');
|
||||
const views = S.Record.getViews(rootId, Constant.blockId.dataview);
|
||||
const viewId = parent.content.viewId || (views.length ? views[0].id : '');
|
||||
const ret = Dataview.applyObjectOrder(rootId, Constant.blockId.dataview, viewId, '', UtilCommon.objectCopy(records));
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import * as React from 'react';
|
|||
import raf from 'raf';
|
||||
import { observer } from 'mobx-react';
|
||||
import { AutoSizer, CellMeasurer, CellMeasurerCache, InfiniteLoader, List as VList } from 'react-virtualized';
|
||||
import { blockStore, recordStore, detailStore } from 'Store';
|
||||
import { I, keyboard, Action } from 'Lib';
|
||||
import { blockStore, detailStore } from 'Store';
|
||||
import { I, S, keyboard, Action } from 'Lib';
|
||||
import { SortableContainer } from 'react-sortable-hoc';
|
||||
import arrayMove from 'array-move';
|
||||
import WidgetListItem from './item';
|
||||
|
@ -31,7 +31,7 @@ const WidgetViewList = observer(class WidgetViewList extends React.Component<I.W
|
|||
|
||||
render (): React.ReactNode {
|
||||
const { parent, block, isPreview, subId } = this.props;
|
||||
const { total } = recordStore.getMeta(subId, '');
|
||||
const { total } = S.Record.getMeta(subId, '');
|
||||
const items = this.getItems();
|
||||
const length = items.length;
|
||||
const isCompact = this.isCompact();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { I, C, S, focus, analytics, Onboarding, Renderer, Preview, UtilCommon, UtilObject, UtilSpace, Storage, UtilData, UtilRouter, UtilMenu, translate, Mapper, keyboard } from 'Lib';
|
||||
import { authStore, blockStore, detailStore, recordStore, popupStore, menuStore } from 'Store';
|
||||
import { authStore, blockStore, detailStore, popupStore, menuStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -39,8 +39,8 @@ class Action {
|
|||
return;
|
||||
};
|
||||
|
||||
recordStore.metaClear(rootId, '');
|
||||
recordStore.recordsClear(rootId, '');
|
||||
S.Record.metaClear(rootId, '');
|
||||
S.Record.recordsClear(rootId, '');
|
||||
detailStore.clear(rootId);
|
||||
|
||||
C.ObjectSearchUnsubscribe([ rootId ]);
|
||||
|
@ -51,12 +51,12 @@ class Action {
|
|||
return;
|
||||
};
|
||||
|
||||
const subId = recordStore.getSubId(rootId, blockId);
|
||||
const subId = S.Record.getSubId(rootId, blockId);
|
||||
|
||||
recordStore.metaClear(subId, '');
|
||||
recordStore.recordsClear(subId, '');
|
||||
recordStore.recordsClear(subId + '/dep', '');
|
||||
recordStore.viewsClear(rootId, blockId);
|
||||
S.Record.metaClear(subId, '');
|
||||
S.Record.recordsClear(subId, '');
|
||||
S.Record.recordsClear(subId + '/dep', '');
|
||||
S.Record.viewsClear(rootId, blockId);
|
||||
|
||||
detailStore.clear(subId);
|
||||
|
||||
|
@ -538,7 +538,7 @@ class Action {
|
|||
const element = blockStore.getMapElement(rootId, it.id);
|
||||
|
||||
if (it.type == I.BlockType.Dataview) {
|
||||
it.content.views = recordStore.getViews(rootId, it.id);
|
||||
it.content.views = S.Record.getViews(rootId, it.id);
|
||||
};
|
||||
|
||||
it.childrenIds = element.childrenIds;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import * as amplitude from 'amplitude-js';
|
||||
import { I, C, S, UtilCommon, Storage, UtilSpace, Relation } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -559,9 +558,9 @@ class Analytics {
|
|||
};
|
||||
|
||||
typeMapper (id: string): string {
|
||||
let object = recordStore.getTypeById(id);
|
||||
let object = S.Record.getTypeById(id);
|
||||
if (!object) {
|
||||
object = recordStore.getTypeByKey(id);
|
||||
object = S.Record.getTypeByKey(id);
|
||||
};
|
||||
|
||||
if (!object) {
|
||||
|
@ -576,7 +575,7 @@ class Analytics {
|
|||
};
|
||||
|
||||
relationMapper (key: string) {
|
||||
const object = recordStore.getRelationByKey(key);
|
||||
const object = S.Record.getRelationByKey(key);
|
||||
if (!object) {
|
||||
return '';
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ import { observable, set } from 'mobx';
|
|||
import Commands from 'dist/lib/pb/protos/commands_pb';
|
||||
import Events from 'dist/lib/pb/protos/events_pb';
|
||||
import Service from 'dist/lib/pb/protos/service/service_grpc_web_pb';
|
||||
import { authStore, blockStore, detailStore, recordStore, notificationStore } from 'Store';
|
||||
import { authStore, blockStore, detailStore, notificationStore } from 'Store';
|
||||
import {
|
||||
S, UtilCommon, UtilObject, I, M, translate, analytics, Renderer, Action, Dataview, Preview, Mapper, Decode, UtilRouter, Storage, UtilSpace, UtilData, keyboard
|
||||
} from 'Lib';
|
||||
|
@ -177,12 +177,12 @@ class Dispatcher {
|
|||
};
|
||||
|
||||
case 'ObjectRelationsAmend': {
|
||||
recordStore.relationsSet(rootId, mapped.id, mapped.relations);
|
||||
S.Record.relationsSet(rootId, mapped.id, mapped.relations);
|
||||
break;
|
||||
};
|
||||
|
||||
case 'ObjectRelationsRemove': {
|
||||
recordStore.relationListDelete(rootId, mapped.id, mapped.relationKeys);
|
||||
S.Record.relationListDelete(rootId, mapped.id, mapped.relationKeys);
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -228,8 +228,8 @@ class Dispatcher {
|
|||
|
||||
for (const block of blocks) {
|
||||
if (block.type == I.BlockType.Dataview) {
|
||||
recordStore.relationsSet(rootId, block.id, block.content.relationLinks);
|
||||
recordStore.viewsSet(rootId, block.id, block.content.views);
|
||||
S.Record.relationsSet(rootId, block.id, block.content.relationLinks);
|
||||
S.Record.viewsSet(rootId, block.id, block.content.views);
|
||||
};
|
||||
|
||||
blockStore.add(rootId, new M.Block(block));
|
||||
|
@ -581,7 +581,7 @@ class Dispatcher {
|
|||
break;
|
||||
};
|
||||
|
||||
recordStore.viewAdd(rootId, id, view);
|
||||
S.Record.viewAdd(rootId, id, view);
|
||||
blockStore.updateWidgetViews(rootId);
|
||||
break;
|
||||
};
|
||||
|
@ -594,7 +594,7 @@ class Dispatcher {
|
|||
break;
|
||||
};
|
||||
|
||||
let view = recordStore.getView(rootId, id, viewId);
|
||||
let view = S.Record.getView(rootId, id, viewId);
|
||||
let updateData = false;
|
||||
|
||||
if (fields !== null) {
|
||||
|
@ -691,7 +691,7 @@ class Dispatcher {
|
|||
view[key.field] = list;
|
||||
});
|
||||
|
||||
recordStore.viewUpdate(rootId, id, view);
|
||||
S.Record.viewUpdate(rootId, id, view);
|
||||
blockStore.updateWidgetViews(rootId);
|
||||
|
||||
if (updateData) {
|
||||
|
@ -703,17 +703,17 @@ class Dispatcher {
|
|||
|
||||
case 'BlockDataviewViewDelete': {
|
||||
const { id, viewId } = mapped;
|
||||
const subId = recordStore.getSubId(rootId, id);
|
||||
const subId = S.Record.getSubId(rootId, id);
|
||||
|
||||
let current = recordStore.getMeta(subId, '').viewId;
|
||||
let current = S.Record.getMeta(subId, '').viewId;
|
||||
|
||||
recordStore.viewDelete(rootId, id, viewId);
|
||||
S.Record.viewDelete(rootId, id, viewId);
|
||||
|
||||
if (viewId == current) {
|
||||
const views = recordStore.getViews(rootId, id);
|
||||
const views = S.Record.getViews(rootId, id);
|
||||
|
||||
current = views.length ? views[views.length - 1].id : '';
|
||||
recordStore.metaSet(subId, '', { viewId: current });
|
||||
S.Record.metaSet(subId, '', { viewId: current });
|
||||
};
|
||||
|
||||
blockStore.updateWidgetViews(rootId);
|
||||
|
@ -723,7 +723,7 @@ class Dispatcher {
|
|||
case 'BlockDataviewViewOrder': {
|
||||
const { id, viewIds } = mapped;
|
||||
|
||||
recordStore.viewsSort(rootId, id, viewIds);
|
||||
S.Record.viewsSort(rootId, id, viewIds);
|
||||
blockStore.updateWidgetViews(rootId);
|
||||
break;
|
||||
};
|
||||
|
@ -731,14 +731,14 @@ class Dispatcher {
|
|||
case 'BlockDataviewRelationDelete': {
|
||||
const { id, relationKeys } = mapped;
|
||||
|
||||
recordStore.relationListDelete(rootId, id, relationKeys);
|
||||
S.Record.relationListDelete(rootId, id, relationKeys);
|
||||
break;
|
||||
};
|
||||
|
||||
case 'BlockDataviewRelationSet': {
|
||||
const { id, relations } = mapped;
|
||||
|
||||
recordStore.relationsSet(rootId, id, relations);
|
||||
S.Record.relationsSet(rootId, id, relations);
|
||||
break;
|
||||
};
|
||||
|
||||
|
@ -846,7 +846,7 @@ class Dispatcher {
|
|||
const [ subId, dep ] = mapped.subId.split('/');
|
||||
|
||||
if (!dep) {
|
||||
recordStore.recordDelete(subId, '', id);
|
||||
S.Record.recordDelete(subId, '', id);
|
||||
detailStore.delete(subId, id);
|
||||
};
|
||||
break;
|
||||
|
@ -863,7 +863,7 @@ class Dispatcher {
|
|||
const [ subId, dep ] = mapped.subId.split('/');
|
||||
|
||||
if (!dep) {
|
||||
recordStore.metaSet(subId, '', { total: mapped.total });
|
||||
S.Record.metaSet(subId, '', { total: mapped.total });
|
||||
};
|
||||
break;
|
||||
};
|
||||
|
@ -873,9 +873,9 @@ class Dispatcher {
|
|||
const [ rootId, blockId ] = mapped.subId.split('-');
|
||||
|
||||
if (remove) {
|
||||
recordStore.groupsRemove(rootId, blockId, [ group.id ]);
|
||||
S.Record.groupsRemove(rootId, blockId, [ group.id ]);
|
||||
} else {
|
||||
recordStore.groupsAdd(rootId, blockId, [ group ]);
|
||||
S.Record.groupsAdd(rootId, blockId, [ group ]);
|
||||
};
|
||||
|
||||
blockStore.updateWidgetData(rootId);
|
||||
|
@ -1026,7 +1026,7 @@ class Dispatcher {
|
|||
return;
|
||||
};
|
||||
|
||||
const records = recordStore.getRecordIds(sid, '');
|
||||
const records = S.Record.getRecordIds(sid, '');
|
||||
const newIndex = afterId ? records.indexOf(afterId) + 1 : 0;
|
||||
|
||||
let oldIndex = records.indexOf(id);
|
||||
|
@ -1041,7 +1041,7 @@ class Dispatcher {
|
|||
};
|
||||
|
||||
if (oldIndex !== newIndex) {
|
||||
recordStore.recordsSet(sid, '', arrayMove(records, oldIndex, newIndex));
|
||||
S.Record.recordsSet(sid, '', arrayMove(records, oldIndex, newIndex));
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1068,7 +1068,7 @@ class Dispatcher {
|
|||
analytics.removeContext();
|
||||
};
|
||||
|
||||
recordStore.relationsSet(contextId, rootId, relationLinks);
|
||||
S.Record.relationsSet(contextId, rootId, relationLinks);
|
||||
detailStore.set(contextId, details);
|
||||
blockStore.restrictionsSet(contextId, restrictions);
|
||||
blockStore.participantsSet(contextId, participants);
|
||||
|
@ -1082,8 +1082,8 @@ class Dispatcher {
|
|||
|
||||
const blocks = objectView.blocks.map(it => {
|
||||
if (it.type == I.BlockType.Dataview) {
|
||||
recordStore.relationsSet(contextId, it.id, it.content.relationLinks);
|
||||
recordStore.viewsSet(contextId, it.id, it.content.views);
|
||||
S.Record.relationsSet(contextId, it.id, it.content.relationLinks);
|
||||
S.Record.viewsSet(contextId, it.id, it.content.views);
|
||||
};
|
||||
|
||||
structure.push({ id: it.id, childrenIds: it.childrenIds });
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import arrayMove from 'array-move';
|
||||
import { recordStore, blockStore, detailStore } from 'Store';
|
||||
import { blockStore, detailStore } from 'Store';
|
||||
import { I, M, C, S, UtilCommon, UtilData, UtilObject, Relation, translate, UtilDate } from 'Lib';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
@ -15,7 +15,7 @@ class Dataview {
|
|||
|
||||
const order: any = {};
|
||||
|
||||
let relations = UtilCommon.objectCopy(recordStore.getObjectRelations(rootId, blockId)).filter(it => it);
|
||||
let relations = UtilCommon.objectCopy(S.Record.getObjectRelations(rootId, blockId)).filter(it => it);
|
||||
let o = 0;
|
||||
|
||||
if (!config.debug.hiddenObject) {
|
||||
|
@ -76,7 +76,7 @@ class Dataview {
|
|||
|
||||
C.BlockDataviewViewRelationReplace(rootId, blockId, view.id, relationKey, rel, (message: any) => {
|
||||
if (index >= 0) {
|
||||
const newView = recordStore.getView(rootId, blockId, view.id);
|
||||
const newView = S.Record.getView(rootId, blockId, view.id);
|
||||
const oldIndex = (newView.relations || []).findIndex(it => it.relationKey == relationKey);
|
||||
|
||||
let keys = newView.relations.map(it => it.relationKey);
|
||||
|
@ -114,14 +114,14 @@ class Dataview {
|
|||
|
||||
const { rootId, blockId, newViewId, keys, offset, limit, clear, collectionId } = param;
|
||||
const block = blockStore.getLeaf(rootId, blockId);
|
||||
const view = recordStore.getView(rootId, blockId, newViewId);
|
||||
const view = S.Record.getView(rootId, blockId, newViewId);
|
||||
|
||||
if (!view) {
|
||||
return;
|
||||
};
|
||||
|
||||
const subId = recordStore.getSubId(rootId, blockId);
|
||||
const { viewId } = recordStore.getMeta(subId, '');
|
||||
const subId = S.Record.getSubId(rootId, blockId);
|
||||
const { viewId } = S.Record.getMeta(subId, '');
|
||||
const viewChange = newViewId != viewId;
|
||||
const meta: any = { offset };
|
||||
const filters = UtilCommon.objectCopy(view.filters).concat(param.filters || []);
|
||||
|
@ -133,10 +133,10 @@ class Dataview {
|
|||
meta.viewId = newViewId;
|
||||
};
|
||||
if (viewChange || clear) {
|
||||
recordStore.recordsSet(subId, '', []);
|
||||
S.Record.recordsSet(subId, '', []);
|
||||
};
|
||||
|
||||
recordStore.metaSet(subId, '', meta);
|
||||
S.Record.metaSet(subId, '', meta);
|
||||
|
||||
if (block) {
|
||||
const el = block.content.objectOrder.find(it => (it.viewId == view.id) && (it.groupId == ''));
|
||||
|
@ -162,7 +162,7 @@ class Dataview {
|
|||
};
|
||||
|
||||
filterMapper (view: any, it: any) {
|
||||
const relation = recordStore.getRelationByKey(it.relationKey);
|
||||
const relation = S.Record.getRelationByKey(it.relationKey);
|
||||
const vr = view.getRelation(it.relationKey);
|
||||
|
||||
if (relation) {
|
||||
|
@ -179,15 +179,15 @@ class Dataview {
|
|||
let view = null;
|
||||
|
||||
if (!viewId) {
|
||||
viewId = recordStore.getMeta(recordStore.getSubId(rootId, blockId), '').viewId;
|
||||
viewId = S.Record.getMeta(S.Record.getSubId(rootId, blockId), '').viewId;
|
||||
};
|
||||
|
||||
if (viewId) {
|
||||
view = recordStore.getView(rootId, blockId, viewId);
|
||||
view = S.Record.getView(rootId, blockId, viewId);
|
||||
};
|
||||
|
||||
if (!view) {
|
||||
const views = recordStore.getViews(rootId, blockId);
|
||||
const views = S.Record.getViews(rootId, blockId);
|
||||
if (views.length) {
|
||||
view = views[0];
|
||||
};
|
||||
|
@ -223,12 +223,12 @@ class Dataview {
|
|||
return;
|
||||
};
|
||||
|
||||
const subId = recordStore.getGroupSubId(rootId, block.id, 'groups');
|
||||
const subId = S.Record.getGroupSubId(rootId, block.id, 'groups');
|
||||
const isCollection = object.layout == I.ObjectLayout.Collection;
|
||||
|
||||
recordStore.groupsClear(rootId, block.id);
|
||||
S.Record.groupsClear(rootId, block.id);
|
||||
|
||||
const relation = recordStore.getRelationByKey(view.groupRelationKey);
|
||||
const relation = S.Record.getRelationByKey(view.groupRelationKey);
|
||||
if (!relation) {
|
||||
return;
|
||||
};
|
||||
|
@ -270,7 +270,7 @@ class Dataview {
|
|||
return it;
|
||||
});
|
||||
|
||||
recordStore.groupsSet(rootId, block.id, this.applyGroupOrder(rootId, block.id, view.id, groups));
|
||||
S.Record.groupsSet(rootId, block.id, this.applyGroupOrder(rootId, block.id, view.id, groups));
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -301,7 +301,7 @@ class Dataview {
|
|||
};
|
||||
|
||||
getGroups (rootId: string, blockId: string, viewId: string, withHidden: boolean) {
|
||||
const groups = UtilCommon.objectCopy(recordStore.getGroups(rootId, blockId));
|
||||
const groups = UtilCommon.objectCopy(S.Record.getGroups(rootId, blockId));
|
||||
const ret = this.applyGroupOrder(rootId, blockId, viewId, groups);
|
||||
|
||||
return !withHidden ? ret.filter(it => !it.isHidden) : ret;
|
||||
|
@ -417,7 +417,7 @@ class Dataview {
|
|||
let group = null;
|
||||
|
||||
if (groupId) {
|
||||
group = recordStore.getGroup(rootId, blockId, groupId);
|
||||
group = S.Record.getGroup(rootId, blockId, groupId);
|
||||
if (group) {
|
||||
details[view.groupRelationKey] = group.value;
|
||||
};
|
||||
|
@ -443,7 +443,7 @@ class Dataview {
|
|||
continue;
|
||||
};
|
||||
|
||||
const relation = recordStore.getRelationByKey(filter.relationKey);
|
||||
const relation = S.Record.getRelationByKey(filter.relationKey);
|
||||
if (relation && !relation.isReadonlyValue) {
|
||||
details[filter.relationKey] = Relation.formatValue(relation, value, true);
|
||||
};
|
||||
|
@ -465,7 +465,7 @@ class Dataview {
|
|||
if (relations.length) {
|
||||
for (const item of relations) {
|
||||
if (item.objectTypes.length) {
|
||||
const first = recordStore.getTypeById(item.objectTypes[0]);
|
||||
const first = S.Record.getTypeById(item.objectTypes[0]);
|
||||
|
||||
if (first && !UtilObject.isFileLayout(first.recommendedLayout) && !UtilObject.isSystemLayout(first.recommendedLayout)) {
|
||||
typeId = first.id;
|
||||
|
@ -491,7 +491,7 @@ class Dataview {
|
|||
return translate('blockDataviewCreateNewTooltipCollection');
|
||||
} else {
|
||||
const typeId = this.getTypeId(rootId, blockId, objectId, viewId);
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
|
||||
if (type) {
|
||||
return UtilCommon.sprintf(translate('blockDataviewCreateNewTooltipType'), type.name);
|
||||
|
@ -501,7 +501,7 @@ class Dataview {
|
|||
};
|
||||
|
||||
viewUpdate (rootId: string, blockId: string, viewId: string, param: Partial<I.View>, callBack?: (message: any) => void) {
|
||||
const view = UtilCommon.objectCopy(recordStore.getView(rootId, blockId, viewId));
|
||||
const view = UtilCommon.objectCopy(S.Record.getView(rootId, blockId, viewId));
|
||||
if (view) {
|
||||
C.BlockDataviewViewUpdate(rootId, blockId, view.id, Object.assign(view, param), callBack);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { I, UtilCommon, UtilFile, UtilDate, translate, Dataview, UtilObject, UtilMenu } from 'Lib';
|
||||
import { recordStore, detailStore } from 'Store';
|
||||
import { I, S, UtilCommon, UtilFile, UtilDate, translate, Dataview, UtilObject, UtilMenu } from 'Lib';
|
||||
import { detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
const DICTIONARY = [ 'layout', 'origin', 'importType' ];
|
||||
|
@ -289,13 +290,13 @@ class Relation {
|
|||
};
|
||||
|
||||
public getOptions (value: any[]) {
|
||||
return this.getArrayValue(value).map(id => recordStore.getOption(id)).filter(it => it && !it._empty_);
|
||||
return this.getArrayValue(value).map(id => S.Record.getOption(id)).filter(it => it && !it._empty_);
|
||||
};
|
||||
|
||||
public getFilterOptions (rootId: string, blockId: string, view: I.View) {
|
||||
const ret: any[] = [];
|
||||
const relations: any[] = Dataview.viewGetRelations(rootId, blockId, view).filter((it: I.ViewRelation) => {
|
||||
const relation = recordStore.getRelationByKey(it.relationKey);
|
||||
const relation = S.Record.getRelationByKey(it.relationKey);
|
||||
return relation && (it.relationKey != 'done');
|
||||
});
|
||||
const idxName = relations.findIndex(it => it.relationKey == 'name');
|
||||
|
@ -303,7 +304,7 @@ class Relation {
|
|||
relations.splice((idxName >= 0 ? idxName + 1 : 0), 0, { relationKey: 'done' });
|
||||
|
||||
relations.forEach((it: I.ViewRelation) => {
|
||||
const relation: any = recordStore.getRelationByKey(it.relationKey);
|
||||
const relation: any = S.Record.getRelationByKey(it.relationKey);
|
||||
if (!relation) {
|
||||
return;
|
||||
};
|
||||
|
@ -331,7 +332,7 @@ class Relation {
|
|||
|
||||
public getCoverOptions (rootId: string, blockId: string) {
|
||||
const formats = [ I.RelationType.File ];
|
||||
const options: any[] = UtilCommon.objectCopy(recordStore.getObjectRelations(rootId, blockId)).filter(it => {
|
||||
const options: any[] = UtilCommon.objectCopy(S.Record.getObjectRelations(rootId, blockId)).filter(it => {
|
||||
if (it.isInstalled && (it.relationKey == 'picture')) {
|
||||
return true;
|
||||
};
|
||||
|
@ -363,7 +364,7 @@ class Relation {
|
|||
};
|
||||
};
|
||||
|
||||
let options: any[] = recordStore.getObjectRelations(rootId, blockId).filter((it: any) => {
|
||||
let options: any[] = S.Record.getObjectRelations(rootId, blockId).filter((it: any) => {
|
||||
return it.isInstalled && formats.includes(it.format) && (!it.isHidden || [ 'done' ].includes(it.relationKey));
|
||||
});
|
||||
|
||||
|
@ -505,12 +506,12 @@ class Relation {
|
|||
|
||||
switch (layout) {
|
||||
case I.ObjectLayout.Type: {
|
||||
el = recordStore.getTypeById(id);
|
||||
el = S.Record.getTypeById(id);
|
||||
break;
|
||||
};
|
||||
|
||||
case I.ObjectLayout.Relation: {
|
||||
el = recordStore.getRelationById(id);
|
||||
el = S.Record.getRelationById(id);
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
@ -586,7 +587,7 @@ class Relation {
|
|||
let type = null;
|
||||
|
||||
if (objectTypes.length) {
|
||||
const allowedTypes = objectTypes.map(id => recordStore.getTypeById(id)).filter(it => it && !UtilObject.isFileOrSystemLayout(it.recommendedLayout));
|
||||
const allowedTypes = objectTypes.map(id => S.Record.getTypeById(id)).filter(it => it && !UtilObject.isFileOrSystemLayout(it.recommendedLayout));
|
||||
const l = allowedTypes.length;
|
||||
|
||||
if (l) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { I, S, UtilCommon, UtilSpace } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -277,7 +276,7 @@ class Storage {
|
|||
];
|
||||
|
||||
for (const key of keys) {
|
||||
const type = recordStore.getTypeByKey(key);
|
||||
const type = S.Record.getTypeByKey(key);
|
||||
if (type) {
|
||||
list.push(type.id);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { I, C, M, S, keyboard, translate, UtilCommon, UtilRouter, Storage, analytics, dispatcher, Mark, UtilObject, focus, UtilSpace, Renderer, Action, Survey, Onboarding } from 'Lib';
|
||||
import { blockStore, detailStore, recordStore, authStore, notificationStore, popupStore } from 'Store';
|
||||
import { blockStore, detailStore, authStore, notificationStore, popupStore } from 'Store';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
|
||||
type SearchSubscribeParams = Partial<{
|
||||
|
@ -317,7 +317,7 @@ class UtilData {
|
|||
ignoreDeleted: true,
|
||||
ignoreHidden: false,
|
||||
onSubscribe: () => {
|
||||
recordStore.getTypes().forEach(it => recordStore.typeKeyMapSet(it.spaceId, it.uniqueKey, it.id));
|
||||
S.Record.getTypes().forEach(it => S.Record.typeKeyMapSet(it.spaceId, it.uniqueKey, it.id));
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -332,7 +332,7 @@ class UtilData {
|
|||
ignoreDeleted: true,
|
||||
ignoreHidden: false,
|
||||
onSubscribe: () => {
|
||||
recordStore.getRelations().forEach(it => recordStore.relationKeyMapSet(it.spaceId, it.relationKey, it.id));
|
||||
S.Record.getRelations().forEach(it => S.Record.relationKeyMapSet(it.spaceId, it.relationKey, it.id));
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -475,7 +475,7 @@ class UtilData {
|
|||
|
||||
let items: any[] = [];
|
||||
|
||||
items = items.concat(recordStore.getTypes().filter(it => {
|
||||
items = items.concat(S.Record.getTypes().filter(it => {
|
||||
return pageLayouts.includes(it.recommendedLayout) && !skipLayouts.includes(it.recommendedLayout) && (it.spaceId == space);
|
||||
}));
|
||||
|
||||
|
@ -484,11 +484,11 @@ class UtilData {
|
|||
};
|
||||
|
||||
if (withSet) {
|
||||
items.push(recordStore.getSetType());
|
||||
items.push(S.Record.getSetType());
|
||||
};
|
||||
|
||||
if (withCollection) {
|
||||
items.push(recordStore.getCollectionType());
|
||||
items.push(S.Record.getCollectionType());
|
||||
};
|
||||
|
||||
items = items.filter(it => it);
|
||||
|
@ -501,7 +501,7 @@ class UtilData {
|
|||
};
|
||||
|
||||
getTemplatesByTypeId (typeId: string, callBack: (message: any) => void) {
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const filters: I.Filter[] = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'type', condition: I.FilterCondition.Equal, value: templateType?.id },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'targetObjectType', condition: I.FilterCondition.In, value: typeId },
|
||||
|
@ -647,7 +647,7 @@ class UtilData {
|
|||
|
||||
// Check if there is at least 1 set for object types
|
||||
checkSetCnt (ids: string[], callBack?: (message: any) => void) {
|
||||
const setType = recordStore.getTypeByKey(Constant.typeKey.set);
|
||||
const setType = S.Record.getTypeByKey(Constant.typeKey.set);
|
||||
this.checkObjectWithRelationCnt('setOf', setType?.id, ids, 2, callBack);
|
||||
};
|
||||
|
||||
|
@ -693,7 +693,7 @@ class UtilData {
|
|||
return;
|
||||
};
|
||||
if (message.counters) {
|
||||
recordStore.metaSet(subId, '', { total: message.counters.total, keys });
|
||||
S.Record.metaSet(subId, '', { total: message.counters.total, keys });
|
||||
};
|
||||
|
||||
const mapper = (it: any) => {
|
||||
|
@ -706,7 +706,7 @@ class UtilData {
|
|||
details = details.concat(message.records.map(mapper));
|
||||
|
||||
detailStore.set(subId, details);
|
||||
recordStore.recordsSet(subId, '', message.records.map(it => it[idField]).filter(it => it));
|
||||
S.Record.recordsSet(subId, '', message.records.map(it => it[idField]).filter(it => it));
|
||||
};
|
||||
|
||||
searchSubscribe (param: SearchSubscribeParams, callBack?: (message: any) => void) {
|
||||
|
@ -893,7 +893,7 @@ class UtilData {
|
|||
|
||||
graphFilters () {
|
||||
const { space } = S.Common;
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const filters = [
|
||||
{ operator: I.FilterOperator.And, relationKey: 'isHidden', condition: I.FilterCondition.NotEqual, value: true },
|
||||
{ operator: I.FilterOperator.And, relationKey: 'isHiddenDiscovery', condition: I.FilterCondition.NotEqual, value: true },
|
||||
|
@ -911,7 +911,7 @@ class UtilData {
|
|||
};
|
||||
|
||||
moveToPage (rootId: string, ids: string[], typeId: string, route: string) {
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
if (!type) {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import $ from 'jquery';
|
||||
import { I, C, S, keyboard, translate, UtilCommon, UtilData, UtilObject, UtilSpace, Relation, Dataview, Action, analytics } from 'Lib';
|
||||
import { blockStore, menuStore, detailStore, recordStore, authStore, popupStore } from 'Store';
|
||||
import { blockStore, menuStore, detailStore, authStore, popupStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -313,7 +313,7 @@ class UtilMenu {
|
|||
|
||||
viewContextMenu (param: any) {
|
||||
const { rootId, blockId, view, onCopy, onRemove, menuParam, close } = param;
|
||||
const views = recordStore.getViews(rootId, blockId);
|
||||
const views = S.Record.getViews(rootId, blockId);
|
||||
|
||||
const options: any[] = [
|
||||
{ id: 'edit', icon: 'viewSettings', name: translate('menuDataviewViewEditView') },
|
||||
|
@ -496,7 +496,7 @@ class UtilMenu {
|
|||
dashboardSelect (element: string, openRoute?: boolean) {
|
||||
const { space } = S.Common;
|
||||
const { spaceview } = blockStore;
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
const subIds = [ 'searchObject' ];
|
||||
|
||||
const onSelect = (object: any, update: boolean) => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { I, C, S, keyboard, history as historyPopup, Renderer, UtilData, translate, UtilRouter, analytics } from 'Lib';
|
||||
import { blockStore, popupStore, detailStore, recordStore } from 'Store';
|
||||
import { blockStore, popupStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
|
@ -149,7 +149,7 @@ class UtilObject {
|
|||
};
|
||||
|
||||
if (details.type) {
|
||||
const type = recordStore.getTypeById(details.type);
|
||||
const type = S.Record.getTypeById(details.type);
|
||||
if (type) {
|
||||
typeKey = type.uniqueKey;
|
||||
|
||||
|
@ -277,7 +277,7 @@ class UtilObject {
|
|||
};
|
||||
|
||||
isTemplate (type: string): boolean {
|
||||
const templateType = recordStore.getTemplateType();
|
||||
const templateType = S.Record.getTemplateType();
|
||||
return templateType ? type == templateType.id : false;
|
||||
};
|
||||
|
||||
|
@ -366,7 +366,7 @@ class UtilObject {
|
|||
};
|
||||
|
||||
isAllowedTemplate (typeId): boolean {
|
||||
const type = recordStore.getTypeById(typeId);
|
||||
const type = S.Record.getTypeById(typeId);
|
||||
return type ? !this.getLayoutsWithoutTemplates().includes(type.recommendedLayout) : false;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { I, S, UtilCommon, UtilData, UtilObject, Storage, translate } from 'Lib';
|
||||
import { authStore, blockStore, detailStore, recordStore } from 'Store';
|
||||
import { authStore, blockStore, detailStore } from 'Store';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
const Url = require('json/url.json');
|
||||
|
@ -78,7 +78,7 @@ class UtilSpace {
|
|||
const subId = Constant.subId.space;
|
||||
const { spaceview } = blockStore;
|
||||
|
||||
let items = recordStore.getRecords(subId, UtilData.spaceRelationKeys());
|
||||
let items = S.Record.getRecords(subId, UtilData.spaceRelationKeys());
|
||||
items = items.filter(it => it.isAccountActive && it.isLocalOk);
|
||||
items = items.map(it => ({ ...it, isActive: spaceview == it.id }));
|
||||
|
||||
|
@ -96,11 +96,11 @@ class UtilSpace {
|
|||
};
|
||||
|
||||
getSpaceviewBySpaceId (id: string) {
|
||||
return recordStore.getRecords(Constant.subId.space).find(it => it.targetSpaceId == id);
|
||||
return S.Record.getRecords(Constant.subId.space).find(it => it.targetSpaceId == id);
|
||||
};
|
||||
|
||||
getParticipantsList (statuses?: I.ParticipantStatus[]) {
|
||||
const ret = recordStore.getRecords(Constant.subId.participant);
|
||||
const ret = S.Record.getRecords(Constant.subId.participant);
|
||||
return statuses ? ret.filter(it => statuses.includes(it.status)) : ret;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { I, M, UtilCommon } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
import { I, M, S, UtilCommon } from 'Lib';
|
||||
import { observable, intercept, makeObservable } from 'mobx';
|
||||
|
||||
class View implements I.View {
|
||||
|
@ -85,7 +84,7 @@ class View implements I.View {
|
|||
};
|
||||
|
||||
getVisibleRelations () {
|
||||
return this.getRelations().filter(it => it.isVisible && recordStore.getRelationByKey(it.relationKey));
|
||||
return this.getRelations().filter(it => it.isVisible && S.Record.getRelationByKey(it.relationKey));
|
||||
};
|
||||
|
||||
getRelation (relationKey: string) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { observable, action, computed, set, makeObservable } from 'mobx';
|
||||
import { I, M, C, S, Storage, analytics, Renderer } from 'Lib';
|
||||
import { blockStore, detailStore, recordStore, menuStore, notificationStore } from 'Store';
|
||||
import { keyboard } from 'Lib';
|
||||
import { I, M, C, S, Storage, analytics, Renderer, keyboard } from 'Lib';
|
||||
import { blockStore, detailStore, menuStore, notificationStore } from 'Store';
|
||||
|
||||
interface NetworkConfig {
|
||||
mode: I.NetworkMode;
|
||||
|
@ -182,7 +181,7 @@ class AuthStore {
|
|||
|
||||
blockStore.clearAll();
|
||||
detailStore.clearAll();
|
||||
recordStore.clearAll();
|
||||
S.Record.clearAll();
|
||||
menuStore.closeAllForced();
|
||||
notificationStore.clear();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { action, computed, intercept, makeObservable, observable, set } from 'mobx';
|
||||
import $ from 'jquery';
|
||||
import { I, M, Storage, UtilCommon, UtilObject, Renderer, UtilRouter } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
import { I, M, S, Storage, UtilCommon, UtilObject, Renderer, UtilRouter } from 'Lib';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface Filter {
|
||||
|
@ -179,9 +179,9 @@ class CommonStore {
|
|||
get type(): string {
|
||||
const key = String(this.defaultType || Storage.get('defaultType') || Constant.default.typeKey);
|
||||
|
||||
let type = recordStore.getTypeByKey(key);
|
||||
let type = S.Record.getTypeByKey(key);
|
||||
if (!type || !type.isInstalled || !UtilObject.getPageLayouts().includes(type.recommendedLayout)) {
|
||||
type = recordStore.getTypeByKey(Constant.default.typeKey);
|
||||
type = S.Record.getTypeByKey(Constant.default.typeKey);
|
||||
};
|
||||
|
||||
return type ? type.id : '';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { observable, action, set, intercept, makeObservable } from 'mobx';
|
||||
import { I, Relation, UtilObject, translate, UtilFile } from 'Lib';
|
||||
import { recordStore } from 'Store';
|
||||
import { I, S, Relation, UtilObject, translate, UtilFile } from 'Lib';
|
||||
|
||||
const Constant = require('json/constant.json');
|
||||
|
||||
interface Detail {
|
||||
|
@ -107,12 +107,12 @@ class DetailStore {
|
|||
map.set(item.id, list);
|
||||
};
|
||||
|
||||
// Update relationKeyMap and typeKeyMap in recordStore to keep consistency
|
||||
// Update relationKeyMap and typeKeyMap in S.Record to keep consistency
|
||||
if (item.details.layout == I.ObjectLayout.Relation) {
|
||||
recordStore.relationKeyMapSet(item.details.spaceId, item.details.relationKey, item.details.id);
|
||||
S.Record.relationKeyMapSet(item.details.spaceId, item.details.relationKey, item.details.id);
|
||||
};
|
||||
if (item.details.layout == I.ObjectLayout.Type) {
|
||||
recordStore.typeKeyMapSet(item.details.spaceId, item.details.uniqueKey, item.details.id);
|
||||
S.Record.typeKeyMapSet(item.details.spaceId, item.details.uniqueKey, item.details.id);
|
||||
};
|
||||
|
||||
if (createMap) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Common } from './common';
|
||||
import { Record } from './record';
|
||||
import { authStore } from './auth';
|
||||
import { blockStore } from './block';
|
||||
import { detailStore } from './detail';
|
||||
import { recordStore } from './record';
|
||||
import { menuStore } from './menu';
|
||||
import { popupStore } from './popup';
|
||||
import { extensionStore } from './extension';
|
||||
|
@ -10,10 +10,11 @@ import { notificationStore } from './notification';
|
|||
|
||||
export {
|
||||
Common,
|
||||
Record,
|
||||
|
||||
authStore,
|
||||
blockStore,
|
||||
detailStore,
|
||||
recordStore,
|
||||
menuStore,
|
||||
popupStore,
|
||||
extensionStore,
|
||||
|
|
|
@ -9,7 +9,7 @@ enum KeyMapType {
|
|||
Type = 'type',
|
||||
};
|
||||
|
||||
class DbStore {
|
||||
class RecordStore {
|
||||
|
||||
public relationMap: Map<string, any[]> = observable(new Map());
|
||||
public relationKeyMap: Map<string, Map<string, string>> = new Map();
|
||||
|
@ -379,4 +379,4 @@ class DbStore {
|
|||
|
||||
};
|
||||
|
||||
export const recordStore: DbStore = new DbStore();
|
||||
export const Record: RecordStore = new RecordStore();
|
Loading…
Add table
Add a link
Reference in a new issue