Skip to content

feat(item-reorder): add side support - #11639

Closed
AmitMY wants to merge 4 commits into
ionic-team:masterfrom
AmitMY:item-reorder-side
Closed

AmitMY wants to merge 4 commits into
ionic-team:masterfrom
AmitMY:item-reorder-side

Conversation

@AmitMY

@AmitMY AmitMY commented May 12, 2017 •

Copy link
Copy Markdown
Contributor

Short description of what this resolves:

A user needs this feature

Video:
https://youtu.be/vlRo4PMnhEc

Changes proposed in this pull request:

  • add [side] to reorder
  • change structure of ion-item

Of course, this is RTL supported. Except for the transform, which will be fixed in an upcoming PR so I did not want to make custom.

Ionic Version: 3.x

Fixes: #11637

template:
'<ng-content select="[item-start],[item-left],ion-checkbox:not([item-end]):not([item-right])"></ng-content>' +
'<div class="item-inner">' +
'<ion-reorder *ngIf="_reorderSide == \'start\'" class="reorder-start"></ion-reorder>' +

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need reorder-start, reorder-end and have, ion-reorder duplicated, we can just use CSS.

order: -1

can make the trick

Comment thread src/util/util.ts
* @param isRTL whether the application dir is rtl
* @param defaultStart whether the default side is start
*/
export function isStartSide(side: Side, isRTL: boolean, defaultStart: boolean = true): boolean {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we reuse isRightSide(side: Side, isRTL: boolean, defaultRight: boolean = false)?

@Output() ionItemReorder: EventEmitter<ReorderIndexes> = new EventEmitter<ReorderIndexes>();

/**
* @input {string} Which side of the view the menu should be placed. Default `"start"`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix comment!

font-size: 1.7em;
opacity: .25;

transform: translate3d(160%, 0, 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to revert and have right side by default, then add: "reorder-end" dynamically

pointer-events: all;
touch-action: manipulation;

&.reorder-end {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we prefer to avoid using nested sass


this._setName(elementRef);
this._hasReorder = !!reorder;
this._reorderSide = reorder ? (isStartSide(reorder.side, plt.isRTL) ? 'start' : 'end') : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this anymore, also, it is not a good idea to calculate this here, since side can change dynamically?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, revert _hasReorder, (we don't need two <ion-reorder>)


private itemForCoord(coord: PointerCoordinates): HTMLElement {
const sideOffset = this.plt.isRTL ? 100 : -100;
const sideOffset = isRightSide(this.reorderList.side, this.plt.isRTL) ? -100 : 100;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we cache some "_reorderSide" as a boolean (probably renamed to (_isRightSide) that is calculated in ngOnInit()?

@AmitMY AmitMY closed this May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants