lexgui 8.2.4 → 8.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/NodeTree.d.ts +51 -51
- package/build/core/Namespace.js +1 -1
- package/build/core/Namespace.js.map +1 -1
- package/build/extensions/AssetView.d.ts +138 -137
- package/build/extensions/AssetView.js +58 -29
- package/build/extensions/AssetView.js.map +1 -1
- package/build/extensions/CodeEditor.d.ts +363 -363
- package/build/extensions/CodeEditor.js +24 -23
- package/build/extensions/CodeEditor.js.map +1 -1
- package/build/extensions/DocMaker.d.ts +28 -28
- package/build/extensions/DocMaker.js +13 -4
- package/build/extensions/DocMaker.js.map +1 -1
- package/build/lexgui.all.js +129 -65
- package/build/lexgui.all.js.map +1 -1
- package/build/lexgui.all.min.js +1 -1
- package/build/lexgui.all.module.js +129 -65
- package/build/lexgui.all.module.js.map +1 -1
- package/build/lexgui.all.module.min.js +1 -1
- package/build/lexgui.css +7466 -7466
- package/build/lexgui.js +34 -9
- package/build/lexgui.js.map +1 -1
- package/build/lexgui.min.css +1 -1
- package/build/lexgui.min.js +1 -1
- package/build/lexgui.module.js +34 -9
- package/build/lexgui.module.js.map +1 -1
- package/build/lexgui.module.min.js +1 -1
- package/changelog.md +14 -1
- package/examples/asset-view.html +29 -2
- package/package.json +2 -1
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { BaseComponent } from './BaseComponent';
|
|
2
|
-
export type NodeTreeAction = 'select' | 'dbl_click' | 'move' | 'delete' | 'rename' | 'visibility' | 'caret' | 'context_menu';
|
|
3
|
-
export interface NodeTreeEvent {
|
|
4
|
-
type: NodeTreeAction;
|
|
5
|
-
domEvent?: Event;
|
|
6
|
-
items?: any[];
|
|
7
|
-
result?: any[];
|
|
8
|
-
from?: any;
|
|
9
|
-
to?: any;
|
|
10
|
-
where?: any;
|
|
11
|
-
oldName?: string;
|
|
12
|
-
newName?: string;
|
|
13
|
-
search?: any[];
|
|
14
|
-
userInitiated: boolean;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Signature for cancelable events.
|
|
18
|
-
* `resolve()` MUST be called by the user to perform the UI action
|
|
19
|
-
*/
|
|
20
|
-
export type NodeTreeEventCallback = (event: NodeTreeEvent, resolve?: (...args: any[]) => void) => boolean | void | Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* @class NodeTree
|
|
23
|
-
*/
|
|
24
|
-
export declare class NodeTree {
|
|
25
|
-
domEl: any;
|
|
26
|
-
data: any;
|
|
27
|
-
options: any;
|
|
28
|
-
selected: any[];
|
|
29
|
-
_forceClose: boolean;
|
|
30
|
-
_callbacks: Record<string, NodeTreeEventCallback>;
|
|
31
|
-
constructor(domEl: any, data: any, options?: any);
|
|
32
|
-
_createItem(parent: any, node: any, level?: number, selectedId?: string): void;
|
|
33
|
-
refresh(newData?: any, selectedId?: string): void;
|
|
34
|
-
frefresh(id: string): void;
|
|
35
|
-
select(id
|
|
36
|
-
deleteNodes(nodes: any[]): any[];
|
|
37
|
-
deleteNode(node: any): boolean;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @class Tree
|
|
41
|
-
* @description Tree Component
|
|
42
|
-
*/
|
|
43
|
-
export declare class Tree extends BaseComponent {
|
|
44
|
-
innerTree: NodeTree;
|
|
45
|
-
constructor(name: string, data: any, options?: any);
|
|
46
|
-
/**
|
|
47
|
-
* @method on
|
|
48
|
-
* @description Stores an event callback for the desired action
|
|
49
|
-
*/
|
|
50
|
-
on(eventName: string, callback: NodeTreeEventCallback): void;
|
|
51
|
-
}
|
|
1
|
+
import { BaseComponent } from './BaseComponent';
|
|
2
|
+
export type NodeTreeAction = 'select' | 'dbl_click' | 'move' | 'delete' | 'rename' | 'visibility' | 'caret' | 'context_menu';
|
|
3
|
+
export interface NodeTreeEvent {
|
|
4
|
+
type: NodeTreeAction;
|
|
5
|
+
domEvent?: Event;
|
|
6
|
+
items?: any[];
|
|
7
|
+
result?: any[];
|
|
8
|
+
from?: any;
|
|
9
|
+
to?: any;
|
|
10
|
+
where?: any;
|
|
11
|
+
oldName?: string;
|
|
12
|
+
newName?: string;
|
|
13
|
+
search?: any[];
|
|
14
|
+
userInitiated: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Signature for cancelable events.
|
|
18
|
+
* `resolve()` MUST be called by the user to perform the UI action
|
|
19
|
+
*/
|
|
20
|
+
export type NodeTreeEventCallback = (event: NodeTreeEvent, resolve?: (...args: any[]) => void) => boolean | void | Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* @class NodeTree
|
|
23
|
+
*/
|
|
24
|
+
export declare class NodeTree {
|
|
25
|
+
domEl: any;
|
|
26
|
+
data: any;
|
|
27
|
+
options: any;
|
|
28
|
+
selected: any[];
|
|
29
|
+
_forceClose: boolean;
|
|
30
|
+
_callbacks: Record<string, NodeTreeEventCallback>;
|
|
31
|
+
constructor(domEl: any, data: any, options?: any);
|
|
32
|
+
_createItem(parent: any, node: any, level?: number, selectedId?: string): void;
|
|
33
|
+
refresh(newData?: any, selectedId?: string): void;
|
|
34
|
+
frefresh(id: string): void;
|
|
35
|
+
select(id?: string, path?: string[]): void;
|
|
36
|
+
deleteNodes(nodes: any[]): any[];
|
|
37
|
+
deleteNode(node: any): boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @class Tree
|
|
41
|
+
* @description Tree Component
|
|
42
|
+
*/
|
|
43
|
+
export declare class Tree extends BaseComponent {
|
|
44
|
+
innerTree: NodeTree;
|
|
45
|
+
constructor(name: string, data: any, options?: any);
|
|
46
|
+
/**
|
|
47
|
+
* @method on
|
|
48
|
+
* @description Stores an event callback for the desired action
|
|
49
|
+
*/
|
|
50
|
+
on(eventName: string, callback: NodeTreeEventCallback): void;
|
|
51
|
+
}
|
package/build/core/Namespace.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Namespace.js","sources":["../../src/core/Namespace.ts"],"sourcesContent":["// Namespace.ts @jxarco\r\n\r\n/**\r\n * Main namespace\r\n * @namespace LX\r\n */\r\n\r\nconst g = globalThis as any;\r\n\r\n// Update global namespace if not present (Loading module)\r\n// Extension scripts rely on LX being globally available\r\nlet LX: any = g.LX;\r\n\r\nif ( !LX )\r\n{\r\n LX = {\r\n version: '8.2.
|
|
1
|
+
{"version":3,"file":"Namespace.js","sources":["../../src/core/Namespace.ts"],"sourcesContent":["// Namespace.ts @jxarco\r\n\r\n/**\r\n * Main namespace\r\n * @namespace LX\r\n */\r\n\r\nconst g = globalThis as any;\r\n\r\n// Update global namespace if not present (Loading module)\r\n// Extension scripts rely on LX being globally available\r\nlet LX: any = g.LX;\r\n\r\nif ( !LX )\r\n{\r\n LX = {\r\n version: '8.2.5',\r\n ready: false,\r\n extensions: [], // Store extensions used\r\n extraCommandbarEntries: [], // User specific entries for command bar\r\n signals: {}, // Events and triggers\r\n activeDraggable: null, // Watch for the current active draggable\r\n\r\n spacingMode: 'default',\r\n layoutMode: 'app',\r\n\r\n MOUSE_LEFT_CLICK: 0,\r\n MOUSE_MIDDLE_CLICK: 1,\r\n MOUSE_RIGHT_CLICK: 2,\r\n\r\n MOUSE_DOUBLE_CLICK: 2,\r\n MOUSE_TRIPLE_CLICK: 3,\r\n\r\n CURVE_MOVEOUT_CLAMP: 0,\r\n CURVE_MOVEOUT_DELETE: 1,\r\n\r\n DRAGGABLE_Z_INDEX: 101\r\n };\r\n\r\n g.LX = LX;\r\n}\r\n\r\nexport { LX };\r\n"],"names":[],"mappings":";AAAA;AAEA;;;AAGG;AAEH,MAAM,CAAC,GAAG,UAAiB;AAE3B;AACA;AACA,IAAI,EAAE,GAAQ,CAAC,CAAC;AAEhB,IAAK,CAAC,EAAE,EACR;AACI,IAAA,EAAE,GAAG;AACD,QAAA,OAAO,EAAE,OAAO;AAChB,QAAA,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE,EAAE;QACd,sBAAsB,EAAE,EAAE;QAC1B,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,IAAI;AAErB,QAAA,WAAW,EAAE,SAAS;AACtB,QAAA,UAAU,EAAE,KAAK;AAEjB,QAAA,gBAAgB,EAAE,CAAC;AACnB,QAAA,kBAAkB,EAAE,CAAC;AACrB,QAAA,iBAAiB,EAAE,CAAC;AAEpB,QAAA,kBAAkB,EAAE,CAAC;AACrB,QAAA,kBAAkB,EAAE,CAAC;AAErB,QAAA,mBAAmB,EAAE,CAAC;AACtB,QAAA,oBAAoB,EAAE,CAAC;AAEvB,QAAA,iBAAiB,EAAE;KACtB;AAED,IAAA,CAAC,CAAC,EAAE,GAAG,EAAE;AACb;;;;"}
|
|
@@ -1,137 +1,138 @@
|
|
|
1
|
-
import { LX } from '../core/Namespace';
|
|
2
|
-
declare const Area: any;
|
|
3
|
-
declare const Panel: any;
|
|
4
|
-
declare const NodeTree: any;
|
|
5
|
-
declare const Tree: any;
|
|
6
|
-
export type AssetViewAction = 'select' | 'dbl_click' | 'check' | 'clone' | 'move' | 'delete' | 'rename' | 'enter_folder' | 'create-folder' | 'refresh-content' | 'node-drag';
|
|
7
|
-
export interface AssetViewItem {
|
|
8
|
-
id: string;
|
|
9
|
-
type: string;
|
|
10
|
-
children: AssetViewItem[];
|
|
11
|
-
parent?: AssetViewItem;
|
|
12
|
-
path?: string;
|
|
13
|
-
src?: string;
|
|
14
|
-
dir?: AssetViewItem[];
|
|
15
|
-
domEl?: HTMLElement;
|
|
16
|
-
metadata: any;
|
|
17
|
-
}
|
|
18
|
-
interface AssetViewEvent {
|
|
19
|
-
type: AssetViewAction;
|
|
20
|
-
items?: AssetViewItem[];
|
|
21
|
-
result?: AssetViewItem[];
|
|
22
|
-
from?: AssetViewItem;
|
|
23
|
-
to?: AssetViewItem;
|
|
24
|
-
where?: AssetViewItem;
|
|
25
|
-
oldName?: string;
|
|
26
|
-
newName?: string;
|
|
27
|
-
search?: any[];
|
|
28
|
-
userInitiated: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Signature for cancelable events.
|
|
32
|
-
* `resolve()` MUST be called by the user to perform the UI action
|
|
33
|
-
*/
|
|
34
|
-
export type AssetViewEventCallback = (event: AssetViewEvent, resolve?: (...args: any[]) => void) => boolean | void | Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* @class AssetView
|
|
37
|
-
* @description Asset container with Tree for file system
|
|
38
|
-
*/
|
|
39
|
-
export declare class AssetView {
|
|
40
|
-
static LAYOUT_GRID: number;
|
|
41
|
-
static LAYOUT_COMPACT: number;
|
|
42
|
-
static LAYOUT_LIST: number;
|
|
43
|
-
static CONTENT_SORT_ASC: number;
|
|
44
|
-
static CONTENT_SORT_DESC: number;
|
|
45
|
-
root: HTMLElement;
|
|
46
|
-
area: typeof Area | null;
|
|
47
|
-
content: HTMLElement;
|
|
48
|
-
leftPanel: typeof Panel | null;
|
|
49
|
-
toolsPanel: any;
|
|
50
|
-
contentPanel: any;
|
|
51
|
-
previewPanel: any;
|
|
52
|
-
tree: typeof NodeTree | null;
|
|
53
|
-
prevData: AssetViewItem[];
|
|
54
|
-
nextData: AssetViewItem[];
|
|
55
|
-
data: AssetViewItem[];
|
|
56
|
-
currentData: AssetViewItem[];
|
|
57
|
-
currentFolder: AssetViewItem | undefined;
|
|
58
|
-
rootItem: AssetViewItem;
|
|
59
|
-
path: string[];
|
|
60
|
-
rootPath: string;
|
|
61
|
-
|
|
62
|
-
allowedTypes: any;
|
|
63
|
-
searchValue: string;
|
|
64
|
-
filter: string;
|
|
65
|
-
gridScale: number;
|
|
66
|
-
layout: number;
|
|
67
|
-
sortMode: number;
|
|
68
|
-
skipBrowser: boolean;
|
|
69
|
-
skipPreview: boolean;
|
|
70
|
-
useNativeTitle: boolean;
|
|
71
|
-
onlyFolders: boolean;
|
|
72
|
-
allowMultipleSelection: boolean;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* @
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* @
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* @
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
* @
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
1
|
+
import { LX } from '../core/Namespace';
|
|
2
|
+
declare const Area: any;
|
|
3
|
+
declare const Panel: any;
|
|
4
|
+
declare const NodeTree: any;
|
|
5
|
+
declare const Tree: any;
|
|
6
|
+
export type AssetViewAction = 'select' | 'dbl_click' | 'check' | 'clone' | 'move' | 'delete' | 'rename' | 'enter_folder' | 'create-folder' | 'refresh-content' | 'node-drag';
|
|
7
|
+
export interface AssetViewItem {
|
|
8
|
+
id: string;
|
|
9
|
+
type: string;
|
|
10
|
+
children: AssetViewItem[];
|
|
11
|
+
parent?: AssetViewItem;
|
|
12
|
+
path?: string;
|
|
13
|
+
src?: string;
|
|
14
|
+
dir?: AssetViewItem[];
|
|
15
|
+
domEl?: HTMLElement;
|
|
16
|
+
metadata: any;
|
|
17
|
+
}
|
|
18
|
+
interface AssetViewEvent {
|
|
19
|
+
type: AssetViewAction;
|
|
20
|
+
items?: AssetViewItem[];
|
|
21
|
+
result?: AssetViewItem[];
|
|
22
|
+
from?: AssetViewItem;
|
|
23
|
+
to?: AssetViewItem;
|
|
24
|
+
where?: AssetViewItem;
|
|
25
|
+
oldName?: string;
|
|
26
|
+
newName?: string;
|
|
27
|
+
search?: any[];
|
|
28
|
+
userInitiated: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Signature for cancelable events.
|
|
32
|
+
* `resolve()` MUST be called by the user to perform the UI action
|
|
33
|
+
*/
|
|
34
|
+
export type AssetViewEventCallback = (event: AssetViewEvent, resolve?: (...args: any[]) => void) => boolean | void | Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* @class AssetView
|
|
37
|
+
* @description Asset container with Tree for file system
|
|
38
|
+
*/
|
|
39
|
+
export declare class AssetView {
|
|
40
|
+
static LAYOUT_GRID: number;
|
|
41
|
+
static LAYOUT_COMPACT: number;
|
|
42
|
+
static LAYOUT_LIST: number;
|
|
43
|
+
static CONTENT_SORT_ASC: number;
|
|
44
|
+
static CONTENT_SORT_DESC: number;
|
|
45
|
+
root: HTMLElement;
|
|
46
|
+
area: typeof Area | null;
|
|
47
|
+
content: HTMLElement;
|
|
48
|
+
leftPanel: typeof Panel | null;
|
|
49
|
+
toolsPanel: any;
|
|
50
|
+
contentPanel: any;
|
|
51
|
+
previewPanel: any;
|
|
52
|
+
tree: typeof NodeTree | null;
|
|
53
|
+
prevData: AssetViewItem[];
|
|
54
|
+
nextData: AssetViewItem[];
|
|
55
|
+
data: AssetViewItem[];
|
|
56
|
+
currentData: AssetViewItem[];
|
|
57
|
+
currentFolder: AssetViewItem | undefined;
|
|
58
|
+
rootItem: AssetViewItem;
|
|
59
|
+
path: string[];
|
|
60
|
+
rootPath: string;
|
|
61
|
+
selectedItems: AssetViewItem[];
|
|
62
|
+
allowedTypes: any;
|
|
63
|
+
searchValue: string;
|
|
64
|
+
filter: string;
|
|
65
|
+
gridScale: number;
|
|
66
|
+
layout: number;
|
|
67
|
+
sortMode: number;
|
|
68
|
+
skipBrowser: boolean;
|
|
69
|
+
skipPreview: boolean;
|
|
70
|
+
useNativeTitle: boolean;
|
|
71
|
+
onlyFolders: boolean;
|
|
72
|
+
allowMultipleSelection: boolean;
|
|
73
|
+
allowItemCheck: boolean;
|
|
74
|
+
previewActions: any[];
|
|
75
|
+
contextMenu: any[];
|
|
76
|
+
itemContextMenuOptions: any;
|
|
77
|
+
private _assetsPerPage;
|
|
78
|
+
get assetsPerPage(): any;
|
|
79
|
+
set assetsPerPage(v: any);
|
|
80
|
+
_callbacks: Record<string, AssetViewEventCallback>;
|
|
81
|
+
_lastSortBy: string;
|
|
82
|
+
_paginator: typeof LX.Pagination | undefined;
|
|
83
|
+
_scriptCodeDialog: typeof LX.Dialog | undefined;
|
|
84
|
+
_moveItemDialog: typeof LX.Dialog | undefined;
|
|
85
|
+
_movingItem: AssetViewItem | undefined;
|
|
86
|
+
constructor(options?: any);
|
|
87
|
+
/**
|
|
88
|
+
* @method on
|
|
89
|
+
* @description Stores an event callback for the desired action
|
|
90
|
+
*/
|
|
91
|
+
on(eventName: string, callback: AssetViewEventCallback): void;
|
|
92
|
+
/**
|
|
93
|
+
* @method load
|
|
94
|
+
* @description Loads and processes the input data
|
|
95
|
+
*/
|
|
96
|
+
load(data: any): void;
|
|
97
|
+
/**
|
|
98
|
+
* @method addItem
|
|
99
|
+
* @description Creates an item DOM element
|
|
100
|
+
*/
|
|
101
|
+
addItem(item: AssetViewItem, childIndex: number | undefined, updateTree?: boolean): HTMLLIElement;
|
|
102
|
+
/**
|
|
103
|
+
* @method clear
|
|
104
|
+
* @description Creates all AssetView container panels
|
|
105
|
+
*/
|
|
106
|
+
clear(): void;
|
|
107
|
+
_processData(data: any, parent?: AssetViewItem): void;
|
|
108
|
+
_updatePath(): void;
|
|
109
|
+
_createNavigationBar(panel: typeof Panel): void;
|
|
110
|
+
_createTreePanel(area: typeof Area): void;
|
|
111
|
+
_subscribeTreeEvents(tree: typeof Tree): void;
|
|
112
|
+
_setContentLayout(layoutMode: number): void;
|
|
113
|
+
_createContentPanel(area: typeof Area): void;
|
|
114
|
+
_makeNameFilterFn(searchValue: string): (name: string) => boolean;
|
|
115
|
+
_refreshContent(searchValue?: string, filter?: string, userInitiated?: boolean): void;
|
|
116
|
+
_previewAsset(file: AssetViewItem): void;
|
|
117
|
+
_processDrop(e: DragEvent): void;
|
|
118
|
+
_sortData(sortBy?: string, sortMode?: number): void;
|
|
119
|
+
_enterFolder(folderItem: AssetViewItem | undefined, storeCurrent?: boolean): Promise<void>;
|
|
120
|
+
_removeItemFromParent(item: AssetViewItem): boolean;
|
|
121
|
+
_requestDeleteItem(items: AssetViewItem[]): void;
|
|
122
|
+
_deleteItem(item: AssetViewItem): void;
|
|
123
|
+
_requestMoveItemToFolder(item: AssetViewItem, folder: AssetViewItem): void;
|
|
124
|
+
_moveItemToFolder(item: AssetViewItem, folder: AssetViewItem): void;
|
|
125
|
+
_moveItem(item: AssetViewItem, defaultFolder?: AssetViewItem | AssetViewItem[]): void;
|
|
126
|
+
_requestCloneItem(item: AssetViewItem): false | undefined;
|
|
127
|
+
_cloneItem(item: AssetViewItem): AssetViewItem;
|
|
128
|
+
_getClonedName(originalName: string, siblings: any[]): string;
|
|
129
|
+
_requestRenameItem(item: AssetViewItem, newName: string, treeEvent?: boolean): void;
|
|
130
|
+
_renameItem(item: AssetViewItem, newName: string, data?: AssetViewItem[]): void;
|
|
131
|
+
_renameItemPopover(item: AssetViewItem): void;
|
|
132
|
+
_requestCreateFolder(folder?: AssetViewItem): void;
|
|
133
|
+
_createFolder(folder?: AssetViewItem, newFolderName?: string): AssetViewItem;
|
|
134
|
+
_openScriptInEditor(script: any): void;
|
|
135
|
+
_setAssetsPerPage(n: number): void;
|
|
136
|
+
_lastModifiedToStringDate(lm: number): string;
|
|
137
|
+
}
|
|
138
|
+
export {};
|
|
@@ -36,7 +36,7 @@ class AssetView {
|
|
|
36
36
|
rootItem;
|
|
37
37
|
path = [];
|
|
38
38
|
rootPath = '';
|
|
39
|
-
|
|
39
|
+
selectedItems = [];
|
|
40
40
|
allowedTypes;
|
|
41
41
|
searchValue = '';
|
|
42
42
|
filter = 'None';
|
|
@@ -48,7 +48,8 @@ class AssetView {
|
|
|
48
48
|
skipPreview = false;
|
|
49
49
|
useNativeTitle = false;
|
|
50
50
|
onlyFolders = true;
|
|
51
|
-
allowMultipleSelection =
|
|
51
|
+
allowMultipleSelection = true;
|
|
52
|
+
allowItemCheck = false;
|
|
52
53
|
previewActions = [];
|
|
53
54
|
contextMenu = [];
|
|
54
55
|
itemContextMenuOptions = null;
|
|
@@ -88,6 +89,7 @@ class AssetView {
|
|
|
88
89
|
this.useNativeTitle = options.useNativeTitle ?? this.useNativeTitle;
|
|
89
90
|
this.onlyFolders = options.onlyFolders ?? this.onlyFolders;
|
|
90
91
|
this.allowMultipleSelection = options.allowMultipleSelection ?? this.allowMultipleSelection;
|
|
92
|
+
this.allowItemCheck = options.allowItemCheck ?? this.allowItemCheck;
|
|
91
93
|
this.previewActions = options.previewActions ?? [];
|
|
92
94
|
this.itemContextMenuOptions = options.itemContextMenuOptions;
|
|
93
95
|
this.gridScale = options.gridScale ?? this.gridScale;
|
|
@@ -184,9 +186,9 @@ class AssetView {
|
|
|
184
186
|
if (!this.useNativeTitle) {
|
|
185
187
|
let desc = document.createElement('span');
|
|
186
188
|
desc.className = 'lexitemdesc';
|
|
187
|
-
desc.id = `floatingTitle_${metadata.uid}
|
|
189
|
+
desc.id = LX.getSupportedDOMName(`floatingTitle_${metadata.uid}`);
|
|
188
190
|
desc.innerHTML = `File: ${item.id}<br>Type: ${type}`;
|
|
189
|
-
LX.insertChildAtIndex(this.content, desc, childIndex ? childIndex + 1 : undefined);
|
|
191
|
+
LX.insertChildAtIndex(this.content, desc, childIndex !== undefined ? childIndex + 1 : undefined);
|
|
190
192
|
itemEl.addEventListener('mousemove', (e) => {
|
|
191
193
|
if (!isGridLayout) {
|
|
192
194
|
return;
|
|
@@ -212,7 +214,7 @@ class AssetView {
|
|
|
212
214
|
else {
|
|
213
215
|
itemEl.title = type + ': ' + item.id;
|
|
214
216
|
}
|
|
215
|
-
if (this.
|
|
217
|
+
if (this.allowItemCheck) {
|
|
216
218
|
let checkbox = document.createElement('input');
|
|
217
219
|
checkbox.type = 'checkbox';
|
|
218
220
|
checkbox.className = 'lexcheckbox';
|
|
@@ -301,11 +303,12 @@ class AssetView {
|
|
|
301
303
|
e.stopPropagation();
|
|
302
304
|
const isDoubleClick = e.detail == LX.MOUSE_DOUBLE_CLICK;
|
|
303
305
|
if (!isDoubleClick) {
|
|
304
|
-
if (!e.shiftKey) {
|
|
306
|
+
if (!e.shiftKey || !that.allowMultipleSelection) {
|
|
305
307
|
that.content.querySelectorAll('.lexassetitem').forEach((i) => i.classList.remove('selected'));
|
|
308
|
+
that.selectedItems.length = 0;
|
|
306
309
|
}
|
|
307
310
|
this.classList.add('selected');
|
|
308
|
-
that.
|
|
311
|
+
that.selectedItems.push(item);
|
|
309
312
|
if (!that.skipPreview) {
|
|
310
313
|
that._previewAsset(item);
|
|
311
314
|
}
|
|
@@ -337,35 +340,44 @@ class AssetView {
|
|
|
337
340
|
e.preventDefault();
|
|
338
341
|
e.stopImmediatePropagation();
|
|
339
342
|
e.stopPropagation();
|
|
340
|
-
const
|
|
343
|
+
const multipleSelection = that.selectedItems.length > 1;
|
|
341
344
|
const options = [
|
|
342
345
|
{
|
|
343
|
-
name:
|
|
346
|
+
name: multipleSelection ? (`${that.selectedItems.length} selected`) : item.id,
|
|
344
347
|
icon: LX.makeIcon('CircleSmall', { svgClass: `fill-current text-${typeColor}` }),
|
|
345
348
|
className: 'text-sm',
|
|
346
349
|
disabled: true
|
|
347
350
|
},
|
|
348
351
|
null
|
|
349
352
|
];
|
|
350
|
-
|
|
353
|
+
// By now, allow with none/single selected items
|
|
354
|
+
if (!multipleSelection) {
|
|
351
355
|
options.push({ name: 'Rename', icon: 'TextCursor', callback: that._renameItemPopover.bind(that, item) });
|
|
352
356
|
}
|
|
353
|
-
|
|
357
|
+
// By now, allow with none/single selected items
|
|
358
|
+
if (!isFolder && !multipleSelection) {
|
|
354
359
|
options.push({ name: 'Clone', icon: 'Copy', callback: that._requestCloneItem.bind(that, item) });
|
|
355
360
|
}
|
|
356
|
-
|
|
357
|
-
if (
|
|
361
|
+
// By now, allow with none/single selected items
|
|
362
|
+
if (!multipleSelection) {
|
|
363
|
+
options.push({ name: 'Move', icon: 'FolderInput', callback: () => that._moveItem(item) });
|
|
364
|
+
}
|
|
365
|
+
// By now, allow with none/single selected items
|
|
366
|
+
if (!multipleSelection && type == 'Script' && LX.has('CodeEditor')) {
|
|
358
367
|
options.push({ name: 'Open in Editor', icon: 'Code', callback: that._openScriptInEditor.bind(that, item) });
|
|
359
368
|
}
|
|
360
369
|
if (that.itemContextMenuOptions) {
|
|
361
|
-
options.
|
|
370
|
+
if (options.length > 2)
|
|
371
|
+
options.push(null);
|
|
362
372
|
for (let o of that.itemContextMenuOptions) {
|
|
363
373
|
if (!o.name || !o.callback)
|
|
364
374
|
continue;
|
|
365
|
-
options.push({ name: o.name, icon: o.icon,
|
|
375
|
+
options.push({ name: o.name, icon: o.icon,
|
|
376
|
+
callback: o.callback?.bind(that, multipleSelection ? that.selectedItems : [item]) });
|
|
366
377
|
}
|
|
367
378
|
}
|
|
368
|
-
options.push(null, { name: 'Delete', icon: 'Trash2', className: 'destructive',
|
|
379
|
+
options.push(null, { name: 'Delete', icon: 'Trash2', className: 'destructive',
|
|
380
|
+
callback: that._requestDeleteItem.bind(that, multipleSelection ? that.selectedItems : [item]) });
|
|
369
381
|
LX.addClass(that.contentPanel.root, 'pointer-events-none');
|
|
370
382
|
LX.addDropdownMenu(e.target, options, { side: 'right', align: 'start', event: e, onBlur: () => {
|
|
371
383
|
LX.removeClass(that.contentPanel.root, 'pointer-events-none');
|
|
@@ -396,7 +408,8 @@ class AssetView {
|
|
|
396
408
|
e.dataTransfer.setDragImage(img, 0, 0);
|
|
397
409
|
e.dataTransfer.effectAllowed = 'move';
|
|
398
410
|
}
|
|
399
|
-
const
|
|
411
|
+
const domName = LX.getSupportedDOMName(`floatingTitle_${metadata.uid}`);
|
|
412
|
+
const desc = that.content.querySelector(`#${domName}`);
|
|
400
413
|
if (desc)
|
|
401
414
|
desc.style.display = 'none';
|
|
402
415
|
}, false);
|
|
@@ -431,7 +444,8 @@ class AssetView {
|
|
|
431
444
|
});
|
|
432
445
|
itemEl.addEventListener('mouseenter', (e) => {
|
|
433
446
|
if (!that.useNativeTitle && isGridLayout) {
|
|
434
|
-
const
|
|
447
|
+
const domName = LX.getSupportedDOMName(`floatingTitle_${metadata.uid}`);
|
|
448
|
+
const desc = that.content.querySelector(`#${domName}`);
|
|
435
449
|
if (desc)
|
|
436
450
|
desc.style.display = 'unset';
|
|
437
451
|
}
|
|
@@ -445,7 +459,8 @@ class AssetView {
|
|
|
445
459
|
itemEl.addEventListener('mouseleave', (e) => {
|
|
446
460
|
if (!that.useNativeTitle && isGridLayout) {
|
|
447
461
|
setTimeout(() => {
|
|
448
|
-
const
|
|
462
|
+
const domName = LX.getSupportedDOMName(`floatingTitle_${metadata.uid}`);
|
|
463
|
+
const desc = that.content.querySelector(`#${domName}`);
|
|
449
464
|
if (desc)
|
|
450
465
|
desc.style.display = 'none';
|
|
451
466
|
}, 100);
|
|
@@ -574,7 +589,7 @@ class AssetView {
|
|
|
574
589
|
const dom = node.domEl;
|
|
575
590
|
dom?.classList.add('selected');
|
|
576
591
|
}
|
|
577
|
-
this.
|
|
592
|
+
this.selectedItems = [node];
|
|
578
593
|
}
|
|
579
594
|
});
|
|
580
595
|
tree.on('beforeMove', (event, resolve) => {
|
|
@@ -725,6 +740,7 @@ class AssetView {
|
|
|
725
740
|
});
|
|
726
741
|
this.content.addEventListener('click', function () {
|
|
727
742
|
this.querySelectorAll('.lexassetitem').forEach((i) => i.classList.remove('selected'));
|
|
743
|
+
that.selectedItems.length = 0;
|
|
728
744
|
});
|
|
729
745
|
this.content.addEventListener('contextmenu', function (e) {
|
|
730
746
|
e.preventDefault();
|
|
@@ -943,7 +959,7 @@ class AssetView {
|
|
|
943
959
|
return;
|
|
944
960
|
}
|
|
945
961
|
const child = this.currentData[0];
|
|
946
|
-
const sameFolder = child?.parent?.
|
|
962
|
+
const sameFolder = child?.parent?.metadata?.uid === folderItem.metadata?.uid;
|
|
947
963
|
if (storeCurrent) {
|
|
948
964
|
this.prevData.push(this.currentFolder ?? {
|
|
949
965
|
id: '/',
|
|
@@ -969,7 +985,15 @@ class AssetView {
|
|
|
969
985
|
if (mustRefresh) {
|
|
970
986
|
this._processData(this.data);
|
|
971
987
|
this._refreshContent();
|
|
972
|
-
|
|
988
|
+
// Get path to avoid same id issues
|
|
989
|
+
let path = `${this.currentFolder.id}/`;
|
|
990
|
+
let parent = this.currentFolder.parent;
|
|
991
|
+
while (parent && parent.id !== '/') {
|
|
992
|
+
path += `${parent.id}/`;
|
|
993
|
+
parent = parent.parent;
|
|
994
|
+
}
|
|
995
|
+
const parentsPath = path.split('/').filter(Boolean).reverse();
|
|
996
|
+
this.tree?.select(undefined, parentsPath);
|
|
973
997
|
}
|
|
974
998
|
this._updatePath();
|
|
975
999
|
}
|
|
@@ -994,14 +1018,14 @@ class AssetView {
|
|
|
994
1018
|
}
|
|
995
1019
|
return true;
|
|
996
1020
|
}
|
|
997
|
-
_requestDeleteItem(
|
|
1021
|
+
_requestDeleteItem(items) {
|
|
998
1022
|
const onBeforeDelete = this._callbacks['beforeDelete'];
|
|
999
1023
|
const onDelete = this._callbacks['delete'];
|
|
1000
1024
|
const resolve = (...args) => {
|
|
1001
|
-
this._deleteItem(item);
|
|
1025
|
+
items.forEach((item) => this._deleteItem(item));
|
|
1002
1026
|
const event = {
|
|
1003
1027
|
type: 'delete',
|
|
1004
|
-
items
|
|
1028
|
+
items,
|
|
1005
1029
|
userInitiated: true
|
|
1006
1030
|
};
|
|
1007
1031
|
if (onDelete)
|
|
@@ -1010,7 +1034,7 @@ class AssetView {
|
|
|
1010
1034
|
if (onBeforeDelete) {
|
|
1011
1035
|
const event = {
|
|
1012
1036
|
type: 'delete',
|
|
1013
|
-
items
|
|
1037
|
+
items,
|
|
1014
1038
|
userInitiated: true
|
|
1015
1039
|
};
|
|
1016
1040
|
onBeforeDelete(event, resolve);
|
|
@@ -1119,7 +1143,7 @@ class AssetView {
|
|
|
1119
1143
|
}
|
|
1120
1144
|
bcContainer.innerHTML = '';
|
|
1121
1145
|
bcContainer.appendChild(LX.makeBreadcrumb(path.reverse().map((p) => {
|
|
1122
|
-
return {
|
|
1146
|
+
return { name: p };
|
|
1123
1147
|
}), {
|
|
1124
1148
|
maxItems: 4,
|
|
1125
1149
|
separatorIcon: 'ChevronRight'
|
|
@@ -1289,16 +1313,21 @@ class AssetView {
|
|
|
1289
1313
|
// It could be a Tree event, so maybe the elements is not created yet
|
|
1290
1314
|
if (item.domEl) {
|
|
1291
1315
|
const wasSelected = LX.hasClass(item.domEl, 'selected');
|
|
1292
|
-
const
|
|
1316
|
+
const hoverTitleDomName = LX.getSupportedDOMName(`floatingTitle_${item.metadata.uid}`);
|
|
1317
|
+
const hoverTitle = this.content.querySelector(`#${hoverTitleDomName}`);
|
|
1293
1318
|
if (hoverTitle)
|
|
1294
1319
|
hoverTitle.remove();
|
|
1295
1320
|
item.domEl?.remove();
|
|
1321
|
+
// Update new name
|
|
1322
|
+
item.id = newName;
|
|
1296
1323
|
item.domEl = this.addItem(item, idx * 2);
|
|
1297
1324
|
if (wasSelected) {
|
|
1298
1325
|
this._previewAsset(item);
|
|
1299
1326
|
}
|
|
1300
1327
|
}
|
|
1301
|
-
|
|
1328
|
+
else {
|
|
1329
|
+
item.id = newName;
|
|
1330
|
+
}
|
|
1302
1331
|
this.tree?.refresh();
|
|
1303
1332
|
this._processData(this.data);
|
|
1304
1333
|
}
|