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
0d4bc39b
Commit
0d4bc39b
authored
4 years ago
by
Tögl, Christina
Browse files
Options
Downloads
Patches
Plain Diff
Update location-select
parent
3c4691d4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/location-select/src/location-select.js
+13
-4
13 additions, 4 deletions
packages/location-select/src/location-select.js
with
13 additions
and
4 deletions
packages/location-select/src/location-select.js
+
13
−
4
View file @
0d4bc39b
...
...
@@ -16,6 +16,7 @@ import * as errorUtils from "dbp-common/error";
const
locationContext
=
{
"
@id
"
:
"
@id
"
,
"
identifier
"
:
"
identifier
"
,
"
name
"
:
"
http://schema.org/name
"
,
"
maximumPhysicalAttendeeCapacity
"
:
"
http://schema.org/maximumPhysicalAttendeeCapacity
"
};
...
...
@@ -62,7 +63,7 @@ export class LocationSelect extends ScopedElementsMixin(LitElement) {
object
:
{
type
:
Object
,
attribute
:
false
},
showReloadButton
:
{
type
:
Boolean
,
attribute
:
'
show-reload-button
'
},
reloadButtonTitle
:
{
type
:
String
,
attribute
:
'
reload-button-title
'
},
show
BirthDate
:
{
type
:
Boolean
,
attribute
:
'
show-capacity
'
},
show
Capacity
:
{
type
:
Boolean
,
attribute
:
'
show-capacity
'
},
};
}
...
...
@@ -156,10 +157,10 @@ export class LocationSelect extends ScopedElementsMixin(LitElement) {
},
processResults
:
function
(
data
)
{
that
.
lastResult
=
data
;
let
transformed
=
that
.
jsonld
.
transformMembers
(
data
,
locationContext
);
//TODO
let
transformed
=
that
.
jsonld
.
transformMembers
(
data
,
locationContext
);
const
results
=
[];
transformed
.
forEach
((
place
)
=>
{
results
.
push
({
id
:
place
[
"
@id
"
],
text
:
that
.
generateOptionText
(
place
)});
results
.
push
({
id
:
place
[
"
@id
"
],
room
:
place
[
"
identifier
"
],
maximumPhysicalAttendeeCapacity
:
place
[
"
maximumPhysicalAttendeeCapacity
"
],
text
:
that
.
generateOptionText
(
place
)});
});
return
{
...
...
@@ -174,6 +175,8 @@ export class LocationSelect extends ScopedElementsMixin(LitElement) {
}).
on
(
"
select2:select
"
,
function
(
e
)
{
// set custom element attributes
const
identifier
=
e
.
params
.
data
.
id
;
const
maxCapacity
=
e
.
params
.
data
.
maximumPhysicalAttendeeCapacity
;
const
room
=
e
.
params
.
data
.
room
;
that
.
object
=
findObjectInApiResults
(
identifier
,
that
.
lastResult
);
$this
.
attr
(
"
data-object
"
,
JSON
.
stringify
(
that
.
object
));
...
...
@@ -187,6 +190,8 @@ export class LocationSelect extends ScopedElementsMixin(LitElement) {
that
.
dispatchEvent
(
new
CustomEvent
(
'
change
'
,
{
detail
:
{
value
:
identifier
,
capacity
:
maxCapacity
,
room
:
room
,
},
bubbles
:
true
}));
...
...
@@ -220,16 +225,20 @@ export class LocationSelect extends ScopedElementsMixin(LitElement) {
that
.
object
=
place
;
const
transformed
=
that
.
jsonld
.
compactMember
(
that
.
jsonld
.
expandMember
(
place
),
locationContext
);
const
identifier
=
transformed
[
"
@id
"
];
const
room
=
transformed
[
"
identifier
"
];
const
maxCapacity
=
transformed
[
"
maximumPhysicalAttendeeCapacity
"
];
const
option
=
new
Option
(
that
.
generateOptionText
(
transformed
),
identifier
,
true
,
true
);
$this
.
attr
(
"
data-object
"
,
JSON
.
stringify
(
place
));
$this
.
data
(
"
object
"
,
place
);
//TODO the object is changed here
$this
.
data
(
"
object
"
,
place
);
that
.
$select
.
append
(
option
).
trigger
(
'
change
'
);
// fire a change event
that
.
dispatchEvent
(
new
CustomEvent
(
'
change
'
,
{
detail
:
{
value
:
identifier
,
capacity
:
maxCapacity
,
room
:
room
,
},
bubbles
:
true
}));
...
...
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