@voplus/morpho-document 1.0.0-dev222 → 1.0.0-dev225
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/DocumentHeader/index.js +4 -8
- package/es/components/DocumentHeader/index.js.map +1 -1
- package/es/components/DocumentList/index.js +1 -3
- package/es/components/DocumentList/index.js.map +1 -1
- package/es/components/DocumentMenu/index.js +2 -4
- package/es/components/DocumentMenu/index.js.map +1 -1
- package/es/components/DocumentMenu/state.d.ts +2 -4
- package/es/components/DocumentMenu/state.js +4 -7
- package/es/components/DocumentMenu/state.js.map +1 -1
- package/es/data/DocumentStore/DocumentStore.d.ts +5 -1
- package/es/data/DocumentStore/DocumentStore.js +21 -1
- package/es/data/DocumentStore/DocumentStore.js.map +1 -1
- package/es/data/FileStore/index.d.ts +0 -1
- package/es/data/FileStore/index.js +0 -1
- package/es/data/FileStore/index.js.map +1 -1
- package/es/modules/unit/components/Members/index.js +4 -6
- package/es/modules/unit/components/Members/index.js.map +1 -1
- package/es/modules/unit/components/NewUnitForm/index.d.ts +1 -1
- package/es/modules/unit/components/SubUnitList/index.js +2 -4
- package/es/modules/unit/components/SubUnitList/index.js.map +1 -1
- package/es/modules/unit/components/UnitItem/SubUnitItem.js +0 -1
- package/es/modules/unit/components/UnitItem/SubUnitItem.js.map +1 -1
- package/es/modules/unit/controls/ToolBar/ContactMenu/index.js +12 -8
- package/es/modules/unit/controls/ToolBar/ContactMenu/index.js.map +1 -1
- package/es/modules/unit/controls/ToolBar/ContactMenu/state.d.ts +6 -5
- package/es/modules/unit/controls/ToolBar/ContactMenu/state.js +12 -7
- package/es/modules/unit/controls/ToolBar/ContactMenu/state.js.map +1 -1
- package/es/modules/unit/data/UnitStore.d.ts +12 -2
- package/es/modules/unit/data/UnitStore.js +38 -7
- package/es/modules/unit/data/UnitStore.js.map +1 -1
- package/es/modules/unit/data/hooks/index.d.ts +6 -0
- package/es/modules/unit/data/hooks/index.js +7 -0
- package/es/modules/unit/data/hooks/index.js.map +1 -0
- package/es/modules/unit/data/hooks/member-events/index.d.ts +3 -0
- package/es/modules/unit/data/hooks/member-events/index.js +4 -0
- package/es/modules/unit/data/hooks/member-events/index.js.map +1 -0
- package/es/modules/unit/data/hooks/member-events/useAutoUpdateMemberListData.d.ts +4 -0
- package/es/modules/unit/data/hooks/member-events/useAutoUpdateMemberListData.js +13 -0
- package/es/modules/unit/data/hooks/member-events/useAutoUpdateMemberListData.js.map +1 -0
- package/es/modules/unit/data/hooks/member-events/useOnDeleteMember.d.ts +4 -0
- package/es/modules/unit/data/hooks/member-events/useOnDeleteMember.js +17 -0
- package/es/modules/unit/data/hooks/member-events/useOnDeleteMember.js.map +1 -0
- package/es/modules/unit/data/hooks/member-events/useOnNewMember.d.ts +4 -0
- package/es/modules/unit/data/hooks/member-events/useOnNewMember.js +17 -0
- package/es/modules/unit/data/hooks/member-events/useOnNewMember.js.map +1 -0
- package/es/modules/unit/data/hooks/unit-events/index.d.ts +3 -0
- package/es/modules/unit/data/hooks/unit-events/index.js +4 -0
- package/es/modules/unit/data/hooks/unit-events/index.js.map +1 -0
- package/es/modules/unit/data/hooks/unit-events/useAutoUpdateUnitListData.d.ts +4 -0
- package/es/modules/unit/data/hooks/unit-events/useAutoUpdateUnitListData.js +13 -0
- package/es/modules/unit/data/hooks/unit-events/useAutoUpdateUnitListData.js.map +1 -0
- package/es/modules/unit/data/hooks/unit-events/useOnDeleteUnit.d.ts +4 -0
- package/es/modules/unit/data/hooks/unit-events/useOnDeleteUnit.js +17 -0
- package/es/modules/unit/data/hooks/unit-events/useOnDeleteUnit.js.map +1 -0
- package/es/modules/unit/data/hooks/unit-events/useOnNewUnit.d.ts +4 -0
- package/es/modules/unit/data/hooks/unit-events/useOnNewUnit.js +17 -0
- package/es/modules/unit/data/hooks/unit-events/useOnNewUnit.js.map +1 -0
- package/es/modules/unit/data/hooks/useTeamListEffect.d.ts +8 -0
- package/es/modules/unit/data/hooks/useTeamListEffect.js +27 -0
- package/es/modules/unit/data/hooks/useTeamListEffect.js.map +1 -0
- package/es/modules/unit/data/hooks/useUnit.d.ts +6 -0
- package/es/modules/unit/data/hooks/useUnit.js +12 -0
- package/es/modules/unit/data/hooks/useUnit.js.map +1 -0
- package/es/modules/unit/data/hooks/useUnitActivityListEffect.d.ts +8 -0
- package/es/modules/unit/data/hooks/useUnitActivityListEffect.js +16 -0
- package/es/modules/unit/data/hooks/useUnitActivityListEffect.js.map +1 -0
- package/es/modules/unit/data/hooks/useUnitListEffect.d.ts +8 -0
- package/es/modules/unit/data/hooks/useUnitListEffect.js +28 -0
- package/es/modules/unit/data/hooks/useUnitListEffect.js.map +1 -0
- package/package.json +1 -1
- package/es/data/FileStore/FileContext.d.ts +0 -6
- package/es/data/FileStore/FileContext.js +0 -40
- package/es/data/FileStore/FileContext.js.map +0 -1
- package/es/modules/unit/data/FileStore/FileContext.d.ts +0 -6
- package/es/modules/unit/data/FileStore/FileContext.js +0 -40
- package/es/modules/unit/data/FileStore/FileContext.js.map +0 -1
- package/es/modules/unit/data/FileStore/index.d.ts +0 -1
- package/es/modules/unit/data/FileStore/index.js +0 -2
- package/es/modules/unit/data/FileStore/index.js.map +0 -1
- package/es/modules/unit/data/hooks.d.ts +0 -30
- package/es/modules/unit/data/hooks.js +0 -115
- package/es/modules/unit/data/hooks.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IUnit, UnitStore } from "../../../data";
|
|
2
|
+
import { DocumentStore } from "../../../../../data/DocumentStore";
|
|
3
3
|
export declare type ContactMenuProps = {
|
|
4
|
-
id
|
|
4
|
+
id: string;
|
|
5
5
|
className?: string;
|
|
6
6
|
printPath?: string;
|
|
7
7
|
edit?: boolean;
|
|
@@ -25,9 +25,10 @@ export declare type ContactMenuProps = {
|
|
|
25
25
|
onUnlock?: () => void;
|
|
26
26
|
};
|
|
27
27
|
export declare class State {
|
|
28
|
+
private _unit;
|
|
28
29
|
private _store;
|
|
29
|
-
private
|
|
30
|
-
constructor(_store: UnitStore,
|
|
30
|
+
private _documents;
|
|
31
|
+
constructor(_unit: IUnit, _store: UnitStore, _documents: DocumentStore);
|
|
31
32
|
props: ContactMenuProps;
|
|
32
33
|
layout: any;
|
|
33
34
|
/** Menu item click */
|
|
@@ -3,9 +3,10 @@ import { Modal, message } from "@voplus/antd";
|
|
|
3
3
|
import { action, observable } from "mobx";
|
|
4
4
|
import Routes from "../../../../../routes";
|
|
5
5
|
export class State {
|
|
6
|
-
constructor(_store,
|
|
6
|
+
constructor(_unit, _store, _documents) {
|
|
7
|
+
this._unit = _unit;
|
|
7
8
|
this._store = _store;
|
|
8
|
-
this.
|
|
9
|
+
this._documents = _documents;
|
|
9
10
|
}
|
|
10
11
|
/** Menu item click */
|
|
11
12
|
async moreOperate({ key, domEvent }) {
|
|
@@ -26,21 +27,25 @@ export class State {
|
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
if (key === "Move") {
|
|
29
|
-
this.props.onMove ? this.props.onMove() : this.
|
|
30
|
+
this.props.onMove ? this.props.onMove() : this._store.cut([this.props.id]);
|
|
30
31
|
}
|
|
31
32
|
if (key === "Paste") {
|
|
32
33
|
if (this.props.onPaste) {
|
|
33
34
|
this.props.onPaste();
|
|
34
35
|
}
|
|
35
36
|
else {
|
|
36
|
-
if (this.
|
|
37
|
+
if (this._store.moveIds.some((id) => id === this.props.id)) {
|
|
37
38
|
return message.warn("Cannot move to itself");
|
|
38
39
|
}
|
|
39
|
-
this.
|
|
40
|
-
this._store.move(this._filestore.moveIds, this.props.id);
|
|
41
|
-
});
|
|
40
|
+
this._store.paste(this.props.id);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
43
|
+
if (key === "PasteDoc") {
|
|
44
|
+
if (this._documents.moveIds.some((id) => id === this._unit.containerId)) {
|
|
45
|
+
return message.warn("Cannot move to itself");
|
|
46
|
+
}
|
|
47
|
+
this._documents.paste(this._unit.containerId);
|
|
48
|
+
}
|
|
44
49
|
if (key === "OpenTreeView" && this.props.id)
|
|
45
50
|
this.layout.history.push(Routes.UnitTree.getUrl(this.props.id));
|
|
46
51
|
if (key === "OpenDocumentAccess" && this.props.onContainerAccess)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/controls/ToolBar/ContactMenu/state.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/controls/ToolBar/ContactMenu/state.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,MAAM,MAAM,uBAAuB,CAAC;AA2B3C,MAAM,OAAO,KAAK;IACjB,YACS,KAAY,EACZ,MAAiB,EACjB,UAAyB;QAFzB,UAAK,GAAL,KAAK,CAAO;QACZ,WAAM,GAAN,MAAM,CAAW;QACjB,eAAU,GAAV,UAAU,CAAe;IAC/B,CAAC;IAIJ,sBAAsB;IAEf,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAO;QAC9C,QAAQ,CAAC,eAAe,EAAE,CAAC;QAC3B,IAAI,GAAG,KAAK,MAAM;YAAE,IAAI,CAAC,KAAK,CAAC,MAAO,EAAE,CAAC;QACzC,IAAI,GAAG,KAAK,QAAQ,EAAE;YACrB,KAAK,CAAC,OAAO,CAAC;gBACb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,kCAAkC;gBAC3F,IAAI,EAAE,GAAG,EAAE;oBACV,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;wBACxB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE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,EAAE;YAC1C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACjE,IAAI,GAAG,KAAK,oBAAoB,IAAI,IAAI,CAAC,KAAK,CAAC,iBAAiB;YAC/D,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAChC,IAAI,GAAG,KAAK,MAAM;YAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAI,CAAC,CAAC;QAC9D,wBAAwB;QACxB,qBAAqB;QACrB,0BAA0B;QAC1B,gEAAgE;QAChE,IAAI;QACJ,0BAA0B;QAC1B,uBAAuB;QACvB,4BAA4B;QAC5B,8DAA8D;QAC9D,IAAI;QACJ,IAAI,GAAG,KAAK,OAAO;YAClB,MAAM,CAAC,IAAI,CACV,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,EAClF,QAAQ,CACR,CAAC;IACJ,CAAC;CACD;AA/DY;IAAX,UAAU;oCAAgC;AAC/B;IAAX,UAAU;qCAAoB;AAI/B;IADC,MAAM;wCA0DN"}
|
|
@@ -45,11 +45,19 @@ export declare class UnitStore extends Store {
|
|
|
45
45
|
/** Contac created event dispatcher */
|
|
46
46
|
private readonly _created;
|
|
47
47
|
private readonly _deleted;
|
|
48
|
+
private readonly _memberCreated;
|
|
49
|
+
private readonly _memberDeleted;
|
|
48
50
|
constructor(_api: ApiEndPoint);
|
|
49
|
-
/**
|
|
51
|
+
/** Id of documents to be moved. */
|
|
52
|
+
moveIds: string[];
|
|
53
|
+
/** Event fires when a new unit has been created. */
|
|
50
54
|
get UnitCreatedEvent(): import("strongly-typed-events").IEvent<UnitStore, IUnit>;
|
|
51
55
|
/** Event fires when a delete contact has been deleted. */
|
|
52
56
|
get UnitDeletedEvent(): import("strongly-typed-events").IEvent<UnitStore, IUnit>;
|
|
57
|
+
/** Event fires when a new member has been created. */
|
|
58
|
+
get MemberCreatedEvent(): import("strongly-typed-events").IEvent<UnitStore, IUnit>;
|
|
59
|
+
/** Event fires when a delete member has been deleted. */
|
|
60
|
+
get MemberDeletedEvent(): import("strongly-typed-events").IEvent<UnitStore, IUnit>;
|
|
53
61
|
readonly items: CountedMap<string, IUnit>;
|
|
54
62
|
/** Create a default contact object with optional default values. */
|
|
55
63
|
static createDefaultContact(defaultValues?: Partial<IUnit>): IUnit;
|
|
@@ -66,7 +74,7 @@ export declare class UnitStore extends Store {
|
|
|
66
74
|
addUserFromGroup(options: {
|
|
67
75
|
pid: string;
|
|
68
76
|
id: string;
|
|
69
|
-
}): Promise<
|
|
77
|
+
}): Promise<IUnit>;
|
|
70
78
|
/** Load a task from server.
|
|
71
79
|
* @param {string} id - id of the task.
|
|
72
80
|
* @param {LoadTaskOptions} options - Optional load options.
|
|
@@ -102,6 +110,8 @@ export declare class UnitStore extends Store {
|
|
|
102
110
|
id: string;
|
|
103
111
|
}): Promise<IUnit>;
|
|
104
112
|
moveAfter(id: string, afterId?: string): Promise<void>;
|
|
113
|
+
cut(ids: string[]): void;
|
|
114
|
+
paste(target: string): void;
|
|
105
115
|
move(ids: string[], targetId?: string): Promise<any>;
|
|
106
116
|
}
|
|
107
117
|
/** React hook to retrieve ContactStore */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { RequestBuilder } from "@voplus/api";
|
|
3
3
|
import { CountedMap, Store, useApplicationContext } from "@voplus/morpho-data";
|
|
4
|
-
import { action, observable } from "mobx";
|
|
4
|
+
import { action, observable, toJS } from "mobx";
|
|
5
5
|
import { EventDispatcher } from "strongly-typed-events";
|
|
6
6
|
import hash from "object-hash";
|
|
7
7
|
import invariant from "invariant";
|
|
@@ -15,11 +15,15 @@ export class UnitStore extends Store {
|
|
|
15
15
|
/** Contac created event dispatcher */
|
|
16
16
|
this._created = new EventDispatcher();
|
|
17
17
|
this._deleted = new EventDispatcher();
|
|
18
|
+
this._memberCreated = new EventDispatcher();
|
|
19
|
+
this._memberDeleted = new EventDispatcher();
|
|
20
|
+
/** Id of documents to be moved. */
|
|
21
|
+
this.moveIds = [];
|
|
18
22
|
this.items = new CountedMap((key) => UnitStore.createDefaultContact({ id: key }), observable.map([], { deep: true }));
|
|
19
23
|
this._listCache = new Map();
|
|
20
24
|
invariant(_api, `API cannot be ${_api}.`);
|
|
21
25
|
}
|
|
22
|
-
/** Event fires when a new
|
|
26
|
+
/** Event fires when a new unit has been created. */
|
|
23
27
|
get UnitCreatedEvent() {
|
|
24
28
|
return this._created.asEvent();
|
|
25
29
|
}
|
|
@@ -27,6 +31,14 @@ export class UnitStore extends Store {
|
|
|
27
31
|
get UnitDeletedEvent() {
|
|
28
32
|
return this._deleted.asEvent();
|
|
29
33
|
}
|
|
34
|
+
/** Event fires when a new member has been created. */
|
|
35
|
+
get MemberCreatedEvent() {
|
|
36
|
+
return this._memberCreated.asEvent();
|
|
37
|
+
}
|
|
38
|
+
/** Event fires when a delete member has been deleted. */
|
|
39
|
+
get MemberDeletedEvent() {
|
|
40
|
+
return this._memberDeleted.asEvent();
|
|
41
|
+
}
|
|
30
42
|
/** Create a default contact object with optional default values. */
|
|
31
43
|
static createDefaultContact(defaultValues) {
|
|
32
44
|
const v = { loaded: false, address: {}, primaryLegalIdentity: {} };
|
|
@@ -50,10 +62,11 @@ export class UnitStore extends Store {
|
|
|
50
62
|
async addUserFromGroup(options) {
|
|
51
63
|
// invariant(options.name, "Name cannot be empty.");
|
|
52
64
|
const r = await this._api.post(`/api/groups/${options.pid}/add/${options.id}`);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
const t = (await r.json());
|
|
66
|
+
t.parentNodeId = options.pid;
|
|
67
|
+
this._memberCreated.dispatch(this, t);
|
|
68
|
+
console.log("addUserFromGroup", t);
|
|
69
|
+
return t;
|
|
57
70
|
}
|
|
58
71
|
/** Load a task from server.
|
|
59
72
|
* @param {string} id - id of the task.
|
|
@@ -147,12 +160,21 @@ export class UnitStore extends Store {
|
|
|
147
160
|
async deleteUser(options) {
|
|
148
161
|
await this._api.delete(`api/groups/${options.pid}/remove/${options.id}`);
|
|
149
162
|
const item = this.items.peek(options.id);
|
|
150
|
-
|
|
163
|
+
item.parentNodeId = options.pid;
|
|
164
|
+
this._memberDeleted.dispatch(this, item);
|
|
151
165
|
return item;
|
|
152
166
|
}
|
|
153
167
|
async moveAfter(id, afterId) {
|
|
154
168
|
await this._api.post(`api/units/${id}/move?afterId=${afterId}`);
|
|
155
169
|
}
|
|
170
|
+
cut(ids) {
|
|
171
|
+
invariant(ids, "Ids cannot be empty.");
|
|
172
|
+
this.moveIds = ids;
|
|
173
|
+
}
|
|
174
|
+
paste(target) {
|
|
175
|
+
this.move(toJS(this.moveIds), target);
|
|
176
|
+
this.moveIds = [];
|
|
177
|
+
}
|
|
156
178
|
async move(ids, targetId) {
|
|
157
179
|
const result = await this._api.post(`api/units/move`, new RequestBuilder().json({ Ids: ids, TargetId: targetId }));
|
|
158
180
|
const moved = await result.json();
|
|
@@ -163,6 +185,9 @@ export class UnitStore extends Store {
|
|
|
163
185
|
return moved;
|
|
164
186
|
}
|
|
165
187
|
}
|
|
188
|
+
__decorate([
|
|
189
|
+
observable
|
|
190
|
+
], UnitStore.prototype, "moveIds", void 0);
|
|
166
191
|
__decorate([
|
|
167
192
|
observable
|
|
168
193
|
], UnitStore.prototype, "items", void 0);
|
|
@@ -172,6 +197,12 @@ __decorate([
|
|
|
172
197
|
__decorate([
|
|
173
198
|
action
|
|
174
199
|
], UnitStore.prototype, "moveAfter", null);
|
|
200
|
+
__decorate([
|
|
201
|
+
action
|
|
202
|
+
], UnitStore.prototype, "cut", null);
|
|
203
|
+
__decorate([
|
|
204
|
+
action
|
|
205
|
+
], UnitStore.prototype, "paste", null);
|
|
175
206
|
__decorate([
|
|
176
207
|
action
|
|
177
208
|
], UnitStore.prototype, "move", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitStore.js","sourceRoot":"","sources":["../../../../src/modules/unit/data/UnitStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAe,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG5F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"UnitStore.js","sourceRoot":"","sources":["../../../../src/modules/unit/data/UnitStore.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAe,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG5F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,SAAS,GAAG,WAAW,CAAC;AAqD9B,MAAM,OAAO,SAAU,SAAQ,KAAK;IAQnC,YAAoC,IAAiB;QACpD,KAAK,EAAE,CAAC;QAD2B,SAAI,GAAJ,IAAI,CAAa;QAPrC,SAAI,GAAW,SAAS,CAAC;QACzC,sCAAsC;QACrB,aAAQ,GAAG,IAAI,eAAe,EAAoB,CAAC;QACnD,aAAQ,GAAG,IAAI,eAAe,EAAoB,CAAC;QACnD,mBAAc,GAAG,IAAI,eAAe,EAAoB,CAAC;QACzD,mBAAc,GAAG,IAAI,eAAe,E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AFC,MAAM;uCAON;AAmBD;IALC,MAAM;0CAON;AAID;IAFC,MAAM;oCAKN;AAID;IAFC,MAAM;sCAKN;AAOD;IALC,MAAM;qCAgBN;AAGF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAChC,MAAM,OAAO,GAAG,qBAAqB,EAAE,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;KAC7D;IACD,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe,CAAC;AAClD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/modules/unit/data/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/member-events/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IUnit } from "../../interfaces";
|
|
2
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
3
|
+
/** React hook to call action when a new Member has been created. */
|
|
4
|
+
export declare const useAutoUpdateMemberListData: (list: ListDataContextState<IUnit>, shouldUpdate: (d: IUnit, event: string) => boolean) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useOnDeleteMember, useOnNewMember } from "./";
|
|
2
|
+
/** React hook to call action when a new Member has been created. */
|
|
3
|
+
export const useAutoUpdateMemberListData = (list, shouldUpdate) => {
|
|
4
|
+
useOnNewMember((s, d) => {
|
|
5
|
+
if (shouldUpdate(d, "new"))
|
|
6
|
+
list.union([d]);
|
|
7
|
+
});
|
|
8
|
+
useOnDeleteMember((s, d) => {
|
|
9
|
+
if (shouldUpdate(d, "delete"))
|
|
10
|
+
list.remove(d.id);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useAutoUpdateMemberListData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoUpdateMemberListData.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/member-events/useAutoUpdateMemberListData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAKvD,oEAAoE;AACpE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAC1C,IAAiC,EACjC,YAAkD,EACjD,EAAE;IACH,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACvB,IAAI,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,IAAI,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useUnitStore } from "../../UnitStore";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/** React hook to call action when a delete Member has been created. */
|
|
4
|
+
export const useOnDeleteMember = (action) => {
|
|
5
|
+
const store = useUnitStore();
|
|
6
|
+
const onDeleteMember = (store, doc) => {
|
|
7
|
+
console.log(`onDeleteMember - ${doc.id} ${doc.name}`);
|
|
8
|
+
action(store, doc);
|
|
9
|
+
};
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
store.MemberDeletedEvent.subscribe(onDeleteMember);
|
|
12
|
+
return () => {
|
|
13
|
+
store.MemberDeletedEvent.unsubscribe(onDeleteMember);
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useOnDeleteMember.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnDeleteMember.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/member-events/useOnDeleteMember.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA8C,EAAE,EAAE;IACnF,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,CAAC,KAAgB,EAAE,GAAU,EAAE,EAAE;QACvD,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE;YACX,KAAK,CAAC,kBAAkB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACtD,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useUnitStore } from "../../UnitStore";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/** React hook to call action when a new member has been created. */
|
|
4
|
+
export const useOnNewMember = (action) => {
|
|
5
|
+
const store = useUnitStore();
|
|
6
|
+
const onNewMember = (store, doc) => {
|
|
7
|
+
console.log(`onNewMember - ${doc.id} ${doc.name}`);
|
|
8
|
+
action(store, doc);
|
|
9
|
+
};
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
store.MemberCreatedEvent.subscribe(onNewMember);
|
|
12
|
+
return () => {
|
|
13
|
+
store.MemberCreatedEvent.unsubscribe(onNewMember);
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useOnNewMember.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnNewMember.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/member-events/useOnNewMember.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,oEAAoE;AACpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAA8C,EAAE,EAAE;IAChF,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,CAAC,KAAgB,EAAE,GAAU,EAAE,EAAE;QACpD,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAChD,OAAO,GAAG,EAAE;YACX,KAAK,CAAC,kBAAkB,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACnD,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/unit-events/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IUnit } from "../../interfaces";
|
|
2
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
3
|
+
/** React hook to call action when a new unit has been created. */
|
|
4
|
+
export declare const useAutoUpdateUnitListData: (list: ListDataContextState<IUnit>, shouldUpdate: (d: IUnit, event: string) => boolean) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useOnDeleteUnit, useOnNewUnit } from "./";
|
|
2
|
+
/** React hook to call action when a new unit has been created. */
|
|
3
|
+
export const useAutoUpdateUnitListData = (list, shouldUpdate) => {
|
|
4
|
+
useOnNewUnit((s, d) => {
|
|
5
|
+
if (shouldUpdate(d, "new"))
|
|
6
|
+
list.union([d]);
|
|
7
|
+
});
|
|
8
|
+
useOnDeleteUnit((s, d) => {
|
|
9
|
+
if (shouldUpdate(d, "delete"))
|
|
10
|
+
list.remove(d.id);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useAutoUpdateUnitListData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoUpdateUnitListData.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/unit-events/useAutoUpdateUnitListData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAKnD,kEAAkE;AAClE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACxC,IAAiC,EACjC,YAAkD,EACjD,EAAE;IACH,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACrB,IAAI,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACxB,IAAI,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useUnitStore } from "../../UnitStore";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/** React hook to call action when a delete unit has been created. */
|
|
4
|
+
export const useOnDeleteUnit = (action) => {
|
|
5
|
+
const store = useUnitStore();
|
|
6
|
+
const onDeleteUnit = (store, doc) => {
|
|
7
|
+
console.log(`onDeleteUnit - ${doc.id} ${doc.name}`);
|
|
8
|
+
action(store, doc);
|
|
9
|
+
};
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
store.UnitDeletedEvent.subscribe(onDeleteUnit);
|
|
12
|
+
return () => {
|
|
13
|
+
store.UnitDeletedEvent.unsubscribe(onDeleteUnit);
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useOnDeleteUnit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnDeleteUnit.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/unit-events/useOnDeleteUnit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAA8C,EAAE,EAAE;IACjF,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,MAAM,YAAY,GAAG,CAAC,KAAgB,EAAE,GAAU,EAAE,EAAE;QACrD,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE;YACX,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAClD,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useUnitStore } from "../../UnitStore";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/** React hook to call action when a new unit has been created. */
|
|
4
|
+
export const useOnNewUnit = (action) => {
|
|
5
|
+
const store = useUnitStore();
|
|
6
|
+
const onNewUnit = (store, doc) => {
|
|
7
|
+
console.log(`onNewUnit - ${doc.id} ${doc.name}`);
|
|
8
|
+
action(store, doc);
|
|
9
|
+
};
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
store.UnitCreatedEvent.subscribe(onNewUnit);
|
|
12
|
+
return () => {
|
|
13
|
+
store.UnitCreatedEvent.unsubscribe(onNewUnit);
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useOnNewUnit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnNewUnit.js","sourceRoot":"","sources":["../../../../../../src/modules/unit/data/hooks/unit-events/useOnNewUnit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,kEAAkE;AAClE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAA8C,EAAE,EAAE;IAC9E,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,CAAC,KAAgB,EAAE,GAAU,EAAE,EAAE;QAClD,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACjD,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACd,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO,GAAG,EAAE;YACX,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LoadUnitListOptions } from "../UnitStore";
|
|
2
|
+
import { IUnit } from "../interfaces";
|
|
3
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
4
|
+
/** React hook to retrieve a list of Team
|
|
5
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
6
|
+
* @param options - Optional team list loading options.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTeamListEffect: (id: string, list: ListDataContextState<IUnit> | null, effect: (list: IUnit[]) => void, options?: LoadUnitListOptions | undefined) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useUnitStore } from "../UnitStore";
|
|
2
|
+
import { useCountedMapListEffect } from "@voplus/morpho-data";
|
|
3
|
+
/** React hook to retrieve a list of Team
|
|
4
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
5
|
+
* @param options - Optional team list loading options.
|
|
6
|
+
*/
|
|
7
|
+
export const useTeamListEffect = (id, list, effect, options) => {
|
|
8
|
+
const deps = options ? options : {};
|
|
9
|
+
const contacts = useUnitStore();
|
|
10
|
+
// Call useContactListEffect and ensure won't load twice for same loading options.
|
|
11
|
+
return useCountedMapListEffect(effect ? innerEffect : effect, contacts.items, () => contacts.loadTeamList(id, options), [deps], {
|
|
12
|
+
preload: () => {
|
|
13
|
+
if (list)
|
|
14
|
+
list.loading = true;
|
|
15
|
+
},
|
|
16
|
+
postload: () => {
|
|
17
|
+
if (list)
|
|
18
|
+
list.loading = false;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
function innerEffect(result) {
|
|
22
|
+
if (list && result.length < list.filters.paging.PageSize)
|
|
23
|
+
list.hasMore = false;
|
|
24
|
+
effect(result);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=useTeamListEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTeamListEffect.js","sourceRoot":"","sources":["../../../../../src/modules/unit/data/hooks/useTeamListEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAE,MAAM,cAAc,CAAC;AAIjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAChC,EAAU,EACV,IAAwC,EACxC,MAA+B,EAC/B,OAA6B,EAC5B,EAAE;IACH,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAA0B,CAAC;IAC7D,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAEhC,kFAAkF;IAClF,OAAO,uBAAuB,CAC7B,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAC7B,QAAQ,CAAC,KAAK,EACd,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,CAAC,EACxC,CAAC,IAAI,CAAC,EACN;QACC,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,CACD,CAAC;IAEF,SAAS,WAAW,CAAC,MAAe;QACnC,IAAI,IAAI,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ;YAAE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAC/E,MAAM,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LoadUnitOptions } from "../UnitStore";
|
|
2
|
+
/** React hook to retrieve a unit
|
|
3
|
+
* @param {string} id - id of the unit
|
|
4
|
+
* @param {LoadUnitOptions} options - options
|
|
5
|
+
*/
|
|
6
|
+
export declare const useUnit: (id: string, options?: LoadUnitOptions | undefined) => import("..").IUnit;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useUnitStore } from "../UnitStore";
|
|
2
|
+
import { useLoadCountedMapItem } from "@voplus/morpho-data";
|
|
3
|
+
/** React hook to retrieve a unit
|
|
4
|
+
* @param {string} id - id of the unit
|
|
5
|
+
* @param {LoadUnitOptions} options - options
|
|
6
|
+
*/
|
|
7
|
+
export const useUnit = (id, options) => {
|
|
8
|
+
options = options ? options : {};
|
|
9
|
+
const store = useUnitStore();
|
|
10
|
+
return useLoadCountedMapItem(id, store.items, () => store.load(id, options), options);
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useUnit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnit.js","sourceRoot":"","sources":["../../../../../src/modules/unit/data/hooks/useUnit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAE,OAAyB,EAAE,EAAE;IAChE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAAsB,CAAC;IACtD,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAE7B,OAAO,qBAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,OAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AACxF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LoadUnitListOptions } from "../UnitStore";
|
|
2
|
+
import { IActivityLog } from "@voplus/morpho-collaboration/es/data/interfaces/IActivityLog";
|
|
3
|
+
/** React hook to retrieve a list of activities of a contact.
|
|
4
|
+
* @param id - the id of the contact.
|
|
5
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
6
|
+
* @param options - Optional task list loading options.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useUnitActivityListEffect: (id: string, effect: (list: IActivityLog[]) => void, options?: LoadUnitListOptions | undefined) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useUnitStore } from "../UnitStore";
|
|
2
|
+
import { useDeepDepEffect } from "@voplus/morpho-data";
|
|
3
|
+
/** React hook to retrieve a list of activities of a contact.
|
|
4
|
+
* @param id - the id of the contact.
|
|
5
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
6
|
+
* @param options - Optional task list loading options.
|
|
7
|
+
*/
|
|
8
|
+
export const useUnitActivityListEffect = (id, effect, options) => {
|
|
9
|
+
const deps = options ? options : {};
|
|
10
|
+
const store = useUnitStore();
|
|
11
|
+
// Call useDeepDepEffect directly because returned links do not need to be stored in counted map.
|
|
12
|
+
useDeepDepEffect(() => {
|
|
13
|
+
store.loadActivityList(id, options).then(effect);
|
|
14
|
+
}, [deps]);
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useUnitActivityListEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnitActivityListEffect.js","sourceRoot":"","sources":["../../../../../src/modules/unit/data/hooks/useUnitActivityListEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACxC,EAAU,EACV,MAAsC,EACtC,OAA6B,EAC5B,EAAE;IACH,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAE,EAA0B,CAAC;IAC7D,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAE7B,iGAAiG;IACjG,gBAAgB,CAAC,GAAG,EAAE;QACrB,KAAK,CAAC,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACZ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LoadUnitListOptions } from "../UnitStore";
|
|
2
|
+
import { IUnit } from "../interfaces";
|
|
3
|
+
import { ListDataContextState } from "@voplus/morpho-ui/es/data";
|
|
4
|
+
/** React hook to retrieve a list of units
|
|
5
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
6
|
+
* @param options - Optional unit list loading options.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useUnitListEffect: (list: ListDataContextState<IUnit> | null, effect: (list: IUnit[]) => void, options?: LoadUnitListOptions | undefined) => void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useUnitStore } from "../UnitStore";
|
|
2
|
+
import { useCountedMapListEffect } from "@voplus/morpho-data";
|
|
3
|
+
/** React hook to retrieve a list of units
|
|
4
|
+
* @param effect - Effect callback to be ran after successful retrieved the list.
|
|
5
|
+
* @param options - Optional unit list loading options.
|
|
6
|
+
*/
|
|
7
|
+
export const useUnitListEffect = (list, effect, options) => {
|
|
8
|
+
const deps = options ? options : {};
|
|
9
|
+
const contacts = useUnitStore();
|
|
10
|
+
// Call useContactListEffect and ensure won't load twice for same loading options.
|
|
11
|
+
// return useCountedMapListEffect(list, effect, contacts.items, () => contacts.loadList(options), [deps]);
|
|
12
|
+
return useCountedMapListEffect(effect ? innerEffect : effect, contacts.items, () => contacts.loadList(options), [deps], {
|
|
13
|
+
preload: () => {
|
|
14
|
+
if (list)
|
|
15
|
+
list.loading = true;
|
|
16
|
+
},
|
|
17
|
+
postload: () => {
|
|
18
|
+
if (list)
|
|
19
|
+
list.loading = false;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
function innerEffect(result) {
|
|
23
|
+
if (list && result.length < list.filters.paging.PageSize)
|
|
24
|
+
list.hasMore = false;
|
|
25
|
+
effect(result);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=useUnitListEffect.js.map
|