@bsol-oss/react-datatable5 13.0.1-beta.6 → 13.0.1-beta.8
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/dist/index.d.ts +1 -0
- package/dist/index.js +294 -154
- package/dist/index.mjs +296 -156
- package/dist/types/components/Form/components/fields/useIdPickerData.d.ts +4 -0
- package/dist/types/components/Form/components/types/CustomJSONSchema7.d.ts +1 -0
- package/dist/types/components/Form/utils/useFormI18n.d.ts +14 -30
- package/package.json +7 -4
|
@@ -26,6 +26,7 @@ export interface UseIdPickerDataReturn {
|
|
|
26
26
|
missingIds: string[];
|
|
27
27
|
comboboxItems: Array<{
|
|
28
28
|
label: string;
|
|
29
|
+
displayLabel: string;
|
|
29
30
|
value: string;
|
|
30
31
|
raw: RecordType;
|
|
31
32
|
}>;
|
|
@@ -33,6 +34,7 @@ export interface UseIdPickerDataReturn {
|
|
|
33
34
|
filter: (text: string) => void;
|
|
34
35
|
set: (items: Array<{
|
|
35
36
|
label: string;
|
|
37
|
+
displayLabel: string;
|
|
36
38
|
value: string;
|
|
37
39
|
raw: RecordType;
|
|
38
40
|
}>) => void;
|
|
@@ -40,6 +42,8 @@ export interface UseIdPickerDataReturn {
|
|
|
40
42
|
idPickerLabels: any;
|
|
41
43
|
insideDialog: boolean;
|
|
42
44
|
renderDisplay: ((item: RecordType) => React.ReactNode) | undefined;
|
|
45
|
+
itemToValue: (item: RecordType) => string;
|
|
46
|
+
itemToString: (item: RecordType) => string;
|
|
43
47
|
loadInitialValues: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
44
48
|
column_ref: string;
|
|
45
49
|
errors: any;
|
|
@@ -79,6 +79,7 @@ export interface CustomJSONSchema7 extends JSONSchema7 {
|
|
|
79
79
|
foreign_key?: ForeignKeyProps;
|
|
80
80
|
variant?: string;
|
|
81
81
|
renderDisplay?: (item: unknown) => ReactNode;
|
|
82
|
+
itemToValue?: (item: unknown) => string;
|
|
82
83
|
loadInitialValues?: (params: LoadInitialValuesParams) => Promise<LoadInitialValuesResult>;
|
|
83
84
|
inputRender?: (props: {
|
|
84
85
|
column: string;
|
|
@@ -1,57 +1,41 @@
|
|
|
1
|
+
import { CustomJSONSchema7 } from '../components/types/CustomJSONSchema7';
|
|
1
2
|
/**
|
|
2
|
-
* Custom hook for form field labels
|
|
3
|
-
* Automatically handles colLabel construction
|
|
4
|
-
* Uses schema.title
|
|
3
|
+
* Custom hook for form field labels.
|
|
4
|
+
* Automatically handles colLabel construction.
|
|
5
|
+
* Uses schema.title for labels and schema.errorMessages for error messages.
|
|
5
6
|
*
|
|
6
7
|
* @param column - The column name
|
|
7
8
|
* @param prefix - The prefix for the field (usually empty string or parent path)
|
|
8
|
-
* @param schema - Required schema object with title
|
|
9
|
+
* @param schema - Required schema object with title and errorMessages properties
|
|
9
10
|
* @returns Object with label helper functions
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
13
|
* ```tsx
|
|
13
14
|
* const formI18n = useFormI18n(column, prefix, schema);
|
|
14
15
|
*
|
|
15
|
-
* // Get field label (
|
|
16
|
+
* // Get field label (from schema.title)
|
|
16
17
|
* <Field label={formI18n.label()} />
|
|
17
18
|
*
|
|
18
|
-
* // Get required error message
|
|
19
|
+
* // Get required error message (from schema.errorMessages?.required)
|
|
19
20
|
* <Text>{formI18n.required()}</Text>
|
|
20
21
|
*
|
|
21
|
-
* // Get custom text
|
|
22
|
-
* <Text>{formI18n.t('add_more')}</Text>
|
|
23
|
-
*
|
|
24
22
|
* // Access the raw colLabel
|
|
25
23
|
* const colLabel = formI18n.colLabel;
|
|
26
24
|
* ```
|
|
27
25
|
*/
|
|
28
|
-
export declare const useFormI18n: (column: string, prefix: string | undefined, schema: {
|
|
29
|
-
title?: string;
|
|
30
|
-
}) => {
|
|
26
|
+
export declare const useFormI18n: (column: string, prefix: string | undefined, schema: CustomJSONSchema7) => {
|
|
31
27
|
/**
|
|
32
28
|
* The constructed column label (prefix + column)
|
|
33
29
|
*/
|
|
34
30
|
colLabel: string;
|
|
35
31
|
/**
|
|
36
|
-
* Get the field label from schema title
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
label: (options?: any) => string;
|
|
40
|
-
/**
|
|
41
|
-
* Get the required error message
|
|
42
|
-
* Equivalent to: translate.t(removeIndex(`${colLabel}.field_required`))
|
|
43
|
-
*/
|
|
44
|
-
required: (options?: any) => string;
|
|
45
|
-
/**
|
|
46
|
-
* Get text for any custom key relative to the field
|
|
47
|
-
* Equivalent to: translate.t(removeIndex(`${colLabel}.${key}`))
|
|
48
|
-
*
|
|
49
|
-
* @param key - The key suffix (e.g., 'add_more', 'total', etc.)
|
|
50
|
-
* @param options - Optional options (e.g., defaultValue, interpolation variables)
|
|
32
|
+
* Get the field label from schema title property.
|
|
33
|
+
* Logs a debug message if title is missing.
|
|
51
34
|
*/
|
|
52
|
-
|
|
35
|
+
label: () => string;
|
|
53
36
|
/**
|
|
54
|
-
*
|
|
37
|
+
* Get the required error message from schema.errorMessages?.required.
|
|
38
|
+
* Returns a helpful fallback message if not provided.
|
|
55
39
|
*/
|
|
56
|
-
|
|
40
|
+
required: () => string;
|
|
57
41
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsol-oss/react-datatable5",
|
|
3
|
-
"version": "13.0.1-beta.
|
|
3
|
+
"version": "13.0.1-beta.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/bsol-oss/react-datatable5.git"
|
|
11
|
+
},
|
|
9
12
|
"homepage": "https://github.com/bsol-oss/react-datatable5#react-datatable5",
|
|
10
13
|
"author": "screw123",
|
|
11
14
|
"license": "MIT",
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
"ajv": "^8.12.0",
|
|
47
50
|
"ajv-errors": "^3.0.0",
|
|
48
51
|
"ajv-formats": "^3.0.1",
|
|
49
|
-
"axios": "^1.
|
|
52
|
+
"axios": "^1.13.2",
|
|
50
53
|
"dayjs": "^1.11.13",
|
|
51
54
|
"next-themes": "^0.4.4",
|
|
52
55
|
"react": "^19.0.0",
|
|
@@ -80,7 +83,7 @@
|
|
|
80
83
|
"lint-staged": "^16.2.5",
|
|
81
84
|
"prettier": "3.2.5",
|
|
82
85
|
"rollup-plugin-dts": "^6.1.0",
|
|
83
|
-
"storybook": "^10.
|
|
86
|
+
"storybook": "^10.1.11",
|
|
84
87
|
"typescript": "^5.2.2",
|
|
85
88
|
"vite": "^5.2.0"
|
|
86
89
|
},
|