@ai-matrx/records 0.87.16 → 0.87.18

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.
@@ -122,6 +122,7 @@ __export(react_exports, {
122
122
  asChoiceNudge: () => asChoiceNudge,
123
123
  asPermissionLevel: () => asPermissionLevel,
124
124
  atLeast: () => atLeast,
125
+ autonumberJoin: () => autonumberJoin,
125
126
  autonumberPrefixOf: () => autonumberPrefixOf,
126
127
  autonumberSearchOf: () => autonumberSearchOf,
127
128
  autonumberWords: () => autonumberWords,
@@ -5295,7 +5296,12 @@ function createRecordsClient(given) {
5295
5296
  );
5296
5297
  let total = Number(answer?.total ?? 0);
5297
5298
  let locked = 0;
5298
- const plainPage = (!filter || Object.keys(filter).length === 0) && (!search || search.trim() === "") && (!sort || sort.length === 0) && view_id == null;
5299
+ const unfiltered = (!filter || Object.keys(filter).length === 0) && (!search || search.trim() === "") && view_id == null;
5300
+ const plainPage = unfiltered && (!sort || sort.length === 0);
5301
+ const lockedOffPage = Number(answer?.locked ?? 0);
5302
+ if (!plainPage && unfiltered && Number.isFinite(lockedOffPage) && lockedOffPage > 0) {
5303
+ locked = Math.max(lockedOnPage, lockedOffPage);
5304
+ }
5299
5305
  if (plainPage) {
5300
5306
  const counted = await client.recordAggregate({ table_id, measures: [{ op: "count" }] });
5301
5307
  if (!counted.ok) return err(counted.error);
@@ -5305,7 +5311,7 @@ function createRecordsClient(given) {
5305
5311
  }
5306
5312
  locked = openable <= total ? Math.max(lockedOnPage, total - openable) : lockedOnPage;
5307
5313
  total = openable;
5308
- } else if (lockedOnPage > 0) {
5314
+ } else if (lockedOnPage > 0 && locked === 0) {
5309
5315
  locked = lockedOnPage;
5310
5316
  total = Math.max(rows.length, total - lockedOnPage);
5311
5317
  }
@@ -12459,7 +12465,10 @@ function autonumberPrefixOf(field2) {
12459
12465
  function autonumberWords(field2, value) {
12460
12466
  const n = typeof value === "number" ? value : typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : NaN;
12461
12467
  if (!Number.isFinite(n)) return null;
12462
- return `${autonumberPrefixOf(field2)}${Math.trunc(n)}`;
12468
+ return `${autonumberJoin(autonumberPrefixOf(field2))}${Math.trunc(n)}`;
12469
+ }
12470
+ function autonumberJoin(prefix) {
12471
+ return prefix === "" || /[-_#.:/\s]$/.test(prefix) ? prefix : `${prefix}-`;
12463
12472
  }
12464
12473
  function autonumberSearchOf(fields, words) {
12465
12474
  const text2 = words.trim();