@bexis2/bexis2-core-ui 0.1.4 → 0.1.6

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,127 +1,148 @@
1
- # bexis-core-ui
2
-
3
- ## v0.1.3
4
- > test table
5
-
6
- ## v0.1.2
7
- ### update
8
- - MultiSelect
9
- - return complex type is available now
10
-
11
- ## v0.1.1
12
- ### update
13
- - Page
14
- - add menu (beta)
15
-
16
-
17
- ## v.0.1.0
18
- ### add
19
- #### types
20
- - ListItem
21
- - KvP
22
-
23
- #### enum
24
- - Position
25
-
26
- ### update
27
- #### components
28
- - DropdownKVP
29
- - return of the target to complex or id only
30
- - TextInput, TextArea, Number
31
- - add placeholder
32
-
33
- ## v0.0.31
34
- ### add
35
- #### components
36
- - Alert
37
-
38
- ### updates
39
- #### components
40
- - Spinner
41
- - label
42
- - color
43
- - position
44
-
45
- - Table
46
- - Date filters
47
- - Configuration for complex types
48
- - Custom event dispatcher
49
- - Updated docs.
50
- - Disabling of filters
51
- - Disabling of sorting
52
-
53
- ### fixes:
54
- #### table
55
- - Arrow in pageSize dropdown.
56
- - Bug with number filter not working on zero values.
57
- - Table of Contents on the right sidebar.
58
-
59
- ## v0.0.29
60
-
61
- ### add
62
- #### types
63
- - Link
64
-
65
- ## v0.0.28
66
-
67
- ### add
68
- #### components
69
- - Page
70
-
71
-
72
-
73
- ## v0.0.27
74
-
75
- ### add
76
- #### components
77
- - Table
78
- - TableFilter
79
- - cloumnFilter
80
- - searchFilter
81
-
82
- #### types
83
- - TableConfig
84
- - Columns
85
- - Column
86
- - Input
87
-
88
- <hr/>
89
-
90
- ## v0.0.26
91
-
92
- ### updates
93
-
94
- - fix bugs in checkbox list
95
- - fix bugs in multi select
96
-
97
- <hr/>
98
-
99
- ## v0.0.25
100
-
101
- ### adds
102
- #### components
103
- - Spinner
104
- - FileUploader
105
- - FileInfo
106
- - FileIcon
107
- -
108
- #### types
109
- - FileUploaderModel
110
-
111
- <hr/>
112
-
113
- ## v0.0.23
114
-
115
- ### updates
116
- - update bexis 2 theme
117
-
118
- ### adds
119
- - Checkbox
120
- - CheckboxKVPList
121
- - CheckboxList
122
- - DateInput
123
- - DropdownKVP
124
- - MultiSelect
125
- - NumberInput
126
- - TextArea
127
- - TextInput
1
+ # bexis-core-ui
2
+ ## v0.1.6
3
+
4
+ - remove massive console.logs
5
+
6
+ ### update
7
+ - Table
8
+ - change submit to apply filter
9
+ - show emtpy table if not data is in the store
10
+ - add option of including custom rendering component
11
+
12
+ ## v0.1.5
13
+ ### update
14
+ - MultiSelect
15
+ - isTargetComplex -> complexTarget
16
+ - isComplex -> complexSource
17
+ - DropdownKVP
18
+ - targetIsComplex -> complexTarget
19
+
20
+ ## v0.1.4
21
+ > test for deploy
22
+
23
+
24
+ ## v0.1.3
25
+ > test table
26
+
27
+ ## v0.1.2
28
+ ### update
29
+ - MultiSelect
30
+ - return complex type is available now
31
+
32
+ ## v0.1.1
33
+ ### update
34
+ - Page
35
+ - add menu (beta)
36
+
37
+
38
+ ## v.0.1.0
39
+ ### add
40
+ #### types
41
+ - ListItem
42
+ - KvP
43
+
44
+ #### enum
45
+ - Position
46
+
47
+ ### update
48
+ #### components
49
+ - DropdownKVP
50
+ - return of the target to complex or id only
51
+ - TextInput, TextArea, Number
52
+ - add placeholder
53
+
54
+ ## v0.0.31
55
+ ### add
56
+ #### components
57
+ - Alert
58
+
59
+ ### updates
60
+ #### components
61
+ - Spinner
62
+ - label
63
+ - color
64
+ - position
65
+
66
+ - Table
67
+ - Date filters
68
+ - Configuration for complex types
69
+ - Custom event dispatcher
70
+ - Updated docs.
71
+ - Disabling of filters
72
+ - Disabling of sorting
73
+
74
+ ### fixes:
75
+ #### table
76
+ - Arrow in pageSize dropdown.
77
+ - Bug with number filter not working on zero values.
78
+ - Table of Contents on the right sidebar.
79
+
80
+ ## v0.0.29
81
+
82
+ ### add
83
+ #### types
84
+ - Link
85
+
86
+ ## v0.0.28
87
+
88
+ ### add
89
+ #### components
90
+ - Page
91
+
92
+
93
+
94
+ ## v0.0.27
95
+
96
+ ### add
97
+ #### components
98
+ - Table
99
+ - TableFilter
100
+ - cloumnFilter
101
+ - searchFilter
102
+
103
+ #### types
104
+ - TableConfig
105
+ - Columns
106
+ - Column
107
+ - Input
108
+
109
+ <hr/>
110
+
111
+ ## v0.0.26
112
+
113
+ ### updates
114
+
115
+ - fix bugs in checkbox list
116
+ - fix bugs in multi select
117
+
118
+ <hr/>
119
+
120
+ ## v0.0.25
121
+
122
+ ### adds
123
+ #### components
124
+ - Spinner
125
+ - FileUploader
126
+ - FileInfo
127
+ - FileIcon
128
+ -
129
+ #### types
130
+ - FileUploaderModel
131
+
132
+ <hr/>
133
+
134
+ ## v0.0.23
135
+
136
+ ### updates
137
+ - update bexis 2 theme
138
+
139
+ ### adds
140
+ - Checkbox
141
+ - CheckboxKVPList
142
+ - CheckboxList
143
+ - DateInput
144
+ - DropdownKVP
145
+ - MultiSelect
146
+ - NumberInput
147
+ - TextArea
148
+ - TextInput
@@ -52,12 +52,12 @@ const tableColumns = [
52
52
  disableFiltering = false,
53
53
  disableSorting = false
54
54
  } = columns[key];
55
- const { toSortableValueFn, toFilterableValueFn, toStringFn } = instructions ?? {};
55
+ const { toSortableValueFn, toFilterableValueFn, toStringFn, renderComponent } = instructions ?? {};
56
56
  return table.column({
57
57
  header: header ?? key,
58
58
  accessor,
59
- cell: ({ value }) => {
60
- return toStringFn ? toStringFn(value) : value;
59
+ cell: ({ value, row }) => {
60
+ return renderComponent ? createRender(renderComponent, { value, row }) : toStringFn ? toStringFn(value) : value;
61
61
  },
62
62
  plugins: {
63
63
  sort: {
@@ -132,12 +132,14 @@ const { filterValue } = pluginStates.tableFilter;
132
132
 
133
133
  <div class="grid gap-2">
134
134
  <div class="table-container">
135
- <input
136
- class="input p-2 mb-2 border border-primary-500"
137
- type="text"
138
- bind:value={$filterValue}
139
- placeholder="Search rows..."
140
- />
135
+ {#if $data.length > 0}
136
+ <input
137
+ class="input p-2 mb-2 border border-primary-500"
138
+ type="text"
139
+ bind:value={$filterValue}
140
+ placeholder="Search rows..."
141
+ />
142
+ {/if}
141
143
  <table {...$tableAttrs} class="table table-compact bg-tertiary-200">
142
144
  <thead>
143
145
  {#each $headerRows as headerRow (headerRow.id)}
@@ -183,6 +185,8 @@ const { filterValue } = pluginStates.tableFilter;
183
185
  {/each}
184
186
  </tr>
185
187
  </Subscribe>
188
+ {:else}
189
+ <p class="items-center justify-center flex w-full p-10 italic">Nothing to show here.</p>
186
190
  {/each}
187
191
  </thead>
188
192
 
@@ -205,6 +209,7 @@ const { filterValue } = pluginStates.tableFilter;
205
209
  </tbody>
206
210
  </table>
207
211
  </div>
208
-
209
- <TablePagination pageConfig={pluginStates.page} {pageSizes} />
212
+ {#if $data.length > 0}
213
+ <TablePagination pageConfig={pluginStates.page} {pageSizes} />
214
+ {/if}
210
215
  </div>
@@ -207,7 +207,7 @@ if (type === "object") {
207
207
  on:click|preventDefault={() => {
208
208
  active = firstValue?.toString().length > 0 || secondValue?.toString().length > 0;
209
209
  $filterValue = [firstOption, firstValue, secondOption, secondValue];
210
- }}>Submit</button
210
+ }}>Apply</button
211
211
  >
212
212
  </div>
213
213
  </div>
@@ -24,7 +24,6 @@ let files = { accepted: [], rejected: [] };
24
24
  $:
25
25
  files;
26
26
  onMount(async () => {
27
- console.log("fileupload - OnMount", data);
28
27
  if (!data) {
29
28
  load();
30
29
  } else {
@@ -42,22 +41,18 @@ async function load() {
42
41
  console.log("fileupload", model);
43
42
  }
44
43
  function handleFilesSelect(e) {
45
- console.log("handleFilesSelect", e);
46
44
  console.log("files", files);
47
45
  const { acceptedFiles, fileRejections } = e.detail;
48
46
  files.accepted = [...files.accepted, ...acceptedFiles];
49
47
  files.rejected = [...files.rejected, ...fileRejections];
50
- console.log("acceptedFiles", acceptedFiles);
51
48
  console.log("files.accepted", files.accepted);
52
49
  if (fileRejections.length > 0) {
53
- console.log("the dropped file is not supported.");
54
50
  console.log(files.rejected);
55
51
  let messages = [""];
56
52
  for (let index = 0; index < fileRejections.length; index++) {
57
53
  const element = fileRejections[index];
58
54
  messages.push(getErrorMessage(element));
59
55
  }
60
- console.log(messages);
61
56
  dispatch("error", { messages });
62
57
  files.rejected = [];
63
58
  }
@@ -76,12 +71,9 @@ function getErrorMessage(rejected) {
76
71
  return message;
77
72
  }
78
73
  async function handleSubmit() {
79
- console.log("SUBMIT");
80
74
  dispatch("submit");
81
75
  let url = submit + "?id=" + id;
82
- console.log("SUBMIT");
83
76
  if (files.accepted.length > 0) {
84
- console.log(files);
85
77
  const formData = new FormData();
86
78
  formData.append("files", "123");
87
79
  for (var i = 0; i < files.accepted.length; i++) {
@@ -96,37 +88,37 @@ async function handleSubmit() {
96
88
  }
97
89
  }
98
90
  }
99
- </script>
100
-
101
- <form on:submit|preventDefault={handleSubmit}>
102
- {#if model}
103
- <!--if model exist -->
104
- <div>
105
- <DropZone
106
- on:drop={handleFilesSelect}
107
- accept={model.accept}
108
- multiple={model.multiple}
109
- {maxSize}
110
- >
111
- <b style="font-size:xx-large"><Fa icon={faFileUpload} /></b>
112
- <span
113
- ><b>Drag 'n' drop some files here, or click to select files</b>
114
- <b>max file : {model.maxSize} mb</b></span
115
- >
116
- <p>
117
- {#if model.accept}
118
- {#each model.accept as ext}
119
- {ext} ,
120
- {/each}
121
- {/if}
122
- </p>
123
- </DropZone>
124
- </div>
125
-
126
- <button id={submitBt} color="primary" style="display:none"><Fa icon={faSave} /></button>
127
- {:else}
128
- <!-- while data is not loaded show a loading information -->
129
-
130
- <Spinner />
131
- {/if}
132
- </form>
91
+ </script>
92
+
93
+ <form on:submit|preventDefault={handleSubmit}>
94
+ {#if model}
95
+ <!--if model exist -->
96
+ <div>
97
+ <DropZone
98
+ on:drop={handleFilesSelect}
99
+ accept={model.accept}
100
+ multiple={model.multiple}
101
+ {maxSize}
102
+ >
103
+ <b style="font-size:xx-large"><Fa icon={faFileUpload} /></b>
104
+ <span
105
+ ><b>Drag 'n' drop some files here, or click to select files</b>
106
+ <b>max file : {model.maxSize} mb</b></span
107
+ >
108
+ <p>
109
+ {#if model.accept}
110
+ {#each model.accept as ext}
111
+ {ext} ,
112
+ {/each}
113
+ {/if}
114
+ </p>
115
+ </DropZone>
116
+ </div>
117
+
118
+ <button id={submitBt} color="primary" style="display:none"><Fa icon={faSave} /></button>
119
+ {:else}
120
+ <!-- while data is not loaded show a loading information -->
121
+
122
+ <Spinner />
123
+ {/if}
124
+ </form>
@@ -9,7 +9,7 @@
9
9
  export let invalid = false;
10
10
  export let feedback = [''];
11
11
  export let required = false;
12
- export let targetIsComplex = false;
12
+ export let complexTarget = false;
13
13
 
14
14
  $: selected = null;
15
15
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  function updatedSelectedValue(selection) {
20
20
  if (selection != null) {
21
- if(targetIsComplex)
21
+ if(complexTarget)
22
22
  {
23
23
  selected = selection.id;
24
24
  }
@@ -30,7 +30,7 @@
30
30
  }
31
31
 
32
32
  function updatedTarget(id) {
33
- if(targetIsComplex)
33
+ if(complexTarget)
34
34
  {
35
35
  target = source.find((opt) => opt.id === id);
36
36
  }
@@ -10,7 +10,7 @@ export default class DropdownKvP extends SvelteComponentTyped<{
10
10
  invalid?: boolean | undefined;
11
11
  valid?: boolean | undefined;
12
12
  feedback?: string[] | undefined;
13
- targetIsComplex?: boolean | undefined;
13
+ complexTarget?: boolean | undefined;
14
14
  }, {
15
15
  change: Event;
16
16
  select: Event;
@@ -32,7 +32,7 @@ declare const __propDef: {
32
32
  invalid?: boolean | undefined;
33
33
  valid?: boolean | undefined;
34
34
  feedback?: string[] | undefined;
35
- targetIsComplex?: boolean | undefined;
35
+ complexTarget?: boolean | undefined;
36
36
  };
37
37
  events: {
38
38
  change: Event;
@@ -8,10 +8,10 @@
8
8
  export let target;
9
9
  export let title;
10
10
  export let itemId = 'value';
11
- export let label = 'label';
11
+ export let itemLabel = 'label';
12
12
  export let isMulti = true;
13
- export let isComplex = false;
14
- export let isTargetComplex = false;
13
+ export let complexSource = false;
14
+ export let complexTarget = false;
15
15
  export let required = false;
16
16
  export let feedback = [];
17
17
 
@@ -22,14 +22,14 @@
22
22
 
23
23
  function updateTarget(selection) {
24
24
  //diffrent cases
25
- console.log('------');
26
- console.log('isComplex',isComplex);
27
- console.log('isTargetComplex',isTargetComplex);
28
- console.log('selection',selection);
25
+ //console.log('------');
26
+ //console.log('isComplex',complexSource);
27
+ //console.log('complexTarget',complexTarget);
28
+ //console.log('selection',selection);
29
29
 
30
30
  //a) source is complex model is simple
31
- if (isComplex && !isTargetComplex && isLoaded) {
32
- console.log('a) source is complex model is simple');
31
+ if (complexSource && !complexTarget && isLoaded) {
32
+ //console.log('a) source is complex model is simple');
33
33
 
34
34
  target = [];
35
35
  for (let i in selection) {
@@ -38,30 +38,30 @@
38
38
  }
39
39
  }
40
40
 
41
- if (!isComplex && !isTargetComplex && isLoaded) {
41
+ if (!complexSource && !complexTarget && isLoaded) {
42
42
  target = [];
43
43
  for (let i in selection) {
44
44
  target.push(selection[i].value);
45
45
  }
46
46
  }
47
47
 
48
- if (isComplex && isTargetComplex && isLoaded)
48
+ if (complexSource && complexTarget && isLoaded)
49
49
  {
50
- console.log("both complex",selection);
50
+ //console.log("both complex",selection);
51
51
  target = selection;
52
52
 
53
53
  }
54
54
 
55
- // console.log('selection ' + title, selection);
56
- // console.log('target ' + title, target);
55
+ // //console.log('selection ' + title, selection);
56
+ // //console.log('target ' + title, target);
57
57
  }
58
58
 
59
59
  onMount(async () => {
60
- //console.log("on mount multiselect");
61
- //console.log(source);
60
+ ////console.log("on mount multiselect");
61
+ ////console.log(source);
62
62
 
63
63
  //a) source is complex model is simple
64
- if (isComplex && !isTargetComplex) {
64
+ if (complexSource && !complexTarget) {
65
65
  let items = [];
66
66
  // event.detail will be null unless isMulti is true and user has removed a single item
67
67
  for (let i in target) {
@@ -73,19 +73,19 @@
73
73
  if (items.length > 0) {
74
74
  value = items;
75
75
  }
76
- //console.log(value);
76
+ ////console.log(value);
77
77
  }
78
78
 
79
- if (isComplex && isTargetComplex)
79
+ if (complexSource && complexTarget)
80
80
  {
81
81
  value = target
82
82
  isLoaded = true;
83
83
  }
84
84
 
85
85
  //b) simple liust and simple model
86
- if (!isComplex && !isTargetComplex) {
87
- //console.log("source", source);
88
- //console.log("target",target);
86
+ if (!complexSource && !complexTarget) {
87
+ ////console.log("source", source);
88
+ ////console.log("target",target);
89
89
  isLoaded = true;
90
90
  //set target only if its nit empty
91
91
  if (target != null && target !== undefined && target != '') {
@@ -100,7 +100,7 @@
100
100
  class="select variant-form-material"
101
101
  items={source}
102
102
  {itemId}
103
- {label}
103
+ label = {itemLabel}
104
104
  multiple={isMulti}
105
105
  bind:value
106
106
  placeholder="-- Please select --"
@@ -6,12 +6,12 @@ export default class MultiSelect extends SvelteComponentTyped<{
6
6
  source: any;
7
7
  title: any;
8
8
  required?: boolean | undefined;
9
- label?: string | undefined;
10
9
  feedback?: any[] | undefined;
11
- isComplex?: boolean | undefined;
12
- isTargetComplex?: boolean | undefined;
10
+ complexTarget?: boolean | undefined;
13
11
  itemId?: string | undefined;
12
+ itemLabel?: string | undefined;
14
13
  isMulti?: boolean | undefined;
14
+ complexSource?: boolean | undefined;
15
15
  }, {
16
16
  [evt: string]: CustomEvent<any>;
17
17
  }, {}> {
@@ -26,12 +26,12 @@ declare const __propDef: {
26
26
  source: any;
27
27
  title: any;
28
28
  required?: boolean | undefined;
29
- label?: string | undefined;
30
29
  feedback?: any[] | undefined;
31
- isComplex?: boolean | undefined;
32
- isTargetComplex?: boolean | undefined;
30
+ complexTarget?: boolean | undefined;
33
31
  itemId?: string | undefined;
32
+ itemLabel?: string | undefined;
34
33
  isMulti?: boolean | undefined;
34
+ complexSource?: boolean | undefined;
35
35
  };
36
36
  events: {
37
37
  [evt: string]: CustomEvent<any>;
@@ -49,6 +49,7 @@ export interface ColumnInstructions {
49
49
  toStringFn?: (value: any) => string;
50
50
  toSortableValueFn?: (value: any) => string | number;
51
51
  toFilterableValueFn?: (value: any) => string | number | Date;
52
+ renderComponent?: typeof SvelteComponent;
52
53
  }
53
54
  export interface Column {
54
55
  header?: string;
@@ -15,9 +15,9 @@ passwordStore.subscribe((value) => {
15
15
  password = value;
16
16
  });
17
17
  export function setApiConfig(_host, _user, _pw) {
18
- console.log('overwrite settings');
18
+ console.log('overwrite api settings');
19
19
  hostStore.update((h) => (h = _host));
20
20
  usernameStore.update((u) => (u = _user));
21
21
  passwordStore.update((p) => (p = _pw));
22
- console.log('overwrite host', _host);
22
+ //console.log('overwrite host',_host);
23
23
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
- "package": "svelte-package --watch",
7
+ "package": "svelte-package",
8
8
  "build": "vite build",
9
9
  "build package": "svelte-kit sync && svelte-package --watch",
10
10
  "preview": "vite preview",