inviton-powerduck 0.0.80 → 0.0.82

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.
@@ -337,7 +337,7 @@ export class DataTableFilterItemCollection extends Array<DataTableFilterItem> {
337
337
  }
338
338
 
339
339
  export class DataTableConfig {
340
- static filterMarking = false;
340
+ static filterMarking = true;
341
341
  }
342
342
 
343
343
  @Component
@@ -854,6 +854,24 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
854
854
  return selectedRows;
855
855
  }
856
856
 
857
+ unmarkSelection(cb: () => void): void {
858
+ if (DataTableConfig.filterMarking) {
859
+ this.markInstance.unmark({
860
+ done: () => {
861
+ this.enforceBodyRedraw = true;
862
+ this.$nextTick(() => {
863
+ this.enforceBodyRedraw = false;
864
+ this.$nextTick(() => {
865
+ cb();
866
+ });
867
+ });
868
+ },
869
+ });
870
+ } else {
871
+ cb();
872
+ }
873
+ }
874
+
857
875
  markSelection(): void {
858
876
  var mySelf = this;
859
877
  var escapeRegExp = function (string) {
@@ -872,6 +890,7 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
872
890
  };
873
891
 
874
892
  var regexBuilder = "";
893
+ var markArr: string[] = [];
875
894
  if (this.filterArr != null) {
876
895
  this.filterArr.forEach((filterItem) => {
877
896
  if (regexBuilder.length > 0) {
@@ -879,7 +898,7 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
879
898
  }
880
899
 
881
900
  (getValueArr(filterItem) || []).forEach((filterValue) => {
882
- regexBuilder += escapeRegExp(filterValue);
901
+ markArr.push(escapeRegExp(filterValue));
883
902
  });
884
903
  });
885
904
  }
@@ -889,10 +908,8 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
889
908
  }
890
909
 
891
910
  if (DataTableConfig.filterMarking) {
892
- this.markInstance.unmark({
893
- done: function () {
894
- mySelf.markInstance.markRegExp(new RegExp("(" + regexBuilder + ")", "i"));
895
- },
911
+ this.unmarkSelection(() => {
912
+ mySelf.markInstance.mark(markArr);
896
913
  });
897
914
  }
898
915
  }
@@ -926,11 +943,13 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
926
943
 
927
944
  handleClientsideFilter(markResults?: boolean): boolean {
928
945
  if (this.filterMode == DataTableFilterMode.Clientside) {
929
- this.performClientsideFilter();
946
+ this.unmarkSelection(() => {
947
+ this.performClientsideFilter();
930
948
 
931
- if (markResults) {
932
- this.$nextTick(() => this.markSelection());
933
- }
949
+ if (markResults) {
950
+ this.markSelection();
951
+ }
952
+ });
934
953
 
935
954
  return true;
936
955
  }
@@ -1325,44 +1344,33 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
1325
1344
  loadPromise = mySelf.customAjaxCall(mySelf.getAjaxArgs(paginationPosition, paginationLength));
1326
1345
  }
1327
1346
 
1328
- const unmark = (cb: () => void) => {
1329
- if (DataTableConfig.filterMarking) {
1330
- mySelf.markInstance.unmark({
1331
- done: function () {
1332
- cb();
1333
- },
1334
- });
1335
- } else {
1336
- cb();
1337
- }
1338
- }
1339
1347
 
1340
- loadPromise
1341
- .then((data: any) => {
1342
- unmark(() => {
1343
- mySelf.enforceBodyRedraw = true;
1344
- mySelf.$nextTick(() => {
1345
- mySelf.enforceBodyRedraw = false;
1346
- mySelf.isLoading = false;
1347
-
1348
- if (mySelf.parseLoadedRowset != null) {
1349
- let rowset = mySelf.parseLoadedRowset(data);
1350
- mySelf.totalCount = rowset.TotalCount;
1351
- mySelf.totalFilteredCount = rowset.TotalFilteredCount;
1352
- mySelf.rows = rowset.Rows;
1353
- } else {
1354
- mySelf.totalCount = data.TotalCount;
1355
- mySelf.totalFilteredCount = data.TotalFilteredCount;
1356
- mySelf.rows = data.Rows;
1357
- }
1358
-
1359
- mySelf.loadedRows = mySelf.rows;
1360
- mySelf.$forceUpdate();
1361
- mySelf.$nextTick(() => mySelf.markSelection());
1362
- resolve(data);
1363
- });
1348
+
1349
+ loadPromise.then((data: any) => {
1350
+ mySelf.unmarkSelection(() => {
1351
+ mySelf.enforceBodyRedraw = true;
1352
+ mySelf.$nextTick(() => {
1353
+ mySelf.enforceBodyRedraw = false;
1354
+ mySelf.isLoading = false;
1355
+
1356
+ if (mySelf.parseLoadedRowset != null) {
1357
+ let rowset = mySelf.parseLoadedRowset(data);
1358
+ mySelf.totalCount = rowset.TotalCount;
1359
+ mySelf.totalFilteredCount = rowset.TotalFilteredCount;
1360
+ mySelf.rows = rowset.Rows;
1361
+ } else {
1362
+ mySelf.totalCount = data.TotalCount;
1363
+ mySelf.totalFilteredCount = data.TotalFilteredCount;
1364
+ mySelf.rows = data.Rows;
1365
+ }
1366
+
1367
+ mySelf.loadedRows = mySelf.rows;
1368
+ mySelf.$forceUpdate();
1369
+ mySelf.$nextTick(() => mySelf.markSelection());
1370
+ resolve(data);
1364
1371
  });
1365
- })
1372
+ });
1373
+ })
1366
1374
  .catch((err) => {
1367
1375
  mySelf.isLoading = false;
1368
1376
  NotificationProvider.showErrorMessage(PowerduckState.getResourceValue('errorFetchingData'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": " vite build && vue-tsc --declaration --emitDeclarationOnly",