@solidev/data 0.0.1-beta.1 → 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 (22) 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/fesm2015/solidev-data.mjs +31 -14
  12. package/fesm2015/solidev-data.mjs.map +1 -1
  13. package/fesm2020/solidev-data.mjs +31 -14
  14. package/fesm2020/solidev-data.mjs.map +1 -1
  15. package/lib/data/fields/computed.d.ts +3 -0
  16. package/lib/modellist/model-list-filters/filters/model-list-select-filter/model-list-select-filter.component.d.ts +1 -1
  17. package/lib/modellist/model-list-filters/filters/model-list-select-filter/model-list-select-filter.d.ts +1 -0
  18. package/lib/modellist/model-list-filters/filters/model-list-select-multi-filter/model-list-select-multi-filter.d.ts +6 -1
  19. package/lib/modellist/model-list-filters/filters/model-list-text-filter/model-list-text-filter.component.d.ts +2 -2
  20. package/lib/modellist/model-list-filters/filters/model-list-text-filter/model-list-text-filter.d.ts +1 -1
  21. package/lib/modellist/model-list-filters/model-list-filter.d.ts +2 -0
  22. package/package.json +1 -1
@@ -2,7 +2,7 @@ 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';
5
+ import { FormControl, Validators, FormGroup, ReactiveFormsModule, UntypedFormControl, NG_VALUE_ACCESSOR, UntypedFormGroup } from '@angular/forms';
6
6
  import { throwError, ReplaySubject, share, combineLatest, of, takeUntil, NEVER, Subject, debounceTime, distinctUntilChanged, isObservable, firstValueFrom, timer, Observable, BehaviorSubject, merge } from 'rxjs';
7
7
  import { tap, switchMap, map, throttleTime, filter, mergeMap, finalize, catchError, take, first } from 'rxjs/operators';
8
8
  import * as i2 from '@angular/platform-browser';
@@ -1584,14 +1584,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
1584
1584
  class ModelListTextFilterComponent {
1585
1585
  constructor() {
1586
1586
  this.classes = '';
1587
- this.fc = new UntypedFormControl();
1587
+ this.fc = new FormControl(null);
1588
1588
  }
1589
1589
  ngOnInit() {
1590
1590
  this.filter.valueChanges.subscribe((val) => {
1591
1591
  this.fc.setValue(val.value, { emitEvent: false });
1592
1592
  });
1593
1593
  this.fc.valueChanges.pipe(debounceTime(250)).subscribe((val) => {
1594
- if (this.filter.set(val, val)) {
1594
+ if (this.filter.set(val, val || '')) {
1595
1595
  this.list.filters.update();
1596
1596
  }
1597
1597
  });
@@ -1856,7 +1856,6 @@ class ModelListSelectFilterComponent {
1856
1856
  }
1857
1857
  ngOnInit() {
1858
1858
  this.filter.valueChanges.subscribe((val) => {
1859
- console.log('Changing value', val);
1860
1859
  this.fc.setValue(val ? val.value : null, {
1861
1860
  emitEvent: false,
1862
1861
  });
@@ -2084,6 +2083,7 @@ class ModelListFilter {
2084
2083
  this.allowed = false;
2085
2084
  this.enabled = false;
2086
2085
  this.type = 'text';
2086
+ this.default = params.default;
2087
2087
  // FIXME: add value init
2088
2088
  }
2089
2089
  get mcurrent$() {
@@ -2387,7 +2387,12 @@ class ModelListSelectFilter extends ModelListFilter {
2387
2387
  this.choices = params.choices;
2388
2388
  }
2389
2389
  }
2390
+ // Set default only for cur type
2391
+ if (this.default && this.type == 'select') {
2392
+ this.set(this.default, '', true);
2393
+ }
2390
2394
  }
2395
+ setDefault() { }
2391
2396
  }
2392
2397
 
2393
2398
  class ModelListSelectMultiFilter extends ModelListSelectFilter {
@@ -2401,18 +2406,27 @@ class ModelListSelectMultiFilter extends ModelListSelectFilter {
2401
2406
  if (this.help == '') {
2402
2407
  this.help = 'Choix par liste déroulante (multiple)';
2403
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
+ }
2404
2415
  }
2405
2416
  }
2406
2417
 
2407
2418
  class ModelListTextFilter extends ModelListFilter {
2408
2419
  constructor(params) {
2409
2420
  super(params);
2410
- this.type = "text";
2411
- if (this.label == "") {
2412
- this.label = "Recherche par texte";
2421
+ this.type = 'text';
2422
+ if (this.label == '') {
2423
+ this.label = 'Recherche par texte';
2413
2424
  }
2414
- if (this.help == "") {
2415
- this.help = "Texte à rechercher";
2425
+ if (this.help == '') {
2426
+ this.help = 'Texte à rechercher';
2427
+ }
2428
+ if (this.default) {
2429
+ this.set(this.default, '', true);
2416
2430
  }
2417
2431
  }
2418
2432
  }
@@ -2558,7 +2572,8 @@ class PChoicePipe {
2558
2572
  if (!value) {
2559
2573
  return '-';
2560
2574
  }
2561
- const fvalue = model[field];
2575
+ // Use value from input, not from field
2576
+ const fvalue = value; //- (model as any)[field];
2562
2577
  if (mode === 'code') {
2563
2578
  return `${fvalue}`;
2564
2579
  }
@@ -2644,7 +2659,8 @@ class PFactorPipe {
2644
2659
  if (!value)
2645
2660
  return null;
2646
2661
  locale = locale || this._locale;
2647
- const fvalue = model[field];
2662
+ // Use value from input, not from model
2663
+ const fvalue = value; // (model as any)[field];
2648
2664
  if (!isValue(fvalue))
2649
2665
  return null;
2650
2666
  const manager = model.FM(field);
@@ -2722,9 +2738,11 @@ class PFactorcPipe {
2722
2738
  return null;
2723
2739
  if (!value)
2724
2740
  return null;
2725
- const fvalue = model[field];
2726
- if (!isValue(fvalue))
2741
+ // Use value from input, not from model
2742
+ const fvalue = value; // (model as any)[field];
2743
+ if (!isValue(fvalue)) {
2727
2744
  return null;
2745
+ }
2728
2746
  locale = locale || this._locale;
2729
2747
  let currency = currencyCode || this._defaultCurrencyCode;
2730
2748
  if (!display) {
@@ -5556,4 +5574,3 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
5556
5574
 
5557
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 };
5558
5576
  //# sourceMappingURL=solidev-data.mjs.map
5559
- //# sourceMappingURL=solidev-data.mjs.map