mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
drag drop styling
This commit is contained in:
@@ -51,7 +51,6 @@ export class LookupRelationService {
|
|||||||
if (setSearchConfig) {
|
if (setSearchConfig) {
|
||||||
this.searchConfig = newConfig;
|
this.searchConfig = newConfig;
|
||||||
}
|
}
|
||||||
console.log(newConfig);
|
|
||||||
return this.searchService.search(newConfig).pipe(
|
return this.searchService.search(newConfig).pipe(
|
||||||
/* Make sure to only listen to the first x results, until loading is finished */
|
/* Make sure to only listen to the first x results, until loading is finished */
|
||||||
/* TODO: in Rxjs 6.4.0 and up, we can replace this with takeWhile(predicate, true) - see https://stackoverflow.com/a/44644237 */
|
/* TODO: in Rxjs 6.4.0 and up, we can replace this with takeWhile(predicate, true) - see https://stackoverflow.com/a/44644237 */
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
<div [class.form-group]="(model.type !== 'GROUP' && asBootstrapFormGroup) || getClass('element', 'container').includes('form-group')"
|
<div [class.form-group]="asBootstrapFormGroup"
|
||||||
[formGroup]="group"
|
[formGroup]="group"
|
||||||
[ngClass]="[getClass('element', 'container'), getClass('grid', 'container')]">
|
[ngClass]="[getClass('element', 'container'), getClass('grid', 'container')]">
|
||||||
|
|
||||||
<label *ngIf="!isCheckbox && hasLabel"
|
<label *ngIf="!isCheckbox && hasLabel"
|
||||||
[for]="model.id"
|
[for]="model.id"
|
||||||
[innerHTML]="(model.required && model.label) ? (model.label | translate) + ' *' : (model.label | translate)"
|
[innerHTML]="(model.required && model.label) ? (model.label | translate) + ' *' : (model.label | translate)"
|
||||||
|
@@ -172,7 +172,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
@Input('templates') inputTemplateList: QueryList<DynamicTemplateDirective>;
|
@Input('templates') inputTemplateList: QueryList<DynamicTemplateDirective>;
|
||||||
|
|
||||||
@Input() formId: string;
|
@Input() formId: string;
|
||||||
@Input() asBootstrapFormGroup = true;
|
@Input() asBootstrapFormGroup = false;
|
||||||
@Input() bindId = true;
|
@Input() bindId = true;
|
||||||
@Input() context: any | null = null;
|
@Input() context: any | null = null;
|
||||||
@Input() group: FormGroup;
|
@Input() group: FormGroup;
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
[model]="model"
|
[model]="model"
|
||||||
[ngClass]="[getClass(model, 'element', 'host'), getClass(model, 'grid', 'host')]"
|
[ngClass]="[getClass(model, 'element', 'host'), getClass(model, 'grid', 'host')]"
|
||||||
[templates]="templates"
|
[templates]="templates"
|
||||||
|
[asBootstrapFormGroup]="true"
|
||||||
(dfBlur)="onEvent($event, 'blur')"
|
(dfBlur)="onEvent($event, 'blur')"
|
||||||
(dfChange)="onEvent($event, 'change')"
|
(dfChange)="onEvent($event, 'change')"
|
||||||
(dfFocus)="onEvent($event, 'focus')"></ds-dynamic-form-control-container>
|
(dfFocus)="onEvent($event, 'focus')"></ds-dynamic-form-control-container>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<div *ngIf="metadataRepresentation" class="mt-2 mb-4 d-flex">
|
<div *ngIf="metadataRepresentation" class="d-flex">
|
||||||
<span class="d-inline-block align-middle ml-1 mr-auto">
|
<span class="mr-auto text-contents">
|
||||||
<ds-metadata-representation-loader [mdRepresentation]="metadataRepresentation"></ds-metadata-representation-loader>
|
<ds-metadata-representation-loader [mdRepresentation]="metadataRepresentation"></ds-metadata-representation-loader>
|
||||||
</span>
|
</span>
|
||||||
<button type="button" class="btn btn-secondary"
|
<button type="button" class="btn btn-secondary"
|
||||||
(click)="removeSelection()">
|
(click)="removeSelection()">
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
span.text-contents{
|
||||||
|
padding: $btn-padding-y 0;
|
||||||
|
}
|
||||||
|
@@ -10,11 +10,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div cdkDropList cdkDropListLockAxis="y" (cdkDropListDropped)="moveSelection($event)">
|
<div cdkDropList cdkDropListLockAxis="y" (cdkDropListDropped)="moveSelection($event)">
|
||||||
<div *ngFor="let groupModel of model.groups; let idx = index" role="group"
|
<div *ngFor="let groupModel of model.groups; let idx = index" role="group"
|
||||||
[formGroupName]="idx" [ngClass]="[getClass('element', 'group'), getClass('grid', 'group')]" cdkDrag>
|
[formGroupName]="idx" [ngClass]="{'pt-2 pb-2': idx > 0}" cdkDrag cdkDragHandle [class]="getClass('element', 'group') + ' ' + getClass('grid', 'group')">
|
||||||
<ng-container *ngIf="idx > 0">
|
<ng-container *ngIf="idx > 0">
|
||||||
<button type="button" class="close float-left drag-button" cdkDragHandle>
|
<i class="drag-icon fas fa-grip-vertical fa-fw"></i>
|
||||||
<i class="fas fa-grip-vertical fa-fw"></i>
|
|
||||||
</button>
|
|
||||||
<ng-container *ngTemplateOutlet="startTemplate?.templateRef; context: groupModel"></ng-container>
|
<ng-container *ngTemplateOutlet="startTemplate?.templateRef; context: groupModel"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="controlContainer; context: {$implicit: idx}"></ng-container>
|
<ng-container *ngTemplateOutlet="controlContainer; context: {$implicit: idx}"></ng-container>
|
||||||
<ng-container *ngTemplateOutlet="endTemplate?.templateRef; context: groupModel"></ng-container>
|
<ng-container *ngTemplateOutlet="endTemplate?.templateRef; context: groupModel"></ng-container>
|
||||||
|
@@ -1,5 +1,45 @@
|
|||||||
@import './../../../../../../../styles/variables';
|
@import './../../../../../../../styles/variables';
|
||||||
|
|
||||||
button.drag-button {
|
.cdk-drag {
|
||||||
height: $button-height;
|
margin-left: -(1.5 * $spacer);
|
||||||
|
.drag-icon {
|
||||||
|
visibility: hidden;
|
||||||
|
width: (1.5 * $spacer);
|
||||||
|
color: $gray-600;
|
||||||
|
margin: $btn-padding-y 0;
|
||||||
|
line-height: $btn-line-height;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover, &:focus {
|
||||||
|
cursor: grab;
|
||||||
|
.drag-icon {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cdk-drop-list-dragging {
|
||||||
|
.cdk-drag {
|
||||||
|
cursor: grabbing;
|
||||||
|
.drag-icon {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cdk-drag-preview {
|
||||||
|
background-color: white;
|
||||||
|
border-radius: $border-radius-sm;
|
||||||
|
margin-left: 0;
|
||||||
|
box-shadow: 0 5px 5px 0px rgba(0, 0, 0, 0.2),
|
||||||
|
0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
||||||
|
0 3px 14px 2px rgba(0, 0, 0, 0.12);
|
||||||
|
.drag-icon {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cdk-drag-placeholder {
|
||||||
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
[ngClass]="getClass('element','control')">
|
[ngClass]="getClass('element','control')">
|
||||||
|
|
||||||
<ds-dynamic-form-control-container *ngFor="let _model of model.group"
|
<ds-dynamic-form-control-container *ngFor="let _model of model.group"
|
||||||
[asBootstrapFormGroup]="true"
|
|
||||||
[formId]="formId"
|
[formId]="formId"
|
||||||
[group]="control"
|
[group]="control"
|
||||||
[hasErrorMessaging]="model.hasErrorMessages"
|
[hasErrorMessaging]="model.hasErrorMessages"
|
||||||
@@ -20,5 +19,4 @@
|
|||||||
(dfFocus)="onFocus($event)"
|
(dfFocus)="onFocus($event)"
|
||||||
(ngbEvent)="onCustomEvent($event, null, true)"></ds-dynamic-form-control-container>
|
(ngbEvent)="onCustomEvent($event, null, true)"></ds-dynamic-form-control-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
@@ -56,7 +56,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{(resultsRD$ | async)?.state}}
|
|
||||||
<ds-search-results [searchResults]="(resultsRD$ | async)"
|
<ds-search-results [searchResults]="(resultsRD$ | async)"
|
||||||
[sortConfig]="this.lookupRelationService.searchConfig?.sort"
|
[sortConfig]="this.lookupRelationService.searchConfig?.sort"
|
||||||
[searchConfig]="this.lookupRelationService.searchConfig"
|
[searchConfig]="this.lookupRelationService.searchConfig"
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
<div class="btn-group" role="group" aria-label="Add and remove button">
|
<div class="btn-group" role="group" aria-label="Add and remove button">
|
||||||
<button type="button" class="btn btn-secondary"
|
<button type="button" class="btn btn-secondary"
|
||||||
[disabled]="isItemReadOnly(context, index)"
|
[disabled]="isItemReadOnly(context, index)"
|
||||||
(click)="insertItem($event, group.context, group.index + 1)">
|
(click)="insertItem($event, group.context, group.index)">
|
||||||
<i class="fas fa-plus" aria-hidden="true"></i>
|
<i class="fas fa-plus" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -327,7 +327,6 @@ export class SectionFormOperationsService {
|
|||||||
this.operationsBuilder.remove(pathCombiner.getPath(path));
|
this.operationsBuilder.remove(pathCombiner.getPath(path));
|
||||||
}
|
}
|
||||||
} else if (hasValue(event.$event) && hasValue(event.$event.previousIndex)) {
|
} else if (hasValue(event.$event) && hasValue(event.$event.previousIndex)) {
|
||||||
console.log(event, path);
|
|
||||||
this.operationsBuilder.move(
|
this.operationsBuilder.move(
|
||||||
pathCombiner.getPath(path),
|
pathCombiner.getPath(path),
|
||||||
pathCombiner.getPath(segmentedPath + '/' + event.$event.previousIndex).path
|
pathCombiner.getPath(segmentedPath + '/' + event.$event.previousIndex).path
|
||||||
|
Reference in New Issue
Block a user