@bexis2/bexis2-core-ui 0.2.16 → 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.
package/src/lib/index.ts CHANGED
@@ -1,78 +1,99 @@
1
- // Reexport your entry components here
2
- // import ListView from './components/ListView.svelte';
3
- // import TableView from './TableView.svelte';
4
-
5
- import FileIcon from './components/file/FileIcon.svelte';
6
- import FileInfo from './components/file/FileInfo.svelte';
7
- import FileUploader from './components/file/FileUploader.svelte';
8
-
9
- //page
10
- import Spinner from './components/page/Spinner.svelte';
11
- import Page from './components/page/Page.svelte';
12
- import Alert from './components/page/Alert.svelte';
13
- import Menu from './components/page/menu/Menu.svelte';
14
- import ErrorMessage from './components/page/ErrorMessage.svelte';
15
-
16
- // input
17
- import Checkbox from './components/form/Checkbox.svelte';
18
- import CheckboxKVPList from './components/form/CheckboxKvPList.svelte';
19
- import CheckboxList from './components/form/CheckboxList.svelte';
20
- import DateInput from './components/form/DateInput.svelte';
21
- import DropdownKVP from './components/form/DropdownKvP.svelte';
22
- import MultiSelect from './components/form/MultiSelect.svelte';
23
- import NumberInput from './components/form/NumberInput.svelte';
24
- import TextInput from './components/form/TextInput.svelte';
25
- import TextArea from './components/form/TextArea.svelte';
26
-
27
- //table
28
- import Table from './components/Table/Table.svelte';
29
- import TableFilter from './components/Table/TableFilter.svelte';
30
- import { columnFilter, searchFilter } from './components/Table/filter';
31
- import type { TableConfig, Columns, Column } from './models/Models';
32
-
33
- //Form
34
- export {
35
- Checkbox,
36
- CheckboxKVPList,
37
- CheckboxList,
38
- DateInput,
39
- DropdownKVP,
40
- MultiSelect,
41
- NumberInput,
42
- TextArea,
43
- TextInput
44
- };
45
-
46
- //File
47
- export { FileInfo, FileIcon, FileUploader };
48
-
49
- //others
50
- export { Spinner, Page, Alert, Menu, ErrorMessage };
51
-
52
- //Api
53
- export { Api } from './services/Api.js';
54
- export { host, username, password, setApiConfig } from './stores/apiStores.js';
55
-
56
- //Type
57
- export type {
58
- userType,
59
- inputType,
60
- fileUploaderType,
61
- linkType,
62
- listItemType,
63
- keyValuePairType,
64
- fileInfoType,
65
- fileReaderInfoType,
66
- asciiFileReaderInfoType
67
- } from './models/Models.js';
68
-
69
- //help
70
- export { helpStore } from '$store/pageStores';
71
- export type { helpStoreType, helpItemType } from './models/Models';
72
-
73
- //enum
74
- export { positionType, pageContentLayoutType,decimalCharacterType,orientationType,textMarkerType,textSeperatorType } from './models/Enums';
75
-
76
- // Table
77
- export { Table, TableFilter, columnFilter, searchFilter };
78
- export type { TableConfig, Columns, Column };
1
+ // Reexport your entry components here
2
+ // import ListView from './components/ListView.svelte';
3
+ // import TableView from './TableView.svelte';
4
+
5
+ import FileIcon from './components/file/FileIcon.svelte';
6
+ import FileInfo from './components/file/FileInfo.svelte';
7
+ import FileUploader from './components/file/FileUploader.svelte';
8
+
9
+ //page
10
+ import Spinner from './components/page/Spinner.svelte';
11
+ import Page from './components/page/Page.svelte';
12
+ import Alert from './components/page/Alert.svelte';
13
+ import Menu from './components/page/menu/Menu.svelte';
14
+ import ErrorMessage from './components/page/ErrorMessage.svelte';
15
+
16
+ // input
17
+ import Checkbox from './components/form/Checkbox.svelte';
18
+ import CheckboxKVPList from './components/form/CheckboxKvPList.svelte';
19
+ import CheckboxList from './components/form/CheckboxList.svelte';
20
+ import DateInput from './components/form/DateInput.svelte';
21
+ import DropdownKVP from './components/form/DropdownKvP.svelte';
22
+ import MultiSelect from './components/form/MultiSelect.svelte';
23
+ import NumberInput from './components/form/NumberInput.svelte';
24
+ import TextInput from './components/form/TextInput.svelte';
25
+ import TextArea from './components/form/TextArea.svelte';
26
+
27
+ //table
28
+ import Table from './components/Table/Table.svelte';
29
+ import TableFilter from './components/Table/TableFilter.svelte';
30
+ import { columnFilter, searchFilter } from './components/Table/filter';
31
+ import type { TableConfig, Columns, Column } from './models/Models';
32
+
33
+ //notification
34
+ import Notification from './components/page/Notification.svelte';
35
+
36
+ //table placeholder
37
+ import TablePlaceholder from './components/page/TablePlaceholder.svelte';
38
+
39
+ //Form
40
+ export {
41
+ Checkbox,
42
+ CheckboxKVPList,
43
+ CheckboxList,
44
+ DateInput,
45
+ DropdownKVP,
46
+ MultiSelect,
47
+ NumberInput,
48
+ TextArea,
49
+ TextInput
50
+ };
51
+
52
+ //File
53
+ export { FileInfo, FileIcon, FileUploader };
54
+
55
+ //others
56
+ export { Spinner, Page, Alert, Menu, ErrorMessage };
57
+
58
+ //Api
59
+ export { Api } from './services/Api.js';
60
+ export { host, username, password, setApiConfig } from './stores/apiStores.js';
61
+
62
+ //Type
63
+ export type {
64
+ userType,
65
+ inputType,
66
+ fileUploaderType,
67
+ linkType,
68
+ listItemType,
69
+ keyValuePairType,
70
+ fileInfoType,
71
+ fileReaderInfoType,
72
+ asciiFileReaderInfoType
73
+ } from './models/Models.js';
74
+
75
+ //help
76
+ export { helpStore } from '$store/pageStores';
77
+ export type { helpStoreType, helpItemType } from './models/Models';
78
+
79
+ //notification
80
+ export { notificationStore } from '$store/pageStores';
81
+ export type { notificationItemType, notificationStoreType } from './models/Models';
82
+ export { notificationType } from './models/Enums';
83
+ export { Notification };
84
+
85
+ //table placholder
86
+ export { TablePlaceholder };
87
+ //enum
88
+ export {
89
+ positionType,
90
+ pageContentLayoutType,
91
+ decimalCharacterType,
92
+ orientationType,
93
+ textMarkerType,
94
+ textSeperatorType
95
+ } from './models/Enums';
96
+
97
+ // Table
98
+ export { Table, TableFilter, columnFilter, searchFilter };
99
+ export type { TableConfig, Columns, Column };
@@ -1,32 +1,40 @@
1
- export enum positionType {
2
- start = 'start',
3
- end = 'end',
4
- center = 'center'
5
- }
6
-
7
- export enum pageContentLayoutType {
8
- full = 'full',
9
- center = 'center'
10
- }
11
-
12
- export enum decimalCharacterType {
13
- point,
14
- comma
15
- }
16
-
17
- export enum orientationType {
18
- columnwise,
19
- rowwise
20
- }
21
-
22
- export enum textSeperatorType {
23
- tab = 9,
24
- comma = 44,
25
- semicolon = 59,
26
- space = 32
27
- }
28
-
29
- export enum textMarkerType {
30
- quotes,
31
- doubleQuotes
32
- }
1
+ export enum positionType {
2
+ start = 'start',
3
+ end = 'end',
4
+ center = 'center'
5
+ }
6
+
7
+ export enum pageContentLayoutType {
8
+ full = 'full',
9
+ center = 'center'
10
+ }
11
+
12
+ export enum decimalCharacterType {
13
+ point,
14
+ comma
15
+ }
16
+
17
+ export enum orientationType {
18
+ columnwise,
19
+ rowwise
20
+ }
21
+
22
+ export enum textSeperatorType {
23
+ tab = 9,
24
+ comma = 44,
25
+ semicolon = 59,
26
+ space = 32
27
+ }
28
+
29
+ export enum textMarkerType {
30
+ quotes,
31
+ doubleQuotes
32
+ }
33
+
34
+ //types for the notification styling
35
+ export enum notificationType {
36
+ success,
37
+ warning,
38
+ error,
39
+ surface
40
+ }
@@ -2,7 +2,13 @@ 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
4
 
5
- import {decimalCharacterType, orientationType,textMarkerType,textSeperatorType} from './Enums'
5
+ import type {
6
+ decimalCharacterType,
7
+ notificationType,
8
+ orientationType,
9
+ textMarkerType,
10
+ textSeperatorType
11
+ } from './Enums';
6
12
 
7
13
  // page
8
14
  export interface linkType {
@@ -43,7 +49,6 @@ export interface asciiFileReaderInfoType extends fileReaderInfoType {
43
49
  textMarker: textMarkerType;
44
50
  }
45
51
 
46
-
47
52
  export interface fileReaderInfoType {
48
53
  decimal: decimalCharacterType;
49
54
  orientation: orientationType;
@@ -55,7 +60,6 @@ export interface fileReaderInfoType {
55
60
  dateformat: string;
56
61
  }
57
62
 
58
-
59
63
  export interface filesType {
60
64
  accepted: Blob[];
61
65
  rejected: Blob[];
@@ -132,3 +136,15 @@ export interface helpStoreType {
132
136
  itemId?: string;
133
137
  helpItems: helpItemType[];
134
138
  }
139
+
140
+ // notifications (toasts)
141
+ export interface notificationItemType {
142
+ notificationType?: notificationType;
143
+ message: string;
144
+ }
145
+
146
+ export interface notificationStoreType {
147
+ notificationType: notificationType;
148
+ message: string;
149
+ btnStyle: string;
150
+ }
@@ -1,121 +1,240 @@
1
- import type { helpItemType, helpStoreType } from '$models/Models';
2
- import type { MenuModel, breadcrumbItemType } from '$models/Page';
3
- import { BreadcrumbModel } from '$models/Page';
4
-
5
- import { writable } from 'svelte/store';
6
-
7
- function createHelpStore() {
8
- // set Store Type
9
- const { subscribe, set, update } = writable<helpStoreType>();
10
-
11
- const h: helpItemType[] = [];
12
- let v: helpStoreType;
13
-
14
- set({ itemId: undefined, helpItems: h });
15
-
16
- return {
17
- //pass Store default functions
18
- subscribe,
19
- set,
20
- update,
21
- //set the list of help items to show
22
- setHelpItemList: (helpItems: helpItemType[]) => {
23
- helpStore.set({ itemId: undefined, helpItems: helpItems });
24
- },
25
- //set the ID of the help item and display it
26
- setItemId: (itemId: string) => {
27
- helpStore.subscribe((value) => {
28
- value = value === undefined ? { itemId: undefined, helpItems: h } : value;
29
- value.helpItems = value.helpItems === undefined ? h : value.helpItems;
30
- v = { itemId: itemId, helpItems: value.helpItems };
31
- });
32
- update((u) => (u = v));
33
- },
34
- //reset the ID of the help item and hide it
35
- resetItemId: () => {
36
- helpStore.subscribe((value) => {
37
- value = value === undefined ? { itemId: undefined, helpItems: h } : value;
38
- value.helpItems = value.helpItems === undefined ? h : value.helpItems;
39
- v = { itemId: undefined, helpItems: value.helpItems };
40
- });
41
- update((u) => (u = v));
42
- },
43
- //set the ID of the help item and display it
44
- show: (itemId: string) => {
45
- helpStore.setItemId(itemId);
46
- },
47
- //set a help item and display it
48
- showHelpItem: (helpItem: helpItemType) => {
49
- helpItem.id = helpItem.id === undefined ? 'default' : helpItem.id;
50
- helpStore.set({ itemId: helpItem.id, helpItems: [helpItem] });
51
- },
52
- //reset the ID of the help item and hide it
53
- hide: () => {
54
- helpStore.resetItemId();
55
- },
56
- //reset the ID of the help item and hide it
57
- toggle: (itemId: string) => {
58
- helpStore.subscribe((value) => {
59
- value = value === undefined ? { itemId: undefined, helpItems: h } : value;
60
- value.helpItems = value.helpItems === undefined ? h : value.helpItems;
61
- v = { itemId: itemId, helpItems: value.helpItems };
62
- });
63
- update((u) => (u = v));
64
- },
65
- reset: () => {
66
- helpStore.set({ itemId: undefined, helpItems: h });
67
- },
68
- clear: () => {
69
- helpStore.reset();
70
- }
71
- };
72
- }
73
-
74
- //crate and export the instance of the store
75
- export const helpStore = createHelpStore();
76
-
77
- // store for menu
78
- export const menuStore = writable<MenuModel>();
79
-
80
- function createBreadcrumbStore() {
81
- // set Store Type
82
- const { subscribe, set, update } = writable<BreadcrumbModel>();
83
-
84
- set(new BreadcrumbModel());
85
-
86
- return {
87
- //pass Store default functions
88
- subscribe,
89
- set,
90
- update,
91
-
92
- //set the ID of the help item and display it
93
- addItem: (item: breadcrumbItemType) => {
94
- let b: BreadcrumbModel;
95
- breadcrumbStore.subscribe((value) => {
96
- value = value === undefined ? new BreadcrumbModel() : value;
97
- // value.items = (value.items === undefined) ? b:value.items
98
- if (!value.items.find((i) => i.label === item.label)) {
99
- value.items = [...value.items, item];
100
- }
101
-
102
- b = value;
103
- });
104
-
105
- update((s) => (s = b));
106
- },
107
-
108
- clean: () => {
109
- let b: BreadcrumbModel;
110
- breadcrumbStore.subscribe((value) => {
111
- value = new BreadcrumbModel();
112
- b = value;
113
- });
114
-
115
- update((s) => (s = b));
116
- }
117
- };
118
- }
119
-
120
- // store for breadcrumb navigation
121
- export const breadcrumbStore = createBreadcrumbStore();
1
+ import { notificationType } from '$models/Enums';
2
+ import type {
3
+ helpItemType,
4
+ helpStoreType,
5
+ notificationItemType,
6
+ notificationStoreType
7
+ } from '$models/Models';
8
+ import type { MenuModel, breadcrumbItemType } from '$models/Page';
9
+ import { BreadcrumbModel } from '$models/Page';
10
+ import { toastStore, type ToastSettings } from '@skeletonlabs/skeleton';
11
+ import { writable, type Writable } from 'svelte/store';
12
+
13
+ function createHelpStore() {
14
+ // set Store Type
15
+ const { subscribe, set, update } = writable<helpStoreType>();
16
+
17
+ const h: helpItemType[] = [];
18
+ let v: helpStoreType;
19
+
20
+ set({ itemId: undefined, helpItems: h });
21
+
22
+ return {
23
+ //pass Store default functions
24
+ subscribe,
25
+ set,
26
+ update,
27
+ //set the list of help items to show
28
+ setHelpItemList: (helpItems: helpItemType[]) => {
29
+ helpStore.set({ itemId: undefined, helpItems: helpItems });
30
+ },
31
+ //set the ID of the help item and display it
32
+ setItemId: (itemId: string) => {
33
+ helpStore.subscribe((value) => {
34
+ value = value === undefined ? { itemId: undefined, helpItems: h } : value;
35
+ value.helpItems = value.helpItems === undefined ? h : value.helpItems;
36
+ v = { itemId: itemId, helpItems: value.helpItems };
37
+ });
38
+ update((u) => (u = v));
39
+ },
40
+ //reset the ID of the help item and hide it
41
+ resetItemId: () => {
42
+ helpStore.subscribe((value) => {
43
+ value = value === undefined ? { itemId: undefined, helpItems: h } : value;
44
+ value.helpItems = value.helpItems === undefined ? h : value.helpItems;
45
+ v = { itemId: undefined, helpItems: value.helpItems };
46
+ });
47
+ update((u) => (u = v));
48
+ },
49
+ //set the ID of the help item and display it
50
+ show: (itemId: string) => {
51
+ helpStore.setItemId(itemId);
52
+ },
53
+ //set a help item and display it
54
+ showHelpItem: (helpItem: helpItemType) => {
55
+ helpItem.id = helpItem.id === undefined ? 'default' : helpItem.id;
56
+ helpStore.set({ itemId: helpItem.id, helpItems: [helpItem] });
57
+ },
58
+ //reset the ID of the help item and hide it
59
+ hide: () => {
60
+ helpStore.resetItemId();
61
+ },
62
+ //reset the ID of the help item and hide it
63
+ toggle: (itemId: string) => {
64
+ helpStore.subscribe((value) => {
65
+ value = value === undefined ? { itemId: undefined, helpItems: h } : value;
66
+ value.helpItems = value.helpItems === undefined ? h : value.helpItems;
67
+ v = { itemId: itemId, helpItems: value.helpItems };
68
+ });
69
+ update((u) => (u = v));
70
+ },
71
+ reset: () => {
72
+ helpStore.set({ itemId: undefined, helpItems: h });
73
+ },
74
+ clear: () => {
75
+ helpStore.reset();
76
+ }
77
+ };
78
+ }
79
+
80
+ //crate and export the instance of the store
81
+ export const helpStore = createHelpStore();
82
+
83
+ // store for menu
84
+ export const menuStore = writable<MenuModel>();
85
+
86
+ function createBreadcrumbStore() {
87
+ // set Store Type
88
+ const { subscribe, set, update } = writable<BreadcrumbModel>();
89
+
90
+ set(new BreadcrumbModel());
91
+
92
+ return {
93
+ //pass Store default functions
94
+ subscribe,
95
+ set,
96
+ update,
97
+
98
+ //set the ID of the help item and display it
99
+ addItem: (item: breadcrumbItemType) => {
100
+ let b: BreadcrumbModel;
101
+ breadcrumbStore.subscribe((value) => {
102
+ value = value === undefined ? new BreadcrumbModel() : value;
103
+ // value.items = (value.items === undefined) ? b:value.items
104
+ if (!value.items.find((i) => i.label === item.label)) {
105
+ value.items = [...value.items, item];
106
+ }
107
+
108
+ b = value;
109
+ });
110
+
111
+ update((s) => (s = b));
112
+ },
113
+
114
+ clean: () => {
115
+ let b: BreadcrumbModel;
116
+ breadcrumbStore.subscribe((value) => {
117
+ value = new BreadcrumbModel();
118
+ b = value;
119
+ });
120
+
121
+ update((s) => (s = b));
122
+ }
123
+ };
124
+ }
125
+
126
+ // store for breadcrumb navigation
127
+ export const breadcrumbStore = createBreadcrumbStore();
128
+
129
+ // store for notification (toasts)
130
+ function createNotificationStore() {
131
+ // set Store Type
132
+ const { subscribe, set, update } = writable<notificationStoreType>();
133
+
134
+ return {
135
+ //pass Store default functions
136
+ subscribe,
137
+ set,
138
+ update,
139
+ // set notificationStroe, notificationType, message and button style
140
+ setNotification: (notificationItem: notificationItemType) => {
141
+ notificationItem.notificationType =
142
+ notificationItem.notificationType === undefined
143
+ ? notificationType.surface
144
+ : notificationItem.notificationType;
145
+ let btnStyle: string;
146
+
147
+ switch (notificationItem.notificationType) {
148
+ case notificationType.success:
149
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-success shadow-md';
150
+ break;
151
+ case notificationType.warning:
152
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-warning shadow-md';
153
+ break;
154
+ case notificationType.error:
155
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-error shadow-md';
156
+ break;
157
+ case notificationType.surface:
158
+ btnStyle = 'btn-icon btn-icon-sm variant-filled-surface shadow-md';
159
+ break;
160
+ }
161
+
162
+ notificationStore.set({
163
+ notificationType: notificationItem.notificationType,
164
+ message: notificationItem.message,
165
+ btnStyle: btnStyle
166
+ });
167
+ notificationStore.subscribe((value) => {});
168
+ },
169
+
170
+ // triggers the notification to show
171
+ triggerNotification: () => {
172
+ let timeout: number = 30000;
173
+ let classes: string = '';
174
+ let message: string = '';
175
+ notificationStore.subscribe((value) => {
176
+ switch (value.notificationType) {
177
+ case notificationType.success:
178
+ classes =
179
+ 'bg-success-300 border-solid border-2 border-success-500 shadow-md text-surface-900';
180
+ break;
181
+ case notificationType.warning:
182
+ classes =
183
+ 'bg-warning-300 border-solid border-2 border-warning-500 shadow-md text-surface-900';
184
+ break;
185
+ case notificationType.error:
186
+ classes =
187
+ 'bg-error-300 border-solid border-2 border-error-500 shadow-md text-surface-900';
188
+ break;
189
+ case notificationType.surface:
190
+ classes =
191
+ 'bg-surface-300 border-solid border-2 border-surface-500 shadow-md text-surface-900';
192
+ break;
193
+ }
194
+
195
+ message = value.message;
196
+ });
197
+ if (classes != '' && message != '') {
198
+ const notificationToast: ToastSettings = {
199
+ classes: classes,
200
+ message: message,
201
+ timeout: timeout
202
+ };
203
+ toastStore.trigger(notificationToast);
204
+ }
205
+ },
206
+
207
+ // cleans the toastStore
208
+ clear: () => {
209
+ toastStore.clear();
210
+ },
211
+
212
+ // cleans, sets, and schows the notification (all you need ;))
213
+ showNotification: (notificationItem: notificationItemType) => {
214
+ notificationStore.clear();
215
+ notificationStore.setNotification({
216
+ notificationType: notificationItem.notificationType,
217
+ message: notificationItem.message
218
+ });
219
+ notificationStore.triggerNotification();
220
+ },
221
+
222
+ // gets the dissmiss Button style
223
+ getBtnStyle: () => {
224
+ let btnStyle: string = '';
225
+ notificationStore.subscribe((value) => {
226
+ do {
227
+ if (value === undefined || value.btnStyle === undefined) {
228
+ notificationStore.setNotification({ message: '' });
229
+ } else {
230
+ btnStyle = value.btnStyle;
231
+ }
232
+ } while (btnStyle === '');
233
+ });
234
+ return btnStyle;
235
+ }
236
+ };
237
+ }
238
+
239
+ //crate and export the instance of the store
240
+ export const notificationStore = createNotificationStore();