@nubitio/crud 0.4.1 → 0.5.0
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.cjs +9 -5
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +9 -5
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -6912,20 +6912,22 @@ function ResourceSchemaProvider({ children, resolver }) {
|
|
|
6912
6912
|
children
|
|
6913
6913
|
});
|
|
6914
6914
|
}
|
|
6915
|
-
function resolveWithRuntimeErrors(resolver, supportedOperations = []) {
|
|
6915
|
+
function resolveWithRuntimeErrors(resolver, supportedOperations = [], formLayout) {
|
|
6916
6916
|
try {
|
|
6917
6917
|
return {
|
|
6918
6918
|
fields: resolver(),
|
|
6919
6919
|
isLoading: false,
|
|
6920
6920
|
error: void 0,
|
|
6921
|
-
supportedOperations
|
|
6921
|
+
supportedOperations,
|
|
6922
|
+
formLayout
|
|
6922
6923
|
};
|
|
6923
6924
|
} catch (runtimeError) {
|
|
6924
6925
|
return {
|
|
6925
6926
|
fields: [],
|
|
6926
6927
|
isLoading: false,
|
|
6927
6928
|
error: runtimeError instanceof Error ? runtimeError : new Error(String(runtimeError)),
|
|
6928
|
-
supportedOperations
|
|
6929
|
+
supportedOperations,
|
|
6930
|
+
formLayout
|
|
6929
6931
|
};
|
|
6930
6932
|
}
|
|
6931
6933
|
}
|
|
@@ -6951,7 +6953,7 @@ function useResolvedResourceFields({ apiUrl, manualFields, overrides, fieldContr
|
|
|
6951
6953
|
baselineFields: baseline.fields,
|
|
6952
6954
|
contract: fieldContract,
|
|
6953
6955
|
legacyOverrides: fieldContract ? void 0 : overrides
|
|
6954
|
-
}), baseline.supportedOperations);
|
|
6956
|
+
}), baseline.supportedOperations, baseline.formLayout);
|
|
6955
6957
|
}, [
|
|
6956
6958
|
baseline,
|
|
6957
6959
|
fieldContract,
|
|
@@ -7031,7 +7033,7 @@ function SmartCrudPage({ resource, fieldOverrides, formRef, onSelectionChanged,
|
|
|
7031
7033
|
const effectiveGridRef = gridRef ?? internalGridRef;
|
|
7032
7034
|
const resolvedBaseResource = (0, react.useMemo)(() => resolveCrudResource(resource), [resource]);
|
|
7033
7035
|
const hasManualFields = !resource.fieldContract && Array.isArray(resource.fields) && resource.fields.length > 0;
|
|
7034
|
-
const { fields, isLoading, error, supportedOperations } = useResolvedResourceFields({
|
|
7036
|
+
const { fields, isLoading, error, supportedOperations, formLayout: inferredFormLayout } = useResolvedResourceFields({
|
|
7035
7037
|
apiUrl: resolvedBaseResource.apiUrl,
|
|
7036
7038
|
manualFields: hasManualFields ? buildFields(resource.fields) : void 0,
|
|
7037
7039
|
overrides: hasManualFields ? void 0 : fieldOverrides,
|
|
@@ -7066,11 +7068,13 @@ function SmartCrudPage({ resource, fieldOverrides, formRef, onSelectionChanged,
|
|
|
7066
7068
|
apiUrl: normalizedApiUrl,
|
|
7067
7069
|
fields: hasManualFields ? buildFields(resource.fields) : gridFields,
|
|
7068
7070
|
formFields: processedFields,
|
|
7071
|
+
formLayout: resolvedBaseResource.formLayout ?? inferredFormLayout,
|
|
7069
7072
|
_supportedOperations: supportedOperations
|
|
7070
7073
|
}), [
|
|
7071
7074
|
fields,
|
|
7072
7075
|
gridFields,
|
|
7073
7076
|
hasManualFields,
|
|
7077
|
+
inferredFormLayout,
|
|
7074
7078
|
normalizedApiUrl,
|
|
7075
7079
|
processedFields,
|
|
7076
7080
|
resolvedBaseResource,
|
package/dist/index.d.cts
CHANGED
|
@@ -1871,6 +1871,11 @@ interface ResourceSchemaResolution {
|
|
|
1871
1871
|
isLoading: boolean;
|
|
1872
1872
|
error: Error | undefined;
|
|
1873
1873
|
supportedOperations: string[];
|
|
1874
|
+
/**
|
|
1875
|
+
* Backend-declared form layout (sections/tabs) from the API doc, when the
|
|
1876
|
+
* resource publishes one. Explicit `ResourceConfig.formLayout` wins.
|
|
1877
|
+
*/
|
|
1878
|
+
formLayout?: FormLayout;
|
|
1874
1879
|
}
|
|
1875
1880
|
interface ResourceSchemaResolver {
|
|
1876
1881
|
useResourceSchema(request: ResourceSchemaRequest): ResourceSchemaResolution;
|
package/dist/index.d.mts
CHANGED
|
@@ -1871,6 +1871,11 @@ interface ResourceSchemaResolution {
|
|
|
1871
1871
|
isLoading: boolean;
|
|
1872
1872
|
error: Error | undefined;
|
|
1873
1873
|
supportedOperations: string[];
|
|
1874
|
+
/**
|
|
1875
|
+
* Backend-declared form layout (sections/tabs) from the API doc, when the
|
|
1876
|
+
* resource publishes one. Explicit `ResourceConfig.formLayout` wins.
|
|
1877
|
+
*/
|
|
1878
|
+
formLayout?: FormLayout;
|
|
1874
1879
|
}
|
|
1875
1880
|
interface ResourceSchemaResolver {
|
|
1876
1881
|
useResourceSchema(request: ResourceSchemaRequest): ResourceSchemaResolution;
|
package/dist/index.mjs
CHANGED
|
@@ -6888,20 +6888,22 @@ function ResourceSchemaProvider({ children, resolver }) {
|
|
|
6888
6888
|
children
|
|
6889
6889
|
});
|
|
6890
6890
|
}
|
|
6891
|
-
function resolveWithRuntimeErrors(resolver, supportedOperations = []) {
|
|
6891
|
+
function resolveWithRuntimeErrors(resolver, supportedOperations = [], formLayout) {
|
|
6892
6892
|
try {
|
|
6893
6893
|
return {
|
|
6894
6894
|
fields: resolver(),
|
|
6895
6895
|
isLoading: false,
|
|
6896
6896
|
error: void 0,
|
|
6897
|
-
supportedOperations
|
|
6897
|
+
supportedOperations,
|
|
6898
|
+
formLayout
|
|
6898
6899
|
};
|
|
6899
6900
|
} catch (runtimeError) {
|
|
6900
6901
|
return {
|
|
6901
6902
|
fields: [],
|
|
6902
6903
|
isLoading: false,
|
|
6903
6904
|
error: runtimeError instanceof Error ? runtimeError : new Error(String(runtimeError)),
|
|
6904
|
-
supportedOperations
|
|
6905
|
+
supportedOperations,
|
|
6906
|
+
formLayout
|
|
6905
6907
|
};
|
|
6906
6908
|
}
|
|
6907
6909
|
}
|
|
@@ -6927,7 +6929,7 @@ function useResolvedResourceFields({ apiUrl, manualFields, overrides, fieldContr
|
|
|
6927
6929
|
baselineFields: baseline.fields,
|
|
6928
6930
|
contract: fieldContract,
|
|
6929
6931
|
legacyOverrides: fieldContract ? void 0 : overrides
|
|
6930
|
-
}), baseline.supportedOperations);
|
|
6932
|
+
}), baseline.supportedOperations, baseline.formLayout);
|
|
6931
6933
|
}, [
|
|
6932
6934
|
baseline,
|
|
6933
6935
|
fieldContract,
|
|
@@ -7007,7 +7009,7 @@ function SmartCrudPage({ resource, fieldOverrides, formRef, onSelectionChanged,
|
|
|
7007
7009
|
const effectiveGridRef = gridRef ?? internalGridRef;
|
|
7008
7010
|
const resolvedBaseResource = useMemo(() => resolveCrudResource(resource), [resource]);
|
|
7009
7011
|
const hasManualFields = !resource.fieldContract && Array.isArray(resource.fields) && resource.fields.length > 0;
|
|
7010
|
-
const { fields, isLoading, error, supportedOperations } = useResolvedResourceFields({
|
|
7012
|
+
const { fields, isLoading, error, supportedOperations, formLayout: inferredFormLayout } = useResolvedResourceFields({
|
|
7011
7013
|
apiUrl: resolvedBaseResource.apiUrl,
|
|
7012
7014
|
manualFields: hasManualFields ? buildFields(resource.fields) : void 0,
|
|
7013
7015
|
overrides: hasManualFields ? void 0 : fieldOverrides,
|
|
@@ -7042,11 +7044,13 @@ function SmartCrudPage({ resource, fieldOverrides, formRef, onSelectionChanged,
|
|
|
7042
7044
|
apiUrl: normalizedApiUrl,
|
|
7043
7045
|
fields: hasManualFields ? buildFields(resource.fields) : gridFields,
|
|
7044
7046
|
formFields: processedFields,
|
|
7047
|
+
formLayout: resolvedBaseResource.formLayout ?? inferredFormLayout,
|
|
7045
7048
|
_supportedOperations: supportedOperations
|
|
7046
7049
|
}), [
|
|
7047
7050
|
fields,
|
|
7048
7051
|
gridFields,
|
|
7049
7052
|
hasManualFields,
|
|
7053
|
+
inferredFormLayout,
|
|
7050
7054
|
normalizedApiUrl,
|
|
7051
7055
|
processedFields,
|
|
7052
7056
|
resolvedBaseResource,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubitio/crud",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Declarative CRUD engine with field DSL, forms, datagrids, RBAC, conditional logic and pluggable adapters (Hydra/REST).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"react-dom": "^19.0.0",
|
|
57
57
|
"react-i18next": "^14.0.0",
|
|
58
58
|
"react-router-dom": "^6.0.0",
|
|
59
|
-
"@nubitio/
|
|
60
|
-
"@nubitio/
|
|
59
|
+
"@nubitio/ui": "^0.5.0",
|
|
60
|
+
"@nubitio/core": "^0.5.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"react-dropzone": "^15.0.0"
|