@bexis2/bexis2-core-ui 0.4.93 → 0.4.95

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.95
3
+ - Input
4
+ - Add focus in/out for element
5
+ - format date picker
6
+
7
+
8
+ ## 0.4.94
9
+ - Input
10
+ - Add InputContainer to export for custom components
2
11
 
3
12
 
4
13
  ## 0.4.93
@@ -1,4 +1,6 @@
1
- <script>import InputContainer from "./InputContainer.svelte";
1
+ <script>import Fa from "svelte-fa";
2
+ import { faCalendar, faClock } from "@fortawesome/free-solid-svg-icons";
3
+ import InputContainer from "./InputContainer.svelte";
2
4
  import SveltyPicker from "svelty-picker";
3
5
  export let id = "";
4
6
  export let label = "";
@@ -17,8 +19,6 @@ export let mode = "date";
17
19
  export let initialDate = "";
18
20
  export let format = "yyyy-mm-dd";
19
21
  export let displayFormat = "yyyy-mm-dd";
20
- export let onChangeHandler = () => {
21
- };
22
22
  let width = "w-32";
23
23
  if (mode !== "date" && mode !== "time" && mode !== "datetime") {
24
24
  throw new Error(`Invalid mode: ${mode}. Valid modes are 'date', 'time', and 'datetime'.`);
@@ -34,16 +34,32 @@ if (mode === "datetime") {
34
34
  </script>
35
35
 
36
36
  <InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
37
- <SveltyPicker
38
- {mode}
39
- name={label}
40
- {format}
41
- {displayFormat}
42
- {initialDate}
43
- bind:value
44
- inputClasses="input variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400 {width}"
45
- on:change={onChangeHandler}
46
- {disabled}
47
- {placeholder}
48
- />
37
+ <!-- 1. Wrap everything in a relative container so the icon positions against this boundary -->
38
+ <div class="relative w-full">
39
+
40
+ <SveltyPicker
41
+ {mode}
42
+ name={label}
43
+ {format}
44
+ {displayFormat}
45
+ {initialDate}
46
+ bind:value
47
+ on:input
48
+ on:change
49
+ {disabled}
50
+ {placeholder}
51
+ manualInput={true}
52
+
53
+ inputClasses="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400 pr-10 {valid ? 'input-success' : ''} {invalid ? 'input-error' : ''}"
54
+ />
55
+ {#if mode === 'time'}
56
+ <Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
57
+ {:else if mode === 'date' }
58
+ <Fa icon={faCalendar} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
59
+ {:else if mode === 'datetime'}
60
+ <Fa icon={faCalendar} class="absolute inset-y-2 right-5 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
61
+ <Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
62
+ {/if}
63
+ </div>
64
+
49
65
  </InputContainer>
@@ -18,11 +18,12 @@ declare const __propDef: {
18
18
  initialDate?: string;
19
19
  format?: string;
20
20
  displayFormat?: string;
21
- onChangeHandler?: (event: CustomEvent) => void;
22
21
  };
23
22
  events: {
24
23
  showDescription: CustomEvent<any>;
25
24
  hideDescription: CustomEvent<any>;
25
+ input: CustomEvent<any>;
26
+ change: CustomEvent<any>;
26
27
  } & {
27
28
  [evt: string]: CustomEvent<any>;
28
29
  };
@@ -11,7 +11,7 @@ export let description = "";
11
11
  export let showDescription = false;
12
12
  export let showIcon = false;
13
13
  const dispatch = createEventDispatcher();
14
- function onMouseOver() {
14
+ export function onMouseOver() {
15
15
  if (help) {
16
16
  helpStore.show(id);
17
17
  }
@@ -19,7 +19,7 @@ function onMouseOver() {
19
19
  dispatch("showDescription", { id, description });
20
20
  }
21
21
  }
22
- function onMouseOut() {
22
+ export function onMouseOut() {
23
23
  if (help) {
24
24
  helpStore.hide(id);
25
25
  }
@@ -36,6 +36,9 @@ function onMouseOut() {
36
36
  on:focus={onMouseOver}
37
37
  on:mouseout={onMouseOut}
38
38
  on:blur={onMouseOut}
39
+ on:focusin={onMouseOver}
40
+ on:focusout={onMouseOut}
41
+
39
42
  >
40
43
  <label class="label w-full flex" for="{id}">
41
44
  <span class="grow"
@@ -9,6 +9,8 @@ declare const __propDef: {
9
9
  description?: string;
10
10
  showDescription?: boolean;
11
11
  showIcon?: boolean;
12
+ onMouseOver?: () => void;
13
+ onMouseOut?: () => void;
12
14
  };
13
15
  events: {
14
16
  showDescription: CustomEvent<any>;
@@ -26,5 +28,7 @@ export type InputContainerProps = typeof __propDef.props;
26
28
  export type InputContainerEvents = typeof __propDef.events;
27
29
  export type InputContainerSlots = typeof __propDef.slots;
28
30
  export default class InputContainer extends SvelteComponent<InputContainerProps, InputContainerEvents, InputContainerSlots> {
31
+ get onMouseOver(): () => void;
32
+ get onMouseOut(): () => void;
29
33
  }
30
34
  export {};
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ import MultiSelect from './components/form/MultiSelect.svelte';
17
17
  import NumberInput from './components/form/NumberInput.svelte';
18
18
  import TextInput from './components/form/TextInput.svelte';
19
19
  import TextArea from './components/form/TextArea.svelte';
20
+ import InputContainer from './components/form/InputContainer.svelte';
20
21
  import Table from './components/Table/Table.svelte';
21
22
  import TableFilter from './components/Table/TableFilter.svelte';
22
23
  import { columnFilter, searchFilter } from './components/Table/filter';
@@ -27,11 +28,11 @@ import CodeEditor from './components/CodeEditor/CodeEditor.svelte';
27
28
  import Notification from './components/page/Notification.svelte';
28
29
  import TablePlaceholder from './components/page/TablePlaceholder.svelte';
29
30
  import { bexis2theme } from './themes/theme-bexis2';
30
- export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DatePickerInput, DropdownKVP, Dropdown, MultiSelect, NumberInput, TextArea, TextInput };
31
+ export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DatePickerInput, DropdownKVP, Dropdown, MultiSelect, NumberInput, TextArea, TextInput, InputContainer };
31
32
  export { FileInfo, FileIcon, FileUploader };
32
33
  export { Spinner, Page, Alert, Menu, ErrorMessage };
33
34
  export { Api } from './services/Api.js';
34
- export { host, username, password, setApiConfig } from './stores/apiStores.js';
35
+ export { host, username, password, errorStore, setApiConfig } from './stores/apiStores.js';
35
36
  export type { userType, inputType, fileUploaderType, linkType, listItemType, keyValuePairType, fileInfoType, fileReaderInfoType, asciiFileReaderInfoType } from './models/Models.js';
36
37
  export { helpStore } from './stores/pageStores';
37
38
  export type { helpStoreType, helpItemType } from './models/Models';
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ import MultiSelect from './components/form/MultiSelect.svelte';
22
22
  import NumberInput from './components/form/NumberInput.svelte';
23
23
  import TextInput from './components/form/TextInput.svelte';
24
24
  import TextArea from './components/form/TextArea.svelte';
25
+ import InputContainer from './components/form/InputContainer.svelte';
25
26
  //table
26
27
  import Table from './components/Table/Table.svelte';
27
28
  import TableFilter from './components/Table/TableFilter.svelte';
@@ -37,14 +38,14 @@ import TablePlaceholder from './components/page/TablePlaceholder.svelte';
37
38
  // theme
38
39
  import { bexis2theme } from './themes/theme-bexis2';
39
40
  //Form
40
- export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DatePickerInput, DropdownKVP, Dropdown, MultiSelect, NumberInput, TextArea, TextInput };
41
+ export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DatePickerInput, DropdownKVP, Dropdown, MultiSelect, NumberInput, TextArea, TextInput, InputContainer };
41
42
  //File
42
43
  export { FileInfo, FileIcon, FileUploader };
43
44
  //others
44
45
  export { Spinner, Page, Alert, Menu, ErrorMessage };
45
46
  //Api
46
47
  export { Api } from './services/Api.js';
47
- export { host, username, password, setApiConfig } from './stores/apiStores.js';
48
+ export { host, username, password, errorStore, setApiConfig } from './stores/apiStores.js';
48
49
  //help
49
50
  export { helpStore } from './stores/pageStores';
50
51
  //notification
@@ -27,7 +27,7 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
27
27
  return Promise.resolve(res);
28
28
  })
29
29
  .catch((er) => {
30
- //console.log("🚀 ~ apiRequest ~ err:", er)
30
+ console.log("🚀 ~ apiRequest ~ err:", er);
31
31
  const err = er.response;
32
32
  let error = {
33
33
  status: err.status,
@@ -36,7 +36,8 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
36
36
  stackTrace: err.data.stackTrace,
37
37
  };
38
38
  errorStore.set(error);
39
- return Promise.reject(err);
39
+ console.log("🚀 ~ apiRequest ~ error:", error);
40
+ return Promise.reject(new Error(error.error));
40
41
  });
41
42
  };
42
43
  // function to execute the http get request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.4.93",
3
+ "version": "0.4.95",
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": [
@@ -1,4 +1,6 @@
1
1
  <script lang="ts">
2
+ import Fa from 'svelte-fa';
3
+ import { faCalendar, faClock } from '@fortawesome/free-solid-svg-icons';
2
4
  import InputContainer from './InputContainer.svelte';
3
5
  import SveltyPicker from 'svelty-picker';
4
6
 
@@ -19,7 +21,6 @@
19
21
  export let initialDate: string = '';
20
22
  export let format: string = 'yyyy-mm-dd';
21
23
  export let displayFormat: string = 'yyyy-mm-dd';
22
- export let onChangeHandler: (event: CustomEvent) => void = () => {};
23
24
 
24
25
  let width = 'w-32';
25
26
 
@@ -39,16 +40,32 @@
39
40
  </script>
40
41
 
41
42
  <InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
42
- <SveltyPicker
43
- {mode}
44
- name={label}
45
- {format}
46
- {displayFormat}
47
- {initialDate}
48
- bind:value
49
- inputClasses="input variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400 {width}"
50
- on:change={onChangeHandler}
51
- {disabled}
52
- {placeholder}
53
- />
43
+ <!-- 1. Wrap everything in a relative container so the icon positions against this boundary -->
44
+ <div class="relative w-full">
45
+
46
+ <SveltyPicker
47
+ {mode}
48
+ name={label}
49
+ {format}
50
+ {displayFormat}
51
+ {initialDate}
52
+ bind:value
53
+ on:input
54
+ on:change
55
+ {disabled}
56
+ {placeholder}
57
+ manualInput={true}
58
+
59
+ inputClasses="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400 pr-10 {valid ? 'input-success' : ''} {invalid ? 'input-error' : ''}"
60
+ />
61
+ {#if mode === 'time'}
62
+ <Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
63
+ {:else if mode === 'date' }
64
+ <Fa icon={faCalendar} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
65
+ {:else if mode === 'datetime'}
66
+ <Fa icon={faCalendar} class="absolute inset-y-2 right-5 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
67
+ <Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
68
+ {/if}
69
+ </div>
70
+
54
71
  </InputContainer>
@@ -15,7 +15,7 @@
15
15
 
16
16
  const dispatch = createEventDispatcher();
17
17
 
18
- function onMouseOver() {
18
+ export function onMouseOver() {
19
19
  if (help) {
20
20
  helpStore.show(id);
21
21
  }
@@ -26,7 +26,7 @@
26
26
 
27
27
  }
28
28
 
29
- function onMouseOut() {
29
+ export function onMouseOut() {
30
30
  if (help) {
31
31
  helpStore.hide(id);
32
32
  }
@@ -44,6 +44,9 @@
44
44
  on:focus={onMouseOver}
45
45
  on:mouseout={onMouseOut}
46
46
  on:blur={onMouseOut}
47
+ on:focusin={onMouseOver}
48
+ on:focusout={onMouseOut}
49
+
47
50
  >
48
51
  <label class="label w-full flex" for="{id}">
49
52
  <span class="grow"
package/src/lib/index.ts CHANGED
@@ -26,6 +26,8 @@ import NumberInput from './components/form/NumberInput.svelte';
26
26
  import TextInput from './components/form/TextInput.svelte';
27
27
  import TextArea from './components/form/TextArea.svelte';
28
28
 
29
+ import InputContainer from './components/form/InputContainer.svelte';
30
+
29
31
 
30
32
  //table
31
33
  import Table from './components/Table/Table.svelte';
@@ -61,7 +63,8 @@ export {
61
63
  MultiSelect,
62
64
  NumberInput,
63
65
  TextArea,
64
- TextInput
66
+ TextInput,
67
+ InputContainer
65
68
  };
66
69
 
67
70
  //File
@@ -72,7 +75,7 @@ export { Spinner, Page, Alert, Menu, ErrorMessage };
72
75
 
73
76
  //Api
74
77
  export { Api } from './services/Api.js';
75
- export { host, username, password, setApiConfig } from './stores/apiStores.js';
78
+ export { host, username, password,errorStore, setApiConfig } from './stores/apiStores.js';
76
79
 
77
80
  //Type
78
81
  export type {
@@ -21,6 +21,7 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
21
21
 
22
22
 
23
23
  //using the axios instance to perform the request that received from each http method
24
+
24
25
  return axiosAPI({
25
26
  method,
26
27
  url,
@@ -35,9 +36,11 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
35
36
 
36
37
  })
37
38
  .catch((er) => {
38
- //console.log("🚀 ~ apiRequest ~ err:", er)
39
+ console.log("🚀 ~ apiRequest ~ err:", er)
39
40
  const err = er.response;
40
41
 
42
+
43
+
41
44
  let error:errorType = {
42
45
  status: err.status,
43
46
  statusText: err.statusText,
@@ -46,8 +49,9 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
46
49
  }
47
50
 
48
51
  errorStore.set(error);
49
-
50
- return Promise.reject(err);
52
+ console.log("🚀 ~ apiRequest ~ error:", error)
53
+
54
+ return Promise.reject(new Error(error.error));
51
55
  });
52
56
  };
53
57