@solidev/data 0.0.1-beta.0 → 0.0.1-beta.2

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.
Files changed (28) hide show
  1. package/esm2020/lib/data/fields/computed.mjs +1 -1
  2. package/esm2020/lib/dispedit/choice.pipe.mjs +3 -2
  3. package/esm2020/lib/dispedit/factor.pipe.mjs +3 -2
  4. package/esm2020/lib/dispedit/factorc.pipe.mjs +5 -3
  5. package/esm2020/lib/modellist/model-list-filters/filters/model-list-select-filter/model-list-select-filter.component.mjs +2 -3
  6. package/esm2020/lib/modellist/model-list-filters/filters/model-list-select-filter/model-list-select-filter.mjs +6 -1
  7. package/esm2020/lib/modellist/model-list-filters/filters/model-list-select-multi-filter/model-list-select-multi-filter.mjs +7 -1
  8. package/esm2020/lib/modellist/model-list-filters/filters/model-list-text-filter/model-list-text-filter.component.mjs +4 -4
  9. package/esm2020/lib/modellist/model-list-filters/filters/model-list-text-filter/model-list-text-filter.mjs +10 -7
  10. package/esm2020/lib/modellist/model-list-filters/model-list-filter.mjs +2 -1
  11. package/esm2020/lib/updates/update/update.component.mjs +17 -0
  12. package/esm2020/lib/updates/update.service.mjs +58 -0
  13. package/esm2020/public-api.mjs +3 -1
  14. package/fesm2015/solidev-data.mjs +100 -16
  15. package/fesm2015/solidev-data.mjs.map +1 -1
  16. package/fesm2020/solidev-data.mjs +100 -16
  17. package/fesm2020/solidev-data.mjs.map +1 -1
  18. package/lib/data/fields/computed.d.ts +3 -0
  19. package/lib/modellist/model-list-filters/filters/model-list-select-filter/model-list-select-filter.component.d.ts +1 -1
  20. package/lib/modellist/model-list-filters/filters/model-list-select-filter/model-list-select-filter.d.ts +1 -0
  21. package/lib/modellist/model-list-filters/filters/model-list-select-multi-filter/model-list-select-multi-filter.d.ts +6 -1
  22. package/lib/modellist/model-list-filters/filters/model-list-text-filter/model-list-text-filter.component.d.ts +2 -2
  23. package/lib/modellist/model-list-filters/filters/model-list-text-filter/model-list-text-filter.d.ts +1 -1
  24. package/lib/modellist/model-list-filters/model-list-filter.d.ts +2 -0
  25. package/lib/updates/update/update.component.d.ts +8 -0
  26. package/lib/updates/update.service.d.ts +16 -0
  27. package/package.json +1 -1
  28. package/public-api.d.ts +2 -0
@@ -2,9 +2,9 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, Component, Input, ViewChild, Pipe, LOCALE_ID, DEFAULT_CURRENCY_CODE, EventEmitter, Output, Directive, HostListener, NgModule } from '@angular/core';
3
3
  import 'reflect-metadata';
4
4
  import * as i2$2 from '@angular/forms';
5
- import { FormControl, Validators, FormGroup, UntypedFormControl, ReactiveFormsModule, NG_VALUE_ACCESSOR, UntypedFormGroup } from '@angular/forms';
6
- import { throwError, ReplaySubject, share, combineLatest, of, takeUntil, NEVER, Subject, debounceTime, distinctUntilChanged, isObservable, firstValueFrom, timer, Observable, BehaviorSubject } from 'rxjs';
7
- import { tap, switchMap, map, throttleTime, filter, mergeMap, finalize, catchError, take } from 'rxjs/operators';
5
+ import { FormControl, Validators, FormGroup, ReactiveFormsModule, UntypedFormControl, NG_VALUE_ACCESSOR, UntypedFormGroup } from '@angular/forms';
6
+ import { throwError, ReplaySubject, share, combineLatest, of, takeUntil, NEVER, Subject, debounceTime, distinctUntilChanged, isObservable, firstValueFrom, timer, Observable, BehaviorSubject, merge } from 'rxjs';
7
+ import { tap, switchMap, map, throttleTime, filter, mergeMap, finalize, catchError, take, first } from 'rxjs/operators';
8
8
  import * as i2 from '@angular/platform-browser';
9
9
  import { makeStateKey } from '@angular/platform-browser';
10
10
  import * as i1$1 from '@angular/common';
@@ -25,6 +25,7 @@ import { __decorate, __param } from 'tslib';
25
25
  import jwt_decode from 'jwt-decode';
26
26
  import * as i1$2 from '@angular/router';
27
27
  import { NavigationEnd, RouterModule } from '@angular/router';
28
+ import * as i1$3 from '@angular/service-worker';
28
29
 
29
30
  /**
30
31
  * DATA_API_URL: stores data api base url
@@ -1583,14 +1584,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
1583
1584
  class ModelListTextFilterComponent {
1584
1585
  constructor() {
1585
1586
  this.classes = '';
1586
- this.fc = new UntypedFormControl();
1587
+ this.fc = new FormControl(null);
1587
1588
  }
1588
1589
  ngOnInit() {
1589
1590
  this.filter.valueChanges.subscribe((val) => {
1590
1591
  this.fc.setValue(val.value, { emitEvent: false });
1591
1592
  });
1592
1593
  this.fc.valueChanges.pipe(debounceTime(250)).subscribe((val) => {
1593
- if (this.filter.set(val, val)) {
1594
+ if (this.filter.set(val, val || '')) {
1594
1595
  this.list.filters.update();
1595
1596
  }
1596
1597
  });
@@ -1855,7 +1856,6 @@ class ModelListSelectFilterComponent {
1855
1856
  }
1856
1857
  ngOnInit() {
1857
1858
  this.filter.valueChanges.subscribe((val) => {
1858
- console.log('Changing value', val);
1859
1859
  this.fc.setValue(val ? val.value : null, {
1860
1860
  emitEvent: false,
1861
1861
  });
@@ -2083,6 +2083,7 @@ class ModelListFilter {
2083
2083
  this.allowed = false;
2084
2084
  this.enabled = false;
2085
2085
  this.type = 'text';
2086
+ this.default = params.default;
2086
2087
  // FIXME: add value init
2087
2088
  }
2088
2089
  get mcurrent$() {
@@ -2386,7 +2387,12 @@ class ModelListSelectFilter extends ModelListFilter {
2386
2387
  this.choices = params.choices;
2387
2388
  }
2388
2389
  }
2390
+ // Set default only for cur type
2391
+ if (this.default && this.type == 'select') {
2392
+ this.set(this.default, '', true);
2393
+ }
2389
2394
  }
2395
+ setDefault() { }
2390
2396
  }
2391
2397
 
2392
2398
  class ModelListSelectMultiFilter extends ModelListSelectFilter {
@@ -2400,18 +2406,27 @@ class ModelListSelectMultiFilter extends ModelListSelectFilter {
2400
2406
  if (this.help == '') {
2401
2407
  this.help = 'Choix par liste déroulante (multiple)';
2402
2408
  }
2409
+ // Set default only for cur type
2410
+ if (this.default && this.type == 'selectmulti') {
2411
+ for (const f of this.default) {
2412
+ this.set(f.value, f.desc, true);
2413
+ }
2414
+ }
2403
2415
  }
2404
2416
  }
2405
2417
 
2406
2418
  class ModelListTextFilter extends ModelListFilter {
2407
2419
  constructor(params) {
2408
2420
  super(params);
2409
- this.type = "text";
2410
- if (this.label == "") {
2411
- this.label = "Recherche par texte";
2421
+ this.type = 'text';
2422
+ if (this.label == '') {
2423
+ this.label = 'Recherche par texte';
2412
2424
  }
2413
- if (this.help == "") {
2414
- this.help = "Texte à rechercher";
2425
+ if (this.help == '') {
2426
+ this.help = 'Texte à rechercher';
2427
+ }
2428
+ if (this.default) {
2429
+ this.set(this.default, '', true);
2415
2430
  }
2416
2431
  }
2417
2432
  }
@@ -2557,7 +2572,8 @@ class PChoicePipe {
2557
2572
  if (!value) {
2558
2573
  return '-';
2559
2574
  }
2560
- const fvalue = model[field];
2575
+ // Use value from input, not from field
2576
+ const fvalue = value; //- (model as any)[field];
2561
2577
  if (mode === 'code') {
2562
2578
  return `${fvalue}`;
2563
2579
  }
@@ -2643,7 +2659,8 @@ class PFactorPipe {
2643
2659
  if (!value)
2644
2660
  return null;
2645
2661
  locale = locale || this._locale;
2646
- const fvalue = model[field];
2662
+ // Use value from input, not from model
2663
+ const fvalue = value; // (model as any)[field];
2647
2664
  if (!isValue(fvalue))
2648
2665
  return null;
2649
2666
  const manager = model.FM(field);
@@ -2721,9 +2738,11 @@ class PFactorcPipe {
2721
2738
  return null;
2722
2739
  if (!value)
2723
2740
  return null;
2724
- const fvalue = model[field];
2725
- if (!isValue(fvalue))
2741
+ // Use value from input, not from model
2742
+ const fvalue = value; // (model as any)[field];
2743
+ if (!isValue(fvalue)) {
2726
2744
  return null;
2745
+ }
2727
2746
  locale = locale || this._locale;
2728
2747
  let currency = currencyCode || this._defaultCurrencyCode;
2729
2748
  if (!display) {
@@ -5480,6 +5499,71 @@ const slugify = (str) => {
5480
5499
  return str;
5481
5500
  };
5482
5501
 
5502
+ class UpdateService {
5503
+ constructor(appRef, swUpdate) {
5504
+ this.appRef = appRef;
5505
+ this.swUpdate = swUpdate;
5506
+ this.stable = false;
5507
+ this._available$ = new ReplaySubject(1);
5508
+ this._available$.next(false);
5509
+ const appIsStable$ = this.appRef.isStable
5510
+ .pipe(first((isStable) => isStable))
5511
+ .pipe(tap(() => console.log('App is stable')));
5512
+ const checkInterval$ = timer(10 * 1000, 5 * 60 * 1000);
5513
+ const checkWhenStable$ = merge(appIsStable$, checkInterval$);
5514
+ const updatesAvailable = swUpdate.versionUpdates.pipe(tap((evt) => console.log('Version updates event', evt)), filter((evt) => evt.type === 'VERSION_READY'), map((evt) => ({
5515
+ type: 'UPDATE_AVAILABLE',
5516
+ current: evt.currentVersion,
5517
+ available: evt.latestVersion,
5518
+ })));
5519
+ updatesAvailable.subscribe(async (evt) => {
5520
+ this._available$.next(true);
5521
+ });
5522
+ checkWhenStable$.subscribe(async () => {
5523
+ this.stable = true;
5524
+ try {
5525
+ console.log('Checking for update');
5526
+ const res = await swUpdate.checkForUpdate();
5527
+ console.log('Check for update result', res);
5528
+ }
5529
+ catch (e) {
5530
+ console.warn('No service worker');
5531
+ }
5532
+ });
5533
+ }
5534
+ get available$() {
5535
+ return this._available$.asObservable();
5536
+ }
5537
+ activate() {
5538
+ this._available$.next(false);
5539
+ console.log('RELOADING FULL PAGE');
5540
+ document.location.reload();
5541
+ }
5542
+ dismiss() {
5543
+ this._available$.next(false);
5544
+ }
5545
+ }
5546
+ UpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, deps: [{ token: i0.ApplicationRef }, { token: i1$3.SwUpdate }], target: i0.ɵɵFactoryTarget.Injectable });
5547
+ UpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, providedIn: 'root' });
5548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, decorators: [{
5549
+ type: Injectable,
5550
+ args: [{
5551
+ providedIn: 'root',
5552
+ }]
5553
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i1$3.SwUpdate }]; } });
5554
+
5555
+ class UpdateComponent {
5556
+ constructor(update) {
5557
+ this.update = update;
5558
+ }
5559
+ }
5560
+ UpdateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateComponent, deps: [{ token: UpdateService }], target: i0.ɵɵFactoryTarget.Component });
5561
+ UpdateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: UpdateComponent, isStandalone: true, selector: "data-update", ngImport: i0, template: "\n<div class=\"snack\" *ngIf=\"update.available$|async\">\n <p>Une nouvelle version de l'application est disponible.</p>\n <div class=\"row\">\n <div class=\"col-sm-6\">\n <button class=\"btn btn-primary btn-block w-100\" (click)=\"update.activate()\">L'ACTIVER MAINTENANT</button>\n </div>\n <div class=\"col-sm-6\">\n <button class=\"btn btn-warning btn-block w-100\" (click)=\"update.dismiss()\">Plus tard</button>\n </div>\n </div>\n</div>", styles: [".snack{position:fixed;bottom:0;margin-left:auto;margin-right:auto;left:auto;right:auto;background-color:#ff7a00cc;padding:20px;z-index:2000;border-top:1px solid rgb(255,122,0);font-size:1.5rem;font-weight:700;color:#8b0000;width:100%;text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] });
5562
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateComponent, decorators: [{
5563
+ type: Component,
5564
+ args: [{ selector: 'data-update', standalone: true, imports: [CommonModule], template: "\n<div class=\"snack\" *ngIf=\"update.available$|async\">\n <p>Une nouvelle version de l'application est disponible.</p>\n <div class=\"row\">\n <div class=\"col-sm-6\">\n <button class=\"btn btn-primary btn-block w-100\" (click)=\"update.activate()\">L'ACTIVER MAINTENANT</button>\n </div>\n <div class=\"col-sm-6\">\n <button class=\"btn btn-warning btn-block w-100\" (click)=\"update.dismiss()\">Plus tard</button>\n </div>\n </div>\n</div>", styles: [".snack{position:fixed;bottom:0;margin-left:auto;margin-right:auto;left:auto;right:auto;background-color:#ff7a00cc;padding:20px;z-index:2000;border-top:1px solid rgb(255,122,0);font-size:1.5rem;font-weight:700;color:#8b0000;width:100%;text-align:center}\n"] }]
5565
+ }], ctorParameters: function () { return [{ type: UpdateService }]; } });
5566
+
5483
5567
  /*
5484
5568
  * Public API Surface of data
5485
5569
  */
@@ -5488,5 +5572,5 @@ const slugify = (str) => {
5488
5572
  * Generated bundle index. Do not edit.
5489
5573
  */
5490
5574
 
5491
- export { AuthInterceptor, AuthServiceBase, BanAdapter, BootstrapDataDisplayConfig, BreadcrumbComponent, ChoicePipe, Collection, CollectionMock, DATA_API_URL, DATA_AUTH_PARAMS, DATA_AUTH_SERVICE, DATA_AUTH_USER_SERVICE, DATA_DISPLAY_CONFIG, DATA_MAX_TRANSFERSTATE_TIME, DATA_MESSAGE_SOUNDS, DEFAULT_TIMEOUTS, DataBackend, DataMessageService, DataModel, DataUploaderService, DispeditComponent, FactorPipe, FactorcPipe, FkselectComponent, FlagsComponent, Jwt, Link, M2mselectComponent, Message, MessageZoneComponent, ModelList, ModelListAutocompleteFilter, ModelListAutocompleteMultiFilter, ModelListDateFilter, ModelListDatetimeFilter, ModelListDatetimerangeFilter, ModelListFieldHeaderComponent, ModelListFieldsSelectorComponent, ModelListFilters, ModelListFiltersComponent, ModelListFiltersSelectComponent, ModelListFlagsFilter, ModelListGeodistanceFilter, ModelListNumberFilter, ModelListNumberOperations, ModelListPaginatorComponent, ModelListSelectFilter, ModelListSelectMultiFilter, ModelListService, ModelListSorterComponent, ModelListTextFilter, ModelListTreeFilter, NavDriver, NgFileDropDirective, NgFileSelectDirective, NgxUploaderModule, PChoicePipe, PFactorPipe, PFactorcPipe, Queryset, RData, RicheditComponent, STATUS, SafeDeleteComponent, TabMemoryService, UploadStatus, booleanField, charField, computedField, dateField, datetimeField, decimalField, detailsField, emailField, floatField, foreignKeyField, humanizeBytes, integerField, isValue, manyToManyField, passwordField, primaryField, reverseForeignKeyField, slugify, strToNumber, textField };
5575
+ export { AuthInterceptor, AuthServiceBase, BanAdapter, BootstrapDataDisplayConfig, BreadcrumbComponent, ChoicePipe, Collection, CollectionMock, DATA_API_URL, DATA_AUTH_PARAMS, DATA_AUTH_SERVICE, DATA_AUTH_USER_SERVICE, DATA_DISPLAY_CONFIG, DATA_MAX_TRANSFERSTATE_TIME, DATA_MESSAGE_SOUNDS, DEFAULT_TIMEOUTS, DataBackend, DataMessageService, DataModel, DataUploaderService, DispeditComponent, FactorPipe, FactorcPipe, FkselectComponent, FlagsComponent, Jwt, Link, M2mselectComponent, Message, MessageZoneComponent, ModelList, ModelListAutocompleteFilter, ModelListAutocompleteMultiFilter, ModelListDateFilter, ModelListDatetimeFilter, ModelListDatetimerangeFilter, ModelListFieldHeaderComponent, ModelListFieldsSelectorComponent, ModelListFilters, ModelListFiltersComponent, ModelListFiltersSelectComponent, ModelListFlagsFilter, ModelListGeodistanceFilter, ModelListNumberFilter, ModelListNumberOperations, ModelListPaginatorComponent, ModelListSelectFilter, ModelListSelectMultiFilter, ModelListService, ModelListSorterComponent, ModelListTextFilter, ModelListTreeFilter, NavDriver, NgFileDropDirective, NgFileSelectDirective, NgxUploaderModule, PChoicePipe, PFactorPipe, PFactorcPipe, Queryset, RData, RicheditComponent, STATUS, SafeDeleteComponent, TabMemoryService, UpdateComponent, UpdateService, UploadStatus, booleanField, charField, computedField, dateField, datetimeField, decimalField, detailsField, emailField, floatField, foreignKeyField, humanizeBytes, integerField, isValue, manyToManyField, passwordField, primaryField, reverseForeignKeyField, slugify, strToNumber, textField };
5492
5576
  //# sourceMappingURL=solidev-data.mjs.map