cx 26.2.0 → 26.2.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.
package/dist/widgets.js CHANGED
@@ -16252,6 +16252,7 @@ class GridComponent extends VDOM.Component {
16252
16252
  pageRecords.forEach((page) => {
16253
16253
  if (Array.isArray(page)) {
16254
16254
  records.push(...page);
16255
+ lastPage = records.length < pageSize;
16255
16256
  } else {
16256
16257
  if (!Array.isArray(page.records))
16257
16258
  throw new Error(
@@ -16266,8 +16267,10 @@ class GridComponent extends VDOM.Component {
16266
16267
  let { data } = this.props;
16267
16268
  if (!isNumber(totalRecordCount)) {
16268
16269
  totalRecordCount = (startPage - 1) * pageSize + records.length;
16269
- if (!lastPage && records.length == (endPage - startPage + 1) * pageSize) totalRecordCount++;
16270
- if (data.totalRecordCount > totalRecordCount) totalRecordCount = data.totalRecordCount;
16270
+ if (!lastPage) {
16271
+ if (records.length == (endPage - startPage + 1) * pageSize) totalRecordCount++;
16272
+ if (data.totalRecordCount > totalRecordCount) totalRecordCount = data.totalRecordCount;
16273
+ }
16271
16274
  }
16272
16275
  instance.buffer.totalRecordCount = data.totalRecordCount = totalRecordCount;
16273
16276
  instance.buffer.records = data.records = records;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "26.2.0",
3
+ "version": "26.2.2",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "exports": {
6
6
  "./data": {
@@ -65,7 +65,7 @@ export interface LookupFieldPagedQueryParams {
65
65
  }
66
66
 
67
67
  /** Common LookupField properties shared across all variants */
68
- interface LookupFieldBaseConfig<TOption = unknown> extends FieldConfig {
68
+ interface LookupFieldBaseConfig<TOption = any> extends FieldConfig {
69
69
  /** The opposite of `disabled`. */
70
70
  enabled?: BooleanProp;
71
71
 
@@ -179,7 +179,7 @@ interface LookupFieldBaseConfig<TOption = unknown> extends FieldConfig {
179
179
  | ((
180
180
  value: number | string,
181
181
  instance: Instance,
182
- validationParams: Record<string, unknown>
182
+ validationParams: Record<string, unknown>,
183
183
  ) => unknown);
184
184
  }
185
185
 
@@ -188,7 +188,7 @@ interface LookupFieldBaseConfig<TOption = unknown> extends FieldConfig {
188
188
  // =============================================================================
189
189
 
190
190
  /** Props for infinite mode: uses onQueryPage */
191
- interface LookupFieldInfiniteProps<TOption = unknown> {
191
+ interface LookupFieldInfiniteProps<TOption = any> {
192
192
  /** Enable infinite scrolling. */
193
193
  infinite: true;
194
194
  /** Number of items per page. Default is `100`. */
@@ -198,28 +198,22 @@ interface LookupFieldInfiniteProps<TOption = unknown> {
198
198
  | string
199
199
  | ((
200
200
  params: LookupFieldPagedQueryParams,
201
- instance: Instance
201
+ instance: Instance,
202
202
  ) => TOption[] | Promise<TOption[]>);
203
- /** Not available in infinite mode. */
204
- onQuery?: never;
205
203
  }
206
204
 
207
205
  /** Props for standard mode: uses onQuery */
208
- interface LookupFieldStandardProps<TOption = unknown> {
206
+ interface LookupFieldStandardProps<TOption = any> {
209
207
  /** Standard mode (no infinite scrolling). */
210
208
  infinite?: false;
211
- /** Not available in standard mode. */
212
- pageSize?: never;
213
- /** Query function for standard mode. */
209
+
214
210
  onQuery?:
215
211
  | string
216
212
  | ((query: string, instance: Instance) => TOption[] | Promise<TOption[]>);
217
- /** Not available in standard mode. */
218
- onQueryPage?: never;
219
213
  }
220
214
 
221
215
  /** Props for multiple selection mode */
222
- interface LookupFieldMultipleProps<TRecord = unknown> {
216
+ interface LookupFieldMultipleProps<TRecord = any> {
223
217
  /** Enable multiple selection. */
224
218
  multiple: true;
225
219
  /** A list of selected ids. */
@@ -230,10 +224,6 @@ interface LookupFieldMultipleProps<TRecord = unknown> {
230
224
  onGetRecordDisplayText?:
231
225
  | ((record: TRecord, instance: Instance) => string)
232
226
  | null;
233
- /** Not available in multiple mode. */
234
- value?: never;
235
- /** Not available in multiple mode. */
236
- text?: never;
237
227
  }
238
228
 
239
229
  /** Props for single selection mode */
@@ -244,12 +234,6 @@ interface LookupFieldSingleProps {
244
234
  value?: Prop<number | string>;
245
235
  /** Text associated with the selection. */
246
236
  text?: StringProp;
247
- /** Not available in single mode. */
248
- values?: never;
249
- /** Not available in single mode. */
250
- records?: never;
251
- /** Not available in single mode. */
252
- onGetRecordDisplayText?: never;
253
237
  }
254
238
 
255
239
  // =============================================================================
@@ -257,36 +241,46 @@ interface LookupFieldSingleProps {
257
241
  // =============================================================================
258
242
 
259
243
  type LookupFieldInfiniteMultipleConfig<
260
- TOption = unknown,
261
- TRecord = unknown,
244
+ TOption = any,
245
+ TRecord = any,
262
246
  > = LookupFieldBaseConfig<TOption> &
263
247
  LookupFieldInfiniteProps<TOption> &
264
248
  LookupFieldMultipleProps<TRecord>;
265
249
 
266
- type LookupFieldInfiniteSingleConfig<TOption = unknown> =
250
+ type LookupFieldInfiniteSingleConfig<TOption = any> =
267
251
  LookupFieldBaseConfig<TOption> &
268
252
  LookupFieldInfiniteProps<TOption> &
269
253
  LookupFieldSingleProps;
270
254
 
271
255
  type LookupFieldStandardMultipleConfig<
272
- TOption = unknown,
273
- TRecord = unknown,
256
+ TOption = any,
257
+ TRecord = any,
274
258
  > = LookupFieldBaseConfig<TOption> &
275
259
  LookupFieldStandardProps<TOption> &
276
260
  LookupFieldMultipleProps<TRecord>;
277
261
 
278
- type LookupFieldStandardSingleConfig<TOption = unknown> =
262
+ type LookupFieldStandardSingleConfig<TOption = any> =
279
263
  LookupFieldBaseConfig<TOption> &
280
264
  LookupFieldStandardProps<TOption> &
281
265
  LookupFieldSingleProps;
282
266
 
283
- export type LookupFieldConfig<TOption = unknown, TRecord = unknown> =
267
+ export type LookupFieldConfig<TOption = any, TRecord = any> =
284
268
  | LookupFieldInfiniteMultipleConfig<TOption, TRecord>
285
269
  | LookupFieldInfiniteSingleConfig<TOption>
286
270
  | LookupFieldStandardMultipleConfig<TOption, TRecord>
287
271
  | LookupFieldStandardSingleConfig<TOption>;
288
272
 
289
- export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
273
+ export interface LookupFieldUniversalConfig<TOption = any, TRecord = any>
274
+ extends LookupFieldBaseConfig<TOption>,
275
+ Omit<Partial<LookupFieldSingleProps>, "multiple">,
276
+ Omit<Partial<LookupFieldMultipleProps<TRecord>>, "multiple">,
277
+ Omit<Partial<LookupFieldStandardProps<TOption>>, "infinite">,
278
+ Omit<Partial<LookupFieldInfiniteProps<TOption>>, "infinite"> {
279
+ multiple?: boolean;
280
+ infinite?: boolean;
281
+ }
282
+
283
+ export class LookupField<TOption = any, TRecord = any> extends Field<
290
284
  LookupFieldConfig<TOption, TRecord>
291
285
  > {
292
286
  declare public baseClass: string;
@@ -324,19 +318,19 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
324
318
  | string
325
319
  | ((
326
320
  query: string,
327
- instance: Instance
321
+ instance: Instance,
328
322
  ) => Promise<Record<string, any>[]> | Record<string, any>[]);
329
323
  declare public onQueryPage?:
330
324
  | string
331
325
  | ((
332
326
  params: LookupFieldPagedQueryParams,
333
- instance: Instance
327
+ instance: Instance,
334
328
  ) => Promise<Record<string, any>[]> | Record<string, any>[]);
335
329
  declare public onCreateVisibleOptionsFilter?:
336
330
  | string
337
331
  | ((
338
332
  filterParams: unknown,
339
- instance: Instance
333
+ instance: Instance,
340
334
  ) => (option: Record<string, any>) => boolean);
341
335
  declare public value?: BindingInput;
342
336
  declare public text?: BindingInput<string>;
@@ -370,7 +364,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
370
364
  filterParams: { structured: true },
371
365
  },
372
366
  additionalAttributes,
373
- ...args
367
+ ...args,
374
368
  );
375
369
  }
376
370
 
@@ -441,7 +435,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
441
435
 
442
436
  prepareData(
443
437
  context: RenderingContext,
444
- instance: FieldInstance<LookupField>
438
+ instance: FieldInstance<LookupField>,
445
439
  ): void {
446
440
  let { data, store } = instance;
447
441
 
@@ -457,7 +451,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
457
451
  let filterPredicate = instance.invoke(
458
452
  "onCreateVisibleOptionsFilter",
459
453
  data.filterParams,
460
- instance
454
+ instance,
461
455
  );
462
456
  data.visibleOptions = data.options.filter(filterPredicate);
463
457
  }
@@ -467,7 +461,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
467
461
  if (this.multiple) {
468
462
  if (isArray(data.values) && isArray(data.options)) {
469
463
  data.selectedKeys = data.values.map((v) =>
470
- this.keyBindings!.length == 1 ? [v] : v
464
+ this.keyBindings!.length == 1 ? [v] : v,
471
465
  );
472
466
  let map: Record<number, Record<string, any>> = {};
473
467
  data.options.filter(($option) => {
@@ -484,20 +478,22 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
484
478
  } else if (isArray(data.records))
485
479
  data.selectedKeys.push(
486
480
  ...data.records.map(($value) =>
487
- this.keyBindings!.map((b) => Binding.get(b.local).value({ $value }))
488
- )
481
+ this.keyBindings!.map((b) =>
482
+ Binding.get(b.local).value({ $value }),
483
+ ),
484
+ ),
489
485
  );
490
486
  } else {
491
487
  let dataViewData = store.getData();
492
488
  data.selectedKeys.push(
493
- this.keyBindings!.map((b) => Binding.get(b.local).value(dataViewData))
489
+ this.keyBindings!.map((b) => Binding.get(b.local).value(dataViewData)),
494
490
  );
495
491
  if (!this.text && isArray(data.options)) {
496
492
  let option = data.options.find(($option) =>
497
493
  areKeysEqual(
498
494
  getOptionKey(this.keyBindings!, { $option }),
499
- data.selectedKeys[0]
500
- )
495
+ data.selectedKeys[0],
496
+ ),
501
497
  );
502
498
  data.text = (option && (option as any)[this.optionTextField!]) || "";
503
499
  }
@@ -511,7 +507,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
511
507
  renderInput(
512
508
  context: RenderingContext,
513
509
  instance: FieldInstance<LookupField>,
514
- key: string
510
+ key: string,
515
511
  ): React.ReactNode {
516
512
  return (
517
513
  <LookupComponent
@@ -538,14 +534,14 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
538
534
  filterOptions(
539
535
  instance: Instance,
540
536
  options: DataRecord[],
541
- query?: string
537
+ query?: string,
542
538
  ): DataRecord[] {
543
539
  if (!query) return options;
544
540
  let textPredicate = getSearchQueryPredicate(query);
545
541
  return options.filter(
546
542
  (o) =>
547
543
  isString(o[this.optionTextField!]) &&
548
- textPredicate((o as any)[this.optionTextField!] as string)
544
+ textPredicate((o as any)[this.optionTextField!] as string),
549
545
  );
550
546
  }
551
547
 
@@ -562,7 +558,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
562
558
 
563
559
  formatValue(
564
560
  context: RenderingContext,
565
- instance: Instance
561
+ instance: Instance,
566
562
  ): string | React.ReactNode {
567
563
  if (!this.multiple) return super.formatValue(context, instance);
568
564
 
@@ -575,7 +571,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
575
571
  (record as any)[this.valueTextField!] ||
576
572
  (record as any)[this.valueIdField!];
577
573
  return records.map((record) =>
578
- valueTextFormatter(record as any, instance)
574
+ valueTextFormatter(record as any, instance),
579
575
  );
580
576
  }
581
577
 
@@ -584,7 +580,7 @@ export class LookupField<TOption = unknown, TRecord = unknown> extends Field<
584
580
  return values
585
581
  .map((id) => {
586
582
  let option = options.find(
587
- (o) => (o as any)[this.optionIdField!] == id
583
+ (o) => (o as any)[this.optionIdField!] == id,
588
584
  );
589
585
  return option ? (option as any)[this.valueTextField!] : id;
590
586
  })
@@ -645,7 +641,7 @@ interface BindingConfig {
645
641
 
646
642
  function getOptionKey(
647
643
  bindings: BindingConfig[],
648
- data: Record<string, any>
644
+ data: Record<string, any>,
649
645
  ): unknown[] {
650
646
  return bindings
651
647
  .filter((a) => a.key)
@@ -662,7 +658,7 @@ function areKeysEqual(key1: unknown[], key2: unknown[]): boolean {
662
658
 
663
659
  function convertOption(
664
660
  bindings: BindingConfig[],
665
- data: Record<string, any>
661
+ data: Record<string, any>,
666
662
  ): Record<string, any> {
667
663
  let result: Record<string, any> = { $value: {} };
668
664
  bindings.forEach((b) => {
@@ -685,7 +681,7 @@ class SelectionDelegate extends Selection {
685
681
  }
686
682
 
687
683
  getIsSelectedDelegate(
688
- store: unknown
684
+ store: unknown,
689
685
  ): (record: Record<string, any>, index: number) => boolean {
690
686
  return (record: Record<string, any>, index: number) =>
691
687
  this.delegate(record, index);
@@ -810,7 +806,7 @@ class LookupComponent extends VDOM.Component<
810
806
  type: SelectionDelegate,
811
807
  delegate: (data: any) =>
812
808
  this.props.instance.data.selectedKeys.find((x: any) =>
813
- areKeysEqual(x, this.getOptionKey({ $option: data }))
809
+ areKeysEqual(x, this.getOptionKey({ $option: data })),
814
810
  ) != null,
815
811
  },
816
812
  children: this.props.itemConfig,
@@ -1126,7 +1122,7 @@ class LookupComponent extends VDOM.Component<
1126
1122
  id={data.id}
1127
1123
  className={CSS.expand(
1128
1124
  CSS.element(widget.baseClass, "input"),
1129
- data.inputClass
1125
+ data.inputClass,
1130
1126
  )}
1131
1127
  style={data.inputStyle}
1132
1128
  tabIndex={data.disabled ? null : data.tabIndex || 0}
@@ -1175,7 +1171,7 @@ class LookupComponent extends VDOM.Component<
1175
1171
 
1176
1172
  onItemClick(
1177
1173
  e: React.KeyboardEvent | React.MouseEvent,
1178
- { store }: { store: { getData: () => Record<string, any> } }
1174
+ { store }: { store: { getData: () => Record<string, any> } },
1179
1175
  ): void {
1180
1176
  this.select(e, [store.getData()]);
1181
1177
  if (!this.props.instance.widget.submitOnEnterKey || e.type != "keydown")
@@ -1185,7 +1181,7 @@ class LookupComponent extends VDOM.Component<
1185
1181
 
1186
1182
  onClearClick(
1187
1183
  e: React.MouseEvent | React.KeyboardEvent,
1188
- value?: Record<string, any>
1184
+ value?: Record<string, any>,
1189
1185
  ): void {
1190
1186
  let { instance } = this.props;
1191
1187
  let { data, store, widget } = instance;
@@ -1196,7 +1192,7 @@ class LookupComponent extends VDOM.Component<
1196
1192
  if (isArray(data.records)) {
1197
1193
  let itemKey = this.getLocalKey({ $value: value });
1198
1194
  let newRecords = data.records.filter(
1199
- (v) => !areKeysEqual(this.getLocalKey({ $value: v }), itemKey)
1195
+ (v) => !areKeysEqual(this.getLocalKey({ $value: v }), itemKey),
1200
1196
  );
1201
1197
 
1202
1198
  instance.set("records", newRecords);
@@ -1225,7 +1221,7 @@ class LookupComponent extends VDOM.Component<
1225
1221
  select(
1226
1222
  e: React.KeyboardEvent | React.MouseEvent,
1227
1223
  itemsData: Record<string, any>[],
1228
- reset?: boolean
1224
+ reset?: boolean,
1229
1225
  ): void {
1230
1226
  let { instance } = this.props;
1231
1227
  let { store, data, widget } = instance;
@@ -1245,7 +1241,8 @@ class LookupComponent extends VDOM.Component<
1245
1241
  selectedKeys.find((k: any) => areKeysEqual(optionKey!, k))
1246
1242
  ) {
1247
1243
  newRecords = records.filter(
1248
- (v: any) => !areKeysEqual(optionKey!, this.getLocalKey({ $value: v }))
1244
+ (v: any) =>
1245
+ !areKeysEqual(optionKey!, this.getLocalKey({ $value: v })),
1249
1246
  );
1250
1247
  } else {
1251
1248
  itemsData.forEach((itemData) => {
@@ -1255,7 +1252,7 @@ class LookupComponent extends VDOM.Component<
1255
1252
  bindings!.forEach((b) => {
1256
1253
  valueData = Binding.get(b.local).set(
1257
1254
  valueData,
1258
- Binding.get(b.remote).value(itemData)
1255
+ Binding.get(b.remote).value(itemData),
1259
1256
  );
1260
1257
  });
1261
1258
  newRecords.push(valueData.$value as Record<string, any>);
@@ -1403,7 +1400,7 @@ class LookupComponent extends VDOM.Component<
1403
1400
 
1404
1401
  toggleDropdown(
1405
1402
  e: React.KeyboardEvent | React.MouseEvent,
1406
- keepFocus?: boolean
1403
+ keepFocus?: boolean,
1407
1404
  ): void {
1408
1405
  if (this.state.dropdownOpen) this.closeDropdown(e, keepFocus);
1409
1406
  else this.openDropdown(e);
@@ -1411,14 +1408,14 @@ class LookupComponent extends VDOM.Component<
1411
1408
 
1412
1409
  closeDropdown(
1413
1410
  e?: React.KeyboardEvent | React.MouseEvent | null,
1414
- keepFocus?: boolean
1411
+ keepFocus?: boolean,
1415
1412
  ): void {
1416
1413
  if (this.state.dropdownOpen) {
1417
1414
  this.setState(
1418
1415
  {
1419
1416
  dropdownOpen: false,
1420
1417
  },
1421
- () => keepFocus && this.dom.input?.focus()
1418
+ () => keepFocus && this.dom.input?.focus(),
1422
1419
  );
1423
1420
 
1424
1421
  this.props.instance.setState({
@@ -1441,7 +1438,7 @@ class LookupComponent extends VDOM.Component<
1441
1438
  },
1442
1439
  () => {
1443
1440
  if (this.dom.dropdown) this.dom.dropdown.focus();
1444
- }
1441
+ },
1445
1442
  );
1446
1443
  }
1447
1444
  }
@@ -1469,7 +1466,7 @@ class LookupComponent extends VDOM.Component<
1469
1466
  status: "info",
1470
1467
  message: StringTemplate.format(
1471
1468
  widget.minQueryLengthMessageText,
1472
- widget.minQueryLength
1469
+ widget.minQueryLength,
1473
1470
  ),
1474
1471
  });
1475
1472
  return;
@@ -1479,7 +1476,7 @@ class LookupComponent extends VDOM.Component<
1479
1476
  let results = widget.filterOptions(
1480
1477
  this.props.instance,
1481
1478
  data.visibleOptions as DataRecord[],
1482
- q
1479
+ q,
1483
1480
  );
1484
1481
  this.setState({
1485
1482
  options: results,
@@ -1529,7 +1526,7 @@ class LookupComponent extends VDOM.Component<
1529
1526
  results = widget.filterOptions(
1530
1527
  this.props.instance,
1531
1528
  results,
1532
- this.lastQuery
1529
+ this.lastQuery,
1533
1530
  );
1534
1531
  }
1535
1532
 
@@ -1542,7 +1539,7 @@ class LookupComponent extends VDOM.Component<
1542
1539
  },
1543
1540
  () => {
1544
1541
  if (widget.infinite) this.onListScroll();
1545
- }
1542
+ },
1546
1543
  );
1547
1544
  })
1548
1545
  .catch((err) => {
@@ -1596,7 +1593,7 @@ class LookupComponent extends VDOM.Component<
1596
1593
  },
1597
1594
  () => {
1598
1595
  this.onListScroll();
1599
- }
1596
+ },
1600
1597
  );
1601
1598
  })
1602
1599
  .catch((err) => {
@@ -1612,7 +1609,7 @@ class LookupComponent extends VDOM.Component<
1612
1609
  if (this.dom.input) {
1613
1610
  tooltipParentWillReceiveProps(
1614
1611
  this.dom.input,
1615
- ...getFieldTooltip(props.instance)
1612
+ ...getFieldTooltip(props.instance),
1616
1613
  );
1617
1614
  }
1618
1615
  }
@@ -1621,7 +1618,7 @@ class LookupComponent extends VDOM.Component<
1621
1618
  if (this.dom.input) {
1622
1619
  tooltipParentDidMount(
1623
1620
  this.dom.input,
1624
- ...getFieldTooltip(this.props.instance)
1621
+ ...getFieldTooltip(this.props.instance),
1625
1622
  );
1626
1623
  autoFocus(this.dom.input, this);
1627
1624
  }
@@ -1651,7 +1648,7 @@ class LookupComponent extends VDOM.Component<
1651
1648
  (e) => this.onListWheel(e as WheelEvent),
1652
1649
  {
1653
1650
  passive: false,
1654
- }
1651
+ },
1655
1652
  );
1656
1653
  }
1657
1654
  }
@@ -1668,7 +1665,7 @@ class LookupComponent extends VDOM.Component<
1668
1665
  () => this.onListScroll(),
1669
1666
  {
1670
1667
  passive: false,
1671
- }
1668
+ },
1672
1669
  );
1673
1670
  }
1674
1671
  }
@@ -521,7 +521,10 @@ export interface GridConfig<T = any> extends StyledContainerConfig {
521
521
  focusable?: boolean;
522
522
 
523
523
  /** Callback function to retrieve grouping data. */
524
- onGetGrouping?: (params: any, instance: Instance) => (string | GridGroupingConfig<T>)[];
524
+ onGetGrouping?: (
525
+ params: any,
526
+ instance: Instance,
527
+ ) => (string | GridGroupingConfig<T>)[];
525
528
 
526
529
  /** Callback function to dynamically calculate columns. */
527
530
  onGetColumns?: (
@@ -2988,6 +2991,7 @@ class GridComponent extends VDOM.Component<
2988
2991
  pageRecords.forEach((page) => {
2989
2992
  if (Array.isArray(page)) {
2990
2993
  records.push(...page);
2994
+ lastPage = records.length < pageSize;
2991
2995
  } else {
2992
2996
  if (!Array.isArray(page.records))
2993
2997
  throw new Error(
@@ -3004,13 +3008,12 @@ class GridComponent extends VDOM.Component<
3004
3008
 
3005
3009
  if (!isNumber(totalRecordCount)) {
3006
3010
  totalRecordCount = (startPage - 1) * pageSize + records.length;
3007
- if (
3008
- !lastPage &&
3009
- records.length == (endPage - startPage + 1) * pageSize
3010
- )
3011
- totalRecordCount++;
3012
- if (data.totalRecordCount > totalRecordCount)
3013
- totalRecordCount = data.totalRecordCount;
3011
+ if (!lastPage) {
3012
+ if (records.length == (endPage - startPage + 1) * pageSize)
3013
+ totalRecordCount++;
3014
+ if (data.totalRecordCount > totalRecordCount)
3015
+ totalRecordCount = data.totalRecordCount;
3016
+ }
3014
3017
  }
3015
3018
 
3016
3019
  instance.buffer.totalRecordCount = data.totalRecordCount =