@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/CHANGELOG.md +6 -0
- package/dist/index.cjs +253 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +131 -111
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +26 -6
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4735,10 +4735,30 @@ import {
|
|
|
4735
4735
|
// src/FormulaTextEditor.tsx
|
|
4736
4736
|
import { useEffect as useEffect11, useMemo as useMemo8, useRef as useRef8, useState as useState13 } from "react";
|
|
4737
4737
|
import { useRecordsClient as useRecordsClient6 } from "@ai-matrx/records/react";
|
|
4738
|
-
import {
|
|
4738
|
+
import { RULE_NODE_KINDS } from "@ai-matrx/records";
|
|
4739
4739
|
import { BasicTextarea, Button as Button7, Label as Label2, cn as cn12 } from "@ai-matrx/design-system";
|
|
4740
4740
|
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4741
|
-
var
|
|
4741
|
+
var NOT_TYPED_BY_NAME = /* @__PURE__ */ new Set([
|
|
4742
|
+
"fx.add",
|
|
4743
|
+
"fx.sub",
|
|
4744
|
+
"fx.mul",
|
|
4745
|
+
"fx.div",
|
|
4746
|
+
"fx.mod",
|
|
4747
|
+
"fx.neg",
|
|
4748
|
+
"fx.eq",
|
|
4749
|
+
"fx.ne",
|
|
4750
|
+
"fx.lt",
|
|
4751
|
+
"fx.lte",
|
|
4752
|
+
"fx.gt",
|
|
4753
|
+
"fx.gte",
|
|
4754
|
+
"fx.autonumber",
|
|
4755
|
+
"fx.created_time",
|
|
4756
|
+
"fx.modified_time"
|
|
4757
|
+
]);
|
|
4758
|
+
function formulaFunctionNames(kinds) {
|
|
4759
|
+
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();
|
|
4760
|
+
}
|
|
4761
|
+
var FORMULA_FUNCTION_NAMES = formulaFunctionNames(RULE_NODE_KINDS);
|
|
4742
4762
|
var RESULT_WORD = {
|
|
4743
4763
|
number: "a number",
|
|
4744
4764
|
text: "text",
|
|
@@ -4835,7 +4855,7 @@ function FormulaTextEditor({
|
|
|
4835
4855
|
text,
|
|
4836
4856
|
columns,
|
|
4837
4857
|
mistake: parsed && !parsed.ok ? parsed.error : error ? refusalSentence(error) : null,
|
|
4838
|
-
functions:
|
|
4858
|
+
functions: FORMULA_FUNCTION_NAMES,
|
|
4839
4859
|
onFormula: onText
|
|
4840
4860
|
}) }) : null
|
|
4841
4861
|
] }),
|
|
@@ -4882,13 +4902,13 @@ function FormulaTextEditor({
|
|
|
4882
4902
|
/* @__PURE__ */ jsx16("span", { className: "text-[11px] text-muted-foreground", children: "Columns:" }),
|
|
4883
4903
|
columns.map((f) => /* @__PURE__ */ jsx16(Button7, { type: "button", size: "sm", variant: "outline", className: "h-6 px-1.5 text-[11px]", onClick: () => insert(`{${fieldName(f)}}`), children: fieldName(f) }, f.id))
|
|
4884
4904
|
] }),
|
|
4885
|
-
|
|
4905
|
+
FORMULA_FUNCTION_NAMES.length > 0 ? /* @__PURE__ */ jsxs14("details", { className: "text-[11px] text-muted-foreground", children: [
|
|
4886
4906
|
/* @__PURE__ */ jsxs14("summary", { className: "cursor-pointer", children: [
|
|
4887
4907
|
"Functions the store works out (",
|
|
4888
|
-
|
|
4908
|
+
FORMULA_FUNCTION_NAMES.length,
|
|
4889
4909
|
")"
|
|
4890
4910
|
] }),
|
|
4891
|
-
/* @__PURE__ */ jsx16("div", { className: "mt-1 flex flex-wrap gap-1", children:
|
|
4911
|
+
/* @__PURE__ */ jsx16("div", { className: "mt-1 flex flex-wrap gap-1", children: FORMULA_FUNCTION_NAMES.map((name) => /* @__PURE__ */ jsx16(Button7, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 font-mono text-[11px]", onClick: () => insert(`${name}()`), children: name }, name)) })
|
|
4892
4912
|
] }) : null
|
|
4893
4913
|
] });
|
|
4894
4914
|
}
|