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

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.14", 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.14",
3804
+ "@nocobase/sdk": "1.0.0-alpha.14",
3805
+ "@nocobase/utils": "1.0.0-alpha.14",
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 ? {
@@ -11125,12 +11125,18 @@ function WorkflowSelect(r) {
11125
11125
  function WorkflowConfig() {
11126
11126
  var u;
11127
11127
  const { dn: e } = useDesignable(), { t } = useTranslation(), o = useFieldSchema(), n = useCollection_deprecated(), r = useFormBlockContext(), i = (r == null ? void 0 : r.type) || o["x-action"], a = r == null ? void 0 : r.type, l = o["x-action"], c = {
11128
- submit: t("Workflow will be triggered before or after submitting succeeded based on workflow type.", {
11129
- ns: "workflow"
11130
- }),
11131
- "customize:save": t("Workflow will be triggered before or after submitting succeeded based on workflow type.", {
11132
- ns: "workflow"
11133
- }),
11128
+ submit: t(
11129
+ "Workflow will be triggered before or after submitting succeeded based on workflow type (supports pre/post action and approval event).",
11130
+ {
11131
+ ns: "workflow"
11132
+ }
11133
+ ),
11134
+ "customize:save": t(
11135
+ "Workflow will be triggered before or after submitting succeeded based on workflow type (supports pre/post action and approval event).",
11136
+ {
11137
+ ns: "workflow"
11138
+ }
11139
+ ),
11134
11140
  "customize:triggerWorkflows": t(
11135
11141
  'Workflow will be triggered directly once the button clicked, without data saving. Only supports to be bound with "Custom action event".',
11136
11142
  { ns: "@nocobase/plugin-workflow-custom-action-trigger" }
@@ -11139,7 +11145,9 @@ function WorkflowConfig() {
11139
11145
  '"Submit to workflow" to "Post-action event" is deprecated, please use "Custom action event" instead.',
11140
11146
  { ns: "workflow" }
11141
11147
  ),
11142
- destroy: t("Workflow will be triggered before deleting succeeded.", { ns: "workflow" })
11148
+ destroy: t("Workflow will be triggered before deleting succeeded (only supports pre-action event).", {
11149
+ ns: "workflow"
11150
+ })
11143
11151
  }[o == null ? void 0 : o["x-action"]];
11144
11152
  return /* @__PURE__ */ jsx(
11145
11153
  SchemaSettingsActionModalItem,
@@ -17185,7 +17193,10 @@ const SchemaSettingsWrapper = (e) => {
17185
17193
  );
17186
17194
  };
17187
17195
  function useSchemaSettingsRender(e, t) {
17188
- const o = useApp(), n = useMemo(() => o.schemaSettingsManager.get(e), [o.schemaSettingsManager, e]);
17196
+ const o = useApp(), n = useMemo(
17197
+ () => typeof e == "object" ? e : o.schemaSettingsManager.get(e),
17198
+ [o.schemaSettingsManager, e]
17199
+ );
17189
17200
  return e ? n ? {
17190
17201
  exists: !0,
17191
17202
  render: (r = {}) => React.createElement(SchemaSettingsWrapper, x(x(x({}, n.options), t), r))
@@ -19641,10 +19652,10 @@ const useStyles$f = createStyles(() => ({
19641
19652
  return o.map((M) => u(M));
19642
19653
  }
19643
19654
  }, [u, o]), { render: y, exists: b } = useSchemaSettingsRender(
19644
- t["x-settings"] || r,
19655
+ r || t["x-settings"],
19645
19656
  t["x-settings-props"]
19646
19657
  ), { render: S, exists: v } = useSchemaInitializerRender(
19647
- t["x-initializer"] || n,
19658
+ n || t["x-initializer"],
19648
19659
  t["x-initializer-props"]
19649
19660
  ), k = useGridRowContext(), A = useGridContext(), P = useMemo(() => {
19650
19661
  var M;
@@ -31779,14 +31790,17 @@ const useTableColumns$1 = (e) => {
31779
31790
  return useMemo(() => {
31780
31791
  if (!a)
31781
31792
  return m;
31782
- const g = [...m];
31783
- return i && g.push({
31784
- title: l(),
31785
- dataIndex: "TABLE_COLUMN_INITIALIZER",
31786
- key: "TABLE_COLUMN_INITIALIZER",
31787
- render: () => /* @__PURE__ */ jsx("div", { style: { minWidth: 180 } }),
31788
- fixed: "right"
31789
- }), e.showDel && g.push({
31793
+ const g = [
31794
+ ...m,
31795
+ {
31796
+ title: l(),
31797
+ dataIndex: "TABLE_COLUMN_INITIALIZER",
31798
+ key: "TABLE_COLUMN_INITIALIZER",
31799
+ render: i ? () => /* @__PURE__ */ jsx("div", { style: { minWidth: 180 } }) : null,
31800
+ fixed: i ? "right" : "none"
31801
+ }
31802
+ ];
31803
+ return e.showDel && g.push({
31790
31804
  title: "",
31791
31805
  key: "delete",
31792
31806
  width: 60,
@@ -33099,7 +33113,24 @@ const AutoComplete = withDynamicSchemaProps(
33099
33113
  return /* @__PURE__ */ jsx(Card, F(x({ ref: o, bordered: !1, style: { marginBottom: i.marginBlock } }, t), { children: e }));
33100
33114
  });
33101
33115
  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) => {
33116
+ const blockDeleteSettings = new SchemaSettings({
33117
+ name: "blockDeleteSettings",
33118
+ items: [
33119
+ {
33120
+ name: "remove",
33121
+ type: "remove",
33122
+ componentProps: {
33123
+ removeParentsIfNoChildren: !0,
33124
+ breakRemoveOn(e) {
33125
+ return e["x-component"] === "Grid";
33126
+ }
33127
+ }
33128
+ }
33129
+ ]
33130
+ }), FallbackComponent = (e) => /* @__PURE__ */ jsxs(BlockItemCard, { children: [
33131
+ /* @__PURE__ */ jsx(SchemaToolbar, { settings: blockDeleteSettings, draggable: !1 }),
33132
+ /* @__PURE__ */ jsx(ErrorFallback, x({}, e))
33133
+ ] }), BlockItemError = ({ children: e }) => /* @__PURE__ */ jsx(ErrorBoundary, { FallbackComponent, onError: (o) => {
33103
33134
  console.error(o);
33104
33135
  }, children: e }), useStyles$a = genStyleHook("nb-card-item", (e) => {
33105
33136
  const { componentCls: t } = e;
@@ -39394,6 +39425,7 @@ function TextArea(e) {
39394
39425
  .ant-input {
39395
39426
  flex-grow: 1;
39396
39427
  min-width: 200px;
39428
+ word-break: break-all;
39397
39429
  }
39398
39430
  .ant-input-disabled {
39399
39431
  .ant-tag {
@@ -39419,6 +39451,7 @@ function TextArea(e) {
39419
39451
  onPaste: j,
39420
39452
  onCompositionStart: z,
39421
39453
  onCompositionEnd: O,
39454
+ placeholder: e.placeholder,
39422
39455
  className: cx(
39423
39456
  o,
39424
39457
  "ant-input",
@@ -39427,6 +39460,11 @@ function TextArea(e) {
39427
39460
  overflow: auto;
39428
39461
  white-space: ${l ? "normal" : "nowrap"};
39429
39462
 
39463
+ &[placeholder]:empty::before {
39464
+ content: attr(placeholder);
39465
+ color: #ccc;
39466
+ }
39467
+
39430
39468
  .ant-tag {
39431
39469
  display: inline;
39432
39470
  line-height: 19px;
@@ -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
  */