@dataclouder/ngx-core 0.1.39 → 0.1.41

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.
@@ -34,7 +34,7 @@ import { SpeedDialModule } from 'primeng/speeddial';
34
34
  import { PaginatorModule } from 'primeng/paginator';
35
35
  import * as i4$2 from 'primeng/table';
36
36
  import { TableModule } from 'primeng/table';
37
- import { get } from 'lodash';
37
+ import { get } from 'es-toolkit/compat';
38
38
  import * as i6 from 'primeng/tag';
39
39
  import { TagModule } from 'primeng/tag';
40
40
  import * as i1$2 from 'primeng/fieldset';
@@ -50,10 +50,11 @@ import * as i2$5 from 'primeng/inputnumber';
50
50
  import { InputNumberModule } from 'primeng/inputnumber';
51
51
  import { toSignal } from '@angular/core/rxjs-interop';
52
52
  import { map } from 'rxjs/operators';
53
- import { firstValueFrom, catchError, lastValueFrom, tap, throwError, map as map$1 } from 'rxjs';
53
+ import { firstValueFrom, catchError, lastValueFrom, tap, throwError, map as map$1, fromEvent, distinctUntilChanged } from 'rxjs';
54
54
  import * as i4$4 from 'primeng/textarea';
55
55
  import { TextareaModule } from 'primeng/textarea';
56
56
  import { HttpClient, HttpEventType } from '@angular/common/http';
57
+ import { Capacitor } from '@capacitor/core';
57
58
 
58
59
  class EmptyStateComponent {
59
60
  constructor() {
@@ -769,7 +770,7 @@ class DcAuditableViewerComponent {
769
770
  </div>
770
771
  </p-fieldset>
771
772
  }
772
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FieldsetModule }, { kind: "component", type: i1$2.Fieldset, selector: "p-fieldset", inputs: ["legend", "toggleable", "collapsed", "style", "styleClass", "transitionOptions"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i6.Tag, selector: "p-tag", inputs: ["styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: ChipModule }, { kind: "component", type: i3$3.Chip, selector: "p-chip", inputs: ["label", "icon", "image", "alt", "styleClass", "removable", "removeIcon", "chipProps"], outputs: ["onRemove", "onImageError"] }, { kind: "ngmodule", type: AvatarModule }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }] }); }
773
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FieldsetModule }, { kind: "component", type: i1$2.Fieldset, selector: "p-fieldset", inputs: ["legend", "toggleable", "collapsed", "style", "styleClass", "transitionOptions"], outputs: ["collapsedChange", "onBeforeToggle", "onAfterToggle"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i6.Tag, selector: "p-tag", inputs: ["styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: ChipModule }, { kind: "component", type: i3$3.Chip, selector: "p-chip", inputs: ["label", "icon", "image", "alt", "styleClass", "disabled", "removable", "removeIcon", "chipProps"], outputs: ["onRemove", "onImageError"] }, { kind: "ngmodule", type: AvatarModule }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }] }); }
773
774
  }
774
775
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: DcAuditableViewerComponent, decorators: [{
775
776
  type: Component,
@@ -935,7 +936,7 @@ class DcTagsFormComponent {
935
936
  this.arrayForm.removeAt(index);
936
937
  }
937
938
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: DcTagsFormComponent, deps: [{ token: i1.ControlContainer }], target: i0.ɵɵFactoryTarget.Component }); }
938
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: DcTagsFormComponent, isStandalone: true, selector: "dc-tags-form", ngImport: i0, template: "<div [formGroup]=\"form\">\n <div formArrayName=\"tags\">\n <div class=\"flex flex-wrap gap-2\">\n @for (tagControl of arrayForm.controls; track tagControl; let i = $index) {\n <p-chip [label]=\"tagControl.value\" [removable]=\"true\" (onRemove)=\"removeTag(i)\"></p-chip>\n }\n </div>\n </div>\n</div>\n\n<div class=\"flex mt-2\">\n <input pInputText type=\"text\" [formControl]=\"newTagControl\" placeholder=\"New tag\" (keydown.enter)=\"addTag(); $event.preventDefault()\" />\n <p-button label=\"Add Tag\" icon=\"pi pi-plus\" (click)=\"addTag()\" [disabled]=\"!newTagControl.value\"></p-button>\n</div>\n", styles: [".tag-field{display:flex;align-items:center;margin-bottom:.5rem}.tag-field input{margin-right:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4$1.InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: ChipModule }, { kind: "component", type: i3$3.Chip, selector: "p-chip", inputs: ["label", "icon", "image", "alt", "styleClass", "removable", "removeIcon", "chipProps"], outputs: ["onRemove", "onImageError"] }], viewProviders: [
939
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.6", type: DcTagsFormComponent, isStandalone: true, selector: "dc-tags-form", ngImport: i0, template: "<div [formGroup]=\"form\">\n <div formArrayName=\"tags\">\n <div class=\"flex flex-wrap gap-2\">\n @for (tagControl of arrayForm.controls; track tagControl; let i = $index) {\n <p-chip [label]=\"tagControl.value\" [removable]=\"true\" (onRemove)=\"removeTag(i)\"></p-chip>\n }\n </div>\n </div>\n</div>\n\n<div class=\"flex mt-2\">\n <input pInputText type=\"text\" [formControl]=\"newTagControl\" placeholder=\"New tag\" (keydown.enter)=\"addTag(); $event.preventDefault()\" />\n <p-button label=\"Add Tag\" icon=\"pi pi-plus\" (click)=\"addTag()\" [disabled]=\"!newTagControl.value\"></p-button>\n</div>\n", styles: [".tag-field{display:flex;align-items:center;margin-bottom:.5rem}.tag-field input{margin-right:.5rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "buttonProps", "autofocus", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4$1.InputText, selector: "[pInputText]", inputs: ["pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: ChipModule }, { kind: "component", type: i3$3.Chip, selector: "p-chip", inputs: ["label", "icon", "image", "alt", "styleClass", "disabled", "removable", "removeIcon", "chipProps"], outputs: ["onRemove", "onImageError"] }], viewProviders: [
939
940
  {
940
941
  provide: ControlContainer,
941
942
  useFactory: () => inject(ControlContainer, { skipSelf: true }),
@@ -3194,6 +3195,10 @@ class EntityCommunicationService {
3194
3195
  findOne(id) {
3195
3196
  return this.httpService.getHttp({ service: `api/${this.serviceName}/${id}`, host: this.customHost });
3196
3197
  }
3198
+ findOneByQuery(query, projection) {
3199
+ // Can find only one with query and projection, query can be id. { id: 'id' }
3200
+ return this.httpService.postHttp({ service: `api/${this.serviceName}/find-one`, data: { query, projection }, host: this.customHost });
3201
+ }
3197
3202
  createOrUpdate(entity) {
3198
3203
  // if Id is present then in object, then Update all props in the object
3199
3204
  return this.httpService.postHttp({ service: `api/${this.serviceName}`, data: entity, host: this.customHost });
@@ -3303,6 +3308,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
3303
3308
  }]
3304
3309
  }] });
3305
3310
 
3311
+ class MobileService {
3312
+ constructor() {
3313
+ this.router = inject(Router);
3314
+ this.hasReponsiveView = signal(false, ...(ngDevMode ? [{ debugName: "hasReponsiveView" }] : []));
3315
+ this.mobileWidthThreshold = 768; // Adjust the threshold as needed
3316
+ this.responsibleWidthThreshold = 994;
3317
+ // Initialize signal with current window width check
3318
+ this.hasReponsiveView.set(window.innerWidth <= this.responsibleWidthThreshold);
3319
+ this.checkMobileAgent();
3320
+ this.screenWidth$ = fromEvent(window, 'resize').pipe(map$1(() => window.innerWidth), distinctUntilChanged());
3321
+ this.screenHeight$ = fromEvent(window, 'resize').pipe(map$1(() => window.innerHeight), distinctUntilChanged());
3322
+ this.isMobile$ = this.screenWidth$.pipe(map$1((width) => width <= this.responsibleWidthThreshold), // Add type assertion to 'width'
3323
+ distinctUntilChanged());
3324
+ this.isMobile$.subscribe((isResposible) => {
3325
+ console.log('isMobile', isResposible);
3326
+ // Update signal value when screen size changes
3327
+ this.hasReponsiveView.set(isResposible);
3328
+ });
3329
+ }
3330
+ isMobileRoute(currentRoute = '') {
3331
+ if (!currentRoute) {
3332
+ currentRoute = this.router.url;
3333
+ }
3334
+ const firstRouteName = currentRoute.split('/')[1];
3335
+ return firstRouteName == 'm' ? true : false;
3336
+ }
3337
+ // Add this function to the class
3338
+ getPlatform() {
3339
+ if (Capacitor.isNativePlatform()) {
3340
+ const platform = Capacitor.getPlatform();
3341
+ // Example usage in component:
3342
+ if (platform === 'ios') {
3343
+ // iOS specific code
3344
+ return 'ios';
3345
+ }
3346
+ else if (platform === 'android') {
3347
+ // Android specific code
3348
+ return 'android';
3349
+ }
3350
+ else {
3351
+ return 'web';
3352
+ }
3353
+ }
3354
+ return 'web';
3355
+ }
3356
+ isNativeMobileOrMobileRoute() {
3357
+ if (Capacitor.isNativePlatform() || this.isMobileRoute()) {
3358
+ return true;
3359
+ }
3360
+ else {
3361
+ return false;
3362
+ }
3363
+ }
3364
+ isNativeMobile() {
3365
+ return Capacitor.isNativePlatform();
3366
+ }
3367
+ getScreenWidth() {
3368
+ return this.screenWidth$;
3369
+ }
3370
+ // isMobile(): Observable<boolean> {
3371
+ // return this.isMobile$;
3372
+ // }
3373
+ installByUser() {
3374
+ console.log('Debería hacer la instalación por el usuario');
3375
+ if (this.eventInstall) {
3376
+ this.eventInstall.prompt();
3377
+ console.log('Debio mandar el promt');
3378
+ }
3379
+ }
3380
+ checkMobileAgent() {
3381
+ if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
3382
+ // true for mobile device
3383
+ this.isMobileAgent = true;
3384
+ }
3385
+ else {
3386
+ // false for not mobile device
3387
+ this.isMobileAgent = false;
3388
+ }
3389
+ }
3390
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: MobileService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3391
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: MobileService, providedIn: 'root' }); }
3392
+ }
3393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: MobileService, decorators: [{
3394
+ type: Injectable,
3395
+ args: [{
3396
+ providedIn: 'root',
3397
+ }]
3398
+ }], ctorParameters: () => [] });
3399
+
3306
3400
  var MoodState;
3307
3401
  (function (MoodState) {
3308
3402
  MoodState["HAPPY"] = "happy";
@@ -3388,5 +3482,5 @@ const CharacterEventActions = [
3388
3482
  * Generated bundle index. Do not edit.
3389
3483
  */
3390
3484
 
3391
- export { APP_CONFIG, AppConfigService, AudioNotificationService, AudioSpeed, AudioSpeedReverse, CharacterEventActions, ChatUserSettings, ConfirmComponent, ConfirmService, DCFilterBarComponent, DCProgressToastComponent, DcAuditableViewerComponent, DcExtensionsViewerComponent, DcLearnableFormComponent, DcLearnableViewerComponent, DcManageableFormComponent, DcManageableViewerComponent, DcReactionsViewerComponent, EModelQuality, EmptyStateComponent, EntityBaseFormComponent, EntityBaseListComponent, EntityCommunicationService, FlagPipe, FormUtilsService, GetPathPipe, HTTP_CORE_CONFIG, HttpCoreService, IAIModel, LANGUAGES, LangDescTranslation, LoadingBarComponent, LoadingBarService, ModelQualityOptions, MoodState, MoodStateOptions, OptionValue, PaginationBase, PromptService, QuickTableComponent, SUPPORTED_LANGUAGES, TOAST_ALERTS_TOKEN, ToastAlertsAbstractService, UiStateService, availibleFilters, extractJsonFromString, formatCamelCaseString, getLangDesc, getSupportedLanguageOptions, provideToastAlert, sortOptions, sortTypes };
3485
+ export { APP_CONFIG, AppConfigService, AudioNotificationService, AudioSpeed, AudioSpeedReverse, CharacterEventActions, ChatUserSettings, ConfirmComponent, ConfirmService, DCFilterBarComponent, DCProgressToastComponent, DcAuditableViewerComponent, DcExtensionsViewerComponent, DcLearnableFormComponent, DcLearnableViewerComponent, DcManageableFormComponent, DcManageableViewerComponent, DcReactionsViewerComponent, EModelQuality, EmptyStateComponent, EntityBaseFormComponent, EntityBaseListComponent, EntityCommunicationService, FlagPipe, FormUtilsService, GetPathPipe, HTTP_CORE_CONFIG, HttpCoreService, IAIModel, LANGUAGES, LangDescTranslation, LoadingBarComponent, LoadingBarService, MobileService, ModelQualityOptions, MoodState, MoodStateOptions, OptionValue, PaginationBase, PromptService, QuickTableComponent, SUPPORTED_LANGUAGES, TOAST_ALERTS_TOKEN, ToastAlertsAbstractService, UiStateService, availibleFilters, extractJsonFromString, formatCamelCaseString, getLangDesc, getSupportedLanguageOptions, provideToastAlert, sortOptions, sortTypes };
3392
3486
  //# sourceMappingURL=dataclouder-ngx-core.mjs.map