@ai-matrx/records-ui 0.115.17 → 0.115.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.
package/dist/pickers.js CHANGED
@@ -2224,10 +2224,30 @@ function ReferenceBuilder({
2224
2224
  // src/FormulaTextEditor.tsx
2225
2225
  import { useEffect as useEffect6, useMemo as useMemo5, useRef as useRef4, useState as useState7 } from "react";
2226
2226
  import { useRecordsClient as useRecordsClient3 } from "@ai-matrx/records/react";
2227
- import { FORMULA_FUNCTIONS as KIT_FORMULA_FUNCTIONS } from "@ai-matrx/kit/formula";
2227
+ import { RULE_NODE_KINDS } from "@ai-matrx/records";
2228
2228
  import { BasicTextarea, Button as Button4, Label as Label2, cn as cn9 } from "@ai-matrx/design-system";
2229
2229
  import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2230
- var FUNCTION_NAMES = KIT_FORMULA_FUNCTIONS.map((fn) => fn.name).sort();
2230
+ var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
2231
+ "fx.add",
2232
+ "fx.sub",
2233
+ "fx.mul",
2234
+ "fx.div",
2235
+ "fx.mod",
2236
+ "fx.neg",
2237
+ "fx.eq",
2238
+ "fx.ne",
2239
+ "fx.lt",
2240
+ "fx.lte",
2241
+ "fx.gt",
2242
+ "fx.gte",
2243
+ "fx.autonumber",
2244
+ "fx.created_time",
2245
+ "fx.modified_time"
2246
+ ]);
2247
+ function formulaFunctionNames(kinds) {
2248
+ return [...new Set(kinds.map((row) => row.node))].filter((node) => node.startsWith("fx.") && !NOT_TYPED_BY_NAME.has(node)).map((node) => node.slice(3).toUpperCase()).sort();
2249
+ }
2250
+ var FORMULA_FUNCTION_NAMES = formulaFunctionNames(RULE_NODE_KINDS);
2231
2251
  var RESULT_WORD = {
2232
2252
  number: "a number",
2233
2253
  text: "text",
@@ -2324,7 +2344,7 @@ function FormulaTextEditor({
2324
2344
  text,
2325
2345
  columns,
2326
2346
  mistake: parsed && !parsed.ok ? parsed.error : error ? refusalSentence(error) : null,
2327
- functions: FUNCTION_NAMES,
2347
+ functions: FORMULA_FUNCTION_NAMES,
2328
2348
  onFormula: onText
2329
2349
  }) }) : null
2330
2350
  ] }),
@@ -2371,13 +2391,13 @@ function FormulaTextEditor({
2371
2391
  /* @__PURE__ */ jsx10("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
2372
2392
  columns.map((f) => /* @__PURE__ */ jsx10(Button4, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
2373
2393
  ] }),
2374
- FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ jsxs9("details", { className: "text-[11px] text-muted-foreground", children: [
2394
+ FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ jsxs9("details", { className: "text-[11px] text-muted-foreground", children: [
2375
2395
  /* @__PURE__ */ jsxs9("summary", { className: "cursor-pointer", children: [
2376
2396
  "Functions the store works out (",
2377
- FUNCTION_NAMES.length,
2397
+ FORMULA_FUNCTION_NAMES.length,
2378
2398
  ")"
2379
2399
  ] }),
2380
- /* @__PURE__ */ jsx10("div", { className: "mt-1 flex flex-wrap gap-1", children: FUNCTION_NAMES.map((name) => /* @__PURE__ */ jsx10(Button4, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
2400
+ /* @__PURE__ */ jsx10("div", { className: "mt-1 flex flex-wrap gap-1", children: FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ jsx10(Button4, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
2381
2401
  ] }) : null
2382
2402
  ] });
2383
2403
  }