@record-evolution/widget-navbutton 1.0.1 → 1.0.3

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
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent widget-navbutton following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "widget-navbutton",
6
- "version": "1.0.1",
6
+ "version": "1.0.3",
7
7
  "type": "module",
8
8
  "main": "dist/widget-navbutton.js",
9
9
  "types": "dist/src/widget-navbutton.d.ts",
@@ -19,7 +19,7 @@
19
19
  "link": "npm link && cd ../RESWARM/frontend && npm link @record-evolution/widget-navbutton",
20
20
  "unlink": "npm unlink --global && cd ../RESWARM/frontend && npm unlink @record-evolution/widget-navbutton && npm i @record-evolution/widget-navbutton",
21
21
  "types": "cat src/definition-schema.json | json2ts > src/definition-schema.d.ts",
22
- "release": "npm run build && npm run types && npm version patch --tag-version-prefix='' && git push && git push --tag"
22
+ "release": "npm run build && npm run types && npm version patch --tag-version-prefix='' && git push && git push --tag && npm run build"
23
23
  },
24
24
  "dependencies": {
25
25
  "lit": "^3.3.1",
@@ -5,19 +5,19 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
- export type TitleSettings = string;
8
+ export type Label = string;
9
9
  /**
10
- * Navigation to perform on title click. Example: If you are at route /my/route/asset then 'settings/profile' routes to '/my/route/settings/profile'.
10
+ * Navigation to perform on button click. Leave blank to perform automatic back navigation. Example: If you are at route /my/route/asset then 'settings/profile' routes to '/my/route/settings/profile'.
11
11
  */
12
- export type TitleNavigation = string;
12
+ export type Navigation = string;
13
13
  /**
14
14
  * Font size in pixels
15
15
  */
16
16
  export type FontSize = number;
17
17
 
18
18
  export interface InputData {
19
- title?: TitleSettings;
20
- route?: TitleNavigation;
19
+ title?: Label;
20
+ route?: Navigation;
21
21
  style?: ButtonStyle;
22
22
  [k: string]: unknown;
23
23
  }
@@ -3,14 +3,14 @@
3
3
  "type": "object",
4
4
  "properties": {
5
5
  "title": {
6
- "title": "Title Settings",
6
+ "title": "Label",
7
7
  "order": 1,
8
8
  "type": "string"
9
9
  },
10
10
  "route": {
11
- "title": "Title Navigation",
11
+ "title": "Navigation",
12
12
  "order": 2,
13
- "description": "Navigation to perform on title click. Example: If you are at route /my/route/asset then 'settings/profile' routes to '/my/route/settings/profile'.",
13
+ "description": "Navigation to perform on button click. Leave blank to perform automatic back navigation. Example: If you are at route /my/route/asset then 'settings/profile' routes to '/my/route/settings/profile'.",
14
14
  "type": "string"
15
15
  },
16
16
  "style": {
@@ -42,13 +42,14 @@ export class WidgetNavbutton extends LitElement {
42
42
  }
43
43
 
44
44
  handleNavItemClick(route?: string) {
45
- console.log('Navigating to:', route, this.route)
46
45
  let goto: string
47
46
  if (this.inputData?.route === '') {
48
- goto = this.route?.split('/').filter(Boolean).slice(0, -1).join('/') || '/'
47
+ goto = '/' + this.route?.split('/').filter(Boolean).slice(0, -1).join('/') + '/' || '/'
48
+ goto = goto === '//' ? '/' : goto
49
49
  } else {
50
50
  goto = this.inputData?.route || '/'
51
51
  }
52
+ console.log('Navigating to:', route, this.route, { goto })
52
53
  const event = new CustomEvent('nav-submit', {
53
54
  detail: { path: goto },
54
55
  bubbles: true,