@bexis2/bexis2-core-ui 0.2.32 → 0.3.0

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,7 @@
1
1
  # bexis-core-ui
2
+ ## 0.3.0
3
+
4
+ - update skeleton ui -> 2.5.0
2
5
 
3
6
  ## 0.2.32
4
7
 
@@ -25,7 +28,7 @@
25
28
  ## 0.2.28
26
29
 
27
30
  - add disabled to multiselect
28
-
31
+
29
32
  ## 0.2.27
30
33
 
31
34
  - fix brand stretching
@@ -7,7 +7,8 @@ import { javascript, esLint } from "@codemirror/lang-javascript";
7
7
  import { lintGutter, linter } from "@codemirror/lint";
8
8
  import { json, jsonParseLinter } from "@codemirror/lang-json";
9
9
  import { oneDark } from "@codemirror/theme-one-dark";
10
- import { Modal, modalStore } from "@skeletonlabs/skeleton";
10
+ import { Modal, getModalStore } from "@skeletonlabs/skeleton";
11
+ const modalStore = getModalStore();
11
12
  import { faMoon, faSave, faSun } from "@fortawesome/free-regular-svg-icons";
12
13
  import { faArrowRotateLeft, faXmark } from "@fortawesome/free-solid-svg-icons";
13
14
  export let id;
@@ -4,8 +4,8 @@
4
4
  export default class DropdownKvP extends SvelteComponentTyped<{
5
5
  target: any;
6
6
  id: any;
7
- title: any;
8
7
  source: any;
8
+ title: any;
9
9
  required?: boolean | undefined;
10
10
  invalid?: boolean | undefined;
11
11
  valid?: boolean | undefined;
@@ -27,8 +27,8 @@ declare const __propDef: {
27
27
  props: {
28
28
  target: any;
29
29
  id: any;
30
- title: any;
31
30
  source: any;
31
+ title: any;
32
32
  required?: boolean | undefined;
33
33
  invalid?: boolean | undefined;
34
34
  valid?: boolean | undefined;
@@ -1,181 +1,180 @@
1
- <script>
2
- import InputContainer from './InputContainer.svelte';
3
-
4
- import Select from 'svelte-select';
5
- import { onMount } from 'svelte';
6
-
7
- export let source;
8
- export let target;
9
- export let id;
10
- export let title;
11
- export let itemId = 'value';
12
- export let itemLabel = 'label';
13
- export let itemGroup = 'group';
14
- export let isMulti = true;
15
- export let complexSource = false;
16
- export let complexTarget = false;
17
- export let required = false;
18
- export let feedback = [''];
19
- export let placeholder = '-- Please select --';
20
- export let invalid = false;
21
- export let loading = false;
22
- export let help = false;
23
- export let clearable = true;
24
- export let disabled = false;
25
-
26
-
27
- let isLoaded = false;
28
-
29
- $: value = null;
30
- $: updateTarget(value);
31
- $: target, setValue(target);
32
-
33
- let groupBy;
34
- $: groupBy;
35
-
36
- function updateTarget(selection) {
37
- //console.log("UPDATE target",selection);
38
- //different cases
39
- //a) source is complex model is simple return array
40
- if (complexSource && !complexTarget && isLoaded && isMulti) {
41
- //console.log('a) source is complex model is simple');
42
-
43
- target = [];
44
- for (let i in selection) {
45
- let item = selection[i];
46
- target.push(item[itemId]);
47
- }
48
- }
49
-
50
- if (!complexSource && !complexTarget && isLoaded && isMulti) {
51
- target = [];
52
-
53
- for (let i in selection) {
54
- target.push(selection[i].value);
55
- }
56
- }
57
-
58
- if (complexSource && complexTarget && isLoaded && isMulti) {
59
- //console.log("both complex",selection);
60
- target = selection;
61
- }
62
-
63
- if (complexSource && complexTarget && isLoaded && !isMulti) {
64
- target = selection;
65
- }
66
-
67
- if (!complexSource && !complexTarget && isLoaded && !isMulti) {
68
- target = selection.value;
69
- }
70
-
71
- if (complexSource && !complexTarget && isLoaded && !isMulti) {
72
- target = selection[itemLabel];
73
- //console.log('selection', selection);
74
- }
75
-
76
- //console.log('selection ' + title, selection);
77
- //console.log('target ' + title, target);
78
- }
79
-
80
- onMount(async () => {
81
- //console.log("OnMount", target)
82
- if(complexSource && complexTarget) // after on mount a setValue is needed when data is complex
83
- {
84
- setValue(target);
85
- }
86
- });
87
-
88
- function setValue(t) {
89
- //console.log("Set Value",t);
90
- //a) source is complex model is simple
91
- if (complexSource && !complexTarget && isMulti) {
92
- let items = [];
93
- // event.detail will be null unless isMulti is true and user has removed a single item
94
- for (let i in t) {
95
- let t = target[i];
96
- items.push(source.find((item) => item[itemId] === t));
97
- }
98
-
99
- isLoaded = true;
100
- if (items.length > 0) {
101
- value = items;
102
- }
103
- ////console.log(value);
104
- groupBy = (item) => item[itemGroup];
105
- }
106
-
107
- if (complexSource && complexTarget && isMulti) {
108
- value = t;
109
- isLoaded = true;
110
- groupBy = (item) => item[itemGroup];
111
- }
112
-
113
- //b) simple liust and simple model
114
- if (!complexSource && !complexTarget && isMulti) {
115
- //console.log('b) simple liust and simple model');
116
- //console.log('source', source);
117
- //console.log("target",t);
118
- isLoaded = true;
119
- //set target only if its nit empty
120
- if (t != null && t !== undefined && t != '') {
121
- //console.log('target', t);
122
- value = t;
123
- }
124
- }
125
-
126
- if (!isMulti) {
127
- //console.log("onmount",complexSource,complexTarget,value,target)
128
- if (!complexSource && !complexTarget) {
129
- value = {
130
- value: t,
131
- label: t
132
- };
133
- }
134
-
135
- if (complexSource && complexTarget) {
136
- value = t;
137
- groupBy = (item) => item[itemGroup];
138
- }
139
-
140
- if (complexSource && !complexTarget) {
141
- //value = target
142
- console.log(
143
- 'this case is currently not supported (complexSource,complexTarget,isMulti)',
144
- complexSource,
145
- complexTarget,
146
- isMulti
147
- );
148
- }
149
-
150
- isLoaded = true;
151
- }
152
-
153
- //console.log(t,value)
154
- }
155
- </script>
156
-
157
- <InputContainer {id} label={title} {feedback} {required} {help}>
158
- <Select
159
- {id}
160
- items={source}
161
- {groupBy}
162
- {itemId}
163
- label={itemLabel}
164
- multiple={isMulti}
165
- bind:value
166
- {placeholder}
167
- hasError={invalid}
168
- {loading}
169
- {clearable}
170
- {disabled}
171
- on:change
172
- on:input
173
- on:focus
174
- on:blur
175
- on:clear
176
- on:loaded
177
- on:error
178
- on:filter
179
- on:hoverItem
180
- />
181
- </InputContainer>
1
+ <script>
2
+ import InputContainer from './InputContainer.svelte';
3
+
4
+ import Select from 'svelte-select';
5
+ import { onMount } from 'svelte';
6
+
7
+ export let source;
8
+ export let target;
9
+ export let id;
10
+ export let title;
11
+ export let itemId = 'value';
12
+ export let itemLabel = 'label';
13
+ export let itemGroup = 'group';
14
+ export let isMulti = true;
15
+ export let complexSource = false;
16
+ export let complexTarget = false;
17
+ export let required = false;
18
+ export let feedback = [''];
19
+ export let placeholder = '-- Please select --';
20
+ export let invalid = false;
21
+ export let loading = false;
22
+ export let help = false;
23
+ export let clearable = true;
24
+ export let disabled = false;
25
+
26
+ let isLoaded = false;
27
+
28
+ $: value = null;
29
+ $: updateTarget(value);
30
+ $: target, setValue(target);
31
+
32
+ let groupBy;
33
+ $: groupBy;
34
+
35
+ function updateTarget(selection) {
36
+ //console.log("UPDATE target",selection);
37
+ //different cases
38
+ //a) source is complex model is simple return array
39
+ if (complexSource && !complexTarget && isLoaded && isMulti) {
40
+ //console.log('a) source is complex model is simple');
41
+
42
+ target = [];
43
+ for (let i in selection) {
44
+ let item = selection[i];
45
+ target.push(item[itemId]);
46
+ }
47
+ }
48
+
49
+ if (!complexSource && !complexTarget && isLoaded && isMulti) {
50
+ target = [];
51
+
52
+ for (let i in selection) {
53
+ target.push(selection[i].value);
54
+ }
55
+ }
56
+
57
+ if (complexSource && complexTarget && isLoaded && isMulti) {
58
+ //console.log("both complex",selection);
59
+ target = selection;
60
+ }
61
+
62
+ if (complexSource && complexTarget && isLoaded && !isMulti) {
63
+ target = selection;
64
+ }
65
+
66
+ if (!complexSource && !complexTarget && isLoaded && !isMulti) {
67
+ target = selection.value;
68
+ }
69
+
70
+ if (complexSource && !complexTarget && isLoaded && !isMulti) {
71
+ target = selection[itemLabel];
72
+ //console.log('selection', selection);
73
+ }
74
+
75
+ //console.log('selection ' + title, selection);
76
+ //console.log('target ' + title, target);
77
+ }
78
+
79
+ onMount(async () => {
80
+ //console.log("OnMount", target)
81
+ if (complexSource && complexTarget) {
82
+ // after on mount a setValue is needed when data is complex
83
+ setValue(target);
84
+ }
85
+ });
86
+
87
+ function setValue(t) {
88
+ //console.log("Set Value",t);
89
+ //a) source is complex model is simple
90
+ if (complexSource && !complexTarget && isMulti) {
91
+ let items = [];
92
+ // event.detail will be null unless isMulti is true and user has removed a single item
93
+ for (let i in t) {
94
+ let t = target[i];
95
+ items.push(source.find((item) => item[itemId] === t));
96
+ }
97
+
98
+ isLoaded = true;
99
+ if (items.length > 0) {
100
+ value = items;
101
+ }
102
+ ////console.log(value);
103
+ groupBy = (item) => item[itemGroup];
104
+ }
105
+
106
+ if (complexSource && complexTarget && isMulti) {
107
+ value = t;
108
+ isLoaded = true;
109
+ groupBy = (item) => item[itemGroup];
110
+ }
111
+
112
+ //b) simple liust and simple model
113
+ if (!complexSource && !complexTarget && isMulti) {
114
+ //console.log('b) simple liust and simple model');
115
+ //console.log('source', source);
116
+ //console.log("target",t);
117
+ isLoaded = true;
118
+ //set target only if its nit empty
119
+ if (t != null && t !== undefined && t != '') {
120
+ //console.log('target', t);
121
+ value = t;
122
+ }
123
+ }
124
+
125
+ if (!isMulti) {
126
+ //console.log("onmount",complexSource,complexTarget,value,target)
127
+ if (!complexSource && !complexTarget) {
128
+ value = {
129
+ value: t,
130
+ label: t
131
+ };
132
+ }
133
+
134
+ if (complexSource && complexTarget) {
135
+ value = t;
136
+ groupBy = (item) => item[itemGroup];
137
+ }
138
+
139
+ if (complexSource && !complexTarget) {
140
+ //value = target
141
+ console.log(
142
+ 'this case is currently not supported (complexSource,complexTarget,isMulti)',
143
+ complexSource,
144
+ complexTarget,
145
+ isMulti
146
+ );
147
+ }
148
+
149
+ isLoaded = true;
150
+ }
151
+
152
+ //console.log(t,value)
153
+ }
154
+ </script>
155
+
156
+ <InputContainer {id} label={title} {feedback} {required} {help}>
157
+ <Select
158
+ {id}
159
+ items={source}
160
+ {groupBy}
161
+ {itemId}
162
+ label={itemLabel}
163
+ multiple={isMulti}
164
+ bind:value
165
+ {placeholder}
166
+ hasError={invalid}
167
+ {loading}
168
+ {clearable}
169
+ {disabled}
170
+ on:change
171
+ on:input
172
+ on:focus
173
+ on:blur
174
+ on:clear
175
+ on:loaded
176
+ on:error
177
+ on:filter
178
+ on:hoverItem
179
+ />
180
+ </InputContainer>
@@ -4,8 +4,8 @@
4
4
  export default class MultiSelect extends SvelteComponentTyped<{
5
5
  target: any;
6
6
  id: any;
7
- title: any;
8
7
  source: any;
8
+ title: any;
9
9
  disabled?: boolean | undefined;
10
10
  required?: boolean | undefined;
11
11
  invalid?: boolean | undefined;
@@ -42,8 +42,8 @@ declare const __propDef: {
42
42
  props: {
43
43
  target: any;
44
44
  id: any;
45
- title: any;
46
45
  source: any;
46
+ title: any;
47
47
  disabled?: boolean | undefined;
48
48
  required?: boolean | undefined;
49
49
  invalid?: boolean | undefined;
@@ -1,8 +1,46 @@
1
- <script>import { Toast } from "@skeletonlabs/skeleton";
1
+ <script>import { onMount } from "svelte";
2
+ import { Toast, getToastStore } from "@skeletonlabs/skeleton";
2
3
  import { notificationStore } from "../../stores/pageStores";
4
+ import { notificationType } from "../../models/Enums";
5
+ const toastStore = getToastStore();
3
6
  let btnStyle;
4
7
  $:
5
8
  btnStyle = $notificationStore === void 0 || $notificationStore.btnStyle === void 0 ? notificationStore.getBtnStyle() : $notificationStore.btnStyle;
9
+ $:
10
+ $notificationStore, triggerToast();
11
+ onMount(() => {
12
+ toastStore.clear();
13
+ });
14
+ function triggerToast() {
15
+ toastStore.clear();
16
+ const timeout = 3e4;
17
+ let classes = "";
18
+ if ($notificationStore.message != void 0 && $notificationStore.message != "") {
19
+ switch ($notificationStore.notificationType) {
20
+ case notificationType.success:
21
+ classes = "bg-success-300 border-solid border-2 border-success-500 shadow-md text-surface-900";
22
+ break;
23
+ case notificationType.warning:
24
+ classes = "bg-warning-300 border-solid border-2 border-warning-500 shadow-md text-surface-900";
25
+ break;
26
+ case notificationType.error:
27
+ classes = "bg-error-300 border-solid border-2 border-error-500 shadow-md text-surface-900";
28
+ break;
29
+ case notificationType.surface:
30
+ classes = "bg-surface-300 border-solid border-2 border-surface-500 shadow-md text-surface-900";
31
+ break;
32
+ }
33
+ const notificationToast = {
34
+ classes,
35
+ message: $notificationStore.message,
36
+ timeout,
37
+ callback: () => {
38
+ toastStore.clear();
39
+ }
40
+ };
41
+ toastStore.trigger(notificationToast);
42
+ }
43
+ }
6
44
  </script>
7
45
 
8
46
  <Toast position="t" buttonDismiss={btnStyle} />
@@ -11,7 +11,6 @@ import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floati
11
11
  import { storePopup } from "@skeletonlabs/skeleton";
12
12
  import { breadcrumbStore } from "../../stores/pageStores";
13
13
  storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
14
- import { helpStore } from "../../stores/pageStores";
15
14
  import Docs from "./Docs.svelte";
16
15
  export let title = "";
17
16
  export let note = "";
@@ -39,7 +38,7 @@ onMount(async () => {
39
38
  {/if}
40
39
 
41
40
  <div class="grid grid-cols-2">
42
- <Breadcrumb bind:title={title} />
41
+ <Breadcrumb bind:title />
43
42
  <Docs {links} {note} />
44
43
  </div>
45
44
  </svelte:fragment>
@@ -1,9 +1,13 @@
1
1
  <script>import { breadcrumbStore } from "../../../stores/pageStores";
2
+ import { browser } from "$app/environment";
3
+ import { base } from "$app/paths";
2
4
  export let title;
3
5
  $:
4
6
  update(title);
5
7
  function update(t) {
6
- breadcrumbStore.updateItem({ label: t, link: window.location.pathname });
8
+ if (browser) {
9
+ breadcrumbStore.updateItem({ label: t, link: window.location.pathname });
10
+ }
7
11
  }
8
12
  let list = [];
9
13
  $:
@@ -12,22 +16,22 @@ $:
12
16
  breadcrumbStore.subscribe((value) => {
13
17
  list = value?.items;
14
18
  });
15
- </script>
16
-
17
- <div class="px-5 py-2">
18
- <ol class="breadcrumb -p50">
19
- <!--default home-->
20
- <li class="crumb"><a class="anchor" href={'/'}>Home</a></li>
21
- <li class="crumb-separator" aria-hidden>&rsaquo;</li>
22
-
23
- {#each list as crumb, i}
24
- <!-- If crumb index is less than the breadcrumb length minus 1 -->
25
- {#if i < list.length - 1}
26
- <li class="crumb"><a class="anchor" href={crumb.link}>{crumb.label}</a></li>
27
- <li class="crumb-separator" aria-hidden>&rsaquo;</li>
28
- {:else}
29
- <li class="crumb">{crumb.label}</li>
30
- {/if}
31
- {/each}
32
- </ol>
33
- </div>
19
+ </script>
20
+
21
+ <div class="px-5 py-2">
22
+ <ol class="breadcrumb -p50">
23
+ <!--default home-->
24
+ <li class="crumb"><a class="anchor" href={base + '/'}>Home</a></li>
25
+ <li class="crumb-separator" aria-hidden>&rsaquo;</li>
26
+
27
+ {#each list as crumb, i}
28
+ <!-- If crumb index is less than the breadcrumb length minus 1 -->
29
+ {#if i < list.length - 1}
30
+ <li class="crumb"><a class="anchor" href={crumb.link}>{crumb.label}</a></li>
31
+ <li class="crumb-separator" aria-hidden>&rsaquo;</li>
32
+ {:else}
33
+ <li class="crumb">{crumb.label}</li>
34
+ {/if}
35
+ {/each}
36
+ </ol>
37
+ </div>
@@ -21,3 +21,5 @@ export function setApiConfig(_host, _user, _pw) {
21
21
  passwordStore.update((p) => (p = _pw));
22
22
  //console.log('overwrite host',_host);
23
23
  }
24
+ // import { getToastStore } from '@skeletonlabs/skeleton';
25
+ // const x = getToastStore();
@@ -1,7 +1,6 @@
1
1
  import type { helpItemType, helpStoreType, notificationItemType, notificationStoreType } from '../models/Models';
2
2
  import type { MenuModel, breadcrumbItemType } from '../models/Page';
3
3
  import { BreadcrumbModel } from '../models/Page';
4
- import { type Writable } from 'svelte/store';
5
4
  export declare const helpStore: {
6
5
  subscribe: (this: void, run: import("svelte/store").Subscriber<helpStoreType>, invalidate?: ((value?: helpStoreType | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
7
6
  set: (this: void, value: helpStoreType) => void;
@@ -16,7 +15,7 @@ export declare const helpStore: {
16
15
  reset: () => void;
17
16
  clear: () => void;
18
17
  };
19
- export declare const menuStore: Writable<MenuModel>;
18
+ export declare const menuStore: import("svelte/store").Writable<MenuModel>;
20
19
  export declare const breadcrumbStore: {
21
20
  subscribe: (this: void, run: import("svelte/store").Subscriber<BreadcrumbModel>, invalidate?: ((value?: BreadcrumbModel | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
22
21
  set: (this: void, value: BreadcrumbModel) => void;
@@ -30,8 +29,6 @@ export declare const notificationStore: {
30
29
  set: (this: void, value: notificationStoreType) => void;
31
30
  update: (this: void, updater: import("svelte/store").Updater<notificationStoreType>) => void;
32
31
  setNotification: (notificationItem: notificationItemType) => void;
33
- triggerNotification: () => void;
34
- clear: () => void;
35
32
  showNotification: (notificationItem: notificationItemType) => void;
36
33
  getBtnStyle: () => string;
37
34
  };
@@ -1,6 +1,5 @@
1
1
  import { notificationType } from '../models/Enums';
2
2
  import { BreadcrumbModel } from '../models/Page';
3
- import { toastStore } from '@skeletonlabs/skeleton';
4
3
  import { writable } from 'svelte/store';
5
4
  function createHelpStore() {
6
5
  // set Store Type
@@ -149,55 +148,18 @@ function createNotificationStore() {
149
148
  message: notificationItem.message,
150
149
  btnStyle: btnStyle
151
150
  });
152
- notificationStore.subscribe((value) => { });
153
- },
154
- // triggers the notification to show
155
- triggerNotification: () => {
156
- let timeout = 30000;
157
- let classes = '';
158
- let message = '';
159
151
  notificationStore.subscribe((value) => {
160
- switch (value.notificationType) {
161
- case notificationType.success:
162
- classes =
163
- 'bg-success-300 border-solid border-2 border-success-500 shadow-md text-surface-900';
164
- break;
165
- case notificationType.warning:
166
- classes =
167
- 'bg-warning-300 border-solid border-2 border-warning-500 shadow-md text-surface-900';
168
- break;
169
- case notificationType.error:
170
- classes =
171
- 'bg-error-300 border-solid border-2 border-error-500 shadow-md text-surface-900';
172
- break;
173
- case notificationType.surface:
174
- classes =
175
- 'bg-surface-300 border-solid border-2 border-surface-500 shadow-md text-surface-900';
176
- break;
177
- }
178
- message = value.message;
152
+ "";
179
153
  });
180
- if (classes != '' && message != '') {
181
- const notificationToast = {
182
- classes: classes,
183
- message: message,
184
- timeout: timeout
185
- };
186
- toastStore.trigger(notificationToast);
187
- }
188
- },
189
- // cleans the toastStore
190
- clear: () => {
191
- toastStore.clear();
192
154
  },
193
155
  // cleans, sets, and schows the notification (all you need ;))
194
156
  showNotification: (notificationItem) => {
195
- notificationStore.clear();
157
+ //notificationStore.clear();
196
158
  notificationStore.setNotification({
197
159
  notificationType: notificationItem.notificationType,
198
160
  message: notificationItem.message
199
161
  });
200
- notificationStore.triggerNotification();
162
+ // if the store is changing, the notification componend will be updated
201
163
  },
202
164
  // gets the dissmiss Button style
203
165
  getBtnStyle: () => {
@@ -0,0 +1,2 @@
1
+ import type { CustomThemeConfig } from '@skeletonlabs/tw-plugin';
2
+ export declare const bexis2Theme: CustomThemeConfig;