inviton-powerduck 0.0.79 → 0.0.81

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.
@@ -336,6 +336,10 @@ export class DataTableFilterItemCollection extends Array<DataTableFilterItem> {
336
336
  }
337
337
  }
338
338
 
339
+ export class DataTableConfig {
340
+ static filterMarking = true;
341
+ }
342
+
339
343
  @Component
340
344
  class TableButtonComponent extends TsxComponent<TableButton> implements TableButton {
341
345
  @Prop() title!: string;
@@ -453,9 +457,12 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
453
457
  this.currentMobileBehavior = this.mobileBehavior;
454
458
  this.performColumnRefresh();
455
459
  this.handleWindowResized();
456
- this.markInstance = new Mark(this.$el);
457
460
  window.addEventListener("resize", this.handleWindowResized, true);
458
461
 
462
+ if (DataTableConfig.filterMarking) {
463
+ this.markInstance = new Mark(this.$el);
464
+ }
465
+
459
466
  if (this.handleInitialFilter) {
460
467
  this.parseInitialFilter();
461
468
  }
@@ -847,6 +854,24 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
847
854
  return selectedRows;
848
855
  }
849
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
+
850
875
  markSelection(): void {
851
876
  var mySelf = this;
852
877
  var escapeRegExp = function (string) {
@@ -881,11 +906,11 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
881
906
  regexBuilder += escapeRegExp(this.fullTextQuery);
882
907
  }
883
908
 
884
- this.markInstance.unmark({
885
- done: function () {
909
+ if (DataTableConfig.filterMarking) {
910
+ this.unmarkSelection(() => {
886
911
  mySelf.markInstance.markRegExp(new RegExp("(" + regexBuilder + ")", "i"));
887
- },
888
- });
912
+ });
913
+ }
889
914
  }
890
915
 
891
916
  addFilterItem(dtColumn: TableColumn, newFilter: DataTablePostBackFilterItem): void {
@@ -917,11 +942,13 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
917
942
 
918
943
  handleClientsideFilter(markResults?: boolean): boolean {
919
944
  if (this.filterMode == DataTableFilterMode.Clientside) {
920
- this.performClientsideFilter();
945
+ this.unmarkSelection(() => {
946
+ this.performClientsideFilter();
921
947
 
922
- if (markResults) {
923
- this.$nextTick(() => this.markSelection());
924
- }
948
+ if (markResults) {
949
+ this.markSelection();
950
+ }
951
+ });
925
952
 
926
953
  return true;
927
954
  }
@@ -1316,34 +1343,33 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
1316
1343
  loadPromise = mySelf.customAjaxCall(mySelf.getAjaxArgs(paginationPosition, paginationLength));
1317
1344
  }
1318
1345
 
1319
- loadPromise
1320
- .then((data: any) => {
1321
- mySelf.markInstance.unmark({
1322
- done: function () {
1323
- mySelf.enforceBodyRedraw = true;
1324
- mySelf.$nextTick(() => {
1325
- mySelf.enforceBodyRedraw = false;
1326
- mySelf.isLoading = false;
1327
-
1328
- if (mySelf.parseLoadedRowset != null) {
1329
- let rowset = mySelf.parseLoadedRowset(data);
1330
- mySelf.totalCount = rowset.TotalCount;
1331
- mySelf.totalFilteredCount = rowset.TotalFilteredCount;
1332
- mySelf.rows = rowset.Rows;
1333
- } else {
1334
- mySelf.totalCount = data.TotalCount;
1335
- mySelf.totalFilteredCount = data.TotalFilteredCount;
1336
- mySelf.rows = data.Rows;
1337
- }
1338
-
1339
- mySelf.loadedRows = mySelf.rows;
1340
- mySelf.$forceUpdate();
1341
- mySelf.$nextTick(() => mySelf.markSelection());
1342
- resolve(data);
1343
- });
1344
- },
1346
+
1347
+
1348
+ loadPromise.then((data: any) => {
1349
+ mySelf.unmarkSelection(() => {
1350
+ mySelf.enforceBodyRedraw = true;
1351
+ mySelf.$nextTick(() => {
1352
+ mySelf.enforceBodyRedraw = false;
1353
+ mySelf.isLoading = false;
1354
+
1355
+ if (mySelf.parseLoadedRowset != null) {
1356
+ let rowset = mySelf.parseLoadedRowset(data);
1357
+ mySelf.totalCount = rowset.TotalCount;
1358
+ mySelf.totalFilteredCount = rowset.TotalFilteredCount;
1359
+ mySelf.rows = rowset.Rows;
1360
+ } else {
1361
+ mySelf.totalCount = data.TotalCount;
1362
+ mySelf.totalFilteredCount = data.TotalFilteredCount;
1363
+ mySelf.rows = data.Rows;
1364
+ }
1365
+
1366
+ mySelf.loadedRows = mySelf.rows;
1367
+ mySelf.$forceUpdate();
1368
+ mySelf.$nextTick(() => mySelf.markSelection());
1369
+ resolve(data);
1345
1370
  });
1346
- })
1371
+ });
1372
+ })
1347
1373
  .catch((err) => {
1348
1374
  mySelf.isLoading = false;
1349
1375
  NotificationProvider.showErrorMessage(PowerduckState.getResourceValue('errorFetchingData'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
- "version": "0.0.79",
3
+ "version": "0.0.81",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": " vite build && vue-tsc --declaration --emitDeclarationOnly",