@datarailsshared/datarailsshared 1.4.101 → 1.4.103

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.
@@ -3938,7 +3938,6 @@
3938
3938
  CHAT_MESSAGE_TYPE["DOWNLOAD_FILE"] = "download-file";
3939
3939
  CHAT_MESSAGE_TYPE["MAILTO"] = "mailto";
3940
3940
  CHAT_MESSAGE_TYPE["EMBED"] = "embed";
3941
- CHAT_MESSAGE_TYPE["WIDGET"] = "widget";
3942
3941
  CHAT_MESSAGE_TYPE["INPUT"] = "input";
3943
3942
  CHAT_MESSAGE_TYPE["CODE"] = "code";
3944
3943
  })(exports.CHAT_MESSAGE_TYPE || (exports.CHAT_MESSAGE_TYPE = {}));
@@ -5334,6 +5333,7 @@
5334
5333
  this.MESSAGE_TYPE = exports.CHAT_MESSAGE_TYPE;
5335
5334
  this.MESSAGE_TYPE_CUSTOM = exports.CHAT_MESSAGE_TYPE.EMBED;
5336
5335
  this._reply = false;
5336
+ this._isEmpty = false;
5337
5337
  }
5338
5338
  Object.defineProperty(DrChatMessageComponent.prototype, "flyInOut", {
5339
5339
  get: function () {
@@ -5362,6 +5362,21 @@
5362
5362
  enumerable: false,
5363
5363
  configurable: true
5364
5364
  });
5365
+ Object.defineProperty(DrChatMessageComponent.prototype, "isEmpty", {
5366
+ /**
5367
+ * The outer flag is whether the message is empty. Needed if it is impossible to calculate it inside.
5368
+ *
5369
+ * @type {boolean}
5370
+ */
5371
+ get: function () {
5372
+ return this._isEmpty;
5373
+ },
5374
+ set: function (value) {
5375
+ this._isEmpty = !!value;
5376
+ },
5377
+ enumerable: false,
5378
+ configurable: true
5379
+ });
5365
5380
  DrChatMessageComponent.prototype.getTemplate = function () {
5366
5381
  this.customMessage = true;
5367
5382
  var customMessage = this.getCustomMessage(this.type);
@@ -5392,7 +5407,7 @@
5392
5407
  ]),
5393
5408
  ],
5394
5409
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
5395
- styles: [":host{display:flex;flex-direction:row}:host:not(:first-child){margin-top:8px}.reply+:host.reply,.not-reply+:host.not-reply{margin-top:3px}:host.not-reply{justify-content:flex-end}:host.not-reply .message{color:#fff;background-color:#4646ce}:host .message{display:flex;background-color:#f3f7ff;border-radius:8px;padding:16px;max-width:60%;width:auto}:host .message--custom{max-width:unset;width:80%}\n"]
5410
+ styles: [":host{display:flex;flex-direction:row}:host.empty{display:none}:host:not(:first-child){margin-top:8px}.reply+:host.reply,.not-reply+:host.not-reply{margin-top:3px}:host.not-reply{justify-content:flex-end}:host.not-reply .message{color:#fff;background-color:#4646ce}:host .message{display:flex;background-color:#f3f7ff;border-radius:8px;padding:16px;max-width:60%;width:auto}\n"]
5396
5411
  },] }
5397
5412
  ];
5398
5413
  DrChatMessageComponent.ctorParameters = function () { return [
@@ -5404,15 +5419,32 @@
5404
5419
  reply: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.reply',] }],
5405
5420
  type: [{ type: i0.Input }],
5406
5421
  message: [{ type: i0.Input }],
5407
- customMessageData: [{ type: i0.Input }]
5422
+ customMessageData: [{ type: i0.Input }],
5423
+ isEmpty: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.empty',] }]
5408
5424
  };
5409
5425
 
5410
5426
  var DrChatComponent = /** @class */ (function () {
5411
5427
  function DrChatComponent(cdr) {
5412
5428
  this.cdr = cdr;
5429
+ this.destroy$ = new rxjs.Subject();
5430
+ this.showClearButton = true;
5413
5431
  this.noMessagesPlaceholder = 'No messages yet.';
5414
5432
  this._scrollBottom = true;
5433
+ this.clear = new i0.EventEmitter();
5415
5434
  }
5435
+ Object.defineProperty(DrChatComponent.prototype, "contentUpdateSubject", {
5436
+ set: function (value) {
5437
+ var _this = this;
5438
+ if (value) {
5439
+ value.pipe(operators.takeUntil(this.destroy$)).subscribe(function () {
5440
+ _this.updateView();
5441
+ });
5442
+ }
5443
+ },
5444
+ enumerable: false,
5445
+ configurable: true
5446
+ });
5447
+ ;
5416
5448
  Object.defineProperty(DrChatComponent.prototype, "scrollBottom", {
5417
5449
  /**
5418
5450
  * Scroll chat to the bottom of the list when a new message arrives
@@ -5446,14 +5478,18 @@
5446
5478
  _this.cdr.markForCheck();
5447
5479
  });
5448
5480
  };
5481
+ DrChatComponent.prototype.ngOnDestroy = function () {
5482
+ this.destroy$.next();
5483
+ this.destroy$.complete();
5484
+ };
5449
5485
  return DrChatComponent;
5450
5486
  }());
5451
5487
  DrChatComponent.decorators = [
5452
5488
  { type: i0.Component, args: [{
5453
5489
  selector: 'dr-chat',
5454
- template: "<div class=\"header\">\n {{ title }}\n</div>\n\n<div class=\"scrollable\">\n <div class=\"messages\" #messagesContainer>\n <ng-content select=\"dr-chat-message\"></ng-content>\n <p class=\"no-messages\" *ngIf=\"!messages?.length\">{{ noMessagesPlaceholder }}</p>\n </div>\n</div>\n\n<div class=\"form\">\n <ng-content select=\"dr-chat-form\"></ng-content>\n</div>\n",
5490
+ template: "<div class=\"header\">\n {{ title }}\n <dr-button *ngIf=\"showClearButton\"\n (click)=\"clear.emit($event)\"\n theme=\"icon\"\n icon=\"dr-icon-trash\"\n class=\"ml-auto\"\n title=\"Clear the history\">\n </dr-button>\n</div>\n\n<div class=\"scrollable\">\n <div class=\"messages\" #messagesContainer>\n <ng-content select=\"dr-chat-message\"></ng-content>\n <p class=\"no-messages\" *ngIf=\"!messages?.length\">{{ noMessagesPlaceholder }}</p>\n </div>\n</div>\n\n<div class=\"form\">\n <ng-content select=\"dr-chat-form\"></ng-content>\n</div>\n",
5455
5491
  providers: [DrChatCustomMessageService],
5456
- styles: [":host{display:flex;flex-grow:1;flex-direction:column;position:relative;height:100%;background-color:#fff;border:1px solid #e5e6ea;border-radius:8px;box-shadow:0 4px 8px 1px #00000040;color:#151b3f;font-family:\"Poppins\",sans-serif;font-size:14px;font-weight:400;line-height:22px}:host .header{border-bottom:1px solid #e5e6ea;padding:16px 32px;font-weight:bold}:host .scrollable{display:flex;flex-grow:1;overflow-x:hidden;overflow-y:auto;height:100%;width:100%}:host .scrollable .messages{padding:16px;overflow-y:auto;overflow-x:hidden;display:flex;flex-shrink:0;flex-direction:column;width:100%}:host .scrollable .no-messages{text-align:center}\n"]
5492
+ styles: [":host{display:flex;flex-grow:1;flex-direction:column;position:relative;height:100%;background-color:#fff;border:1px solid #e5e6ea;border-radius:8px;box-shadow:0 4px 8px 1px #00000040;color:#151b3f;font-family:\"Poppins\",sans-serif;font-size:14px;font-weight:400;line-height:22px}:host .header{display:flex;align-items:center;border-bottom:1px solid #e5e6ea;padding:16px 32px;font-weight:bold}:host .scrollable{display:flex;flex-grow:1;overflow-x:hidden;overflow-y:auto;height:100%;width:100%}:host .scrollable .messages{padding:16px;overflow-y:auto;overflow-x:hidden;display:flex;flex-shrink:0;flex-direction:column;width:100%}:host .scrollable .no-messages{text-align:center}\n"]
5457
5493
  },] }
5458
5494
  ];
5459
5495
  DrChatComponent.ctorParameters = function () { return [
@@ -5461,11 +5497,14 @@
5461
5497
  ]; };
5462
5498
  DrChatComponent.propDecorators = {
5463
5499
  title: [{ type: i0.Input }],
5500
+ showClearButton: [{ type: i0.Input }],
5464
5501
  noMessagesPlaceholder: [{ type: i0.Input }],
5502
+ contentUpdateSubject: [{ type: i0.Input }],
5465
5503
  scrollBottom: [{ type: i0.Input }],
5466
5504
  messagesContainer: [{ type: i0.ViewChild, args: ['messagesContainer',] }],
5467
5505
  messages: [{ type: i0.ContentChildren, args: [DrChatMessageComponent,] }],
5468
- chatForm: [{ type: i0.ContentChild, args: [DrChatFormComponent,] }]
5506
+ chatForm: [{ type: i0.ContentChild, args: [DrChatFormComponent,] }],
5507
+ clear: [{ type: i0.Output }]
5469
5508
  };
5470
5509
 
5471
5510
  /**