@bexis2/bexis2-core-ui 0.4.62 → 0.4.64

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/README.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # bexis-core-ui
2
+ ## 0.4.64
3
+ - Page
4
+ - if application name position
5
+
6
+ ## 0.4.63
7
+ - Page
8
+ - check if hidden field exist
9
+
2
10
  ## 0.4.62
3
11
  - Page
4
12
  - change call order
@@ -18,6 +18,7 @@ import { getAntiForgeryToken } from "./PageCaller";
18
18
  import { get } from "svelte/store";
19
19
  import { getApplicationName } from "./breadcrumb/BreadcrumbDataCaller";
20
20
  export let title = "";
21
+ let applicationName = "";
21
22
  export let note = "";
22
23
  export let links = [];
23
24
  export let menu = true;
@@ -40,11 +41,15 @@ onMount(async () => {
40
41
  var token = get(csrfTokenStore);
41
42
  console.log("\u{1F680} ~ token:", token);
42
43
  if (!token || token.length === 0) {
43
- const data = await getAntiForgeryToken();
44
- csrfTokenStore.set(data.csrfToken);
45
- var x = get(csrfTokenStore);
46
- console.log("\u{1F680} ~ x:", x);
47
- title = await getApplicationName();
44
+ const tokenContainer = document.getElementsByName("__RequestVerificationToken")[0];
45
+ if (tokenContainer) {
46
+ const csrfToken = tokenContainer?.value;
47
+ csrfTokenStore.set(csrfToken);
48
+ } else {
49
+ const data = await getAntiForgeryToken();
50
+ csrfTokenStore.set(data.csrfToken);
51
+ }
52
+ applicationName = await getApplicationName();
48
53
  }
49
54
  });
50
55
  csrfTokenStore.subscribe((value) => {
@@ -70,7 +75,7 @@ function scrollToTop() {
70
75
  {/if}
71
76
 
72
77
  <div class="grid grid-cols-2">
73
- <Breadcrumb bind:title />
78
+ <Breadcrumb bind:title bind:applicationName />
74
79
  <Docs {links} {note} />
75
80
  </div>
76
81
  </svelte:fragment>
@@ -1,9 +1,9 @@
1
1
  <script>import { breadcrumbStore } from "../../../stores/pageStores";
2
2
  import { browser } from "$app/environment";
3
- import { onMount } from "svelte";
4
- import { getApplicationName } from "./BreadcrumbDataCaller";
5
3
  export let title;
6
4
  $: update(title);
5
+ export let applicationName;
6
+ $: applicationName = "";
7
7
  function update(t) {
8
8
  if (browser) {
9
9
  breadcrumbStore.updateItem({ label: t, link: window.location.pathname });
@@ -14,13 +14,11 @@ $: list;
14
14
  $: breadcrumbStore.subscribe((value) => {
15
15
  list = value?.items;
16
16
  });
17
- let applicationName = "BEXIS2";
18
- onMount(async () => {
19
- applicationName = title;
20
- });
21
17
  </script>
22
18
 
19
+
23
20
  <div class="px-5 py-2">
21
+
24
22
  <ol class="breadcrumb -p50">
25
23
  <!--default home-->
26
24
  <li class="crumb"><a class="anchor" href={'/'}>{applicationName}</a></li>
@@ -36,4 +34,7 @@ onMount(async () => {
36
34
  {/if}
37
35
  {/each}
38
36
  </ol>
37
+
39
38
  </div>
39
+
40
+
@@ -2,6 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  title: any;
5
+ applicationName: string;
5
6
  };
6
7
  events: {
7
8
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.4.62",
3
+ "version": "0.4.64",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -34,6 +34,7 @@ import type { helpItemType, helpStoreType } from '$models/Models';
34
34
 
35
35
 
36
36
  export let title = '';
37
+ let applicationName = '';
37
38
  export let note = '';
38
39
  export let links: linkType[] = [];
39
40
 
@@ -65,20 +66,23 @@ import type { helpItemType, helpStoreType } from '$models/Models';
65
66
 
66
67
  if(!token || token.length===0){
67
68
 
69
+ // check if csrf token exist as hidden field
70
+ const tokenContainer = document.getElementsByName('__RequestVerificationToken')[0]
71
+ if(tokenContainer)
72
+ {
73
+ const csrfToken = tokenContainer?.value;
74
+ csrfTokenStore.set(csrfToken);
75
+ }
76
+ else
77
+ {
68
78
  const data = await getAntiForgeryToken();
69
79
  csrfTokenStore.set(data.csrfToken);
70
- var x = get(csrfTokenStore);
71
- console.log("🚀 ~ x:", x)
72
-
73
- title = await getApplicationName();
74
-
75
- // get data from parent
76
- // const container = document.getElementsByName('__RequestVerificationToken')[0];
77
- // console.log("🚀 ~ container:", container)
78
- // let csrfToken = container?.getAttribute('value');
79
- // if(csrfToken) csrfTokenStore.set(csrfToken);
80
-
81
- //console.log("🚀 ~ csrfToken:", csrfToken)
80
+
81
+ }
82
+
83
+ applicationName = await getApplicationName();
84
+ //alert(title);
85
+
82
86
  }
83
87
  });
84
88
 
@@ -109,7 +113,7 @@ import type { helpItemType, helpStoreType } from '$models/Models';
109
113
  {/if}
110
114
 
111
115
  <div class="grid grid-cols-2">
112
- <Breadcrumb bind:title />
116
+ <Breadcrumb bind:title bind:applicationName />
113
117
  <Docs {links} {note} />
114
118
  </div>
115
119
  </svelte:fragment>
@@ -2,13 +2,16 @@
2
2
  import { breadcrumbStore } from '$store/pageStores';
3
3
  import type { breadcrumbItemType } from '$models/Page';
4
4
  import { browser } from '$app/environment';
5
- import { onMount } from 'svelte';
6
- import {getApplicationName} from './BreadcrumbDataCaller';
5
+
7
6
 
8
7
  export let title;
9
8
 
10
9
  $: update(title);
11
10
 
11
+ export let applicationName: string;
12
+ $: applicationName = "";
13
+
14
+
12
15
  function update(t) {
13
16
  if (browser) {
14
17
  breadcrumbStore.updateItem({ label: t, link: window.location.pathname });
@@ -22,15 +25,12 @@
22
25
  list = value?.items;
23
26
  });
24
27
 
25
- let applicationName = "BEXIS2";
26
-
27
- onMount(async () => {
28
- applicationName = title;
29
- });
30
28
 
31
29
  </script>
32
30
 
31
+
33
32
  <div class="px-5 py-2">
33
+
34
34
  <ol class="breadcrumb -p50">
35
35
  <!--default home-->
36
36
  <li class="crumb"><a class="anchor" href={'/'}>{applicationName}</a></li>
@@ -46,4 +46,7 @@
46
46
  {/if}
47
47
  {/each}
48
48
  </ol>
49
+
49
50
  </div>
51
+
52
+