@bexis2/bexis2-core-ui 0.2.17 → 0.2.18

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.
@@ -26,12 +26,13 @@
26
26
 
27
27
  $: value = null;
28
28
  $: updateTarget(value);
29
- $:target, setValue(target);
29
+ $: target, setValue(target);
30
30
 
31
31
  let groupBy;
32
32
  $: groupBy;
33
33
 
34
34
  function updateTarget(selection) {
35
+ console.log("UPDATE target",selection);
35
36
  //different cases
36
37
  //a) source is complex model is simple return array
37
38
  if (complexSource && !complexTarget && isLoaded && isMulti) {
@@ -46,8 +47,9 @@
46
47
 
47
48
  if (!complexSource && !complexTarget && isLoaded && isMulti) {
48
49
  target = [];
50
+
49
51
  for (let i in selection) {
50
- target.push(selection[i].value);
52
+ target.push(selection[i]);
51
53
  }
52
54
  }
53
55
 
@@ -74,72 +76,73 @@
74
76
  }
75
77
 
76
78
  onMount(async () => {
77
- setValue(target);
79
+ setValue(target);
78
80
  });
79
81
 
80
- function setValue(t)
81
- {
82
- //a) source is complex model is simple
83
- if (complexSource && !complexTarget && isMulti) {
84
- let items = [];
85
- // event.detail will be null unless isMulti is true and user has removed a single item
86
- for (let i in t) {
87
- let t = target[i];
88
- items.push(source.find((item) => item[itemId] === t));
89
- }
90
-
91
- isLoaded = true;
92
- if (items.length > 0) {
93
- value = items;
94
- }
95
- ////console.log(value);
96
- groupBy = (item) => item[itemGroup];
82
+ function setValue(t) {
83
+ //a) source is complex model is simple
84
+ if (complexSource && !complexTarget && isMulti) {
85
+ let items = [];
86
+ // event.detail will be null unless isMulti is true and user has removed a single item
87
+ for (let i in t) {
88
+ let t = target[i];
89
+ items.push(source.find((item) => item[itemId] === t));
90
+ }
91
+
92
+ isLoaded = true;
93
+ if (items.length > 0) {
94
+ value = items;
97
95
  }
96
+ ////console.log(value);
97
+ groupBy = (item) => item[itemGroup];
98
+ }
99
+
100
+ if (complexSource && complexTarget && isMulti) {
101
+ value = t;
102
+ isLoaded = true;
103
+ groupBy = (item) => item[itemGroup];
104
+ }
98
105
 
99
- if (complexSource && complexTarget && isMulti) {
106
+ //b) simple liust and simple model
107
+ if (!complexSource && !complexTarget && isMulti) {
108
+ console.log('b) simple liust and simple model');
109
+ console.log('source', source);
110
+ //console.log("target",t);
111
+ isLoaded = true;
112
+ //set target only if its nit empty
113
+ if (t != null && t !== undefined && t != '') {
114
+ console.log('target', t);
100
115
  value = t;
101
- isLoaded = true;
102
- groupBy = (item) => item[itemGroup];
116
+ }
117
+ }
118
+
119
+ if (!isMulti) {
120
+ //console.log("onmount",complexSource,complexTarget,value,target)
121
+ if (!complexSource && !complexTarget) {
122
+ value = {
123
+ value: t,
124
+ label: t
125
+ };
103
126
  }
104
127
 
105
- //b) simple liust and simple model
106
- if (!complexSource && !complexTarget && isMulti) {
107
- ////console.log("source", source);
108
- ////console.log("target",target);
109
- isLoaded = true;
110
- //set target only if its nit empty
111
- if (t != null && t !== undefined && t != '') {
112
- value = t;
113
- }
128
+ if (complexSource && complexTarget) {
129
+ value = t;
130
+ groupBy = (item) => item[itemGroup];
114
131
  }
115
132
 
116
- if (!isMulti) {
117
- //console.log("onmount",complexSource,complexTarget,value,target)
118
- if (!complexSource && !complexTarget) {
119
- value = {
120
- value: t,
121
- label: t
122
- };
123
- }
124
-
125
- if (complexSource && complexTarget) {
126
- value = t;
127
- groupBy = (item) => item[itemGroup];
128
- }
129
-
130
- if (complexSource && !complexTarget) {
131
- //value = target
132
- console.log(
133
- 'this case is currently not supported (complexSource,complexTarget,isMulti)',
134
- complexSource,
135
- complexTarget,
136
- isMulti
137
- );
138
- }
139
-
140
- isLoaded = true;
133
+ if (complexSource && !complexTarget) {
134
+ //value = target
135
+ console.log(
136
+ 'this case is currently not supported (complexSource,complexTarget,isMulti)',
137
+ complexSource,
138
+ complexTarget,
139
+ isMulti
140
+ );
141
141
  }
142
- }
142
+
143
+ isLoaded = true;
144
+ }
145
+ }
143
146
  </script>
144
147
 
145
148
  <InputContainer {id} label={title} {feedback} {required} {help}>
@@ -0,0 +1,8 @@
1
+ <script>import { Toast } from "@skeletonlabs/skeleton";
2
+ import { notificationStore } from "../../stores/pageStores";
3
+ let btnStyle;
4
+ $:
5
+ btnStyle = $notificationStore === void 0 || $notificationStore.btnStyle === void 0 ? notificationStore.getBtnStyle() : $notificationStore.btnStyle;
6
+ </script>
7
+
8
+ <Toast position="t" buttonDismiss={btnStyle} />
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type NotificationProps = typeof __propDef.props;
10
+ export type NotificationEvents = typeof __propDef.events;
11
+ export type NotificationSlots = typeof __propDef.slots;
12
+ export default class Notification extends SvelteComponentTyped<NotificationProps, NotificationEvents, NotificationSlots> {
13
+ }
14
+ export {};
@@ -6,6 +6,7 @@ import Footer from "./Footer.svelte";
6
6
  import Header from "./Header.svelte";
7
7
  import HelpPopUp from "./HelpPopUp.svelte";
8
8
  import Breadcrumb from "./breadcrumb/Breadcrumb.svelte";
9
+ import Notification from "./Notification.svelte";
9
10
  import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
10
11
  import { storePopup } from "@skeletonlabs/skeleton";
11
12
  import { breadcrumbStore } from "../../stores/pageStores";
@@ -79,4 +80,5 @@ onMount(async () => {
79
80
  </div>
80
81
 
81
82
  <HelpPopUp active={help} />
83
+ <Notification />
82
84
  </AppShell>
@@ -0,0 +1,16 @@
1
+ <script>export let cols = 1;
2
+ export let rows = 10;
3
+ </script>
4
+
5
+ <div class="placeholder animate-pulse w-full h-10 sp" />
6
+ <div class="table-container w-full">
7
+ <table class="table table-compact w-full">
8
+ {#each Array(rows) as _}
9
+ <tr class="w-full">
10
+ {#each Array(cols) as _}
11
+ <td class="p-3"><div class="placeholder animate-pulse h-9 w-full" /></td>
12
+ {/each}
13
+ </tr>
14
+ {/each}
15
+ </table>
16
+ </div>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ cols?: number | undefined;
5
+ rows?: number | undefined;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type TablePlaceholderProps = typeof __propDef.props;
13
+ export type TablePlaceholderEvents = typeof __propDef.events;
14
+ export type TablePlaceholderSlots = typeof __propDef.slots;
15
+ export default class TablePlaceholder extends SvelteComponentTyped<TablePlaceholderProps, TablePlaceholderEvents, TablePlaceholderSlots> {
16
+ }
17
+ export {};
@@ -13,7 +13,6 @@ onMount(async () => {
13
13
  let hamburger = true;
14
14
  </script>
15
15
 
16
-
17
16
  {#if $menuStore !== undefined}
18
17
  <div
19
18
  class="sm:flex h-min flex-row w-full justify-between items-center md:flex px-3 py-2 bg-tertiary-50 text-surface-800 z-50 shadow-md"
package/dist/index.d.ts CHANGED
@@ -19,6 +19,8 @@ import Table from './components/Table/Table.svelte';
19
19
  import TableFilter from './components/Table/TableFilter.svelte';
20
20
  import { columnFilter, searchFilter } from './components/Table/filter';
21
21
  import type { TableConfig, Columns, Column } from './models/Models';
22
+ import Notification from './components/page/Notification.svelte';
23
+ import TablePlaceholder from './components/page/TablePlaceholder.svelte';
22
24
  export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DropdownKVP, MultiSelect, NumberInput, TextArea, TextInput };
23
25
  export { FileInfo, FileIcon, FileUploader };
24
26
  export { Spinner, Page, Alert, Menu, ErrorMessage };
@@ -27,6 +29,11 @@ export { host, username, password, setApiConfig } from './stores/apiStores.js';
27
29
  export type { userType, inputType, fileUploaderType, linkType, listItemType, keyValuePairType, fileInfoType, fileReaderInfoType, asciiFileReaderInfoType } from './models/Models.js';
28
30
  export { helpStore } from './stores/pageStores';
29
31
  export type { helpStoreType, helpItemType } from './models/Models';
32
+ export { notificationStore } from './stores/pageStores';
33
+ export type { notificationItemType, notificationStoreType } from './models/Models';
34
+ export { notificationType } from './models/Enums';
35
+ export { Notification };
36
+ export { TablePlaceholder };
30
37
  export { positionType, pageContentLayoutType, decimalCharacterType, orientationType, textMarkerType, textSeperatorType } from './models/Enums';
31
38
  export { Table, TableFilter, columnFilter, searchFilter };
32
39
  export type { TableConfig, Columns, Column };
package/dist/index.js CHANGED
@@ -24,6 +24,10 @@ import TextArea from './components/form/TextArea.svelte';
24
24
  import Table from './components/Table/Table.svelte';
25
25
  import TableFilter from './components/Table/TableFilter.svelte';
26
26
  import { columnFilter, searchFilter } from './components/Table/filter';
27
+ //notification
28
+ import Notification from './components/page/Notification.svelte';
29
+ //table placeholder
30
+ import TablePlaceholder from './components/page/TablePlaceholder.svelte';
27
31
  //Form
28
32
  export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DropdownKVP, MultiSelect, NumberInput, TextArea, TextInput };
29
33
  //File
@@ -35,6 +39,12 @@ export { Api } from './services/Api.js';
35
39
  export { host, username, password, setApiConfig } from './stores/apiStores.js';
36
40
  //help
37
41
  export { helpStore } from './stores/pageStores';
42
+ //notification
43
+ export { notificationStore } from './stores/pageStores';
44
+ export { notificationType } from './models/Enums';
45
+ export { Notification };
46
+ //table placholder
47
+ export { TablePlaceholder };
38
48
  //enum
39
49
  export { positionType, pageContentLayoutType, decimalCharacterType, orientationType, textMarkerType, textSeperatorType } from './models/Enums';
40
50
  // Table
@@ -25,3 +25,9 @@ export declare enum textMarkerType {
25
25
  quotes = 0,
26
26
  doubleQuotes = 1
27
27
  }
28
+ export declare enum notificationType {
29
+ success = 0,
30
+ warning = 1,
31
+ error = 2,
32
+ surface = 3
33
+ }
@@ -31,3 +31,11 @@ export var textMarkerType;
31
31
  textMarkerType[textMarkerType["quotes"] = 0] = "quotes";
32
32
  textMarkerType[textMarkerType["doubleQuotes"] = 1] = "doubleQuotes";
33
33
  })(textMarkerType || (textMarkerType = {}));
34
+ //types for the notification styling
35
+ export var notificationType;
36
+ (function (notificationType) {
37
+ notificationType[notificationType["success"] = 0] = "success";
38
+ notificationType[notificationType["warning"] = 1] = "warning";
39
+ notificationType[notificationType["error"] = 2] = "error";
40
+ notificationType[notificationType["surface"] = 3] = "surface";
41
+ })(notificationType || (notificationType = {}));
@@ -1,7 +1,7 @@
1
1
  import type { SvelteComponent } from 'svelte';
2
2
  import type { ColumnFilterFn } from 'svelte-headless-table/lib/plugins';
3
3
  import type { Writable } from 'svelte/store';
4
- import { decimalCharacterType, orientationType, textMarkerType, textSeperatorType } from './Enums';
4
+ import type { decimalCharacterType, notificationType, orientationType, textMarkerType, textSeperatorType } from './Enums';
5
5
  export interface linkType {
6
6
  label: string;
7
7
  url: string;
@@ -106,3 +106,12 @@ export interface helpStoreType {
106
106
  itemId?: string;
107
107
  helpItems: helpItemType[];
108
108
  }
109
+ export interface notificationItemType {
110
+ notificationType?: notificationType;
111
+ message: string;
112
+ }
113
+ export interface notificationStoreType {
114
+ notificationType: notificationType;
115
+ message: string;
116
+ btnStyle: string;
117
+ }
@@ -1 +1 @@
1
- import { decimalCharacterType, orientationType, textMarkerType, textSeperatorType } from './Enums';
1
+ export {};
@@ -1,6 +1,7 @@
1
- import type { helpItemType, helpStoreType } from '../models/Models';
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';
4
5
  export declare const helpStore: {
5
6
  subscribe: (this: void, run: import("svelte/store").Subscriber<helpStoreType>, invalidate?: ((value?: helpStoreType | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
6
7
  set: (this: void, value: helpStoreType) => void;
@@ -15,7 +16,7 @@ export declare const helpStore: {
15
16
  reset: () => void;
16
17
  clear: () => void;
17
18
  };
18
- export declare const menuStore: import("svelte/store").Writable<MenuModel>;
19
+ export declare const menuStore: Writable<MenuModel>;
19
20
  export declare const breadcrumbStore: {
20
21
  subscribe: (this: void, run: import("svelte/store").Subscriber<BreadcrumbModel>, invalidate?: ((value?: BreadcrumbModel | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
21
22
  set: (this: void, value: BreadcrumbModel) => void;
@@ -23,3 +24,13 @@ export declare const breadcrumbStore: {
23
24
  addItem: (item: breadcrumbItemType) => void;
24
25
  clean: () => void;
25
26
  };
27
+ export declare const notificationStore: {
28
+ subscribe: (this: void, run: import("svelte/store").Subscriber<notificationStoreType>, invalidate?: ((value?: notificationStoreType | undefined) => void) | undefined) => import("svelte/store").Unsubscriber;
29
+ set: (this: void, value: notificationStoreType) => void;
30
+ update: (this: void, updater: import("svelte/store").Updater<notificationStoreType>) => void;
31
+ setNotification: (notificationItem: notificationItemType) => void;
32
+ triggerNotification: () => void;
33
+ clear: () => void;
34
+ showNotification: (notificationItem: notificationItemType) => void;
35
+ getBtnStyle: () => string;
36
+ };
@@ -1,4 +1,6 @@
1
+ import { notificationType } from '../models/Enums';
1
2
  import { BreadcrumbModel } from '../models/Page';
3
+ import { toastStore } from '@skeletonlabs/skeleton';
2
4
  import { writable } from 'svelte/store';
3
5
  function createHelpStore() {
4
6
  // set Store Type
@@ -101,3 +103,107 @@ function createBreadcrumbStore() {
101
103
  }
102
104
  // store for breadcrumb navigation
103
105
  export const breadcrumbStore = createBreadcrumbStore();
106
+ // store for notification (toasts)
107
+ function createNotificationStore() {
108
+ // set Store Type
109
+ const { subscribe, set, update } = writable();
110
+ return {
111
+ //pass Store default functions
112
+ subscribe,
113
+ set,
114
+ update,
115
+ // set notificationStroe, notificationType, message and button style
116
+ setNotification: (notificationItem) => {
117
+ notificationItem.notificationType =
118
+ notificationItem.notificationType === undefined
119
+ ? notificationType.surface
120
+ : notificationItem.notificationType;
121
+ let btnStyle;
122
+ switch (notificationItem.notificationType) {
123
+ case notificationType.success:
124
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-success shadow-md';
125
+ break;
126
+ case notificationType.warning:
127
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-warning shadow-md';
128
+ break;
129
+ case notificationType.error:
130
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-error shadow-md';
131
+ break;
132
+ case notificationType.surface:
133
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-surface shadow-md';
134
+ break;
135
+ }
136
+ notificationStore.set({
137
+ notificationType: notificationItem.notificationType,
138
+ message: notificationItem.message,
139
+ btnStyle: btnStyle
140
+ });
141
+ notificationStore.subscribe((value) => { });
142
+ },
143
+ // triggers the notification to show
144
+ triggerNotification: () => {
145
+ let timeout = 30000;
146
+ let classes = '';
147
+ let message = '';
148
+ notificationStore.subscribe((value) => {
149
+ switch (value.notificationType) {
150
+ case notificationType.success:
151
+ classes =
152
+ 'bg-success-300 border-solid border-2 border-success-500 shadow-md text-surface-900';
153
+ break;
154
+ case notificationType.warning:
155
+ classes =
156
+ 'bg-warning-300 border-solid border-2 border-warning-500 shadow-md text-surface-900';
157
+ break;
158
+ case notificationType.error:
159
+ classes =
160
+ 'bg-error-300 border-solid border-2 border-error-500 shadow-md text-surface-900';
161
+ break;
162
+ case notificationType.surface:
163
+ classes =
164
+ 'bg-surface-300 border-solid border-2 border-surface-500 shadow-md text-surface-900';
165
+ break;
166
+ }
167
+ message = value.message;
168
+ });
169
+ if (classes != '' && message != '') {
170
+ const notificationToast = {
171
+ classes: classes,
172
+ message: message,
173
+ timeout: timeout
174
+ };
175
+ toastStore.trigger(notificationToast);
176
+ }
177
+ },
178
+ // cleans the toastStore
179
+ clear: () => {
180
+ toastStore.clear();
181
+ },
182
+ // cleans, sets, and schows the notification (all you need ;))
183
+ showNotification: (notificationItem) => {
184
+ notificationStore.clear();
185
+ notificationStore.setNotification({
186
+ notificationType: notificationItem.notificationType,
187
+ message: notificationItem.message
188
+ });
189
+ notificationStore.triggerNotification();
190
+ },
191
+ // gets the dissmiss Button style
192
+ getBtnStyle: () => {
193
+ let btnStyle = '';
194
+ notificationStore.subscribe((value) => {
195
+ do {
196
+ if (value === undefined || value.btnStyle === undefined) {
197
+ notificationStore.setNotification({ message: '' });
198
+ }
199
+ else {
200
+ btnStyle = value.btnStyle;
201
+ }
202
+ } while (btnStyle === '');
203
+ });
204
+ return btnStyle;
205
+ }
206
+ };
207
+ }
208
+ //crate and export the instance of the store
209
+ export const notificationStore = createNotificationStore();