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
d184ded2
Commit
d184ded2
authored
5 years ago
by
Bekerle, Patrizio
Committed by
Reiter, Christoph
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implement support for changing entry-point-url attribute at runtime
parent
b5f5dbcd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/person-select/src/person-select.js
+30
-26
30 additions, 26 deletions
packages/person-select/src/person-select.js
packages/person-select/vendor/common
+1
-1
1 addition, 1 deletion
packages/person-select/vendor/common
with
31 additions
and
27 deletions
packages/person-select/src/person-select.js
+
30
−
26
View file @
d184ded2
...
...
@@ -17,6 +17,7 @@ class PersonSelect extends VPULitElementJQuery {
this
.
lang
=
'
de
'
;
this
.
entryPointUrl
=
utils
.
getAPiUrl
();
this
.
jsonld
=
null
;
this
.
$select
=
null
;
}
static
get
properties
()
{
...
...
@@ -31,17 +32,7 @@ class PersonSelect extends VPULitElementJQuery {
const
that
=
this
;
this
.
updateComplete
.
then
(()
=>
{
JSONLD
.
initialize
(
this
.
entryPointUrl
,
function
(
jsonld
)
{
that
.
jsonld
=
jsonld
;
const
$select
=
that
.
initSelect2
();
// close the selector on blur of the web component
$
(
that
).
blur
(()
=>
{
// the 500ms delay is a workaround to actually get an item selected when clicking on it,
// because the blur gets also fired when clicking in the selector
setTimeout
(()
=>
{
$select
.
select2
(
'
close
'
)},
500
);
});
});
that
.
$select
=
that
.
$
(
'
#person-select
'
);
})
}
...
...
@@ -63,13 +54,11 @@ class PersonSelect extends VPULitElementJQuery {
"
text
"
:
"
http://schema.org/name
"
};
const
$select
=
this
.
$
(
'
#person-select
'
);
if
(
$select
.
hasClass
(
'
select2-hidden-accessible
'
))
{
$select
.
select2
(
'
destroy
'
);
if
(
this
.
$select
.
hasClass
(
'
select2-hidden-accessible
'
))
{
this
.
$select
.
select2
(
'
destroy
'
);
}
$select
.
select2
({
this
.
$select
.
select2
({
width
:
'
100%
'
,
language
:
this
.
lang
===
"
de
"
?
select2LangDe
()
:
select2LangEn
(),
minimumInputLength
:
2
,
...
...
@@ -120,20 +109,35 @@ class PersonSelect extends VPULitElementJQuery {
}));
});
return
$select
;
return
this
.
$select
;
}
update
(
changedProperties
)
{
changedProperties
.
forEach
((
oldValue
,
propName
)
=>
{
if
(
propName
===
"
lang
"
)
{
i18n
.
changeLanguage
(
this
.
lang
);
const
$select
=
this
.
$
(
'
#person-select.select2-hidden-accessible
'
);
if
(
$select
.
length
>
0
)
{
// no other way to set an other language at runtime did work
this
.
initSelect2
();
}
switch
(
propName
)
{
case
"
lang
"
:
i18n
.
changeLanguage
(
this
.
lang
);
if
(
this
.
$select
!==
null
&&
this
.
$select
.
hasClass
(
"
select2-hidden-accessible
"
))
{
// no other way to set an other language at runtime did work
this
.
initSelect2
();
}
break
;
case
"
entryPointUrl
"
:
const
that
=
this
;
JSONLD
.
initialize
(
this
.
entryPointUrl
,
function
(
jsonld
)
{
that
.
jsonld
=
jsonld
;
that
.
$select
=
that
.
initSelect2
();
// close the selector on blur of the web component
$
(
that
).
blur
(()
=>
{
// the 500ms delay is a workaround to actually get an item selected when clicking on it,
// because the blur gets also fired when clicking in the selector
setTimeout
(()
=>
{
that
.
$select
.
select2
(
'
close
'
)},
500
);
});
});
break
;
}
});
...
...
This diff is collapsed.
Click to expand it.
common
@
08f98d94
Subproject commit
45e52fbec09bf05c7e287703fc78b3040af69ac
7
Subproject commit
08f98d949388649606fa5e5b08b750aeb24a4af
7
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