Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
verona-modules-aspect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IQB
verona-modules-aspect
Commits
ae938bca
Commit
ae938bca
authored
2 years ago
by
rhenck
Browse files
Options
Downloads
Patches
Plain Diff
- Sortieren klappt in allen Orientierungen - Optionales Highlighting
parent
303bef15
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#43248
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
projects/common/components/input-elements/drop-list.component.ts
+29
-26
29 additions, 26 deletions
...s/common/components/input-elements/drop-list.component.ts
projects/common/models/elements/input-elements/drop-list.ts
+2
-2
2 additions, 2 deletions
projects/common/models/elements/input-elements/drop-list.ts
with
31 additions
and
28 deletions
projects/common/components/input-elements/drop-list.component.ts
+
29
−
26
View file @
ae938bca
import
{
Component
,
Input
,
OnInit
,
Pipe
,
PipeTransform
}
from
'
@angular/core
'
;
import
{
CdkDrag
,
CdkDragDrop
,
CdkDropList
,
moveItemInArray
,
transferArrayItem
}
from
'
@angular/cdk/drag-drop
'
;
Component
,
Input
}
from
'
@angular/core
'
;
import
{
CdkDrag
,
CdkDragDrop
,
CdkDropList
,
moveItemInArray
,
transferArrayItem
}
from
'
@angular/cdk/drag-drop
'
;
import
{
DropListElement
}
from
'
common/models/elements/input-elements/drop-list
'
;
import
{
DragNDropValueObject
}
from
'
common/models/elements/element
'
;
import
{
FormElementComponent
}
from
'
../../directives/form-element-component.directive
'
;
@
Component
({
selector
:
'
aspect-drop-list
'
,
template
:
`
<!-- [fxLayout]="elementModel.orientation | droplistLayout"-->
<!-- [fxLayoutAlign]="elementModel.orientation | droplistLayoutAlign"-->
<!-- [class.vertical-orientation]="elementModel.orientation === 'vertical'"-->
<!-- [class.horizontal-orientation]="elementModel.orientation === 'horizontal'"-->
<!-- [class.only-one-item]="elementModel.onlyOneItem"-->
<!-- [style.min-height.px]="elementModel.position?.useMinHeight || clozeContext ? elementModel.height : undefined"-->
<!-- [style.border-color]="elementModel.highlightReceivingDropListColor"-->
<!-- tabindex="0"-->
<!-- [style.min-height.px]="elementModel.position?.useMinHeight || clozeContext ? elementModel.height : undefined"-->
<!-- tabindex="0"-->
<div class="list" [id]="elementModel.id"
[class.cloze-context]="clozeContext"
[class.vertical-orientation]="elementModel.orientation === 'vertical'"
[class.horizontal-orientation]="elementModel.orientation === 'horizontal'"
[class.floating-orientation]="elementModel.orientation === 'flex'"
[class.highlight-receiver]="classReference.highlightReceivingDropList"
cdkDropList
[cdkDropListData]="this" [cdkDropListConnectedTo]="elementModel.connectedTo"
[cdkDropListOrientation]="elementModel.orientation === 'vertical' ? 'vertical' : 'horizontal'"
[cdkDropListEnterPredicate]="onlyOneItemPredicate"
(cdkDropListDropped)="drop($event)"
[style.color]="elementModel.styling.fontColor"
...
...
@@ -34,17 +29,20 @@ import { FormElementComponent } from '../../directives/form-element-component.di
[style.font-style]="elementModel.styling.italic ? 'italic' : ''"
[style.text-decoration]="elementModel.styling.underline ? 'underline' : ''"
[style.backgroundColor]="elementModel.styling.backgroundColor"
[style.border-color]="elementModel.highlightReceivingDropListColor"
[class.errors]="elementFormControl.errors && elementFormControl.touched"
(focusout)="elementFormControl.markAsTouched()">
<ng-container *ngFor="let dropListValueElement of elementModel.value let index = index;">
<!-- fxLayout="row"-->
<!-- [fxLayoutAlign]="elementModel.onlyOneItem ? (clozeContext ? 'center center' : 'start center') : 'none'"-->
<div *ngIf="!dropListValueElement.imgSrc"
class="list-item" cdkDrag
class="list-item"
cdkDrag
(cdkDragStarted)="setHighlighting(elementModel.highlightReceivingDropList)"
(cdkDragEnded)="setHighlighting(false)"
[style.background-color]="elementModel.styling.itemBackgroundColor">
<span>{{dropListValueElement.text}}</span>
<div class="example-custom-placeholder" *cdkDragPlaceholder></div>
<ng-template cdkDragPreview [matchSize]="true">
<div *cdkDragPlaceholder></div>
<!-- <ng-template cdkDragPreview [matchSize]="true">-->
<ng-template cdkDragPreview>
<div [style.color]="elementModel.styling.fontColor"
[style.font-family]="elementModel.styling.font"
[style.font-size.px]="elementModel.styling.fontSize"
...
...
@@ -69,12 +67,11 @@ import { FormElementComponent } from '../../directives/form-element-component.di
`
,
styles
:
[
'
.list {width: 100%; height: 100%; background-color: rgb(244, 244, 242); border-radius: 5px;}
'
,
// '.list {padding: 2px; display: flex; gap: 5px;}',
'
.list {display: flex; gap: 5px; box-sizing: border-box; padding: 5px}
'
,
'
.list.vertical-orientation {flex-direction: column;}
'
,
'
.list.horizontal-orientation {flex-direction: row;}
'
,
'
.list.floating-orientation {place-content: center space-around; align-items: center; flex-flow: row wrap;}
'
,
//
'.cloze-context.list {p
lace-content: stretch; align-items: stretch;
}',
'
.cloze-context.list {p
adding: 0
}
'
,
'
.list-item {border-radius: 5px;}
'
,
// '.list-item {margin: 2px; border-radius: 5px;}',
'
:not(.cloze-context) .list-item {padding: 10px;}
'
,
...
...
@@ -82,7 +79,6 @@ import { FormElementComponent } from '../../directives/form-element-component.di
// '.cloze-context .list {padding: 0 5px;}',
// '.cloze-context .list-item {padding: 0 5px; line-height: 1.2;}',
// '.only-one-item.cloze-context .list-item {padding: 0;}',
// '.only-one-item.cloze-context .list-item {padding: 0;}',
// '.only-one-item:not(.cloze-context) .list-item {padding: 0 10px;}',
// '.only-one-item .list-item {height: 100%; min-height: 100%; min-width: 100%; width: 100%; line-height: 1.2;}',
// 'img.list-item {align-self: start; padding: 2px !important;}',
...
...
@@ -95,18 +91,20 @@ import { FormElementComponent } from '../../directives/form-element-component.di
// '.list-item {cursor: grab;}',
// '.list-item:active {cursor: grabbing;}',
'
.cdk-drag-preview {border-radius: 5px; box-shadow: 2px 2px 5px black;}
'
,
'
.cdk-drag-preview {border-radius: 5px; box-shadow: 2px 2px 5px black;
padding: 10px;
}
'
,
'
.cdk-drop-list-dragging .cdk-drag {transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);}
'
,
'
.cdk-drop-list-receiving {background-color: cadetblue !important;}
'
,
// '.cdk-drop-list-receiving {border: 2px solid;}',
// '.cdk-drop-list-receiving .list-item {margin: 0;}'
'
.example-custom-placeholder {background: #ccc; border: dotted 3px #999; min-height: 20px;}
'
'
.highlight-receiver.cdk-drop-list-receiving {padding: 3px; border: 2px solid;}
'
,
'
.cdk-drag-placeholder {background: #ccc; border: dotted 3px #999; min-height: 20px;}
'
,
'
.cdk-drag-placeholder {transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);}
'
]
})
export
class
DropListComponent
extends
FormElementComponent
{
@
Input
()
elementModel
!
:
DropListElement
;
@
Input
()
clozeContext
:
boolean
=
false
;
classReference
=
DropListComponent
;
static
highlightReceivingDropList
=
false
;
// viewModel: DragNDropValueObject[] = [];
// ngOnInit() {
...
...
@@ -137,4 +135,9 @@ export class DropListComponent extends FormElementComponent {
onlyOneItemPredicate
=
(
drag
:
CdkDrag
,
drop
:
CdkDropList
):
boolean
=>
(
!
drop
.
data
.
elementModel
.
onlyOneItem
||
drop
.
data
.
elementModel
.
value
.
length
<
1
);
setHighlighting
(
showHighlight
:
boolean
)
{
console
.
log
(
'
drag started
'
,
showHighlight
);
DropListComponent
.
highlightReceivingDropList
=
showHighlight
;
}
}
This diff is collapsed.
Click to expand it.
projects/common/models/elements/input-elements/drop-list.ts
+
2
−
2
View file @
ae938bca
...
...
@@ -11,7 +11,7 @@ import { DropListComponent } from 'common/components/input-elements/drop-list.co
export
class
DropListElement
extends
InputElement
{
value
:
DragNDropValueObject
[];
onlyOneItem
:
boolean
=
false
;
isSortList
:
boolean
=
false
;
//
isSortList: boolean = false;
connectedTo
:
string
[]
=
[];
copyOnDrop
:
boolean
=
false
;
deleteDroppedItemWithSameID
:
boolean
=
false
;
...
...
@@ -29,7 +29,7 @@ export class DropListElement extends InputElement {
element
.
value
.
map
(
val
=>
({
...
val
}))
:
[];
if
(
element
.
onlyOneItem
)
this
.
onlyOneItem
=
element
.
onlyOneItem
;
if
(
element
.
isSortList
!==
undefined
)
this
.
isSortList
=
element
.
isSortList
;
//
if (element.isSortList !== undefined) this.isSortList = element.isSortList;
if
(
element
.
connectedTo
)
this
.
connectedTo
=
[...
element
.
connectedTo
];
if
(
element
.
copyOnDrop
!==
undefined
)
this
.
copyOnDrop
=
element
.
copyOnDrop
;
if
(
element
.
deleteDroppedItemWithSameID
!==
undefined
)
{
...
...
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