@lotics/app-sdk 0.127.6 → 0.127.7

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.
@@ -197,6 +197,28 @@ var COMBINING_MARKS = /[̀-ͯ]/g;
197
197
  function foldDiacritics(value) {
198
198
  return value.normalize("NFD").replace(COMBINING_MARKS, "").replace(/[đĐ]/g, (c) => c === "\u0111" ? "d" : "D");
199
199
  }
200
+ var TONE_PLACEMENTS = [
201
+ ["o\xE0", "\xF2a"],
202
+ ["o\xE1", "\xF3a"],
203
+ ["o\u1EA3", "\u1ECFa"],
204
+ ["o\xE3", "\xF5a"],
205
+ ["o\u1EA1", "\u1ECDa"],
206
+ ["o\xE8", "\xF2e"],
207
+ ["o\xE9", "\xF3e"],
208
+ ["o\u1EBB", "\u1ECFe"],
209
+ ["o\u1EBD", "\xF5e"],
210
+ ["o\u1EB9", "\u1ECDe"],
211
+ ["u\u1EF3", "\xF9y"],
212
+ ["u\xFD", "\xFAy"],
213
+ ["u\u1EF7", "\u1EE7y"],
214
+ ["u\u1EF9", "\u0169y"],
215
+ ["u\u1EF5", "\u1EE5y"]
216
+ ];
217
+ var TONE_PLACEMENT_PATTERN = new RegExp(TONE_PLACEMENTS.map(([placed]) => placed).join("|"), "g");
218
+ var OLD_STYLE = new Map(TONE_PLACEMENTS);
219
+ function keepAccentsForm(value) {
220
+ return value.normalize("NFC").toLowerCase().replace(TONE_PLACEMENT_PATTERN, (placed) => OLD_STYLE.get(placed) ?? placed);
221
+ }
200
222
  function foldSearchText(value) {
201
223
  return foldDiacritics(value).toLowerCase();
202
224
  }
@@ -2040,7 +2062,7 @@ async function standaloneUpload(file, fidelity, place) {
2040
2062
  export {
2041
2063
  __export,
2042
2064
  foldDiacritics,
2043
- foldSearchText,
2065
+ keepAccentsForm,
2044
2066
  searchWords,
2045
2067
  customAlphabet,
2046
2068
  isFieldKey,
package/dist/index.js CHANGED
@@ -19,13 +19,13 @@ import {
19
19
  encodePatch,
20
20
  fixedDecimal,
21
21
  foldDiacritics,
22
- foldSearchText,
23
22
  getUrlParams,
24
23
  hostSpec,
25
24
  installRpcTransport,
26
25
  isEmbedded,
27
26
  isFieldKey,
28
27
  isRecordBound,
28
+ keepAccentsForm,
29
29
  moduloDecimal,
30
30
  multiplyDecimal,
31
31
  multiplyExactly,
@@ -51,7 +51,7 @@ import {
51
51
  subtractDecimal,
52
52
  sumDecimal,
53
53
  urlParam
54
- } from "./chunk-3CRJJUTV.js";
54
+ } from "./chunk-HEFHU5J6.js";
55
55
 
56
56
  // src/mount.tsx
57
57
  import { createRoot } from "react-dom/client";
@@ -12535,6 +12535,9 @@ function fileProperty(entry, property, fileFacts, fieldKey, operator) {
12535
12535
  const own = typeof entry === "object" && entry !== null ? Reflect.get(entry, property) : void 0;
12536
12536
  return typeof own === "string" ? own : "";
12537
12537
  }
12538
+ function searchForm(lowered, ignoreAccents) {
12539
+ return ignoreAccents ? foldDiacritics(lowered) : keepAccentsForm(lowered);
12540
+ }
12538
12541
  function matchCell(cell, field, filterCondition, looseCondition, memberContext, fileFacts, figureFactor = 1) {
12539
12542
  let columnValue = cell;
12540
12543
  const resolvedType = filterCondition.type;
@@ -12549,12 +12552,13 @@ function matchCell(cell, field, filterCondition, looseCondition, memberContext,
12549
12552
  columnValue = null;
12550
12553
  }
12551
12554
  let matches = false;
12555
+ const ignoreAccents = looseCondition.ignore_accents === true;
12552
12556
  if (filterCondition.type === "text") {
12553
12557
  const value = columnValue?.trim();
12554
12558
  const normalizedValue = typeof value === "string" ? value.toLowerCase() : void 0;
12555
12559
  const normalizedFilterValue = typeof filterCondition.value === "string" ? filterCondition.value.trim().toLowerCase() : filterCondition.value;
12556
- const foldedValue = normalizedValue === void 0 ? void 0 : foldDiacritics(normalizedValue);
12557
- const foldedFilterValue = typeof normalizedFilterValue === "string" ? foldDiacritics(normalizedFilterValue) : void 0;
12560
+ const foldedValue = normalizedValue === void 0 ? void 0 : searchForm(normalizedValue, ignoreAccents);
12561
+ const foldedFilterValue = typeof normalizedFilterValue === "string" ? searchForm(normalizedFilterValue, ignoreAccents) : void 0;
12558
12562
  if (filterCondition.value === "" && filterCondition.operator !== "is_empty" && filterCondition.operator !== "is_not_empty") {
12559
12563
  return null;
12560
12564
  }
@@ -12584,7 +12588,7 @@ function matchCell(cell, field, filterCondition, looseCondition, memberContext,
12584
12588
  matches = normalizedValue === void 0 || normalizedFilterValues.every((fv) => normalizedValue !== fv);
12585
12589
  }
12586
12590
  } else if (filterCondition.operator === "contains_any_of") {
12587
- const needles = (filterCondition.value === null ? [] : searchWords(filterCondition.value)).map(foldSearchText);
12591
+ const needles = (filterCondition.value === null ? [] : searchWords(filterCondition.value)).map((word) => searchForm(word.toLowerCase(), ignoreAccents));
12588
12592
  matches = foldedValue !== void 0 && needles.some((needle) => foldedValue.includes(needle));
12589
12593
  }
12590
12594
  } else if (filterCondition.type === "number") {
@@ -12880,8 +12884,8 @@ function matchCell(cell, field, filterCondition, looseCondition, memberContext,
12880
12884
  if (filterCondition.value === null || filterCondition.value === void 0 || Array.isArray(filterCondition.value)) {
12881
12885
  return null;
12882
12886
  }
12883
- const searchText = foldSearchText(filterCondition.value.trim());
12884
- const displayTexts = items.map((item) => foldDiacritics((item.display ?? "").toLowerCase()));
12887
+ const searchText = searchForm(filterCondition.value.trim().toLowerCase(), ignoreAccents);
12888
+ const displayTexts = items.map((item) => searchForm((item.display ?? "").toLowerCase(), ignoreAccents));
12885
12889
  if (filterCondition.operator === "contains") {
12886
12890
  matches = displayTexts.some((text2) => text2.includes(searchText));
12887
12891
  } else if (filterCondition.operator === "not_contains") {
package/dist/router.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  isEmbedded,
3
3
  postHostNotification,
4
4
  setUrlParams
5
- } from "./chunk-3CRJJUTV.js";
5
+ } from "./chunk-HEFHU5J6.js";
6
6
 
7
7
  // src/router.tsx
8
8
  import { useEffect } from "react";
@@ -147,6 +147,8 @@ export interface QueryFilterFieldCondition<C extends string = string> {
147
147
  value?: unknown;
148
148
  /** A comparison on a figure read in each row's own unit or currency: the option, by key, its value is in. */
149
149
  unit_option?: string;
150
+ /** A text search that ignores accents as well as case; absent, it keeps them. */
151
+ ignore_accents?: boolean;
150
152
  }
151
153
  export interface QueryFilterGroup<C extends string = string> {
152
154
  node_type: "group";
@@ -281,7 +283,7 @@ export type SpecLayout = CardsSpec | TableSpec | { kind: "calendar"; date: strin
281
283
  export type StatedBounds<V> = { gt: V | null; gte: V | null; lt: V | null; lte: V | null; };
282
284
  export type TableField = { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "number"; notation?: { style: "decimal"; } | { style: "currency"; currency: string | { per_row: string; }; } | { style: "unit"; unit: string | { per_row: string; }; } | undefined; rating?: { max: number; } | null | undefined; format: "currency" | "number" | "percentage"; currency?: string | null | undefined; unit?: string | null | undefined; unit_field?: string | null | undefined; currency_field?: string | null | undefined; default_value?: number | null | undefined; default_from?: { link_field_key: string; through?: string[] | undefined; field_key: string; options?: Record<string, string> | undefined; } | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "text"; unique?: boolean | undefined; format?: "link" | "markdown" | "text" | undefined; default_value?: string | null | undefined; default_from?: { link_field_key: string; through?: string[] | undefined; field_key: string; options?: Record<string, string> | undefined; } | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "date"; format?: "date" | "date_range" | "datetime" | "datetime_range" | "month" | undefined; timezone?: string | undefined; derive_from?: "created_at" | "updated_at" | undefined; default_value?: string | null | undefined; default_from?: { link_field_key: string; through?: string[] | undefined; field_key: string; options?: Record<string, string> | undefined; } | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "boolean"; default_value?: boolean | null | undefined; default_from?: { link_field_key: string; through?: string[] | undefined; field_key: string; options?: Record<string, string> | undefined; } | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "select"; options: { key: string; alias?: string | undefined; name: string; color: "amber" | "blue" | "cyan" | "emerald" | "fuchsia" | "gray" | "green" | "indigo" | "lime" | "neutral" | "orange" | "pink" | "purple" | "red" | "rose" | "sky" | "slate" | "stone" | "teal" | "violet" | "yellow" | "zinc"; mark?: { kind: string; name: string; } | undefined; short?: string | undefined; }[]; multi?: boolean | undefined; default_value?: string[] | null | undefined; default_from?: { link_field_key: string; through?: string[] | undefined; field_key: string; options?: Record<string, string> | undefined; } | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "select_member"; multi?: boolean | undefined; default_value?: string[] | null | undefined; default_from?: { link_field_key: string; through?: string[] | undefined; field_key: string; options?: Record<string, string> | undefined; } | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "select_record_link"; table_id: string; paired_field_key?: string | undefined; cardinality?: "many" | "one" | undefined; default_from?: { link_field_key: string; through?: string[] | undefined; field_key: string; options?: Record<string, string> | undefined; } | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "rollup"; source_field_key: string; aggregate_option: { operation: "checked" | "percent_checked" | "percent_unchecked" | "unchecked"; field_key: string; } | { operation: "empty" | "filled" | "percent_empty" | "percent_filled" | "selected"; field_key: string; } | { operation: "empty" | "filled" | "percent_empty" | "percent_filled" | "percent_unique" | "unique"; field_key: string; } | { operation: "empty" | "filled" | "percent_empty" | "percent_filled" | "percent_unique" | "selected" | "unique"; field_key: string; } | { operation: "date_range" | "earliest" | "empty" | "filled" | "latest" | "percent_empty" | "percent_filled" | "percent_unique" | "unique"; field_key: string; } | { operation: "avg" | "empty" | "filled" | "max" | "median" | "min" | "percent_empty" | "percent_filled" | "percent_unique" | "range" | "sum" | "unique"; field_key: string; } | { operation: "avg" | "date_range" | "earliest" | "empty" | "filled" | "latest" | "max" | "median" | "min" | "percent_empty" | "percent_filled" | "percent_unique" | "range" | "sum" | "unique"; field_key: string; } | { operation: "avg" | "checked" | "date_range" | "earliest" | "empty" | "filled" | "latest" | "max" | "median" | "min" | "percent_checked" | "percent_empty" | "percent_filled" | "percent_unchecked" | "percent_unique" | "range" | "sum" | "unchecked" | "unique"; field_key: string; } | { operation: "count"; field_key?: string | undefined; }; filter?: TableRecordFiltersGroupNode | undefined; aggregate_field_type?: "autonumber" | "boolean" | "button" | "date" | "files" | "formula" | "lookup" | "number" | "rollup" | "select" | "select_member" | "select_record_link" | "text" | undefined; aggregate_field_notation?: { style: "decimal"; } | { style: "currency"; currency: string | { per_row: string; }; } | { style: "unit"; unit: string | { per_row: string; }; } | undefined; aggregate_field_format?: string | undefined; aggregate_field_currency?: string | undefined; aggregate_field_unit?: string | undefined; aggregate_field_unit_field?: string | undefined; aggregate_field_currency_field?: string | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "lookup"; source_field_key: string; lookup_field_key: string; lookup_field_type?: "autonumber" | "boolean" | "button" | "date" | "files" | "formula" | "lookup" | "number" | "rollup" | "select" | "select_member" | "select_record_link" | "text" | undefined; lookup_field_notation?: { style: "decimal"; } | { style: "currency"; currency: string | { per_row: string; }; } | { style: "unit"; unit: string | { per_row: string; }; } | undefined; lookup_field_format?: string | undefined; lookup_field_currency?: string | undefined; lookup_field_unit?: string | undefined; lookup_field_options?: { key: string; name: string; color?: string | undefined; mark?: { kind: string; name: string; } | undefined; }[] | undefined; lookup_field_autonumber?: boolean | undefined; lookup_field_several?: true | undefined; order_by?: { field_key: string; direction: "asc" | "desc"; } | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "files"; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "formula"; formula: { expression: string; notation?: { style: "decimal"; } | { style: "currency"; currency: string | { per_row: string; }; } | { style: "unit"; unit: string | { per_row: string; }; } | undefined; link?: true | undefined; format?: "currency" | "link" | "number" | "percentage" | undefined; currency?: string | undefined; unit?: string | undefined; unit_field?: string | undefined; currency_field?: string | undefined; options?: { key: string; alias?: string | undefined; name: string; color: "amber" | "blue" | "cyan" | "emerald" | "fuchsia" | "gray" | "green" | "indigo" | "lime" | "neutral" | "orange" | "pink" | "purple" | "red" | "rose" | "sky" | "slate" | "stone" | "teal" | "violet" | "yellow" | "zinc"; mark?: { kind: string; name: string; } | undefined; short?: string | undefined; }[] | undefined; output_type?: "boolean" | "date" | "datetime" | "number" | "select" | "text" | undefined; volatile?: boolean | undefined; }; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "button"; text: string; workflow_id?: string | null | undefined; } | { key: string; alias?: string | undefined; name: string; description: string; confirm_before_update?: boolean | undefined; required?: boolean | undefined; type: "autonumber"; prefix?: string | undefined; padding?: number | undefined; template?: string | undefined; };
283
285
  export type TableRecordFilters = TableRecordFiltersConditionNode | TableRecordFiltersGroupNode | TableRecordFiltersTraversalNode;
284
- export type TableRecordFiltersConditionNode = { node_type: "condition"; field_key?: string; type?: string; operator: string; value?: unknown; unit_option?: string; };
286
+ export type TableRecordFiltersConditionNode = { node_type: "condition"; field_key?: string; type?: string; operator: string; value?: unknown; unit_option?: string; ignore_accents?: boolean; };
285
287
  export type TableRecordFiltersGroupNode = { node_type: "group"; logic: "and" | "or"; children: (TableRecordFiltersConditionNode | TableRecordFiltersTraversalNode | TableRecordFiltersGroupNode)[]; };
286
288
  /**
287
289
  * Traversal node — filter the current table by a field on a record reachable
package/docs/queries.md CHANGED
@@ -480,7 +480,7 @@ derived surfaces share one implementation.
480
480
 
481
481
  | Field type | Column type | Source-layer operators | Derived-layer differences | Sort / group / aggregate notes |
482
482
  | --- | --- | --- | --- | --- |
483
- | text | `text` | `equals`, `not_equals`, `contains`, `does_not_contain`, `starts_with`, `ends_with`, `is_empty`, `is_not_empty`, `is_any_of`, `is_none_of`, `contains_any_of` | same set | Sort is lexicographic in the database's default collation — no locale control — over the trimmed, case-folded text, a column the query derives included; the value read stays as written. Text comparisons normalize both sides (trim + case-insensitive). The LIKE family (`contains`, `does_not_contain`, `starts_with`, `ends_with`, and `contains_any_of`, whose value is a list and which holds when ANY listed word is in the cell) additionally folds **diacritics**, so `contains "ha noi"` matches `"Hà Nội"`; the identity operators (`equals`, `not_equals`, `is_any_of`, `is_none_of`) do **not** — they compare a stored value, and `mã` is not `ma`. |
483
+ | text | `text` | `equals`, `not_equals`, `contains`, `does_not_contain`, `starts_with`, `ends_with`, `is_empty`, `is_not_empty`, `is_any_of`, `is_none_of`, `contains_any_of` | same set | Sort is lexicographic in the database's default collation — no locale control — over the trimmed, case-folded text, a column the query derives included; the value read stays as written. Text comparisons normalize both sides (trim + case-insensitive). The LIKE family (`contains`, `does_not_contain`, `starts_with`, `ends_with`, and `contains_any_of`, whose value is a list and which holds when ANY listed word is in the cell) keeps **accents** (`contains "cá"` matches `"Cá hồi"`, not `"Cà chua"`) unless the condition states `"ignore_accents": true`, which folds them, so `contains "ha noi"` matches `"Hà Nội"`; the identity operators (`equals`, `not_equals`, `is_any_of`, `is_none_of`) do **not** — they compare a stored value, and `mã` is not `ma`. |
484
484
  | number | `number` | `equals`, `not_equals`, `greater_than`, `less_than`, `greater_than_or_equal_to`, `less_than_or_equal_to`, `is_empty`, `is_not_empty` | same set — except a figure read in each row's own unit or currency (a `notation` whose currency or unit is `per_row`, or a rollup totalling in its row's), which a comparison matches only at the source layer: a condition on a column passing it straight through moves there, anywhere else it is refused | Full numeric aggregate set (§8). A comparison on a figure read per row states `unit_option`, the key of the option of that select its value is in — `{ "field_key": "amount", "operator": "greater_than", "value": 100, "unit_option": "opt_usd" }` — and matches only rows holding that option; rows in a measured unit of the same dimension compare converted (`≥ 1` in `t` matches `1500` in `kg`), a counted unit or a currency never. One stating none is refused. |
485
485
  | date / datetime | `date` / `datetime` (datetime when the field's format includes time) | `on`, `before`, `after`, `on_or_before`, `on_or_after`, `between`, `time_of_day`, `is_empty`, `is_not_empty` — values are `DateTimePoint`s (below) | same set | Day-level filters on datetime values expand to the full-day window; a `date` column compares on the day alone, so a time in the filter value is ignored. A reduced-precision value (`"2026-05"`) is its period start, and a value with no time is at `00:00` for `time_of_day`. Sortable; bucketable in `group.by` (§8); `earliest`/`latest`/`min`/`max`/`date_range` aggregate. |
486
486
  | boolean | `boolean` | `equals` (value `true`/`false`; `false` matches NULL/missing) | same | `checked`/`unchecked`/`percent_*` aggregate (`unchecked` counts false **or** empty). |
@@ -652,7 +652,7 @@ a required one is refused (§6).
652
652
 
653
653
  **Search-as-you-type over a LARGE table uses `search`, never a `contains` OR-group alone.** Per-field
654
654
  `contains` is unindexed — a zero-match keystroke forces a full-table scan that hangs the
655
- picker. (It is not accent-sensitive; the LIKE family folds diacritics, §5.) Gate the fetch on a
655
+ picker. (`contains` keeps accents unless the condition states `ignore_accents: true`, §5.) Gate the fetch on a
656
656
  non-empty term client-side (`enabled`), or first paint dumps the table.
657
657
 
658
658
  **But `search` matches the WHOLE record, and on an identity box that is usually wrong.** The
@@ -661,9 +661,9 @@ linked record's cached display text — including the `Field=True/False` pill a
661
661
  into. A box captioned "find a person" then matches rows that merely share a stage label or an
662
662
  owner, and folding makes near-homographs collide (`tiến` ≡ `tiền`). When the box means *find
663
663
  this person*, bound it: an OR-group of `contains` over the two or three identity fields (name,
664
- national id, phone), with the term param `required: false` so an empty box prunes the group to
664
+ national id, phone), each with `ignore_accents: true` so `nguyen` finds `Nguyễn`, with the term param `required: false` so an empty box prunes the group to
665
665
  match-all, and put the same term in `search` beside it: the search document holds every field the
666
- OR-group reads, folded alike for diacritics and case, so the pair returns the OR-group's rows, found
666
+ OR-group reads, so the pair returns the OR-group's rows, found
667
667
  through the trigram index rather than a scan. (A term whose letters `contains` folds further — `ß`,
668
668
  `ł`, curly quotes — can miss a row.) Use `search` alone when the box genuinely means *find this
669
669
  anywhere in the record*.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.127.6",
3
+ "version": "0.127.7",
4
4
  "description": "The SDK a Lotics custom-code app reads and writes through — typed hooks over the host bridge, cell readers, mount() and AppRouter",
5
5
  "type": "module",
6
6
  "exports": {