Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
ed4efaff
Commit
ed4efaff
authored
4 years ago
by
Bekerle, Patrizio
Committed by
Reiter, Christoph
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implement enabled-sources attribute (
#6
)
parent
7a8ac7dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/file-handling/README.md
+4
-0
4 additions, 0 deletions
packages/file-handling/README.md
packages/file-handling/src/file-source.js
+15
-2
15 additions, 2 deletions
packages/file-handling/src/file-source.js
with
19 additions
and
2 deletions
packages/file-handling/README.md
+
4
−
0
View file @
ed4efaff
...
...
@@ -22,6 +22,10 @@ files from a [Nextcloud](https://nextcloud.com/) instance.
-
example
`<vpu-file-source allowed-mime-types='image/*'></vpu-file-source>`
... images (of all sub types) only
-
example
`<vpu-file-source allowed-mime-types='image/png,text/plain'></vpu-file-source>`
... PNGs or TXTs only
-
example
`<vpu-file-source allowed-mime-types='*/*'></vpu-file-source>`
... all file types (default)
-
`enabled-sources`
(optional): sets which sources are enabled
-
you can use
`local`
and
`nextcloud`
-
default is
`local`
-
example
`<vpu-file-source enabled-sources='local,nextcloud'></vpu-file-source>`
-
`disabled`
(optional): disable input control
-
example
`<vpu-file-source disabled></vpu-file-source>`
-
`decompress-zip`
(optional): decompress zip file and send the contained files (including files in folders)
...
...
This diff is collapsed.
Click to expand it.
packages/file-handling/src/file-source.js
+
15
−
2
View file @
ed4efaff
...
...
@@ -38,6 +38,7 @@ export class FileSource extends ScopedElementsMixin(VPULitElement) {
this
.
nextcloudWebDavUrl
=
''
;
this
.
dropArea
=
null
;
this
.
allowedMimeTypes
=
'
*/*
'
;
this
.
enabledSources
=
'
local
'
;
this
.
text
=
''
;
this
.
buttonLabel
=
''
;
this
.
disabled
=
false
;
...
...
@@ -62,6 +63,7 @@ export class FileSource extends ScopedElementsMixin(VPULitElement) {
return
{
lang
:
{
type
:
String
},
allowedMimeTypes
:
{
type
:
String
,
attribute
:
'
allowed-mime-types
'
},
enabledSources
:
{
type
:
String
,
attribute
:
'
enabled-sources
'
},
nextcloudAuthUrl
:
{
type
:
String
,
attribute
:
'
nextcloud-auth-url
'
},
nextcloudWebDavUrl
:
{
type
:
String
,
attribute
:
'
nextcloud-web-dav-url
'
},
text
:
{
type
:
String
},
...
...
@@ -80,6 +82,11 @@ export class FileSource extends ScopedElementsMixin(VPULitElement) {
case
"
lang
"
:
i18n
.
changeLanguage
(
this
.
lang
);
break
;
case
"
enabledSources
"
:
if
(
!
this
.
hasEnabledSource
(
this
.
activeSource
))
{
this
.
activeSource
=
this
.
enabledSources
.
split
(
"
,
"
)[
0
];
}
break
;
case
"
isDialogOpen
"
:
if
(
this
.
isDialogOpen
)
{
// this.setAttribute("dialog-open", "");
...
...
@@ -219,6 +226,12 @@ export class FileSource extends ScopedElementsMixin(VPULitElement) {
return
true
;
}
hasEnabledSource
(
source
)
{
const
enabledSources
=
this
.
enabledSources
.
split
(
'
,
'
);
return
enabledSources
.
includes
(
source
);
}
/**
* Decompress files synchronously
*
...
...
@@ -515,12 +528,12 @@ export class FileSource extends ScopedElementsMixin(VPULitElement) {
<nav class="modal-nav">
<div title="
${
i18n
.
t
(
'
file-source.nav-local
'
)}
"
@click="
${()
=>
{
this
.
activeSource
=
"
local
"
;
}}
"
class="
${
classMap
({
"
active
"
:
this
.
activeSource
===
"
local
"
})}
">
class="
${
classMap
({
"
active
"
:
this
.
activeSource
===
"
local
"
,
hidden
:
!
this
.
hasEnabledSource
(
"
local
"
)
})}
">
<vpu-icon class="nav-icon" name="laptop"></vpu-icon>
</div>
<div title="Nextcloud"
@click="
${()
=>
{
this
.
activeSource
=
"
nextcloud
"
;
}}
"
class="
${
classMap
({
"
active
"
:
this
.
activeSource
===
"
nextcloud
"
,
hidden
:
this
.
nextcloudWebDavUrl
===
""
||
this
.
nextcloudAuthUrl
===
""
})}
">
class="
${
classMap
({
"
active
"
:
this
.
activeSource
===
"
nextcloud
"
,
hidden
:
!
this
.
hasEnabledSource
(
"
nextcloud
"
)
})}
">
<vpu-icon class="nav-icon" name="cloud"></vpu-icon>
</div>
</nav>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment