mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature: client: sort: migrate to ESM
This commit is contained in:
parent
917f585137
commit
e27ef51d43
1 changed files with 0 additions and 0 deletions
|
|
@ -1,31 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/* global CloudCmd */
|
||||
const DOM = require('./dom');
|
||||
|
||||
const Info = DOM.CurrentInfo;
|
||||
const {sort, order} = CloudCmd;
|
||||
const position = DOM.getPanelPosition();
|
||||
let sortPrevious = sort[position];
|
||||
|
||||
const {getPanel} = DOM;
|
||||
|
||||
CloudCmd.sortPanel = (name, panel = getPanel()) => {
|
||||
const position = panel.dataset.name.replace('js-', '');
|
||||
|
||||
if (name !== sortPrevious)
|
||||
order[position] = 'asc';
|
||||
else if (order[position] === 'asc')
|
||||
order[position] = 'desc';
|
||||
else
|
||||
order[position] = 'asc';
|
||||
|
||||
sortPrevious = name;
|
||||
sort[position] = name;
|
||||
const noCurrent = position !== Info.panelPosition;
|
||||
|
||||
CloudCmd.refresh({
|
||||
panel,
|
||||
noCurrent,
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue