@nocobase/client 1.2.1-alpha → 1.2.3-alpha

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/es/index.mjs CHANGED
@@ -61,7 +61,7 @@ import { Outlet, UNSAFE_RouteContext, UNSAFE_LocationContext, useRoutes, HashRou
61
61
  import * as nocobaseSDK from "@nocobase/sdk";
62
62
  import { APIClient as APIClient$1, getSubAppName } from "@nocobase/sdk";
63
63
  import * as antd from "antd";
64
- import { notification, Spin, message, Tag, Select as Select$1, theme, App, ConfigProvider, Popover, Menu as Menu$1, Switch, Divider, Button, Result, Tooltip, Input as Input$3, Empty, Modal, Typography, Image, Slider, Space as Space$1, Card, Collapse, Badge, Tree as Tree$2, Dropdown, Alert, Cascader as Cascader$1, Radio as Radio$1, Drawer as Drawer$1, Flex, Tabs as Tabs$1, TreeSelect as TreeSelect$2, Upload as Upload$1, Progress, Table as Table$2, Skeleton, AutoComplete as AutoComplete$1, Checkbox as Checkbox$1, ColorPicker as ColorPicker$1, DatePicker as DatePicker$1, List as List$1, Col, InputNumber as InputNumber$1, Pagination as Pagination$1, TimePicker as TimePicker$1, Row, Popconfirm, Layout } from "antd";
64
+ import { notification, Spin, message, Tag, Select as Select$1, theme, App, ConfigProvider, Popover, Menu as Menu$1, Switch, Divider, Button, Result, Tooltip, Input as Input$3, Empty, Modal, Typography, Image, Slider, Space as Space$1, Card, Collapse, Badge, Tree as Tree$2, Dropdown, Alert, Cascader as Cascader$1, Radio as Radio$1, Drawer as Drawer$1, Flex, Tabs as Tabs$1, TreeSelect as TreeSelect$2, Upload as Upload$1, Progress, Table as Table$2, Skeleton, AutoComplete as AutoComplete$1, Checkbox as Checkbox$1, ColorPicker as ColorPicker$1, DatePicker as DatePicker$1, List as List$1, Col, InputNumber as InputNumber$1, QRCode, Pagination as Pagination$1, TimePicker as TimePicker$1, Row, Popconfirm, Layout } from "antd";
65
65
  import * as formilyShared from "@formily/shared";
66
66
  import { merge, uid, isArr, isFn, applyMiddleware, isNum as isNum$1, isStr, isBool, toArr as toArr$3, isValid, each, isReactElement } from "@formily/shared";
67
67
  import * as ahooks from "ahooks";
@@ -791,7 +791,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
791
791
  return useLinkageAction;
792
792
  },
793
793
  get useStyles() {
794
- return useStyles$5;
794
+ return useStyles$4;
795
795
  },
796
796
  get useTabsContext() {
797
797
  return useTabsContext;
@@ -3397,7 +3397,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3397
3397
  return useSourceIdFromRecord;
3398
3398
  },
3399
3399
  get useStyles() {
3400
- return useStyles$5;
3400
+ return useStyles$4;
3401
3401
  },
3402
3402
  get useSupportedBlocks() {
3403
3403
  return useSupportedBlocks;
@@ -3902,7 +3902,7 @@ function addAppVersion(e, t) {
3902
3902
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
3903
3903
  }), e;
3904
3904
  }
3905
- const name = "@nocobase/client", version$1 = "1.2.1-alpha", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3905
+ const name = "@nocobase/client", version$1 = "1.2.3-alpha", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3906
3906
  "@ahooksjs/use-url-state": "3.5.1",
3907
3907
  "@ant-design/cssinjs": "^1.11.1",
3908
3908
  "@ant-design/icons": "^5.1.4",
@@ -3923,9 +3923,9 @@ const name = "@nocobase/client", version$1 = "1.2.1-alpha", license = "AGPL-3.0"
3923
3923
  "@formily/reactive-react": "^2.2.27",
3924
3924
  "@formily/shared": "^2.2.27",
3925
3925
  "@formily/validator": "^2.2.27",
3926
- "@nocobase/evaluators": "1.2.1-alpha",
3927
- "@nocobase/sdk": "1.2.1-alpha",
3928
- "@nocobase/utils": "1.2.1-alpha",
3926
+ "@nocobase/evaluators": "1.2.3-alpha",
3927
+ "@nocobase/sdk": "1.2.3-alpha",
3928
+ "@nocobase/utils": "1.2.3-alpha",
3929
3929
  ahooks: "^3.7.2",
3930
3930
  antd: "^5.12.8",
3931
3931
  "antd-style": "3.4.5",
@@ -11257,53 +11257,68 @@ const ColDivider = (e) => {
11257
11257
  return useMemo(() => e.reduceProperties((t, o) => (o["x-component"] === "Grid.Col" && !o["x-hidden"] && t.push(o), t), []), [Object.keys(e.properties || {}).join(",")]);
11258
11258
  }, DndWrapper = (e) => e.dndContext === !1 ? /* @__PURE__ */ jsx(Fragment, { children: e.children }) : /* @__PURE__ */ jsx(DndContext, F(g({}, e.dndContext), { children: e.children })), useGridContext = () => useContext(GridContext), useGridRowContext = () => useContext(GridRowContext), Grid = observer$1(
11259
11259
  (e) => {
11260
- const { distributed: t, showDivider: o = !0 } = e, n = useRef(null), r = useField(), i = useFieldSchema(), { render: a } = useSchemaInitializerRender(i["x-initializer"], i["x-initializer-props"]), l = useCallback((x) => a(x), []), c = r.address.toString(), u = useRowProperties(), { setPrintContent: d } = useFormBlockContext(), { styles: p } = useStyles$j(), m = t === void 0 ? (i == null ? void 0 : i.parent["x-component"]) === "Page" || (i == null ? void 0 : i.parent["x-component"]) === "Tabs.TabPane" : t;
11260
+ const { distributed: t, showDivider: o = !0 } = e, n = useRef(null), r = useField(), i = useFieldSchema(), { render: a } = useSchemaInitializerRender(i["x-initializer"], i["x-initializer-props"]), l = useCallback((C) => a(C), []), c = r.address.toString(), u = useRowProperties(), { setPrintContent: d } = useFormBlockContext(), { styles: p } = useStyles$j(), { token: m } = theme.useToken(), { designable: h } = useDesignable(), x = t === void 0 ? (i == null ? void 0 : i.parent["x-component"]) === "Page" || (i == null ? void 0 : i.parent["x-component"]) === "Tabs.TabPane" : t;
11261
11261
  useEffect(() => {
11262
11262
  n.current && (d == null || d(n.current));
11263
11263
  }, [n.current]);
11264
- const h = useMemo(() => ({
11264
+ const f = useMemo(() => ({
11265
11265
  ref: n,
11266
11266
  fieldSchema: i,
11267
11267
  renderSchemaInitializer: a,
11268
11268
  InitializerComponent: l,
11269
11269
  showDivider: o
11270
11270
  }), [i, a, l, o]);
11271
- return /* @__PURE__ */ jsx(FilterBlockProvider, { children: /* @__PURE__ */ jsx(GridContext.Provider, { value: h, children: /* @__PURE__ */ jsx("div", { className: `nb-grid ${p.container}`, style: { position: "relative" }, ref: n, children: /* @__PURE__ */ jsxs("div", { className: "nb-grid-warp", children: [
11272
- /* @__PURE__ */ jsxs(DndWrapper, { dndContext: e.dndContext, children: [
11273
- o ? /* @__PURE__ */ jsx(
11274
- RowDivider,
11275
- {
11276
- rows: u,
11277
- first: !0,
11278
- id: `${c}_0`,
11279
- data: {
11280
- breakRemoveOn: breakRemoveOnGrid,
11281
- wrapSchema: wrapRowSchema,
11282
- insertAdjacent: "afterBegin",
11283
- schema: i
11284
- }
11285
- }
11286
- ) : null,
11287
- u.map((x, f) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
11288
- m ? /* @__PURE__ */ jsx(SchemaComponent, { name: x.name, schema: x, distributed: !0 }) : /* @__PURE__ */ jsx(MemorizedRecursionField, { name: x.name, schema: x }),
11289
- o ? /* @__PURE__ */ jsx(
11290
- RowDivider,
11291
- {
11292
- rows: u,
11293
- index: f,
11294
- id: `${c}_${f + 1}`,
11295
- data: {
11296
- breakRemoveOn: breakRemoveOnGrid,
11297
- wrapSchema: wrapRowSchema,
11298
- insertAdjacent: "afterEnd",
11299
- schema: x
11271
+ return /* @__PURE__ */ jsx(FilterBlockProvider, { children: /* @__PURE__ */ jsx(GridContext.Provider, { value: f, children: /* @__PURE__ */ jsx(
11272
+ "div",
11273
+ {
11274
+ className: cls(
11275
+ `nb-grid ${p.container}`,
11276
+ css`
11277
+ & {
11278
+ margin-bottom: ${h ? 0 : -m.marginLG}px;
11279
+ }
11280
+ `
11281
+ ),
11282
+ style: { position: "relative" },
11283
+ ref: n,
11284
+ children: /* @__PURE__ */ jsxs("div", { className: "nb-grid-warp", children: [
11285
+ /* @__PURE__ */ jsxs(DndWrapper, { dndContext: e.dndContext, children: [
11286
+ o ? /* @__PURE__ */ jsx(
11287
+ RowDivider,
11288
+ {
11289
+ rows: u,
11290
+ first: !0,
11291
+ id: `${c}_0`,
11292
+ data: {
11293
+ breakRemoveOn: breakRemoveOnGrid,
11294
+ wrapSchema: wrapRowSchema,
11295
+ insertAdjacent: "afterBegin",
11296
+ schema: i
11297
+ }
11300
11298
  }
11301
- }
11302
- ) : null
11303
- ] }, f))
11304
- ] }),
11305
- a()
11306
- ] }) }) }) });
11299
+ ) : null,
11300
+ u.map((C, S) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
11301
+ x ? /* @__PURE__ */ jsx(SchemaComponent, { name: C.name, schema: C, distributed: !0 }) : /* @__PURE__ */ jsx(MemorizedRecursionField, { name: C.name, schema: C }),
11302
+ o ? /* @__PURE__ */ jsx(
11303
+ RowDivider,
11304
+ {
11305
+ rows: u,
11306
+ index: S,
11307
+ id: `${c}_${S + 1}`,
11308
+ data: {
11309
+ breakRemoveOn: breakRemoveOnGrid,
11310
+ wrapSchema: wrapRowSchema,
11311
+ insertAdjacent: "afterEnd",
11312
+ schema: C
11313
+ }
11314
+ }
11315
+ ) : null
11316
+ ] }, S))
11317
+ ] }),
11318
+ a()
11319
+ ] })
11320
+ }
11321
+ ) }) });
11307
11322
  },
11308
11323
  { displayName: "Grid" }
11309
11324
  );
@@ -28714,7 +28729,7 @@ const useFieldComponentOptions = () => {
28714
28729
  var l;
28715
28730
  e != null && e.title || (e.title = i((l = r == null ? void 0 : r.uiSchema) == null ? void 0 : l.title));
28716
28731
  }, [(a = r == null ? void 0 : r.uiSchema) == null ? void 0 : a.title]);
28717
- }, getPageHeaderHeight = (e, t, o, n) => e ? n.paddingContentHorizontalLG : o ? n.paddingContentHorizontalLG + 12 : t ? n.paddingSM + n.controlHeight + n.marginXS + 2 * n.controlPaddingHorizontalSM + 22 + n.paddingContentHorizontalLG : n.controlHeight + n.marginXS + (n.paddingXXS + 2) * 2 + n.paddingContentHorizontalLG, usePageFullScreenHeight = (e) => {
28732
+ }, getPageHeaderHeight = (e, t, o, n) => e ? n.paddingContentHorizontalLG : o ? t ? n.controlPaddingHorizontal + 3 * n.controlPaddingHorizontalSM + 22 + n.paddingContentHorizontalLG : n.paddingContentHorizontalLG + 12 : t ? n.paddingSM + n.controlHeight + n.marginXS + 2 * n.controlPaddingHorizontalSM + 22 + n.paddingContentHorizontalLG : n.controlHeight + n.marginXS + (n.paddingXXS + 2) * 2 + n.paddingContentHorizontalLG, usePageFullScreenHeight = (e) => {
28718
28733
  const { token: t } = theme.useToken(), { designable: o } = useDesignable(), { heightProps: n } = useBlockHeightProps(), { disablePageHeader: r, enablePageTabs: i, hidePageTitle: a } = n || e || {}, l = t.sizeXXL - 2, c = o ? t.controlHeight + 2 * t.paddingContentHorizontalLG : 1 * t.paddingContentHorizontalLG, u = getPageHeaderHeight(r, i, a, t);
28719
28734
  return l + u + c;
28720
28735
  }, useFullScreenHeight = (e) => {
@@ -30463,7 +30478,7 @@ const FixedBlockContext = React.createContext({
30463
30478
  }
30464
30479
  },
30465
30480
  ".nb-page-wrapper": {
30466
- padding: `${e.paddingPageVertical}px ${e.paddingPageHorizontal}px 0px ${e.paddingPageHorizontal}px`,
30481
+ padding: `${e.paddingPageVertical}px`,
30467
30482
  flex: 1
30468
30483
  }
30469
30484
  }
@@ -36206,29 +36221,174 @@ function convertToText(e) {
36206
36221
  const n = o.innerText;
36207
36222
  return o = null, (n == null ? void 0 : n.replace(/[\n\r]/g, "")) || "";
36208
36223
  }
36224
+ const useStyles$5 = genStyleHook("nb-variable-select", (e) => {
36225
+ const { componentCls: t } = e;
36226
+ return {
36227
+ [t]: {
36228
+ position: "relative",
36229
+ ".ant-select.ant-cascader": {
36230
+ position: "absolute",
36231
+ top: "-1px",
36232
+ right: "-1px",
36233
+ minWidth: "auto",
36234
+ width: "calc(100% + 2px)",
36235
+ height: "calc(100% + 2px)",
36236
+ overflow: "hidden",
36237
+ opacity: 0
36238
+ },
36239
+ ".variable-btn": {
36240
+ fontStyle: "italic",
36241
+ fontFamily: "'New York', 'Times New Roman', Times, serif"
36242
+ },
36243
+ ".Cascader-popupClassName": {
36244
+ ".ant-cascader-menu": {
36245
+ marginBottom: 0
36246
+ }
36247
+ }
36248
+ }
36249
+ };
36250
+ }), XButton = forwardRef((e, t) => {
36251
+ const o = useMemo(() => ({
36252
+ fontStyle: "italic",
36253
+ fontFamily: "New York, Times New Roman, Times, serif"
36254
+ }), []);
36255
+ return /* @__PURE__ */ jsxs(Button, F(g({ "aria-label": "variable-button", ref: t, style: o }, e), { children: [
36256
+ "x",
36257
+ e.children
36258
+ ] }));
36259
+ });
36260
+ XButton.displayName = "XButton";
36261
+ function VariableSelect({
36262
+ options: e,
36263
+ setOptions: t,
36264
+ onInsert: o,
36265
+ changeOnSelect: n = !1,
36266
+ fieldNames: r = {},
36267
+ className: i
36268
+ }) {
36269
+ const { t: a } = useTranslation(), [l, c] = useState([]), { wrapSSR: u, componentCls: d, hashId: p } = useStyles$5(), { token: m } = useToken();
36270
+ function h(x) {
36271
+ return V(this, null, function* () {
36272
+ var C;
36273
+ const f = x[x.length - 1];
36274
+ !((C = f.children) != null && C.length) && !f.isLeaf && f.loadChildren && (yield f.loadChildren(f), t((S) => [...S]));
36275
+ });
36276
+ }
36277
+ return u(
36278
+ /* @__PURE__ */ jsx(XButton, { className: cx("x-button", d, p, i), children: /* @__PURE__ */ jsx(
36279
+ Cascader$1,
36280
+ {
36281
+ placeholder: a("Select a variable"),
36282
+ value: [],
36283
+ options: e,
36284
+ fieldNames: r,
36285
+ loadData: h,
36286
+ onChange: (x = [], f = []) => {
36287
+ var S;
36288
+ if (c(x), !x.length)
36289
+ return;
36290
+ const C = f[f.length - 1];
36291
+ (!((S = C == null ? void 0 : C.children) != null && S.length) && !(C != null && C.loadChildren) || C != null && C.isLeaf) && o(x);
36292
+ },
36293
+ changeOnSelect: n,
36294
+ onClick: (x) => {
36295
+ var f;
36296
+ if (!(x.detail !== 2 || !n))
36297
+ for (let C = x.target; C && C !== x.currentTarget; C = C.parentNode)
36298
+ Array.from((f = C.classList) != null ? f : []).includes("ant-cascader-menu-item") && o(l);
36299
+ },
36300
+ popupClassName: "Cascader-popupClassName",
36301
+ dropdownRender: n ? (x) => /* @__PURE__ */ jsxs(Fragment, { children: [
36302
+ x,
36303
+ /* @__PURE__ */ jsx(
36304
+ "div",
36305
+ {
36306
+ style: {
36307
+ padding: "0.5em",
36308
+ borderTop: `1px solid ${m.colorBorder}`,
36309
+ color: m.colorTextDescription
36310
+ },
36311
+ children: a("Double click to choose entire object")
36312
+ }
36313
+ )
36314
+ ] }) : null
36315
+ }
36316
+ ) })
36317
+ );
36318
+ }
36319
+ class QRCodeWebComponent extends HTMLElement {
36320
+ constructor() {
36321
+ super();
36322
+ P(this, "root");
36323
+ this.attachShadow({ mode: "open" }), this.root = null;
36324
+ }
36325
+ getProps(o, n = {}) {
36326
+ return [...o].filter((r) => r.name !== "style").map((r) => this.convert(n, r.name, r.value)).reduce((r, i) => F(g({}, r), { [i.name]: i.value }), {});
36327
+ }
36328
+ convert(o, n, r) {
36329
+ const i = Object.keys(o).find((l) => l.toLowerCase() == n);
36330
+ let a = r;
36331
+ return r === "true" || r === "false" ? a = r == "true" : !isNaN(r) && r !== "" ? a = +r : /^{.*}/.exec(r) && (a = JSON.parse(r)), {
36332
+ name: i || n,
36333
+ value: a
36334
+ };
36335
+ }
36336
+ connectedCallback() {
36337
+ const o = g({}, this.getProps(this.attributes));
36338
+ this.root = createRoot$1(this.shadowRoot), this.root.render(/* @__PURE__ */ jsx(QRCode, g({}, o)));
36339
+ }
36340
+ disconnectedCallback() {
36341
+ this.root.unmount();
36342
+ }
36343
+ }
36344
+ function registerQrcodeWebComponent() {
36345
+ customElements.get("qr-code") || customElements.define("qr-code", QRCodeWebComponent);
36346
+ }
36209
36347
  const MarkdownEditor = (e) => {
36210
- const { t } = useTranslation(), [o, n] = useState(e.defaultValue);
36211
- return /* @__PURE__ */ jsxs("div", { className: "mb-markdown", style: { position: "relative" }, children: [
36348
+ const { scope: t } = e, { t: o } = useTranslation(), [n, r] = useState(e.defaultValue), i = useRef(null), [a, l] = useState([]), [c, u] = useState(null);
36349
+ useEffect(() => {
36350
+ l(t);
36351
+ }, [t]), useEffect(() => {
36352
+ var m, h;
36353
+ const p = (h = (m = i == null ? void 0 : i.current) == null ? void 0 : m.resizableTextArea) == null ? void 0 : h.textArea;
36354
+ c && p && p.setSelectionRange(c, c);
36355
+ }, [c]);
36356
+ const d = useCallback(
36357
+ function(p) {
36358
+ var y;
36359
+ const m = p.filter((v) => !!v.trim()), { current: h } = i, x = (y = h == null ? void 0 : h.resizableTextArea) == null ? void 0 : y.textArea;
36360
+ if (!x || !m)
36361
+ return;
36362
+ h.focus();
36363
+ const f = `{{${p.join(".")}}}`, C = x.selectionStart || 0, S = n.substring(0, C) + f + n.substring(C, n.length), b = C + f.length;
36364
+ r(S), u(b);
36365
+ },
36366
+ [n]
36367
+ );
36368
+ return /* @__PURE__ */ jsxs("div", { className: "mb-markdown", style: { position: "relative", paddingTop: "20px" }, children: [
36212
36369
  /* @__PURE__ */ jsx(
36213
36370
  Input$3.TextArea,
36214
36371
  F(g({
36372
+ ref: i,
36215
36373
  autoSize: { minRows: 3 }
36216
36374
  }, e), {
36217
- value: o,
36218
- onChange: (r) => {
36219
- n(r.target.value);
36220
- }
36375
+ value: n,
36376
+ onChange: (p) => {
36377
+ r(p.target.value);
36378
+ },
36379
+ style: { paddingBottom: "40px" }
36221
36380
  })
36222
36381
  ),
36382
+ /* @__PURE__ */ jsx("div", { style: { position: "absolute", top: 21, right: 1 }, children: /* @__PURE__ */ jsx(VariableSelect, { options: a, setOptions: l, onInsert: d }) }),
36223
36383
  /* @__PURE__ */ jsxs(Space$1, { style: { position: "absolute", bottom: 5, right: 5 }, children: [
36224
36384
  /* @__PURE__ */ jsx(
36225
36385
  Button,
36226
36386
  {
36227
- onClick: (r) => {
36228
- var i;
36229
- (i = e.onCancel) == null || i.call(e, r);
36387
+ onClick: (p) => {
36388
+ var m;
36389
+ (m = e.onCancel) == null || m.call(e, p);
36230
36390
  },
36231
- children: t("Cancel")
36391
+ children: o("Cancel")
36232
36392
  }
36233
36393
  ),
36234
36394
  /* @__PURE__ */ jsx(
@@ -36236,10 +36396,10 @@ const MarkdownEditor = (e) => {
36236
36396
  {
36237
36397
  type: "primary",
36238
36398
  onClick: () => {
36239
- var r;
36240
- (r = e.onSubmit) == null || r.call(e, o);
36399
+ var p;
36400
+ (p = e.onSubmit) == null || p.call(e, n);
36241
36401
  },
36242
- children: t("Save")
36402
+ children: o("Save")
36243
36403
  }
36244
36404
  )
36245
36405
  ] })
@@ -36248,24 +36408,41 @@ const MarkdownEditor = (e) => {
36248
36408
  const { token: e } = theme.useToken(), t = useBlockHeight();
36249
36409
  if (t)
36250
36410
  return t - 2 * e.paddingLG;
36251
- }, MarkdownVoid = observer$1(
36252
- (e) => {
36253
- const { isDarkTheme: t } = useGlobalTheme(), { componentCls: o, hashId: n } = useStyles$6({ isDarkTheme: t }), { content: r, className: i } = e, a = useField(), l = useFieldSchema(), { dn: c } = useDesignable(), { onSave: u, onCancel: d } = e, { html: p, loading: m } = useParseMarkdown(r), h = useMarkdownHeight();
36254
- return m ? /* @__PURE__ */ jsx(Spin, {}) : a != null && a.editable ? /* @__PURE__ */ jsx(
36411
+ }, MarkdownVoid = withDynamicSchemaProps(
36412
+ observer$1((e) => {
36413
+ const { isDarkTheme: t } = useGlobalTheme(), { componentCls: o, hashId: n } = useStyles$6({ isDarkTheme: t }), { content: r, className: i } = e, a = useField(), l = useFieldSchema(), { dn: c } = useDesignable(), { onSave: u, onCancel: d, form: p } = e, m = useCollectionRecord(), [h, x] = useState(""), f = useVariables(), C = useLocalVariables(), [S, b] = useState(!1);
36414
+ useEffect(() => {
36415
+ b(!0), V(void 0, null, function* () {
36416
+ const A = yield replaceVariableValue(r, f, C), T = yield parseMarkdown(A);
36417
+ x(T), b(!1);
36418
+ });
36419
+ }, [r, f, C]);
36420
+ const y = useMarkdownHeight(), v = useVariableOptions({
36421
+ collectionField: { uiSchema: l },
36422
+ form: p,
36423
+ record: m,
36424
+ uiSchema: l,
36425
+ noDisabled: !0
36426
+ });
36427
+ return useEffect(() => {
36428
+ registerQrcodeWebComponent();
36429
+ }, []), S ? /* @__PURE__ */ jsx(Spin, {}) : a != null && a.editable ? /* @__PURE__ */ jsx(
36255
36430
  MarkdownEditor,
36256
- F(g({}, e), {
36431
+ F(g({
36432
+ scope: v
36433
+ }, e), {
36257
36434
  className: !0,
36258
36435
  defaultValue: r,
36259
36436
  onCancel: () => {
36260
36437
  a.editable = !1, d == null || d();
36261
36438
  },
36262
- onSubmit: (x) => V(void 0, null, function* () {
36263
- var f;
36264
- a.editable = !1, (f = l["x-component-props"]) != null || (l["x-component-props"] = {}), l["x-component-props"].content = x, a.componentProps.content = x, u == null || u(l), c.emit("patch", {
36439
+ onSubmit: (I) => V(void 0, null, function* () {
36440
+ var A;
36441
+ a.editable = !1, (A = l["x-component-props"]) != null || (l["x-component-props"] = {}), l["x-component-props"].content = I, a.componentProps.content = I, u == null || u(l), c.emit("patch", {
36265
36442
  schema: {
36266
36443
  "x-uid": l["x-uid"],
36267
36444
  "x-component-props": {
36268
- content: x
36445
+ content: I
36269
36446
  }
36270
36447
  }
36271
36448
  });
@@ -36275,11 +36452,11 @@ const MarkdownEditor = (e) => {
36275
36452
  "div",
36276
36453
  {
36277
36454
  className: cls([o, n, "nb-markdown nb-markdown-default nb-markdown-table", i]),
36278
- style: F(g({}, e.style), { height: h || "100%", overflow: "auto" }),
36279
- dangerouslySetInnerHTML: { __html: p }
36455
+ style: F(g({}, e.style), { height: y || "100%" }),
36456
+ dangerouslySetInnerHTML: { __html: h }
36280
36457
  }
36281
36458
  );
36282
- },
36459
+ }),
36283
36460
  { displayName: "MarkdownVoid" }
36284
36461
  );
36285
36462
  MarkdownVoid.Designer = MarkdownVoidDesigner;
@@ -37111,7 +37288,7 @@ Menu.SubMenu = observer$1(
37111
37288
  { displayName: "Menu.SubMenu" }
37112
37289
  );
37113
37290
  Menu.Designer = MenuDesigner;
37114
- const useStyles$5 = createStyles(({ token: e }) => ({
37291
+ const useStyles$4 = createStyles(({ token: e }) => ({
37115
37292
  menuItem: {
37116
37293
  paddingLeft: `${e.padding}px !important`,
37117
37294
  paddingRight: `${e.padding}px !important`
@@ -37534,7 +37711,7 @@ RecordPicker.Selector = ActionContainer;
37534
37711
  * Copyright (c) 2014, Jason Chen
37535
37712
  * Copyright (c) 2013, salesforce.com
37536
37713
  */
37537
- const useStyles$4 = genStyleHook("nb-rich-text", (e) => {
37714
+ const useStyles$3 = genStyleHook("nb-rich-text", (e) => {
37538
37715
  const { componentCls: t } = e;
37539
37716
  return {
37540
37717
  [t]: {
@@ -38166,7 +38343,7 @@ const useStyles$4 = genStyleHook("nb-rich-text", (e) => {
38166
38343
  };
38167
38344
  }), RichText = connect(
38168
38345
  (e) => {
38169
- const { wrapSSR: t, hashId: o, componentCls: n } = useStyles$4(), r = {
38346
+ const { wrapSSR: t, hashId: o, componentCls: n } = useStyles$3(), r = {
38170
38347
  toolbar: [["bold", "italic", "underline", "link"], [{ list: "ordered" }, { list: "bullet" }], ["clean"]]
38171
38348
  }, i = [
38172
38349
  "header",
@@ -39487,18 +39664,7 @@ const ReadPretty = observer$1(
39487
39664
  })
39488
39665
  ),
39489
39666
  mapReadPretty(ReadPretty)
39490
- ), XButton = forwardRef((e, t) => {
39491
- const o = useMemo(() => ({
39492
- fontStyle: "italic",
39493
- fontFamily: "New York, Times New Roman, Times, serif"
39494
- }), []);
39495
- return /* @__PURE__ */ jsxs(Button, F(g({ "aria-label": "variable-button", ref: t, style: o }, e), { children: [
39496
- "x",
39497
- e.children
39498
- ] }));
39499
- });
39500
- XButton.displayName = "XButton";
39501
- const useStyles$3 = genStyleHook("nb-variable", (e) => {
39667
+ ), useStyles$2 = genStyleHook("nb-variable", (e) => {
39502
39668
  const { componentCls: t, lineWidth: o, colorFillQuaternary: n } = e, r = e.paddingSM - 1, a = 8 - o, l = e.fontSizeSM, c = `${e.lineHeightSM * l}px`, u = n;
39503
39669
  return {
39504
39670
  [t]: {
@@ -39690,7 +39856,7 @@ function Input(e) {
39690
39856
  className: l,
39691
39857
  changeOnSelect: c,
39692
39858
  fieldNames: u
39693
- } = e, d = typeof e.scope == "function" ? e.scope() : e.scope, { wrapSSR: p, hashId: m, componentCls: h, rootPrefixCls: x } = useStyles$3();
39859
+ } = e, d = typeof e.scope == "function" ? e.scope() : e.scope, { wrapSSR: p, hashId: m, componentCls: h, rootPrefixCls: x } = useStyles$2();
39694
39860
  useAntdInputStyle(`${x}-input`);
39695
39861
  const f = useCompile(), { t: C } = useTranslation(), S = useForm(), [b, y] = React.useState([]), [v, I] = React.useState([]), A = useMemo(() => parseValue(t), [t]), T = typeof A == "string", w = T ? A : "", M = T ? null : A, $ = Object.assign(
39696
39862
  {
@@ -39811,10 +39977,10 @@ function Input(e) {
39811
39977
  className: cx("ant-input", { "ant-input-disabled": j }, m),
39812
39978
  contentEditable: !j,
39813
39979
  suppressContentEditableWarning: !0,
39814
- children: /* @__PURE__ */ jsx(Tag, { contentEditable: !1, color: "blue", children: v.map((D, N) => /* @__PURE__ */ jsxs(Fragment, { children: [
39980
+ children: /* @__PURE__ */ jsx(Tag, { contentEditable: !1, color: "blue", children: v.map((D, N) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
39815
39981
  N ? " / " : "",
39816
39982
  D
39817
- ] })) })
39983
+ ] }, D)) })
39818
39984
  }
39819
39985
  ),
39820
39986
  j ? null : /* @__PURE__ */ jsx(
@@ -39855,91 +40021,6 @@ function Input(e) {
39855
40021
  ] })
39856
40022
  );
39857
40023
  }
39858
- const useStyles$2 = genStyleHook("nb-variable-select", (e) => {
39859
- const { componentCls: t } = e;
39860
- return {
39861
- [t]: {
39862
- position: "relative",
39863
- ".ant-select.ant-cascader": {
39864
- position: "absolute",
39865
- top: "-1px",
39866
- right: "-1px",
39867
- minWidth: "auto",
39868
- width: "calc(100% + 2px)",
39869
- height: "calc(100% + 2px)",
39870
- overflow: "hidden",
39871
- opacity: 0
39872
- },
39873
- ".variable-btn": {
39874
- fontStyle: "italic",
39875
- fontFamily: "'New York', 'Times New Roman', Times, serif"
39876
- },
39877
- ".Cascader-popupClassName": {
39878
- ".ant-cascader-menu": {
39879
- marginBottom: 0
39880
- }
39881
- }
39882
- }
39883
- };
39884
- });
39885
- function VariableSelect({
39886
- options: e,
39887
- setOptions: t,
39888
- onInsert: o,
39889
- changeOnSelect: n = !1,
39890
- fieldNames: r = {},
39891
- className: i
39892
- }) {
39893
- const { t: a } = useTranslation(), [l, c] = useState([]), { wrapSSR: u, componentCls: d, hashId: p } = useStyles$2(), { token: m } = useToken();
39894
- function h(x) {
39895
- return V(this, null, function* () {
39896
- var C;
39897
- const f = x[x.length - 1];
39898
- !((C = f.children) != null && C.length) && !f.isLeaf && f.loadChildren && (yield f.loadChildren(f), t((S) => [...S]));
39899
- });
39900
- }
39901
- return u(
39902
- /* @__PURE__ */ jsx(XButton, { className: cx("x-button", d, p, i), children: /* @__PURE__ */ jsx(
39903
- Cascader$1,
39904
- {
39905
- placeholder: a("Select a variable"),
39906
- value: [],
39907
- options: e,
39908
- fieldNames: r,
39909
- loadData: h,
39910
- onChange: (x = [], f = []) => {
39911
- var S;
39912
- if (c(x), !x.length)
39913
- return;
39914
- const C = f[f.length - 1];
39915
- (!((S = C == null ? void 0 : C.children) != null && S.length) && !(C != null && C.loadChildren) || C != null && C.isLeaf) && o(x);
39916
- },
39917
- changeOnSelect: n,
39918
- onClick: (x) => {
39919
- var f;
39920
- if (!(x.detail !== 2 || !n))
39921
- for (let C = x.target; C && C !== x.currentTarget; C = C.parentNode)
39922
- Array.from((f = C.classList) != null ? f : []).includes("ant-cascader-menu-item") && o(l);
39923
- },
39924
- popupClassName: "Cascader-popupClassName",
39925
- dropdownRender: n ? (x) => /* @__PURE__ */ jsxs(Fragment, { children: [
39926
- x,
39927
- /* @__PURE__ */ jsx(
39928
- "div",
39929
- {
39930
- style: {
39931
- padding: "0.5em",
39932
- borderTop: `1px solid ${m.colorBorder}`,
39933
- color: m.colorTextDescription
39934
- },
39935
- children: a("Double click to choose entire object")
39936
- }
39937
- )
39938
- ] }) : null
39939
- }
39940
- ) })
39941
- );
39942
- }
39943
40024
  function setNativeInputValue(e, t) {
39944
40025
  var n;
39945
40026
  const o = (n = Object.getOwnPropertyDescriptor(e.constructor.prototype, "value")) == null ? void 0 : n.set;
@@ -40097,7 +40178,7 @@ function getCurrentRange(e) {
40097
40178
  ];
40098
40179
  }
40099
40180
  function TextArea(e) {
40100
- const { wrapSSR: t, hashId: o, componentCls: n } = useStyles$3(), { value: r = "", scope: i, onChange: a, multiline: l = !0, changeOnSelect: c, style: u } = e, d = useRef(null), [p, m] = useState([]), h = useForm(), x = useMemo(() => createOptionsValueLabelMap(p), [p]), [f, C] = useState(!1), [S, b] = useState(!1), [y, v] = useState(() => renderHTML(r != null ? r : "", x)), [I, A] = useState([-1, 0, -1, 0]);
40181
+ const { wrapSSR: t, hashId: o, componentCls: n } = useStyles$2(), { value: r = "", scope: i, onChange: a, multiline: l = !0, changeOnSelect: c, style: u } = e, d = useRef(null), [p, m] = useState([]), h = useForm(), x = useMemo(() => createOptionsValueLabelMap(p), [p]), [f, C] = useState(!1), [S, b] = useState(!1), [y, v] = useState(() => renderHTML(r != null ? r : "", x)), [I, A] = useState([-1, 0, -1, 0]);
40101
40182
  useAntdInputStyle("ant-input"), useEffect(() => {
40102
40183
  preloadOptions(i, r).then((j) => {
40103
40184
  m(j);
@@ -55352,7 +55433,7 @@ const commonOptions$e = {
55352
55433
  const e = {}, t = useSchemaInitializerItem();
55353
55434
  return /* @__PURE__ */ jsx(InitializerWithSwitch, F(g({}, t), { schema: e, item: t, type: "x-collection-field" }));
55354
55435
  }, LinkMenuItem = () => {
55355
- const { insert: e } = useSchemaInitializer(), { t } = useTranslation(), o = useContext(SchemaOptionsContext), { theme: n } = useGlobalTheme(), { styles: r } = useStyles$5(), i = useCallback(() => V(void 0, null, function* () {
55436
+ const { insert: e } = useSchemaInitializer(), { t } = useTranslation(), o = useContext(SchemaOptionsContext), { theme: n } = useGlobalTheme(), { styles: r } = useStyles$4(), i = useCallback(() => V(void 0, null, function* () {
55356
55437
  const a = yield FormDialog(
55357
55438
  t("Add link"),
55358
55439
  () => /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: o.scope, components: g({}, o.components), children: /* @__PURE__ */ jsx(FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsx(
@@ -55407,7 +55488,7 @@ const commonOptions$e = {
55407
55488
  }), [e, o.components, o.scope, t, n]);
55408
55489
  return /* @__PURE__ */ jsx(SchemaInitializerItem, { title: t("Link"), onClick: i, className: r.menuItem });
55409
55490
  }, PageMenuItem = () => {
55410
- const { insert: e } = useSchemaInitializer(), { t } = useTranslation(), o = useContext(SchemaOptionsContext), { theme: n } = useGlobalTheme(), { styles: r } = useStyles$5(), i = useCallback(() => V(void 0, null, function* () {
55491
+ const { insert: e } = useSchemaInitializer(), { t } = useTranslation(), o = useContext(SchemaOptionsContext), { theme: n } = useGlobalTheme(), { styles: r } = useStyles$4(), i = useCallback(() => V(void 0, null, function* () {
55411
55492
  const a = yield FormDialog(
55412
55493
  t("Add page"),
55413
55494
  () => /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: o.scope, components: g({}, o.components), children: /* @__PURE__ */ jsx(FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsx(
@@ -55471,7 +55552,7 @@ const commonOptions$e = {
55471
55552
  }), [e, o.components, o.scope, t, n]);
55472
55553
  return /* @__PURE__ */ jsx(SchemaInitializerItem, { title: t("Page"), onClick: i, className: r.menuItem });
55473
55554
  }, GroupItem = () => {
55474
- const { insert: e } = useSchemaInitializer(), { t } = useTranslation(), o = useContext(SchemaOptionsContext), { theme: n } = useGlobalTheme(), { styles: r } = useStyles$5(), i = useCallback(() => V(void 0, null, function* () {
55555
+ const { insert: e } = useSchemaInitializer(), { t } = useTranslation(), o = useContext(SchemaOptionsContext), { theme: n } = useGlobalTheme(), { styles: r } = useStyles$4(), i = useCallback(() => V(void 0, null, function* () {
55475
55556
  const a = yield FormDialog(
55476
55557
  t("Add group"),
55477
55558
  () => /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: o.scope, components: g({}, o.components), children: /* @__PURE__ */ jsx(FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsx(
@@ -57254,7 +57335,7 @@ export {
57254
57335
  useSortFields,
57255
57336
  useSourceIdFromParentRecord,
57256
57337
  useSourceIdFromRecord,
57257
- useStyles$5 as useStyles,
57338
+ useStyles$4 as useStyles,
57258
57339
  useSupportedBlocks,
57259
57340
  useSyncFromForm,
57260
57341
  useSystemSettings,
@@ -9,6 +9,7 @@
9
9
  import React from 'react';
10
10
  import { TextAreaProps } from 'antd/es/input';
11
11
  export interface MarkdownEditorProps extends Omit<TextAreaProps, 'onSubmit'> {
12
+ scope: any[];
12
13
  defaultValue?: string;
13
14
  onSubmit?: (value: string) => void;
14
15
  onCancel?: (e: React.MouseEvent) => void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare function registerQrcodeWebComponent(): void;