@nocobase/client-v2 2.1.0-beta.34 → 2.1.0-beta.36

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 (76) hide show
  1. package/es/BaseApplication.d.ts +7 -1
  2. package/es/PluginManager.d.ts +2 -0
  3. package/es/components/PoweredBy.d.ts +18 -0
  4. package/es/components/SwitchLanguage.d.ts +11 -0
  5. package/es/components/form/DialogFormLayout.d.ts +75 -0
  6. package/es/components/form/DrawerFormLayout.d.ts +11 -11
  7. package/es/components/form/PasswordInput.d.ts +40 -0
  8. package/es/components/form/RemoteSelect.d.ts +79 -0
  9. package/es/components/form/index.d.ts +3 -0
  10. package/es/components/form/table/styles.d.ts +10 -0
  11. package/es/components/index.d.ts +2 -0
  12. package/es/flow/models/base/ActionModelCore.d.ts +6 -0
  13. package/es/flow/models/base/GridModel.d.ts +2 -0
  14. package/es/flow/models/blocks/filter-form/FilterFormBlockModel.d.ts +9 -1
  15. package/es/flow/utils/dataScopeFormValueClear.d.ts +14 -0
  16. package/es/flow-compat/passwordUtils.d.ts +1 -1
  17. package/es/hooks/index.d.ts +2 -0
  18. package/es/hooks/useCurrentAppInfo.d.ts +9 -0
  19. package/es/index.mjs +117 -105
  20. package/es/json-logic/globalOperators.d.ts +11 -0
  21. package/es/nocobase-buildin-plugin/index.d.ts +25 -0
  22. package/es/utils/appVersionHTML.d.ts +10 -0
  23. package/es/utils/globalDeps.d.ts +7 -0
  24. package/es/utils/index.d.ts +1 -0
  25. package/es/utils/remotePlugins.d.ts +4 -1
  26. package/lib/index.js +120 -108
  27. package/package.json +7 -6
  28. package/src/BaseApplication.tsx +11 -3
  29. package/src/PluginManager.ts +2 -0
  30. package/src/PluginSettingsManager.ts +2 -1
  31. package/src/__tests__/PluginSettingsManager.test.ts +19 -0
  32. package/src/__tests__/PoweredBy.test.tsx +130 -0
  33. package/src/__tests__/app.test.tsx +39 -0
  34. package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +39 -72
  35. package/src/__tests__/remotePlugins.test.ts +203 -0
  36. package/src/__tests__/useCurrentRoles.test.tsx +100 -0
  37. package/src/components/PoweredBy.tsx +71 -0
  38. package/src/components/README.md +314 -0
  39. package/src/components/README.zh-CN.md +312 -0
  40. package/src/components/SwitchLanguage.tsx +48 -0
  41. package/src/components/form/DialogFormLayout.tsx +111 -0
  42. package/src/components/form/DrawerFormLayout.tsx +13 -32
  43. package/src/components/form/PasswordInput.tsx +211 -0
  44. package/src/components/form/RemoteSelect.tsx +137 -0
  45. package/src/components/form/index.tsx +3 -0
  46. package/src/components/form/table/Table.tsx +2 -1
  47. package/src/components/form/table/styles.ts +19 -0
  48. package/src/components/index.ts +2 -0
  49. package/src/css-variable/CSSVariableProvider.tsx +10 -1
  50. package/src/flow/actions/__tests__/dataScopeFormValueClear.test.ts +96 -0
  51. package/src/flow/actions/dataScope.tsx +3 -0
  52. package/src/flow/actions/filterFormDefaultValues.tsx +1 -2
  53. package/src/flow/admin-shell/admin-layout/AdminLayoutComponent.tsx +1 -4
  54. package/src/flow/admin-shell/admin-layout/HelpLite.tsx +7 -33
  55. package/src/flow/components/BlockItemCard.tsx +2 -2
  56. package/src/flow/models/base/ActionModel.tsx +8 -7
  57. package/src/flow/models/base/ActionModelCore.tsx +15 -7
  58. package/src/flow/models/base/GridModel.tsx +93 -36
  59. package/src/flow/models/base/__tests__/GridModel.visibleLayout.test.ts +83 -11
  60. package/src/flow/models/blocks/details/DetailsItemModel.tsx +2 -0
  61. package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +329 -5
  62. package/src/flow/models/blocks/filter-form/__tests__/defaultValues.wiring.test.ts +337 -0
  63. package/src/flow/models/blocks/form/FormItemModel.tsx +5 -3
  64. package/src/flow/models/blocks/form/__tests__/FormItemModel.defineChildren.test.ts +108 -0
  65. package/src/flow/models/blocks/table/TableActionsColumnModel.tsx +5 -0
  66. package/src/flow/models/blocks/table/TableColumnModel.tsx +2 -0
  67. package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +2 -0
  68. package/src/flow/utils/dataScopeFormValueClear.ts +278 -0
  69. package/src/hooks/index.ts +2 -0
  70. package/src/hooks/useCurrentAppInfo.ts +36 -0
  71. package/src/json-logic/globalOperators.js +731 -0
  72. package/src/nocobase-buildin-plugin/index.tsx +70 -16
  73. package/src/utils/appVersionHTML.ts +28 -0
  74. package/src/utils/globalDeps.ts +47 -31
  75. package/src/utils/index.tsx +2 -0
  76. package/src/utils/remotePlugins.ts +119 -13
@@ -0,0 +1,11 @@
1
+ export function getOperators(): {
2
+ is_logic(logic: any): boolean;
3
+ truthy(value: any): boolean;
4
+ getOperator(logic: any): string;
5
+ getValues(logic: any): any;
6
+ apply(logic: any, data: any): any;
7
+ uses_data(logic: any): any[];
8
+ addOperation(name: any, code: any): void;
9
+ rmOperation(name: any): void;
10
+ rule_like(rule: any, pattern: any): any;
11
+ };
@@ -6,8 +6,33 @@
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 React from 'react';
9
10
  import type { Application } from '../Application';
10
11
  import { Plugin } from '../Plugin';
12
+ export type CurrentUserState = {
13
+ data?: {
14
+ data?: any;
15
+ };
16
+ loading: boolean;
17
+ };
18
+ export type CurrentRoleOption = {
19
+ name: string;
20
+ title: string;
21
+ };
22
+ export declare const CurrentUserContext: React.Context<CurrentUserState>;
23
+ export declare function useCurrentUserContext(): CurrentUserState;
24
+ /**
25
+ * 返回当前用户在 v2 应用上下文中可选的角色列表,等价于 v1 `useCurrentRoles`:
26
+ * 从 FlowEngine 全局上下文 `engine.context.user.roles` 派生(CurrentUserProvider 在
27
+ * `/auth:check` 成功后通过 `defineProperty('user', { value })` 写入),按需追加匿名角色,
28
+ * 并去掉合并角色 `__union__`。v2 中角色 title 可能含有 `{{t('...')}}` 模板,因此用
29
+ * flowEngine.context.t 解析。
30
+ *
31
+ * 不读 React `CurrentUserContext`:FlowEngine 的 dialog/drawer/popover 内容通过 `ctx.viewer`
32
+ * 渲染到独立的 ElementsHolder,部分场景会脱离原 Provider 树;FlowEngine 全局上下文是同一份
33
+ * 数据但不受 React 树位置影响。
34
+ */
35
+ export declare function useCurrentRoles(): CurrentRoleOption[];
11
36
  /**
12
37
  * client-v2 使用的内建插件集合。
13
38
  *
@@ -0,0 +1,10 @@
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 escapeHTML(value: string): string;
10
+ export declare function getAppVersionHTML(version: unknown): string;
@@ -7,6 +7,13 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import type { RequireJS } from './requirejs';
10
+ declare global {
11
+ interface Window {
12
+ __nocobase_app_dev__?: boolean;
13
+ __nocobase_app_dev_deps__?: Record<string, unknown>;
14
+ __nocobase_app_dev_plugins__?: Record<string, unknown>;
15
+ }
16
+ }
10
17
  /**
11
18
  * @internal
12
19
  */
@@ -7,5 +7,6 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import React, { ComponentType } from 'react';
10
+ export * from './appVersionHTML';
10
11
  export declare function normalizeContainer(container: Element | ShadowRoot | string): Element | null;
11
12
  export declare const compose: (...components: [ComponentType<any>, any][]) => (LastChild?: ComponentType<any>) => React.FC;
@@ -10,10 +10,13 @@ import type { DevDynamicImport } from '../Application';
10
10
  import type { PluginClass } from '../PluginManager';
11
11
  import type { PluginData } from '../PluginManager';
12
12
  import type { RequireJS } from './requirejs';
13
+ type RemotePluginModule = PluginClass | ({
14
+ default?: PluginClass;
15
+ } & Record<string, unknown>);
13
16
  /**
14
17
  * @internal
15
18
  */
16
- export declare function defineDevPlugins(plugins: Record<string, PluginClass>): void;
19
+ export declare function defineDevPlugins(plugins: Record<string, RemotePluginModule>): void;
17
20
  /**
18
21
  * @internal
19
22
  */