@nocobase/client 1.9.0-beta.15 → 1.9.0-beta.17

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.
@@ -8,12 +8,13 @@
8
8
  */
9
9
  export * from './BlockProvider';
10
10
  export * from './BlockSchemaComponentProvider';
11
+ export * from './DetailsBlockProvider';
11
12
  export * from './FilterFormBlockProvider';
12
13
  export * from './FormBlockProvider';
13
14
  export * from './FormFieldProvider';
15
+ export * from './hooks';
16
+ export { useLinkActionProps } from './hooks/index';
14
17
  export * from './TableBlockProvider';
15
18
  export * from './TableFieldProvider';
16
19
  export * from './TableSelectorProvider';
17
- export * from './DetailsBlockProvider';
18
- export * from './hooks';
19
- export { useLinkActionProps } from './hooks/index';
20
+ export * from './TemplateBlockProvider';
package/es/index.mjs CHANGED
@@ -2718,6 +2718,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2718
2718
  get TargetKey() {
2719
2719
  return TargetKey;
2720
2720
  },
2721
+ get TemplateBlockProvider() {
2722
+ return TemplateBlockProvider;
2723
+ },
2721
2724
  get TemplateSummary() {
2722
2725
  return TemplateSummary;
2723
2726
  },
@@ -4230,6 +4233,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4230
4233
  get useTabsContext() {
4231
4234
  return useTabsContext;
4232
4235
  },
4236
+ get useTemplateBlockContext() {
4237
+ return useTemplateBlockContext;
4238
+ },
4233
4239
  get useTitleFieldOptions() {
4234
4240
  return useTitleFieldOptions;
4235
4241
  },
@@ -8850,7 +8856,7 @@ function addAppVersion(e, t) {
8850
8856
  addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
8851
8857
  }), e;
8852
8858
  }
8853
- const name = "@nocobase/client", version = "1.9.0-beta.15", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8859
+ const name = "@nocobase/client", version = "1.9.0-beta.17", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8854
8860
  "@ahooksjs/use-url-state": "3.5.1",
8855
8861
  "@ant-design/cssinjs": "^1.11.1",
8856
8862
  "@ant-design/icons": "^5.6.1",
@@ -8871,11 +8877,13 @@ const name = "@nocobase/client", version = "1.9.0-beta.15", license = "AGPL-3.0"
8871
8877
  "@formily/reactive-react": "^2.2.27",
8872
8878
  "@formily/shared": "^2.2.27",
8873
8879
  "@formily/validator": "^2.2.27",
8874
- "@nocobase/evaluators": "1.9.0-beta.15",
8875
- "@nocobase/sdk": "1.9.0-beta.15",
8876
- "@nocobase/utils": "1.9.0-beta.15",
8880
+ "@nocobase/evaluators": "1.9.0-beta.17",
8881
+ "@nocobase/sdk": "1.9.0-beta.17",
8882
+ "@nocobase/utils": "1.9.0-beta.17",
8877
8883
  ahooks: "^3.7.2",
8878
8884
  antd: "5.24.2",
8885
+ "antd-mobile": "^5.41.1",
8886
+ "antd-mobile-icons": "^0.3.0",
8879
8887
  "antd-style": "3.7.1",
8880
8888
  axios: "^1.7.0",
8881
8889
  "bignumber.js": "^9.1.2",
@@ -22368,7 +22376,7 @@ const SchemaSettingsModalItem = (e) => {
22368
22376
  );
22369
22377
  }, SchemaSettingsLinkageRules = function(t) {
22370
22378
  var w;
22371
- const { collectionName: n, readPretty: o, Component: r, afterSubmit: a, title: i, returnScope: l } = t, c = useFieldSchema(), { form: u } = useFormBlockContext(), { dn: d } = useDesignable(), { t: p } = useTranslation(), { getTemplateById: m } = useSchemaTemplateManager(), h = useVariables$1(), g = useLocalVariables$1(), f = useRecord(), { type: C } = useFormBlockType(), b = (w = t == null ? void 0 : t.category) != null ? w : LinkageRuleCategory.default, S = (t == null ? void 0 : t.type) || (c != null && c["x-action"] || ["Action", "Action.Link"].includes(c["x-component"]) ? "button" : "field"), y = findGridSchema(c) || c, v = useLinkageCollectionFilterOptions(n), I = useLinkageCollectionFieldOptions(n, o), F = {
22379
+ const { collectionName: n, readPretty: o, Component: r, afterSubmit: a, title: i, returnScope: l } = t, c = useFieldSchema(), { form: u } = useFormBlockContext(), { dn: d } = useDesignable(), { t: p } = useTranslation(), { getTemplateById: m } = useSchemaTemplateManager(), h = useVariables$1(), g = useLocalVariables$1(), f = useRecord(), { type: C } = useFormBlockType(), b = (w = t == null ? void 0 : t.category) != null ? w : LinkageRuleCategory.default, S = (t == null ? void 0 : t.type) || (c != null && c["x-action"] || ["Action", "Action.Link", "WorkbenchAction"].includes(c["x-component"]) ? "button" : "field"), y = findGridSchema(c) || c, v = useLinkageCollectionFilterOptions(n), I = useLinkageCollectionFieldOptions(n, o), F = {
22372
22380
  [LinkageRuleCategory.default]: p("Linkage rules"),
22373
22381
  [LinkageRuleCategory.style]: p("Style")
22374
22382
  }, R = LinkageRuleDataKeyMap[b], T = useCallback(() => (y == null ? void 0 : y[R]) || (c == null ? void 0 : c[R]) || [], [y, c, R]), D = i || F[b] || p("Linkage rules"), B = useFlag(), N = useMemo(
@@ -30097,21 +30105,21 @@ const useCreateActionProps = () => {
30097
30105
  onReset: h
30098
30106
  };
30099
30107
  }, useDetailsPaginationProps = () => {
30100
- var o, r, a, i, l, c, u, d, p, m, h, g, f, C, b;
30101
- const e = useDetailsBlockContext(), t = ((a = (r = (o = e.service) == null ? void 0 : o.data) == null ? void 0 : r.meta) == null ? void 0 : a.count) || 0, n = (c = (l = (i = e.service) == null ? void 0 : i.data) == null ? void 0 : l.meta) == null ? void 0 : c.page;
30108
+ var r, a, i, l, c, u, d, p, m, h, g, f, C, b, S, y, v;
30109
+ const e = useDetailsBlockContext(), t = ((i = (a = (r = e.service) == null ? void 0 : r.data) == null ? void 0 : a.meta) == null ? void 0 : i.count) || 0, n = (u = (c = (l = e.service) == null ? void 0 : l.data) == null ? void 0 : c.meta) == null ? void 0 : u.page, { hasNext: o } = ((p = (d = e.service) == null ? void 0 : d.data) == null ? void 0 : p.meta) || {};
30102
30110
  if (!t && n) {
30103
- let y;
30111
+ let F;
30104
30112
  return {
30105
30113
  simple: !0,
30106
- current: ((p = (d = (u = e.service) == null ? void 0 : u.data) == null ? void 0 : d.meta) == null ? void 0 : p.page) || 1,
30114
+ current: ((g = (h = (m = e.service) == null ? void 0 : m.data) == null ? void 0 : h.meta) == null ? void 0 : g.page) || 1,
30107
30115
  pageSize: 1,
30108
30116
  showSizeChanger: !1,
30109
30117
  align: "center",
30110
- onChange(v) {
30118
+ onChange(R) {
30111
30119
  return q(this, null, function* () {
30112
- var F, R;
30113
- const I = (R = (F = e.service) == null ? void 0 : F.params) == null ? void 0 : R[0];
30114
- e.service.run(P(x({}, I), { page: v }));
30120
+ var D, B;
30121
+ const T = (B = (D = e.service) == null ? void 0 : D.params) == null ? void 0 : B[0];
30122
+ e.service.run(P(x({}, T), { page: R }));
30115
30123
  });
30116
30124
  },
30117
30125
  style: {
@@ -30120,7 +30128,7 @@ const useCreateActionProps = () => {
30120
30128
  },
30121
30129
  showTotal: !1,
30122
30130
  showTitle: !1,
30123
- total: (g = (h = (m = e.service) == null ? void 0 : m.data) == null ? void 0 : h.data) != null && g.length ? 1 * n + 1 : 1 * n,
30131
+ total: ((b = (C = (f = e.service) == null ? void 0 : f.data) == null ? void 0 : C.data) == null ? void 0 : b.length) < 1 || !o ? 1 * n : 1 * n + 1,
30124
30132
  className: css`
30125
30133
  .ant-pagination-simple-pager {
30126
30134
  display: none !important;
@@ -30131,16 +30139,16 @@ const useCreateActionProps = () => {
30131
30139
  return {
30132
30140
  simple: !0,
30133
30141
  hidden: t <= 1,
30134
- current: ((b = (C = (f = e.service) == null ? void 0 : f.data) == null ? void 0 : C.meta) == null ? void 0 : b.page) || 1,
30142
+ current: ((v = (y = (S = e.service) == null ? void 0 : S.data) == null ? void 0 : y.meta) == null ? void 0 : v.page) || 1,
30135
30143
  total: t,
30136
30144
  pageSize: 1,
30137
30145
  showSizeChanger: !1,
30138
30146
  align: "center",
30139
- onChange(y) {
30147
+ onChange(F) {
30140
30148
  return q(this, null, function* () {
30141
- var I, F;
30142
- const v = (F = (I = e.service) == null ? void 0 : I.params) == null ? void 0 : F[0];
30143
- e.service.run(P(x({}, v), { page: y }));
30149
+ var T, D;
30150
+ const R = (D = (T = e.service) == null ? void 0 : T.params) == null ? void 0 : D[0];
30151
+ e.service.run(P(x({}, R), { page: F }));
30144
30152
  });
30145
30153
  },
30146
30154
  style: {
@@ -30963,11 +30971,14 @@ const SortableProvider = (e) => {
30963
30971
  return e.id ? e.id : (n = t.address) == null ? void 0 : n.toString();
30964
30972
  }, InternalSortableItem = observer$1(
30965
30973
  (e) => {
30966
- const l = useSortableItemProps(e), { schema: t, id: n, eid: o, removeParentsIfNoChildren: r } = l, a = Y(l, ["schema", "id", "eid", "removeParentsIfNoChildren"]), i = useMemo(() => ({
30967
- insertAdjacent: "afterEnd",
30968
- schema: t,
30969
- removeParentsIfNoChildren: r != null ? r : !0
30970
- }), [t, r]);
30974
+ const l = useSortableItemProps(e), { schema: t, id: n, eid: o, removeParentsIfNoChildren: r } = l, a = Y(l, ["schema", "id", "eid", "removeParentsIfNoChildren"]), i = useMemo(() => {
30975
+ var c, u, d;
30976
+ return {
30977
+ insertAdjacent: "afterEnd",
30978
+ schema: ((u = (c = t.parent) == null ? void 0 : c.parent) == null ? void 0 : u["x-component"]) === "BlockTemplate" ? (d = t.parent) == null ? void 0 : d.parent : t,
30979
+ removeParentsIfNoChildren: r != null ? r : !0
30980
+ };
30981
+ }, [t, r]);
30971
30982
  return /* @__PURE__ */ jsx(SortableProvider, { id: n, data: i, children: /* @__PURE__ */ jsx(Sortable, P(x({ id: o }, a), { children: e.children })) });
30972
30983
  },
30973
30984
  { displayName: "InternalSortableItem" }
@@ -31215,7 +31226,7 @@ const DragHandler = (e) => {
31215
31226
  };
31216
31227
  }, BlockItem = withDynamicSchemaProps(
31217
31228
  (e) => {
31218
- const { className: t, children: n, style: o } = useProps(e), { componentCls: r, hashId: a } = useStyles$9(), i = useFieldSchema(), { render: l } = useSchemaToolbarRender(i), { getAriaLabel: c } = useGetAriaLabelOfBlockItem(e.name), u = useMemo(() => c(), [c]), d = useCollection(), p = i["x-decorator"] === "FormItem" && i["x-block-linkage-rules"], m = /* @__PURE__ */ jsxs(
31229
+ const { className: t, children: n, style: o } = useProps(e), { componentCls: r, hashId: a } = useStyles$9(), i = useFieldSchema(), { render: l } = useSchemaToolbarRender(i), { getAriaLabel: c } = useGetAriaLabelOfBlockItem(e.name), u = useMemo(() => c(), [c]), d = useCollection(), p = i["x-decorator"] === "FormItem" && i["x-block-linkage-rules"], m = i["x-component"] === "Iframe" && i["x-block-linkage-rules"], h = /* @__PURE__ */ jsxs(
31219
31230
  SortableItem,
31220
31231
  {
31221
31232
  role: "button",
@@ -31228,7 +31239,7 @@ const DragHandler = (e) => {
31228
31239
  ]
31229
31240
  }
31230
31241
  );
31231
- return d && !p ? m : /* @__PURE__ */ jsx(BlockLinkageRuleProvider, { children: m });
31242
+ return d && !p && !m ? h : /* @__PURE__ */ jsx(BlockLinkageRuleProvider, { children: h });
31232
31243
  },
31233
31244
  { displayName: "BlockItem" }
31234
31245
  ), TestDesigner = () => {
@@ -31909,7 +31920,7 @@ const useParseDefaultValue = () => {
31909
31920
  const j = transformVariableValue(B, {
31910
31921
  targetCollectionField: D
31911
31922
  });
31912
- j == null || j === "" ? e.mounted && (e.setInitialValue(void 0), e.setValue(void 0)) : p() ? h === 0 && m(j) : (e.setInitialValue(j), e.setValue(j)), e.loading = !1;
31923
+ j == null || j === "" ? e.mounted && (e.setInitialValue(void 0), e.setValue(void 0)) : p() ? h === 0 && m(j) : c ? e.setValue(j) : e.setInitialValue(j), e.loading = !1;
31913
31924
  } else
31914
31925
  !/\{\{.+\}\}/g.test(t.default) && e.setInitialValue && e.setInitialValue(t.default);
31915
31926
  }), v = _.debounce(y, DEBOUNCE_WAIT);
@@ -44048,7 +44059,7 @@ function useBeforeUpload(e) {
44048
44059
  }));
44049
44060
  }
44050
44061
  const a = validate(r, e);
44051
- return a ? (r.status = "error", r.response = t(a)) : r.status === "error" && (delete r.status, delete r.response), a ? !1 : r;
44062
+ return a ? (n.status = "error", n.response = t(a)) : n.status === "error" && (delete r.status, delete r.response), a ? !1 : Promise.resolve(r);
44052
44063
  },
44053
44064
  [e]
44054
44065
  );
@@ -59275,7 +59286,7 @@ class OBOFieldInterface extends CollectionFieldInterface {
59275
59286
  }
59276
59287
  }
59277
59288
  });
59278
- k(this, "availableTypes", ["hasOne"]);
59289
+ k(this, "availableTypes", ["belongsTo"]);
59279
59290
  k(this, "properties", x(x({
59280
59291
  "uiSchema.title": {
59281
59292
  type: "string",
@@ -70220,6 +70231,7 @@ export {
70220
70231
  TabsContextProvider,
70221
70232
  TargetForeignKey,
70222
70233
  TargetKey,
70234
+ TemplateBlockProvider,
70223
70235
  TemplateSummary,
70224
70236
  Templates,
70225
70237
  TestDesigner,
@@ -70724,6 +70736,7 @@ export {
70724
70736
  useTableSelectorProps$4 as useTableSelectorProps,
70725
70737
  useTableSize,
70726
70738
  useTabsContext,
70739
+ useTemplateBlockContext,
70727
70740
  useTitleFieldOptions,
70728
70741
  useToken,
70729
70742
  useUIConfigurationPermissions,
@@ -87,4 +87,4 @@ export declare function toValueItem(data: any): any;
87
87
  export declare const toItem: (file: any) => any;
88
88
  export declare const toFileList: (fileList: any) => any[];
89
89
  export declare function validate(file: any, rules: Record<string, any>): string;
90
- export declare function useBeforeUpload(rules: any): (file: any, fileList: any) => any;
90
+ export declare function useBeforeUpload(rules: any): (file: any, fileList: any) => false | Promise<any>;