@omegagrid/commands 0.10.0 → 0.10.2
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/package.json +4 -4
- package/dist/adapters/adapter.d.ts +0 -19
- package/dist/adapters/adapter.d.ts.map +0 -1
- package/dist/adapters/adapter.js +0 -23
- package/dist/adapters/adapter.js.map +0 -1
- package/dist/adapters/commandsFlowAdapter.d.ts +0 -25
- package/dist/adapters/commandsFlowAdapter.d.ts.map +0 -1
- package/dist/adapters/commandsFlowAdapter.js +0 -61
- package/dist/adapters/commandsFlowAdapter.js.map +0 -1
- package/dist/adapters/index.d.ts +0 -3
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -3
- package/dist/adapters/index.js.map +0 -1
- package/dist/commandManager.d.ts +0 -39
- package/dist/commandManager.d.ts.map +0 -1
- package/dist/commandManager.js +0 -104
- package/dist/commandManager.js.map +0 -1
- package/dist/common.d.ts +0 -5
- package/dist/common.d.ts.map +0 -1
- package/dist/common.js +0 -18
- package/dist/common.js.map +0 -1
- package/dist/constants.d.ts +0 -49
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -7
- package/dist/constants.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/model/commands.d.ts +0 -66
- package/dist/model/commands.d.ts.map +0 -1
- package/dist/model/commands.js +0 -116
- package/dist/model/commands.js.map +0 -1
- package/dist/model/index.d.ts +0 -3
- package/dist/model/index.d.ts.map +0 -1
- package/dist/model/index.js +0 -3
- package/dist/model/index.js.map +0 -1
- package/dist/model/options.d.ts +0 -13
- package/dist/model/options.d.ts.map +0 -1
- package/dist/model/options.js +0 -17
- package/dist/model/options.js.map +0 -1
- package/dist/ui/commandWindow.d.ts +0 -75
- package/dist/ui/commandWindow.d.ts.map +0 -1
- package/dist/ui/commandWindow.js +0 -438
- package/dist/ui/commandWindow.js.map +0 -1
- package/dist/ui/commandWindow.style.d.ts +0 -3
- package/dist/ui/commandWindow.style.d.ts.map +0 -1
- package/dist/ui/commandWindow.style.js +0 -148
- package/dist/ui/commandWindow.style.js.map +0 -1
- package/dist/ui/floatingCommandWindow.d.ts +0 -7
- package/dist/ui/floatingCommandWindow.d.ts.map +0 -1
- package/dist/ui/floatingCommandWindow.js +0 -41
- package/dist/ui/floatingCommandWindow.js.map +0 -1
- package/dist/ui/index.d.ts +0 -2
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -2
- package/dist/ui/index.js.map +0 -1
package/dist/ui/commandWindow.js
DELETED
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Commands, Command, CommandGroup, initOptions } from "../model";
|
|
8
|
-
import { dom, ListSelectTrigger } from "@omegagrid/core";
|
|
9
|
-
import { LitElement, html } from 'lit';
|
|
10
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
11
|
-
import { debounce } from "ts-debounce";
|
|
12
|
-
import { style, itemStyle } from "./commandWindow.style";
|
|
13
|
-
import { styleMap } from "lit-html/directives/style-map.js";
|
|
14
|
-
import { msg } from "@omegagrid/localize";
|
|
15
|
-
export class CommandEvent extends Event {
|
|
16
|
-
constructor(type, args) {
|
|
17
|
-
super(`command.${type}`, { bubbles: true, composed: true });
|
|
18
|
-
if (args)
|
|
19
|
-
Object.assign(this, args);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const DEFAULT_COMMAND_RENDERER = (_div, command) => {
|
|
23
|
-
return html `<div class="command">${command.name}</div>`;
|
|
24
|
-
};
|
|
25
|
-
const DEFAULT_GROUP_RENDERER = (_div, group) => {
|
|
26
|
-
return html `
|
|
27
|
-
<div class="group" @mousedown="${(e) => e.preventDefault()}">
|
|
28
|
-
<div class="group-toggle">
|
|
29
|
-
<og-icon icon="angle-${group.open ? 'down' : 'right'}"></og-icon>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div class="group-text">
|
|
33
|
-
${group.name}
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
`;
|
|
37
|
-
};
|
|
38
|
-
let CommandWindow = class CommandWindow extends LitElement {
|
|
39
|
-
get activeSection() { return this.sections?.[this.activeSectionIndex]; }
|
|
40
|
-
get inputValue() { return this.input?.value ?? ''; }
|
|
41
|
-
get parsedInput() {
|
|
42
|
-
const input = this.inputValue;
|
|
43
|
-
const chunks = input.split(' ', 2);
|
|
44
|
-
if (chunks.length > 1) {
|
|
45
|
-
const section = (this.sections ?? []).findIndex(s => s?.triggerCommand == chunks[0]);
|
|
46
|
-
const value = section > -1 ? chunks[1] ?? '' : input;
|
|
47
|
-
return { section, value };
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return { section: -1, value: input };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
get filterValue() {
|
|
54
|
-
return this.mode == 'search' ? this.parsedInput?.value ?? '' : '';
|
|
55
|
-
}
|
|
56
|
-
get commandRenderer() {
|
|
57
|
-
return this.options?.commandRenderer || DEFAULT_COMMAND_RENDERER;
|
|
58
|
-
}
|
|
59
|
-
get groupRenderer() {
|
|
60
|
-
return this.options?.groupRenderer || DEFAULT_GROUP_RENDERER;
|
|
61
|
-
}
|
|
62
|
-
async exec(dispatchEvent = true) {
|
|
63
|
-
const input = this.parsedInput;
|
|
64
|
-
const command = this.visibleItems[this.list.selectedIndex];
|
|
65
|
-
if (!(command instanceof Command))
|
|
66
|
-
return;
|
|
67
|
-
this.clearFilter(false);
|
|
68
|
-
command.exec(input.value);
|
|
69
|
-
if (this.adapter) {
|
|
70
|
-
this.adapter.exec(command, input.value);
|
|
71
|
-
}
|
|
72
|
-
if (dispatchEvent)
|
|
73
|
-
this.dispatchEvent(new CommandEvent('exec', {
|
|
74
|
-
command: command,
|
|
75
|
-
section: this.sections.find(s => s.id === input.section),
|
|
76
|
-
value: input.value
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
constructor() {
|
|
80
|
-
super();
|
|
81
|
-
this.options = initOptions();
|
|
82
|
-
/**
|
|
83
|
-
* search = commands are filtered by input value
|
|
84
|
-
* input = commands are not filtered, input is used to enter custom value
|
|
85
|
-
* none = no input, only command list is shown
|
|
86
|
-
*/
|
|
87
|
-
this.mode = 'search';
|
|
88
|
-
this.sectionPosition = 'right';
|
|
89
|
-
this.placeholder = '';
|
|
90
|
-
this.showGroups = false;
|
|
91
|
-
this.model = new Commands();
|
|
92
|
-
this.sections = [{ id: 'default' }];
|
|
93
|
-
this.activeSectionIndex = 0;
|
|
94
|
-
this.noResults = false;
|
|
95
|
-
this._onKeyDown = (e) => {
|
|
96
|
-
if (e.key != 'Escape')
|
|
97
|
-
e.stopPropagation();
|
|
98
|
-
switch (e.key) {
|
|
99
|
-
case 'ArrowDown':
|
|
100
|
-
e.preventDefault();
|
|
101
|
-
this.list.moveDown();
|
|
102
|
-
break;
|
|
103
|
-
case 'ArrowUp':
|
|
104
|
-
e.preventDefault();
|
|
105
|
-
this.list.moveUp();
|
|
106
|
-
break;
|
|
107
|
-
case 'Enter':
|
|
108
|
-
e.preventDefault();
|
|
109
|
-
if (this.visibleItems[this.list.selectedIndex] instanceof CommandGroup)
|
|
110
|
-
this.toggleGroup(this.visibleItems[this.list.selectedIndex].id);
|
|
111
|
-
else
|
|
112
|
-
this.exec();
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
this._debounceInput = debounce(() => {
|
|
117
|
-
if (this.mode == 'search') {
|
|
118
|
-
const input = this.parsedInput;
|
|
119
|
-
if (input.section > -1) {
|
|
120
|
-
this.activeSectionIndex = input.section;
|
|
121
|
-
this.input.value = '';
|
|
122
|
-
this.updateCommands(true);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
this.updateCommands();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else if (this.mode == 'none') { // online highlight first match
|
|
129
|
-
const input = this.parsedInput;
|
|
130
|
-
const commands = this.model.filter(input.value, false);
|
|
131
|
-
if (commands.length > 0) {
|
|
132
|
-
const index = this.visibleItems.findIndex(item => item instanceof Command && item.id === commands[0].id);
|
|
133
|
-
if (index > -1) {
|
|
134
|
-
this.list.selectedIndex = index;
|
|
135
|
-
this.list.renderItems(true);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, this.options.inputDelay);
|
|
140
|
-
this._onInput = (e) => {
|
|
141
|
-
e.stopPropagation();
|
|
142
|
-
this._debounceInput();
|
|
143
|
-
};
|
|
144
|
-
this._onSectionSelect = async (e) => {
|
|
145
|
-
if (this.activeSectionIndex == e.index)
|
|
146
|
-
return;
|
|
147
|
-
this.activeSectionIndex = e.index;
|
|
148
|
-
this.updateCommands(true);
|
|
149
|
-
this.focus();
|
|
150
|
-
};
|
|
151
|
-
this._onDropdownChange = async (_e) => {
|
|
152
|
-
this.activeSectionIndex = this.sections.findIndex(s => s.id === this.dropdown.value);
|
|
153
|
-
this.updateCommands(true);
|
|
154
|
-
this.focus();
|
|
155
|
-
};
|
|
156
|
-
this._onSelect = (e) => {
|
|
157
|
-
const item = this.visibleItems[e.index];
|
|
158
|
-
if (item instanceof Command) {
|
|
159
|
-
if (this.mode == 'search')
|
|
160
|
-
this.input.value = item.name;
|
|
161
|
-
if (e.trigger == ListSelectTrigger.Click || e.trigger == ListSelectTrigger.Enter) {
|
|
162
|
-
this.exec();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
this.input.value = '';
|
|
167
|
-
if (e.trigger == ListSelectTrigger.Click || e.trigger == ListSelectTrigger.Enter) {
|
|
168
|
-
this.toggleGroup(item.id);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
setTimeout(() => this.input.focus());
|
|
172
|
-
};
|
|
173
|
-
this._itemRenderer = (div, index, opts) => {
|
|
174
|
-
return this.visibleItems[index] instanceof CommandGroup
|
|
175
|
-
? this.groupRenderer(div, this.visibleItems[index], opts)
|
|
176
|
-
: this.commandRenderer(div, this.visibleItems[index], opts);
|
|
177
|
-
};
|
|
178
|
-
this.renderTabs = () => this.sections?.length > 1 ? html `
|
|
179
|
-
<og-container
|
|
180
|
-
.horizontalSliderPosition="${this.sectionPosition == 'top' ? 'bottom' : 'top'}"
|
|
181
|
-
scrollMode="horizontal"
|
|
182
|
-
sliderSize="4">
|
|
183
|
-
<og-tabs
|
|
184
|
-
slot="content"
|
|
185
|
-
class="tabs"
|
|
186
|
-
tabSize="stretch"
|
|
187
|
-
tabAlign="center"
|
|
188
|
-
style="${styleMap({ borderTop: this.sectionPosition == 'bottom' ? '1px solid var(--og-border)' : '' })}"
|
|
189
|
-
@tab.select="${this._onSectionSelect}"
|
|
190
|
-
.position="${this.sectionPosition == 'top' ? 'top' : 'bottom'}"
|
|
191
|
-
.selectedIndex="${this.activeSectionIndex}"
|
|
192
|
-
.items="${this.sections.map(section => ({ ...section, title: this.getSectionTitle(section) }))}">
|
|
193
|
-
</og-tabs>
|
|
194
|
-
</og-container>
|
|
195
|
-
` : '';
|
|
196
|
-
this.renderDropdown = () => this.sections?.length > 1 ? html `
|
|
197
|
-
<og-dropdown-list
|
|
198
|
-
color="transparent"
|
|
199
|
-
.value="${this.activeSection?.id}"
|
|
200
|
-
@change="${this._onDropdownChange}"
|
|
201
|
-
.items="${this.sections.map(section => ({
|
|
202
|
-
k: section.id,
|
|
203
|
-
v: this.getSectionTitle(section),
|
|
204
|
-
icon: section.icon
|
|
205
|
-
}))}">
|
|
206
|
-
</og-dropdown-list>
|
|
207
|
-
` : '';
|
|
208
|
-
this.renderSwitches = () => this.activeSection?.switches?.length > 0 ? html `
|
|
209
|
-
<div class="switches">
|
|
210
|
-
${this.activeSection.switches.map((s) => html `
|
|
211
|
-
<og-button
|
|
212
|
-
type="toggle"
|
|
213
|
-
.text="${s.value}"
|
|
214
|
-
.state="${s.checked ? 'checked' : 'unchecked'}"
|
|
215
|
-
@click="${(e) => {
|
|
216
|
-
s.checked = e.target.state === 'checked';
|
|
217
|
-
this.focus();
|
|
218
|
-
this.updateCommands();
|
|
219
|
-
}}">
|
|
220
|
-
</og-button>
|
|
221
|
-
`)}
|
|
222
|
-
</div>
|
|
223
|
-
` : '';
|
|
224
|
-
this.render = () => html `
|
|
225
|
-
<div class="input">
|
|
226
|
-
${this.sectionPosition == 'left' ? this.renderDropdown() : ''}
|
|
227
|
-
|
|
228
|
-
<input
|
|
229
|
-
type="text"
|
|
230
|
-
@input="${this._onInput}"
|
|
231
|
-
.placeholder="${this.placeholder}"
|
|
232
|
-
.value="${this.value ?? ''}">
|
|
233
|
-
|
|
234
|
-
${this.sectionPosition == 'right' ? this.renderDropdown() : ''}
|
|
235
|
-
</div>
|
|
236
|
-
|
|
237
|
-
${this.sectionPosition != 'bottom' ? this.renderSwitches() : ''}
|
|
238
|
-
|
|
239
|
-
${this.text != null ? html `<div class="text">${this.text}</div>` : ''}
|
|
240
|
-
|
|
241
|
-
${this.sectionPosition == 'top' ? this.renderTabs() : ''}
|
|
242
|
-
|
|
243
|
-
${this.noResults ? html `
|
|
244
|
-
<div class="no-results">${msg('No results found')}</div>
|
|
245
|
-
` : ''}
|
|
246
|
-
|
|
247
|
-
<div class="list">
|
|
248
|
-
<og-list
|
|
249
|
-
animations
|
|
250
|
-
arrowEvents
|
|
251
|
-
maxHeight="300"
|
|
252
|
-
?dynamicItemHeight="${this.options?.commandRenderer != null}"
|
|
253
|
-
.customStyle="${[this.options?.itemStyle, itemStyle]}"
|
|
254
|
-
.lineHeight="${this.options.itemHeight - 2}"
|
|
255
|
-
.itemHeight="${this.options.itemHeight}"
|
|
256
|
-
.itemRenderer="${this._itemRenderer}"
|
|
257
|
-
@select="${this._onSelect}"
|
|
258
|
-
@render="${() => this.layout()}">
|
|
259
|
-
</og-list>
|
|
260
|
-
</div>
|
|
261
|
-
|
|
262
|
-
${this.sectionPosition == 'bottom' ? this.renderSwitches() : ''}
|
|
263
|
-
|
|
264
|
-
${this.sectionPosition == 'bottom' ? this.renderTabs() : ''}
|
|
265
|
-
`;
|
|
266
|
-
this.addEventListener('click', e => e.stopPropagation());
|
|
267
|
-
this.addEventListener('keydown', this._onKeyDown);
|
|
268
|
-
}
|
|
269
|
-
connectedCallback() {
|
|
270
|
-
super.connectedCallback();
|
|
271
|
-
this.tabIndex = 0;
|
|
272
|
-
}
|
|
273
|
-
focus() {
|
|
274
|
-
this.input?.focus();
|
|
275
|
-
}
|
|
276
|
-
clearFilter(updateCommands = true) {
|
|
277
|
-
this.input.value = '';
|
|
278
|
-
this.focus();
|
|
279
|
-
if (updateCommands)
|
|
280
|
-
this.updateCommands();
|
|
281
|
-
}
|
|
282
|
-
async willUpdate(props) {
|
|
283
|
-
if (props.has('adapter') && this.adapter) {
|
|
284
|
-
this.adapter.attach(this);
|
|
285
|
-
const sections = await this.adapter.getSections();
|
|
286
|
-
const options = await this.adapter.getOptions(sections?.length ? sections[0].id : null);
|
|
287
|
-
this.sections = sections;
|
|
288
|
-
if (options)
|
|
289
|
-
this.options = initOptions(options);
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
if (props.has('commands') && this.commands) {
|
|
293
|
-
this.model.clear();
|
|
294
|
-
this.commands.forEach(c => this.model.register(c));
|
|
295
|
-
}
|
|
296
|
-
if (props.has('options')) {
|
|
297
|
-
this.options = initOptions(this.options);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
async updated(props) {
|
|
302
|
-
if (['commands', 'adapter', 'model', 'activeSectionIndex'].some(p => props.has(p))) {
|
|
303
|
-
await this.updateCommands(true);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
async updateCommands(updateOptions = false) {
|
|
307
|
-
if (this.adapter) {
|
|
308
|
-
this.model.clear();
|
|
309
|
-
const switches = this.activeSection?.switches?.filter(s => s.checked).map(s => s.key) || [];
|
|
310
|
-
if (updateOptions) {
|
|
311
|
-
const options = await this.adapter.getOptions(this.activeSection?.id);
|
|
312
|
-
this.options = initOptions(options);
|
|
313
|
-
}
|
|
314
|
-
const [groups, commands] = (await Promise.all([this.adapter.getGroups({
|
|
315
|
-
sectionId: this.activeSection?.id,
|
|
316
|
-
filter: this.filterValue,
|
|
317
|
-
switches
|
|
318
|
-
}), this.adapter.getCommands({
|
|
319
|
-
sectionId: this.activeSection?.id,
|
|
320
|
-
filter: this.filterValue,
|
|
321
|
-
switches
|
|
322
|
-
})]));
|
|
323
|
-
groups?.forEach(group => this.model.registerGroup(group));
|
|
324
|
-
commands?.forEach(command => this.model.register(command));
|
|
325
|
-
this.visibleItems = this.model.filter(null, this.showGroups, true);
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
this.visibleItems = this.model.filter(this.filterValue, this.showGroups);
|
|
329
|
-
}
|
|
330
|
-
this.placeholder = this.activeSection?.placeholder || '';
|
|
331
|
-
this.list.reset();
|
|
332
|
-
this.list.size = this.visibleItems.length;
|
|
333
|
-
this.list.selectedIndex = this.visibleItems.findIndex(item => item instanceof Command) ?? 0;
|
|
334
|
-
this.list.renderItems(true);
|
|
335
|
-
this.noResults = this.visibleItems.length == 0;
|
|
336
|
-
}
|
|
337
|
-
async toggleGroup(groupId) {
|
|
338
|
-
const group = this.model.groups.get(groupId);
|
|
339
|
-
this.list.reset();
|
|
340
|
-
if (group.open) {
|
|
341
|
-
group.open = false;
|
|
342
|
-
this.visibleItems = this.model.filter(this.filterValue, this.showGroups, true);
|
|
343
|
-
this.list.size = this.visibleItems.length;
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
group.open = true;
|
|
347
|
-
if (this.adapter) {
|
|
348
|
-
const commands = (await Promise.all([this.adapter.getCommands({
|
|
349
|
-
sectionId: this.activeSection?.id,
|
|
350
|
-
groupId,
|
|
351
|
-
filter: this.filterValue
|
|
352
|
-
})]))[0];
|
|
353
|
-
if (commands.length > 0) {
|
|
354
|
-
group.commands.clear();
|
|
355
|
-
commands.forEach(c => {
|
|
356
|
-
if (!c.group || c.group == groupId)
|
|
357
|
-
group.addCommand(c);
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
this.visibleItems = this.model.filter(null, this.showGroups, true);
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
this.visibleItems = this.model.filter(this.filterValue, this.showGroups, true);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
this.list.size = this.visibleItems.length;
|
|
367
|
-
}
|
|
368
|
-
getSectionTitle(section) {
|
|
369
|
-
return (section.title ?? section.id) + (section.triggerCommand ? ` (${section.triggerCommand})` : '');
|
|
370
|
-
}
|
|
371
|
-
layout() {
|
|
372
|
-
if (!this.listWrapper)
|
|
373
|
-
return;
|
|
374
|
-
this.listWrapper.style.transition = `flex-basis 0.2s ease-in-out`;
|
|
375
|
-
this.listWrapper.style.flexBasis = dom.px(this.list.offsetHeight);
|
|
376
|
-
dom.setSize(this.listWrapper, { h: this.list.offsetHeight });
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
CommandWindow.styles = [style];
|
|
380
|
-
__decorate([
|
|
381
|
-
property({ type: Object })
|
|
382
|
-
], CommandWindow.prototype, "options", void 0);
|
|
383
|
-
__decorate([
|
|
384
|
-
property({ type: String })
|
|
385
|
-
], CommandWindow.prototype, "mode", void 0);
|
|
386
|
-
__decorate([
|
|
387
|
-
property({ type: String })
|
|
388
|
-
], CommandWindow.prototype, "value", void 0);
|
|
389
|
-
__decorate([
|
|
390
|
-
property({ type: String, reflect: true })
|
|
391
|
-
], CommandWindow.prototype, "sectionPosition", void 0);
|
|
392
|
-
__decorate([
|
|
393
|
-
property({ type: String })
|
|
394
|
-
], CommandWindow.prototype, "text", void 0);
|
|
395
|
-
__decorate([
|
|
396
|
-
property({ type: Array })
|
|
397
|
-
], CommandWindow.prototype, "commands", void 0);
|
|
398
|
-
__decorate([
|
|
399
|
-
property({ type: Object })
|
|
400
|
-
], CommandWindow.prototype, "adapter", void 0);
|
|
401
|
-
__decorate([
|
|
402
|
-
property({ type: Object })
|
|
403
|
-
], CommandWindow.prototype, "target", void 0);
|
|
404
|
-
__decorate([
|
|
405
|
-
property({ type: String })
|
|
406
|
-
], CommandWindow.prototype, "placeholder", void 0);
|
|
407
|
-
__decorate([
|
|
408
|
-
property({ type: Boolean })
|
|
409
|
-
], CommandWindow.prototype, "showGroups", void 0);
|
|
410
|
-
__decorate([
|
|
411
|
-
property({ type: Object })
|
|
412
|
-
], CommandWindow.prototype, "model", void 0);
|
|
413
|
-
__decorate([
|
|
414
|
-
state()
|
|
415
|
-
], CommandWindow.prototype, "sections", void 0);
|
|
416
|
-
__decorate([
|
|
417
|
-
state()
|
|
418
|
-
], CommandWindow.prototype, "activeSectionIndex", void 0);
|
|
419
|
-
__decorate([
|
|
420
|
-
state()
|
|
421
|
-
], CommandWindow.prototype, "noResults", void 0);
|
|
422
|
-
__decorate([
|
|
423
|
-
query('.list')
|
|
424
|
-
], CommandWindow.prototype, "listWrapper", void 0);
|
|
425
|
-
__decorate([
|
|
426
|
-
query('og-list')
|
|
427
|
-
], CommandWindow.prototype, "list", void 0);
|
|
428
|
-
__decorate([
|
|
429
|
-
query('input')
|
|
430
|
-
], CommandWindow.prototype, "input", void 0);
|
|
431
|
-
__decorate([
|
|
432
|
-
query('og-dropdown-list')
|
|
433
|
-
], CommandWindow.prototype, "dropdown", void 0);
|
|
434
|
-
CommandWindow = __decorate([
|
|
435
|
-
customElement('og-commands')
|
|
436
|
-
], CommandWindow);
|
|
437
|
-
export { CommandWindow };
|
|
438
|
-
//# sourceMappingURL=commandWindow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandWindow.js","sourceRoot":"","sources":["../../src/ui/commandWindow.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAmB,WAAW,EAA8B,MAAM,UAAU,CAAC;AAErH,OAAO,EAAU,GAAG,EAA0F,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzJ,OAAO,EAAE,UAAU,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,OAAO,YAAa,SAAQ,KAAK;IAMtC,YAAY,IAAY,EAAE,IAA4B;QACrD,KAAK,CAAC,WAAW,IAAI,EAAE,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;QACzD,IAAI,IAAI;YAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;CACD;AAKD,MAAM,wBAAwB,GAAoB,CAAC,IAAoB,EAAE,OAAgB,EAAE,EAAE;IAC5F,OAAO,IAAI,CAAA,wBAAwB,OAAO,CAAC,IAAI,QAAQ,CAAC;AACzD,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAkB,CAAC,IAAoB,EAAE,KAAmB,EAAE,EAAE;IAC3F,OAAO,IAAI,C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E,KAAK,EAAC,CAAC;+CACE;AAG1B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;8CACA;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACL;AAGpB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACR;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDACR;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;4CACF;AAGvB;IADC,KAAK,EAAE;+CACwC;AAGhD;IADC,KAAK,EAAE;yDACe;AAGvB;IADC,KAAK,EAAE;gDACU;AAGlB;IADC,KAAK,CAAC,OAAO,CAAC;kDACa;AAG5B;IADC,KAAK,CAAC,SAAS,CAAC;2CACN;AAGX;IADC,KAAK,CAAC,OAAO,CAAC;4CACS;AAGxB;IADC,KAAK,CAAC,kBAAkB,CAAC;+CACH;AA/DX,aAAa;IADzB,aAAa,CAAC,aAAa,CAAC;GAChB,aAAa,CA6ZzB","sourcesContent":["import { Commands, Command, CommandGroup, CommandsSection, initOptions, CommandMode, CommandSource } from \"../model\";\nimport { CommandsAdapter} from \"../adapters\";\nimport { Button, dom, DropdownList, events, List, ListItemRenderer, ListItemRendererOptions, ListSelectEvent, ListSelectTrigger } from \"@omegagrid/core\";\nimport { LitElement, html, TemplateResult, PropertyValues } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { debounce } from \"ts-debounce\";\nimport { style, itemStyle } from \"./commandWindow.style\";\nimport { styleMap } from \"lit-html/directives/style-map.js\";\nimport { TabEvent } from \"@omegagrid/tabs\";\nimport { msg } from \"@omegagrid/localize\";\n\nexport class CommandEvent extends Event {\n\n\treadonly command?: Command;\n\treadonly value?: string;\n\treadonly section?: CommandsSection;\n\n\tconstructor(type: string, args?: Partial<CommandEvent>) {\n\t\tsuper(`command.${type}`, {bubbles: true, composed: true})\n\t\tif (args) Object.assign(this, args);\n\t}\n}\n\nexport type CommandRenderer = (div: HTMLDivElement, command: Command, opts?: ListItemRendererOptions) => string | void | TemplateResult<1> | null;\nexport type GroupRenderer = (div: HTMLDivElement, group: CommandGroup, opts?: ListItemRendererOptions) => string | void | TemplateResult<1> | null;\n\nconst DEFAULT_COMMAND_RENDERER: CommandRenderer = (_div: HTMLDivElement, command: Command) => {\n\treturn html`<div class=\"command\">${command.name}</div>`;\n};\n\nconst DEFAULT_GROUP_RENDERER: GroupRenderer = (_div: HTMLDivElement, group: CommandGroup) => {\n\treturn html`\n\t\t<div class=\"group\" @mousedown=\"${(e: MouseEvent) => e.preventDefault()}\">\n\t\t\t<div class=\"group-toggle\">\n\t\t\t\t<og-icon icon=\"angle-${group.open ? 'down' : 'right'}\"></og-icon>\n\t\t\t</div>\n\t\t\t\n\t\t\t<div class=\"group-text\">\n\t\t\t\t${group.name}\n\t\t\t</div>\n\t\t</div>\n\t`;\n};\n\n@customElement('og-commands')\nexport class CommandWindow extends LitElement {\n\n\tstatic styles = [style];\n\n\tprivate visibleItems: (Command|CommandGroup)[];\n\n\t@property({type: Object})\n\toptions = initOptions();\n\n\t/**\n\t * search = commands are filtered by input value\n\t * input = commands are not filtered, input is used to enter custom value\n\t * none = no input, only command list is shown\n\t */\n\t@property({type: String})\n\tmode: CommandMode = 'search';\n\n\t@property({type: String})\n\tvalue: string;\n\n\t@property({type: String, reflect: true})\n\tsectionPosition: 'top'|'bottom'|'left'|'right' = 'right';\n\n\t@property({type: String})\n\ttext: string;\n\n\t@property({type: Array})\n\tcommands: CommandSource[];\n\t\n\t@property({type: Object})\n\tadapter: CommandsAdapter;\n\n\t@property({type: Object})\n\ttarget: HTMLElement;\n\n\t@property({type: String})\n\tplaceholder = '';\n\t\n\t@property({type: Boolean})\n\tshowGroups = false\n\n\t@property({type: Object})\n\tmodel = new Commands();\n\n\t@state()\n\tsections: CommandsSection[] = [{id: 'default'}];\n\n\t@state()\n\tactiveSectionIndex = 0;\n\n\t@state()\n\tnoResults = false;\n\n\t@query('.list')\n\tlistWrapper: HTMLDivElement;\n\n\t@query('og-list')\n\tlist: List;\n\n\t@query('input')\n\tinput: HTMLInputElement;\n\n\t@query('og-dropdown-list')\n\tdropdown: DropdownList;\n\n\tget activeSection() { return this.sections?.[this.activeSectionIndex] }\n\n\tget inputValue() { return this.input?.value ?? '' }\n\tget parsedInput() {\n\t\tconst input = this.inputValue;\n\t\tconst chunks = input.split(' ', 2);\n\t\tif (chunks.length > 1) {\n\t\t\tconst section = (this.sections ?? []).findIndex(s => s?.triggerCommand == chunks[0]);\n\t\t\tconst value = section > -1 ? chunks[1] ?? '' : input;\n\t\t\treturn { section, value };\n\t\t} else {\n\t\t\treturn { section: -1, value: input};\n\t\t}\n\t}\n\n\tget filterValue() {\n\t\treturn this.mode == 'search' ? this.parsedInput?.value ?? '' : '';\n\t}\n\n\tget commandRenderer(): CommandRenderer {\n\t\treturn this.options?.commandRenderer || DEFAULT_COMMAND_RENDERER;\n\t}\n\n\tget groupRenderer(): GroupRenderer {\n\t\treturn this.options?.groupRenderer || DEFAULT_GROUP_RENDERER;\n\t}\n\n\tasync exec(dispatchEvent = true) {\n\t\tconst input = this.parsedInput;\n\t\tconst command = this.visibleItems[this.list.selectedIndex];\n\n\t\tif (!(command instanceof Command)) return;\n\t\t\n\t\tthis.clearFilter(false);\n\t\t\n\t\tcommand.exec(input.value);\n\t\tif (this.adapter) {\n\t\t\tthis.adapter.exec(command, input.value);\n\t\t}\n\t\t\n\t\tif (dispatchEvent) this.dispatchEvent(new CommandEvent('exec', { \n\t\t\tcommand: command,\n\t\t\tsection: this.sections.find(s => s.id === input.section),\n\t\t\tvalue: input.value\n\t\t}));\n\t}\n\n\t_onKeyDown = (e: KeyboardEvent) => {\n\t\tif (e.key != 'Escape') e.stopPropagation();\n\n\t\tswitch (e.key) {\n\t\t\tcase 'ArrowDown':\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.list.moveDown();\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.list.moveUp();\n\t\t\t\tbreak;\n\t\t\tcase 'Enter':\n\t\t\t\te.preventDefault();\n\t\t\t\tif (this.visibleItems[this.list.selectedIndex] instanceof CommandGroup) \n\t\t\t\t\tthis.toggleGroup((this.visibleItems[this.list.selectedIndex] as CommandGroup).id);\n\t\t\t\telse this.exec();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t_debounceInput = debounce(() => {\n\t\tif (this.mode == 'search') {\n\t\t\tconst input = this.parsedInput;\n\t\t\tif (input.section > -1) {\n\t\t\t\tthis.activeSectionIndex = input.section;\n\t\t\t\tthis.input.value = '';\n\t\t\t\tthis.updateCommands(true);\n\t\t\t} else {\n\t\t\t\tthis.updateCommands();\n\t\t\t}\n\t\t} else if (this.mode == 'none') { // online highlight first match\n\t\t\tconst input = this.parsedInput;\n\t\t\tconst commands = this.model.filter(input.value, false) as Command[];\n\t\t\tif (commands.length > 0) {\n\t\t\t\tconst index = this.visibleItems.findIndex(item => item instanceof Command && item.id === commands[0].id);\n\t\t\t\tif (index > -1) {\n\t\t\t\t\tthis.list.selectedIndex = index;\n\t\t\t\t\tthis.list.renderItems(true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, this.options.inputDelay);\n\n\t_onInput = (e: InputEvent) => {\n\t\te.stopPropagation();\n\t\tthis._debounceInput();\n\t}\n\n\t_onSectionSelect = async (e: TabEvent) => {\n\t\tif (this.activeSectionIndex == e.index) return;\n\t\tthis.activeSectionIndex = e.index;\n\t\tthis.updateCommands(true);\n\t\tthis.focus();\n\t}\n\n\t_onDropdownChange = async (_e: events.ChangeEvent) => {\n\t\tthis.activeSectionIndex = this.sections.findIndex(s => s.id === this.dropdown.value);\n\t\tthis.updateCommands(true);\n\t\tthis.focus();\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.addEventListener('click', e => e.stopPropagation());\n\t\tthis.addEventListener('keydown', this._onKeyDown);\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis.tabIndex = 0;\n\t}\n\n\tfocus() {\n\t\tthis.input?.focus();\n\t}\n\n\tclearFilter(updateCommands = true) {\n\t\tthis.input.value = '';\n\t\tthis.focus();\n\t\tif (updateCommands) this.updateCommands();\n\t}\n\n\tasync willUpdate(props: PropertyValues) {\n\t\tif (props.has('adapter') && this.adapter) {\n\t\t\tthis.adapter.attach(this);\n\t\t\tconst sections = await this.adapter.getSections();\n\t\t\tconst options = await this.adapter.getOptions(sections?.length ? sections[0].id : null);\n\t\t\tthis.sections = sections;\n\t\t\tif (options) this.options = initOptions(options);\n\t\t} else {\n\t\t\tif (props.has('commands') && this.commands) {\n\t\t\t\tthis.model.clear();\n\t\t\t\tthis.commands.forEach(c => this.model.register(c));\n\t\t\t}\n\n\t\t\tif (props.has('options')) {\n\t\t\t\tthis.options = initOptions(this.options);\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updated(props: Map<PropertyKey, unknown>) {\n\t\tif (['commands', 'adapter', 'model', 'activeSectionIndex'].some(p => props.has(p))) {\n\t\t\tawait this.updateCommands(true);\n\t\t}\n\t}\n\n\t_onSelect = (e: ListSelectEvent) => {\n\t\tconst item = this.visibleItems[e.index];\n\t\tif (item instanceof Command) {\n\t\t\tif (this.mode == 'search') this.input.value = item.name;\t\t\t\n\t\t\tif (e.trigger == ListSelectTrigger.Click || e.trigger == ListSelectTrigger.Enter) {\n\t\t\t\tthis.exec();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.input.value = '';\n\t\t\tif (e.trigger == ListSelectTrigger.Click || e.trigger == ListSelectTrigger.Enter) {\n\t\t\t\tthis.toggleGroup((item as CommandGroup).id);\n\t\t\t}\n\t\t}\n\n\t\tsetTimeout(() => this.input.focus());\n\t}\n\n\t_itemRenderer: ListItemRenderer = (div: HTMLDivElement, index: number, opts?: ListItemRendererOptions) => {\n\t\treturn this.visibleItems[index] instanceof CommandGroup\n\t\t\t? this.groupRenderer(div, this.visibleItems[index] as CommandGroup, opts)\n\t\t\t: this.commandRenderer(div, this.visibleItems[index] as Command, opts);\n\t}\n\n\tasync updateCommands(updateOptions = false) {\n\t\tif (this.adapter) {\n\t\t\tthis.model.clear();\n\t\t\tconst switches = this.activeSection?.switches?.filter(s => s.checked).map(s => s.key) || [];\n\n\t\t\tif (updateOptions) {\n\t\t\t\tconst options = await this.adapter.getOptions(this.activeSection?.id);\n\t\t\t\tthis.options = initOptions(options);\n\t\t\t}\n\n\t\t\tconst [groups, commands] = (await Promise.all([this.adapter.getGroups({\n\t\t\t\tsectionId: this.activeSection?.id,\n\t\t\t\tfilter: this.filterValue,\n\t\t\t\tswitches\n\t\t\t}), this.adapter.getCommands({\n\t\t\t\tsectionId: this.activeSection?.id,\n\t\t\t\tfilter: this.filterValue,\n\t\t\t\tswitches\n\t\t\t})]));\n\t\t\tgroups?.forEach(group => this.model.registerGroup(group));\n\t\t\tcommands?.forEach(command => this.model.register(command));\n\t\t\tthis.visibleItems = this.model.filter(null, this.showGroups, true);\n\t\t} else {\n\t\t\tthis.visibleItems = this.model.filter(this.filterValue, this.showGroups);\n\t\t}\n\n\t\tthis.placeholder = this.activeSection?.placeholder || '';\n\t\tthis.list.reset();\n\t\tthis.list.size = this.visibleItems.length;\n\t\tthis.list.selectedIndex = this.visibleItems.findIndex(item => item instanceof Command) ?? 0;\n\t\tthis.list.renderItems(true);\n\t\tthis.noResults = this.visibleItems.length == 0;\n\t}\n\n\tasync toggleGroup(groupId: string) {\n\t\tconst group = this.model.groups.get(groupId);\n\t\tthis.list.reset();\n\t\t\n\t\tif (group.open) {\n\t\t\tgroup.open = false;\n\t\t\tthis.visibleItems = this.model.filter(this.filterValue, this.showGroups, true);\n\t\t\tthis.list.size = this.visibleItems.length;\n\t\t} else {\n\t\t\tgroup.open = true;\n\t\t\tif (this.adapter) {\n\t\t\t\tconst commands = (await Promise.all([this.adapter.getCommands({\n\t\t\t\t\tsectionId: this.activeSection?.id,\n\t\t\t\t\tgroupId, \n\t\t\t\t\tfilter: this.filterValue\n\t\t\t\t})]))[0];\n\n\t\t\t\tif (commands.length > 0) {\n\t\t\t\t\tgroup.commands.clear();\n\t\t\t\t\tcommands.forEach(c => {\n\t\t\t\t\t\tif (!c.group || c.group == groupId) group.addCommand(c);\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tthis.visibleItems = this.model.filter(null, this.showGroups, true);\n\t\t\t} else {\n\t\t\t\tthis.visibleItems = this.model.filter(this.filterValue, this.showGroups, true);\n\t\t\t}\n\t\t}\n\t\tthis.list.size = this.visibleItems.length;\n\t}\n\n\tprivate getSectionTitle(section: CommandsSection) {\n\t\treturn (section.title ?? section.id) + (section.triggerCommand ? ` (${section.triggerCommand})` : '');\n\t}\n\n\tlayout() {\n\t\tif (!this.listWrapper) return;\n\n\t\tthis.listWrapper.style.transition = `flex-basis 0.2s ease-in-out`;\n\t\tthis.listWrapper.style.flexBasis = dom.px(this.list.offsetHeight);\n\t\tdom.setSize(this.listWrapper, {h: this.list.offsetHeight});\n\t}\n\n\trenderTabs = () => this.sections?.length > 1 ? html`\n\t\t<og-container \n\t\t\t.horizontalSliderPosition=\"${this.sectionPosition == 'top' ? 'bottom' : 'top'}\"\n\t\t\tscrollMode=\"horizontal\" \n\t\t\tsliderSize=\"4\">\n\t\t\t<og-tabs\n\t\t\t\tslot=\"content\"\n\t\t\t\tclass=\"tabs\"\n\t\t\t\ttabSize=\"stretch\"\n\t\t\t\ttabAlign=\"center\"\n\t\t\t\tstyle=\"${styleMap({borderTop: this.sectionPosition == 'bottom' ? '1px solid var(--og-border)' : ''})}\"\n\t\t\t\t@tab.select=\"${this._onSectionSelect}\"\n\t\t\t\t.position=\"${this.sectionPosition == 'top' ? 'top' : 'bottom'}\"\n\t\t\t\t.selectedIndex=\"${this.activeSectionIndex}\"\n\t\t\t\t.items=\"${this.sections.map(section => ({...section, title: this.getSectionTitle(section)}))}\">\n\t\t\t</og-tabs>\n\t\t</og-container>\n\t` : ''\n\n\trenderDropdown = () => this.sections?.length > 1 ? html`\n\t\t<og-dropdown-list \n\t\t\tcolor=\"transparent\"\n\t\t\t.value=\"${this.activeSection?.id}\"\n\t\t\t@change=\"${this._onDropdownChange}\"\n\t\t\t.items=\"${this.sections.map(section => ({\n\t\t\t\tk: section.id as string,\n\t\t\t\tv: this.getSectionTitle(section),\n\t\t\t\ticon: section.icon\n\t\t\t}))}\">\n\t\t</og-dropdown-list>\n\t` : '';\n\n\trenderSwitches = () => this.activeSection?.switches?.length > 0 ? html`\n\t\t<div class=\"switches\">\n\t\t\t${this.activeSection.switches.map((s) => html`\n\t\t\t\t<og-button \n\t\t\t\t\ttype=\"toggle\"\n\t\t\t\t\t.text=\"${s.value}\"\n\t\t\t\t\t.state=\"${s.checked ? 'checked' : 'unchecked'}\"\n\t\t\t\t\t@click=\"${(e: PointerEvent) => {\n\t\t\t\t\t\ts.checked = (e.target as Button).state === 'checked';\n\t\t\t\t\t\tthis.focus();\n\t\t\t\t\t\tthis.updateCommands();\n\t\t\t\t\t}}\">\n\t\t\t\t</og-button>\n\t\t\t`)}\n\t\t</div>\n\t` : '';\n\n\trender = () => html`\n\t\t<div class=\"input\">\n\t\t\t${this.sectionPosition == 'left' ? this.renderDropdown() : ''}\n\t\t\t\n\t\t\t<input\n\t\t\t\ttype=\"text\"\n\t\t\t\t@input=\"${this._onInput}\"\n\t\t\t\t.placeholder=\"${this.placeholder}\"\n\t\t\t\t.value=\"${this.value ?? ''}\">\n\n\t\t\t${this.sectionPosition == 'right' ? this.renderDropdown() : ''}\n\t\t</div>\n\n\t\t${this.sectionPosition != 'bottom' ? this.renderSwitches() : ''}\n\n\t\t${this.text != null ? html`<div class=\"text\">${this.text}</div>` : ''}\n\n\t\t${this.sectionPosition == 'top' ? this.renderTabs() : ''}\n\n\t\t${this.noResults ? html`\n\t\t\t<div class=\"no-results\">${msg('No results found')}</div>\n\t\t` : ''}\n\n\t\t<div class=\"list\">\n\t\t\t<og-list\n\t\t\t\tanimations\n\t\t\t\tarrowEvents\n\t\t\t\tmaxHeight=\"300\"\n\t\t\t\t?dynamicItemHeight=\"${this.options?.commandRenderer != null}\"\n\t\t\t\t.customStyle=\"${[this.options?.itemStyle, itemStyle]}\"\n\t\t\t\t.lineHeight=\"${this.options.itemHeight - 2}\"\n\t\t\t\t.itemHeight=\"${this.options.itemHeight}\"\n\t\t\t\t.itemRenderer=\"${this._itemRenderer}\"\n\t\t\t\t@select=\"${this._onSelect}\"\n\t\t\t\t@render=\"${() => this.layout()}\">\n\t\t\t</og-list>\n\t\t</div>\n\n\t\t${this.sectionPosition == 'bottom' ? this.renderSwitches() : ''}\n\n\t\t${this.sectionPosition == 'bottom' ? this.renderTabs() : ''}\n\t`;\n\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandWindow.style.d.ts","sourceRoot":"","sources":["../../src/ui/commandWindow.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,yBA0GjB,CAAC;AAEF,eAAO,MAAM,SAAS,yBAqCrB,CAAC"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
import constants from '../constants';
|
|
3
|
-
export const style = css `
|
|
4
|
-
* {
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
:host {
|
|
9
|
-
background: var(--og-commands-background);
|
|
10
|
-
color: var(--og-commands-color);
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
box-shadow: 0px 0px 6px 1px var(--og-commands-shadow);
|
|
14
|
-
border: 1px solid var(--og-border);
|
|
15
|
-
border-radius: var(--og-base-radius);
|
|
16
|
-
font-family: var(--og-font-family);
|
|
17
|
-
font-size: var(--og-font-size);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.text {
|
|
21
|
-
padding: 4px 4px 8px 4px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.input {
|
|
25
|
-
width: 100%;
|
|
26
|
-
padding: 6px;
|
|
27
|
-
display: flex;
|
|
28
|
-
flex: 0 0 40px;
|
|
29
|
-
flex-direction: row;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:host([sectionposition="left"]) .input > input {
|
|
33
|
-
border-top-left-radius: 0;
|
|
34
|
-
border-bottom-left-radius: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
:host([sectionposition="right"]) .input > input {
|
|
38
|
-
border-top-right-radius: 0;
|
|
39
|
-
border-bottom-right-radius: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
:host([sectionposition="left"]) .input > og-dropdown-list {
|
|
43
|
-
border-right: none;
|
|
44
|
-
border-top-right-radius: 0;
|
|
45
|
-
border-bottom-right-radius: 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host([sectionposition="right"]) .input > og-dropdown-list {
|
|
49
|
-
border-left: none;
|
|
50
|
-
border-top-left-radius: 0;
|
|
51
|
-
border-bottom-left-radius: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.input > og-dropdown-list {
|
|
55
|
-
flex: 0 0 100px;
|
|
56
|
-
height: 100%;
|
|
57
|
-
border: 1px solid var(--og-accent-color);
|
|
58
|
-
padding-right: 5px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.input > input {
|
|
62
|
-
width: 100%;
|
|
63
|
-
font-size: 16px;
|
|
64
|
-
padding: 4px;
|
|
65
|
-
border: 1px solid var(--og-accent-color);
|
|
66
|
-
border-radius: var(--og-base-radius);
|
|
67
|
-
background-color: var(--og-commands-input-background);
|
|
68
|
-
color: var(--og-commands-color);
|
|
69
|
-
outline: none;
|
|
70
|
-
flex: 1;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.tabs {
|
|
74
|
-
flex: 0;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.list {
|
|
78
|
-
flex: 0;
|
|
79
|
-
position: relative;
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
og-container {
|
|
84
|
-
height: 30px;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
og-list {
|
|
88
|
-
height: 250px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.no-results {
|
|
92
|
-
padding: 0 10px 10px 10px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:host([sectionposition="bottom"]) .switches {
|
|
96
|
-
padding-top: 6px;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.switches {
|
|
100
|
-
padding: 0 6px 6px 6px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.switches og-button {
|
|
104
|
-
font-size: 0.8em;
|
|
105
|
-
height: 16px;
|
|
106
|
-
border: 1px solid var(--og-accent-color);
|
|
107
|
-
border-radius: 8px;
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
export const itemStyle = css `
|
|
111
|
-
.item {
|
|
112
|
-
border: 1px solid transparent;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.item.selected {
|
|
116
|
-
border: 1px solid var(--og-accent-color);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.item>div {
|
|
120
|
-
display: flex;
|
|
121
|
-
flex-direction: row;
|
|
122
|
-
|
|
123
|
-
height: 100%;
|
|
124
|
-
padding: 0 5px;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.item .group {
|
|
128
|
-
background-color: var(--og-commands-header-background);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.item .group-toggle {
|
|
132
|
-
width: 15px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.item .group-text {
|
|
136
|
-
line-height: ${constants.COMMAND_ITEM_HEIGHT - 2}px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.item .group og-icon {
|
|
140
|
-
line-height: ${constants.COMMAND_ITEM_HEIGHT - 2}px;
|
|
141
|
-
display: inline;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.item .command {
|
|
145
|
-
margin-left: 10px;
|
|
146
|
-
}
|
|
147
|
-
`;
|
|
148
|
-
//# sourceMappingURL=commandWindow.style.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandWindow.style.js","sourceRoot":"","sources":["../../src/ui/commandWindow.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GvB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BX,SAAS,CAAC,mBAAmB,GAAG,CAAC;;;;iBAIjC,SAAS,CAAC,mBAAmB,GAAG,CAAC;;;;;;;CAOjD,CAAC","sourcesContent":["import { css } from 'lit';\nimport constants from '../constants';\n\nexport const style = css`\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host {\n\t\tbackground: var(--og-commands-background);\n\t\tcolor: var(--og-commands-color);\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tbox-shadow: 0px 0px 6px 1px var(--og-commands-shadow);\n\t\tborder: 1px solid var(--og-border);\n\t\tborder-radius: var(--og-base-radius);\n\t\tfont-family: var(--og-font-family);\n\t\tfont-size: var(--og-font-size);\n\t}\n\n\t.text {\n\t\tpadding: 4px 4px 8px 4px;\n\t}\n\n\t.input {\n\t\twidth: 100%;\n\t\tpadding: 6px;\n\t\tdisplay: flex;\n\t\tflex: 0 0 40px;\n\t\tflex-direction: row;\n\t}\n\n\t:host([sectionposition=\"left\"]) .input > input {\n\t\tborder-top-left-radius: 0;\n\t\tborder-bottom-left-radius: 0;\n\t}\n\n\t:host([sectionposition=\"right\"]) .input > input {\n\t\tborder-top-right-radius: 0;\n\t\tborder-bottom-right-radius: 0;\n\t}\n\n\t:host([sectionposition=\"left\"]) .input > og-dropdown-list {\n\t\tborder-right: none;\n\t\tborder-top-right-radius: 0;\n\t\tborder-bottom-right-radius: 0;\n\t}\n\n\t:host([sectionposition=\"right\"]) .input > og-dropdown-list {\n\t\tborder-left: none;\n\t\tborder-top-left-radius: 0;\n\t\tborder-bottom-left-radius: 0;\n\t}\n\n\t.input > og-dropdown-list {\n\t\tflex: 0 0 100px;\n\t\theight: 100%;\n\t\tborder: 1px solid var(--og-accent-color);\n\t\tpadding-right: 5px;\n\t}\n\n\t.input > input {\n\t\twidth: 100%;\n\t\tfont-size: 16px;\n\t\tpadding: 4px;\n\t\tborder: 1px solid var(--og-accent-color);\n\t\tborder-radius: var(--og-base-radius);\n\t\tbackground-color: var(--og-commands-input-background);\n\t\tcolor: var(--og-commands-color);\n\t\toutline: none;\n\t\tflex: 1;\n\t}\n\n\t.tabs {\n\t\tflex: 0;\n\t}\n\n\t.list {\n\t\tflex: 0;\n\t\tposition: relative;\n\t\toverflow: hidden;\n\t}\n\n\tog-container {\n\t\theight: 30px;\n\t}\n\n\tog-list {\n\t\theight: 250px;\n\t}\n\n\t.no-results {\n\t\tpadding: 0 10px 10px 10px;\n\t}\n\n\t:host([sectionposition=\"bottom\"]) .switches {\n\t\tpadding-top: 6px;\n\t}\n\n\t.switches {\n\t\tpadding: 0 6px 6px 6px;\n\t}\n\n\t.switches og-button {\n\t\tfont-size: 0.8em;\n\t\theight: 16px;\n\t\tborder: 1px solid var(--og-accent-color);\n\t\tborder-radius: 8px;\n\t}\n`;\n\nexport const itemStyle = css`\n\t.item {\n\t\tborder: 1px solid transparent;\n\t}\n\n\t.item.selected {\n\t\tborder: 1px solid var(--og-accent-color);\n\t}\n\n\t.item>div {\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\t\n\t\theight: 100%;\n\t\tpadding: 0 5px;\n\t}\n\n\t.item .group {\n\t\tbackground-color: var(--og-commands-header-background);\n\t}\n\n\t.item .group-toggle {\n\t\twidth: 15px;\n\t}\n\n\t.item .group-text {\n\t\tline-height: ${constants.COMMAND_ITEM_HEIGHT - 2}px;\n\t}\n\n\t.item .group og-icon {\n\t\tline-height: ${constants.COMMAND_ITEM_HEIGHT - 2}px;\n\t\tdisplay: inline;\n\t}\n\n\t.item .command {\n\t\tmargin-left: 10px;\n\t}\n`;"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FloatingWindow } from "@omegagrid/core";
|
|
2
|
-
export declare class FloatingCommands extends FloatingWindow {
|
|
3
|
-
static styles: import("lit").CSSResult;
|
|
4
|
-
connectedCallback(): void;
|
|
5
|
-
disconnectedCallback(): void;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=floatingCommandWindow.d.ts.map
|