lupine.web 1.0.30 → 1.0.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lupine.web",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "license": "MIT",
5
5
  "author": "uuware.com",
6
6
  "homepage": "https://github.com/uuware/lupine.js",
@@ -23,6 +23,7 @@ export class PageRouter {
23
23
  private routerData: PageRouterData[] = [];
24
24
  private filter: PageRouterCallback | undefined;
25
25
  private framePage: FramePageProps | undefined;
26
+ private subDir: string = '';
26
27
 
27
28
  // if the filter returns null (passed filter), the router will continue.
28
29
  // it works in the same way as in use method
@@ -30,6 +31,11 @@ export class PageRouter {
30
31
  this.filter = filter;
31
32
  }
32
33
 
34
+ // if the script is under a sub-dir (without last /), then findRoute needs to remove it from the url
35
+ setSubDir(subDir: string) {
36
+ this.subDir = subDir;
37
+ }
38
+
33
39
  setFramePage(framePage: FramePageProps) {
34
40
  this.framePage = framePage;
35
41
  }
@@ -149,6 +155,9 @@ export class PageRouter {
149
155
  }
150
156
 
151
157
  async handleRoute(url: string, props: PageProps, renderPartPage: boolean): Promise<VNode<any> | null> {
158
+ if (url.startsWith(this.subDir)) {
159
+ url = url.substring(this.subDir.length);
160
+ }
152
161
  let vNode = null;
153
162
  if (this.filter) {
154
163
  vNode = await this.callHandle(this.filter, url, props);