@omegagrid/commands 0.10.1 → 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.
Files changed (57) hide show
  1. package/package.json +4 -4
  2. package/dist/adapters/adapter.d.ts +0 -19
  3. package/dist/adapters/adapter.d.ts.map +0 -1
  4. package/dist/adapters/adapter.js +0 -23
  5. package/dist/adapters/adapter.js.map +0 -1
  6. package/dist/adapters/commandsFlowAdapter.d.ts +0 -25
  7. package/dist/adapters/commandsFlowAdapter.d.ts.map +0 -1
  8. package/dist/adapters/commandsFlowAdapter.js +0 -61
  9. package/dist/adapters/commandsFlowAdapter.js.map +0 -1
  10. package/dist/adapters/index.d.ts +0 -3
  11. package/dist/adapters/index.d.ts.map +0 -1
  12. package/dist/adapters/index.js +0 -3
  13. package/dist/adapters/index.js.map +0 -1
  14. package/dist/commandManager.d.ts +0 -39
  15. package/dist/commandManager.d.ts.map +0 -1
  16. package/dist/commandManager.js +0 -104
  17. package/dist/commandManager.js.map +0 -1
  18. package/dist/common.d.ts +0 -5
  19. package/dist/common.d.ts.map +0 -1
  20. package/dist/common.js +0 -18
  21. package/dist/common.js.map +0 -1
  22. package/dist/constants.d.ts +0 -49
  23. package/dist/constants.d.ts.map +0 -1
  24. package/dist/constants.js +0 -7
  25. package/dist/constants.js.map +0 -1
  26. package/dist/index.d.ts +0 -6
  27. package/dist/index.d.ts.map +0 -1
  28. package/dist/index.js +0 -7
  29. package/dist/index.js.map +0 -1
  30. package/dist/model/commands.d.ts +0 -66
  31. package/dist/model/commands.d.ts.map +0 -1
  32. package/dist/model/commands.js +0 -116
  33. package/dist/model/commands.js.map +0 -1
  34. package/dist/model/index.d.ts +0 -3
  35. package/dist/model/index.d.ts.map +0 -1
  36. package/dist/model/index.js +0 -3
  37. package/dist/model/index.js.map +0 -1
  38. package/dist/model/options.d.ts +0 -13
  39. package/dist/model/options.d.ts.map +0 -1
  40. package/dist/model/options.js +0 -17
  41. package/dist/model/options.js.map +0 -1
  42. package/dist/ui/commandWindow.d.ts +0 -75
  43. package/dist/ui/commandWindow.d.ts.map +0 -1
  44. package/dist/ui/commandWindow.js +0 -438
  45. package/dist/ui/commandWindow.js.map +0 -1
  46. package/dist/ui/commandWindow.style.d.ts +0 -3
  47. package/dist/ui/commandWindow.style.d.ts.map +0 -1
  48. package/dist/ui/commandWindow.style.js +0 -148
  49. package/dist/ui/commandWindow.style.js.map +0 -1
  50. package/dist/ui/floatingCommandWindow.d.ts +0 -7
  51. package/dist/ui/floatingCommandWindow.d.ts.map +0 -1
  52. package/dist/ui/floatingCommandWindow.js +0 -41
  53. package/dist/ui/floatingCommandWindow.js.map +0 -1
  54. package/dist/ui/index.d.ts +0 -2
  55. package/dist/ui/index.d.ts.map +0 -1
  56. package/dist/ui/index.js +0 -2
  57. package/dist/ui/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/commands",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Command window",
6
6
  "main": "./dist/index.js",
@@ -27,9 +27,9 @@
27
27
  "_prepublish": "yarn test && yarn lint"
28
28
  },
29
29
  "dependencies": {
30
- "@omegagrid/core": "^0.10.1",
31
- "@omegagrid/localize": "^0.10.1",
32
- "@omegagrid/tabs": "^0.10.1",
30
+ "@omegagrid/core": "^0.10.2",
31
+ "@omegagrid/localize": "^0.10.2",
32
+ "@omegagrid/tabs": "^0.10.2",
33
33
  "lit": "^3.1.1",
34
34
  "lit-html": "^3.1.1",
35
35
  "ts-debounce": "^4.0.0"
@@ -1,19 +0,0 @@
1
- import { ComponentAdapter, ComponentId } from "@omegagrid/core";
2
- import { CommandSource, CommandGroupSource, CommandsSection, Command } from "../model/commands";
3
- import { Options } from "../model/options";
4
- import { CommandWindow } from "../ui";
5
- export type CommandQuery = {
6
- sectionId?: ComponentId;
7
- groupId?: ComponentId;
8
- filter?: string;
9
- switches?: string[];
10
- };
11
- export declare abstract class CommandsAdapter extends ComponentAdapter<CommandWindow> {
12
- protected filterCommands(commands: CommandSource[], query: CommandQuery): CommandSource[];
13
- getGroups(_query?: CommandQuery): CommandGroupSource[] | Promise<CommandGroupSource[]>;
14
- getCommands(_query: CommandQuery): CommandSource[] | Promise<CommandSource[]>;
15
- getSections(_query?: CommandQuery): CommandsSection[] | Promise<CommandsSection[]>;
16
- getOptions(_sectionId?: ComponentId): Options | Promise<Options> | null;
17
- exec(_command: Command, _value?: string): void;
18
- }
19
- //# sourceMappingURL=adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAS,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG;IAC1B,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAA;AAED,8BAAsB,eAAgB,SAAQ,gBAAgB,CAAC,aAAa,CAAC;IAE5E,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,YAAY,GAAG,aAAa,EAAE;IAMzF,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,kBAAkB,EAAE,GAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAIpF,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,EAAE,GAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IAI3E,WAAW,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,eAAe,EAAE,GAAC,OAAO,CAAC,eAAe,EAAE,CAAC;IAIhF,UAAU,CAAC,UAAU,CAAC,EAAE,WAAW,GAAG,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,IAAI;IAInE,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM;CAEvC"}
@@ -1,23 +0,0 @@
1
- import { ComponentAdapter, utils } from "@omegagrid/core";
2
- export class CommandsAdapter extends ComponentAdapter {
3
- filterCommands(commands, query) {
4
- if (!commands)
5
- return [];
6
- const filterRegex = query?.filter == null ? null : new RegExp(utils.escapeRegExp(query.filter), 'i');
7
- return filterRegex == null ? commands : commands.filter(c => filterRegex.test(c.id || c.name || ''));
8
- }
9
- getGroups(_query) {
10
- return [];
11
- }
12
- getCommands(_query) {
13
- return [];
14
- }
15
- getSections(_query) {
16
- return [{ id: 'default' }];
17
- }
18
- getOptions(_sectionId) {
19
- return null;
20
- }
21
- exec(_command, _value) { }
22
- }
23
- //# sourceMappingURL=adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapters/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAe,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAYvE,MAAM,OAAgB,eAAgB,SAAQ,gBAA+B;IAElE,cAAc,CAAC,QAAyB,EAAE,KAAmB;QACtE,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QACzB,MAAM,WAAW,GAAG,KAAK,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;QACrG,OAAO,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IACtG,CAAC;IAED,SAAS,CAAC,MAAqB;QAC9B,OAAO,EAAE,CAAC;IACX,CAAC;IAED,WAAW,CAAC,MAAoB;QAC/B,OAAO,EAAE,CAAC;IACX,CAAC;IAED,WAAW,CAAC,MAAqB;QAChC,OAAO,CAAC,EAAC,EAAE,EAAE,SAAS,EAAC,CAAC,CAAC;IAC1B,CAAC;IAED,UAAU,CAAC,UAAwB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,CAAC,QAAiB,EAAE,MAAe,IAAI,CAAC;CAE5C","sourcesContent":["import { ComponentAdapter, ComponentId, utils } from \"@omegagrid/core\";\nimport { CommandSource, CommandGroupSource, CommandsSection, Command } from \"../model/commands\";\nimport { Options } from \"../model/options\";\nimport { CommandWindow } from \"../ui\";\n\nexport type CommandQuery = {\n\tsectionId?: ComponentId,\n\tgroupId?: ComponentId,\n\tfilter?: string,\n\tswitches?: string[],\n}\n\nexport abstract class CommandsAdapter extends ComponentAdapter<CommandWindow> {\n\n\tprotected filterCommands(commands: CommandSource[], query: CommandQuery): CommandSource[] {\n\t\tif (!commands) return [];\n\t\tconst filterRegex = query?.filter == null ? null : new RegExp(utils.escapeRegExp(query.filter), 'i');\n\t\treturn filterRegex == null ? commands : commands.filter(c => filterRegex.test(c.id || c.name || ''));\n\t}\n\t\n\tgetGroups(_query?: CommandQuery): CommandGroupSource[]|Promise<CommandGroupSource[]> {\n\t\treturn [];\n\t}\n\t\n\tgetCommands(_query: CommandQuery): CommandSource[]|Promise<CommandSource[]> {\n\t\treturn [];\n\t}\n\n\tgetSections(_query?: CommandQuery): CommandsSection[]|Promise<CommandsSection[]> {\n\t\treturn [{id: 'default'}];\n\t}\n\n\tgetOptions(_sectionId?: ComponentId): Options|Promise<Options>|null {\n\t\treturn null;\n\t}\n\n\texec(_command: Command, _value?: string) { }\n\n}"]}
@@ -1,25 +0,0 @@
1
- import { CommandSource, Command, CommandMode } from "../model/commands";
2
- import { Options } from "../model/options";
3
- import { CommandQuery, CommandsAdapter } from "./adapter";
4
- export type FlowCommandSource = CommandSource & {
5
- next?: {
6
- commands: FlowCommandSource[];
7
- mode?: CommandMode;
8
- text?: string;
9
- };
10
- };
11
- export declare class CommandsFlowAdapter extends CommandsAdapter {
12
- readonly map: Map<string, FlowCommandSource>;
13
- private commandChain;
14
- private _originalText;
15
- private _originalMode;
16
- private _commands;
17
- get commands(): FlowCommandSource[];
18
- set commands(value: FlowCommandSource[]);
19
- constructor(commands: FlowCommandSource[]);
20
- getCommands(query: CommandQuery): CommandSource[] | Promise<CommandSource[]>;
21
- exec(command: Command, _value?: string): void;
22
- reset(): void;
23
- getOptions(): Options | Promise<Options> | null;
24
- }
25
- //# sourceMappingURL=commandsFlowAdapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandsFlowAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/commandsFlowAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC/C,IAAI,CAAC,EAAE;QACN,QAAQ,EAAE,iBAAiB,EAAE,CAAC;QAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;CACF,CAAA;AAED,qBAAa,mBAAoB,SAAQ,eAAe;IAEvD,QAAQ,CAAC,GAAG,iCAAwC;IACpD,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAc;IAEnC,OAAO,CAAC,SAAS,CAA2B;IAC5C,IAAI,QAAQ,IAGQ,iBAAiB,EAAE,CADtC;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,iBAAiB,EAAE,EAUtC;gBAEW,QAAQ,EAAE,iBAAiB,EAAE;IAKzC,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,EAAE,GAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IAM1E,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM;IAetC,KAAK;IAUL,UAAU,IAAI,OAAO,GAAC,OAAO,CAAC,OAAO,CAAC,GAAC,IAAI;CAI3C"}
@@ -1,61 +0,0 @@
1
- import { CommandsAdapter } from "./adapter";
2
- export class CommandsFlowAdapter extends CommandsAdapter {
3
- get commands() {
4
- return this._commands;
5
- }
6
- set commands(value) {
7
- this._commands = value;
8
- this.map.clear();
9
- const map = (commands) => {
10
- commands.forEach(c => {
11
- this.map.set(c.id ?? c.name, c);
12
- if (c.next?.commands)
13
- map(c.next.commands);
14
- });
15
- };
16
- map(this._commands);
17
- }
18
- constructor(commands) {
19
- super();
20
- this.map = new Map();
21
- this.commandChain = [];
22
- this._commands = [];
23
- this.commands = commands;
24
- }
25
- getCommands(query) {
26
- const lastCommand = this.commandChain.length ? this.commandChain[this.commandChain.length - 1] : null;
27
- const nextCommands = lastCommand ? this.map.get(lastCommand.id)?.next?.commands : null;
28
- return this.filterCommands(nextCommands ? nextCommands : this.commands, query);
29
- }
30
- exec(command, _value) {
31
- const next = this.map.get(command.id)?.next;
32
- if (next?.commands?.length) {
33
- this.commandChain.push(command);
34
- if (this._originalText == null)
35
- this._originalText = this.component.text;
36
- if (this._originalMode == null)
37
- this._originalMode = this.component.mode;
38
- if (next.text != null)
39
- this.component.text = next.text;
40
- if (next.mode != null)
41
- this.component.mode = next.mode;
42
- }
43
- else {
44
- this.reset();
45
- }
46
- this.component.updateCommands();
47
- }
48
- reset() {
49
- this.commandChain = [];
50
- if (this.component) {
51
- this.component.text = this._originalText;
52
- this.component.mode = this._originalMode;
53
- }
54
- this._originalText = null;
55
- this._originalMode = null;
56
- }
57
- getOptions() {
58
- return null;
59
- }
60
- }
61
- //# sourceMappingURL=commandsFlowAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandsFlowAdapter.js","sourceRoot":"","sources":["../../src/adapters/commandsFlowAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,eAAe,EAAE,MAAM,WAAW,CAAC;AAU1D,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IAQvD,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IACD,IAAI,QAAQ,CAAC,KAA0B;QACtC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,GAAG,GAAG,CAAC,QAA6B,EAAE,EAAE;YAC7C,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;gBACpB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAChC,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ;oBAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;IAED,YAAY,QAA6B;QACxC,KAAK,EAAE,CAAC;QAtBA,QAAG,GAAG,IAAI,GAAG,EAA6B,CAAC;QAC5C,iBAAY,GAAc,EAAE,CAAC;QAI7B,cAAS,GAAwB,EAAE,CAAC;QAkB3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1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P,IAAI,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;IACjC,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;YACzC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,UAAU;QACT,OAAO,IAAI,CAAC;IACb,CAAC;CAED","sourcesContent":["import { CommandSource, Command, CommandMode } from \"../model/commands\";\nimport { Options } from \"../model/options\";\nimport { CommandQuery, CommandsAdapter } from \"./adapter\";\n\nexport type FlowCommandSource = CommandSource & {\n\tnext?: {\n\t\tcommands: FlowCommandSource[];\n\t\tmode?: CommandMode;\n\t\ttext?: string;\n\t};\n}\n\nexport class CommandsFlowAdapter extends CommandsAdapter {\n\n\treadonly map = new Map<string, FlowCommandSource>();\n\tprivate commandChain: Command[] = [];\n\tprivate _originalText: string;\n\tprivate _originalMode: CommandMode;\n\n\tprivate _commands: FlowCommandSource[] = [];\n\tget commands() {\n\t\treturn this._commands;\n\t}\n\tset commands(value: FlowCommandSource[]) {\n\t\tthis._commands = value;\n\t\tthis.map.clear();\n\t\tconst map = (commands: FlowCommandSource[]) => {\n\t\t\tcommands.forEach(c => {\n\t\t\t\tthis.map.set(c.id ?? c.name, c);\n\t\t\t\tif (c.next?.commands) map(c.next.commands);\n\t\t\t});\n\t\t};\n\t\tmap(this._commands);\n\t}\n\n\tconstructor(commands: FlowCommandSource[]) {\n\t\tsuper();\n\t\tthis.commands = commands;\n\t}\n\t\t\n\tgetCommands(query: CommandQuery): CommandSource[]|Promise<CommandSource[]> {\n\t\tconst lastCommand = this.commandChain.length ? this.commandChain[this.commandChain.length - 1] : null;\n\t\tconst nextCommands = lastCommand ? this.map.get(lastCommand.id)?.next?.commands : null;\n\t\treturn this.filterCommands(nextCommands ? nextCommands : this.commands, query);\n\t}\n\n\texec(command: Command, _value?: string) {\n\t\tconst next = this.map.get(command.id)?.next;\n\t\tif (next?.commands?.length) {\n\t\t\tthis.commandChain.push(command);\n\t\t\tif (this._originalText == null) this._originalText = this.component.text;\n\t\t\tif (this._originalMode == null) this._originalMode = this.component.mode;\n\t\t\tif (next.text != null) this.component.text = next.text;\n\t\t\tif (next.mode != null) this.component.mode = next.mode;\n\t\t} else {\n\t\t\tthis.reset();\n\t\t}\n\n\t\tthis.component.updateCommands();\n\t}\n\n\treset() {\n\t\tthis.commandChain = [];\n\t\tif (this.component) {\n\t\t\tthis.component.text = this._originalText;\n\t\t\tthis.component.mode = this._originalMode;\n\t\t}\n\t\tthis._originalText = null;\n\t\tthis._originalMode = null;\n\t}\n\n\tgetOptions(): Options|Promise<Options>|null {\n\t\treturn null;\n\t}\n\n}"]}
@@ -1,3 +0,0 @@
1
- export * from './adapter';
2
- export * from './commandsFlowAdapter';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './adapter';
2
- export * from './commandsFlowAdapter';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './adapter';\nexport * from './commandsFlowAdapter';"]}
@@ -1,39 +0,0 @@
1
- import { FloatingWindow } from "@omegagrid/core";
2
- import { Command, CommandMode, CommandSource } from "./model";
3
- import { CommandWindow } from "./ui";
4
- import { LitElement } from "lit";
5
- import { CommonCommandType } from "./common";
6
- import { CommandsFlowAdapter, FlowCommandSource } from "./adapters";
7
- export type OpenCommandsOptions = {
8
- value?: string;
9
- text?: string;
10
- mode?: CommandMode;
11
- content: CommandSource[] | CommonCommandType;
12
- };
13
- export type CommandResult = {
14
- command: Command;
15
- value?: string;
16
- id?: string;
17
- };
18
- export declare class CommandManager {
19
- readonly target: LitElement;
20
- private _menu;
21
- private _menuContainer;
22
- private _resolveCallback;
23
- private _rejectCallback;
24
- private _adapter;
25
- private _commands;
26
- get commands(): FlowCommandSource[];
27
- constructor(target: LitElement);
28
- clear(): void;
29
- add(commands: FlowCommandSource | FlowCommandSource[]): void;
30
- get adapter(): CommandsFlowAdapter;
31
- private cleanCallbacks;
32
- private _onExec;
33
- get menu(): CommandWindow;
34
- get menuContainer(): FloatingWindow;
35
- open(options?: OpenCommandsOptions): Promise<CommandResult | null>;
36
- close(): void;
37
- updatePosition(): void;
38
- }
39
- //# sourceMappingURL=commandManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandManager.d.ts","sourceRoot":"","sources":["../src/commandManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAO,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAgB,aAAa,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAkB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,MAAM,mBAAmB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,aAAa,EAAE,GAAG,iBAAiB,CAAC;CAChD,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ,CAAA;AAED,qBAAa,cAAc;IAad,QAAQ,CAAC,MAAM,EAAE,UAAU;IAXvC,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,gBAAgB,CAAuC;IAC/D,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,SAAS,CAA2B;IAE5C,IAAI,QAAQ,wBAEX;gBAEoB,MAAM,EAAE,UAAU;IAEvC,KAAK;IAKL,GAAG,CAAC,QAAQ,EAAE,iBAAiB,GAAC,iBAAiB,EAAE;IAKnD,IAAI,OAAO,wBAIV;IAED,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,OAAO,CAad;IAED,IAAI,IAAI,kBAIP;IAED,IAAI,aAAa,mBAWhB;IAEK,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,GAAC,IAAI,CAAC;IAgCtE,KAAK;IAOL,cAAc;CAMd"}
@@ -1,104 +0,0 @@
1
- import { dom, log } from "@omegagrid/core";
2
- import { createCommands } from "./common";
3
- import { CommandsFlowAdapter } from "./adapters";
4
- export class CommandManager {
5
- get commands() {
6
- return this._commands;
7
- }
8
- constructor(target) {
9
- this.target = target;
10
- this._commands = [];
11
- this._onExec = (e) => {
12
- log.getLogger().info(`trigger command: ${e.command.id}`);
13
- if (this._resolveCallback)
14
- this._resolveCallback({
15
- command: e.command,
16
- id: e.command?.id,
17
- value: e.value,
18
- });
19
- this._resolveCallback = null;
20
- this._rejectCallback = null;
21
- if (this.adapter.map.get(e.command.id)?.next == null) {
22
- this.close();
23
- }
24
- };
25
- }
26
- clear() {
27
- this._commands = [];
28
- this._adapter = null;
29
- }
30
- add(commands) {
31
- this._commands.push(...(Array.isArray(commands) ? commands : [commands]));
32
- this._adapter = null;
33
- }
34
- get adapter() {
35
- if (this._adapter)
36
- return this._adapter;
37
- this._adapter = new CommandsFlowAdapter(this._commands);
38
- return this._adapter;
39
- }
40
- cleanCallbacks() {
41
- if (this._rejectCallback)
42
- this._rejectCallback();
43
- this._resolveCallback = null;
44
- this._rejectCallback = null;
45
- }
46
- get menu() {
47
- return this._menu ?? (this._menu = dom.createElement('og-commands', {
48
- listeners: [['command.exec', this._onExec]]
49
- }));
50
- }
51
- get menuContainer() {
52
- if (this._menuContainer)
53
- return this._menuContainer;
54
- this._menuContainer = dom.createElement('og-floating-window', {
55
- listeners: [['hide', () => {
56
- this.target?.focus();
57
- this.adapter?.reset();
58
- }]]
59
- });
60
- this.menu.slot = 'content';
61
- this._menuContainer.appendChild(this.menu);
62
- return this._menuContainer;
63
- }
64
- async open(options) {
65
- log.getLogger().info('open menu');
66
- this.target.shadowRoot.appendChild(this.menuContainer);
67
- this.menuContainer.show();
68
- options ?? (options = { content: null });
69
- this.menu.text = options.text;
70
- this.menu.value = options.value;
71
- this.menu.mode = options.mode || 'search';
72
- if (Array.isArray(options.content)) {
73
- this.menu.commands = options.content;
74
- this.menu.adapter = null;
75
- }
76
- else if (typeof options.content === 'string') {
77
- this.menu.commands = createCommands(options.content);
78
- this.menu.adapter = null;
79
- }
80
- else {
81
- this.menu.commands = null;
82
- this.menu.adapter = this.adapter;
83
- }
84
- await this.menu.updateComplete;
85
- this.menu.focus();
86
- this.updatePosition();
87
- return new Promise((resolve, reject) => {
88
- this._resolveCallback = resolve;
89
- this._rejectCallback = reject;
90
- });
91
- }
92
- close() {
93
- this.menuContainer.hide(false);
94
- this.menuContainer.remove();
95
- this.cleanCallbacks();
96
- this.target?.focus();
97
- }
98
- updatePosition() {
99
- dom.setSize(this.menuContainer, { w: 0.9 * this.target.clientWidth });
100
- dom.setCenterPosition(this.menuContainer, this.target, { horizontal: true, vertical: false });
101
- dom.setPosition(this.menuContainer, { t: 50 });
102
- }
103
- }
104
- //# sourceMappingURL=commandManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandManager.js","sourceRoot":"","sources":["../src/commandManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAI3D,OAAO,EAAE,cAAc,EAAqB,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAqB,MAAM,YAAY,CAAC;AAepE,MAAM,OAAO,cAAc;IAS1B,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED,YAAqB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;QAN/B,cAAS,GAAwB,EAAE,CAAC;QA8BpC,YAAO,GAAG,CAAC,CAAe,EAAE,EAAE;YACrC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YACzD,IAAI,IAAI,CAAC,gBAAgB;gBAAE,IAAI,CAAC,gBAAgB,CAAC;oBAChD,OAAO,EAAE,CAAC,CAAC,OAAO;oBAClB,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE;oBACjB,KAAK,EAAE,CAAC,CAAC,KAAK;iBACd,CAAC,CAAC;YACH,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAE5B,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;gBACtD,IAAI,CAAC,KAAK,EAAE,CAAC;YACd,CAAC;QACF,CAAC,CAAA;IArC0C,CAAC;IAE5C,KAAK;QACJ,I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I,CAAC,QAAQ,GAAG,IAAI,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAClC,CAAC;QAED,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAElB,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;YAChC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC;QAC/B,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,cAAc;QACb,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,EAAC,CAAC,CAAC;QACpE,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,EAAE,EAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAC,CAAC,CAAC;QAC5F,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC;IAC9C,CAAC;CAED","sourcesContent":["import { dom, FloatingWindow, log } from \"@omegagrid/core\";\nimport { Command, CommandMode, CommandSource } from \"./model\";\nimport { CommandEvent, CommandWindow } from \"./ui\";\nimport { LitElement } from \"lit\";\nimport { createCommands, CommonCommandType } from \"./common\";\nimport { CommandsFlowAdapter, FlowCommandSource } from \"./adapters\";\n\nexport type OpenCommandsOptions = {\n value?: string;\n text?: string;\n mode?: CommandMode;\n content: CommandSource[] | CommonCommandType;\n}\n\nexport type CommandResult = {\n\tcommand: Command;\n\tvalue?: string;\n\tid?: string;\n}\n\nexport class CommandManager {\n\n\tprivate _menu: CommandWindow;\n\tprivate _menuContainer: FloatingWindow;\n\tprivate _resolveCallback: (result: CommandResult|null) => void;\n\tprivate _rejectCallback: () => void;\n\tprivate _adapter: CommandsFlowAdapter;\n\tprivate _commands: FlowCommandSource[] = [];\n\n\tget commands() {\n\t\treturn this._commands;\n\t}\n\t\n\tconstructor(readonly target: LitElement) { }\n\n\tclear() {\n\t\tthis._commands = [];\n\t\tthis._adapter = null;\n\t}\n\n\tadd(commands: FlowCommandSource|FlowCommandSource[]) {\n\t\tthis._commands.push(...(Array.isArray(commands) ? commands : [commands]));\n\t\tthis._adapter = null;\n\t}\n\n\tget adapter() {\n\t\tif (this._adapter) return this._adapter;\n\t\tthis._adapter = new CommandsFlowAdapter(this._commands);\n\t\treturn this._adapter;\n\t}\n\n\tprivate cleanCallbacks() {\n\t\tif (this._rejectCallback) this._rejectCallback();\n\t\tthis._resolveCallback = null;\n\t\tthis._rejectCallback = null;\n\t}\n\n\tprivate _onExec = (e: CommandEvent) => {\n\t\tlog.getLogger().info(`trigger command: ${e.command.id}`);\n\t\tif (this._resolveCallback) this._resolveCallback({\n\t\t\tcommand: e.command,\n\t\t\tid: e.command?.id,\n\t\t\tvalue: e.value,\n\t\t});\n\t\tthis._resolveCallback = null;\n\t\tthis._rejectCallback = null;\n\n\t\tif (this.adapter.map.get(e.command.id)?.next == null) {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\tget menu() {\n\t\treturn this._menu ?? (this._menu = dom.createElement<CommandWindow>('og-commands', {\n\t\t\tlisteners: [['command.exec', this._onExec]]\n\t\t}));\n\t}\n\t\n\tget menuContainer() {\n\t\tif (this._menuContainer) return this._menuContainer;\n\t\tthis._menuContainer = dom.createElement<FloatingWindow>('og-floating-window', {\n\t\t\tlisteners: [['hide', () => {\n\t\t\t\tthis.target?.focus();\n\t\t\t\tthis.adapter?.reset();\n\t\t\t}]]\n\t\t});\n\t\tthis.menu.slot = 'content';\n\t\tthis._menuContainer.appendChild(this.menu);\n\t\treturn this._menuContainer;\n\t}\n\n\tasync open(options?: OpenCommandsOptions): Promise<CommandResult|null> {\n\t\tlog.getLogger().info('open menu');\n\t\tthis.target.shadowRoot.appendChild(this.menuContainer);\n\t\tthis.menuContainer.show();\n\t\toptions ??= {content: null};\n\n\t\tthis.menu.text = options.text;\n\t\tthis.menu.value = options.value;\n\t\tthis.menu.mode = options.mode || 'search';\n\n\t\tif (Array.isArray(options.content)) {\n\t\t\tthis.menu.commands = options.content;\n\t\t\tthis.menu.adapter = null;\n\t\t} else if (typeof options.content === 'string') {\n\t\t\tthis.menu.commands = createCommands(options.content);\n\t\t\tthis.menu.adapter = null;\n\t\t} else {\n\t\t\tthis.menu.commands = null;\n\t\t\tthis.menu.adapter = this.adapter;\n\t\t}\n\n\t\tawait this.menu.updateComplete;\n\t\tthis.menu.focus();\n\n\t\tthis.updatePosition();\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis._resolveCallback = resolve;\n\t\t\tthis._rejectCallback = reject;\n\t\t});\n\t}\n\n\tclose() {\n\t\tthis.menuContainer.hide(false);\n\t\tthis.menuContainer.remove();\n\t\tthis.cleanCallbacks();\n\t\tthis.target?.focus();\n\t}\n\n\tupdatePosition() {\n\t\tdom.setSize(this.menuContainer, {w: 0.9 * this.target.clientWidth});\n\t\tdom.setCenterPosition(this.menuContainer, this.target, {horizontal: true, vertical: false});\n\t\tdom.setPosition(this.menuContainer, {t: 50});\n\t}\n\n}"]}
package/dist/common.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { CommandFunction, CommandSource } from '@omegagrid/commands';
2
- export type CommonCommandType = 'yes_no' | 'apply' | 'ok';
3
- export declare const commandFactories: Record<CommonCommandType, (exec?: CommandFunction) => CommandSource[]>;
4
- export declare const createCommands: (type: CommonCommandType, exec?: CommandFunction) => CommandSource[];
5
- //# sourceMappingURL=common.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;AAE1D,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,aAAa,EAAE,CAanG,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,iBAAiB,EAAE,OAAO,eAAe,KAAG,aAAa,EAE7F,CAAC"}
package/dist/common.js DELETED
@@ -1,18 +0,0 @@
1
- export const commandFactories = {
2
- 'yes_no': (exec) => [
3
- { id: 'Y', name: 'Yes', exec },
4
- { id: 'N', name: 'No', exec }
5
- ],
6
- 'apply': (exec) => [
7
- { id: 'apply', name: 'Apply', exec },
8
- { id: 'cancel', name: 'Cancel' }
9
- ],
10
- 'ok': (exec) => [
11
- { id: 'ok', name: 'OK', exec },
12
- { id: 'cancel', name: 'Cancel' }
13
- ]
14
- };
15
- export const createCommands = (type, exec) => {
16
- return commandFactories[type](exec);
17
- };
18
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,gBAAgB,GAA2E;IACvG,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QACnB,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC;QAC5B,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;KAC3B;IACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QAClB,EAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAC;QAClC,EAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAC;KAC9B;IACD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;QACf,EAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;QAC5B,EAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAC;KAC9B;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAuB,EAAE,IAAsB,EAAmB,EAAE;IAClG,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { CommandFunction, CommandSource } from '@omegagrid/commands';\n\nexport type CommonCommandType = 'yes_no' | 'apply' | 'ok';\n\nexport const commandFactories: Record<CommonCommandType, (exec?: CommandFunction) => CommandSource[]> = {\n\t'yes_no': (exec) => [\n\t\t{id: 'Y', name: 'Yes', exec},\n\t\t{id: 'N', name: 'No', exec}\n\t],\n\t'apply': (exec) => [\n\t\t{id: 'apply', name: 'Apply', exec},\n\t\t{id: 'cancel', name: 'Cancel'}\n\t],\n\t'ok': (exec) => [\n\t\t{id: 'ok', name: 'OK', exec},\n\t\t{id: 'cancel', name: 'Cancel'}\n\t]\n};\n\nexport const createCommands = (type: CommonCommandType, exec?: CommandFunction): CommandSource[] => {\n\treturn commandFactories[type](exec);\n};\n"]}
@@ -1,49 +0,0 @@
1
- declare const _default: {
2
- PREFIX: string;
3
- DEFAULT_ACCENT_COLOR: string;
4
- DEFAULT_ACCENT_COLOR_2: import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | import("color")<string | number | any | ArrayLike<number> | {
5
- [key: string]: any;
6
- }> | ArrayLike<number> | {
7
- [key: string]: any;
8
- }> | ArrayLike<number> | {
9
- [key: string]: any;
10
- }> | ArrayLike<number> | {
11
- [key: string]: any;
12
- }> | ArrayLike<number> | {
13
- [key: string]: any;
14
- }> | ArrayLike<number> | {
15
- [key: string]: any;
16
- }> | ArrayLike<number> | {
17
- [key: string]: any;
18
- }> | ArrayLike<number> | {
19
- [key: string]: any;
20
- }> | ArrayLike<number> | {
21
- [key: string]: any;
22
- }> | ArrayLike<number> | {
23
- [key: string]: any;
24
- }> | ArrayLike<number> | {
25
- [key: string]: any;
26
- }> | ArrayLike<number> | {
27
- [key: string]: any;
28
- }>;
29
- SIZER_SIZE: number;
30
- SLIDER_SIZE: number;
31
- SLIDER_MIN_LENGTH: number;
32
- EXPANDER_SIZE: number;
33
- LIST_ITEM_HEIGHT: number;
34
- LIST_RENDERING_TRESHOLD: number;
35
- LIST_AUTOSCROLL_TRESHOLD: number;
36
- LIST_AUTOSCROLL_DELAY: number;
37
- DEFAULT_TEXT_HIGHLIGHT_COLOR: string;
38
- TOOLTIP_MARGIN: number;
39
- MENU_ITEM_HEIGHT: number;
40
- COLORPICKER_COLOR_SIZE: number;
41
- DEFAULT_NUMBER_FORMAT: string;
42
- BUTTON_HEIGHT: number;
43
- FONT_SIZE: number;
44
- FLOATING_WINDOW_MAX_WIDTH: number;
45
- COMMAND_WINDOW_MAX_WIDTH: number;
46
- COMMAND_ITEM_HEIGHT: number;
47
- };
48
- export default _default;
49
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAIC"}
package/dist/constants.js DELETED
@@ -1,7 +0,0 @@
1
- import { constants as coreConstants } from '@omegagrid/core';
2
- export default {
3
- COMMAND_WINDOW_MAX_WIDTH: 500,
4
- COMMAND_ITEM_HEIGHT: 22,
5
- ...coreConstants
6
- };
7
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,eAAe;IACd,wBAAwB,EAAE,GAAG;IAC7B,mBAAmB,EAAE,EAAE;IACvB,GAAG,aAAa;CAChB,CAAA","sourcesContent":["import { constants as coreConstants } from '@omegagrid/core';\n\nexport default {\n\tCOMMAND_WINDOW_MAX_WIDTH: 500,\n\tCOMMAND_ITEM_HEIGHT: 22,\n\t...coreConstants\n}"]}
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from './ui';
2
- export * from './model';
3
- export * from './adapters';
4
- export * from './commandManager';
5
- export * from './common';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC"}
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- export * from './ui';
2
- export * from './model';
3
- export * from './adapters';
4
- export * from './commandManager';
5
- export * from './common';
6
- // export * from './types';
7
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,2BAA2B","sourcesContent":["export * from './ui';\nexport * from './model';\nexport * from './adapters';\nexport * from './commandManager';\nexport * from './common';\n// export * from './types';"]}
@@ -1,66 +0,0 @@
1
- import { CustomProperties, IconSpec } from "@omegagrid/core";
2
- import { TabItem } from "@omegagrid/tabs";
3
- export type CommandSectionSwitch = {
4
- key: string;
5
- value: string;
6
- checked?: boolean;
7
- icon?: IconSpec | string;
8
- };
9
- export type CommandsSection = TabItem & {
10
- placeholder?: string;
11
- triggerCommand?: string;
12
- switches?: CommandSectionSwitch[];
13
- };
14
- export type CommandMode = 'search' | 'input' | 'none';
15
- export type CommandInput = {
16
- id: string;
17
- value?: string;
18
- };
19
- export type CommandFunction = (command: Command, value?: string) => void | Promise<void>;
20
- export type CommandSource = {
21
- id?: string;
22
- name?: string;
23
- value?: string;
24
- group?: string;
25
- exec?: CommandFunction;
26
- props?: CustomProperties;
27
- };
28
- export declare class Command {
29
- id: string;
30
- name: string;
31
- group: string;
32
- props: CustomProperties;
33
- private _exec;
34
- constructor(source?: CommandSource);
35
- populate(source: CommandSource): void;
36
- getSourceData(): CommandSource;
37
- exec(value?: string): void | Promise<void>;
38
- }
39
- export type CommandGroupSource = {
40
- id: string;
41
- name?: string;
42
- commands?: CommandSource[];
43
- };
44
- export declare class CommandGroup {
45
- readonly commands: Map<string, Command>;
46
- readonly id: string;
47
- readonly name: string;
48
- open: boolean;
49
- constructor(source: CommandGroupSource);
50
- addCommand(command: Command | CommandSource): void;
51
- getSourceData(): CommandGroupSource;
52
- }
53
- export declare class Commands {
54
- readonly groups: Map<string, CommandGroup>;
55
- get count(): number;
56
- constructor(commands?: CommandSource[]);
57
- clear(): this;
58
- registerGroup(group: CommandGroupSource): CommandGroup;
59
- removeSection(sectionId: string): void;
60
- register(command: Command | CommandSource): void;
61
- remove(name: string): void;
62
- get(name: string): Command;
63
- exec(id: string, value?: string): void | Promise<void>;
64
- filter(term?: string, includeGroups?: boolean, emptyGroups?: boolean): (CommandGroup | Command)[];
65
- }
66
- //# sourceMappingURL=commands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commands.d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