@nocobase/client-v2 2.1.0-beta.47 → 2.1.0-beta.48
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.
- package/es/components/form/ScanInput/CodeScanner.d.ts +18 -0
- package/es/components/form/ScanInput/ScanBox.d.ts +12 -0
- package/es/components/form/ScanInput/ScanInput.d.ts +18 -0
- package/es/components/form/ScanInput/index.d.ts +11 -0
- package/es/components/form/ScanInput/types.d.ts +10 -0
- package/es/components/form/ScanInput/useCodeScanner.d.ts +31 -0
- package/es/components/form/index.d.ts +1 -0
- package/es/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.d.ts +14 -0
- package/es/index.mjs +76 -36
- package/lib/index.js +111 -71
- package/package.json +8 -7
- package/src/components/form/ScanInput/CodeScanner.tsx +219 -0
- package/src/components/form/ScanInput/ScanBox.tsx +30 -0
- package/src/components/form/ScanInput/ScanInput.tsx +150 -0
- package/src/components/form/ScanInput/__tests__/ScanInput.test.tsx +119 -0
- package/src/components/form/ScanInput/__tests__/useCodeScanner.test.tsx +123 -0
- package/src/components/form/ScanInput/index.ts +12 -0
- package/src/components/form/ScanInput/types.ts +12 -0
- package/src/components/form/ScanInput/useCodeScanner.ts +136 -0
- package/src/components/form/index.tsx +1 -0
- package/src/flow/actions/__tests__/actionLinkageRules.race.repro.test.ts +45 -0
- package/src/flow/actions/linkageRules.tsx +16 -4
- package/src/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.tsx +111 -26
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +61 -0
- package/src/flow/models/fields/InputFieldModel.tsx +56 -1
- package/src/flow/models/fields/__tests__/InputFieldModel.test.tsx +116 -0
|
@@ -0,0 +1,18 @@
|
|
|
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 React from 'react';
|
|
10
|
+
import type { CodeFormatsToSupport } from './types';
|
|
11
|
+
type CodeScannerProps = {
|
|
12
|
+
visible: boolean;
|
|
13
|
+
formatsToSupport?: CodeFormatsToSupport;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
onScanSuccess: (result: string) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function CodeScanner(props: CodeScannerProps): React.ReactPortal;
|
|
18
|
+
export {};
|
|
@@ -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
|
+
import React from 'react';
|
|
10
|
+
export declare function ScanBox({ style }: {
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { InputProps } from 'antd';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import type { CodeFormatsToSupport } from './types';
|
|
12
|
+
export type ScanInputProps = Omit<InputProps, 'onChange'> & {
|
|
13
|
+
disableManualInput?: boolean;
|
|
14
|
+
enableScan?: boolean;
|
|
15
|
+
formatsToSupport?: CodeFormatsToSupport;
|
|
16
|
+
onChange?: (value: string | React.ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
};
|
|
18
|
+
export declare function ScanInput({ value, onChange, disabled, disableManualInput, enableScan, formatsToSupport, onFocus, suffix, ...rest }: ScanInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 * from './CodeScanner';
|
|
10
|
+
export * from './ScanInput';
|
|
11
|
+
export * from './types';
|
|
@@ -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
|
+
import type { Html5QrcodeSupportedFormats } from 'html5-qrcode';
|
|
10
|
+
export type CodeFormatsToSupport = Html5QrcodeSupportedFormats[];
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { CodeFormatsToSupport } from './types';
|
|
10
|
+
type ScannerSize = {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
type UseCodeScannerOptions = {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
elementId: string;
|
|
17
|
+
formatsToSupport?: CodeFormatsToSupport;
|
|
18
|
+
scanBoxSize?: ScannerSize;
|
|
19
|
+
onScannerSizeChanged?: (size: ScannerSize) => void;
|
|
20
|
+
onScanSuccess: (text: string) => void;
|
|
21
|
+
onScanFailure?: () => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const DEFAULT_CODE_FORMATS: CodeFormatsToSupport;
|
|
24
|
+
export declare function getCodeScanBoxSize(width: number, height: number): {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function useCodeScanner({ enabled, elementId, formatsToSupport, scanBoxSize, onScannerSizeChanged, onScanSuccess, onScanFailure, }: UseCodeScannerOptions): {
|
|
29
|
+
startScanFile: (file: File) => Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -10,6 +10,20 @@ import { CollectionField, FlowModel } from '@nocobase/flow-engine';
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { FieldModel } from '../../base/FieldModel';
|
|
12
12
|
import { type ItemChain } from './itemChain';
|
|
13
|
+
import { type AssociationFieldNames } from './recordSelectShared';
|
|
14
|
+
export declare function canRecordPickerSelectMultiple(collectionField: {
|
|
15
|
+
type?: string;
|
|
16
|
+
} | null | undefined, allowMultiple?: boolean): boolean;
|
|
17
|
+
export declare function shouldClearRecordPickerValueOnMultipleChange(collectionField: {
|
|
18
|
+
type?: string;
|
|
19
|
+
} | null | undefined, previousAllowMultiple?: boolean, nextAllowMultiple?: boolean): boolean;
|
|
20
|
+
export declare function normalizeRecordPickerSelectedRows(value: unknown, allowMultiple: boolean): any[];
|
|
21
|
+
export declare function getRecordPickerEmptyValue(allowMultiple: boolean): any[];
|
|
22
|
+
export declare function getRecordPickerClearedValue(): any;
|
|
23
|
+
export declare function normalizeRecordPickerValue(value: unknown, fieldNames: AssociationFieldNames, allowMultiple: boolean): any[] | {
|
|
24
|
+
label: unknown;
|
|
25
|
+
value: unknown;
|
|
26
|
+
};
|
|
13
27
|
export declare function buildRecordPickerParentItemContext(ctx: any): {
|
|
14
28
|
parentItem: ItemChain;
|
|
15
29
|
parentItemMeta: any;
|