@banta/sdk 3.0.0 → 3.0.1
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/banta-sdk.metadata.json +1 -1
- package/bundles/banta-sdk.umd.js +170 -34
- package/bundles/banta-sdk.umd.js.map +1 -1
- package/bundles/banta-sdk.umd.min.js +1 -1
- package/bundles/banta-sdk.umd.min.js.map +1 -1
- package/esm2015/lib/banta/banta.component.js +2 -5
- package/esm2015/lib/banta-sdk.module.js +4 -2
- package/esm2015/lib/chat/banta-chat/banta-chat.component.js +2 -3
- package/esm2015/lib/chat/live-chat-message.component.js +2 -2
- package/esm2015/lib/comments/banta-comments/banta-comments.component.js +44 -5
- package/esm2015/lib/comments/comment-view/comment-view.component.js +78 -16
- package/esm2015/lib/comments/comments.module.js +9 -1
- package/esm2015/lib/comments/live-comment.component.js +2 -2
- package/esm2015/lib/common/chat-backend.service.js +7 -0
- package/esm2015/lib/common/index.js +2 -1
- package/esm2015/lib/index.js +1 -2
- package/fesm2015/banta-sdk.js +131 -28
- package/fesm2015/banta-sdk.js.map +1 -1
- package/lib/banta/banta.component.d.ts +1 -2
- package/lib/chat/banta-chat/banta-chat.component.d.ts +1 -2
- package/lib/chat/live-chat-message.component.d.ts +1 -1
- package/lib/comments/banta-comments/banta-comments.component.d.ts +13 -2
- package/lib/comments/comment-view/comment-view.component.d.ts +15 -2
- package/lib/comments/live-comment.component.d.ts +1 -1
- package/lib/{chat-backend.service.d.ts → common/chat-backend.service.d.ts} +0 -0
- package/lib/common/index.d.ts +1 -0
- package/lib/index.d.ts +0 -1
- package/package.json +1 -1
- package/esm2015/lib/chat-backend.service.js +0 -7
package/banta-sdk.metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"exports":[{"from":"./common"},{"from":"./emoji"},{"from":"./banta/banta.component"},{"from":"./banta-logo.component"},{"from":"./chat"},{"from":"./live-message.component"},{"from":"./comments"},{"from":"./
|
|
1
|
+
{"__symbolic":"module","version":4,"exports":[{"from":"./common"},{"from":"./emoji"},{"from":"./banta/banta.component"},{"from":"./banta-logo.component"},{"from":"./chat"},{"from":"./live-message.component"},{"from":"./comments"},{"from":"./banta-sdk.module"}],"metadata":{},"origins":{},"importAs":"@banta/sdk"}
|
package/bundles/banta-sdk.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/material/icon'), require('@angular/material/button'), require('subsink'), require('@angular/material/dialog'), require('@angular/forms'), require('@angular/material/menu'), require('@angular/material/
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@banta/sdk', ['exports', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/common', '@angular/platform-browser', '@angular/material/icon', '@angular/material/button', 'subsink', '@angular/material/dialog', '@angular/forms', '@angular/material/menu', '@angular/material/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.banta = global.banta || {}, global.banta.sdk = {}), global.rxjs, global.rxjs.operators, global.ng.core, global.ng.common, global.ng.platformBrowser, global.ng.material.icon, global.ng.material.button, global.subsink, global.ng.material.dialog, global.ng.forms, global.ng.material.menu, global.ng.material.
|
|
5
|
-
}(this, (function (exports, rxjs, operators, core, common, platformBrowser, icon, button, subsink, dialog, forms, menu,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('@angular/core'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/material/icon'), require('@angular/material/button'), require('subsink'), require('@angular/material/dialog'), require('@angular/forms'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/cdk/text-field'), require('@angular/material/tooltip')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@banta/sdk', ['exports', 'rxjs', 'rxjs/operators', '@angular/core', '@angular/common', '@angular/platform-browser', '@angular/material/icon', '@angular/material/button', 'subsink', '@angular/material/dialog', '@angular/forms', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/material/form-field', '@angular/material/input', '@angular/cdk/text-field', '@angular/material/tooltip'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.banta = global.banta || {}, global.banta.sdk = {}), global.rxjs, global.rxjs.operators, global.ng.core, global.ng.common, global.ng.platformBrowser, global.ng.material.icon, global.ng.material.button, global.subsink, global.ng.material.dialog, global.ng.forms, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.material.formField, global.ng.material.input, global.ng.cdk.textField, global.ng.material.tooltip));
|
|
5
|
+
}(this, (function (exports, rxjs, operators, core, common, platformBrowser, icon, button, subsink, dialog, forms, menu, progressSpinner, formField, input, textField, tooltip) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function lazyConnection(options) {
|
|
8
8
|
var obs = new rxjs.Observable(function (observer) {
|
|
@@ -149,6 +149,15 @@
|
|
|
149
149
|
value: [{ type: core.Input }]
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
var ChatBackendService = /** @class */ (function () {
|
|
153
|
+
function ChatBackendService() {
|
|
154
|
+
}
|
|
155
|
+
return ChatBackendService;
|
|
156
|
+
}());
|
|
157
|
+
ChatBackendService.decorators = [
|
|
158
|
+
{ type: core.Injectable }
|
|
159
|
+
];
|
|
160
|
+
|
|
152
161
|
var COMPONENTS = [
|
|
153
162
|
TimestampComponent
|
|
154
163
|
];
|
|
@@ -7138,15 +7147,6 @@
|
|
|
7138
7147
|
},] }
|
|
7139
7148
|
];
|
|
7140
7149
|
|
|
7141
|
-
var ChatBackendService = /** @class */ (function () {
|
|
7142
|
-
function ChatBackendService() {
|
|
7143
|
-
}
|
|
7144
|
-
return ChatBackendService;
|
|
7145
|
-
}());
|
|
7146
|
-
ChatBackendService.decorators = [
|
|
7147
|
-
{ type: core.Injectable }
|
|
7148
|
-
];
|
|
7149
|
-
|
|
7150
7150
|
/**
|
|
7151
7151
|
* Unified chat and comments component
|
|
7152
7152
|
*/
|
|
@@ -7177,9 +7177,6 @@
|
|
|
7177
7177
|
_this.newNotifications = true;
|
|
7178
7178
|
}));
|
|
7179
7179
|
};
|
|
7180
|
-
BantaComponent.prototype.newPointSubMessageKeyDown = function (event) {
|
|
7181
|
-
// TODO
|
|
7182
|
-
};
|
|
7183
7180
|
BantaComponent.prototype.sendPointSubMessage = function () {
|
|
7184
7181
|
return __awaiter(this, void 0, void 0, function () {
|
|
7185
7182
|
var text, message, e_1;
|
|
@@ -8120,17 +8117,25 @@
|
|
|
8120
8117
|
};
|
|
8121
8118
|
|
|
8122
8119
|
var CommentViewComponent = /** @class */ (function () {
|
|
8123
|
-
function CommentViewComponent() {
|
|
8120
|
+
function CommentViewComponent(backend) {
|
|
8121
|
+
this.backend = backend;
|
|
8124
8122
|
this._sourceSubs = new subsink.SubSink();
|
|
8125
8123
|
this._selected = new rxjs.Subject();
|
|
8126
8124
|
this._upvoted = new rxjs.Subject();
|
|
8127
8125
|
this._reported = new rxjs.Subject();
|
|
8128
8126
|
this._userSelected = new rxjs.Subject();
|
|
8127
|
+
this.showEmptyState = true;
|
|
8129
8128
|
this.allowReplies = true;
|
|
8130
8129
|
this.menuMessage = null;
|
|
8131
8130
|
this.messages = [];
|
|
8132
|
-
this.maxMessages =
|
|
8131
|
+
this.maxMessages = 2000;
|
|
8132
|
+
this.maxVisibleMessages = 200;
|
|
8133
8133
|
this.newestLast = false;
|
|
8134
|
+
this.isViewingMore = false;
|
|
8135
|
+
this.isLoadingMore = false;
|
|
8136
|
+
this.hasMore = false;
|
|
8137
|
+
this.newMessages = [];
|
|
8138
|
+
this.olderMessages = [];
|
|
8134
8139
|
}
|
|
8135
8140
|
Object.defineProperty(CommentViewComponent.prototype, "selected", {
|
|
8136
8141
|
get: function () {
|
|
@@ -8172,9 +8177,11 @@
|
|
|
8172
8177
|
}
|
|
8173
8178
|
this._source = value;
|
|
8174
8179
|
if (value) {
|
|
8175
|
-
var messages = value.messages || [];
|
|
8180
|
+
var messages = (value.messages || []).slice();
|
|
8181
|
+
this.messages = messages;
|
|
8182
|
+
this.olderMessages = messages.splice(this.maxVisibleMessages, messages.length);
|
|
8183
|
+
this.hasMore = this.olderMessages.length > 0;
|
|
8176
8184
|
this._sourceSubs = new subsink.SubSink();
|
|
8177
|
-
this.messages = messages.slice();
|
|
8178
8185
|
this._sourceSubs.add(this._source.messageReceived
|
|
8179
8186
|
.subscribe(function (msg) { return _this.messageReceived(msg); }), this._source.messageSent
|
|
8180
8187
|
.subscribe(function (msg) { return _this.messageSent(msg); }));
|
|
@@ -8193,22 +8200,82 @@
|
|
|
8193
8200
|
this._reported.next(message);
|
|
8194
8201
|
};
|
|
8195
8202
|
CommentViewComponent.prototype.selectMessage = function (message) {
|
|
8196
|
-
this
|
|
8203
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8204
|
+
return __generator(this, function (_a) {
|
|
8205
|
+
this._selected.next(message);
|
|
8206
|
+
return [2 /*return*/];
|
|
8207
|
+
});
|
|
8208
|
+
});
|
|
8197
8209
|
};
|
|
8198
8210
|
CommentViewComponent.prototype.selectMessageUser = function (message) {
|
|
8199
8211
|
this._userSelected.next(message);
|
|
8200
8212
|
};
|
|
8213
|
+
CommentViewComponent.prototype.messageIdentity = function (chatMessage) {
|
|
8214
|
+
return chatMessage.id;
|
|
8215
|
+
};
|
|
8216
|
+
CommentViewComponent.prototype.showNew = function () {
|
|
8217
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8218
|
+
var overflow;
|
|
8219
|
+
return __generator(this, function (_a) {
|
|
8220
|
+
this.isViewingMore = false;
|
|
8221
|
+
this.messages = this.newMessages.splice(0, this.newMessages.length).concat(this.messages);
|
|
8222
|
+
overflow = this.messages.splice(this.maxVisibleMessages, this.messages.length);
|
|
8223
|
+
this.olderMessages = overflow.concat(this.olderMessages);
|
|
8224
|
+
this.olderMessages.splice(this.maxMessages - this.maxVisibleMessages, this.olderMessages.length);
|
|
8225
|
+
return [2 /*return*/];
|
|
8226
|
+
});
|
|
8227
|
+
});
|
|
8228
|
+
};
|
|
8229
|
+
CommentViewComponent.prototype.showMore = function () {
|
|
8230
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8231
|
+
var lastMessage, messages;
|
|
8232
|
+
return __generator(this, function (_a) {
|
|
8233
|
+
switch (_a.label) {
|
|
8234
|
+
case 0:
|
|
8235
|
+
this.isViewingMore = true;
|
|
8236
|
+
if (!(this.olderMessages.length > 0)) return [3 /*break*/, 1];
|
|
8237
|
+
this.isLoadingMore = false;
|
|
8238
|
+
this.messages = this.messages.concat(this.olderMessages.splice(0, 50));
|
|
8239
|
+
return [3 /*break*/, 4];
|
|
8240
|
+
case 1:
|
|
8241
|
+
if (!this.source.loadAfter) return [3 /*break*/, 3];
|
|
8242
|
+
this.isLoadingMore = true;
|
|
8243
|
+
lastMessage = this.messages[this.messages.length - 1];
|
|
8244
|
+
return [4 /*yield*/, this.source.loadAfter(lastMessage, 100)];
|
|
8245
|
+
case 2:
|
|
8246
|
+
messages = _a.sent();
|
|
8247
|
+
this.messages = this.messages.concat(messages);
|
|
8248
|
+
this.isLoadingMore = false;
|
|
8249
|
+
if (messages.length === 0)
|
|
8250
|
+
this.hasMore = false;
|
|
8251
|
+
return [3 /*break*/, 4];
|
|
8252
|
+
case 3:
|
|
8253
|
+
this.hasMore = false;
|
|
8254
|
+
_a.label = 4;
|
|
8255
|
+
case 4: return [2 /*return*/];
|
|
8256
|
+
}
|
|
8257
|
+
});
|
|
8258
|
+
});
|
|
8259
|
+
};
|
|
8201
8260
|
CommentViewComponent.prototype.addMessage = function (message) {
|
|
8261
|
+
var destination = this.messages;
|
|
8262
|
+
var bucket = this.olderMessages;
|
|
8263
|
+
if (this.isViewingMore) {
|
|
8264
|
+
destination = this.newMessages;
|
|
8265
|
+
bucket = null;
|
|
8266
|
+
}
|
|
8202
8267
|
if (this.newestLast) {
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8268
|
+
destination.push(message);
|
|
8269
|
+
var overflow = destination.splice(this.maxVisibleMessages, destination.length);
|
|
8270
|
+
bucket === null || bucket === void 0 ? void 0 : bucket.push.apply(bucket, __spread(overflow));
|
|
8206
8271
|
}
|
|
8207
8272
|
else {
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8273
|
+
destination.unshift(message);
|
|
8274
|
+
var overflow = destination.splice(this.maxVisibleMessages, destination.length);
|
|
8275
|
+
bucket === null || bucket === void 0 ? void 0 : bucket.unshift.apply(bucket, __spread(overflow));
|
|
8211
8276
|
}
|
|
8277
|
+
if ((bucket === null || bucket === void 0 ? void 0 : bucket.length) > 0)
|
|
8278
|
+
this.hasMore = true;
|
|
8212
8279
|
};
|
|
8213
8280
|
CommentViewComponent.prototype.messageReceived = function (message) {
|
|
8214
8281
|
var _this = this;
|
|
@@ -8254,13 +8321,17 @@
|
|
|
8254
8321
|
CommentViewComponent.decorators = [
|
|
8255
8322
|
{ type: core.Component, args: [{
|
|
8256
8323
|
selector: 'banta-comment-view',
|
|
8257
|
-
template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n <banta-comment \r\n *ngFor=\"let message of messages\"\r\n class=\"abbreviated\"\r\n [message]=\"message\"\r\n [showReplyAction]=\"allowReplies\"\r\n (userSelected)=\"selectMessageUser(message)\"\r\n (upvoted)=\"upvoteMessage(message)\"\r\n (reported)=\"reportMessage(message)\"\r\n (selected)=\"selectMessage(message)\"\r\n ></banta-comment>\r\n <ng-content select=\":not([data-before])\"></ng-content>\r\n</div>",
|
|
8258
|
-
styles: [":host{display:flex;flex-direction:column;flex-grow:1;opacity:1;transition:opacity .2s ease-in}.message-container{background:#fff;color:#000;flex-grow:1;
|
|
8324
|
+
template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n \r\n <a mat-button class=\"nav\" *ngIf=\"isViewingMore\" href=\"javascript:;\" (click)=\"showNew()\">\r\n Show \r\n <ng-container *ngIf=\"newMessages.length === 1\">\r\n {{newMessages.length}} new message\r\n </ng-container>\r\n <ng-container *ngIf=\"newMessages.length > 1\">\r\n {{newMessages.length}} new messages\r\n </ng-container>\r\n <ng-container *ngIf=\"newMessages.length === 0\">\r\n new messages\r\n </ng-container>\r\n </a>\r\n\r\n <ng-container *ngIf=\"messages.length === 0\">\r\n <div class=\"empty-state\" *ngIf=\"showEmptyState\">\r\n Be the first to comment!\r\n </div>\r\n </ng-container>\r\n <banta-comment \r\n *ngFor=\"let message of messages; trackBy: messageIdentity\"\r\n class=\"abbreviated\"\r\n [message]=\"message\"\r\n [showReplyAction]=\"allowReplies\"\r\n (userSelected)=\"selectMessageUser(message)\"\r\n (upvoted)=\"upvoteMessage(message)\"\r\n (reported)=\"reportMessage(message)\"\r\n (selected)=\"selectMessage(message)\"\r\n ></banta-comment>\r\n\r\n <a mat-button class=\"nav\" *ngIf=\"hasMore && !isLoadingMore\" href=\"javascript:;\" (click)=\"showMore()\">Show more</a>\r\n\r\n <div class=\"loading-more\" *ngIf=\"isLoadingMore\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n\r\n <!-- <div style=\"color: #666\">\r\n n={{newMessages.length}}, m={{messages.length}}, o={{olderMessages.length}},\r\n v={{maxVisibleMessages}}, M={{maxMessages}}\r\n </div> -->\r\n\r\n <ng-content select=\":not([data-before])\"></ng-content>\r\n</div>",
|
|
8325
|
+
styles: [":host{display:flex;flex-direction:column;flex-grow:1;opacity:1;transition:opacity .2s ease-in}.message-container{background:#fff;color:#000;flex-grow:1;opacity:1;overflow-x:hidden;padding:.5em 1em .5em .5em;position:relative;transition:opacity .5s ease-in-out}.message-container.no-scroll{height:auto;overflow-y:visible}.message-container.faded{opacity:.25}.message-container .overlay{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10}:host.fixed-height .message-container{overflow-y:auto}:host-context(.mat-dark-theme) .message-container{background:#000;color:#fff}.empty-state{color:#666;margin:3em;text-align:center}:host-context(.mat-dark-theme) .empty-state{color:#666}a.nav{text-transform:uppercase;width:100%}.loading-more,a.nav{padding:2em;text-align:center}.loading-more{margin:0 auto;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}"]
|
|
8259
8326
|
},] }
|
|
8260
8327
|
];
|
|
8261
|
-
CommentViewComponent.ctorParameters = function () { return [
|
|
8328
|
+
CommentViewComponent.ctorParameters = function () { return [
|
|
8329
|
+
{ type: ChatBackendService }
|
|
8330
|
+
]; };
|
|
8262
8331
|
CommentViewComponent.propDecorators = {
|
|
8332
|
+
showEmptyState: [{ type: core.Input }],
|
|
8263
8333
|
allowReplies: [{ type: core.Input }],
|
|
8334
|
+
fixedHeight: [{ type: core.Input }, { type: core.HostBinding, args: ['class.fixed-height',] }],
|
|
8264
8335
|
selected: [{ type: core.Output }],
|
|
8265
8336
|
userSelected: [{ type: core.Output }],
|
|
8266
8337
|
reported: [{ type: core.Output }],
|
|
@@ -8269,6 +8340,7 @@
|
|
|
8269
8340
|
genericAvatarUrl: [{ type: core.Input }],
|
|
8270
8341
|
messageContainer: [{ type: core.ViewChild, args: ['messageContainer',] }],
|
|
8271
8342
|
maxMessages: [{ type: core.Input }],
|
|
8343
|
+
maxVisibleMessages: [{ type: core.Input }],
|
|
8272
8344
|
newestLast: [{ type: core.Input }]
|
|
8273
8345
|
};
|
|
8274
8346
|
|
|
@@ -8398,6 +8470,11 @@
|
|
|
8398
8470
|
BantaCommentsComponent.prototype.insertEmoji = function (text) {
|
|
8399
8471
|
this.newMessageText += text;
|
|
8400
8472
|
};
|
|
8473
|
+
BantaCommentsComponent.prototype.onReplyKeyDown = function (event) {
|
|
8474
|
+
};
|
|
8475
|
+
BantaCommentsComponent.prototype.insertReplyEmoji = function (text) {
|
|
8476
|
+
this.replyMessage += text;
|
|
8477
|
+
};
|
|
8401
8478
|
BantaCommentsComponent.prototype.sendMessage = function () {
|
|
8402
8479
|
return __awaiter(this, void 0, void 0, function () {
|
|
8403
8480
|
var text, message, e_1;
|
|
@@ -8439,19 +8516,69 @@
|
|
|
8439
8516
|
BantaCommentsComponent.prototype.reportMessage = function (message) {
|
|
8440
8517
|
this._reported.next(message);
|
|
8441
8518
|
};
|
|
8519
|
+
BantaCommentsComponent.prototype.unselectMessage = function () {
|
|
8520
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8521
|
+
return __generator(this, function (_b) {
|
|
8522
|
+
this._selected.next(null);
|
|
8523
|
+
this.selectedMessage = null;
|
|
8524
|
+
if (this.selectedMessageThread) {
|
|
8525
|
+
if (this.selectedMessageThread.close)
|
|
8526
|
+
this.selectedMessageThread.close();
|
|
8527
|
+
this.selectedMessageThread = null;
|
|
8528
|
+
}
|
|
8529
|
+
return [2 /*return*/];
|
|
8530
|
+
});
|
|
8531
|
+
});
|
|
8532
|
+
};
|
|
8442
8533
|
BantaCommentsComponent.prototype.selectMessage = function (message) {
|
|
8443
|
-
this
|
|
8534
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8535
|
+
var _b;
|
|
8536
|
+
return __generator(this, function (_c) {
|
|
8537
|
+
switch (_c.label) {
|
|
8538
|
+
case 0:
|
|
8539
|
+
this._selected.next(message);
|
|
8540
|
+
this.selectedMessage = message;
|
|
8541
|
+
_b = this;
|
|
8542
|
+
return [4 /*yield*/, this.backend.getSourceForThread(this.topicID, message.id)];
|
|
8543
|
+
case 1:
|
|
8544
|
+
_b.selectedMessageThread = _c.sent();
|
|
8545
|
+
return [2 /*return*/];
|
|
8546
|
+
}
|
|
8547
|
+
});
|
|
8548
|
+
});
|
|
8444
8549
|
};
|
|
8445
8550
|
BantaCommentsComponent.prototype.selectMessageUser = function (message) {
|
|
8446
8551
|
this._userSelected.next(message);
|
|
8447
8552
|
};
|
|
8553
|
+
BantaCommentsComponent.prototype.sendReply = function () {
|
|
8554
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8555
|
+
return __generator(this, function (_b) {
|
|
8556
|
+
switch (_b.label) {
|
|
8557
|
+
case 0: return [4 /*yield*/, this.selectedMessageThread.send({
|
|
8558
|
+
message: this.replyMessage,
|
|
8559
|
+
parentMessageId: this.selectedMessage.id,
|
|
8560
|
+
upvotes: 0,
|
|
8561
|
+
user: this.user,
|
|
8562
|
+
submessages: [],
|
|
8563
|
+
topicId: this.topicID,
|
|
8564
|
+
sentAt: Date.now(),
|
|
8565
|
+
updatedAt: Date.now()
|
|
8566
|
+
})];
|
|
8567
|
+
case 1:
|
|
8568
|
+
_b.sent();
|
|
8569
|
+
this.replyMessage = '';
|
|
8570
|
+
return [2 /*return*/];
|
|
8571
|
+
}
|
|
8572
|
+
});
|
|
8573
|
+
});
|
|
8574
|
+
};
|
|
8448
8575
|
return BantaCommentsComponent;
|
|
8449
8576
|
}());
|
|
8450
8577
|
BantaCommentsComponent.decorators = [
|
|
8451
8578
|
{ type: core.Component, args: [{
|
|
8452
8579
|
selector: 'banta-comments',
|
|
8453
|
-
template: "\r\n<form class=\"new-message\" (submit)=\"sendMessage()\">\r\n <div class=\"text-container\">\r\n <textarea \r\n name=\"message\" \r\n (keydown)=\"onKeyDown($event)\"\r\n [(ngModel)]=\"newMessageText\"></textarea>\r\n <emoji-selector-button \r\n class=\"top-right\"\r\n (selected)=\"insertEmoji($event)\"\r\n ></emoji-selector-button>\r\n </div>\r\n <div class=\"actions\">\r\n
|
|
8454
|
-
styles: [":host{flex-direction:column}:host,form{display:flex}form{align-items:center;padding:.5em 0}form .text-container{display:flex;flex-grow:1;position:relative}form .text-container textarea{background-color:#fff;border:1px solid #ccc;color:#333;font-size:14pt;min-height:6em;width:100%}form .text-container emoji-selector-button{bottom:0;position:absolute;right:0}form input[type=text]{background:#000;border:1px solid #333;color:#fff;height:1em;width:100%}form .actions{margin-left:1em}form button{display:block;margin:0 0 0 auto}:host-context(.mat-dark-theme) form .text-container textarea{background:#000;border-color:#333;color:#fff}"]
|
|
8580
|
+
template: "\r\n<div class=\"focused\" *ngIf=\"selectedMessage\">\r\n\r\n <div>\r\n <a mat-button href=\"javascript:;\" (click)=\"unselectMessage()\">\r\n <mat-icon>arrow_back</mat-icon>\r\n Latest Comments\r\n </a>\r\n </div>\r\n\r\n <banta-comment \r\n [message]=\"selectedMessage\"\r\n ></banta-comment>\r\n\r\n <div class=\"replies\">\r\n Reply\r\n <form class=\"new-message\" (submit)=\"sendReply()\">\r\n <div class=\"text-container\">\r\n <textarea \r\n name=\"message\" \r\n (keydown)=\"onReplyKeyDown($event)\"\r\n [(ngModel)]=\"replyMessage\"></textarea>\r\n <emoji-selector-button \r\n class=\"top-right\"\r\n (selected)=\"insertReplyEmoji($event)\"\r\n ></emoji-selector-button>\r\n </div>\r\n <button [disabled]=\"!replyMessage\" \r\n mat-raised-button color=\"primary\">Send</button>\r\n </form>\r\n <banta-comment-view \r\n [source]=\"selectedMessageThread\"\r\n [allowReplies]=\"false\"\r\n [fixedHeight]=\"false\"\r\n [showEmptyState]=\"false\"\r\n ></banta-comment-view>\r\n </div>\r\n</div>\r\n\r\n<form class=\"new-message\" (submit)=\"sendMessage()\" *ngIf=\"!selectedMessage\">\r\n <div class=\"text-container\">\r\n <textarea \r\n name=\"message\" \r\n placeholder=\"Type your comment\"\r\n (keydown)=\"onKeyDown($event)\"\r\n [(ngModel)]=\"newMessageText\"></textarea>\r\n <emoji-selector-button \r\n class=\"top-right\"\r\n (selected)=\"insertEmoji($event)\"\r\n ></emoji-selector-button>\r\n </div>\r\n <div class=\"actions\">\r\n <ng-container *ngIf=\"!user\">\r\n <button \r\n mat-raised-button \r\n color=\"primary\"\r\n type=\"button\"\r\n (click)=\"showSignIn()\"\r\n >{{signInLabel}}</button>\r\n </ng-container>\r\n <ng-container *ngIf=\"user\">\r\n <button \r\n *ngIf=\"canComment\"\r\n mat-raised-button \r\n color=\"primary\"\r\n [disabled]=\"!newMessageText\" \r\n >{{sendLabel}}</button>\r\n <button \r\n *ngIf=\"!canComment\"\r\n type=\"button\"\r\n (click)=\"showPermissionDenied()\"\r\n mat-raised-button \r\n color=\"primary\"\r\n >{{permissionDeniedLabel}}</button>\r\n </ng-container>\r\n </div>\r\n</form>\r\n\r\n<banta-comment-view \r\n [class.faded]=\"selectedMessage\"\r\n [source]=\"source\"\r\n [fixedHeight]=\"fixedHeight\"\r\n [maxMessages]=\"maxMessages\"\r\n [maxVisibleMessages]=\"maxVisibleMessages\"\r\n [genericAvatarUrl]=\"genericAvatarUrl\"\r\n (userSelected)=\"selectMessageUser($event)\"\r\n (selected)=\"selectMessage($event)\"\r\n (upvoted)=\"upvoteMessage($event)\"\r\n (reported)=\"reportMessage($event)\"\r\n ></banta-comment-view>",
|
|
8581
|
+
styles: [":host{flex-direction:column}:host,form{display:flex}form{align-items:center;padding:.5em 0}form .text-container{display:flex;flex-grow:1;position:relative}form .text-container textarea{background-color:#fff;border:1px solid #ccc;color:#333;font-size:14pt;min-height:6em;width:100%}form .text-container emoji-selector-button{bottom:0;position:absolute;right:0}form input[type=text]{background:#000;border:1px solid #333;color:#fff;height:1em;width:100%}form .actions{margin-left:1em}form button{display:block;margin:0 0 0 auto}:host-context(.mat-dark-theme) form .text-container textarea{background:#000;border-color:#333;color:#fff}.focused .replies{margin-left:4em;margin-top:1em}banta-comment-view{opacity:1;transition:opacity .4s ease-in-out}banta-comment-view.faded{opacity:.25}form.new-message{align-items:flex-start;display:flex}form.new-message mat-form-field{flex-grow:1}form.new-message button{margin-left:1em;margin-top:.5em}"]
|
|
8455
8582
|
},] }
|
|
8456
8583
|
];
|
|
8457
8584
|
BantaCommentsComponent.ctorParameters = function () { return [
|
|
@@ -8460,6 +8587,10 @@
|
|
|
8460
8587
|
]; };
|
|
8461
8588
|
BantaCommentsComponent.propDecorators = {
|
|
8462
8589
|
source: [{ type: core.Input }],
|
|
8590
|
+
fixedHeight: [{ type: core.Input }],
|
|
8591
|
+
maxMessages: [{ type: core.Input }],
|
|
8592
|
+
maxVisibleMessages: [{ type: core.Input }],
|
|
8593
|
+
genericAvatarUrl: [{ type: core.Input }],
|
|
8463
8594
|
topicID: [{ type: core.Input }],
|
|
8464
8595
|
signInLabel: [{ type: core.Input }],
|
|
8465
8596
|
sendLabel: [{ type: core.Input }],
|
|
@@ -8566,10 +8697,14 @@
|
|
|
8566
8697
|
declarations: COMPONENTS$3,
|
|
8567
8698
|
imports: [
|
|
8568
8699
|
common.CommonModule,
|
|
8700
|
+
textField.TextFieldModule,
|
|
8569
8701
|
forms.FormsModule,
|
|
8570
8702
|
icon.MatIconModule,
|
|
8703
|
+
formField.MatFormFieldModule,
|
|
8704
|
+
input.MatInputModule,
|
|
8571
8705
|
button.MatButtonModule,
|
|
8572
8706
|
menu.MatMenuModule,
|
|
8707
|
+
progressSpinner.MatProgressSpinnerModule,
|
|
8573
8708
|
BantaCommonModule,
|
|
8574
8709
|
EmojiModule
|
|
8575
8710
|
],
|
|
@@ -8605,7 +8740,8 @@
|
|
|
8605
8740
|
menu.MatMenuModule,
|
|
8606
8741
|
dialog.MatDialogModule,
|
|
8607
8742
|
formField.MatFormFieldModule,
|
|
8608
|
-
input.MatInputModule
|
|
8743
|
+
input.MatInputModule,
|
|
8744
|
+
progressSpinner.MatProgressSpinnerModule
|
|
8609
8745
|
],
|
|
8610
8746
|
declarations: [
|
|
8611
8747
|
BantaComponent,
|