@sneat/ui 0.27.15 → 0.27.17

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.
@@ -1,11 +1,10 @@
1
- import { inject } from '@angular/core';
1
+ import { inject, Injector } from '@angular/core';
2
2
  import { ModalController } from '@ionic/angular';
3
- import { ErrorLogger } from '@sneat/core';
4
3
  export class SelectorBaseService {
5
4
  constructor(component) {
6
5
  this.component = component;
7
- this.errorLogger = inject(ErrorLogger);
8
6
  this.modalController = inject(ModalController);
7
+ this.injector = inject(Injector);
9
8
  }
10
9
  async selectSingleInModal(options) {
11
10
  const result = await this.selectMultipleInModal(options);
@@ -38,6 +37,10 @@ export class SelectorBaseService {
38
37
  component: this.component,
39
38
  componentProps: componentProps,
40
39
  keyboardClose: true,
40
+ // ModalController is commonly provided at the application root, while
41
+ // selector dependencies belong to the routed feature. Preserve the
42
+ // caller's injector so the overlay inherits those feature providers.
43
+ injector: this.injector,
41
44
  };
42
45
  const modal = await this.modalController.create(modalOptions);
43
46
  await modal.present();
@@ -1 +1 @@
1
- {"version":3,"file":"selector-base.service.js","sourceRoot":"","sources":["../../../../../../libs/ui/src/lib/selector/selector-base.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,MAAM,OAAgB,mBAAmB;IAIvC,YAAuC,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;QAH3C,gBAAW,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QACpC,oBAAe,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;IAEM,CAAC;IAE3D,KAAK,CAAC,mBAAmB,CAC9B,OAA4B;QAE5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnC,CAAC;IAED,mFAAmF;IACzE,KAAK,CAAC,qBAAqB,CACnC,OAA4B;QAG5B,IAAI,MAAM,GAA6B,SAAS,CAAC;QAEjD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAEtC,OAAO,GAAG;YACR,GAAG,OAAO;YACV,UAAU,EAAE,KAAK,EAAE,KAAW,EAAiB,EAAE;gBAC/C,MAAM,GAAG,KAAK,CAAC;gBACf,IAAI,UAAU,EAAE,CAAC;oBACf,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC;gBACD,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5C,CAAC;SACF,CAAC;QACF,IAAI,cAAc,GAA4B;YAC5C,GAAG,OAAO,CAAC,cAAc;YACzB,UAAU,EAAE,UAAU;YACtB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,IAAI,EAAE,OAAO;SACd,CAAC;QACF,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,cAAc,GAAG,EAAE,GAAG,cAAc,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAC/D,CAAC;QACD,MAAM,YAAY,GAAiB;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,cAAc,EAAE,cAAc;YAC9B,aAAa,EAAE,IAAI;SACpB,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC9D,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAEtB,uCAAuC;QACvC,MAAM,KAAK,CAAC,YAAY,EAAE,CAAC;QAE3B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { inject } from '@angular/core';\nimport { ModalController, ModalOptions } from '@ionic/angular';\nimport type { ComponentProps, ComponentRef } from '@ionic/core';\nimport { ErrorLogger } from '@sneat/core';\nimport { ISelectItem } from './selector-interfaces';\nimport { ISelectorOptions } from './selector-options';\n\nexport abstract class SelectorBaseService<T = ISelectItem> {\n protected readonly errorLogger = inject(ErrorLogger);\n private readonly modalController = inject(ModalController);\n\n protected constructor(private readonly component: ComponentRef) {}\n\n public async selectSingleInModal(\n options: ISelectorOptions<T>,\n ): Promise<T | null> {\n const result = await this.selectMultipleInModal(options);\n return result ? result[0] : null;\n }\n\n // We make it protected so each service must override it for easiness of navigation\n protected async selectMultipleInModal(\n options: ISelectorOptions<T>,\n ): Promise<T[] | undefined> {\n\n let result: readonly T[] | undefined = undefined;\n\n const onSelected = options.onSelected;\n\n options = {\n ...options,\n onSelected: async (items?: T[]): Promise<void> => {\n result = items;\n if (onSelected) {\n await onSelected(items);\n }\n await this.modalController.dismiss(items);\n },\n };\n let componentProps: ComponentProps<unknown> = {\n ...options.componentProps,\n selectMode: 'multiple',\n onSelected: options.onSelected,\n mode: 'modal',\n };\n if (options.title) {\n componentProps = { ...componentProps, title: options.title };\n }\n const modalOptions: ModalOptions = {\n component: this.component,\n componentProps: componentProps,\n keyboardClose: true,\n };\n const modal = await this.modalController.create(modalOptions);\n await modal.present();\n\n // 🔹 Track when the modal is dismissed\n await modal.onDidDismiss();\n\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"selector-base.service.js","sourceRoot":"","sources":["../../../../../../libs/ui/src/lib/selector/selector-base.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAC;AAK/D,MAAM,OAAgB,mBAAmB;IAIvC,YAAuC,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;QAH7C,oBAAe,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;QAC1C,aAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAA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Y,CAAC,CAAC;QAC9D,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QAEtB,uCAAuC;QACvC,MAAM,KAAK,CAAC,YAAY,EAAE,CAAC;QAE3B,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { inject, Injector } from '@angular/core';\nimport { ModalController, ModalOptions } from '@ionic/angular';\nimport type { ComponentProps, ComponentRef } from '@ionic/core';\nimport { ISelectItem } from './selector-interfaces';\nimport { ISelectorOptions } from './selector-options';\n\nexport abstract class SelectorBaseService<T = ISelectItem> {\n private readonly modalController = inject(ModalController);\n private readonly injector = inject(Injector);\n\n protected constructor(private readonly component: ComponentRef) {}\n\n public async selectSingleInModal(\n options: ISelectorOptions<T>,\n ): Promise<T | null> {\n const result = await this.selectMultipleInModal(options);\n return result ? result[0] : null;\n }\n\n // We make it protected so each service must override it for easiness of navigation\n protected async selectMultipleInModal(\n options: ISelectorOptions<T>,\n ): Promise<T[] | undefined> {\n\n let result: readonly T[] | undefined = undefined;\n\n const onSelected = options.onSelected;\n\n options = {\n ...options,\n onSelected: async (items?: T[]): Promise<void> => {\n result = items;\n if (onSelected) {\n await onSelected(items);\n }\n await this.modalController.dismiss(items);\n },\n };\n let componentProps: ComponentProps<unknown> = {\n ...options.componentProps,\n selectMode: 'multiple',\n onSelected: options.onSelected,\n mode: 'modal',\n };\n if (options.title) {\n componentProps = { ...componentProps, title: options.title };\n }\n const modalOptions: ModalOptions = {\n component: this.component,\n componentProps: componentProps,\n keyboardClose: true,\n // ModalController is commonly provided at the application root, while\n // selector dependencies belong to the routed feature. Preserve the\n // caller's injector so the overlay inherits those feature providers.\n injector: this.injector,\n };\n const modal = await this.modalController.create(modalOptions);\n await modal.present();\n\n // 🔹 Track when the modal is dismissed\n await modal.onDidDismiss();\n\n return result;\n }\n}\n"]}
@@ -3,8 +3,8 @@ import { ISelectItem } from './selector-interfaces';
3
3
  import { ISelectorOptions } from './selector-options';
4
4
  export declare abstract class SelectorBaseService<T = ISelectItem> {
5
5
  private readonly component;
6
- protected readonly errorLogger: import("@sneat/core").IErrorLogger;
7
6
  private readonly modalController;
7
+ private readonly injector;
8
8
  protected constructor(component: ComponentRef);
9
9
  selectSingleInModal(options: ISelectorOptions<T>): Promise<T | null>;
10
10
  protected selectMultipleInModal(options: ISelectorOptions<T>): Promise<T[] | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/ui",
3
- "version": "0.27.15",
3
+ "version": "0.27.17",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },