@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 { provideAnimations } from '@angular/platform-browser/animations';
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
@@ -1585,14 +1586,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
1585
1586
  class ModelListTextFilterComponent {
1586
1587
  constructor() {
1587
1588
  this.classes = '';
1588
- this.fc = new UntypedFormControl();
1589
+ this.fc = new FormControl(null);
1589
1590
  }
1590
1591
  ngOnInit() {
1591
1592
  this.filter.valueChanges.subscribe((val) => {
1592
1593
  this.fc.setValue(val.value, { emitEvent: false });
1593
1594
  });
1594
1595
  this.fc.valueChanges.pipe(debounceTime(250)).subscribe((val) => {
1595
- if (this.filter.set(val, val)) {
1596
+ if (this.filter.set(val, val || '')) {
1596
1597
  this.list.filters.update();
1597
1598
  }
1598
1599
  });
@@ -1858,7 +1859,6 @@ class ModelListSelectFilterComponent {
1858
1859
  }
1859
1860
  ngOnInit() {
1860
1861
  this.filter.valueChanges.subscribe((val) => {
1861
- console.log('Changing value', val);
1862
1862
  this.fc.setValue(val ? val.value : null, {
1863
1863
  emitEvent: false,
1864
1864
  });
@@ -2086,6 +2086,7 @@ class ModelListFilter {
2086
2086
  this.allowed = false;
2087
2087
  this.enabled = false;
2088
2088
  this.type = 'text';
2089
+ this.default = params.default;
2089
2090
  // FIXME: add value init
2090
2091
  }
2091
2092
  get mcurrent$() {
@@ -2390,7 +2391,12 @@ class ModelListSelectFilter extends ModelListFilter {
2390
2391
  this.choices = params.choices;
2391
2392
  }
2392
2393
  }
2394
+ // Set default only for cur type
2395
+ if (this.default && this.type == 'select') {
2396
+ this.set(this.default, '', true);
2397
+ }
2393
2398
  }
2399
+ setDefault() { }
2394
2400
  }
2395
2401
 
2396
2402
  class ModelListSelectMultiFilter extends ModelListSelectFilter {
@@ -2404,18 +2410,27 @@ class ModelListSelectMultiFilter extends ModelListSelectFilter {
2404
2410
  if (this.help == '') {
2405
2411
  this.help = 'Choix par liste déroulante (multiple)';
2406
2412
  }
2413
+ // Set default only for cur type
2414
+ if (this.default && this.type == 'selectmulti') {
2415
+ for (const f of this.default) {
2416
+ this.set(f.value, f.desc, true);
2417
+ }
2418
+ }
2407
2419
  }
2408
2420
  }
2409
2421
 
2410
2422
  class ModelListTextFilter extends ModelListFilter {
2411
2423
  constructor(params) {
2412
2424
  super(params);
2413
- this.type = "text";
2414
- if (this.label == "") {
2415
- this.label = "Recherche par texte";
2425
+ this.type = 'text';
2426
+ if (this.label == '') {
2427
+ this.label = 'Recherche par texte';
2416
2428
  }
2417
- if (this.help == "") {
2418
- this.help = "Texte à rechercher";
2429
+ if (this.help == '') {
2430
+ this.help = 'Texte à rechercher';
2431
+ }
2432
+ if (this.default) {
2433
+ this.set(this.default, '', true);
2419
2434
  }
2420
2435
  }
2421
2436
  }
@@ -2561,7 +2576,8 @@ class PChoicePipe {
2561
2576
  if (!value) {
2562
2577
  return '-';
2563
2578
  }
2564
- const fvalue = model[field];
2579
+ // Use value from input, not from field
2580
+ const fvalue = value; //- (model as any)[field];
2565
2581
  if (mode === 'code') {
2566
2582
  return `${fvalue}`;
2567
2583
  }
@@ -2649,7 +2665,8 @@ class PFactorPipe {
2649
2665
  if (!value)
2650
2666
  return null;
2651
2667
  locale = locale || this._locale;
2652
- const fvalue = model[field];
2668
+ // Use value from input, not from model
2669
+ const fvalue = value; // (model as any)[field];
2653
2670
  if (!isValue(fvalue))
2654
2671
  return null;
2655
2672
  const manager = model.FM(field);
@@ -2731,9 +2748,11 @@ class PFactorcPipe {
2731
2748
  return null;
2732
2749
  if (!value)
2733
2750
  return null;
2734
- const fvalue = model[field];
2735
- if (!isValue(fvalue))
2751
+ // Use value from input, not from model
2752
+ const fvalue = value; // (model as any)[field];
2753
+ if (!isValue(fvalue)) {
2736
2754
  return null;
2755
+ }
2737
2756
  locale = locale || this._locale;
2738
2757
  let currency = currencyCode || this._defaultCurrencyCode;
2739
2758
  if (!display) {
@@ -5537,6 +5556,71 @@ const slugify = (str) => {
5537
5556
  return str;
5538
5557
  };
5539
5558
 
5559
+ class UpdateService {
5560
+ constructor(appRef, swUpdate) {
5561
+ this.appRef = appRef;
5562
+ this.swUpdate = swUpdate;
5563
+ this.stable = false;
5564
+ this._available$ = new ReplaySubject(1);
5565
+ this._available$.next(false);
5566
+ const appIsStable$ = this.appRef.isStable
5567
+ .pipe(first((isStable) => isStable))
5568
+ .pipe(tap(() => console.log('App is stable')));
5569
+ const checkInterval$ = timer(10 * 1000, 5 * 60 * 1000);
5570
+ const checkWhenStable$ = merge(appIsStable$, checkInterval$);
5571
+ const updatesAvailable = swUpdate.versionUpdates.pipe(tap((evt) => console.log('Version updates event', evt)), filter((evt) => evt.type === 'VERSION_READY'), map((evt) => ({
5572
+ type: 'UPDATE_AVAILABLE',
5573
+ current: evt.currentVersion,
5574
+ available: evt.latestVersion,
5575
+ })));
5576
+ updatesAvailable.subscribe((evt) => __awaiter(this, void 0, void 0, function* () {
5577
+ this._available$.next(true);
5578
+ }));
5579
+ checkWhenStable$.subscribe(() => __awaiter(this, void 0, void 0, function* () {
5580
+ this.stable = true;
5581
+ try {
5582
+ console.log('Checking for update');
5583
+ const res = yield swUpdate.checkForUpdate();
5584
+ console.log('Check for update result', res);
5585
+ }
5586
+ catch (e) {
5587
+ console.warn('No service worker');
5588
+ }
5589
+ }));
5590
+ }
5591
+ get available$() {
5592
+ return this._available$.asObservable();
5593
+ }
5594
+ activate() {
5595
+ this._available$.next(false);
5596
+ console.log('RELOADING FULL PAGE');
5597
+ document.location.reload();
5598
+ }
5599
+ dismiss() {
5600
+ this._available$.next(false);
5601
+ }
5602
+ }
5603
+ 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 });
5604
+ UpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, providedIn: 'root' });
5605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateService, decorators: [{
5606
+ type: Injectable,
5607
+ args: [{
5608
+ providedIn: 'root',
5609
+ }]
5610
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i1$3.SwUpdate }]; } });
5611
+
5612
+ class UpdateComponent {
5613
+ constructor(update) {
5614
+ this.update = update;
5615
+ }
5616
+ }
5617
+ UpdateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateComponent, deps: [{ token: UpdateService }], target: i0.ɵɵFactoryTarget.Component });
5618
+ 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" }] });
5619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UpdateComponent, decorators: [{
5620
+ type: Component,
5621
+ 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"] }]
5622
+ }], ctorParameters: function () { return [{ type: UpdateService }]; } });
5623
+
5540
5624
  /*
5541
5625
  * Public API Surface of data
5542
5626
  */
@@ -5545,5 +5629,5 @@ const slugify = (str) => {
5545
5629
  * Generated bundle index. Do not edit.
5546
5630
  */
5547
5631
 
5548
- 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 };
5632
+ 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 };
5549
5633
  //# sourceMappingURL=solidev-data.mjs.map