@nocobase/client 1.0.0-alpha.12 → 1.0.0-alpha.13

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.
@@ -9,7 +9,8 @@
9
9
  import { ButtonProps } from 'antd';
10
10
  import React from 'react';
11
11
  import { SchemaInitializerOptions } from '../types';
12
- export declare function useSchemaInitializerRender<P1 = ButtonProps, P2 = {}>(name: string, options?: Omit<SchemaInitializerOptions<P1, P2>, 'name'>): {
12
+ import { SchemaInitializer } from '../SchemaInitializer';
13
+ export declare function useSchemaInitializerRender<P1 = ButtonProps, P2 = {}>(name: string | SchemaInitializer<P1, P2>, options?: Omit<SchemaInitializerOptions<P1, P2>, 'name'>): {
13
14
  exists: boolean;
14
15
  render: () => any;
15
16
  } | {
@@ -12,12 +12,13 @@ import { SchemaSettingsProps } from '../../../schema-settings';
12
12
  import { Schema } from '@formily/json-schema';
13
13
  import { GeneralField } from '@formily/core';
14
14
  import { Designable } from '../../../schema-component';
15
+ import { SchemaSettings } from '../SchemaSettings';
15
16
  type UseSchemaSettingsRenderOptions<T = {}> = Omit<SchemaSettingOptions<T>, 'name' | 'items'> & Omit<SchemaSettingsProps, 'title' | 'children'> & {
16
17
  fieldSchema?: Schema;
17
18
  field?: GeneralField;
18
19
  dn?: Designable;
19
20
  };
20
- export declare function useSchemaSettingsRender<T = {}>(name: string, options?: UseSchemaSettingsRenderOptions<T>): {
21
+ export declare function useSchemaSettingsRender<T = {}>(name: string | SchemaSettings<T>, options?: UseSchemaSettingsRenderOptions<T>): {
21
22
  exists: boolean;
22
23
  render: () => any;
23
24
  } | {
package/es/index.mjs CHANGED
@@ -3779,7 +3779,7 @@ function addAppVersion(e, t) {
3779
3779
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
3780
3780
  }), e;
3781
3781
  }
3782
- const name = "@nocobase/client", version$1 = "1.0.0-alpha.12", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3782
+ const name = "@nocobase/client", version$1 = "1.0.0-alpha.13", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3783
3783
  "@ahooksjs/use-url-state": "3.5.1",
3784
3784
  "@ant-design/cssinjs": "^1.11.1",
3785
3785
  "@ant-design/icons": "^5.1.4",
@@ -3800,9 +3800,9 @@ const name = "@nocobase/client", version$1 = "1.0.0-alpha.12", license = "AGPL-3
3800
3800
  "@formily/reactive-react": "^2.2.27",
3801
3801
  "@formily/shared": "^2.2.27",
3802
3802
  "@formily/validator": "^2.2.27",
3803
- "@nocobase/evaluators": "1.0.0-alpha.12",
3804
- "@nocobase/sdk": "1.0.0-alpha.12",
3805
- "@nocobase/utils": "1.0.0-alpha.12",
3803
+ "@nocobase/evaluators": "1.0.0-alpha.13",
3804
+ "@nocobase/sdk": "1.0.0-alpha.13",
3805
+ "@nocobase/utils": "1.0.0-alpha.13",
3806
3806
  ahooks: "^3.7.2",
3807
3807
  antd: "^5.12.8",
3808
3808
  "antd-style": "3.4.5",
@@ -3815,7 +3815,7 @@ const name = "@nocobase/client", version$1 = "1.0.0-alpha.12", license = "AGPL-3
3815
3815
  i18next: "^22.4.9",
3816
3816
  "i18next-http-backend": "^2.1.1",
3817
3817
  lodash: "4.17.21",
3818
- "markdown-it": "13.0.1",
3818
+ "markdown-it": "14.1.0",
3819
3819
  "markdown-it-highlightjs": "3.3.1",
3820
3820
  mathjs: "^10.6.0",
3821
3821
  mermaid: "9.4.3",
@@ -3840,7 +3840,7 @@ const name = "@nocobase/client", version$1 = "1.0.0-alpha.12", license = "AGPL-3
3840
3840
  "react-is": ">=18.0.0"
3841
3841
  }, devDependencies = {
3842
3842
  "@testing-library/react": "^14.0.0",
3843
- "@types/markdown-it": "12.2.3",
3843
+ "@types/markdown-it": "14.1.1",
3844
3844
  "@types/markdown-it-highlightjs": "3.3.1",
3845
3845
  "@types/react-big-calendar": "^1.6.4",
3846
3846
  "axios-mock-adapter": "^1.20.0",
@@ -6037,7 +6037,7 @@ const InitializerComponent = React.memo((e) => {
6037
6037
  InitializerComponent.displayName = "InitializerComponent";
6038
6038
  function useSchemaInitializerRender(e, t) {
6039
6039
  const o = useApp(), n = useMemo(
6040
- () => o.schemaInitializerManager.get(e),
6040
+ () => typeof e == "object" ? e : o.schemaInitializerManager.get(e),
6041
6041
  [o.schemaInitializerManager, e]
6042
6042
  );
6043
6043
  return useMemo(() => e ? n ? {
@@ -17185,7 +17185,10 @@ const SchemaSettingsWrapper = (e) => {
17185
17185
  );
17186
17186
  };
17187
17187
  function useSchemaSettingsRender(e, t) {
17188
- const o = useApp(), n = useMemo(() => o.schemaSettingsManager.get(e), [o.schemaSettingsManager, e]);
17188
+ const o = useApp(), n = useMemo(
17189
+ () => typeof e == "object" ? e : o.schemaSettingsManager.get(e),
17190
+ [o.schemaSettingsManager, e]
17191
+ );
17189
17192
  return e ? n ? {
17190
17193
  exists: !0,
17191
17194
  render: (r = {}) => React.createElement(SchemaSettingsWrapper, x(x(x({}, n.options), t), r))
@@ -19641,10 +19644,10 @@ const useStyles$f = createStyles(() => ({
19641
19644
  return o.map((M) => u(M));
19642
19645
  }
19643
19646
  }, [u, o]), { render: y, exists: b } = useSchemaSettingsRender(
19644
- t["x-settings"] || r,
19647
+ r || t["x-settings"],
19645
19648
  t["x-settings-props"]
19646
19649
  ), { render: S, exists: v } = useSchemaInitializerRender(
19647
- t["x-initializer"] || n,
19650
+ n || t["x-initializer"],
19648
19651
  t["x-initializer-props"]
19649
19652
  ), k = useGridRowContext(), A = useGridContext(), P = useMemo(() => {
19650
19653
  var M;
@@ -33099,7 +33102,24 @@ const AutoComplete = withDynamicSchemaProps(
33099
33102
  return /* @__PURE__ */ jsx(Card, F(x({ ref: o, bordered: !1, style: { marginBottom: i.marginBlock } }, t), { children: e }));
33100
33103
  });
33101
33104
  BlockItemCard.displayName = "BlockItemCard";
33102
- const FallbackComponent = (e) => /* @__PURE__ */ jsx(BlockItemCard, { children: /* @__PURE__ */ jsx(ErrorFallback, x({}, e)) }), BlockItemError = ({ children: e }) => /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent, onError: (o) => {
33105
+ const blockDeleteSettings = new SchemaSettings({
33106
+ name: "blockDeleteSettings",
33107
+ items: [
33108
+ {
33109
+ name: "remove",
33110
+ type: "remove",
33111
+ componentProps: {
33112
+ removeParentsIfNoChildren: !0,
33113
+ breakRemoveOn(e) {
33114
+ return e["x-component"] === "Grid";
33115
+ }
33116
+ }
33117
+ }
33118
+ ]
33119
+ }), FallbackComponent = (e) => /* @__PURE__ */ jsxs(BlockItemCard, { children: [
33120
+ /* @__PURE__ */ jsx(SchemaToolbar, { settings: blockDeleteSettings, draggable: !1 }),
33121
+ /* @__PURE__ */ jsx(ErrorFallback, x({}, e))
33122
+ ] }), BlockItemError = ({ children: e }) => /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent, onError: (o) => {
33103
33123
  console.error(o);
33104
33124
  }, children: e }), useStyles$a = genStyleHook("nb-card-item", (e) => {
33105
33125
  const { componentCls: t } = e;
@@ -7,6 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { FC } from 'react';
10
+ import { SchemaInitializer, SchemaSettings } from '../application';
10
11
  export interface GeneralSchemaDesignerProps {
11
12
  disableInitializer?: boolean;
12
13
  title?: string;
@@ -26,8 +27,8 @@ export declare const GeneralSchemaDesigner: FC<GeneralSchemaDesignerProps>;
26
27
  export interface SchemaToolbarProps {
27
28
  title?: string | string[];
28
29
  draggable?: boolean;
29
- initializer?: string | false;
30
- settings?: string | false;
30
+ initializer?: string | SchemaInitializer<any> | false;
31
+ settings?: string | SchemaSettings<any> | false;
31
32
  /**
32
33
  * @default true
33
34
  */