@nocobase/client-v2 2.2.0-alpha.7 → 2.2.0-alpha.9

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 (56) hide show
  1. package/es/APIClient.d.ts +1 -3
  2. package/es/components/form/ScanInput/useCodeScanner.d.ts +2 -1
  3. package/es/flow/actions/index.d.ts +1 -1
  4. package/es/flow/actions/linkageRules.d.ts +2 -0
  5. package/es/flow/admin-shell/admin-layout/AdminLayoutMenuModels.d.ts +1 -0
  6. package/es/flow/components/FieldAssignValueInput.d.ts +6 -0
  7. package/es/flow/components/filter/FilterGroup.d.ts +1 -0
  8. package/es/flow/components/filter/VariableFilterItem.d.ts +6 -1
  9. package/es/flow/models/base/PageModel/PageModel.d.ts +12 -0
  10. package/es/flow/models/base/PageModel/PageModelTabBar.d.ts +22 -0
  11. package/es/flow/models/base/PageModel/PageTabModel.d.ts +12 -0
  12. package/es/flow-compat/fieldValidationConstants.d.ts +1 -1
  13. package/es/flow-compat/routeTypes.d.ts +1 -0
  14. package/es/index.mjs +105 -104
  15. package/lib/index.js +117 -116
  16. package/lib/locale/languageCodes.js +2 -1
  17. package/package.json +7 -7
  18. package/src/APIClient.ts +1 -10
  19. package/src/Application.tsx +4 -0
  20. package/src/BaseApplication.tsx +3 -2
  21. package/src/__tests__/app.test.tsx +47 -0
  22. package/src/__tests__/nocobase-buildin-plugin-auth.test.tsx +28 -0
  23. package/src/collection-manager/field-validation.ts +1 -1
  24. package/src/components/form/ScanInput/CodeScanner.tsx +23 -6
  25. package/src/components/form/ScanInput/__tests__/useCodeScanner.test.tsx +35 -1
  26. package/src/components/form/ScanInput/useCodeScanner.ts +16 -3
  27. package/src/components/form/TypedVariableInput.tsx +12 -8
  28. package/src/components/form/__tests__/TypedVariableInput.test.tsx +44 -3
  29. package/src/flow/actions/__tests__/linkageRules.tab.test.ts +171 -0
  30. package/src/flow/actions/__tests__/linkageRulesRefresh.test.ts +7 -3
  31. package/src/flow/actions/index.ts +2 -0
  32. package/src/flow/actions/linkageRules.tsx +86 -11
  33. package/src/flow/actions/linkageRulesRefresh.tsx +2 -6
  34. package/src/flow/components/FieldAssignValueInput.tsx +21 -0
  35. package/src/flow/components/__tests__/FieldAssignValueInput.context.test.tsx +84 -2
  36. package/src/flow/components/filter/FilterGroup.tsx +33 -5
  37. package/src/flow/components/filter/VariableFilterItem.tsx +158 -10
  38. package/src/flow/components/filter/__tests__/FilterGroup.test.tsx +45 -0
  39. package/src/flow/components/filter/__tests__/VariableFilterItem.leftMetaTree.test.tsx +9 -0
  40. package/src/flow/components/filter/__tests__/VariableFilterItem.test.tsx +70 -1
  41. package/src/flow/models/base/PageModel/PageModel.tsx +387 -53
  42. package/src/flow/models/base/PageModel/PageModelTabBar.tsx +114 -0
  43. package/src/flow/models/base/PageModel/PageTabModel.tsx +184 -3
  44. package/src/flow/models/base/PageModel/__tests__/PageModel.test.ts +790 -10
  45. package/src/flow/models/base/PageModel/__tests__/PageModelTabBar.module-isolation.test.tsx +130 -0
  46. package/src/flow/models/base/PageModel/__tests__/PageModelTabBar.test.tsx +118 -0
  47. package/src/flow/models/base/PageModel/__tests__/PageTabModel.test.ts +572 -1
  48. package/src/flow/models/blocks/table/TableActionsColumnModel.tsx +2 -1
  49. package/src/flow/models/blocks/table/TableBlockModel.tsx +1 -1
  50. package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +1 -1
  51. package/src/flow/models/fields/VariableFieldFormModel.tsx +3 -3
  52. package/src/flow/models/fields/__tests__/VariableFieldFormModel.test.tsx +51 -0
  53. package/src/flow-compat/fieldValidationConstants.ts +1 -1
  54. package/src/flow-compat/routeTypes.ts +1 -0
  55. package/src/locale/languageCodes.ts +2 -1
  56. package/src/nocobase-buildin-plugin/index.tsx +12 -0
@@ -0,0 +1,51 @@
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
+
10
+ import { FlowEngine, FlowEngineProvider } from '@nocobase/flow-engine';
11
+ import { render, screen, waitFor } from '@testing-library/react';
12
+ import React from 'react';
13
+ import { describe, expect, it } from 'vitest';
14
+ import { InputFieldModel } from '../InputFieldModel';
15
+ import { VariableFieldFormModel } from '../VariableFieldFormModel';
16
+
17
+ describe('VariableFieldFormModel', () => {
18
+ it('uses DOM-safe name and id for temporary controls created from reserved form property names', async () => {
19
+ const engine = new FlowEngine();
20
+ engine.registerModels({ InputFieldModel, VariableFieldFormModel });
21
+ const model = engine.createModel<VariableFieldFormModel>({
22
+ use: 'VariableFieldFormModel',
23
+ subModels: {
24
+ fields: [
25
+ {
26
+ use: 'InputFieldModel',
27
+ stepParams: {
28
+ fieldSettings: {
29
+ init: {
30
+ fieldPath: 'nodeName',
31
+ },
32
+ },
33
+ },
34
+ },
35
+ ],
36
+ },
37
+ });
38
+ const field = model.subModels.fields[0];
39
+
40
+ render(<FlowEngineProvider engine={engine}>{model.render()}</FlowEngineProvider>);
41
+
42
+ const input = await screen.findByRole('textbox');
43
+ await waitFor(() => {
44
+ expect(field.props.name).toEqual(['__nb_variable_field_nodeName']);
45
+ });
46
+ expect(input).toHaveAttribute('name', '__nb_variable_field_nodeName');
47
+ expect(input).toHaveAttribute('id', '__nb_variable_field_nodeName');
48
+ expect(field.props.id).toEqual(['__nb_variable_field_nodeName']);
49
+ expect(field.getStepParams('fieldSettings', 'init')).toEqual({ fieldPath: 'nodeName' });
50
+ });
51
+ });
@@ -231,7 +231,7 @@ export const FIELDS_VALIDATION_OPTIONS = {
231
231
  },
232
232
  {
233
233
  key: 'multiple',
234
- label: 'Multiple',
234
+ label: 'Multiple of',
235
235
  hasValue: true,
236
236
  params: [{ key: 'base', label: 'Base', componentType: 'inputNumber', required: true }],
237
237
  },
@@ -18,6 +18,7 @@ export enum NocoBaseDesktopRouteType {
18
18
 
19
19
  export interface NocoBaseDesktopRouteOptions {
20
20
  hasPersistedMenuInstanceFlow?: boolean;
21
+ hasPersistedPageTabFlowModel?: boolean;
21
22
  [key: string]: any;
22
23
  }
23
24
 
@@ -73,7 +73,8 @@ export const languageCodes: Record<string, LocaleOptions> = {
73
73
  'tk-TK': { label: 'Turkmen' },
74
74
  'tr-TR': { label: 'Türkçe' },
75
75
  'uk-UA': { label: 'Українська' },
76
- 'ur-PK': { label: 'Oʻzbekcha' },
76
+ 'ur-PK': { label: 'اردو' },
77
+ 'uz-UZ': { label: 'Oʻzbekcha' },
77
78
  'vi-VN': { label: 'Tiếng Việt' },
78
79
  'zh-CN': { label: '简体中文' },
79
80
  'zh-HK': { label: '繁體中文(香港)' },
@@ -240,6 +240,16 @@ const CurrentUserProvider: FC = ({ children }) => {
240
240
  return;
241
241
  }
242
242
 
243
+ try {
244
+ await app.apiClient.auth.syncCookies();
245
+ } catch {
246
+ // Cookie bootstrap is best-effort; auth:check remains the source of truth for the current page load.
247
+ }
248
+
249
+ if (!mounted) {
250
+ return;
251
+ }
252
+
243
253
  const userMeta = createCollectionContextMeta(
244
254
  () => app.flowEngine.context.dataSourceManager?.getDataSource('main')?.getCollection('users') || null,
245
255
  app.flowEngine.translate('Current user'),
@@ -298,6 +308,8 @@ const CurrentUserProvider: FC = ({ children }) => {
298
308
  return <CurrentUserContext.Provider value={contextValue}>{children}</CurrentUserContext.Provider>;
299
309
  };
300
310
 
311
+ CurrentUserProvider.displayName = 'CurrentUserProvider';
312
+
301
313
  const RootRedirect: FC = () => {
302
314
  const app = useApp<Application>();
303
315
  const hasToken = !!app?.apiClient?.auth?.token;