@sumaris-net/ngx-components 2.6.11 → 2.6.12

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.
@@ -30712,10 +30712,10 @@ class EntityMetadataComponent {
30712
30712
  }
30713
30713
  }
30714
30714
  EntityMetadataComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: EntityMetadataComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
30715
- EntityMetadataComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: EntityMetadataComponent, selector: "app-entity-metadata", inputs: { value: "value", showRecorder: "showRecorder" }, ngImport: i0, template: "<ng-container *ngIf=\"value && value.id\">\n <ion-card @fadeInAnimation>\n\n <!-- recorder -->\n <ion-item color=\"light\"\n *ngIf=\"showRecorder && value && \u00A0(value.recorderDepartment || value.recorderPerson)\">\n\n <!-- recorder avatar -->\n <ion-avatar slot=\"start\" *ngIf=\"value.recorderPerson; let recorderPerson\">\n <img *ngIf=\"recorderPerson.avatar; else generateAvatar\"\n src=\"{{ recorderPerson.avatar }}\">\n <ng-template #generateAvatar>\n <svg *ngIf=\"recorderPerson.id; let personId\"\n width=\"38\" height=\"38\" [data-jdenticon-value]=\"personId\"></svg>\n </ng-template>\n </ion-avatar>\n\n <!-- recorder name -->\n <ion-label>\n <ion-card-subtitle translate>COMMON.RECORDER</ion-card-subtitle>\n <ion-card-title>{{value.recorderPerson?.firstName}} {{value.recorderPerson?.lastName}}</ion-card-title>\n <ion-card-subtitle>{{value.recorderDepartment?.label}}</ion-card-subtitle>\n </ion-label>\n </ion-item>\n\n <ion-card-content>\n <ion-label class=\"ion-text-wrap status\">\n <!-- creation date -->\n <ion-text *ngIf=\"value.creationDate\">\n <ion-icon name=\"calendar\"></ion-icon>&nbsp;\n <span translate>COMMON.CREATED_ON</span>\n <span>\n <b>{{ value.creationDate | dateFormat: {time: true} }}</b>\n </span>\n </ion-text>\n\n <!-- update date -->\n <ion-text *ngIf=\"value.updateDate && value.updateDate != value.creationDate\">\n <br *ngIf=\"value.creationDate\"/>\n <ion-label>\n <ion-icon name=\"time-outline\"></ion-icon>&nbsp;\n <span translate>COMMON.UPDATED_ON</span>\n <span>&nbsp;{{ value.updateDate | dateFormat: {time: true, seconds: true} }}</span>\n </ion-label>\n </ion-text>\n\n </ion-label>\n\n <ng-content></ng-content>\n\n </ion-card-content>\n </ion-card>\n</ng-container>\n", styles: ["ion-card ion-avatar{height:40px;width:40px}ion-card ion-avatar img,ion-card ion-avatar svg{border:solid 1px rgba(0,0,0,.2)}ion-card ion-avatar img{background-color:var(--ion-color-secondary)!important}ion-card ion-avatar svg{border-radius:20px;height:38px;width:38px}ion-card ion-card-content{background-color:var(--ion-color-light-tint)}ion-card ion-card-content ion-label.status,ion-card ion-card-content * ion-label.status{font-size:12px!important;color:var(--ion-color-step-850)}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.IonAvatar, selector: "ion-avatar" }, { kind: "component", type: i2$1.IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: i2$1.IonCardContent, selector: "ion-card-content", inputs: ["mode"] }, { kind: "component", type: i2$1.IonCardSubtitle, selector: "ion-card-subtitle", inputs: ["color", "mode"] }, { kind: "component", type: i2$1.IonCardTitle, selector: "ion-card-title", inputs: ["color", "mode"] }, { kind: "component", type: i2$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2$1.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "directive", type: i1$1.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { kind: "directive", type: i4$3.SvgJdenticonDirective, selector: "svg[data-jdenticon-hash],svg[data-jdenticon-value]", inputs: ["data-jdenticon-hash", "data-jdenticon-value", "width", "height"] }, { kind: "pipe", type: DateFormatPipe, name: "dateFormat" }], animations: [fadeInAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush });
30715
+ EntityMetadataComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: EntityMetadataComponent, selector: "app-entity-metadata", inputs: { value: "value", showRecorder: "showRecorder" }, ngImport: i0, template: "<ng-container *ngIf=\"value && value.id\">\n <ion-card @fadeInAnimation>\n\n <!-- recorder -->\n <ion-item color=\"light\"\n *ngIf=\"showRecorder && value && (value.recorderDepartment || value.recorderPerson)\">\n\n <!-- recorder avatar -->\n <ion-avatar slot=\"start\" *ngIf=\"value.recorderPerson; let recorderPerson\">\n <img *ngIf=\"recorderPerson.avatar; else generateAvatar\"\n src=\"{{ recorderPerson.avatar }}\">\n <ng-template #generateAvatar>\n <svg *ngIf=\"recorderPerson.id; let personId\"\n width=\"38\" height=\"38\" [data-jdenticon-value]=\"personId\"></svg>\n </ng-template>\n </ion-avatar>\n\n <!-- recorder name -->\n <ion-label>\n <ion-card-subtitle translate>COMMON.RECORDER</ion-card-subtitle>\n <ion-card-title>{{value.recorderPerson?.firstName}} {{value.recorderPerson?.lastName}}</ion-card-title>\n <ion-card-subtitle>{{value.recorderDepartment?.label}}</ion-card-subtitle>\n </ion-label>\n\n <ng-content select=\"[recorderSuffix]\"></ng-content>\n </ion-item>\n\n <ion-card-content>\n <ion-label class=\"ion-text-wrap status\">\n <!-- creation date -->\n <ion-text *ngIf=\"value.creationDate\">\n <ion-icon name=\"calendar\"></ion-icon>&nbsp;\n <span translate>COMMON.CREATED_ON</span>\n <span>&nbsp;<b>{{ value.creationDate | dateFormat: {time: true} }}</b></span>\n </ion-text>\n\n <!-- update date -->\n <ion-text *ngIf=\"value.updateDate && value.updateDate != value.creationDate\">\n <br *ngIf=\"value.creationDate\"/>\n <ion-label>\n <ion-icon name=\"time-outline\"></ion-icon>&nbsp;\n <span translate>COMMON.UPDATED_ON</span>\n <span>&nbsp;{{ value.updateDate | dateFormat: {time: true, seconds: true} }}</span>\n </ion-label>\n </ion-text>\n\n </ion-label>\n\n <ng-content></ng-content>\n\n </ion-card-content>\n </ion-card>\n</ng-container>\n", styles: ["ion-card ion-avatar{height:40px;width:40px}ion-card ion-avatar img,ion-card ion-avatar svg{border:solid 1px rgba(0,0,0,.2)}ion-card ion-avatar img{background-color:var(--ion-color-secondary)!important}ion-card ion-avatar svg{border-radius:20px;height:38px;width:38px}ion-card ion-card-content{background-color:var(--ion-color-light-tint)}ion-card ion-card-content ion-label.status,ion-card ion-card-content * ion-label.status{font-size:12px!important;color:var(--ion-color-step-850)}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$1.IonAvatar, selector: "ion-avatar" }, { kind: "component", type: i2$1.IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: i2$1.IonCardContent, selector: "ion-card-content", inputs: ["mode"] }, { kind: "component", type: i2$1.IonCardSubtitle, selector: "ion-card-subtitle", inputs: ["color", "mode"] }, { kind: "component", type: i2$1.IonCardTitle, selector: "ion-card-title", inputs: ["color", "mode"] }, { kind: "component", type: i2$1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i2$1.IonItem, selector: "ion-item", inputs: ["button", "color", "counter", "counterFormatter", "detail", "detailIcon", "disabled", "download", "fill", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "shape", "target", "type"] }, { kind: "component", type: i2$1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i2$1.IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "directive", type: i1$1.TranslateDirective, selector: "[translate],[ngx-translate]", inputs: ["translate", "translateParams"] }, { kind: "directive", type: i4$3.SvgJdenticonDirective, selector: "svg[data-jdenticon-hash],svg[data-jdenticon-value]", inputs: ["data-jdenticon-hash", "data-jdenticon-value", "width", "height"] }, { kind: "pipe", type: DateFormatPipe, name: "dateFormat" }], animations: [fadeInAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush });
30716
30716
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: EntityMetadataComponent, decorators: [{
30717
30717
  type: Component,
30718
- args: [{ selector: 'app-entity-metadata', animations: [fadeInAnimation], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"value && value.id\">\n <ion-card @fadeInAnimation>\n\n <!-- recorder -->\n <ion-item color=\"light\"\n *ngIf=\"showRecorder && value && \u00A0(value.recorderDepartment || value.recorderPerson)\">\n\n <!-- recorder avatar -->\n <ion-avatar slot=\"start\" *ngIf=\"value.recorderPerson; let recorderPerson\">\n <img *ngIf=\"recorderPerson.avatar; else generateAvatar\"\n src=\"{{ recorderPerson.avatar }}\">\n <ng-template #generateAvatar>\n <svg *ngIf=\"recorderPerson.id; let personId\"\n width=\"38\" height=\"38\" [data-jdenticon-value]=\"personId\"></svg>\n </ng-template>\n </ion-avatar>\n\n <!-- recorder name -->\n <ion-label>\n <ion-card-subtitle translate>COMMON.RECORDER</ion-card-subtitle>\n <ion-card-title>{{value.recorderPerson?.firstName}} {{value.recorderPerson?.lastName}}</ion-card-title>\n <ion-card-subtitle>{{value.recorderDepartment?.label}}</ion-card-subtitle>\n </ion-label>\n </ion-item>\n\n <ion-card-content>\n <ion-label class=\"ion-text-wrap status\">\n <!-- creation date -->\n <ion-text *ngIf=\"value.creationDate\">\n <ion-icon name=\"calendar\"></ion-icon>&nbsp;\n <span translate>COMMON.CREATED_ON</span>\n <span>\n <b>{{ value.creationDate | dateFormat: {time: true} }}</b>\n </span>\n </ion-text>\n\n <!-- update date -->\n <ion-text *ngIf=\"value.updateDate && value.updateDate != value.creationDate\">\n <br *ngIf=\"value.creationDate\"/>\n <ion-label>\n <ion-icon name=\"time-outline\"></ion-icon>&nbsp;\n <span translate>COMMON.UPDATED_ON</span>\n <span>&nbsp;{{ value.updateDate | dateFormat: {time: true, seconds: true} }}</span>\n </ion-label>\n </ion-text>\n\n </ion-label>\n\n <ng-content></ng-content>\n\n </ion-card-content>\n </ion-card>\n</ng-container>\n", styles: ["ion-card ion-avatar{height:40px;width:40px}ion-card ion-avatar img,ion-card ion-avatar svg{border:solid 1px rgba(0,0,0,.2)}ion-card ion-avatar img{background-color:var(--ion-color-secondary)!important}ion-card ion-avatar svg{border-radius:20px;height:38px;width:38px}ion-card ion-card-content{background-color:var(--ion-color-light-tint)}ion-card ion-card-content ion-label.status,ion-card ion-card-content * ion-label.status{font-size:12px!important;color:var(--ion-color-step-850)}\n"] }]
30718
+ args: [{ selector: 'app-entity-metadata', animations: [fadeInAnimation], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"value && value.id\">\n <ion-card @fadeInAnimation>\n\n <!-- recorder -->\n <ion-item color=\"light\"\n *ngIf=\"showRecorder && value && (value.recorderDepartment || value.recorderPerson)\">\n\n <!-- recorder avatar -->\n <ion-avatar slot=\"start\" *ngIf=\"value.recorderPerson; let recorderPerson\">\n <img *ngIf=\"recorderPerson.avatar; else generateAvatar\"\n src=\"{{ recorderPerson.avatar }}\">\n <ng-template #generateAvatar>\n <svg *ngIf=\"recorderPerson.id; let personId\"\n width=\"38\" height=\"38\" [data-jdenticon-value]=\"personId\"></svg>\n </ng-template>\n </ion-avatar>\n\n <!-- recorder name -->\n <ion-label>\n <ion-card-subtitle translate>COMMON.RECORDER</ion-card-subtitle>\n <ion-card-title>{{value.recorderPerson?.firstName}} {{value.recorderPerson?.lastName}}</ion-card-title>\n <ion-card-subtitle>{{value.recorderDepartment?.label}}</ion-card-subtitle>\n </ion-label>\n\n <ng-content select=\"[recorderSuffix]\"></ng-content>\n </ion-item>\n\n <ion-card-content>\n <ion-label class=\"ion-text-wrap status\">\n <!-- creation date -->\n <ion-text *ngIf=\"value.creationDate\">\n <ion-icon name=\"calendar\"></ion-icon>&nbsp;\n <span translate>COMMON.CREATED_ON</span>\n <span>&nbsp;<b>{{ value.creationDate | dateFormat: {time: true} }}</b></span>\n </ion-text>\n\n <!-- update date -->\n <ion-text *ngIf=\"value.updateDate && value.updateDate != value.creationDate\">\n <br *ngIf=\"value.creationDate\"/>\n <ion-label>\n <ion-icon name=\"time-outline\"></ion-icon>&nbsp;\n <span translate>COMMON.UPDATED_ON</span>\n <span>&nbsp;{{ value.updateDate | dateFormat: {time: true, seconds: true} }}</span>\n </ion-label>\n </ion-text>\n\n </ion-label>\n\n <ng-content></ng-content>\n\n </ion-card-content>\n </ion-card>\n</ng-container>\n", styles: ["ion-card ion-avatar{height:40px;width:40px}ion-card ion-avatar img,ion-card ion-avatar svg{border:solid 1px rgba(0,0,0,.2)}ion-card ion-avatar img{background-color:var(--ion-color-secondary)!important}ion-card ion-avatar svg{border-radius:20px;height:38px;width:38px}ion-card ion-card-content{background-color:var(--ion-color-light-tint)}ion-card ion-card-content ion-label.status,ion-card ion-card-content * ion-label.status{font-size:12px!important;color:var(--ion-color-step-850)}\n"] }]
30719
30719
  }], propDecorators: { value: [{
30720
30720
  type: Input
30721
30721
  }], showRecorder: [{
@@ -37223,15 +37223,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
37223
37223
  }] });
37224
37224
 
37225
37225
  const Mutations = {
37226
- send: gql `mutation SendMessage($data: MessageVOInput){
37227
- done: sendMessage(message: $data)
37228
- }`
37226
+ send: gql `
37227
+ mutation SendMessage($data: MessageVOInput) {
37228
+ done: sendMessage(message: $data)
37229
+ }
37230
+ `,
37229
37231
  };
37230
37232
  class MessageService extends BaseGraphqlService {
37231
- constructor(graphql, translate, toastController, environment) {
37233
+ constructor(graphql, translate, modalCtrl, toastController, environment) {
37232
37234
  super(graphql, environment);
37233
37235
  this.graphql = graphql;
37234
37236
  this.translate = translate;
37237
+ this.modalCtrl = modalCtrl;
37235
37238
  this.toastController = toastController;
37236
37239
  this.environment = environment;
37237
37240
  // For DEV only
@@ -37249,7 +37252,7 @@ class MessageService extends BaseGraphqlService {
37249
37252
  const data = entity.asObject(MINIFY_ENTITY_FOR_POD);
37250
37253
  const now = Date.now();
37251
37254
  if (this._debug)
37252
- console.debug(`[message-service] Send message...`, data);
37255
+ console.debug(`[message-service] Sending message...`);
37253
37256
  try {
37254
37257
  const { done } = yield this.graphql.mutate({
37255
37258
  mutation: Mutations.send,
@@ -37275,6 +37278,24 @@ class MessageService extends BaseGraphqlService {
37275
37278
  }
37276
37279
  });
37277
37280
  }
37281
+ openComposeModal(options) {
37282
+ return __awaiter(this, void 0, void 0, function* () {
37283
+ const hasTopModal = !!(yield this.modalCtrl.getTop());
37284
+ const modal = yield this.modalCtrl.create({
37285
+ component: MessageModal,
37286
+ componentProps: options,
37287
+ cssClass: hasTopModal && 'stack-modal',
37288
+ });
37289
+ // Open the modal
37290
+ yield modal.present();
37291
+ // On dismiss
37292
+ const { data } = yield modal.onDidDismiss();
37293
+ if (!data || !(data instanceof Message))
37294
+ return; // CANCELLED
37295
+ // Send message
37296
+ yield this.send(data, { showToast: options === null || options === void 0 ? void 0 : options.showToast });
37297
+ });
37298
+ }
37278
37299
  /* -- protected methods -- */
37279
37300
  showToast(opts) {
37280
37301
  return __awaiter(this, void 0, void 0, function* () {
@@ -37282,13 +37303,13 @@ class MessageService extends BaseGraphqlService {
37282
37303
  });
37283
37304
  }
37284
37305
  }
37285
- MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageService, deps: [{ token: GraphqlService }, { token: i1$1.TranslateService }, { token: i2$1.ToastController }, { token: ENVIRONMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
37306
+ MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageService, deps: [{ token: GraphqlService }, { token: i1$1.TranslateService }, { token: i2$1.ModalController }, { token: i2$1.ToastController }, { token: ENVIRONMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
37286
37307
  MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageService, providedIn: 'root' });
37287
37308
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MessageService, decorators: [{
37288
37309
  type: Injectable,
37289
37310
  args: [{ providedIn: 'root' }]
37290
37311
  }], ctorParameters: function () {
37291
- return [{ type: GraphqlService }, { type: i1$1.TranslateService }, { type: i2$1.ToastController }, { type: Environment, decorators: [{
37312
+ return [{ type: GraphqlService }, { type: i1$1.TranslateService }, { type: i2$1.ModalController }, { type: i2$1.ToastController }, { type: Environment, decorators: [{
37292
37313
  type: Optional
37293
37314
  }, {
37294
37315
  type: Inject,
@@ -37675,7 +37696,7 @@ class UsersPage extends AppTable {
37675
37696
  }
37676
37697
  openComposeMessageModal(event) {
37677
37698
  return __awaiter(this, void 0, void 0, function* () {
37678
- // Get recipients
37699
+ // Compute recipients
37679
37700
  const recipients = (this.selection.selected || [])
37680
37701
  .map((row) => row.currentData)
37681
37702
  .map(Person.fromObject)
@@ -37685,25 +37706,12 @@ class UsersPage extends AppTable {
37685
37706
  target.department = (_a = p.department) === null || _a === void 0 ? void 0 : _a.asObject();
37686
37707
  return target;
37687
37708
  });
37688
- const hasTopModal = !!(yield this.modalCtrl.getTop());
37689
- const modal = yield this.modalCtrl.create({
37690
- component: MessageModal,
37691
- componentProps: {
37692
- suggestFn: (value, filter, sortBy, sortDirection) => this.dataService.suggest(value, filter, sortBy, sortDirection),
37693
- data: {
37694
- recipients,
37695
- },
37709
+ return this.messageService.openComposeModal({
37710
+ suggestFn: (value, filter, sortBy, sortDirection) => this.dataService.suggest(value, filter, sortBy, sortDirection),
37711
+ data: {
37712
+ recipients,
37696
37713
  },
37697
- cssClass: hasTopModal && 'stack-modal',
37698
37714
  });
37699
- // Open the modal
37700
- yield modal.present();
37701
- // On dismiss
37702
- const { data } = yield modal.onDidDismiss();
37703
- if (!data || !(data instanceof Message))
37704
- return; // CANCELLED
37705
- console.info('[users] received message to send: ', data);
37706
- yield this.messageService.send(data);
37707
37715
  });
37708
37716
  }
37709
37717
  /* -- protected methods -- */