@voplus/morpho-document 1.0.0-dev225 → 1.0.0-dev228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +5 -0
- package/es/components/ActivityLog/ActivityActionFilter.d.ts +3 -0
- package/es/components/ActivityLog/ActivityActionFilter.js +23 -0
- package/es/components/ActivityLog/ActivityActionFilter.js.map +1 -0
- package/es/components/ActivityLog/index.d.ts +1 -1
- package/es/components/ActivityLog/index.js +72 -43
- package/es/components/ActivityLog/index.js.map +1 -1
- package/es/components/ActivityLog/index.less +73 -64
- package/es/components/ActivityLog/state.d.ts +12 -1
- package/es/components/ActivityLog/state.js +55 -16
- package/es/components/ActivityLog/state.js.map +1 -1
- package/es/components/AddDocDropdown/state.js +97 -93
- package/es/components/AddDocDropdown/state.js.map +1 -1
- package/es/components/AvatarList/AvatarItem/index.d.ts +3 -3
- package/es/components/AvatarList/state.js +50 -46
- package/es/components/AvatarList/state.js.map +1 -1
- package/es/components/BreadCrumbsHeader/state.js +31 -27
- package/es/components/BreadCrumbsHeader/state.js.map +1 -1
- package/es/components/DocumentDescription/index.d.ts +1 -1
- package/es/components/DocumentHeader/index.js +10 -18
- package/es/components/DocumentHeader/index.js.map +1 -1
- package/es/components/DocumentItem/index.js +2 -2
- package/es/components/DocumentItem/index.js.map +1 -1
- package/es/components/DocumentItem/state.js +48 -44
- package/es/components/DocumentItem/state.js.map +1 -1
- package/es/components/DocumentList/index.js +16 -1
- package/es/components/DocumentList/index.js.map +1 -1
- package/es/components/DocumentList/index.less +9 -2
- package/es/components/DocumentList/state.d.ts +7 -0
- package/es/components/DocumentList/state.js +221 -200
- package/es/components/DocumentList/state.js.map +1 -1
- package/es/components/DocumentListView/state.js +12 -8
- package/es/components/DocumentListView/state.js.map +1 -1
- package/es/components/DocumentMenu/index.js +12 -9
- package/es/components/DocumentMenu/index.js.map +1 -1
- package/es/components/DocumentMenu/state.d.ts +2 -1
- package/es/components/DocumentMenu/state.js +78 -65
- package/es/components/DocumentMenu/state.js.map +1 -1
- package/es/components/DocumentName/index.js +5 -4
- package/es/components/DocumentName/index.js.map +1 -1
- package/es/components/DocumentName/index.less +6 -2
- package/es/components/DocumentQuickViewDialog/index.js +0 -1
- package/es/components/DocumentQuickViewDialog/index.js.map +1 -1
- package/es/components/DocumentSelectDialog/index.less +1 -1
- package/es/components/DocumentSelectDialog/state.js +72 -68
- package/es/components/DocumentSelectDialog/state.js.map +1 -1
- package/es/components/DocumentSortableTree/index.js +3 -1
- package/es/components/DocumentSortableTree/index.js.map +1 -1
- package/es/components/DocumentSortableTree/state.js +175 -171
- package/es/components/DocumentSortableTree/state.js.map +1 -1
- package/es/components/DocumentTabs/index.d.ts +4 -4
- package/es/components/DocumentTree/state.js +86 -82
- package/es/components/DocumentTree/state.js.map +1 -1
- package/es/components/FileExplorerTheme/node-content-renderer.js +5 -3
- package/es/components/FileExplorerTheme/node-content-renderer.js.map +1 -1
- package/es/components/FileExplorerTheme/node-content-renderer.less +9 -25
- package/es/components/FileViewer/Preview.d.ts +1 -1
- package/es/components/Links/Item.d.ts +3 -3
- package/es/components/Links/Item.js +2 -2
- package/es/components/Links/Item.js.map +1 -1
- package/es/components/Links/state.js +67 -63
- package/es/components/Links/state.js.map +1 -1
- package/es/components/NewDocumentForm/index.d.ts +1 -0
- package/es/components/NewDocumentForm/index.js +1 -1
- package/es/components/NewDocumentForm/index.js.map +1 -1
- package/es/components/NewDocumentForm/state.js +47 -43
- package/es/components/NewDocumentForm/state.js.map +1 -1
- package/es/components/PeopleAccess/NewAccessSelector.d.ts +1 -1
- package/es/components/PeopleAccess/PeopleAccessState.js +136 -132
- package/es/components/PeopleAccess/PeopleAccessState.js.map +1 -1
- package/es/components/PublishModal/index.d.ts +2 -2
- package/es/components/PublishModal/state.js +14 -10
- package/es/components/PublishModal/state.js.map +1 -1
- package/es/components/QuickAccessSearch/ObjectItem/index.d.ts +1 -1
- package/es/components/QuickAccessSearch/state.js +63 -59
- package/es/components/QuickAccessSearch/state.js.map +1 -1
- package/es/components/QuickViewDialog/QuickSubTab/index.d.ts +5 -5
- package/es/components/QuickViewDialog/QuickSubTab/index.js +1 -2
- package/es/components/QuickViewDialog/QuickSubTab/index.js.map +1 -1
- package/es/components/QuickViewDialog/index.d.ts +0 -1
- package/es/components/QuickViewDialog/index.js +5 -2
- package/es/components/QuickViewDialog/index.js.map +1 -1
- package/es/components/QuickViewDialog/state.js +26 -22
- package/es/components/QuickViewDialog/state.js.map +1 -1
- package/es/components/TagView/state.js +63 -59
- package/es/components/TagView/state.js.map +1 -1
- package/es/components/VersionsModal/state.js +27 -23
- package/es/components/VersionsModal/state.js.map +1 -1
- package/es/components/helper.d.ts +2 -1
- package/es/components/helper.js +17 -18
- package/es/components/helper.js.map +1 -1
- package/es/controls/FlagIcon/index.d.ts +1 -1
- package/es/controls/Panable/state.js +31 -27
- package/es/controls/Panable/state.js.map +1 -1
- package/es/controls/PermissionModal/index.d.ts +1 -1
- package/es/controls/QuickDataIcon/index.d.ts +3 -3
- package/es/controls/TimeLog/index.d.ts +1 -1
- package/es/controls/ToolBar/index.js +2 -2
- package/es/controls/ToolBar/index.js.map +1 -1
- package/es/controls/ToolBar/state.js +147 -143
- package/es/controls/ToolBar/state.js.map +1 -1
- package/es/controls/filters/CreateDateFilter/state.js +31 -27
- package/es/controls/filters/CreateDateFilter/state.js.map +1 -1
- package/es/controls/filters/DocumentStatusFilter/state.js +42 -38
- package/es/controls/filters/DocumentStatusFilter/state.js.map +1 -1
- package/es/controls/filters/DocumentTypeFilter/state.js +52 -48
- package/es/controls/filters/DocumentTypeFilter/state.js.map +1 -1
- package/es/controls/filters/FlagFilter/state.js +50 -46
- package/es/controls/filters/FlagFilter/state.js.map +1 -1
- package/es/data/DocumentMetaStore.js +38 -34
- package/es/data/DocumentMetaStore.js.map +1 -1
- package/es/data/DocumentStore/DocumentStore.d.ts +1 -1
- package/es/data/DocumentStore/DocumentStore.js +232 -228
- package/es/data/DocumentStore/DocumentStore.js.map +1 -1
- package/es/data/DocumentStore/hooks/useDocumentActivityListEffect.d.ts +3 -2
- package/es/data/DocumentStore/hooks/useDocumentActivityListEffect.js +3 -5
- package/es/data/DocumentStore/hooks/useDocumentActivityListEffect.js.map +1 -1
- package/es/data/DocumentStore/hooks/useDocumentListLoaderEffect.d.ts +1 -1
- package/es/data/DocumentStore/hooks/useDocumentListLoaderEffect.js.map +1 -1
- package/es/data/DocumentType.d.ts +1 -0
- package/es/data/DocumentType.js +2 -1
- package/es/data/DocumentType.js.map +1 -1
- package/es/data/contexts/DocumentListContext/index.d.ts +0 -2
- package/es/data/contexts/DocumentListContext/index.js +34 -30
- package/es/data/contexts/DocumentListContext/index.js.map +1 -1
- package/es/data/index.js +1 -0
- package/es/data/index.js.map +1 -1
- package/es/data/interfaces/index.js +9 -0
- package/es/data/interfaces/index.js.map +1 -1
- package/es/data/metas/FileTypeMeta.js +25 -21
- package/es/data/metas/FileTypeMeta.js.map +1 -1
- package/es/data/metas/ShortcutMeta.js +26 -22
- package/es/data/metas/ShortcutMeta.js.map +1 -1
- package/es/modules/unit/components/ActivityLog/index.d.ts +1 -1
- package/es/modules/unit/components/ActivityLog/state.js +19 -15
- package/es/modules/unit/components/ActivityLog/state.js.map +1 -1
- package/es/modules/unit/components/AddUnitDropdown/state.js +79 -75
- package/es/modules/unit/components/AddUnitDropdown/state.js.map +1 -1
- package/es/modules/unit/components/BreadCrumbsHeader/state.js +18 -14
- package/es/modules/unit/components/BreadCrumbsHeader/state.js.map +1 -1
- package/es/modules/unit/components/Members/state.js +25 -21
- package/es/modules/unit/components/Members/state.js.map +1 -1
- package/es/modules/unit/components/NewUnitForm/index.d.ts +1 -0
- package/es/modules/unit/components/NewUnitForm/index.js +1 -1
- package/es/modules/unit/components/NewUnitForm/index.js.map +1 -1
- package/es/modules/unit/components/NewUnitForm/state.js +47 -43
- package/es/modules/unit/components/NewUnitForm/state.js.map +1 -1
- package/es/modules/unit/components/SubUnitList/state.js +32 -28
- package/es/modules/unit/components/SubUnitList/state.js.map +1 -1
- package/es/modules/unit/components/UnitAvatar/index.d.ts +5 -5
- package/es/modules/unit/components/UnitDetails/index.js +50 -33
- package/es/modules/unit/components/UnitDetails/index.js.map +1 -1
- package/es/modules/unit/components/UnitDetails/index.less +25 -3
- package/es/modules/unit/components/UnitDetails/state.js +24 -20
- package/es/modules/unit/components/UnitDetails/state.js.map +1 -1
- package/es/modules/unit/components/UnitHead/index.d.ts +2 -2
- package/es/modules/unit/components/UnitHead/state.js +9 -5
- package/es/modules/unit/components/UnitHead/state.js.map +1 -1
- package/es/modules/unit/components/UnitItem/state.js +20 -16
- package/es/modules/unit/components/UnitItem/state.js.map +1 -1
- package/es/modules/unit/components/UnitList/state.js +31 -27
- package/es/modules/unit/components/UnitList/state.js.map +1 -1
- package/es/modules/unit/components/UnitSortableTree/index.js +20 -1
- package/es/modules/unit/components/UnitSortableTree/index.js.map +1 -1
- package/es/modules/unit/components/UnitSortableTree/state.d.ts +3 -0
- package/es/modules/unit/components/UnitSortableTree/state.js +158 -138
- package/es/modules/unit/components/UnitSortableTree/state.js.map +1 -1
- package/es/modules/unit/components/UnitTabs/index.d.ts +2 -2
- package/es/modules/unit/controls/ContactSelect/state.js +40 -36
- package/es/modules/unit/controls/ContactSelect/state.js.map +1 -1
- package/es/modules/unit/controls/QuickDataIcon/index.d.ts +3 -3
- package/es/modules/unit/controls/ToolBar/ContactMenu/index.js +1 -1
- package/es/modules/unit/controls/ToolBar/ContactMenu/index.js.map +1 -1
- package/es/modules/unit/controls/ToolBar/ContactMenu/state.js +68 -64
- package/es/modules/unit/controls/ToolBar/ContactMenu/state.js.map +1 -1
- package/es/modules/unit/controls/ToolBar/index.js +1 -1
- package/es/modules/unit/controls/ToolBar/index.js.map +1 -1
- package/es/modules/unit/controls/ToolBar/state.js +62 -58
- package/es/modules/unit/controls/ToolBar/state.js.map +1 -1
- package/es/modules/unit/controls/UnitTypeFilter/state.js +59 -55
- package/es/modules/unit/controls/UnitTypeFilter/state.js.map +1 -1
- package/es/modules/unit/data/UnitContext/index.d.ts +0 -2
- package/es/modules/unit/data/UnitContext/index.js +24 -20
- package/es/modules/unit/data/UnitContext/index.js.map +1 -1
- package/es/modules/unit/data/UnitStore.js +202 -198
- package/es/modules/unit/data/UnitStore.js.map +1 -1
- package/es/modules/unit/data/hooks/useTeamListEffect.d.ts +1 -1
- package/es/modules/unit/data/hooks/useTeamListEffect.js.map +1 -1
- package/es/modules/unit/data/hooks/useUnitListEffect.d.ts +1 -1
- package/es/modules/unit/data/hooks/useUnitListEffect.js.map +1 -1
- package/es/modules/unit/data/index.js +2 -0
- package/es/modules/unit/data/index.js.map +1 -1
- package/es/modules/unit/data/interfaces/index.js +3 -0
- package/es/modules/unit/data/interfaces/index.js.map +1 -1
- package/es/modules/unit/pages/UnitTreeView/state.js +14 -10
- package/es/modules/unit/pages/UnitTreeView/state.js.map +1 -1
- package/es/pages/TreeViewPage/state.js +14 -10
- package/es/pages/TreeViewPage/state.js.map +1 -1
- package/package.json +4 -4
- package/es/components/DocumentIconView/index.d.ts +0 -13
- package/es/components/DocumentIconView/index.js +0 -118
- package/es/components/DocumentIconView/index.js.map +0 -1
- package/es/components/DocumentIconView/index.less +0 -70
|
@@ -7,246 +7,250 @@ import { EventDispatcher } from "strongly-typed-events";
|
|
|
7
7
|
import invariant from "invariant";
|
|
8
8
|
const documentStoreName = "DocumentStore";
|
|
9
9
|
/** Document store provides service for task operations */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return t;
|
|
50
|
-
}
|
|
51
|
-
/** Create a new shortcut . */
|
|
52
|
-
async createShortcuts(options) {
|
|
53
|
-
const r = await this.endpoint.post(`${this.path}/create/shortcuts`, new RequestBuilder().json(options));
|
|
54
|
-
const results = (await r.json());
|
|
55
|
-
for (const t of results)
|
|
10
|
+
let DocumentStore = /** @class */ (() => {
|
|
11
|
+
class DocumentStore extends Store {
|
|
12
|
+
constructor(endpoint) {
|
|
13
|
+
super();
|
|
14
|
+
this.endpoint = endpoint;
|
|
15
|
+
this.path = "/api/documents";
|
|
16
|
+
/** Document created event dispatcher */
|
|
17
|
+
this._documentCreated = new EventDispatcher();
|
|
18
|
+
this._documentDeleted = new EventDispatcher();
|
|
19
|
+
this._linkCreated = new EventDispatcher();
|
|
20
|
+
this._linkDeleted = new EventDispatcher();
|
|
21
|
+
/** Store name */
|
|
22
|
+
this.name = documentStoreName;
|
|
23
|
+
/** Id of documents to be moved. */
|
|
24
|
+
this.moveIds = [];
|
|
25
|
+
/** All currently used documents. */
|
|
26
|
+
this.items = new CountedMap((key) => ({ id: key, loaded: false }), observable.map([], { deep: true }));
|
|
27
|
+
}
|
|
28
|
+
/** Event fires when a new document has been created. */
|
|
29
|
+
get DocumentCreatedEvent() {
|
|
30
|
+
return this._documentCreated.asEvent();
|
|
31
|
+
}
|
|
32
|
+
/** Event fires when a delete document has been deleted. */
|
|
33
|
+
get DocumentDeletedEvent() {
|
|
34
|
+
return this._documentDeleted.asEvent();
|
|
35
|
+
}
|
|
36
|
+
/** Events fires when link has been created for a document */
|
|
37
|
+
get LinkCreatedEvent() {
|
|
38
|
+
return this._linkCreated.asEvent();
|
|
39
|
+
}
|
|
40
|
+
/** Events fires when link has been created for a document */
|
|
41
|
+
get LinkDeletedEvent() {
|
|
42
|
+
return this._linkDeleted.asEvent();
|
|
43
|
+
}
|
|
44
|
+
/** Create a new document base on type. */
|
|
45
|
+
async createFromType(options) {
|
|
46
|
+
invariant(options.name, "Name cannot be empty.");
|
|
47
|
+
const r = await this.endpoint.post(`${this.path}/create`, new RequestBuilder().form(options));
|
|
48
|
+
const t = (await r.json());
|
|
56
49
|
this._documentCreated.dispatch(this, t);
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
/** Create a new draft version for a document
|
|
60
|
-
* @param id - id of the document
|
|
61
|
-
*/
|
|
62
|
-
async createNewDraftVersion(id) {
|
|
63
|
-
const r = await this.endpoint.post(`${this.path}/${id}/draft-version`);
|
|
64
|
-
const t = (await r.json());
|
|
65
|
-
this._documentCreated.dispatch(this, t);
|
|
66
|
-
return t;
|
|
67
|
-
}
|
|
68
|
-
/** Upload files to a document.
|
|
69
|
-
* @param files - Files to be uploaded.
|
|
70
|
-
* @param id - Document id upload to be uploaded.
|
|
71
|
-
*/
|
|
72
|
-
async upload(id, files) {
|
|
73
|
-
invariant(files, "files cannot be empty.");
|
|
74
|
-
invariant(id, "id cannot be empty.");
|
|
75
|
-
for (const f of files) {
|
|
76
|
-
const r = await this.endpoint.post(`/api/files/${id}`, new RequestBuilder().form({ file: f }));
|
|
77
|
-
const file = await r.json();
|
|
78
|
-
this._documentCreated.dispatch(this, file);
|
|
50
|
+
return t;
|
|
79
51
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
/** Load a list of documents from server.
|
|
89
|
-
* @param {LoadDocumentListOptions}
|
|
90
|
-
*/
|
|
91
|
-
async loadList(options) {
|
|
92
|
-
return await loadListFromServer(this, options);
|
|
93
|
-
}
|
|
94
|
-
/** Load a list of referenced documents of a document from server.
|
|
95
|
-
* @param id - id of the document to load the reference from.
|
|
96
|
-
* @param {LoadDocumentListOptions}
|
|
97
|
-
*/
|
|
98
|
-
async loadDocumentLinkList(id, options) {
|
|
99
|
-
invariant(id, "id cannot be empty");
|
|
100
|
-
return await loadListFromServer({ endpoint: this.endpoint, path: `${this.path}/${id}/links` }, options);
|
|
101
|
-
}
|
|
102
|
-
/** Load a list of activities of a document from server.
|
|
103
|
-
* @param id - id of the document.
|
|
104
|
-
* @param {LoadDocumentListOptions}
|
|
105
|
-
*/
|
|
106
|
-
async loadDocumentActivityList(id, options) {
|
|
107
|
-
invariant(id, "id cannot be empty");
|
|
108
|
-
return await loadListFromServer({ endpoint: this.endpoint, path: `${this.path}/${id}/activities` }, options);
|
|
109
|
-
}
|
|
110
|
-
/** Load a list of tags from server.
|
|
111
|
-
* @param query - query string
|
|
112
|
-
*/
|
|
113
|
-
async loadTags(query) {
|
|
114
|
-
const r = await this.endpoint.get(`${this.path}/tags?q=${query}`);
|
|
115
|
-
return (await r.json());
|
|
116
|
-
}
|
|
117
|
-
/** Edit an existing item on server. */
|
|
118
|
-
async edit(id, options) {
|
|
119
|
-
const r = await this.endpoint.post(`${this.path}/${id}/info`, new RequestBuilder().json(options));
|
|
120
|
-
const t = (await r.json());
|
|
121
|
-
this.items.overwrite(t.id, t);
|
|
122
|
-
}
|
|
123
|
-
/** Edit links of an existing item on server. */
|
|
124
|
-
async editLinks(id, options) {
|
|
125
|
-
const r = await this.endpoint.post(`${this.path}/${id}/links/info`, new RequestBuilder().json(options));
|
|
126
|
-
const t = (await r.json());
|
|
127
|
-
for (const link of t.linksAdded) {
|
|
128
|
-
this._linkCreated.dispatch(this, link);
|
|
52
|
+
/** Create a new shortcut . */
|
|
53
|
+
async createShortcuts(options) {
|
|
54
|
+
const r = await this.endpoint.post(`${this.path}/create/shortcuts`, new RequestBuilder().json(options));
|
|
55
|
+
const results = (await r.json());
|
|
56
|
+
for (const t of results)
|
|
57
|
+
this._documentCreated.dispatch(this, t);
|
|
58
|
+
return results;
|
|
129
59
|
}
|
|
130
|
-
|
|
131
|
-
|
|
60
|
+
/** Create a new draft version for a document
|
|
61
|
+
* @param id - id of the document
|
|
62
|
+
*/
|
|
63
|
+
async createNewDraftVersion(id) {
|
|
64
|
+
const r = await this.endpoint.post(`${this.path}/${id}/draft-version`);
|
|
65
|
+
const t = (await r.json());
|
|
66
|
+
this._documentCreated.dispatch(this, t);
|
|
67
|
+
return t;
|
|
132
68
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (item) {
|
|
145
|
-
deleted.push(item);
|
|
146
|
-
item.status = "Deleted";
|
|
147
|
-
this._documentDeleted.dispatch(this, item);
|
|
69
|
+
/** Upload files to a document.
|
|
70
|
+
* @param files - Files to be uploaded.
|
|
71
|
+
* @param id - Document id upload to be uploaded.
|
|
72
|
+
*/
|
|
73
|
+
async upload(id, files) {
|
|
74
|
+
invariant(files, "files cannot be empty.");
|
|
75
|
+
invariant(id, "id cannot be empty.");
|
|
76
|
+
for (const f of files) {
|
|
77
|
+
const r = await this.endpoint.post(`/api/files/${id}`, new RequestBuilder().form({ file: f }));
|
|
78
|
+
const file = await r.json();
|
|
79
|
+
this._documentCreated.dispatch(this, file);
|
|
148
80
|
}
|
|
149
81
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
82
|
+
/** Load a task from server.
|
|
83
|
+
* @param {string} id - id of the task.
|
|
84
|
+
* @param {LoadTaskOptions} options - Optional load options.
|
|
85
|
+
*/
|
|
86
|
+
async load(id, options) {
|
|
87
|
+
return await loadFromServer(this, id, options);
|
|
88
|
+
}
|
|
89
|
+
/** Load a list of documents from server.
|
|
90
|
+
* @param {LoadDocumentListOptions}
|
|
91
|
+
*/
|
|
92
|
+
async loadList(options) {
|
|
93
|
+
return await loadListFromServer(this, options);
|
|
94
|
+
}
|
|
95
|
+
/** Load a list of referenced documents of a document from server.
|
|
96
|
+
* @param id - id of the document to load the reference from.
|
|
97
|
+
* @param {LoadDocumentListOptions}
|
|
98
|
+
*/
|
|
99
|
+
async loadDocumentLinkList(id, options) {
|
|
100
|
+
invariant(id, "id cannot be empty");
|
|
101
|
+
return await loadListFromServer({ endpoint: this.endpoint, path: `${this.path}/${id}/links` }, options);
|
|
102
|
+
}
|
|
103
|
+
/** Load a list of activities of a document from server.
|
|
104
|
+
* @param id - id of the document.
|
|
105
|
+
* @param {LoadDocumentListOptions}
|
|
106
|
+
*/
|
|
107
|
+
async loadDocumentActivityList(id, options) {
|
|
108
|
+
invariant(id, "id cannot be empty");
|
|
109
|
+
return await loadListFromServer({ endpoint: this.endpoint, path: `${this.path}/${id}/activities` }, options);
|
|
110
|
+
}
|
|
111
|
+
/** Load a list of tags from server.
|
|
112
|
+
* @param query - query string
|
|
113
|
+
*/
|
|
114
|
+
async loadTags(query) {
|
|
115
|
+
const r = await this.endpoint.get(`${this.path}/tags?q=${query}`);
|
|
116
|
+
return (await r.json());
|
|
117
|
+
}
|
|
118
|
+
/** Edit an existing item on server. */
|
|
119
|
+
async edit(id, options) {
|
|
120
|
+
const r = await this.endpoint.post(`${this.path}/${id}/info`, new RequestBuilder().json(options));
|
|
121
|
+
const t = (await r.json());
|
|
122
|
+
this.items.overwrite(t.id, t);
|
|
123
|
+
}
|
|
124
|
+
/** Edit links of an existing item on server. */
|
|
125
|
+
async editLinks(id, options) {
|
|
126
|
+
const r = await this.endpoint.post(`${this.path}/${id}/links/info`, new RequestBuilder().json(options));
|
|
127
|
+
const t = (await r.json());
|
|
128
|
+
for (const link of t.linksAdded) {
|
|
129
|
+
this._linkCreated.dispatch(this, link);
|
|
130
|
+
}
|
|
131
|
+
for (const link of t.linksDeleted) {
|
|
132
|
+
this._linkDeleted.dispatch(this, link);
|
|
161
133
|
}
|
|
162
134
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
this.items.
|
|
135
|
+
/** Move Edit links of an existing item on server. */
|
|
136
|
+
async moveLinks(targetId, sourceId, AddLinks, RemoveLinks) {
|
|
137
|
+
await this.editLinks(sourceId, { RemoveLinks });
|
|
138
|
+
await this.editLinks(targetId, { AddLinks });
|
|
139
|
+
}
|
|
140
|
+
async delete(ids, options) {
|
|
141
|
+
await this.endpoint.delete(`${this.path}/delete`, new RequestBuilder().json({ Ids: ids, Options: options }));
|
|
142
|
+
const deleted = [];
|
|
143
|
+
for (const id of ids) {
|
|
144
|
+
const item = this.items.peek(id);
|
|
145
|
+
if (item) {
|
|
146
|
+
deleted.push(item);
|
|
147
|
+
item.status = "Deleted";
|
|
148
|
+
this._documentDeleted.dispatch(this, item);
|
|
149
|
+
}
|
|
173
150
|
}
|
|
174
|
-
|
|
151
|
+
return deleted;
|
|
175
152
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
153
|
+
/** Archive documents. */
|
|
154
|
+
async archive(ids) {
|
|
155
|
+
//const deleted = [];
|
|
156
|
+
for (const id of ids) {
|
|
157
|
+
await this.edit(id, { Status: "Archived" });
|
|
158
|
+
const item = this.items.peek(id);
|
|
159
|
+
if (item) {
|
|
160
|
+
item.status = "Archived";
|
|
161
|
+
this._documentDeleted.dispatch(this, item);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** Restore archived documents. */
|
|
166
|
+
async restore(ids) {
|
|
167
|
+
for (const id of ids) {
|
|
168
|
+
const r = await this.endpoint.post(`${this.path}/${id}/info`, new RequestBuilder().json({ Status: "Normal" }));
|
|
169
|
+
const t = await r.json();
|
|
170
|
+
const item = this.items.peek(id);
|
|
171
|
+
if (item) {
|
|
172
|
+
this._documentDeleted.dispatch(this, item);
|
|
173
|
+
this.items.overwrite(t.id, t);
|
|
174
|
+
}
|
|
175
|
+
this._documentCreated.dispatch(this, t);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async moveAfter(id, afterId) {
|
|
179
|
+
await this.endpoint.post(`${this.path}/${id}/move?afterId=${afterId}`);
|
|
180
|
+
}
|
|
181
|
+
cut(ids) {
|
|
182
|
+
invariant(ids, "Ids cannot be empty.");
|
|
183
|
+
this.moveIds = ids;
|
|
184
|
+
}
|
|
185
|
+
async paste(target) {
|
|
186
|
+
await this.move(toJS(this.moveIds), target);
|
|
187
|
+
this.moveIds = [];
|
|
188
|
+
}
|
|
189
|
+
async move(ids, targetId) {
|
|
190
|
+
invariant(ids, "ids cannot be empty.");
|
|
191
|
+
const result = await this.endpoint.post(`${this.path}/move`, new RequestBuilder().json({ Ids: ids, TargetId: targetId }));
|
|
192
|
+
const moved = await result.json();
|
|
193
|
+
for (const item of moved) {
|
|
194
|
+
this._documentCreated.dispatch(this, item);
|
|
195
|
+
}
|
|
196
|
+
this._documentDeleted.dispatch(this, moved);
|
|
197
|
+
return moved;
|
|
198
|
+
}
|
|
199
|
+
async loadAccess(id) {
|
|
200
|
+
invariant(id, "id cannot be empty");
|
|
201
|
+
const r = await this.endpoint.get(`${this.path}/${id}/permissions`);
|
|
202
|
+
return await r.json();
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Edit the access/role list of a document
|
|
206
|
+
* @param {string} id - Id of the document
|
|
207
|
+
* @param {boolean} inherit - Inherit access/role from parent or not
|
|
208
|
+
* @param {Array<{id:string;role:string}>} accesses - List of access right
|
|
209
|
+
*/
|
|
210
|
+
async editAccess(id, inherit, accesses) {
|
|
211
|
+
invariant(id, "id cannot be empty.");
|
|
212
|
+
invariant(inherit !== undefined, "Inherit cannot be be empty.");
|
|
213
|
+
invariant(accesses, "Accesses cannot be be empty.");
|
|
214
|
+
const r = await this.endpoint.post(`${this.path}/${id}/permissions`, new RequestBuilder().json({ inherit, accesses }));
|
|
215
|
+
return await r.json();
|
|
194
216
|
}
|
|
195
|
-
this._documentDeleted.dispatch(this, moved);
|
|
196
|
-
return moved;
|
|
197
|
-
}
|
|
198
|
-
async loadAccess(id) {
|
|
199
|
-
invariant(id, "id cannot be empty");
|
|
200
|
-
const r = await this.endpoint.get(`${this.path}/${id}/permissions`);
|
|
201
|
-
return await r.json();
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Edit the access/role list of a document
|
|
205
|
-
* @param {string} id - Id of the document
|
|
206
|
-
* @param {boolean} inherit - Inherit access/role from parent or not
|
|
207
|
-
* @param {Array<{id:string;role:string}>} accesses - List of access right
|
|
208
|
-
*/
|
|
209
|
-
async editAccess(id, inherit, accesses) {
|
|
210
|
-
invariant(id, "id cannot be empty.");
|
|
211
|
-
invariant(inherit !== undefined, "Inherit cannot be be empty.");
|
|
212
|
-
invariant(accesses, "Accesses cannot be be empty.");
|
|
213
|
-
const r = await this.endpoint.post(`${this.path}/${id}/permissions`, new RequestBuilder().json({ inherit, accesses }));
|
|
214
|
-
return await r.json();
|
|
215
217
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
218
|
+
__decorate([
|
|
219
|
+
observable
|
|
220
|
+
], DocumentStore.prototype, "moveIds", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
action
|
|
223
|
+
], DocumentStore.prototype, "editLinks", null);
|
|
224
|
+
__decorate([
|
|
225
|
+
action
|
|
226
|
+
], DocumentStore.prototype, "moveLinks", null);
|
|
227
|
+
__decorate([
|
|
228
|
+
action
|
|
229
|
+
], DocumentStore.prototype, "delete", null);
|
|
230
|
+
__decorate([
|
|
231
|
+
action
|
|
232
|
+
], DocumentStore.prototype, "archive", null);
|
|
233
|
+
__decorate([
|
|
234
|
+
action
|
|
235
|
+
], DocumentStore.prototype, "restore", null);
|
|
236
|
+
__decorate([
|
|
237
|
+
action
|
|
238
|
+
], DocumentStore.prototype, "moveAfter", null);
|
|
239
|
+
__decorate([
|
|
240
|
+
action
|
|
241
|
+
], DocumentStore.prototype, "cut", null);
|
|
242
|
+
__decorate([
|
|
243
|
+
action
|
|
244
|
+
], DocumentStore.prototype, "paste", null);
|
|
245
|
+
__decorate([
|
|
246
|
+
action
|
|
247
|
+
], DocumentStore.prototype, "move", null);
|
|
248
|
+
__decorate([
|
|
249
|
+
action
|
|
250
|
+
], DocumentStore.prototype, "loadAccess", null);
|
|
251
|
+
return DocumentStore;
|
|
252
|
+
})();
|
|
253
|
+
export { DocumentStore };
|
|
250
254
|
/** React hook to retrieve DocumentStore */
|
|
251
255
|
export const useDocumentStore = () => {
|
|
252
256
|
const context = useApplicationContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentStore.js","sourceRoot":"","sources":["../../../src/data/DocumentStore/DocumentStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAe,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAW5F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,I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;IAOD;QALC,MAAM;kDAON;IAID;QAFC,MAAM;4CAKN;IAID;QAFC,MAAM;8CAKN;IAOD;QALC,MAAM;6CAiBN;IAGD;QADC,MAAM;mDAKN;IAuBF,oBAAC;KAAA;SArTY,aAAa;AAuT1B,2CAA2C;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE;QACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;KACjE;IACD,OAAO,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB,CAAC;AAC9D,CAAC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LoadDocumentListOptions } from "../DocumentStore";
|
|
2
|
-
import {
|
|
2
|
+
import { IDocument } from "../../interfaces";
|
|
3
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
3
4
|
/** React hook to retrieve a list of activities of a document.
|
|
4
5
|
* @param id - the id of the document.
|
|
5
6
|
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
6
7
|
* @param options - Optional task list loading options.
|
|
7
8
|
*/
|
|
8
|
-
export declare const useDocumentActivityListEffect: (id: string, effect: (list:
|
|
9
|
+
export declare const useDocumentActivityListEffect: <T extends IDocument>(id: string, list: ListDataContextState<T> | null, effect: (list: T[]) => void, options?: LoadDocumentListOptions | undefined) => void;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { useDocumentStore } from "../DocumentStore";
|
|
2
|
-
import {
|
|
2
|
+
import { useDocumentListLoaderEffect } from ".";
|
|
3
3
|
/** React hook to retrieve a list of activities of a document.
|
|
4
4
|
* @param id - the id of the document.
|
|
5
5
|
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
6
6
|
* @param options - Optional task list loading options.
|
|
7
7
|
*/
|
|
8
|
-
export const useDocumentActivityListEffect = (id, effect, options) => {
|
|
8
|
+
export const useDocumentActivityListEffect = (id, list, effect, options) => {
|
|
9
9
|
const deps = options ? options : {};
|
|
10
10
|
const store = useDocumentStore();
|
|
11
11
|
// Call useDeepDepEffect directly because returned links do not need to be stored in counted map.
|
|
12
|
-
|
|
13
|
-
store.loadDocumentActivityList(id, options).then(effect);
|
|
14
|
-
}, [deps]);
|
|
12
|
+
return useDocumentListLoaderEffect(list, effect, () => store.loadDocumentActivityList(id, options), [deps]);
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=useDocumentActivityListEffect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentActivityListEffect.js","sourceRoot":"","sources":["../../../../src/data/DocumentStore/hooks/useDocumentActivityListEffect.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useDocumentActivityListEffect.js","sourceRoot":"","sources":["../../../../src/data/DocumentStore/hooks/useDocumentActivityListEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAM7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,GAAG,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC5C,EAAU,EACV,IAAoC,EACpC,MAA2B,EAC3B,OAAiC,EAChC,EAAE;IACH,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAA8B,CAAC;IACjE,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IAEjC,iGAAiG;IACjG,OAAO,2BAA2B,CACjC,IAAI,EACJ,MAAM,EACN,GAAG,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,EAAE,EAAE,OAAO,CAAQ,EACxD,CAAC,IAAI,CAAC,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -6,4 +6,4 @@ import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
|
6
6
|
* @param {Promise<T[]>} loader - a function return promise of list of documents.
|
|
7
7
|
* @param deps - a list of dependencies
|
|
8
8
|
*/
|
|
9
|
-
export declare function useDocumentListLoaderEffect<T extends IDocument>(list: ListDataContextState<T> | null, effect: (list: T[]) => void | null, loader: () => Promise<T[]>, deps?: any[]): void;
|
|
9
|
+
export declare function useDocumentListLoaderEffect<T extends IDocument>(list: ListDataContextState<T> | null, effect: ((list: T[]) => void) | null, loader: () => Promise<T[]>, deps?: any[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentListLoaderEffect.js","sourceRoot":"","sources":["../../../../src/data/DocumentStore/hooks/useDocumentListLoaderEffect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAC1C,IAAoC,EACpC,
|
|
1
|
+
{"version":3,"file":"useDocumentListLoaderEffect.js","sourceRoot":"","sources":["../../../../src/data/DocumentStore/hooks/useDocumentListLoaderEffect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAC1C,IAAoC,EACpC,MAAoC,EACpC,MAA0B,EAC1B,IAAY;IAEZ,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;IAErC,sEAAsE;IACtE,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QACrF,OAAO,EAAE,GAAG,EAAE;YACb,IAAI,IAAI;gBAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAC/B,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE;YACd,IAAI,IAAI;gBAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAChC,CAAC;KACD,CAAC,CAAC;IAEH,SAAS,WAAW,CAAC,MAAW;QAC/B,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ;YAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAC/E,MAAO,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC;AACF,CAAC"}
|
|
@@ -14,5 +14,6 @@ export declare const DocumentType: {
|
|
|
14
14
|
Dashboard: string;
|
|
15
15
|
Invoice: string;
|
|
16
16
|
Journal: string;
|
|
17
|
+
Shortcut: string;
|
|
17
18
|
};
|
|
18
19
|
export declare type docType = "text" | "document" | "task" | "meeting" | "board" | "graph" | "quotation" | "dashboard" | "invoice" | "journal" | "shortcut";
|
package/es/data/DocumentType.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentType.js","sourceRoot":"","sources":["../../src/data/DocumentType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"DocumentType.js","sourceRoot":"","sources":["../../src/data/DocumentType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,OAAO,EAAE,UAAU;IACnB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;CACpB,CAAC"}
|