@bexis2/bexis2-core-ui 0.4.74 → 0.4.76

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,13 @@
1
1
  # bexis-core-ui
2
+ ## 0.4.76
3
+ - API
4
+ - Extending the API with custom headers and configuration
5
+
6
+
7
+ ## 0.4.75
8
+ - Menu
9
+ - add ids
10
+
2
11
  ## 0.4.73
3
12
  - NumberInput
4
13
  - fix issue destroying layout with number.MinValue
@@ -1,7 +1,7 @@
1
1
  export declare const Api: {
2
- get: (url: any, request?: string) => Promise<import("axios").AxiosResponse<any, any>>;
3
- delete: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
4
- post: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
5
- put: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
6
- patch: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
2
+ get: (url: any, request?: string, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
3
+ delete: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
4
+ post: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
5
+ put: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
6
+ patch: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
7
7
  };
@@ -4,6 +4,7 @@ import { goTo } from "../../../services/BaseCaller";
4
4
  export let menubarItem;
5
5
  export let comboboxValue;
6
6
  let id = Math.floor(Math.random() * 100).toString();
7
+ let idLabel = "menu-" + menubarItem.Title.replaceAll(" ", "-");
7
8
  let popupCombobox = {
8
9
  event: "click",
9
10
  target: id,
@@ -16,7 +17,7 @@ let popupCombobox = {
16
17
  {#if menubarItem.Items.length < 1}
17
18
  <div class="p-2">
18
19
 
19
- <button class="grid" use:popup={popupCombobox} >
20
+ <button id={id+"bt"} class="grid" use:popup={popupCombobox} >
20
21
  <a class="grid" href={menubarItem.Url} target="{menubarItem.Target}">
21
22
  <span class="capitalize whitespace-nowrap text-lg hover:text-secondary-500">{comboboxValue ?? menubarItem.Title}</span>
22
23
  </a>
@@ -26,7 +27,7 @@ let popupCombobox = {
26
27
  <div class="sm:hidden block">
27
28
  <AccordionItem padding="p-2">
28
29
  <svelte:fragment slot="summary"
29
- ><button class="flex items-center gap-x-1">
30
+ ><button id={idLabel} class="flex items-center gap-x-1">
30
31
  <span class="capitalize text-lg hover:text-secondary-500">{menubarItem.Title}</span>
31
32
  </button></svelte:fragment
32
33
  >
@@ -37,7 +38,7 @@ let popupCombobox = {
37
38
  >
38
39
  </div>
39
40
  <div class="hidden sm:block place-self-center" use:popup={popupCombobox}>
40
- <button class="flex items-center gap-x-1 px-2">
41
+ <button id={idLabel} class="flex items-center gap-x-1 px-2">
41
42
  <span class="capitalize text-lg whitespace-nowrap hover:text-secondary-500">{menubarItem.Title}▾</span>
42
43
  </button>
43
44
 
@@ -54,11 +54,12 @@ async function logOffFn() {
54
54
  <ListBoxItem
55
55
  class="text-md sm:text-sm text-surface-800 py-1 hover:text-secondary-500 bg-transparent hover:bg-surface-200"
56
56
  bind:group={item.Title}
57
+
57
58
  name="medium"
58
59
  value={item.Title}
59
60
 
60
61
  >
61
- <a href={item.Url} target="{item.Target}" on:click|preventDefault={()=>clickFn(item)}>{item.Title}</a>
62
+ <a id={"menu-"+item.Title.replaceAll(' ', '-')} href={item.Url} target="{item.Target}" on:click|preventDefault={()=>clickFn(item)}>{item.Title}</a>
62
63
 
63
64
  </ListBoxItem>
64
65
 
@@ -18,7 +18,7 @@ let popupCombobox = {
18
18
  <div class="sm:hidden">
19
19
  <AccordionItem padding="p-2">
20
20
  <svelte:fragment slot="summary"
21
- ><button class="flex items-center gap-x-1 text-sm text-surface-800 w-5 h-full">
21
+ ><button id="settings" class="flex items-center gap-x-1 text-sm text-surface-800 w-5 h-full">
22
22
  <span class="capitalize"><Fa icon={faCog} /></span>
23
23
  </button></svelte:fragment
24
24
  >
@@ -26,7 +26,7 @@ let popupCombobox = {
26
26
  </AccordionItem>
27
27
  </div>
28
28
  <div class="hidden sm:block place-self-center" use:popup={popupCombobox}>
29
- <button class="flex items-center gap-x-1">
29
+ <button id="menu-settings" class="flex items-center gap-x-1">
30
30
  <div class="hidden sm:block" />
31
31
  <span class="capitalize"><Fa icon={faCog} /></span>
32
32
  </button>
@@ -1,7 +1,7 @@
1
1
  export declare const Api: {
2
- get: (url: any, request?: string) => Promise<import("axios").AxiosResponse<any, any>>;
3
- delete: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
4
- post: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
5
- put: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
6
- patch: (url: any, request: any) => Promise<import("axios").AxiosResponse<any, any>>;
2
+ get: (url: any, request?: string, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
3
+ delete: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
4
+ post: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
5
+ put: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
6
+ patch: (url: any, request: any, headers?: {}, config?: {}) => Promise<import("axios").AxiosResponse<any, any>>;
7
7
  };
@@ -3,7 +3,7 @@ import axios from 'axios';
3
3
  import { host, username, password, errorStore, csrfToken } from '../stores/apiStores';
4
4
  console.log('setup axios');
5
5
  // implement a method to execute all the request from here.
6
- const apiRequest = (method, url, request) => {
6
+ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {}) => {
7
7
  // Create a instance of axios to use the same base url.
8
8
  const axiosAPI = axios.create({
9
9
  baseURL: host
@@ -11,14 +11,16 @@ const apiRequest = (method, url, request) => {
11
11
  const requestVerificationToken = csrfToken;
12
12
  const headers = {
13
13
  authorization: 'Basic ' + btoa(username + ':' + password),
14
- '__RequestVerificationToken': requestVerificationToken
14
+ '__RequestVerificationToken': requestVerificationToken,
15
+ ...customHeaders
15
16
  };
16
17
  //using the axios instance to perform the request that received from each http method
17
18
  return axiosAPI({
18
19
  method,
19
20
  url,
20
21
  data: request,
21
- headers
22
+ headers,
23
+ ...customConfig
22
24
  })
23
25
  .then((res) => {
24
26
  //console.log("res-test",res);
@@ -38,15 +40,15 @@ const apiRequest = (method, url, request) => {
38
40
  });
39
41
  };
40
42
  // function to execute the http get request
41
- const get = (url, request = '') => apiRequest('get', url, request);
43
+ const get = (url, request = '', headers = {}, config = {}) => apiRequest('get', url, request, headers, config);
42
44
  // function to execute the http delete request
43
- const deleteRequest = (url, request) => apiRequest('delete', url, request);
45
+ const deleteRequest = (url, request, headers = {}, config = {}) => apiRequest('delete', url, request, headers, config);
44
46
  // function to execute the http post request
45
- const post = (url, request) => apiRequest('post', url, request);
47
+ const post = (url, request, headers = {}, config = {}) => apiRequest('post', url, request, headers, config);
46
48
  // function to execute the http put request
47
- const put = (url, request) => apiRequest('put', url, request);
49
+ const put = (url, request, headers = {}, config = {}) => apiRequest('put', url, request, headers, config);
48
50
  // function to execute the http path request
49
- const patch = (url, request) => apiRequest('patch', url, request);
51
+ const patch = (url, request, headers = {}, config = {}) => apiRequest('patch', url, request, headers, config);
50
52
  // expose your method to other services or actions
51
53
  export const Api = {
52
54
  get,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.4.74",
3
+ "version": "0.4.76",
4
4
  "private": false,
5
5
  "description": "Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).",
6
6
  "keywords": [
@@ -14,6 +14,7 @@
14
14
  export let comboboxValue;
15
15
 
16
16
  let id = Math.floor(Math.random() * 100).toString();
17
+ let idLabel = "menu-"+menubarItem.Title.replaceAll(' ', '-');
17
18
 
18
19
  let popupCombobox: PopupSettings = {
19
20
  event: 'click',
@@ -27,7 +28,7 @@
27
28
  {#if menubarItem.Items.length < 1}
28
29
  <div class="p-2">
29
30
 
30
- <button class="grid" use:popup={popupCombobox} >
31
+ <button id={id+"bt"} class="grid" use:popup={popupCombobox} >
31
32
  <a class="grid" href={menubarItem.Url} target="{menubarItem.Target}">
32
33
  <span class="capitalize whitespace-nowrap text-lg hover:text-secondary-500">{comboboxValue ?? menubarItem.Title}</span>
33
34
  </a>
@@ -37,7 +38,7 @@
37
38
  <div class="sm:hidden block">
38
39
  <AccordionItem padding="p-2">
39
40
  <svelte:fragment slot="summary"
40
- ><button class="flex items-center gap-x-1">
41
+ ><button id={idLabel} class="flex items-center gap-x-1">
41
42
  <span class="capitalize text-lg hover:text-secondary-500">{menubarItem.Title}</span>
42
43
  </button></svelte:fragment
43
44
  >
@@ -48,7 +49,7 @@
48
49
  >
49
50
  </div>
50
51
  <div class="hidden sm:block place-self-center" use:popup={popupCombobox}>
51
- <button class="flex items-center gap-x-1 px-2">
52
+ <button id={idLabel} class="flex items-center gap-x-1 px-2">
52
53
  <span class="capitalize text-lg whitespace-nowrap hover:text-secondary-500">{menubarItem.Title}▾</span>
53
54
  </button>
54
55
 
@@ -74,11 +74,12 @@
74
74
  <ListBoxItem
75
75
  class="text-md sm:text-sm text-surface-800 py-1 hover:text-secondary-500 bg-transparent hover:bg-surface-200"
76
76
  bind:group={item.Title}
77
+
77
78
  name="medium"
78
79
  value={item.Title}
79
80
 
80
81
  >
81
- <a href={item.Url} target="{item.Target}" on:click|preventDefault={()=>clickFn(item)}>{item.Title}</a>
82
+ <a id={"menu-"+item.Title.replaceAll(' ', '-')} href={item.Url} target="{item.Target}" on:click|preventDefault={()=>clickFn(item)}>{item.Title}</a>
82
83
 
83
84
  </ListBoxItem>
84
85
 
@@ -24,7 +24,7 @@
24
24
  <div class="sm:hidden">
25
25
  <AccordionItem padding="p-2">
26
26
  <svelte:fragment slot="summary"
27
- ><button class="flex items-center gap-x-1 text-sm text-surface-800 w-5 h-full">
27
+ ><button id="settings" class="flex items-center gap-x-1 text-sm text-surface-800 w-5 h-full">
28
28
  <span class="capitalize"><Fa icon={faCog} /></span>
29
29
  </button></svelte:fragment
30
30
  >
@@ -32,7 +32,7 @@
32
32
  </AccordionItem>
33
33
  </div>
34
34
  <div class="hidden sm:block place-self-center" use:popup={popupCombobox}>
35
- <button class="flex items-center gap-x-1">
35
+ <button id="menu-settings" class="flex items-center gap-x-1">
36
36
  <div class="hidden sm:block" />
37
37
  <span class="capitalize"><Fa icon={faCog} /></span>
38
38
  </button>
@@ -6,7 +6,7 @@ import type { errorType } from '$models/Models';
6
6
  console.log('setup axios');
7
7
 
8
8
  // implement a method to execute all the request from here.
9
- const apiRequest = (method, url, request) => {
9
+ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {}) => {
10
10
  // Create a instance of axios to use the same base url.
11
11
  const axiosAPI = axios.create({
12
12
  baseURL: host
@@ -15,7 +15,8 @@ const apiRequest = (method, url, request) => {
15
15
  const requestVerificationToken = csrfToken;
16
16
  const headers = {
17
17
  authorization: 'Basic ' + btoa(username + ':' + password),
18
- '__RequestVerificationToken': requestVerificationToken
18
+ '__RequestVerificationToken': requestVerificationToken,
19
+ ...customHeaders
19
20
  };
20
21
 
21
22
 
@@ -24,7 +25,8 @@ const apiRequest = (method, url, request) => {
24
25
  method,
25
26
  url,
26
27
  data: request,
27
- headers
28
+ headers,
29
+ ...customConfig
28
30
  })
29
31
  .then((res) => {
30
32
  //console.log("res-test",res);
@@ -50,19 +52,19 @@ const apiRequest = (method, url, request) => {
50
52
  };
51
53
 
52
54
  // function to execute the http get request
53
- const get = (url, request = '') => apiRequest('get', url, request);
55
+ const get = (url, request = '', headers ={}, config ={}) => apiRequest('get', url, request, headers, config);
54
56
 
55
57
  // function to execute the http delete request
56
- const deleteRequest = (url, request) => apiRequest('delete', url, request);
58
+ const deleteRequest = (url, request, headers ={}, config ={}) => apiRequest('delete', url, request, headers, config);
57
59
 
58
60
  // function to execute the http post request
59
- const post = (url, request) => apiRequest('post', url, request);
61
+ const post = (url, request, headers ={}, config ={}) => apiRequest('post', url, request, headers, config);
60
62
 
61
63
  // function to execute the http put request
62
- const put = (url, request) => apiRequest('put', url, request);
64
+ const put = (url, request, headers ={}, config ={}) => apiRequest('put', url, request, headers, config);
63
65
 
64
66
  // function to execute the http path request
65
- const patch = (url, request) => apiRequest('patch', url, request);
67
+ const patch = (url, request, headers ={}, config ={}) => apiRequest('patch', url, request, headers, config);
66
68
 
67
69
  // expose your method to other services or actions
68
70
  export const Api = {