@nocobase/client-v2 2.4.0-alpha.17 → 2.4.0-alpha.19

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.
Files changed (34) hide show
  1. package/es/components/form/VariableInput.d.ts +1 -0
  2. package/es/flow/FlowModelRepository.d.ts +4 -1
  3. package/es/flow/FlowPage.d.ts +1 -1
  4. package/es/flow/models/actions/getHasManyDeleteFilterByTk.d.ts +12 -0
  5. package/es/flow/models/base/PageModel/closeGuard.d.ts +8 -1
  6. package/es/flow/models/blocks/form/EditFormModel.d.ts +2 -0
  7. package/es/flow/models/blocks/table/sortUtils.d.ts +3 -0
  8. package/es/flow/models/topbar/UserCenterTopbarActionModel.d.ts +2 -0
  9. package/es/flow/useRouteContentRequest.d.ts +19 -0
  10. package/es/index.mjs +125 -88
  11. package/lib/index.js +128 -91
  12. package/package.json +7 -7
  13. package/src/components/form/VariableInput.tsx +1 -0
  14. package/src/flow/FlowModelRepository.ts +47 -1
  15. package/src/flow/FlowPage.tsx +19 -10
  16. package/src/flow/__tests__/FlowModelRepository.test.ts +38 -1
  17. package/src/flow/__tests__/FlowPage.test.tsx +78 -46
  18. package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +8 -1
  19. package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.mobile.test.tsx +55 -1
  20. package/src/flow/models/actions/BulkDeleteActionModel.tsx +13 -2
  21. package/src/flow/models/actions/DeleteActionModel.tsx +16 -2
  22. package/src/flow/models/actions/__tests__/DeleteActionModel.test.ts +256 -0
  23. package/src/flow/models/actions/getHasManyDeleteFilterByTk.ts +40 -0
  24. package/src/flow/models/base/PageModel/PageTabModel.tsx +27 -12
  25. package/src/flow/models/base/PageModel/closeGuard.ts +9 -8
  26. package/src/flow/models/blocks/details/DetailsItemModel.tsx +62 -1
  27. package/src/flow/models/blocks/details/__tests__/DetailsItemModel.spacing.test.tsx +77 -0
  28. package/src/flow/models/blocks/form/EditFormModel.tsx +23 -1
  29. package/src/flow/models/blocks/form/__tests__/EditFormModel.pagination.test.tsx +77 -0
  30. package/src/flow/models/blocks/table/TableBlockModel.tsx +4 -10
  31. package/src/flow/models/blocks/table/__tests__/sortUtils.test.ts +11 -1
  32. package/src/flow/models/blocks/table/sortUtils.ts +10 -0
  33. package/src/flow/models/topbar/UserCenterTopbarActionModel.tsx +58 -28
  34. package/src/flow/useRouteContentRequest.tsx +42 -0
@@ -65,6 +65,7 @@ export interface VariableInputProps {
65
65
  value?: string;
66
66
  onChange?: (value: string) => void;
67
67
  disabled?: boolean;
68
+ readOnly?: boolean;
68
69
  placeholder?: string;
69
70
  addonBefore?: React.ReactNode;
70
71
  /**
@@ -6,7 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { FlowModel, IFlowModelRepository } from '@nocobase/flow-engine';
9
+ import { type CreateModelOptions, type FlowEngine, FlowModel, IFlowModelRepository } from '@nocobase/flow-engine';
10
10
  import type { BaseApplication } from '../BaseApplication';
11
11
  export declare class MockFlowModelRepository implements IFlowModelRepository<FlowModel> {
12
12
  protected prefix: string;
@@ -27,6 +27,7 @@ export declare class FlowModelRepository implements IFlowModelRepository<FlowMod
27
27
  private inFlightFindOne;
28
28
  private buildFindOneKey;
29
29
  findOne(query: any): Promise<any>;
30
+ ensureRouteContent(options: CreateModelOptions): Promise<any>;
30
31
  save(model: FlowModel, options?: {
31
32
  onlyStepParams?: boolean;
32
33
  }): Promise<any>;
@@ -34,3 +35,5 @@ export declare class FlowModelRepository implements IFlowModelRepository<FlowMod
34
35
  move(sourceId: string, targetId: string, position?: 'before' | 'after'): Promise<any>;
35
36
  duplicate(uid: string): Promise<any>;
36
37
  }
38
+ export declare function isRouteContentConfirmed(model: FlowModel): boolean;
39
+ export declare function loadRouteContentForEditing(engine: FlowEngine, options: CreateModelOptions): Promise<FlowModel<import("@nocobase/flow-engine").DefaultStructure>>;
@@ -16,6 +16,6 @@ type FlowPageProps = {
16
16
  defaultTabTitle?: string;
17
17
  showFlowSettings?: FlowModelRendererProps['showFlowSettings'];
18
18
  };
19
- export declare const FlowPage: React.MemoExoticComponent<(props: FlowPageProps & Record<string, unknown>) => React.JSX.Element>;
19
+ export declare const FlowPage: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<FlowPageProps & Record<string, unknown>, "ref">>>;
20
20
  export declare const RemoteFlowModelRenderer: (props: any) => React.JSX.Element;
21
21
  export { FlowRoute };
@@ -0,0 +1,12 @@
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
+ type RecordData = Record<string, unknown>;
10
+ type TargetValue = string | number;
11
+ export declare function getHasManyDeleteFilterByTk(targetKey: unknown, records: RecordData | RecordData[]): TargetValue | TargetValue[] | undefined;
12
+ export {};
@@ -6,6 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import type { FlowModelContext } from '@nocobase/flow-engine';
9
10
  type CloseGuardContext = {
10
11
  inputArgs?: {
11
12
  dirty?: {
@@ -22,10 +23,16 @@ type CloseGuardContext = {
22
23
  content: string;
23
24
  okText: string;
24
25
  cancelText: string;
25
- }) => boolean | Promise<boolean>;
26
+ }) => boolean | Promise<boolean> | ReturnType<FlowModelContext['modal']['confirm']>;
26
27
  };
27
28
  t: (value: string) => string;
28
29
  exitAll: () => void;
29
30
  };
31
+ export declare function confirmDiscardChanges(ctx: Pick<CloseGuardContext, 'modal' | 't'>): boolean | Promise<boolean> | ({
32
+ destroy: () => void;
33
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
34
+ } & {
35
+ then<T>(resolve: (confirmed: boolean) => T, reject: VoidFunction): Promise<T>;
36
+ });
30
37
  export declare function confirmUnsavedChangesHandler(ctx: CloseGuardContext): Promise<void>;
31
38
  export {};
@@ -12,6 +12,7 @@ import { FormBlockModel } from './FormBlockModel';
12
12
  export declare class EditFormModel extends FormBlockModel {
13
13
  static scene: import("../../base/BlockModel").BlockSceneType;
14
14
  static blockCapabilityActionName: string;
15
+ private readonly confirmingPageChange;
15
16
  private actionFlowSettings;
16
17
  private actionExtraToolbarItems;
17
18
  createResource(_ctx: FlowModelContext, params: any): SingleRecordResource<unknown> | MultiRecordResource<unknown>;
@@ -19,6 +20,7 @@ export declare class EditFormModel extends FormBlockModel {
19
20
  getCurrentRecord(): any;
20
21
  hasAvailableData(): boolean;
21
22
  getAclActionName(): string;
23
+ private hasUnsavedChanges;
22
24
  handlePageChange: (page: number) => Promise<void>;
23
25
  submitHandler(ctx: any, params: any, cb?: (values?: any, filterByTk?: any) => void): Promise<void>;
24
26
  submit(params?: any, cb?: (values?: any, filterByTk?: any) => void): Promise<void>;
@@ -29,4 +29,7 @@ export declare function resolveTableSorterField(sorter: {
29
29
  sortField?: string;
30
30
  };
31
31
  }): string;
32
+ export declare function getTableSorterOrder(sorter: Parameters<typeof resolveTableSorterField>[0] & {
33
+ order?: string;
34
+ }, dragSortField?: string, defaultSort?: string[]): string[];
32
35
  export {};
@@ -37,6 +37,8 @@ export declare class UserCenterItemModel extends FlowModel {
37
37
  getDescriptionNode(): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
38
38
  getValueNode(): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
39
39
  prepare(): Promise<void>;
40
+ /** Recheck this item on each opening without delaying other menu items. */
41
+ checkAvailability?(): Promise<boolean>;
40
42
  render(): React.JSX.Element;
41
43
  }
42
44
  export declare class UserCenterTextItemModel extends UserCenterItemModel {
@@ -0,0 +1,19 @@
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
+ import type { FlowModel } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ export declare function useRouteContentRequest(load: (forEditing: boolean) => Promise<FlowModel>, editing: boolean, refreshDeps: unknown[]): {
12
+ model: FlowModel<import("@nocobase/flow-engine").DefaultStructure>;
13
+ error: Error;
14
+ loading: boolean;
15
+ needsConfirmation: boolean;
16
+ };
17
+ export declare function RouteContent({ pending, children }: React.PropsWithChildren<{
18
+ pending: boolean;
19
+ }>): React.JSX.Element;