@bexis2/bexis2-core-ui 0.0.2 → 0.0.4
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/.eslintignore +13 -0
- package/.eslintrc.cjs +20 -0
- package/.prettierignore +13 -0
- package/.prettierrc +9 -0
- package/.vscode/settings.json +99 -0
- package/{TableView.svelte.d.ts → dist/TableView.svelte.d.ts} +23 -23
- package/{components → dist/components}/File/FileIcon.svelte.d.ts +23 -23
- package/{components → dist/components}/File/FileInfo.svelte.d.ts +27 -27
- package/dist/components/File/FileUploader.svelte +217 -0
- package/{components → dist/components}/File/FileUploader.svelte.d.ts +44 -27
- package/{components → dist/components}/ListView.svelte.d.ts +14 -14
- package/dist/components/Spinner/Spinner.svelte +8 -0
- package/dist/components/Spinner/Spinner.svelte.d.ts +23 -0
- package/dist/css/core.ui.postcss +2 -0
- package/{index.d.ts → dist/index.d.ts} +9 -9
- package/{index.js → dist/index.js} +9 -9
- package/{models → dist/models}/Models.d.ts +31 -31
- package/{models → dist/models}/Models.js +1 -1
- package/{services → dist/services}/Api.d.ts +7 -7
- package/{services → dist/services}/Api.js +44 -44
- package/{stores → dist/stores}/apistore.d.ts +4 -4
- package/{stores → dist/stores}/apistore.js +22 -22
- package/package.json +36 -167
- package/playwright.config.ts +11 -0
- package/postcss.config.cjs +6 -0
- package/src/app.d.ts +11 -0
- package/src/app.html +15 -0
- package/src/app.postcss +2 -0
- package/src/index.test.ts +7 -0
- package/src/lib/TableView.svelte +1 -0
- package/src/lib/components/File/FileIcon.svelte +49 -0
- package/src/lib/components/File/FileInfo.svelte +14 -0
- package/src/lib/components/File/FileUploader.svelte +217 -0
- package/src/lib/components/ListView.svelte +13 -0
- package/src/lib/components/Spinner/Spinner.svelte +8 -0
- package/src/lib/css/core.ui.postcss +2 -0
- package/src/lib/css/themes/theme-crimson.css +100 -0
- package/src/lib/css/themes/theme-gold-nouveau.css +140 -0
- package/src/lib/css/themes/theme-hamlindigo.css +111 -0
- package/src/lib/css/themes/theme-modern.css +127 -0
- package/src/lib/css/themes/theme-rocket.css +119 -0
- package/src/lib/css/themes/theme-sahara.css +128 -0
- package/src/lib/css/themes/theme-seafoam.css +121 -0
- package/src/lib/css/themes/theme-seasonal.css +115 -0
- package/src/lib/css/themes/theme-skeleton.css +118 -0
- package/src/lib/css/themes/theme-vintage.css +125 -0
- package/src/lib/index.ts +19 -0
- package/src/lib/models/Models.ts +39 -0
- package/src/lib/services/Api.ts +58 -0
- package/src/lib/stores/apistore.ts +32 -0
- package/src/routes/+layout.svelte +10 -0
- package/src/routes/+page.svelte +0 -0
- package/static/favicon.png +0 -0
- package/svelte.config.js +18 -0
- package/tailwind.config.cjs +9 -0
- package/tests/test.ts +6 -0
- package/tsconfig.json +19 -0
- package/vite.config.ts +9 -0
- package/components/File/FileUploader.svelte +0 -135
- /package/{TableView.svelte → dist/TableView.svelte} +0 -0
- /package/{components → dist/components}/File/FileIcon.svelte +0 -0
- /package/{components → dist/components}/File/FileInfo.svelte +0 -0
- /package/{components → dist/components}/ListView.svelte +0 -0
- /package/{themes → dist/css/themes}/theme-crimson.css +0 -0
- /package/{themes → dist/css/themes}/theme-gold-nouveau.css +0 -0
- /package/{themes → dist/css/themes}/theme-hamlindigo.css +0 -0
- /package/{themes → dist/css/themes}/theme-modern.css +0 -0
- /package/{themes → dist/css/themes}/theme-rocket.css +0 -0
- /package/{themes → dist/css/themes}/theme-sahara.css +0 -0
- /package/{themes → dist/css/themes}/theme-seafoam.css +0 -0
- /package/{themes → dist/css/themes}/theme-seasonal.css +0 -0
- /package/{themes → dist/css/themes}/theme-skeleton.css +0 -0
- /package/{themes → dist/css/themes}/theme-vintage.css +0 -0
package/.eslintignore
ADDED
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
parser: '@typescript-eslint/parser',
|
|
4
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
|
|
5
|
+
plugins: ['svelte3', '@typescript-eslint'],
|
|
6
|
+
ignorePatterns: ['*.cjs'],
|
|
7
|
+
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
|
8
|
+
settings: {
|
|
9
|
+
'svelte3/typescript': () => require('typescript')
|
|
10
|
+
},
|
|
11
|
+
parserOptions: {
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
ecmaVersion: 2020
|
|
14
|
+
},
|
|
15
|
+
env: {
|
|
16
|
+
browser: true,
|
|
17
|
+
es2017: true,
|
|
18
|
+
node: true
|
|
19
|
+
}
|
|
20
|
+
};
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"prettier.documentSelectors": [
|
|
3
|
+
"**/*.svelte"
|
|
4
|
+
],
|
|
5
|
+
"tailwindCSS.classAttributes": [
|
|
6
|
+
"class",
|
|
7
|
+
"accent",
|
|
8
|
+
"active",
|
|
9
|
+
"background",
|
|
10
|
+
"badge",
|
|
11
|
+
"bgBackdrop",
|
|
12
|
+
"bgDark",
|
|
13
|
+
"bgDrawer",
|
|
14
|
+
"bgLight",
|
|
15
|
+
"blur",
|
|
16
|
+
"border",
|
|
17
|
+
"button",
|
|
18
|
+
"buttonAction",
|
|
19
|
+
"buttonBack",
|
|
20
|
+
"buttonClasses",
|
|
21
|
+
"buttonComplete",
|
|
22
|
+
"buttonDismiss",
|
|
23
|
+
"buttonNeutral",
|
|
24
|
+
"buttonNext",
|
|
25
|
+
"buttonPositive",
|
|
26
|
+
"buttonTextCancel",
|
|
27
|
+
"buttonTextConfirm",
|
|
28
|
+
"buttonTextNext",
|
|
29
|
+
"buttonTextPrevious",
|
|
30
|
+
"buttonTextSubmit",
|
|
31
|
+
"caretClosed",
|
|
32
|
+
"caretOpen",
|
|
33
|
+
"chips",
|
|
34
|
+
"color",
|
|
35
|
+
"cursor",
|
|
36
|
+
"display",
|
|
37
|
+
"element",
|
|
38
|
+
"fill",
|
|
39
|
+
"fillDark",
|
|
40
|
+
"fillLight",
|
|
41
|
+
"flex",
|
|
42
|
+
"gap",
|
|
43
|
+
"gridColumns",
|
|
44
|
+
"height",
|
|
45
|
+
"hover",
|
|
46
|
+
"invalid",
|
|
47
|
+
"justify",
|
|
48
|
+
"meter",
|
|
49
|
+
"padding",
|
|
50
|
+
"position",
|
|
51
|
+
"regionBackdrop",
|
|
52
|
+
"regionBody",
|
|
53
|
+
"regionCaption",
|
|
54
|
+
"regionCaret",
|
|
55
|
+
"regionCell",
|
|
56
|
+
"regionCone",
|
|
57
|
+
"regionContent",
|
|
58
|
+
"regionControl",
|
|
59
|
+
"regionDefault",
|
|
60
|
+
"regionDrawer",
|
|
61
|
+
"regionFoot",
|
|
62
|
+
"regionFooter",
|
|
63
|
+
"regionHead",
|
|
64
|
+
"regionHeader",
|
|
65
|
+
"regionIcon",
|
|
66
|
+
"regionInterface",
|
|
67
|
+
"regionInterfaceText",
|
|
68
|
+
"regionLabel",
|
|
69
|
+
"regionLead",
|
|
70
|
+
"regionLegend",
|
|
71
|
+
"regionList",
|
|
72
|
+
"regionNavigation",
|
|
73
|
+
"regionPage",
|
|
74
|
+
"regionPanel",
|
|
75
|
+
"regionRowHeadline",
|
|
76
|
+
"regionRowMain",
|
|
77
|
+
"regionTrail",
|
|
78
|
+
"ring",
|
|
79
|
+
"rounded",
|
|
80
|
+
"select",
|
|
81
|
+
"shadow",
|
|
82
|
+
"slotDefault",
|
|
83
|
+
"slotFooter",
|
|
84
|
+
"slotHeader",
|
|
85
|
+
"slotLead",
|
|
86
|
+
"slotMessage",
|
|
87
|
+
"slotMeta",
|
|
88
|
+
"slotPageContent",
|
|
89
|
+
"slotPageFooter",
|
|
90
|
+
"slotPageHeader",
|
|
91
|
+
"slotSidebarLeft",
|
|
92
|
+
"slotSidebarRight",
|
|
93
|
+
"slotTrail",
|
|
94
|
+
"spacing",
|
|
95
|
+
"text",
|
|
96
|
+
"track",
|
|
97
|
+
"width"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} TableViewProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} TableViewEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} TableViewSlots */
|
|
4
|
-
export default class TableView extends SvelteComponentTyped<{
|
|
5
|
-
[x: string]: never;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
}
|
|
10
|
-
export type TableViewProps = typeof __propDef.props;
|
|
11
|
-
export type TableViewEvents = typeof __propDef.events;
|
|
12
|
-
export type TableViewSlots = typeof __propDef.slots;
|
|
13
|
-
import { SvelteComponentTyped } from "svelte";
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
[x: string]: never;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
};
|
|
23
|
-
export {};
|
|
1
|
+
/** @typedef {typeof __propDef.props} TableViewProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} TableViewEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} TableViewSlots */
|
|
4
|
+
export default class TableView extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type TableViewProps = typeof __propDef.props;
|
|
11
|
+
export type TableViewEvents = typeof __propDef.events;
|
|
12
|
+
export type TableViewSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} FileIconProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} FileIconEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} FileIconSlots */
|
|
4
|
-
export default class FileIcon extends SvelteComponentTyped<{
|
|
5
|
-
type?: string | undefined;
|
|
6
|
-
}, {
|
|
7
|
-
[evt: string]: CustomEvent<any>;
|
|
8
|
-
}, {}> {
|
|
9
|
-
}
|
|
10
|
-
export type FileIconProps = typeof __propDef.props;
|
|
11
|
-
export type FileIconEvents = typeof __propDef.events;
|
|
12
|
-
export type FileIconSlots = typeof __propDef.slots;
|
|
13
|
-
import { SvelteComponentTyped } from "svelte";
|
|
14
|
-
declare const __propDef: {
|
|
15
|
-
props: {
|
|
16
|
-
type?: string | undefined;
|
|
17
|
-
};
|
|
18
|
-
events: {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {};
|
|
22
|
-
};
|
|
23
|
-
export {};
|
|
1
|
+
/** @typedef {typeof __propDef.props} FileIconProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FileIconEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FileIconSlots */
|
|
4
|
+
export default class FileIcon extends SvelteComponentTyped<{
|
|
5
|
+
type?: string | undefined;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type FileIconProps = typeof __propDef.props;
|
|
11
|
+
export type FileIconEvents = typeof __propDef.events;
|
|
12
|
+
export type FileIconSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
type?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/** @typedef {typeof __propDef.props} FileInfoProps */
|
|
2
|
-
/** @typedef {typeof __propDef.events} FileInfoEvents */
|
|
3
|
-
/** @typedef {typeof __propDef.slots} FileInfoSlots */
|
|
4
|
-
export default class FileInfo extends SvelteComponentTyped<{
|
|
5
|
-
type?: string | undefined;
|
|
6
|
-
name?: string | undefined;
|
|
7
|
-
size?: string | undefined;
|
|
8
|
-
}, {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
}, {}> {
|
|
11
|
-
}
|
|
12
|
-
export type FileInfoProps = typeof __propDef.props;
|
|
13
|
-
export type FileInfoEvents = typeof __propDef.events;
|
|
14
|
-
export type FileInfoSlots = typeof __propDef.slots;
|
|
15
|
-
import { SvelteComponentTyped } from "svelte";
|
|
16
|
-
declare const __propDef: {
|
|
17
|
-
props: {
|
|
18
|
-
type?: string | undefined;
|
|
19
|
-
name?: string | undefined;
|
|
20
|
-
size?: string | undefined;
|
|
21
|
-
};
|
|
22
|
-
events: {
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {};
|
|
26
|
-
};
|
|
27
|
-
export {};
|
|
1
|
+
/** @typedef {typeof __propDef.props} FileInfoProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FileInfoEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FileInfoSlots */
|
|
4
|
+
export default class FileInfo extends SvelteComponentTyped<{
|
|
5
|
+
type?: string | undefined;
|
|
6
|
+
name?: string | undefined;
|
|
7
|
+
size?: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
}, {}> {
|
|
11
|
+
}
|
|
12
|
+
export type FileInfoProps = typeof __propDef.props;
|
|
13
|
+
export type FileInfoEvents = typeof __propDef.events;
|
|
14
|
+
export type FileInfoSlots = typeof __propDef.slots;
|
|
15
|
+
import { SvelteComponentTyped } from "svelte";
|
|
16
|
+
declare const __propDef: {
|
|
17
|
+
props: {
|
|
18
|
+
type?: string | undefined;
|
|
19
|
+
name?: string | undefined;
|
|
20
|
+
size?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
events: {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
};
|
|
25
|
+
slots: {};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
import type { FileUploaderModel, FileInfo, Files} from '../../models/Models.js'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import DropZone from "svelte-file-dropzone/Dropzone.svelte";
|
|
7
|
+
import {Fa} from 'svelte-fa'
|
|
8
|
+
|
|
9
|
+
import Spinner from '../Spinner/Spinner.svelte';
|
|
10
|
+
import { createEventDispatcher } from 'svelte';
|
|
11
|
+
import { faTrash } from '@fortawesome/free-solid-svg-icons'
|
|
12
|
+
import { faSave } from '@fortawesome/free-regular-svg-icons'
|
|
13
|
+
import { faFileUpload } from '@fortawesome/free-solid-svg-icons'
|
|
14
|
+
|
|
15
|
+
import { Api } from '../../services/Api.js'
|
|
16
|
+
|
|
17
|
+
export let id=0;
|
|
18
|
+
export let version=1;
|
|
19
|
+
|
|
20
|
+
import { onMount } from 'svelte'
|
|
21
|
+
|
|
22
|
+
// export let description="";
|
|
23
|
+
// export let status=0;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
//action to load fileupload model
|
|
27
|
+
export let start="";
|
|
28
|
+
//action to save selected file
|
|
29
|
+
export let submit="";
|
|
30
|
+
|
|
31
|
+
export let context="";
|
|
32
|
+
|
|
33
|
+
export let data:FileUploaderModel | undefined;
|
|
34
|
+
|
|
35
|
+
$:model= data;
|
|
36
|
+
$:submitBt ="submit";
|
|
37
|
+
|
|
38
|
+
let maxSize=0;
|
|
39
|
+
|
|
40
|
+
const dispatch = createEventDispatcher();
|
|
41
|
+
|
|
42
|
+
let fx:FileInfo[]
|
|
43
|
+
|
|
44
|
+
let files:Files = {accepted:[], rejected:[]};
|
|
45
|
+
$:files;
|
|
46
|
+
|
|
47
|
+
onMount(async () => {
|
|
48
|
+
|
|
49
|
+
console.log("fileupload - OnMount", data);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
if(!data)
|
|
53
|
+
{
|
|
54
|
+
load();
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
{
|
|
58
|
+
model = data;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if(model)
|
|
62
|
+
{
|
|
63
|
+
submitBt += context;
|
|
64
|
+
maxSize = (model.maxSize*1024)*1024
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// load modal from server
|
|
70
|
+
async function load()
|
|
71
|
+
{
|
|
72
|
+
let url = start+"?id="+id+"&version="+version;
|
|
73
|
+
|
|
74
|
+
// load menu froms server
|
|
75
|
+
const res = await Api.get(url);
|
|
76
|
+
model = await res.json();
|
|
77
|
+
|
|
78
|
+
console.log("fileupload",model);
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function handleFilesSelect(e:any) {
|
|
84
|
+
|
|
85
|
+
console.log("handleFilesSelect", e);
|
|
86
|
+
console.log("files", files);
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
const { acceptedFiles, fileRejections } = e.detail;
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
files.accepted = [...files.accepted, ...acceptedFiles];
|
|
93
|
+
files.rejected = [...files.rejected, ...fileRejections];
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
console.log("acceptedFiles", acceptedFiles);
|
|
97
|
+
console.log("files.accepted", files.accepted);
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
if(fileRejections.length>0)
|
|
101
|
+
{
|
|
102
|
+
//alert("the dropped file is not supported");
|
|
103
|
+
console.log("the dropped file is not supported.");
|
|
104
|
+
console.log(files.rejected);
|
|
105
|
+
|
|
106
|
+
let messages = [""];
|
|
107
|
+
|
|
108
|
+
for (let index = 0; index < fileRejections.length; index++) {
|
|
109
|
+
const element = fileRejections[index];
|
|
110
|
+
messages.push(getErrorMessage(element))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
console.log(messages);
|
|
114
|
+
|
|
115
|
+
dispatch("error", {messages})
|
|
116
|
+
//list up the errors somewhere
|
|
117
|
+
files.rejected = []
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if(acceptedFiles.length>0)
|
|
121
|
+
{
|
|
122
|
+
document.getElementById(submitBt)?.click();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getErrorMessage(rejected)
|
|
128
|
+
{
|
|
129
|
+
let message = "";
|
|
130
|
+
message = rejected.file.path+" : ";
|
|
131
|
+
let errors = rejected.errors;
|
|
132
|
+
for (let index = 0; index < errors.length; index++) {
|
|
133
|
+
const error = errors[index];
|
|
134
|
+
message+=error.message
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return message;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function handleSubmit() {
|
|
141
|
+
|
|
142
|
+
console.log("SUBMIT");
|
|
143
|
+
|
|
144
|
+
dispatch('submit')
|
|
145
|
+
|
|
146
|
+
let url = submit+"?id="+id;
|
|
147
|
+
|
|
148
|
+
// console.log(model);
|
|
149
|
+
// console.log(url);
|
|
150
|
+
console.log("SUBMIT");
|
|
151
|
+
|
|
152
|
+
if (files.accepted.length > 0) {
|
|
153
|
+
|
|
154
|
+
console.log(files);
|
|
155
|
+
|
|
156
|
+
const formData = new FormData();
|
|
157
|
+
formData.append("files","123");
|
|
158
|
+
// Looping over all files and add it to FormData object
|
|
159
|
+
for (var i = 0; i < files.accepted.length; i++) {
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
formData.append(files.accepted[i].name, files.accepted[i]);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
const response = await Api.post(url, formData);
|
|
167
|
+
|
|
168
|
+
if(response.status==200)
|
|
169
|
+
{
|
|
170
|
+
dispatch('submited');
|
|
171
|
+
|
|
172
|
+
let message = files.accepted.length +" is/are uploaded";
|
|
173
|
+
dispatch('success', {text:message})
|
|
174
|
+
|
|
175
|
+
files.accepted = [];
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
</script>
|
|
182
|
+
|
|
183
|
+
<form on:submit|preventDefault={handleSubmit}>
|
|
184
|
+
{#if model}
|
|
185
|
+
<!--if model exist -->
|
|
186
|
+
<div>
|
|
187
|
+
|
|
188
|
+
<DropZone
|
|
189
|
+
on:drop={handleFilesSelect}
|
|
190
|
+
accept={model.accept}
|
|
191
|
+
multiple={model.multiple}
|
|
192
|
+
{maxSize}>
|
|
193
|
+
|
|
194
|
+
<b style="font-size:xx-large"><Fa icon={faFileUpload}/></b>
|
|
195
|
+
<span><b>Drag 'n' drop some files here, or click to select files</b>
|
|
196
|
+
<b>max file : {model.maxSize} mb</b></span>
|
|
197
|
+
<p>
|
|
198
|
+
{#if model.accept}
|
|
199
|
+
{#each model.accept as ext}
|
|
200
|
+
{ext} ,
|
|
201
|
+
{/each}
|
|
202
|
+
{/if}
|
|
203
|
+
</p>
|
|
204
|
+
</DropZone>
|
|
205
|
+
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
<button id="{submitBt}" color="primary" style="display:none" ><Fa icon={faSave}/></button>
|
|
209
|
+
|
|
210
|
+
{:else} <!-- while data is not loaded show a loading information -->
|
|
211
|
+
|
|
212
|
+
<Spinner/>
|
|
213
|
+
{/if}
|
|
214
|
+
|
|
215
|
+
</form>
|
|
216
|
+
|
|
217
|
+
|
|
@@ -1,27 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
/** @typedef {typeof __propDef.props} FileUploaderProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} FileUploaderEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} FileUploaderSlots */
|
|
4
|
+
export default class FileUploader extends SvelteComponentTyped<{
|
|
5
|
+
data: FileUploaderModel | undefined;
|
|
6
|
+
submit?: string | undefined;
|
|
7
|
+
id?: number | undefined;
|
|
8
|
+
version?: number | undefined;
|
|
9
|
+
start?: string | undefined;
|
|
10
|
+
context?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
error: CustomEvent<any>;
|
|
13
|
+
submit: CustomEvent<any>;
|
|
14
|
+
submited: CustomEvent<any>;
|
|
15
|
+
success: CustomEvent<any>;
|
|
16
|
+
} & {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
}, {}> {
|
|
19
|
+
}
|
|
20
|
+
export type FileUploaderProps = typeof __propDef.props;
|
|
21
|
+
export type FileUploaderEvents = typeof __propDef.events;
|
|
22
|
+
export type FileUploaderSlots = typeof __propDef.slots;
|
|
23
|
+
import { FileUploaderModel } from '../../models/Models.js';
|
|
24
|
+
import { SvelteComponentTyped } from "svelte";
|
|
25
|
+
declare const __propDef: {
|
|
26
|
+
props: {
|
|
27
|
+
data: FileUploaderModel | undefined;
|
|
28
|
+
submit?: string | undefined;
|
|
29
|
+
id?: number | undefined;
|
|
30
|
+
version?: number | undefined;
|
|
31
|
+
start?: string | undefined;
|
|
32
|
+
context?: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
events: {
|
|
35
|
+
error: CustomEvent<any>;
|
|
36
|
+
submit: CustomEvent<any>;
|
|
37
|
+
submited: CustomEvent<any>;
|
|
38
|
+
success: CustomEvent<any>;
|
|
39
|
+
} & {
|
|
40
|
+
[evt: string]: CustomEvent<any>;
|
|
41
|
+
};
|
|
42
|
+
slots: {};
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -1,14 +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 ListViewProps = typeof __propDef.props;
|
|
10
|
-
export type ListViewEvents = typeof __propDef.events;
|
|
11
|
-
export type ListViewSlots = typeof __propDef.slots;
|
|
12
|
-
export default class ListView extends SvelteComponentTyped<ListViewProps, ListViewEvents, ListViewSlots> {
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
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 ListViewProps = typeof __propDef.props;
|
|
10
|
+
export type ListViewEvents = typeof __propDef.events;
|
|
11
|
+
export type ListViewSlots = typeof __propDef.slots;
|
|
12
|
+
export default class ListView extends SvelteComponentTyped<ListViewProps, ListViewEvents, ListViewSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]"
|
|
3
|
+
role="status">
|
|
4
|
+
<span
|
|
5
|
+
class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]"
|
|
6
|
+
>Loading...</span
|
|
7
|
+
>
|
|
8
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} SpinnerProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} SpinnerEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} SpinnerSlots */
|
|
4
|
+
export default class Spinner extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type SpinnerProps = typeof __propDef.props;
|
|
11
|
+
export type SpinnerEvents = typeof __propDef.events;
|
|
12
|
+
export type SpinnerSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import ListView from './components/ListView.svelte';
|
|
2
|
-
import TableView from './TableView.svelte';
|
|
3
|
-
import FileIcon from './components/File/FileIcon.svelte';
|
|
4
|
-
import FileInfo from './components/File/FileInfo.svelte';
|
|
5
|
-
import FileUploader from './components/File/FileUploader.svelte';
|
|
6
|
-
export { ListView, TableView, FileInfo, FileIcon, FileUploader };
|
|
7
|
-
export { Api } from './services/Api.js';
|
|
8
|
-
export { host, username, password, setApiConfig } from './stores/apistore.js';
|
|
9
|
-
export type { user, FileUploaderModel } from './models/Models.js';
|
|
1
|
+
import ListView from './components/ListView.svelte';
|
|
2
|
+
import TableView from './TableView.svelte';
|
|
3
|
+
import FileIcon from './components/File/FileIcon.svelte';
|
|
4
|
+
import FileInfo from './components/File/FileInfo.svelte';
|
|
5
|
+
import FileUploader from './components/File/FileUploader.svelte';
|
|
6
|
+
export { ListView, TableView, FileInfo, FileIcon, FileUploader };
|
|
7
|
+
export { Api } from './services/Api.js';
|
|
8
|
+
export { host, username, password, setApiConfig } from './stores/apistore.js';
|
|
9
|
+
export type { user, FileUploaderModel } from './models/Models.js';
|