@yesilyazilim/web.spa 1.0.55 → 1.0.57

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.
package/index.js CHANGED
@@ -4616,12 +4616,12 @@ let $36389158a9da3eaf$export$c5db0d123d7c6491 = class AccordionContainer extends
4616
4616
  constructor(prop){
4617
4617
  super();
4618
4618
  this._items = [];
4619
- this._connected = prop.connected;
4619
+ this._isConnected = prop.connected;
4620
4620
  prop.items.forEach((item, index)=>{
4621
4621
  const accordion = new $36389158a9da3eaf$export$a766cd26d0d69044(item);
4622
4622
  this._items.push(accordion);
4623
4623
  this.appendChild(accordion);
4624
- if (this._connected) accordion.addEventListener('toogle', (ea)=>{
4624
+ if (this._isConnected) accordion.addEventListener('toogle', (ea)=>{
4625
4625
  if (ea.detail) for (const child of this.children){
4626
4626
  const acc = child;
4627
4627
  if (child != ea.target && acc.isOpen) acc.toggle();
@@ -5418,6 +5418,7 @@ let $1b4e3c1abfa7ee85$export$df30df7ec97b32b5 = class DataTable extends (0, $ea0
5418
5418
  this._selDepTableActions = [];
5419
5419
  this._searchCols = [];
5420
5420
  this._detailsVisible = true;
5421
+ this._activeFiltersGroups = new Map();
5421
5422
  this.rowSelected = new (0, $b8c3515ddc2cad1c$export$5297c8d5665821a0)();
5422
5423
  this._onRowFormat = (row)=>{
5423
5424
  if (this.options.detail) {
@@ -5437,6 +5438,31 @@ let $1b4e3c1abfa7ee85$export$df30df7ec97b32b5 = class DataTable extends (0, $ea0
5437
5438
  else this._footerDiv.style.display = 'none';
5438
5439
  this.appendChildren(this._headerDiv, this._bodyDiv, this._footerDiv);
5439
5440
  }
5441
+ applyFilterGroup(filterGroup, skipRefresh = false) {
5442
+ this._activeFiltersGroups.set(filterGroup.key, filterGroup);
5443
+ if (!skipRefresh) this._refreshFilters();
5444
+ }
5445
+ removeFilterGroup(key) {
5446
+ if (!this._activeFiltersGroups.delete(key)) return;
5447
+ this._refreshFilters();
5448
+ }
5449
+ _createTabulatorFilterFromActiveGroups() {
5450
+ const andFilters = [];
5451
+ const orFilters = [];
5452
+ for (const afg of this._activeFiltersGroups.values()){
5453
+ if (afg.andFilters && afg.andFilters.length > 0) andFilters.push(...afg.andFilters);
5454
+ if (afg.orFilters && afg.orFilters.length > 0) orFilters.push(...afg.orFilters);
5455
+ }
5456
+ const filters = [];
5457
+ if (andFilters.length > 0) filters.push(...andFilters);
5458
+ if (orFilters.length > 0) filters.push(orFilters);
5459
+ return filters;
5460
+ }
5461
+ _refreshFilters() {
5462
+ const filters = this._createTabulatorFilterFromActiveGroups();
5463
+ if (filters.length > 0) this._table.setFilter(filters);
5464
+ else this._table.clearFilter(false);
5465
+ }
5440
5466
  onConnected() {
5441
5467
  var _a, _b;
5442
5468
  if (this._table) return;
@@ -5687,6 +5713,14 @@ let $1b4e3c1abfa7ee85$export$df30df7ec97b32b5 = class DataTable extends (0, $ea0
5687
5713
  ];
5688
5714
  opt.paginationCounter = 'rows';
5689
5715
  }
5716
+ if (this.options.initialFilters && this.options.initialFilters.length > 0) {
5717
+ const fg = {
5718
+ key: 'initial',
5719
+ andFilters: this.options.initialFilters
5720
+ };
5721
+ this.applyFilterGroup(fg, true);
5722
+ opt.initialFilter = this.options.initialFilters;
5723
+ }
5690
5724
  return opt;
5691
5725
  }
5692
5726
  _createColumnsOptions(ttOpt) {
@@ -5769,7 +5803,7 @@ let $1b4e3c1abfa7ee85$export$df30df7ec97b32b5 = class DataTable extends (0, $ea0
5769
5803
  }
5770
5804
  _filterSearch() {
5771
5805
  const searchTerm = this._searchInput.value.toLowerCase().trim();
5772
- if (searchTerm.length < 1) this._table.clearFilter(true);
5806
+ if (searchTerm.length < 1) this.removeFilterGroup('__search');
5773
5807
  else {
5774
5808
  const arr = [];
5775
5809
  for (const sCol of this._searchCols)arr.push({
@@ -5777,9 +5811,11 @@ let $1b4e3c1abfa7ee85$export$df30df7ec97b32b5 = class DataTable extends (0, $ea0
5777
5811
  type: "like",
5778
5812
  value: searchTerm
5779
5813
  });
5780
- this._table.setFilter([
5781
- arr
5782
- ]);
5814
+ this.applyFilterGroup({
5815
+ orFilters: arr,
5816
+ key: '__search'
5817
+ });
5818
+ console.log("filtre search, all filters > ", this.table.getFilters(false));
5783
5819
  }
5784
5820
  }
5785
5821
  _exportPdf() {