@banta/sdk 3.2.3 → 3.3.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/bundles/banta-sdk.umd.js +172 -43
- 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/comments/banta-comments/banta-comments.component.js +60 -13
- package/esm2015/lib/comments/comment/comment.component.js +11 -3
- package/esm2015/lib/comments/comment-sort/comment-sort.component.js +34 -0
- package/esm2015/lib/comments/comment-view/comment-view.component.js +16 -7
- package/esm2015/lib/comments/comments.module.js +10 -4
- package/esm2015/lib/common/chat-backend.service.js +1 -1
- package/fesm2015/banta-sdk.js +122 -22
- package/fesm2015/banta-sdk.js.map +1 -1
- package/lib/comments/banta-comments/banta-comments.component.d.ts +16 -4
- package/lib/comments/comment/comment.component.d.ts +3 -0
- package/lib/comments/comment-sort/comment-sort.component.d.ts +9 -0
- package/lib/comments/comment-view/comment-view.component.d.ts +3 -0
- package/lib/common/chat-backend.service.d.ts +3 -3
- package/package.json +3 -3
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('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('@angular/material/dialog'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), 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', '@angular/material/form-field', '@angular/material/input', '@angular/forms', '@angular/material/dialog', '@angular/material/menu', '@angular/material/progress-spinner', '@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.ng.material.formField, global.ng.material.input, global.ng.forms, global.ng.material.dialog, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.cdk.textField, global.ng.material.tooltip));
|
|
5
|
-
}(this, (function (exports, rxjs, operators, core, common, platformBrowser, icon, button, formField, input, forms, dialog, menu, progressSpinner, textField, tooltip) { 'use strict';
|
|
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('@angular/material/form-field'), require('@angular/material/input'), require('@angular/forms'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/material/menu'), require('@angular/material/progress-spinner'), require('@angular/cdk/text-field'), require('@angular/material/tooltip'), require('@banta/common'), require('@angular/material/select')) :
|
|
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', '@angular/material/form-field', '@angular/material/input', '@angular/forms', '@angular/material/dialog', '@angular/router', '@angular/material/menu', '@angular/material/progress-spinner', '@angular/cdk/text-field', '@angular/material/tooltip', '@banta/common', '@angular/material/select'], 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.ng.material.formField, global.ng.material.input, global.ng.forms, global.ng.material.dialog, global.ng.router, global.ng.material.menu, global.ng.material.progressSpinner, global.ng.cdk.textField, global.ng.material.tooltip, global.common$1, global.ng.material.select));
|
|
5
|
+
}(this, (function (exports, rxjs, operators, core, common, platformBrowser, icon, button, formField, input, forms, dialog, router, menu, progressSpinner, textField, tooltip, common$1, select) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function lazyConnection(options) {
|
|
8
8
|
var obs = new rxjs.Observable(function (observer) {
|
|
@@ -8116,6 +8116,7 @@
|
|
|
8116
8116
|
this._reported = new rxjs.Subject();
|
|
8117
8117
|
this._selected = new rxjs.Subject();
|
|
8118
8118
|
this._upvoted = new rxjs.Subject();
|
|
8119
|
+
this._shared = new rxjs.Subject();
|
|
8119
8120
|
this._userSelected = new rxjs.Subject();
|
|
8120
8121
|
this._avatarSelected = new rxjs.Subject();
|
|
8121
8122
|
this._usernameSelected = new rxjs.Subject();
|
|
@@ -8184,12 +8185,22 @@
|
|
|
8184
8185
|
enumerable: false,
|
|
8185
8186
|
configurable: true
|
|
8186
8187
|
});
|
|
8188
|
+
Object.defineProperty(CommentComponent.prototype, "shared", {
|
|
8189
|
+
get: function () {
|
|
8190
|
+
return this._shared.asObservable();
|
|
8191
|
+
},
|
|
8192
|
+
enumerable: false,
|
|
8193
|
+
configurable: true
|
|
8194
|
+
});
|
|
8187
8195
|
CommentComponent.prototype.report = function () {
|
|
8188
8196
|
this._reported.next();
|
|
8189
8197
|
};
|
|
8190
8198
|
CommentComponent.prototype.upvote = function () {
|
|
8191
8199
|
this._upvoted.next();
|
|
8192
8200
|
};
|
|
8201
|
+
CommentComponent.prototype.share = function () {
|
|
8202
|
+
this._shared.next(this.message);
|
|
8203
|
+
};
|
|
8193
8204
|
CommentComponent.prototype.select = function () {
|
|
8194
8205
|
this._selected.next();
|
|
8195
8206
|
};
|
|
@@ -8216,7 +8227,7 @@
|
|
|
8216
8227
|
CommentComponent.decorators = [
|
|
8217
8228
|
{ type: core.Component, args: [{
|
|
8218
8229
|
selector: 'banta-comment',
|
|
8219
|
-
template: "\r\n<mat-menu #pointItemMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"report()\">Report</button>\r\n <button mat-menu-item>Help</button>\r\n</mat-menu>\r\n\r\n<div class=\"message-content\">\r\n <div class=\"user\">\r\n <a
|
|
8230
|
+
template: "\r\n<mat-menu #pointItemMenu=\"matMenu\">\r\n <button mat-menu-item (click)=\"report()\">Report</button>\r\n <button mat-menu-item>Help</button>\r\n</mat-menu>\r\n\r\n<div class=\"message-content\">\r\n <div class=\"user\">\r\n <a\r\n href=\"javascript:;\"\r\n class=\"avatar\"\r\n (click)=\"selectAvatar(message.user)\"\r\n [style.background-image]=\"avatarForUser(message.user)\"></a>\r\n <a href=\"javascript:;\" class=\"display-name\" (click)=\"selectUser()\">{{message.user.displayName}}</a>\r\n <a href=\"javascript:;\" class=\"username\" (click)=\"selectUsername(message.user)\">@{{message.user.username}}</a>\r\n </div>\r\n <div class=\"content\">\r\n {{message.message}}\r\n </div>\r\n\r\n <div class=\"actions\">\r\n <banta-timestamp [value]=\"message.sentAt\"></banta-timestamp>\r\n <div class=\"spacer\"></div>\r\n <div class=\"counted-action\" *ngIf=\"showReplyAction\">\r\n <div class=\"count-indicator\">\r\n {{message.submessages?.length || 0}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Comment\" matTooltipPosition=\"below\" (click)=\"select()\">\r\n <mat-icon [inline]=\"true\">comment</mat-icon>\r\n </button>\r\n </div>\r\n <div class=\"counted-action\">\r\n <div class=\"count-indicator\">\r\n {{message.upvotes}}\r\n </div>\r\n <button mat-icon-button matTooltip=\"Upvote\" matTooltipPosition=\"below\" (click)=\"upvote()\">\r\n <mat-icon [inline]=\"true\">thumb_up</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div class=\"counted-action\">\r\n <button mat-icon-button matTooltip=\"Share this comment\" matTooltipPosition=\"below\" (click)=\"share()\">\r\n <mat-icon [inline]=\"true\" >share</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <button mat-icon-button [matMenuTriggerFor]=\"pointItemMenu\">\r\n <mat-icon [inline]=\"true\">more_vert</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n",
|
|
8220
8231
|
styles: ["@-webkit-keyframes comment-appear{0%{transform:translate(100vw)}to{transform:translate(0)}}@keyframes comment-appear{0%{transform:translate(100vw)}to{transform:translate(0)}}:host{display:flex;flex-direction:column;padding:.5em;position:relative;visibility:hidden}:host.new{-webkit-animation-duration:.4s;-webkit-animation-fill-mode:both;-webkit-animation-name:comment-appear;animation-duration:.4s;animation-fill-mode:both;animation-name:comment-appear}:host.new,:host.visible{visibility:visible}:host:hover{background:#eee}:host .message-content .content{margin-left:60px;margin-right:.5em}:host.abbreviated .message-content .content{max-height:8.5em;overflow-y:hidden;text-overflow:ellipsis}:host .actions{align-items:center;display:flex;margin-left:60px;padding-right:10px}:host .actions button{color:#666}:host .actions banta-timestamp{color:#666;font-size:10pt}.user{align-items:center;display:flex;margin:1em 0 0;position:relative}.user .display-name,.user .username{color:#000;display:block;flex-grow:0;flex-shrink:1;font-size:10pt;margin:0 auto 0 0;max-width:100%;overflow:hidden;padding:0 0 0 1em;position:relative;text-overflow:ellipsis;white-space:nowrap;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;z-index:1}.user .display-name.username,.user .username.username{color:#666;flex-grow:1;flex-shrink:0}.avatar{background-color:#333;background-position:50%;background-size:cover;border-radius:100%;flex-grow:0;flex-shrink:0;height:48px;width:48px}.counted-action{align-items:center;display:flex}.count-indicator{color:#666;font-size:9pt;padding:0 0 0 3px}:host-context(.mat-dark-theme) .count-indicator{border-color:#333}:host-context(.mat-dark-theme):hover{background:#060606}:host-context(.mat-dark-theme) .user .display-name,:host-context(.mat-dark-theme) .user .username{color:#fff}@media (max-width:400px){.avatar{height:32px;width:32px}:host .actions{margin-left:44px}:host .message-content .content{margin-left:44px;margin-right:.5em}}"]
|
|
8221
8232
|
},] }
|
|
8222
8233
|
];
|
|
@@ -8231,7 +8242,8 @@
|
|
|
8231
8242
|
reported: [{ type: core.Output }],
|
|
8232
8243
|
upvoted: [{ type: core.Output }],
|
|
8233
8244
|
selected: [{ type: core.Output }],
|
|
8234
|
-
commentId: [{ type: core.HostBinding, args: ['attr.data-comment-id',] }]
|
|
8245
|
+
commentId: [{ type: core.HostBinding, args: ['attr.data-comment-id',] }],
|
|
8246
|
+
shared: [{ type: core.Output }]
|
|
8235
8247
|
};
|
|
8236
8248
|
|
|
8237
8249
|
var CommentViewComponent = /** @class */ (function () {
|
|
@@ -8244,6 +8256,7 @@
|
|
|
8244
8256
|
this._userSelected = new rxjs.Subject();
|
|
8245
8257
|
this._usernameSelected = new rxjs.Subject();
|
|
8246
8258
|
this._avatarSelected = new rxjs.Subject();
|
|
8259
|
+
this._shared = new rxjs.Subject();
|
|
8247
8260
|
this.showEmptyState = true;
|
|
8248
8261
|
this.allowReplies = true;
|
|
8249
8262
|
this.menuMessage = null;
|
|
@@ -8299,6 +8312,13 @@
|
|
|
8299
8312
|
enumerable: false,
|
|
8300
8313
|
configurable: true
|
|
8301
8314
|
});
|
|
8315
|
+
Object.defineProperty(CommentViewComponent.prototype, "shared", {
|
|
8316
|
+
get: function () {
|
|
8317
|
+
return this._shared;
|
|
8318
|
+
},
|
|
8319
|
+
enumerable: false,
|
|
8320
|
+
configurable: true
|
|
8321
|
+
});
|
|
8302
8322
|
Object.defineProperty(CommentViewComponent.prototype, "source", {
|
|
8303
8323
|
get: function () {
|
|
8304
8324
|
return this._source;
|
|
@@ -8311,6 +8331,7 @@
|
|
|
8311
8331
|
}
|
|
8312
8332
|
this._source = value;
|
|
8313
8333
|
if (value) {
|
|
8334
|
+
console.log("[banta-comment-view] Subscribing to source...");
|
|
8314
8335
|
var messages = (value.messages || []).slice();
|
|
8315
8336
|
this.messages = messages;
|
|
8316
8337
|
this.olderMessages = messages.splice(this.maxVisibleMessages, messages.length);
|
|
@@ -8344,6 +8365,9 @@
|
|
|
8344
8365
|
CommentViewComponent.prototype.selectAvatar = function (user) {
|
|
8345
8366
|
this._avatarSelected.next(user);
|
|
8346
8367
|
};
|
|
8368
|
+
CommentViewComponent.prototype.sharedMessage = function (message) {
|
|
8369
|
+
this._shared.next(message);
|
|
8370
|
+
};
|
|
8347
8371
|
CommentViewComponent.prototype.messageIdentity = function (index, chatMessage) {
|
|
8348
8372
|
return chatMessage.id;
|
|
8349
8373
|
};
|
|
@@ -8455,7 +8479,7 @@
|
|
|
8455
8479
|
CommentViewComponent.decorators = [
|
|
8456
8480
|
{ type: core.Component, args: [{
|
|
8457
8481
|
selector: 'banta-comment-view',
|
|
8458
|
-
template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n
|
|
8482
|
+
template: "<div class=\"message-container\">\r\n <ng-content select=\"[data-before]\"></ng-content>\r\n\r\n <a mat-button class=\"nav\" [class.visible]=\"isViewingMore\" href=\"javascript:;\" (click)=\"showNew()\">\r\n <mat-icon>file_upload</mat-icon>\r\n New\r\n <ng-container *ngIf=\"newMessages.length >= 1\">\r\n ({{newMessages.length}})\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 (click)=\"isViewingMore = true\"\r\n [showReplyAction]=\"allowReplies\"\r\n\t\t(userSelected)=\"selectMessageUser(message)\"\r\n (avatarSelected)=\"selectAvatar($event)\"\r\n\t\t(usernameSelected)=\"selectUsername($event)\"\r\n (upvoted)=\"upvoteMessage(message)\"\r\n (reported)=\"reportMessage(message)\"\r\n (selected)=\"selectMessage(message)\"\r\n (shared)=\"sharedMessage($event)\"\r\n ></banta-comment>\r\n\r\n <a mat-button class=\"nav\" [class.visible]=\"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>\r\n",
|
|
8459
8483
|
styles: [":host{display:flex;flex-direction:column;flex-grow:1;opacity:1;transition:opacity .2s ease-in}.message-container{background:#fff;color:#111;flex-grow:1;opacity:1;overflow-x:hidden;padding:.5em 1em 3em .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:#111;color:#fff}.empty-state{color:#666;margin:3em;text-align:center}:host-context(.mat-dark-theme) .empty-state{color:#666}a.nav{background:#222;border-radius:2em;opacity:0;pointer-events:none;position:absolute;right:.5em;text-align:center;transition:opacity .4s ease-in-out;z-index:10}a.nav.visible{opacity:1;pointer-events:auto}.loading-more{margin:0 auto;padding:2em;text-align:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}@media (max-width:400px){.message-container{padding:0 0 3em}}"]
|
|
8460
8484
|
},] }
|
|
8461
8485
|
];
|
|
@@ -8472,6 +8496,7 @@
|
|
|
8472
8496
|
upvoted: [{ type: core.Output }],
|
|
8473
8497
|
usernameSelected: [{ type: core.Output }],
|
|
8474
8498
|
avatarSelected: [{ type: core.Output }],
|
|
8499
|
+
shared: [{ type: core.Output }],
|
|
8475
8500
|
source: [{ type: core.Input }],
|
|
8476
8501
|
genericAvatarUrl: [{ type: core.Input }],
|
|
8477
8502
|
messageContainer: [{ type: core.ViewChild, args: ['messageContainer',] }],
|
|
@@ -8484,14 +8509,16 @@
|
|
|
8484
8509
|
* Comments component
|
|
8485
8510
|
*/
|
|
8486
8511
|
var BantaCommentsComponent = /** @class */ (function () {
|
|
8487
|
-
function BantaCommentsComponent(banta, backend, elementRef) {
|
|
8512
|
+
function BantaCommentsComponent(banta, backend, elementRef, activatedRoute) {
|
|
8488
8513
|
this.banta = banta;
|
|
8489
8514
|
this.backend = backend;
|
|
8490
8515
|
this.elementRef = elementRef;
|
|
8516
|
+
this.activatedRoute = activatedRoute;
|
|
8491
8517
|
this._upvoted = new rxjs.Subject();
|
|
8492
8518
|
this._reported = new rxjs.Subject();
|
|
8493
8519
|
this._selected = new rxjs.Subject();
|
|
8494
8520
|
this._userSelected = new rxjs.Subject();
|
|
8521
|
+
this._shared = new rxjs.Subject();
|
|
8495
8522
|
this._usernameSelected = new rxjs.Subject();
|
|
8496
8523
|
this._avatarSelected = new rxjs.Subject();
|
|
8497
8524
|
this._subs = new rxjs.Subscription();
|
|
@@ -8515,10 +8542,45 @@
|
|
|
8515
8542
|
this.expandError = false;
|
|
8516
8543
|
this.selectedMessageVisible = false;
|
|
8517
8544
|
}
|
|
8545
|
+
Object.defineProperty(BantaCommentsComponent.prototype, "sortOrder", {
|
|
8546
|
+
get: function () {
|
|
8547
|
+
return this._sortOrder;
|
|
8548
|
+
},
|
|
8549
|
+
set: function (value) {
|
|
8550
|
+
var _this = this;
|
|
8551
|
+
if (this._sortOrder !== value) {
|
|
8552
|
+
this._sortOrder = value;
|
|
8553
|
+
setTimeout(function () {
|
|
8554
|
+
_this.setSourceFromTopicID(_this.topicID);
|
|
8555
|
+
});
|
|
8556
|
+
}
|
|
8557
|
+
},
|
|
8558
|
+
enumerable: false,
|
|
8559
|
+
configurable: true
|
|
8560
|
+
});
|
|
8518
8561
|
BantaCommentsComponent.prototype.ngOnInit = function () {
|
|
8519
8562
|
var _this = this;
|
|
8520
8563
|
this._subs.add(this.banta.userChanged.subscribe(function (user) { return _this.user = user; }));
|
|
8521
8564
|
};
|
|
8565
|
+
BantaCommentsComponent.prototype.ngAfterViewInit = function () {
|
|
8566
|
+
if (typeof window !== 'undefined')
|
|
8567
|
+
this.checkForSharedComment();
|
|
8568
|
+
};
|
|
8569
|
+
BantaCommentsComponent.prototype.scrollToComment = function (commentId) {
|
|
8570
|
+
setTimeout(function () {
|
|
8571
|
+
var comment = document.querySelectorAll("[data-comment-id=\"" + commentId + "\"]");
|
|
8572
|
+
console.log(comment);
|
|
8573
|
+
if (comment.length > 0) {
|
|
8574
|
+
// comment.item(0).scroll({behavior: 'smooth'});
|
|
8575
|
+
comment.item(0).scrollIntoView();
|
|
8576
|
+
}
|
|
8577
|
+
}, 1000);
|
|
8578
|
+
};
|
|
8579
|
+
BantaCommentsComponent.prototype.checkForSharedComment = function () {
|
|
8580
|
+
var commentID = this.activatedRoute.snapshot.queryParamMap.get('comment');
|
|
8581
|
+
if (commentID)
|
|
8582
|
+
this.scrollToComment(commentID);
|
|
8583
|
+
};
|
|
8522
8584
|
BantaCommentsComponent.prototype.ngOnDestroy = function () {
|
|
8523
8585
|
this._subs.unsubscribe();
|
|
8524
8586
|
};
|
|
@@ -8534,33 +8596,44 @@
|
|
|
8534
8596
|
});
|
|
8535
8597
|
Object.defineProperty(BantaCommentsComponent.prototype, "topicID", {
|
|
8536
8598
|
get: function () {
|
|
8537
|
-
return this.
|
|
8599
|
+
return this._topicID;
|
|
8538
8600
|
},
|
|
8539
8601
|
set: function (value) {
|
|
8540
|
-
this
|
|
8602
|
+
var _this = this;
|
|
8603
|
+
if (this._topicID !== value) {
|
|
8604
|
+
this._topicID = value;
|
|
8605
|
+
setTimeout(function () { return _this.setSourceFromTopicID(value); });
|
|
8606
|
+
}
|
|
8541
8607
|
},
|
|
8542
8608
|
enumerable: false,
|
|
8543
8609
|
configurable: true
|
|
8544
8610
|
});
|
|
8545
8611
|
BantaCommentsComponent.prototype.setSourceFromTopicID = function (topicID) {
|
|
8612
|
+
var _a, _b;
|
|
8546
8613
|
return __awaiter(this, void 0, void 0, function () {
|
|
8547
|
-
var _b;
|
|
8548
8614
|
var _this = this;
|
|
8549
8615
|
return __generator(this, function (_c) {
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8616
|
+
(_b = (_a = this._source) === null || _a === void 0 ? void 0 : _a.close) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
8617
|
+
this._source = null;
|
|
8618
|
+
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
8619
|
+
var _c;
|
|
8620
|
+
var _this = this;
|
|
8621
|
+
return __generator(this, function (_d) {
|
|
8622
|
+
switch (_d.label) {
|
|
8623
|
+
case 0:
|
|
8624
|
+
_c = this;
|
|
8625
|
+
return [4 /*yield*/, this.backend.getSourceForTopic(topicID, { sortOrder: this.sortOrder })];
|
|
8626
|
+
case 1:
|
|
8627
|
+
_c._source = _d.sent();
|
|
8628
|
+
console.log("[banta-comments] Subscribing to source for topic '" + topicID + "'");
|
|
8629
|
+
this._source.messageReceived.subscribe(function (m) { return _this.addParticipant(m); });
|
|
8630
|
+
this._source.messageSent.subscribe(function (m) { return _this.addParticipant(m); });
|
|
8631
|
+
this._source.messages.forEach(function (m) { return _this.addParticipant(m); });
|
|
8632
|
+
return [2 /*return*/];
|
|
8633
|
+
}
|
|
8634
|
+
});
|
|
8635
|
+
}); });
|
|
8636
|
+
return [2 /*return*/];
|
|
8564
8637
|
});
|
|
8565
8638
|
});
|
|
8566
8639
|
};
|
|
@@ -8671,6 +8744,13 @@
|
|
|
8671
8744
|
enumerable: false,
|
|
8672
8745
|
configurable: true
|
|
8673
8746
|
});
|
|
8747
|
+
Object.defineProperty(BantaCommentsComponent.prototype, "shared", {
|
|
8748
|
+
get: function () {
|
|
8749
|
+
return this._shared.asObservable();
|
|
8750
|
+
},
|
|
8751
|
+
enumerable: false,
|
|
8752
|
+
configurable: true
|
|
8753
|
+
});
|
|
8674
8754
|
BantaCommentsComponent.prototype.onKeyDown = function (event) {
|
|
8675
8755
|
};
|
|
8676
8756
|
BantaCommentsComponent.prototype.insertEmoji = function (text) {
|
|
@@ -8693,13 +8773,13 @@
|
|
|
8693
8773
|
};
|
|
8694
8774
|
BantaCommentsComponent.prototype.upvoteMessage = function (message) {
|
|
8695
8775
|
return __awaiter(this, void 0, void 0, function () {
|
|
8696
|
-
return __generator(this, function (
|
|
8697
|
-
switch (
|
|
8776
|
+
return __generator(this, function (_c) {
|
|
8777
|
+
switch (_c.label) {
|
|
8698
8778
|
case 0:
|
|
8699
8779
|
this._upvoted.next(message);
|
|
8700
8780
|
return [4 /*yield*/, this.backend.upvoteMessage(message.topicId, message.parentMessageId ? message.parentMessageId : message.id, message.parentMessageId ? message.id : undefined)];
|
|
8701
8781
|
case 1:
|
|
8702
|
-
|
|
8782
|
+
_c.sent();
|
|
8703
8783
|
return [2 /*return*/];
|
|
8704
8784
|
}
|
|
8705
8785
|
});
|
|
@@ -8712,7 +8792,7 @@
|
|
|
8712
8792
|
return __awaiter(this, void 0, void 0, function () {
|
|
8713
8793
|
var message;
|
|
8714
8794
|
var _this = this;
|
|
8715
|
-
return __generator(this, function (
|
|
8795
|
+
return __generator(this, function (_c) {
|
|
8716
8796
|
message = this.selectedMessage;
|
|
8717
8797
|
this._selected.next(null);
|
|
8718
8798
|
this.selectedMessage = null;
|
|
@@ -8730,19 +8810,19 @@
|
|
|
8730
8810
|
BantaCommentsComponent.prototype.selectMessage = function (message) {
|
|
8731
8811
|
return __awaiter(this, void 0, void 0, function () {
|
|
8732
8812
|
var _this = this;
|
|
8733
|
-
return __generator(this, function (
|
|
8813
|
+
return __generator(this, function (_c) {
|
|
8734
8814
|
this._selected.next(message);
|
|
8735
8815
|
this.selectedMessage = message;
|
|
8736
8816
|
setTimeout(function () { return _this.selectedMessageVisible = true; });
|
|
8737
8817
|
setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
8738
|
-
var
|
|
8739
|
-
return __generator(this, function (
|
|
8740
|
-
switch (
|
|
8818
|
+
var _c;
|
|
8819
|
+
return __generator(this, function (_d) {
|
|
8820
|
+
switch (_d.label) {
|
|
8741
8821
|
case 0:
|
|
8742
|
-
|
|
8822
|
+
_c = this;
|
|
8743
8823
|
return [4 /*yield*/, this.backend.getSourceForThread(this.topicID, message.id)];
|
|
8744
8824
|
case 1:
|
|
8745
|
-
|
|
8825
|
+
_c.selectedMessageThread = _d.sent();
|
|
8746
8826
|
return [2 /*return*/];
|
|
8747
8827
|
}
|
|
8748
8828
|
});
|
|
@@ -8760,10 +8840,13 @@
|
|
|
8760
8840
|
BantaCommentsComponent.prototype.selectAvatar = function (user) {
|
|
8761
8841
|
this._avatarSelected.next(user);
|
|
8762
8842
|
};
|
|
8843
|
+
BantaCommentsComponent.prototype.shareMessage = function (message) {
|
|
8844
|
+
this._shared.next(message);
|
|
8845
|
+
};
|
|
8763
8846
|
BantaCommentsComponent.prototype.sendReply = function () {
|
|
8764
8847
|
return __awaiter(this, void 0, void 0, function () {
|
|
8765
|
-
return __generator(this, function (
|
|
8766
|
-
switch (
|
|
8848
|
+
return __generator(this, function (_c) {
|
|
8849
|
+
switch (_c.label) {
|
|
8767
8850
|
case 0: return [4 /*yield*/, this.selectedMessageThread.send({
|
|
8768
8851
|
message: this.replyMessage,
|
|
8769
8852
|
parentMessageId: this.selectedMessage.id,
|
|
@@ -8775,7 +8858,7 @@
|
|
|
8775
8858
|
updatedAt: Date.now()
|
|
8776
8859
|
})];
|
|
8777
8860
|
case 1:
|
|
8778
|
-
|
|
8861
|
+
_c.sent();
|
|
8779
8862
|
this.replyMessage = '';
|
|
8780
8863
|
return [2 /*return*/];
|
|
8781
8864
|
}
|
|
@@ -8793,14 +8876,15 @@
|
|
|
8793
8876
|
BantaCommentsComponent.decorators = [
|
|
8794
8877
|
{ type: core.Component, args: [{
|
|
8795
8878
|
selector: 'banta-comments',
|
|
8796
|
-
template: "\r\n<div class=\"focused\" [class.visible]=\"selectedMessageVisible\" *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
|
|
8879
|
+
template: "\r\n<div class=\"focused\" [class.visible]=\"selectedMessageVisible\" *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\r\n <ng-container *ngIf=\"!selectedMessageThread\">\r\n <div class=\"loading\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"selectedMessageThread\">\r\n <banta-comment-view\r\n [source]=\"selectedMessageThread\"\r\n [allowReplies]=\"false\"\r\n [fixedHeight]=\"false\"\r\n [showEmptyState]=\"false\"\r\n [newestLast]=\"true\"\r\n ></banta-comment-view>\r\n\r\n <banta-comment-field\r\n [sendLabel]=\"replyLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n (signInSelected)=\"showSignIn()\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n [source]=\"selectedMessageThread\"\r\n [canComment]=\"canComment\"\r\n [signInLabel]=\"signInLabel\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n [user]=\"user\"\r\n [label]=\"postReplyLabel\"\r\n ></banta-comment-field>\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<div class=\"main\" [class.hidden]=\"selectedMessage\">\r\n <banta-comment-field\r\n [source]=\"source\"\r\n [user]=\"user\"\r\n [sendLabel]=\"sendLabel\"\r\n [sendingLabel]=\"sendingLabel\"\r\n [signInLabel]=\"signInLabel\"\r\n [canComment]=\"canComment\"\r\n [hashtags]=\"hashtags\"\r\n [participants]=\"participants\"\r\n [label]=\"postCommentLabel\"\r\n (editAvatarSelected)=\"showEditAvatar()\"\r\n (signInSelected)=\"showSignIn()\"\r\n [permissionDeniedLabel]=\"permissionDeniedLabel\"\r\n (permissionDeniedError)=\"showPermissionDenied()\"\r\n ></banta-comment-field>\r\n\r\n <banta-comment-sort\r\n [(sort)]=\"sortOrder\"></banta-comment-sort>\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 (usernameSelected)=\"selectUsername($event)\"\r\n (avatarSelected)=\"selectAvatar($event)\"\r\n (shared)=\"shareMessage($event)\"\r\n ></banta-comment-view>\r\n</div>\r\n",
|
|
8797
8880
|
styles: [":host{display:flex;flex-direction:column}@-webkit-keyframes select-comment{0%{transform:scale(1.15)}to{transform:scale(1)}}@keyframes select-comment{0%{transform:scale(1.15)}to{transform:scale(1)}}.focused{-webkit-animation-duration:.4s;-webkit-animation-fill-mode:both;-webkit-animation-name:select-comment;animation-duration:.4s;animation-fill-mode:both;animation-name:select-comment}.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}.loading{display:block;margin:0 auto;min-height:16em;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.main.hidden{display:none}@media (max-width:500px){.focused .replies{margin-left:0}}"]
|
|
8798
8881
|
},] }
|
|
8799
8882
|
];
|
|
8800
8883
|
BantaCommentsComponent.ctorParameters = function () { return [
|
|
8801
8884
|
{ type: BantaService },
|
|
8802
8885
|
{ type: ChatBackendService },
|
|
8803
|
-
{ type: core.ElementRef }
|
|
8886
|
+
{ type: core.ElementRef },
|
|
8887
|
+
{ type: router.ActivatedRoute }
|
|
8804
8888
|
]; };
|
|
8805
8889
|
BantaCommentsComponent.propDecorators = {
|
|
8806
8890
|
hashtags: [{ type: core.Input }],
|
|
@@ -8826,7 +8910,8 @@
|
|
|
8826
8910
|
selected: [{ type: core.Output }],
|
|
8827
8911
|
userSelected: [{ type: core.Output }],
|
|
8828
8912
|
usernameSelected: [{ type: core.Output }],
|
|
8829
|
-
avatarSelected: [{ type: core.Output }]
|
|
8913
|
+
avatarSelected: [{ type: core.Output }],
|
|
8914
|
+
shared: [{ type: core.Output }]
|
|
8830
8915
|
};
|
|
8831
8916
|
|
|
8832
8917
|
var LiveCommentComponent = /** @class */ (function () {
|
|
@@ -9187,12 +9272,54 @@
|
|
|
9187
9272
|
permissionDeniedError: [{ type: core.Output }]
|
|
9188
9273
|
};
|
|
9189
9274
|
|
|
9275
|
+
var CommentSortComponent = /** @class */ (function () {
|
|
9276
|
+
function CommentSortComponent() {
|
|
9277
|
+
this.commentsOrder = common$1.CommentsOrder;
|
|
9278
|
+
this._sortChange = new rxjs.Subject();
|
|
9279
|
+
this._sort = common$1.CommentsOrder.LIKES;
|
|
9280
|
+
}
|
|
9281
|
+
Object.defineProperty(CommentSortComponent.prototype, "sort", {
|
|
9282
|
+
get: function () {
|
|
9283
|
+
return this._sort;
|
|
9284
|
+
},
|
|
9285
|
+
set: function (value) {
|
|
9286
|
+
var _this = this;
|
|
9287
|
+
if (this._sort !== value) {
|
|
9288
|
+
this._sort = value;
|
|
9289
|
+
setTimeout(function () { return _this._sortChange.next(value); });
|
|
9290
|
+
}
|
|
9291
|
+
},
|
|
9292
|
+
enumerable: false,
|
|
9293
|
+
configurable: true
|
|
9294
|
+
});
|
|
9295
|
+
Object.defineProperty(CommentSortComponent.prototype, "sortChange", {
|
|
9296
|
+
get: function () {
|
|
9297
|
+
return this._sortChange.asObservable();
|
|
9298
|
+
},
|
|
9299
|
+
enumerable: false,
|
|
9300
|
+
configurable: true
|
|
9301
|
+
});
|
|
9302
|
+
return CommentSortComponent;
|
|
9303
|
+
}());
|
|
9304
|
+
CommentSortComponent.decorators = [
|
|
9305
|
+
{ type: core.Component, args: [{
|
|
9306
|
+
selector: 'banta-comment-sort',
|
|
9307
|
+
template: "<div class=\"sort-row\">\r\n <mat-form-field>\r\n <mat-label>Sort by</mat-label>\r\n <mat-select [(value)]=\"sort\" >\r\n <mat-option [value]=\"commentsOrder.NEWEST\">Newest</mat-option>\r\n <mat-option [value]=\"commentsOrder.OLDEST\">Oldest</mat-option>\r\n <mat-option [value]=\"commentsOrder.LIKES\">Likes</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</div>\r\n",
|
|
9308
|
+
styles: [".sort-row{display:flex;justify-content:end;padding-right:3em}"]
|
|
9309
|
+
},] }
|
|
9310
|
+
];
|
|
9311
|
+
CommentSortComponent.propDecorators = {
|
|
9312
|
+
sort: [{ type: core.Input }],
|
|
9313
|
+
sortChange: [{ type: core.Output }]
|
|
9314
|
+
};
|
|
9315
|
+
|
|
9190
9316
|
var COMPONENTS$3 = [
|
|
9191
9317
|
CommentComponent,
|
|
9192
9318
|
CommentViewComponent,
|
|
9193
9319
|
BantaCommentsComponent,
|
|
9194
9320
|
LiveCommentComponent,
|
|
9195
|
-
CommentFieldComponent
|
|
9321
|
+
CommentFieldComponent,
|
|
9322
|
+
CommentSortComponent
|
|
9196
9323
|
];
|
|
9197
9324
|
var CommentsModule = /** @class */ (function () {
|
|
9198
9325
|
function CommentsModule() {
|
|
@@ -9213,7 +9340,9 @@
|
|
|
9213
9340
|
menu.MatMenuModule,
|
|
9214
9341
|
progressSpinner.MatProgressSpinnerModule,
|
|
9215
9342
|
BantaCommonModule,
|
|
9216
|
-
EmojiModule
|
|
9343
|
+
EmojiModule,
|
|
9344
|
+
tooltip.MatTooltipModule,
|
|
9345
|
+
select.MatSelectModule
|
|
9217
9346
|
],
|
|
9218
9347
|
exports: COMPONENTS$3
|
|
9219
9348
|
},] }
|