-
Notifications
You must be signed in to change notification settings - Fork 31
NTNGL-5467 | Enable List Tile Drag and Drop #6973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f81a7ac
255ff60
1600984
a6929fc
9f3ffee
e54ead3
300a4b8
22c0502
a31dd6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,8 +65,7 @@ class ListItemGenericLayout extends LitElement { | |
| /** | ||
| * @ignore | ||
| */ | ||
| layout: { type: String, reflect: true } | ||
|
|
||
| layout: { type: String, reflect: true }, | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -216,7 +215,21 @@ class ListItemGenericLayout extends LitElement { | |
|
|
||
| :host([layout="tile"]) { | ||
| grid-template-columns: | ||
| [start control-start] minmax(0, min-content) | ||
| [start outside-control-start] minmax(0, 30px) | ||
| [outside-control-end control-start] minmax(0, min-content) | ||
| [control-end actions-start] minmax(0, auto) | ||
| [actions-end end]; | ||
| grid-template-rows: | ||
| [start header-start] minmax(0, min-content) | ||
| [header-end content-start] auto | ||
| [content-end end]; | ||
| height: 100%; | ||
| } | ||
|
|
||
| :host([layout="tile"]:not([is-draggable])) { | ||
| grid-template-columns: | ||
| [start outside-control-start] 0 | ||
| [outside-control-end control-start] minmax(0, min-content) | ||
| [control-end actions-start] minmax(0, auto) | ||
| [actions-end end]; | ||
|
Comment on lines
+229
to
234
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This varient ensures that the selection box is the left most item when the drag handle isn't present. There's a fun layout issue that prevents |
||
| grid-template-rows: | ||
|
|
@@ -258,14 +271,22 @@ class ListItemGenericLayout extends LitElement { | |
| grid-row: content-start / content-end; | ||
| } | ||
|
|
||
| :host([layout="tile"]) ::slotted([slot="outside-control"]) { | ||
| grid-column: outside-control-start / outside-control-end; | ||
| grid-row: start / start; | ||
| width: min-content; | ||
| } | ||
|
|
||
| :host([layout="tile"]) ::slotted([slot="outside-control-action"]) { | ||
| grid-column: start / end; | ||
| grid-row: start / start; | ||
| } | ||
|
|
||
| :host(:not([layout="tile"])) slot[name="header"], | ||
| :host([layout="tile"]) slot[name="add-top"], | ||
| :host([layout="tile"]) slot[name="control-container"], | ||
| :host([layout="tile"]) slot[name="before-content"], | ||
| :host([layout="tile"]) slot[name="outside-control"], | ||
| :host([layout="tile"]) slot[name="outside-control-action"], | ||
| :host([layout="tile"]) slot[name="expand-collapse"], | ||
| :host([layout="tile"]) slot[name="drop-target"], | ||
| :host([layout="tile"]) slot[name="nested"], | ||
| :host([layout="tile"]) slot[name="add"] { | ||
| display: none; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -474,6 +474,7 @@ export const ListItemMixin = superclass => class extends composeMixins( | |
| transform: translateY(-10px); | ||
| transition: opacity 200ms ease-out, transform 0ms ease-out 300ms; | ||
| } | ||
|
|
||
| :host([layout="tile"][_selection-when-interacted]) [slot="control"]:hover, | ||
| :host([layout="tile"][_selection-when-interacted][_focusing]) [slot="control"], | ||
| :host([layout="tile"][_selection-when-interacted][_force-show-selection]) [slot="control"], | ||
|
|
@@ -484,6 +485,10 @@ export const ListItemMixin = superclass => class extends composeMixins( | |
| transition: opacity 200ms ease-out, transform 200ms ease-out; | ||
| } | ||
|
|
||
| :host([layout="tile"][draggable][tile-header]) [slot="control"] { | ||
| margin: 0.25rem 0; | ||
| } | ||
|
|
||
| @media (prefers-reduced-motion: reduce) { | ||
| :host([layout="tile"][_selection-when-interacted]) [slot="control"] { | ||
| transform: none; | ||
|
|
@@ -587,6 +592,10 @@ export const ListItemMixin = superclass => class extends composeMixins( | |
| :host([layout="tile"]) d2l-selection-input { | ||
| margin: 0; | ||
| } | ||
|
|
||
| :host([layout="tile"][draggable]) d2l-selection-input { | ||
| margin: auto; | ||
| } | ||
|
Comment on lines
+596
to
+598
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the drag handle makes the title bar slightly taller so we need to tell the selection to center itself |
||
| :host([layout="tile"]:not([tile-header])) d2l-selection-input { | ||
| --d2l-input-checkbox-border-color-hover-focus: var(--d2l-color-celestine-minus-1); | ||
| --d2l-input-radio-border-color-hover-focus: var(--d2l-color-celestine-minus-1); | ||
|
|
@@ -724,6 +733,9 @@ export const ListItemMixin = superclass => class extends composeMixins( | |
| this._hasListItemContent = !!this.shadowRoot.querySelector('slot:not([name])').assignedElements({ flatten: true }) | ||
| .find(elem => elem.tagName === 'D2L-LIST-ITEM-CONTENT'); | ||
| } | ||
| if (this.draggable && this.layout === 'tile' && this.tileHeader === false) { | ||
| this.tileHeader = true; | ||
| } | ||
| } | ||
|
|
||
| focus() { | ||
|
|
@@ -975,6 +987,8 @@ export const ListItemMixin = superclass => class extends composeMixins( | |
| data-separators="${ifDefined(this._separators)}" | ||
| indentation="${ifDefined(this.indentation)}" | ||
| ?grid-active="${this.role === 'row'}" | ||
| ?selectable="${this.selectable}" | ||
| ?is-draggable="${this.draggable}" | ||
| layout="${this.layout}" | ||
| ?no-primary-action="${this.noPrimaryAction}"> | ||
| ${this._showAddButton && this.first ? html` | ||
|
|
@@ -1038,10 +1052,12 @@ export const ListItemMixin = superclass => class extends composeMixins( | |
| </d2l-list-item-generic-layout> | ||
| `; | ||
|
|
||
| const isDraggableTile = this.draggable && this.layout === 'tile'; | ||
|
|
||
| return html` | ||
| ${this._renderTopPlacementMarker(html`<d2l-list-item-placement-marker></d2l-list-item-placement-marker>`)} | ||
| ${this._renderTopPlacementMarker(html`<d2l-list-item-placement-marker ?verticle="${isDraggableTile}"></d2l-list-item-placement-marker>`)} | ||
| ${this.draggable ? html`<div class="d2l-list-item-drag-image">${innerView}</div>` : innerView} | ||
| ${this._renderBottomPlacementMarker(html`<d2l-list-item-placement-marker></d2l-list-item-placement-marker>`)} | ||
| ${this._renderBottomPlacementMarker(html`<d2l-list-item-placement-marker ?verticle="${isDraggableTile}"></d2l-list-item-placement-marker>`)} | ||
| ${this._displayKeyboardTooltip && tooltipForId ? html`<d2l-tooltip align="start" announced for="${tooltipForId}" for-type="descriptor">${this.localizeHTML('components.list.keyboard')}</d2l-tooltip>` : ''} | ||
| ${this.draggable ? this._renderDragMultipleImage() : nothing} | ||
| `; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rotates the drop targets