@social-mail/social-mail-client 1.2.6 → 1.2.8
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/dist/admin/AdminAppIndex.pack.js +242 -55
- package/dist/admin/AdminAppIndex.pack.js.map +1 -1
- package/dist/admin/AdminAppIndex.pack.min.js +21 -5
- package/dist/admin/AdminAppIndex.pack.min.js.map +1 -1
- package/dist/common/controls/file-preview/FilePreview.d.ts.map +1 -1
- package/dist/common/controls/file-preview/FilePreview.js +1 -0
- package/dist/common/controls/file-preview/FilePreview.js.map +1 -1
- package/dist/common/events/CommonEvents.d.ts +3 -1
- package/dist/common/events/CommonEvents.d.ts.map +1 -1
- package/dist/common/events/CommonEvents.js +3 -1
- package/dist/common/events/CommonEvents.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/web/AppIndex.pack.js +242 -55
- package/dist/web/AppIndex.pack.js.map +1 -1
- package/dist/web/AppIndex.pack.min.js +22 -6
- package/dist/web/AppIndex.pack.min.js.map +1 -1
- package/dist/web/page/mails/ConversationPage.d.ts +0 -1
- package/dist/web/page/mails/ConversationPage.d.ts.map +1 -1
- package/dist/web/page/mails/ConversationPage.js +4 -8
- package/dist/web/page/mails/ConversationPage.js.map +1 -1
- package/dist/web/page/mails/{MiniComposeBox.d.ts → mini-compose/MiniComposeBox.d.ts} +8 -4
- package/dist/web/page/mails/mini-compose/MiniComposeBox.d.ts.map +1 -0
- package/dist/web/page/mails/{MiniComposeBox.js → mini-compose/MiniComposeBox.js} +111 -20
- package/dist/web/page/mails/mini-compose/MiniComposeBox.js.map +1 -0
- package/dist/web/page/mails/mini-compose/SendFiles.d.ts +9 -0
- package/dist/web/page/mails/mini-compose/SendFiles.d.ts.map +1 -0
- package/dist/web/page/mails/mini-compose/SendFiles.js +78 -0
- package/dist/web/page/mails/mini-compose/SendFiles.js.map +1 -0
- package/dist/web/page/mails/service/ConversationService.d.ts +1 -1
- package/dist/web/page/mails/service/ConversationService.d.ts.map +1 -1
- package/dist/web/page/mails/service/ConversationService.js +5 -3
- package/dist/web/page/mails/service/ConversationService.js.map +1 -1
- package/dist/web/page/mails/service/MailService.d.ts +2 -1
- package/dist/web/page/mails/service/MailService.d.ts.map +1 -1
- package/dist/web/page/mails/service/MailService.js +16 -2
- package/dist/web/page/mails/service/MailService.js.map +1 -1
- package/package.json +1 -1
- package/src/common/controls/file-preview/FilePreview.tsx +1 -0
- package/src/common/events/CommonEvents.ts +6 -2
- package/src/web/page/mails/ConversationPage.tsx +2 -7
- package/src/web/page/mails/mini-compose/MiniComposeBox.tsx +198 -0
- package/src/web/page/mails/mini-compose/SendFiles.tsx +63 -0
- package/src/web/page/mails/service/ConversationService.tsx +3 -1
- package/src/web/page/mails/service/MailService.ts +11 -1
- package/dist/web/page/mails/MiniComposeBox.d.ts.map +0 -1
- package/dist/web/page/mails/MiniComposeBox.js.map +0 -1
- package/src/web/page/mails/MiniComposeBox.tsx +0 -118
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MailService.d.ts","sourceRoot":"","sources":["../../../../../src/web/page/mails/service/MailService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgC,MAAM,EAA2B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"MailService.d.ts","sourceRoot":"","sources":["../../../../../src/web/page/mails/service/MailService.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgC,QAAQ,EAAE,MAAM,EAA2B,MAAM,yBAAyB,CAAC;AAKlH,MAAM,CAAC,OAAO,OAAO,WAAW;IAG5B,OAAO,CAAC,aAAa,CAAgB;IAE/B,OAAO,CAAC,SAAS,EAAE,MAAM;IAOzB,IAAI,CAAC,EACP,MAAW,EACX,SAAS,EACT,KAAS,EACT,IAAS,EACT,OAAW,EACX,WAAmB,EACnB,WAAW,EACd;;;;;;;;KAAA;IAkBK,GAAG,CAAC,KAAK,EAAE,MAAM;IAOjB,IAAI,CAAC,KAAK,EAAE,MAAM;IAUlB,gBAAgB,CAAC,IAAI,EAAE,QAAQ;CAQxC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/core/dist/di/Inject", "../../../../services/EntityService", "../../../../model/model", "../../../../common/Sql"], function (_export, _context) {
|
|
1
|
+
System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/core/dist/di/Inject", "../../../../services/EntityService", "../../../../model/model", "../../../../common/Sql", "../../../../common/events/CommonEvents"], function (_export, _context) {
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
var __awaiter, __decorate, __metadata, DISingleton, Inject, EntityService, AppFile, Mailbox, MailboxContact, Sql, MailService;
|
|
4
|
+
var __awaiter, __decorate, __metadata, DISingleton, Inject, EntityService, AppFile, Mailbox, MailboxContact, Sql, CommonEvents, MailService;
|
|
5
5
|
return {
|
|
6
6
|
setters: [function (_tslib) {
|
|
7
7
|
__awaiter = _tslib.__awaiter;
|
|
@@ -19,6 +19,8 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
|
|
|
19
19
|
MailboxContact = _modelModel.MailboxContact;
|
|
20
20
|
}, function (_commonSql) {
|
|
21
21
|
Sql = _commonSql.Sql;
|
|
22
|
+
}, function (_commonEventsCommonEvents) {
|
|
23
|
+
CommonEvents = _commonEventsCommonEvents.CommonEvents;
|
|
22
24
|
}],
|
|
23
25
|
execute: function () {
|
|
24
26
|
MailService = class MailService {
|
|
@@ -80,6 +82,18 @@ System.register(["tslib", "@web-atoms/core/dist/di/DISingleton", "@web-atoms/cor
|
|
|
80
82
|
yield this.entityService.save(cloner);
|
|
81
83
|
});
|
|
82
84
|
}
|
|
85
|
+
deleteAttachment(file) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const {
|
|
88
|
+
appFileID
|
|
89
|
+
} = file;
|
|
90
|
+
yield this.entityService.save(AppFile.create({
|
|
91
|
+
$deleted: true,
|
|
92
|
+
appFileID
|
|
93
|
+
}));
|
|
94
|
+
CommonEvents.onFileDeleted.dispatchEvent(file);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
83
97
|
};
|
|
84
98
|
__decorate([Inject, __metadata("design:type", EntityService)], MailService.prototype, "entityService", void 0);
|
|
85
99
|
MailService = __decorate([DISingleton()], MailService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DISingleton","_webAtomsCoreDistDiDISingleton","default","_webAtomsCoreDistDiInject","Inject","_servicesEntityService","EntityService","_modelModel","AppFile","Mailbox","MailboxContact","_commonSql","Sql","execute","MailService","mailbox","mailboxID","entityService","query","where","p","x","include","emailAddress","firstOrDefault","list","search","start","size","version","showBlocked","cancelToken","q","blocked","orderByDescending","dateUpdated","likeSearch","text","iLike","lastEmail","textBody","subject","name","senderName","toPagedList","raw","email","originalFileID","file","appFileID","rs","fetch","url","send","iterator","recipients","emailAddressText","trim","cloner","attachments","copy","save","__decorate","_export"],"sources":["../../../../../src/web/page/mails/service/MailService.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;MAAOA,WAAW,GAAAC,8BAAA,CAAAC,OAAA;IAAA,aAAAC,yBAAA;MACTC,MAAM,GAAAD,yBAAA,CAANC,MAAM;IAAA,aAAAC,sBAAA;MACRC,aAAa,GAAAD,sBAAA,CAAAH,OAAA;IAAA,aAAAK,WAAA;MACXC,OAAO,GAAAD,WAAA,CAAPC,OAAO;
|
|
1
|
+
{"version":3,"names":["DISingleton","_webAtomsCoreDistDiDISingleton","default","_webAtomsCoreDistDiInject","Inject","_servicesEntityService","EntityService","_modelModel","AppFile","Mailbox","MailboxContact","_commonSql","Sql","_commonEventsCommonEvents","CommonEvents","execute","MailService","mailbox","mailboxID","entityService","query","where","p","x","include","emailAddress","firstOrDefault","list","search","start","size","version","showBlocked","cancelToken","q","blocked","orderByDescending","dateUpdated","likeSearch","text","iLike","lastEmail","textBody","subject","name","senderName","toPagedList","raw","email","originalFileID","file","appFileID","rs","fetch","url","send","iterator","recipients","emailAddressText","trim","cloner","attachments","copy","save","deleteAttachment","create","$deleted","onFileDeleted","dispatchEvent","__decorate","_export"],"sources":["../../../../../src/web/page/mails/service/MailService.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;MAAOA,WAAW,GAAAC,8BAAA,CAAAC,OAAA;IAAA,aAAAC,yBAAA;MACTC,MAAM,GAAAD,yBAAA,CAANC,MAAM;IAAA,aAAAC,sBAAA;MACRC,aAAa,GAAAD,sBAAA,CAAAH,OAAA;IAAA,aAAAK,WAAA;MACXC,OAAO,GAAAD,WAAA,CAAPC,OAAO;MAAyCC,OAAO,GAAAF,WAAA,CAAPE,OAAO;MAAEC,cAAc,GAAAH,WAAA,CAAdG,cAAc;IAAA,aAAAC,UAAA;MACvEC,GAAG,GAAAD,UAAA,CAAHC,GAAG;IAAA,aAAAC,yBAAA;MACHC,YAAY,GAAAD,yBAAA,CAAZC,YAAY;IAAA;IAAAC,OAAA,WAAAA,CAAA;MAGAC,WAAW,GAAjB,MAAMA,WAAW;QAKtBC,OAAOA,CAACC,SAAiB;;YAC3B,OAAO,IAAI,CAACC,aAAa,CAACC,KAAK,CAACX,OAAO,CAAC,CACnCY,KAAK,CAAC;cAAEH;YAAS,CAAE,EAAGI,CAAC,IAAMC,CAAC,IAAKA,CAAC,CAACL,SAAS,KAAKI,CAAC,CAACJ,SAAS,CAAC,CAC/DM,OAAO,CAAED,CAAC,IAAKA,CAAC,CAACE,YAAY,CAAC,CAC9BC,cAAc,EAAE;UACzB,CAAC;;QAEKC,IAAIA,CAAC;UACPC,MAAM,GAAG,EAAE;UACXV,SAAS;UACTW,KAAK,GAAG,CAAC;UACTC,IAAI,GAAG,EAAE;UACTC,OAAO,GAAG,CAAC;UACXC,WAAW,GAAG,KAAK;UACnBC;QAAW,CACd;;YACG,IAAIC,CAAC,GAAG,IAAI,CAACf,aAAa,CAACC,KAAK,CAACV,cAAc,CAAC,CAC3CW,KAAK,CAAC;cA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AAAsD,OAAA,YA/DoBtD,WAAW;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import EventScope from "@web-atoms/core/dist/core/EventScope";
|
|
2
|
-
import { IMailboxContact, IMailboxContactEmail } from "../../model/model";
|
|
2
|
+
import { IAppFile, IEmail, IMailboxContact, IMailboxContactEmail } from "../../model/model";
|
|
3
3
|
|
|
4
4
|
export const CommonEvents = {
|
|
5
5
|
|
|
6
6
|
onThreadMarkedAsRead: EventScope.create<IMailboxContactEmail>(),
|
|
7
7
|
|
|
8
|
-
onThreadMarkedAsBlocked: EventScope.create<IMailboxContact>()
|
|
8
|
+
onThreadMarkedAsBlocked: EventScope.create<IMailboxContact>(),
|
|
9
|
+
|
|
10
|
+
onDraftDeleted: EventScope.create<IEmail>(),
|
|
11
|
+
|
|
12
|
+
onFileDeleted: EventScope.create<IAppFile>()
|
|
9
13
|
};
|
|
@@ -23,7 +23,7 @@ import SocialMailApp from "../../../common/SocialMailApp";
|
|
|
23
23
|
import MailDetailPage from "./detail/MailDetailPage";
|
|
24
24
|
import Checkbox from "@web-atoms/web-controls/dist/basic/Checkbox";
|
|
25
25
|
import FilePreview from "../../../common/controls/file-preview/FilePreview";
|
|
26
|
-
import MiniComposeBox from "./MiniComposeBox";
|
|
26
|
+
import MiniComposeBox from "./mini-compose/MiniComposeBox";
|
|
27
27
|
import { AncestorEnumerator } from "@web-atoms/core/dist/web/core/AtomUI";
|
|
28
28
|
|
|
29
29
|
const itemCss = styled.css `
|
|
@@ -81,8 +81,6 @@ export default class ConversationPage extends ContentPage {
|
|
|
81
81
|
|
|
82
82
|
private mails: IMailboxContactEmail[] = [];
|
|
83
83
|
|
|
84
|
-
private draft: IEmail = null;
|
|
85
|
-
|
|
86
84
|
private search: string = "";
|
|
87
85
|
private version = 1;
|
|
88
86
|
|
|
@@ -193,11 +191,9 @@ export default class ConversationPage extends ContentPage {
|
|
|
193
191
|
</div>
|
|
194
192
|
</PopupActionButton>;
|
|
195
193
|
|
|
196
|
-
this.draft = await this.conversationService.getDraft(this.parameters);
|
|
197
|
-
|
|
198
194
|
this.footerRenderer = () => <MiniComposeBox
|
|
199
195
|
mailboxContact={this.parameters}
|
|
200
|
-
|
|
196
|
+
/>;
|
|
201
197
|
}
|
|
202
198
|
|
|
203
199
|
@Action({ onEvent: "click"})
|
|
@@ -342,6 +338,5 @@ export default class ConversationPage extends ContentPage {
|
|
|
342
338
|
async deleteDraft(mce: IMailboxContactEmail) {
|
|
343
339
|
await this.conversationService.delete(mce.email);
|
|
344
340
|
this.mails.remove(mce);
|
|
345
|
-
this.draft = null;
|
|
346
341
|
}
|
|
347
342
|
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
2
|
+
import styled from "@web-atoms/core/dist/style/styled";
|
|
3
|
+
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
4
|
+
import { AppFile, Email, EmailRecipient, IAppFile, IEmail, IMailbox, IMailboxContact, MailboxEmail } from "../../../../model/model";
|
|
5
|
+
import Bind from "@web-atoms/core/dist/core/Bind";
|
|
6
|
+
import Action from "@web-atoms/core/dist/view-model/Action";
|
|
7
|
+
import AudioRecorder from "../../../../common/controls/audio/AudioRecorder";
|
|
8
|
+
import { Inject } from "@web-atoms/core/dist/di/Inject";
|
|
9
|
+
import ConversationService from "../service/ConversationService";
|
|
10
|
+
import { IUploadedFile } from "../../../../services/files/LocalFileService";
|
|
11
|
+
import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
|
|
12
|
+
import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
|
|
13
|
+
import { AtomBinder } from "@web-atoms/core/dist/core/AtomBinder";
|
|
14
|
+
import { CommonEvents } from "../../../../common/events/CommonEvents";
|
|
15
|
+
import MailService from "../service/MailService";
|
|
16
|
+
import DateTime from "@web-atoms/date-time/dist/DateTime";
|
|
17
|
+
import SendFiles from "./SendFiles";
|
|
18
|
+
import sleep from "@web-atoms/core/dist/core/sleep";
|
|
19
|
+
|
|
20
|
+
const css = styled.css `
|
|
21
|
+
display: grid;
|
|
22
|
+
grid-template-columns: auto 1fr auto;
|
|
23
|
+
grid-template-rows: auto 1fr auto;
|
|
24
|
+
|
|
25
|
+
& > [data-element=add] {
|
|
26
|
+
grid-row: 1 / span 2;
|
|
27
|
+
grid-column: 1;
|
|
28
|
+
align-self: center;
|
|
29
|
+
font-size: larger;
|
|
30
|
+
padding: 10px;
|
|
31
|
+
background-color: white;
|
|
32
|
+
border-radius: 9999px;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
& > [data-element=send] {
|
|
37
|
+
grid-row: 2;
|
|
38
|
+
grid-column: 3;
|
|
39
|
+
border-radius: 10px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
& > [data-element=editor] {
|
|
43
|
+
grid-row: 2;
|
|
44
|
+
grid-column: 2;
|
|
45
|
+
margin-left: 5px;
|
|
46
|
+
margin-right: 5px;
|
|
47
|
+
}
|
|
48
|
+
& > [data-element=files] {
|
|
49
|
+
grid-row: 3;
|
|
50
|
+
grid-column: 2;
|
|
51
|
+
}
|
|
52
|
+
`.installLocal();
|
|
53
|
+
|
|
54
|
+
export default class MiniComposeBox extends AtomControl {
|
|
55
|
+
|
|
56
|
+
public mailboxContact: IMailboxContact = null;
|
|
57
|
+
|
|
58
|
+
public draft: IEmail = null;
|
|
59
|
+
|
|
60
|
+
public typedMessage: string = "";
|
|
61
|
+
|
|
62
|
+
@InjectProperty
|
|
63
|
+
private conversationService: ConversationService;
|
|
64
|
+
|
|
65
|
+
@InjectProperty
|
|
66
|
+
private mailService: MailService;
|
|
67
|
+
|
|
68
|
+
constructor(app, e) {
|
|
69
|
+
super(app, e);
|
|
70
|
+
this.element.className = css;
|
|
71
|
+
this.app.runAsync(() => this.init());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async init() {
|
|
75
|
+
|
|
76
|
+
await sleep(100);
|
|
77
|
+
|
|
78
|
+
this.draft = await this.conversationService.getDraft(this.mailboxContact);
|
|
79
|
+
|
|
80
|
+
this.draft.attachments ??= [];
|
|
81
|
+
|
|
82
|
+
this.render(<div>
|
|
83
|
+
<i
|
|
84
|
+
data-click-event="add-media"
|
|
85
|
+
data-element="add"
|
|
86
|
+
class="fa-solid fa-plus"
|
|
87
|
+
title="Attach media"/>
|
|
88
|
+
<textarea
|
|
89
|
+
data-element="editor"
|
|
90
|
+
value={Bind.twoWaysImmediate(() => this.typedMessage)}/>
|
|
91
|
+
<i
|
|
92
|
+
data-element="send"
|
|
93
|
+
class="fa-solid fa-microphone-lines mic"
|
|
94
|
+
event-click={() => this.sendAudioMessage()}
|
|
95
|
+
style-display={Bind.oneWay(() => !this.typedMessage)} />
|
|
96
|
+
<i
|
|
97
|
+
data-element="send"
|
|
98
|
+
class="fa-solid fa-angle-double-right send"
|
|
99
|
+
style-display={Bind.oneWay(() => !!this.typedMessage)}
|
|
100
|
+
data-click-event="send-email"
|
|
101
|
+
/>
|
|
102
|
+
<AtomRepeater
|
|
103
|
+
data-element="files"
|
|
104
|
+
items={Bind.oneWay(() => this.draft?.attachments)}
|
|
105
|
+
style-display={Bind.oneWay(() => this.draft && this.draft.attachments && this.draft.attachments.length > 0)}
|
|
106
|
+
data-layout="flex-wrap-padding"
|
|
107
|
+
itemRenderer={(item: IAppFile) => <div
|
|
108
|
+
data-layout="icon-button">
|
|
109
|
+
<label text={item.name}/>
|
|
110
|
+
<i
|
|
111
|
+
data-click-event="delete-attachment"
|
|
112
|
+
class="fas fa-times-circle"
|
|
113
|
+
data-cursor="pointer"
|
|
114
|
+
data-color="red"/>
|
|
115
|
+
</div>}
|
|
116
|
+
/>
|
|
117
|
+
</div>);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@Action({ onEvent: "add-media"})
|
|
121
|
+
async addMedia() {
|
|
122
|
+
const files = await SendFiles.showModal<IUploadedFile[]>({});
|
|
123
|
+
this.draft ??= Email.create({
|
|
124
|
+
attachments: []
|
|
125
|
+
});
|
|
126
|
+
this.addFiles(... files);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@Action({
|
|
130
|
+
onEvent: "delete-attachment",
|
|
131
|
+
confirm: "Are you sure you want to delete this attachment?"
|
|
132
|
+
})
|
|
133
|
+
async deleteAttachment(file: IAppFile) {
|
|
134
|
+
await this.mailService.deleteAttachment(file);
|
|
135
|
+
this.draft?.attachments.remove(file);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@Action({ onEvent: CommonEvents.onDraftDeleted })
|
|
139
|
+
async refreshDraft() {
|
|
140
|
+
this.draft ??= Email.create({
|
|
141
|
+
attachments: []
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Action({ onEvent: "input", defer: 500, blockMultipleExecution: true })
|
|
146
|
+
async onChanged() {
|
|
147
|
+
if (!this.typedMessage) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.draft ??= Email.create({
|
|
151
|
+
attachments: []
|
|
152
|
+
});
|
|
153
|
+
this.draft.mdBody = this.typedMessage;
|
|
154
|
+
await this.save();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@Action({
|
|
158
|
+
onEvent: "send-email"
|
|
159
|
+
})
|
|
160
|
+
async sendEmail() {
|
|
161
|
+
this.draft.status = "scheduled";
|
|
162
|
+
this.draft.dateSent = DateTime.now;
|
|
163
|
+
await this.mailService.send(this.draft);
|
|
164
|
+
this.draft ??= Email.create({
|
|
165
|
+
attachments: []
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@Action({})
|
|
170
|
+
async sendAudioMessage() {
|
|
171
|
+
const uploadedFile = await AudioRecorder.show<IUploadedFile>();
|
|
172
|
+
this.draft ??= Email.create({
|
|
173
|
+
attachments: []
|
|
174
|
+
});
|
|
175
|
+
this.draft.mdBody = this.typedMessage;
|
|
176
|
+
this.addFiles(uploadedFile);
|
|
177
|
+
await this.save();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private addFiles(... files: IUploadedFile[]) {
|
|
181
|
+
const attachments = this.draft.attachments ??= [];
|
|
182
|
+
AtomBinder.refreshValue(this, "draft");
|
|
183
|
+
for (const { appFileID, url, file } of files) {
|
|
184
|
+
attachments.add(AppFile.create({
|
|
185
|
+
appFileID,
|
|
186
|
+
contentType: file.type,
|
|
187
|
+
name: file.name,
|
|
188
|
+
contentID: appFileID.toString(36),
|
|
189
|
+
url
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
private async save() {
|
|
195
|
+
this.draft = await this.conversationService.draft({ ... this.mailboxContact, email: this.draft }, true);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
2
|
+
import Action from "@web-atoms/core/dist/view-model/Action";
|
|
3
|
+
import { MenuItem } from "@web-atoms/web-controls/dist/basic/PopupButton";
|
|
4
|
+
import UploadEvent from "@web-atoms/web-controls/dist/basic/UploadEvent";
|
|
5
|
+
import BottomPopup from "@web-atoms/web-controls/dist/mobile-app/BottomPopup";
|
|
6
|
+
import { IMailboxContact } from "../../../../model/model";
|
|
7
|
+
|
|
8
|
+
export default class SendFiles extends BottomPopup {
|
|
9
|
+
|
|
10
|
+
async init() {
|
|
11
|
+
this.renderer = <div>
|
|
12
|
+
<div data-layout="vertical-flex-center-items">
|
|
13
|
+
<MenuItem
|
|
14
|
+
{ ... UploadEvent.AttachUploadAction({
|
|
15
|
+
accept: "image/*",
|
|
16
|
+
multiple: true,
|
|
17
|
+
extra: {}
|
|
18
|
+
})}
|
|
19
|
+
data-click-event="send-photos"
|
|
20
|
+
icon="fas fa-image"
|
|
21
|
+
label="Send Photos"
|
|
22
|
+
/>
|
|
23
|
+
<MenuItem
|
|
24
|
+
{ ... UploadEvent.AttachUploadAction({
|
|
25
|
+
accept: "image/*",
|
|
26
|
+
capture: "user",
|
|
27
|
+
extra: {}
|
|
28
|
+
})}
|
|
29
|
+
data-click-event="take-photo"
|
|
30
|
+
icon="fa-duotone fa-video-plus"
|
|
31
|
+
label="Take Photo"
|
|
32
|
+
/>
|
|
33
|
+
<MenuItem
|
|
34
|
+
{ ... UploadEvent.AttachUploadAction({
|
|
35
|
+
accept: "video/*",
|
|
36
|
+
multiple: false,
|
|
37
|
+
extra: {}
|
|
38
|
+
})}
|
|
39
|
+
data-click-event="send-video"
|
|
40
|
+
icon="fas fa-video"
|
|
41
|
+
label="Send Video"
|
|
42
|
+
/>
|
|
43
|
+
<MenuItem
|
|
44
|
+
{ ... UploadEvent.AttachUploadAction({
|
|
45
|
+
accept: "video/*",
|
|
46
|
+
capture: "user",
|
|
47
|
+
extra: {}
|
|
48
|
+
})}
|
|
49
|
+
data-click-event="record-video"
|
|
50
|
+
icon="fa-duotone fa-video-plus"
|
|
51
|
+
label="Record Video"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
</div>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Action({ onEvent: "filesAvailable"})
|
|
58
|
+
async filesAvailable({ files, extra }) {
|
|
59
|
+
this.close(files);
|
|
60
|
+
// send to compose...
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
@@ -231,10 +231,12 @@ export default class ConversationService {
|
|
|
231
231
|
CommonEvents.onThreadMarkedAsBlocked.dispatchEvent(thread);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
async delete(
|
|
234
|
+
async delete(email: IEmail) {
|
|
235
|
+
const { emailID } = email;
|
|
235
236
|
await this.entityService.delete(Email.create({
|
|
236
237
|
emailID
|
|
237
238
|
}));
|
|
239
|
+
CommonEvents.onDraftDeleted.dispatchEvent(email);
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import DISingleton from "@web-atoms/core/dist/di/DISingleton";
|
|
2
2
|
import { Inject } from "@web-atoms/core/dist/di/Inject";
|
|
3
3
|
import EntityService from "../../../../services/EntityService";
|
|
4
|
-
import { AppFile, Email, EmailAddress, IEmail, Mailbox, MailboxContact } from "../../../../model/model";
|
|
4
|
+
import { AppFile, Email, EmailAddress, IAppFile, IEmail, Mailbox, MailboxContact } from "../../../../model/model";
|
|
5
5
|
import { Sql } from "../../../../common/Sql";
|
|
6
|
+
import { CommonEvents } from "../../../../common/events/CommonEvents";
|
|
6
7
|
|
|
7
8
|
@DISingleton()
|
|
8
9
|
export default class MailService {
|
|
@@ -59,4 +60,13 @@ export default class MailService {
|
|
|
59
60
|
const cloner = this.entityService.cloner(email).include((x) => x.recipients).include((x) => x.attachments).copy;
|
|
60
61
|
await this.entityService.save(cloner);
|
|
61
62
|
}
|
|
63
|
+
|
|
64
|
+
async deleteAttachment(file: IAppFile) {
|
|
65
|
+
const { appFileID } = file;
|
|
66
|
+
await this.entityService.save(AppFile.create({
|
|
67
|
+
$deleted: true,
|
|
68
|
+
appFileID
|
|
69
|
+
}));
|
|
70
|
+
CommonEvents.onFileDeleted.dispatchEvent(file);
|
|
71
|
+
}
|
|
62
72
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MiniComposeBox.d.ts","sourceRoot":"","sources":["../../../../src/web/page/mails/MiniComposeBox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAA4C,MAAM,EAAY,eAAe,EAAgB,MAAM,sBAAsB,CAAC;AA8BjI,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IAE5C,cAAc,EAAE,eAAe,CAAQ;IAEvC,KAAK,EAAE,MAAM,CAAQ;IAErB,YAAY,EAAE,MAAM,CAAM;IAGjC,OAAO,CAAC,mBAAmB,CAAsB;gBAErC,GAAG,KAAA,EAAE,CAAC,KAAA;IAMZ,IAAI;IAyBJ,SAAS;IAWf,WAAW,IAAI,GAAG;YAKJ,gBAAgB;IAU9B,OAAO,CAAC,OAAO;YAYD,IAAI;CAIrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["MiniComposeBox","css","_export","setters","_tslib","XNode","_webAtomsCoreDistCoreXNode","default","_webAtomsCoreDistStyleStyled","styled","_webAtomsCoreDistWebControlsAtomControl","AtomControl","_modelModel","AppFile","Email","_webAtomsCoreDistCoreBind","Bind","_webAtomsCoreDistViewModelAction","Action","_commonControlsAudioAudioRecorder","AudioRecorder","_serviceConversationService","ConversationService","_webAtomsWebControlsDistBasicAtomRepeater","AtomRepeater","_webAtomsCoreDistCoreInjectProperty","InjectProperty","_webAtomsCoreDistCoreAtomBinder","AtomBinder","execute","installLocal","constructor","app","e","mailboxContact","draft","typedMessage","element","className","runAsync","init","render","create","value","twoWaysImmediate","class","event-click","sendAudioMessage","oneWay","sendMessage","items","_a","attachments","itemRenderer","item","text","name","onChanged","mdBody","save","Error","uploadedFile","show","addFile","appFileID","url","file","_b","refreshValue","add","contentType","type","contentID","toString","conversationService","Object","assign","email","__decorate","onEvent","defer","blockMultipleExecution"],"sources":["../../../../src/web/page/mails/MiniComposeBox.tsx"],"sourcesContent":[null],"mappings":";;;iLAiCqBA,cAAe,EAAAC,GAAA;EAAAC,OAAA;EAAA;IAAAC,OAAA,aAAAC,MAAA;;;;;MAjC7BC,KAAK,GAAAC,0BAAA,CAAAC,OAAA;IAAA,aAAAC,4BAAA;MACLC,MAAM,GAAAD,4BAAA,CAAAD,OAAA;IAAA,aAAAG,uCAAA;MACJC,WAAW,GAAAD,uCAAA,CAAXC,WAAW;IAAA,aAAAC,WAAA;MACXC,OAAO,GAAAD,WAAA,CAAPC,OAAO;MAAEC,KAAK,GAAAF,WAAA,CAALE,KAAK;IAAA,aAAAC,yBAAA;MAChBC,IAAI,GAAAD,yBAAA,CAAAR,OAAA;IAAA,aAAAU,gC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EADb5D,MAAM,CAAC,EAAE,CAAC,E,wKASV;IAAA;EAAA;AAAA"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
2
|
-
import styled from "@web-atoms/core/dist/style/styled";
|
|
3
|
-
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
4
|
-
import { AppFile, Email, EmailRecipient, IAppFile, IEmail, IMailbox, IMailboxContact, MailboxEmail } from "../../../model/model";
|
|
5
|
-
import Bind from "@web-atoms/core/dist/core/Bind";
|
|
6
|
-
import Action from "@web-atoms/core/dist/view-model/Action";
|
|
7
|
-
import AudioRecorder from "../../../common/controls/audio/AudioRecorder";
|
|
8
|
-
import { Inject } from "@web-atoms/core/dist/di/Inject";
|
|
9
|
-
import ConversationService from "./service/ConversationService";
|
|
10
|
-
import { IUploadedFile } from "../../../services/files/LocalFileService";
|
|
11
|
-
import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
|
|
12
|
-
import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
|
|
13
|
-
import { AtomBinder } from "@web-atoms/core/dist/core/AtomBinder";
|
|
14
|
-
|
|
15
|
-
const css = styled.css `
|
|
16
|
-
display: grid;
|
|
17
|
-
grid-template-columns: auto 1fr auto;
|
|
18
|
-
grid-template-rows: auto 1fr auto;
|
|
19
|
-
|
|
20
|
-
& > [data-element=send] {
|
|
21
|
-
grid-row: 2;
|
|
22
|
-
grid-column: 3;
|
|
23
|
-
border-radius: 10px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
& > [data-element=editor] {
|
|
27
|
-
grid-row: 2;
|
|
28
|
-
grid-column: 2;
|
|
29
|
-
margin-left: 5px;
|
|
30
|
-
margin-right: 5px;
|
|
31
|
-
}
|
|
32
|
-
`.installLocal();
|
|
33
|
-
|
|
34
|
-
export default class MiniComposeBox extends AtomControl {
|
|
35
|
-
|
|
36
|
-
public mailboxContact: IMailboxContact = null;
|
|
37
|
-
|
|
38
|
-
public draft: IEmail = null;
|
|
39
|
-
|
|
40
|
-
public typedMessage: string = "";
|
|
41
|
-
|
|
42
|
-
@InjectProperty
|
|
43
|
-
private conversationService: ConversationService;
|
|
44
|
-
|
|
45
|
-
constructor(app, e) {
|
|
46
|
-
super(app, e);
|
|
47
|
-
this.element.className = css;
|
|
48
|
-
this.app.runAsync(() => this.init());
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async init() {
|
|
52
|
-
this.render(<div>
|
|
53
|
-
<textarea
|
|
54
|
-
data-element="editor"
|
|
55
|
-
value={Bind.twoWaysImmediate(() => this.typedMessage)}/>
|
|
56
|
-
<i
|
|
57
|
-
data-element="send"
|
|
58
|
-
class="fa-solid fa-microphone-lines mic"
|
|
59
|
-
event-click={() => this.sendAudioMessage()}
|
|
60
|
-
style-display={Bind.oneWay(() => !this.typedMessage)} />
|
|
61
|
-
<i
|
|
62
|
-
data-element="send"
|
|
63
|
-
class="fa-solid fa-angle-double-right send"
|
|
64
|
-
style-display={Bind.oneWay(() => !!this.typedMessage)}
|
|
65
|
-
event-click={() => this.sendMessage()}
|
|
66
|
-
/>
|
|
67
|
-
<AtomRepeater
|
|
68
|
-
items={Bind.oneWay(() => this.draft?.attachments)}
|
|
69
|
-
data-layout="flex-wrap-padding"
|
|
70
|
-
itemRenderer={(item: IAppFile) => <div data-layout="row"><label text={item.name}/></div>}
|
|
71
|
-
/>
|
|
72
|
-
</div>);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@Action({ onEvent: "input", defer: 500, blockMultipleExecution: true })
|
|
76
|
-
async onChanged() {
|
|
77
|
-
if (!this.typedMessage) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.draft ??= Email.create({
|
|
81
|
-
attachments: []
|
|
82
|
-
});
|
|
83
|
-
this.draft.mdBody = this.typedMessage;
|
|
84
|
-
await this.save();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
sendMessage(): any {
|
|
88
|
-
throw new Error("Method not implemented.");
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@Action({})
|
|
92
|
-
private async sendAudioMessage() {
|
|
93
|
-
const uploadedFile = await AudioRecorder.show<IUploadedFile>();
|
|
94
|
-
this.draft ??= Email.create({
|
|
95
|
-
attachments: []
|
|
96
|
-
});
|
|
97
|
-
this.draft.mdBody = this.typedMessage;
|
|
98
|
-
this.addFile(uploadedFile);
|
|
99
|
-
await this.save();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private addFile({ appFileID, url, file }: IUploadedFile) {
|
|
103
|
-
this.draft.attachments ??= [];
|
|
104
|
-
AtomBinder.refreshValue(this, "draft");
|
|
105
|
-
this.draft.attachments.add(AppFile.create({
|
|
106
|
-
appFileID,
|
|
107
|
-
contentType: file.type,
|
|
108
|
-
name: file.name,
|
|
109
|
-
contentID: appFileID.toString(36),
|
|
110
|
-
url
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private async save() {
|
|
115
|
-
this.draft = await this.conversationService.draft({ ... this.mailboxContact, email: this.draft }, true);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}
|