@resistdesign/voltra 3.0.0-alpha.41 → 3.0.0-alpha.42
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/app/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-
|
|
1
|
+
export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-B4DHXYKJ.js';
|
|
2
2
|
export { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
|
|
3
|
-
export { AutoForm, AutoFormView, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory, computeAreaBounds, createAutoField, createBrowserRouteAdapter, createFormRenderer, createHistoryBackHandler, createManualRouteAdapter, createMemoryHistory, createNativeRouteAdapter, createRouteAdapterFromHistory, createUniversalAdapter, defaultTranslateValidationErrorCode, getFieldKind, parseHistoryPath, parseTemplate, resolveSuite, useFormEngine, useRouteContext, validateAreas, wrapRouteAdapterWithPathResolver } from '../chunk-
|
|
3
|
+
export { AutoForm, AutoFormView, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory, computeAreaBounds, createAutoField, createBrowserRouteAdapter, createFormRenderer, createHistoryBackHandler, createManualRouteAdapter, createMemoryHistory, createNativeRouteAdapter, createRouteAdapterFromHistory, createUniversalAdapter, defaultTranslateValidationErrorCode, getFieldKind, parseHistoryPath, parseTemplate, resolveSuite, useFormEngine, useRouteContext, validateAreas, wrapRouteAdapterWithPathResolver } from '../chunk-FXMKH3RB.js';
|
|
4
4
|
import '../chunk-7AMEFPPP.js';
|
|
5
5
|
import '../chunk-YCTVEW2I.js';
|
|
6
6
|
import { mergeStringPaths, PATH_DELIMITER } from '../chunk-WNFRDIBW.js';
|
package/app/utils/Route.d.ts
CHANGED
|
@@ -140,9 +140,9 @@ export declare const RouteProvider: ({ adapter, initialPath, children, }: RouteP
|
|
|
140
140
|
*/
|
|
141
141
|
export type RouteProps<ParamsType extends Record<string, any>> = {
|
|
142
142
|
/**
|
|
143
|
-
* Route path pattern, using `:` for params.
|
|
143
|
+
* Route path pattern(s), using `:` for params.
|
|
144
144
|
*/
|
|
145
|
-
path?: string;
|
|
145
|
+
path?: string | string[];
|
|
146
146
|
/**
|
|
147
147
|
* Callback when params update for this route.
|
|
148
148
|
*
|
|
@@ -673,37 +673,49 @@ var RouteMatcher = ({
|
|
|
673
673
|
() => currentWindowPath,
|
|
674
674
|
[currentWindowPath]
|
|
675
675
|
);
|
|
676
|
-
const
|
|
677
|
-
() =>
|
|
678
|
-
[
|
|
676
|
+
const normalizedPaths = useMemo(
|
|
677
|
+
() => Array.isArray(path) ? path : [path],
|
|
678
|
+
[path]
|
|
679
679
|
);
|
|
680
|
-
const
|
|
681
|
-
() =>
|
|
682
|
-
|
|
680
|
+
const matchedRoute = useMemo(
|
|
681
|
+
() => {
|
|
682
|
+
for (const routePath of normalizedPaths) {
|
|
683
|
+
const fullPath = mergeStringPaths(parentPath, routePath);
|
|
684
|
+
const newParams = getParamsAndTestPath(targetCurrentPath, fullPath, exact);
|
|
685
|
+
if (newParams) {
|
|
686
|
+
return {
|
|
687
|
+
fullPath,
|
|
688
|
+
newParams
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return null;
|
|
693
|
+
},
|
|
694
|
+
[targetCurrentPath, parentPath, normalizedPaths, exact]
|
|
683
695
|
);
|
|
684
696
|
const params = useMemo(
|
|
685
697
|
() => ({
|
|
686
698
|
...parentParams,
|
|
687
|
-
...newParams ? newParams : {}
|
|
699
|
+
...matchedRoute?.newParams ? matchedRoute.newParams : {}
|
|
688
700
|
}),
|
|
689
|
-
[parentParams,
|
|
701
|
+
[parentParams, matchedRoute]
|
|
690
702
|
);
|
|
691
703
|
const newRouteContext = useMemo(
|
|
692
704
|
() => ({
|
|
693
705
|
currentWindowPath: targetCurrentPath,
|
|
694
|
-
parentPath: fullPath,
|
|
706
|
+
parentPath: matchedRoute?.fullPath ?? parentPath,
|
|
695
707
|
params,
|
|
696
708
|
isTopLevel: false,
|
|
697
709
|
adapter
|
|
698
710
|
}),
|
|
699
|
-
[targetCurrentPath,
|
|
711
|
+
[targetCurrentPath, matchedRoute, parentPath, params, adapter]
|
|
700
712
|
);
|
|
701
713
|
useEffect(() => {
|
|
702
714
|
if (onParamsChange) {
|
|
703
715
|
onParamsChange(params);
|
|
704
716
|
}
|
|
705
717
|
}, [params, onParamsChange]);
|
|
706
|
-
return newParams ? /* @__PURE__ */ jsx(RouteContextProvider, { value: newRouteContext, children }) : null;
|
|
718
|
+
return matchedRoute?.newParams ? /* @__PURE__ */ jsx(RouteContextProvider, { value: newRouteContext, children }) : null;
|
|
707
719
|
};
|
|
708
720
|
var RouteRootProvider = ({
|
|
709
721
|
children,
|
package/native/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
|
|
2
|
-
import { createFormRenderer, createHistoryBackHandler, buildHistoryPath, AutoFormView, AutoForm, parseTemplate, validateAreas, computeAreaBounds, parseHistoryPath, createMemoryHistory, Route, buildRoutePath } from '../chunk-
|
|
2
|
+
import { createFormRenderer, createHistoryBackHandler, buildHistoryPath, AutoFormView, AutoForm, parseTemplate, validateAreas, computeAreaBounds, parseHistoryPath, createMemoryHistory, Route, buildRoutePath } from '../chunk-FXMKH3RB.js';
|
|
3
3
|
import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
|
|
4
4
|
import { resolveRouteAdapterPath, getPathArray } from '../chunk-WNFRDIBW.js';
|
|
5
5
|
import '../chunk-I2KLQ2HA.js';
|
package/package.json
CHANGED
package/web/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createEasyLayout } from '../chunk-
|
|
2
|
-
import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-
|
|
1
|
+
import { createEasyLayout } from '../chunk-B4DHXYKJ.js';
|
|
2
|
+
import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-FXMKH3RB.js';
|
|
3
3
|
import { ERROR_MESSAGE_CONSTANTS } from '../chunk-YCTVEW2I.js';
|
|
4
4
|
import '../chunk-WNFRDIBW.js';
|
|
5
5
|
import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
|