@bexis2/bexis2-core-ui 0.2.29 → 0.2.30
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 +14 -2
- package/dist/TableView.svelte +1 -1
- package/dist/components/{file → File}/FileIcon.svelte +45 -45
- package/{src/lib/components/file → dist/components/File}/FileInfo.svelte +13 -13
- package/dist/components/ListView.svelte +5 -5
- package/dist/components/Table/Table.svelte +17 -2
- package/dist/components/Table/TableFilter.svelte +13 -6
- package/dist/components/form/Checkbox.svelte +13 -13
- package/dist/components/form/CheckboxKvPList.svelte +16 -16
- package/dist/components/form/CheckboxList.svelte +10 -10
- package/dist/components/form/DateInput.svelte +14 -14
- package/dist/components/form/DropdownKvP.svelte +54 -54
- package/dist/components/form/MultiSelect.svelte +181 -181
- package/dist/components/form/NumberInput.svelte +15 -15
- package/dist/components/form/TextArea.svelte +14 -14
- package/dist/components/form/TextInput.svelte +15 -15
- package/dist/components/page/Alert.svelte +28 -28
- package/dist/components/page/BackToTop.svelte +30 -30
- package/dist/components/page/Docs.svelte +22 -22
- package/dist/components/page/ErrorMessage.svelte +8 -8
- package/dist/components/page/Footer.svelte +5 -5
- package/dist/components/page/Header.svelte +5 -5
- package/dist/components/page/HelpPopUp.svelte +30 -30
- package/dist/components/page/PageCaller.js +19 -19
- package/dist/components/page/Spinner.svelte +14 -14
- package/dist/components/page/breadcrumb/Breadcrumb.svelte +19 -19
- package/dist/components/page/menu/MenuDataCaller.js +10 -10
- package/dist/css/core.ui.postcss +17 -17
- package/dist/css/themes/theme-bexis2.css +96 -96
- package/dist/css/themes/theme-crimson.css +101 -101
- package/dist/css/themes/theme-gold-nouveau.css +140 -140
- package/dist/css/themes/theme-hamlindigo.css +112 -112
- package/dist/css/themes/theme-modern.css +127 -127
- package/dist/css/themes/theme-rocket.css +119 -119
- package/dist/css/themes/theme-sahara.css +128 -128
- package/dist/css/themes/theme-seafoam.css +122 -122
- package/dist/css/themes/theme-seasonal.css +115 -115
- package/dist/css/themes/theme-skeleton.css +118 -118
- package/dist/css/themes/theme-vintage.css +125 -125
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/models/Models.d.ts +3 -3
- package/dist/services/BaseCaller.js +16 -16
- package/package.json +1 -1
- package/src/lib/TableView.svelte +1 -1
- package/src/lib/components/{file → File}/FileIcon.svelte +45 -45
- package/{dist/components/file → src/lib/components/File}/FileInfo.svelte +13 -13
- package/src/lib/components/ListView.svelte +11 -11
- package/src/lib/components/Table/Table.svelte +19 -3
- package/src/lib/components/Table/TableFilter.svelte +15 -6
- package/src/lib/components/Table/filter.ts +141 -141
- package/src/lib/components/form/Checkbox.svelte +24 -24
- package/src/lib/components/form/CheckboxKvPList.svelte +29 -29
- package/src/lib/components/form/CheckboxList.svelte +21 -21
- package/src/lib/components/form/DateInput.svelte +27 -27
- package/src/lib/components/form/DropdownKvP.svelte +54 -54
- package/src/lib/components/form/MultiSelect.svelte +181 -181
- package/src/lib/components/form/NumberInput.svelte +30 -30
- package/src/lib/components/form/TextArea.svelte +28 -28
- package/src/lib/components/form/TextInput.svelte +28 -28
- package/src/lib/components/page/Alert.svelte +41 -41
- package/src/lib/components/page/BackToTop.svelte +30 -30
- package/src/lib/components/page/Docs.svelte +46 -46
- package/src/lib/components/page/ErrorMessage.svelte +10 -10
- package/src/lib/components/page/Footer.svelte +18 -18
- package/src/lib/components/page/Header.svelte +18 -18
- package/src/lib/components/page/HelpPopUp.svelte +72 -72
- package/src/lib/components/page/PageCaller.js +19 -19
- package/src/lib/components/page/Spinner.svelte +20 -20
- package/src/lib/components/page/breadcrumb/Breadcrumb.svelte +39 -39
- package/src/lib/components/page/menu/MenuDataCaller.js +10 -10
- package/src/lib/css/core.ui.postcss +17 -17
- package/src/lib/css/themes/theme-bexis2.css +96 -96
- package/src/lib/css/themes/theme-crimson.css +101 -101
- package/src/lib/css/themes/theme-gold-nouveau.css +140 -140
- package/src/lib/css/themes/theme-hamlindigo.css +112 -112
- package/src/lib/css/themes/theme-modern.css +127 -127
- package/src/lib/css/themes/theme-rocket.css +119 -119
- package/src/lib/css/themes/theme-sahara.css +128 -128
- package/src/lib/css/themes/theme-seafoam.css +122 -122
- package/src/lib/css/themes/theme-seasonal.css +115 -115
- package/src/lib/css/themes/theme-skeleton.css +118 -118
- package/src/lib/css/themes/theme-vintage.css +125 -125
- package/src/lib/index.ts +3 -3
- package/src/lib/models/Models.ts +3 -3
- package/src/lib/models/Page.ts +40 -40
- package/src/lib/services/Api.ts +55 -55
- package/src/lib/services/BaseCaller.js +16 -16
- package/src/lib/stores/apiStores.ts +31 -31
- /package/dist/components/{file → File}/FileIcon.svelte.d.ts +0 -0
- /package/dist/components/{file → File}/FileInfo.svelte.d.ts +0 -0
- /package/dist/components/{file → File}/FileUploader.svelte +0 -0
- /package/dist/components/{file → File}/FileUploader.svelte.d.ts +0 -0
- /package/src/lib/components/{file → File}/FileUploader.svelte +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# bexis-core-ui
|
|
2
|
+
|
|
3
|
+
## 0.2.30
|
|
4
|
+
|
|
5
|
+
- fix routes for 'file' components ('.../file/...' -> '.../File/...')
|
|
6
|
+
- 'Table' components is able to display heterogeneous data, that means data items/rows might have a different number of properties/columns.
|
|
7
|
+
|
|
2
8
|
## 0.2.29
|
|
9
|
+
|
|
3
10
|
- add disbaled propertie to
|
|
4
11
|
- TextInput
|
|
5
12
|
- TextArea
|
|
@@ -7,20 +14,25 @@
|
|
|
7
14
|
- DateInput
|
|
8
15
|
|
|
9
16
|
## 0.2.28
|
|
17
|
+
|
|
10
18
|
- add disabled to multiselect
|
|
11
19
|
|
|
12
20
|
## 0.2.27
|
|
21
|
+
|
|
13
22
|
- fix brand stretching
|
|
14
23
|
|
|
15
24
|
## 0.2.26
|
|
25
|
+
|
|
16
26
|
- add fixLeft to page
|
|
17
27
|
|
|
18
28
|
## 0.2.25
|
|
29
|
+
|
|
19
30
|
- hide console.logs
|
|
20
|
-
- file uploader return list of uploaded files after success
|
|
31
|
+
- file uploader return list of uploaded files after success
|
|
21
32
|
|
|
22
33
|
## 0.2.24
|
|
23
|
-
|
|
34
|
+
|
|
35
|
+
- add ids to table and code editor components
|
|
24
36
|
|
|
25
37
|
## 0.2.23
|
|
26
38
|
|
package/dist/TableView.svelte
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<h1>table</h1>
|
|
1
|
+
<h1>table</h1>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Fa from 'svelte-fa';
|
|
3
|
-
import { faFileAudio } from '@fortawesome/free-regular-svg-icons';
|
|
4
|
-
import { faFileVideo } from '@fortawesome/free-regular-svg-icons';
|
|
5
|
-
import { faFileWord } from '@fortawesome/free-regular-svg-icons';
|
|
6
|
-
import { faFilePdf } from '@fortawesome/free-regular-svg-icons';
|
|
7
|
-
import { faFileExcel } from '@fortawesome/free-regular-svg-icons';
|
|
8
|
-
import { faFileAlt } from '@fortawesome/free-regular-svg-icons';
|
|
9
|
-
import { faFileImage } from '@fortawesome/free-regular-svg-icons';
|
|
10
|
-
import { faFileArchive } from '@fortawesome/free-regular-svg-icons';
|
|
11
|
-
|
|
12
|
-
export let type = '';
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
{#if type.includes('excel') || type.includes('spreadsheetml')}
|
|
16
|
-
<Fa icon={faFileExcel} />
|
|
17
|
-
{/if}
|
|
18
|
-
|
|
19
|
-
{#if type.includes('text')}
|
|
20
|
-
<Fa icon={faFileAlt} />
|
|
21
|
-
{/if}
|
|
22
|
-
|
|
23
|
-
{#if type.includes('image')}
|
|
24
|
-
<Fa icon={faFileImage} />
|
|
25
|
-
{/if}
|
|
26
|
-
|
|
27
|
-
{#if type.includes('audio')}
|
|
28
|
-
<Fa icon={faFileAudio} />
|
|
29
|
-
{/if}
|
|
30
|
-
|
|
31
|
-
{#if type.includes('video')}
|
|
32
|
-
<Fa icon={faFileVideo} />
|
|
33
|
-
{/if}
|
|
34
|
-
|
|
35
|
-
{#if type.includes('word')}
|
|
36
|
-
<Fa icon={faFileWord} />
|
|
37
|
-
{/if}
|
|
38
|
-
|
|
39
|
-
{#if type.includes('pdf')}
|
|
40
|
-
<Fa icon={faFilePdf} />
|
|
41
|
-
{/if}
|
|
42
|
-
|
|
43
|
-
{#if type.includes('zip')}
|
|
44
|
-
<Fa icon={faFileArchive} />
|
|
45
|
-
{/if}
|
|
1
|
+
<script>
|
|
2
|
+
import Fa from 'svelte-fa';
|
|
3
|
+
import { faFileAudio } from '@fortawesome/free-regular-svg-icons';
|
|
4
|
+
import { faFileVideo } from '@fortawesome/free-regular-svg-icons';
|
|
5
|
+
import { faFileWord } from '@fortawesome/free-regular-svg-icons';
|
|
6
|
+
import { faFilePdf } from '@fortawesome/free-regular-svg-icons';
|
|
7
|
+
import { faFileExcel } from '@fortawesome/free-regular-svg-icons';
|
|
8
|
+
import { faFileAlt } from '@fortawesome/free-regular-svg-icons';
|
|
9
|
+
import { faFileImage } from '@fortawesome/free-regular-svg-icons';
|
|
10
|
+
import { faFileArchive } from '@fortawesome/free-regular-svg-icons';
|
|
11
|
+
|
|
12
|
+
export let type = '';
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{#if type.includes('excel') || type.includes('spreadsheetml')}
|
|
16
|
+
<Fa icon={faFileExcel} />
|
|
17
|
+
{/if}
|
|
18
|
+
|
|
19
|
+
{#if type.includes('text')}
|
|
20
|
+
<Fa icon={faFileAlt} />
|
|
21
|
+
{/if}
|
|
22
|
+
|
|
23
|
+
{#if type.includes('image')}
|
|
24
|
+
<Fa icon={faFileImage} />
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
{#if type.includes('audio')}
|
|
28
|
+
<Fa icon={faFileAudio} />
|
|
29
|
+
{/if}
|
|
30
|
+
|
|
31
|
+
{#if type.includes('video')}
|
|
32
|
+
<Fa icon={faFileVideo} />
|
|
33
|
+
{/if}
|
|
34
|
+
|
|
35
|
+
{#if type.includes('word')}
|
|
36
|
+
<Fa icon={faFileWord} />
|
|
37
|
+
{/if}
|
|
38
|
+
|
|
39
|
+
{#if type.includes('pdf')}
|
|
40
|
+
<Fa icon={faFilePdf} />
|
|
41
|
+
{/if}
|
|
42
|
+
|
|
43
|
+
{#if type.includes('zip')}
|
|
44
|
+
<Fa icon={faFileArchive} />
|
|
45
|
+
{/if}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import FileIcon from './FileIcon.svelte';
|
|
3
|
-
|
|
4
|
-
export let name = '';
|
|
5
|
-
export let type = '';
|
|
6
|
-
// export let description;
|
|
7
|
-
export let size = '';
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<div style="font-size:{size}">
|
|
11
|
-
<FileIcon {type} />
|
|
12
|
-
{name}
|
|
13
|
-
</div>
|
|
1
|
+
<script>
|
|
2
|
+
import FileIcon from './FileIcon.svelte';
|
|
3
|
+
|
|
4
|
+
export let name = '';
|
|
5
|
+
export let type = '';
|
|
6
|
+
// export let description;
|
|
7
|
+
export let size = '';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div style="font-size:{size}">
|
|
11
|
+
<FileIcon {type} />
|
|
12
|
+
{name}
|
|
13
|
+
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>let result = { name: "david" };
|
|
2
|
-
</script>
|
|
3
|
-
|
|
4
|
-
<h1>MyList</h1>
|
|
5
|
-
{result.name}
|
|
6
|
-
<b>from bexis-lib</b>
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<h1>MyList</h1>
|
|
5
|
+
{result.name}
|
|
6
|
+
<b>from bexis-lib</b>
|
|
@@ -36,7 +36,15 @@ const table = createTable(data, {
|
|
|
36
36
|
page: addPagination({ initialPageSize: defaultPageSize }),
|
|
37
37
|
expand: addExpandedRows()
|
|
38
38
|
});
|
|
39
|
-
const
|
|
39
|
+
const allCols = {};
|
|
40
|
+
$data.forEach((item) => {
|
|
41
|
+
Object.keys(item).forEach((key) => {
|
|
42
|
+
if (!allCols[key]) {
|
|
43
|
+
allCols[key] = {};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
const accessors = Object.keys(allCols);
|
|
40
48
|
const tableColumns = [
|
|
41
49
|
...accessors.filter((accessor) => {
|
|
42
50
|
const key = accessor;
|
|
@@ -96,6 +104,9 @@ const tableColumns = [
|
|
|
96
104
|
return table.column({
|
|
97
105
|
header: key,
|
|
98
106
|
accessor,
|
|
107
|
+
cell: ({ value }) => {
|
|
108
|
+
return value === void 0 ? "" : value;
|
|
109
|
+
},
|
|
99
110
|
plugins: {
|
|
100
111
|
sort: {
|
|
101
112
|
invert: true
|
|
@@ -217,7 +228,11 @@ const { filterValue } = pluginStates.tableFilter;
|
|
|
217
228
|
<tr {...rowAttrs} id="{tableId}-row-{row.id}">
|
|
218
229
|
{#each row.cells as cell (cell?.id)}
|
|
219
230
|
<Subscribe attrs={cell.attrs()} let:attrs>
|
|
220
|
-
<td
|
|
231
|
+
<td
|
|
232
|
+
{...attrs}
|
|
233
|
+
class="!p-2 w-max focus:resize"
|
|
234
|
+
id="{tableId}-{cell.id}-{row.id}"
|
|
235
|
+
>
|
|
221
236
|
<div
|
|
222
237
|
class="flex items-center h-max overflow-x-auto resize-none hover:resize"
|
|
223
238
|
class:max-w-md={!fitToScreen}
|
|
@@ -97,12 +97,19 @@ const popupFeatured = {
|
|
|
97
97
|
target: popupId,
|
|
98
98
|
placement: "bottom-start"
|
|
99
99
|
};
|
|
100
|
-
let type =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
let type = "";
|
|
101
|
+
let isDate = false;
|
|
102
|
+
$values.forEach((item) => {
|
|
103
|
+
if (item) {
|
|
104
|
+
type = typeof (toFilterableValueFn ? toFilterableValueFn(item) : item);
|
|
105
|
+
if (type === "object") {
|
|
106
|
+
if (item instanceof Date) {
|
|
107
|
+
isDate = true;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
104
110
|
}
|
|
105
|
-
}
|
|
111
|
+
});
|
|
112
|
+
type = isDate ? "date" : type;
|
|
106
113
|
</script>
|
|
107
114
|
|
|
108
115
|
<form class="">
|
|
@@ -116,7 +123,7 @@ if (type === "object") {
|
|
|
116
123
|
<Fa icon={faFilter} size="12" />
|
|
117
124
|
</button>
|
|
118
125
|
|
|
119
|
-
<div data-popup={`${popupId}`} id=
|
|
126
|
+
<div data-popup={`${popupId}`} id={popupId} class="z-50">
|
|
120
127
|
<div class="card p-3 grid gap-2 shadow-lg w-min bg-base-100">
|
|
121
128
|
<button
|
|
122
129
|
class="btn variant-filled-primary btn-sm"
|
|
@@ -6,16 +6,16 @@ export let valid;
|
|
|
6
6
|
export let invalid;
|
|
7
7
|
export let required;
|
|
8
8
|
export let feedback;
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<InputContainer {label} {feedback} {required}>
|
|
12
|
-
<input
|
|
13
|
-
{id}
|
|
14
|
-
class="input variant-form-material"
|
|
15
|
-
type="checkbox"
|
|
16
|
-
class:input-success={valid}
|
|
17
|
-
class:input-error={invalid}
|
|
18
|
-
bind:checked
|
|
19
|
-
on:input
|
|
20
|
-
/>
|
|
21
|
-
</InputContainer>
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<InputContainer {label} {feedback} {required}>
|
|
12
|
+
<input
|
|
13
|
+
{id}
|
|
14
|
+
class="input variant-form-material"
|
|
15
|
+
type="checkbox"
|
|
16
|
+
class:input-success={valid}
|
|
17
|
+
class:input-error={invalid}
|
|
18
|
+
bind:checked
|
|
19
|
+
on:input
|
|
20
|
+
/>
|
|
21
|
+
</InputContainer>
|
|
@@ -8,19 +8,19 @@ export let key;
|
|
|
8
8
|
export let help = false;
|
|
9
9
|
let required = false;
|
|
10
10
|
let feedback;
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
14
|
-
{#each source as item}
|
|
15
|
-
<label class="flex items-center space-x-2" for={key}>
|
|
16
|
-
<input
|
|
17
|
-
class="checkbox"
|
|
18
|
-
type="checkbox"
|
|
19
|
-
bind:group={target}
|
|
20
|
-
checked={item.key}
|
|
21
|
-
value={item.key}
|
|
22
|
-
/>
|
|
23
|
-
<p>{item.value}</p>
|
|
24
|
-
</label>
|
|
25
|
-
{/each}
|
|
26
|
-
</InputContainer>
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
14
|
+
{#each source as item}
|
|
15
|
+
<label class="flex items-center space-x-2" for={key}>
|
|
16
|
+
<input
|
|
17
|
+
class="checkbox"
|
|
18
|
+
type="checkbox"
|
|
19
|
+
bind:group={target}
|
|
20
|
+
checked={item.key}
|
|
21
|
+
value={item.key}
|
|
22
|
+
/>
|
|
23
|
+
<p>{item.value}</p>
|
|
24
|
+
</label>
|
|
25
|
+
{/each}
|
|
26
|
+
</InputContainer>
|
|
@@ -6,13 +6,13 @@ export let description = "";
|
|
|
6
6
|
export let key;
|
|
7
7
|
let required = false;
|
|
8
8
|
let feedback;
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<InputContainer label={title} {feedback} {required}>
|
|
12
|
-
{#each source as item}
|
|
13
|
-
<label class="flex items-center space-x-2" for={key}>
|
|
14
|
-
<input class="checkbox" type="checkbox" bind:group={target} value={item} />
|
|
15
|
-
<p>{item}</p>
|
|
16
|
-
</label>
|
|
17
|
-
{/each}
|
|
18
|
-
</InputContainer>
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<InputContainer label={title} {feedback} {required}>
|
|
12
|
+
{#each source as item}
|
|
13
|
+
<label class="flex items-center space-x-2" for={key}>
|
|
14
|
+
<input class="checkbox" type="checkbox" bind:group={target} value={item} />
|
|
15
|
+
<p>{item}</p>
|
|
16
|
+
</label>
|
|
17
|
+
{/each}
|
|
18
|
+
</InputContainer>
|
|
@@ -8,17 +8,17 @@ export let required = false;
|
|
|
8
8
|
export let feedback = [""];
|
|
9
9
|
export let help = false;
|
|
10
10
|
export let disabled = false;
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<InputContainer {id} {label} {feedback} {required} {help}>
|
|
14
|
-
<input
|
|
15
|
-
{id}
|
|
16
|
-
class="input variant-form-material"
|
|
17
|
-
type="date"
|
|
18
|
-
class:input-success={valid}
|
|
19
|
-
class:input-error={invalid}
|
|
20
|
-
bind:value
|
|
21
|
-
on:input
|
|
22
|
-
{disabled}
|
|
23
|
-
/>
|
|
24
|
-
</InputContainer>
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<InputContainer {id} {label} {feedback} {required} {help}>
|
|
14
|
+
<input
|
|
15
|
+
{id}
|
|
16
|
+
class="input variant-form-material"
|
|
17
|
+
type="date"
|
|
18
|
+
class:input-success={valid}
|
|
19
|
+
class:input-error={invalid}
|
|
20
|
+
bind:value
|
|
21
|
+
on:input
|
|
22
|
+
{disabled}
|
|
23
|
+
/>
|
|
24
|
+
</InputContainer>
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import InputContainer from './InputContainer.svelte';
|
|
3
|
-
|
|
4
|
-
export let id;
|
|
5
|
-
export let source;
|
|
6
|
-
export let target;
|
|
7
|
-
export let title;
|
|
8
|
-
export let valid = false;
|
|
9
|
-
export let invalid = false;
|
|
10
|
-
export let feedback = [''];
|
|
11
|
-
export let required = false;
|
|
12
|
-
export let complexTarget = false;
|
|
13
|
-
export let help = false;
|
|
14
|
-
|
|
15
|
-
$: selected = null;
|
|
16
|
-
|
|
17
|
-
$: updatedSelectedValue(target);
|
|
18
|
-
$: updatedTarget(selected);
|
|
19
|
-
|
|
20
|
-
function updatedSelectedValue(selection) {
|
|
21
|
-
if (selection != null) {
|
|
22
|
-
if (complexTarget) {
|
|
23
|
-
selected = selection.id;
|
|
24
|
-
} else {
|
|
25
|
-
selected = selection;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function updatedTarget(id) {
|
|
31
|
-
if (complexTarget) {
|
|
32
|
-
target = source.find((opt) => opt.id === id);
|
|
33
|
-
} else {
|
|
34
|
-
target = id;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
40
|
-
<select
|
|
41
|
-
{id}
|
|
42
|
-
class="select variant-form-material"
|
|
43
|
-
class:input-success={valid}
|
|
44
|
-
class:input-error={invalid}
|
|
45
|
-
bind:value={selected}
|
|
46
|
-
on:change
|
|
47
|
-
on:select
|
|
48
|
-
>
|
|
49
|
-
<option value={null}>-- Please select --</option>
|
|
50
|
-
{#each source as e}
|
|
51
|
-
<option value={e.id}>{e.text}</option>
|
|
52
|
-
{/each}
|
|
53
|
-
</select>
|
|
54
|
-
</InputContainer>
|
|
1
|
+
<script>
|
|
2
|
+
import InputContainer from './InputContainer.svelte';
|
|
3
|
+
|
|
4
|
+
export let id;
|
|
5
|
+
export let source;
|
|
6
|
+
export let target;
|
|
7
|
+
export let title;
|
|
8
|
+
export let valid = false;
|
|
9
|
+
export let invalid = false;
|
|
10
|
+
export let feedback = [''];
|
|
11
|
+
export let required = false;
|
|
12
|
+
export let complexTarget = false;
|
|
13
|
+
export let help = false;
|
|
14
|
+
|
|
15
|
+
$: selected = null;
|
|
16
|
+
|
|
17
|
+
$: updatedSelectedValue(target);
|
|
18
|
+
$: updatedTarget(selected);
|
|
19
|
+
|
|
20
|
+
function updatedSelectedValue(selection) {
|
|
21
|
+
if (selection != null) {
|
|
22
|
+
if (complexTarget) {
|
|
23
|
+
selected = selection.id;
|
|
24
|
+
} else {
|
|
25
|
+
selected = selection;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function updatedTarget(id) {
|
|
31
|
+
if (complexTarget) {
|
|
32
|
+
target = source.find((opt) => opt.id === id);
|
|
33
|
+
} else {
|
|
34
|
+
target = id;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
40
|
+
<select
|
|
41
|
+
{id}
|
|
42
|
+
class="select variant-form-material"
|
|
43
|
+
class:input-success={valid}
|
|
44
|
+
class:input-error={invalid}
|
|
45
|
+
bind:value={selected}
|
|
46
|
+
on:change
|
|
47
|
+
on:select
|
|
48
|
+
>
|
|
49
|
+
<option value={null}>-- Please select --</option>
|
|
50
|
+
{#each source as e}
|
|
51
|
+
<option value={e.id}>{e.text}</option>
|
|
52
|
+
{/each}
|
|
53
|
+
</select>
|
|
54
|
+
</InputContainer>
|