mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
feature: cloudcmd: migrate to ESM
This commit is contained in:
parent
e8a81c49ea
commit
4533a25c6f
184 changed files with 339 additions and 388 deletions
36
client/sort.js
Normal file
36
client/sort.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* global CloudCmd */
|
||||
import {fullstore} from 'fullstore';
|
||||
import DOM from '#dom';
|
||||
|
||||
const sortPrevious = fullstore();
|
||||
|
||||
const {getPanel} = DOM;
|
||||
|
||||
export const initSortPanel = () => {
|
||||
const {sort} = CloudCmd;
|
||||
const position = DOM.getPanelPosition();
|
||||
|
||||
sortPrevious(sort[position]);
|
||||
};
|
||||
|
||||
export const sortPanel = (name, panel = getPanel()) => {
|
||||
const {sort, order} = CloudCmd;
|
||||
const Info = DOM.CurrentInfo;
|
||||
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