@omegagrid/toolbar 0.10.2 → 0.10.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/dist/constants.d.ts +50 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/controls/index.d.ts +9 -0
- package/dist/ui/controls/index.d.ts.map +1 -0
- package/dist/ui/controls/index.js +9 -0
- package/dist/ui/controls/index.js.map +1 -0
- package/dist/ui/controls/renderers.d.ts +4 -0
- package/dist/ui/controls/renderers.d.ts.map +1 -0
- package/dist/ui/controls/renderers.js +96 -0
- package/dist/ui/controls/renderers.js.map +1 -0
- package/dist/ui/controls/toolbarButton.d.ts +10 -0
- package/dist/ui/controls/toolbarButton.d.ts.map +1 -0
- package/dist/ui/controls/toolbarButton.js +54 -0
- package/dist/ui/controls/toolbarButton.js.map +1 -0
- package/dist/ui/controls/toolbarColorPicker.d.ts +16 -0
- package/dist/ui/controls/toolbarColorPicker.d.ts.map +1 -0
- package/dist/ui/controls/toolbarColorPicker.js +111 -0
- package/dist/ui/controls/toolbarColorPicker.js.map +1 -0
- package/dist/ui/controls/toolbarCustomDropdown.d.ts +11 -0
- package/dist/ui/controls/toolbarCustomDropdown.d.ts.map +1 -0
- package/dist/ui/controls/toolbarCustomDropdown.js +58 -0
- package/dist/ui/controls/toolbarCustomDropdown.js.map +1 -0
- package/dist/ui/controls/toolbarDropdown.d.ts +14 -0
- package/dist/ui/controls/toolbarDropdown.d.ts.map +1 -0
- package/dist/ui/controls/toolbarDropdown.js +78 -0
- package/dist/ui/controls/toolbarDropdown.js.map +1 -0
- package/dist/ui/controls/toolbarDropdownButton.d.ts +25 -0
- package/dist/ui/controls/toolbarDropdownButton.d.ts.map +1 -0
- package/dist/ui/controls/toolbarDropdownButton.js +156 -0
- package/dist/ui/controls/toolbarDropdownButton.js.map +1 -0
- package/dist/ui/controls/toolbarDropdownMenu.d.ts +10 -0
- package/dist/ui/controls/toolbarDropdownMenu.d.ts.map +1 -0
- package/dist/ui/controls/toolbarDropdownMenu.js +55 -0
- package/dist/ui/controls/toolbarDropdownMenu.js.map +1 -0
- package/dist/ui/controls/toolbarGrid.d.ts +8 -0
- package/dist/ui/controls/toolbarGrid.d.ts.map +1 -0
- package/dist/ui/controls/toolbarGrid.js +40 -0
- package/dist/ui/controls/toolbarGrid.js.map +1 -0
- package/dist/ui/controls/toolbarText.d.ts +19 -0
- package/dist/ui/controls/toolbarText.d.ts.map +1 -0
- package/dist/ui/controls/toolbarText.js +119 -0
- package/dist/ui/controls/toolbarText.js.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/toolbar.d.ts +19 -0
- package/dist/ui/toolbar.d.ts.map +1 -0
- package/dist/ui/toolbar.js +75 -0
- package/dist/ui/toolbar.js.map +1 -0
- package/dist/ui/toolbar.style.d.ts +2 -0
- package/dist/ui/toolbar.style.d.ts.map +1 -0
- package/dist/ui/toolbar.style.js +65 -0
- package/dist/ui/toolbar.style.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
TOOLBAR_HEIGHT: number;
|
|
46
|
+
TOOLBAR_COMPONENT_SIZE_BASE: number;
|
|
47
|
+
TOOLBAR_TOOLTIP_DELAY: number;
|
|
48
|
+
};
|
|
49
|
+
export default _default;
|
|
50
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
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,cAAc,EAAE,EAAE;IAClB,2BAA2B,EAAE,EAAE;IAC/B,qBAAqB,EAAE,GAAG;IAC1B,GAAG,aAAa;CAEhB,CAAA","sourcesContent":["import { constants as coreConstants } from '@omegagrid/core';\n\nexport default {\n\tTOOLBAR_HEIGHT: 30,\n\tTOOLBAR_COMPONENT_SIZE_BASE: 24,\n\tTOOLBAR_TOOLTIP_DELAY: 200,\n\t...coreConstants\n\n}"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC","sourcesContent":["export * from './ui';\nexport * from './types';"]}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ColorTypes, ComponentAdapter, ComponentId, IconSpec } from "@omegagrid/core";
|
|
2
|
+
import { NodeSource } from "@omegagrid/tree";
|
|
3
|
+
import { TemplateResult } from "lit-html";
|
|
4
|
+
export type ToolbarItemType = 'divider' | 'button' | 'togglebutton' | 'dropdown' | 'dropdown-button' | 'dropdown-custom' | 'color' | 'text' | 'label' | 'dropdown-menu';
|
|
5
|
+
export type ToolbarItem = {
|
|
6
|
+
type: ToolbarItemType;
|
|
7
|
+
id: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
value?: unknown;
|
|
10
|
+
tooltip?: string;
|
|
11
|
+
color?: ColorTypes;
|
|
12
|
+
icon?: IconSpec | string;
|
|
13
|
+
width?: number;
|
|
14
|
+
text?: string;
|
|
15
|
+
caption?: string;
|
|
16
|
+
content?: TemplateResult<1>;
|
|
17
|
+
items?: ToolbarItem[][] | NodeSource[];
|
|
18
|
+
adapter?: ComponentAdapter;
|
|
19
|
+
colspan?: number;
|
|
20
|
+
default?: boolean;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
gap?: number;
|
|
25
|
+
alignment?: 'left' | 'right';
|
|
26
|
+
options?: Record<string, unknown>;
|
|
27
|
+
createComponent?: (id: ComponentId, value?: unknown) => Promise<HTMLElement> | HTMLElement;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,eAAe,GAC1B,SAAS,GAAC,QAAQ,GAAC,cAAc,GAAC,UAAU,GAAC,iBAAiB,GAC9D,iBAAiB,GAAC,OAAO,GAAC,MAAM,GAAC,OAAO,GAAC,eAAe,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAC,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,WAAW,EAAE,EAAE,GAAC,UAAU,EAAE,CAAC;IACrC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAC,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,CAAC,GAAC,WAAW,CAAC;CACzF,CAAA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorTypes, ComponentAdapter, ComponentId, IconSpec } from \"@omegagrid/core\";\nimport { NodeSource } from \"@omegagrid/tree\"\nimport { TemplateResult } from \"lit-html\";\n\nexport type ToolbarItemType = \n\t'divider'|'button'|'togglebutton'|'dropdown'|'dropdown-button'|\n\t'dropdown-custom'|'color'|'text'|'label'|'dropdown-menu';\n\nexport type ToolbarItem = {\n\ttype: ToolbarItemType,\n\tid: string,\n\ttitle?: string,\n\tvalue?: unknown,\n\ttooltip?: string,\n\tcolor?: ColorTypes,\n\ticon?: IconSpec|string,\n\twidth?: number,\n\ttext?: string,\n\tcaption?: string,\n\tcontent?: TemplateResult<1>,\n\titems?: ToolbarItem[][]|NodeSource[],\n\tadapter?: ComponentAdapter,\n\tcolspan?: number,\n\tdefault?: boolean,\n\tplaceholder?: string,\n\tdisabled?: boolean,\n\thidden?: boolean,\n\tgap?: number,\n\talignment?: 'left'|'right',\n\toptions?: Record<string, unknown>,\n\tcreateComponent?: (id: ComponentId, value?: unknown) => Promise<HTMLElement>|HTMLElement,\n}"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './toolbarButton';
|
|
2
|
+
export * from './toolbarDropdown';
|
|
3
|
+
export * from './toolbarCustomDropdown';
|
|
4
|
+
export * from './toolbarDropdownButton';
|
|
5
|
+
export * from './toolbarDropdownMenu';
|
|
6
|
+
export * from './toolbarGrid';
|
|
7
|
+
export * from './toolbarText';
|
|
8
|
+
export * from './toolbarColorPicker';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './toolbarButton';
|
|
2
|
+
export * from './toolbarDropdown';
|
|
3
|
+
export * from './toolbarCustomDropdown';
|
|
4
|
+
export * from './toolbarDropdownButton';
|
|
5
|
+
export * from './toolbarDropdownMenu';
|
|
6
|
+
export * from './toolbarGrid';
|
|
7
|
+
export * from './toolbarText';
|
|
8
|
+
export * from './toolbarColorPicker';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/controls/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC","sourcesContent":["export * from './toolbarButton';\nexport * from './toolbarDropdown';\nexport * from './toolbarCustomDropdown';\nexport * from './toolbarDropdownButton';\nexport * from './toolbarDropdownMenu';\nexport * from './toolbarGrid';\nexport * from './toolbarText';\nexport * from './toolbarColorPicker';"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/renderers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAmB3D,eAAO,MAAM,SAAS,8BAAmC,WAAW,UAAU,OAAO,KAAK,cAAc,CAAC,CAAC,CAAC,CA0EzG,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { dom } from "@omegagrid/core";
|
|
2
|
+
import { html } from "lit";
|
|
3
|
+
import { styleMap } from "lit-html/directives/style-map.js";
|
|
4
|
+
const defaultStyles = new Map([
|
|
5
|
+
['button', {}],
|
|
6
|
+
['togglebutton', {}],
|
|
7
|
+
['dropdown', {}],
|
|
8
|
+
['dropdown-button', { width: '38px' }],
|
|
9
|
+
['color', { width: '38px' }],
|
|
10
|
+
['text', { width: '100px' }],
|
|
11
|
+
]);
|
|
12
|
+
function getItemStyle(item) {
|
|
13
|
+
const style = { ...defaultStyles.get(item.type) };
|
|
14
|
+
style.display = item.hidden ? 'none' : null;
|
|
15
|
+
if (item.width)
|
|
16
|
+
style.width = dom.numToPixels(item.width);
|
|
17
|
+
if (item.gap)
|
|
18
|
+
style.marginLeft = dom.numToPixels(item.gap);
|
|
19
|
+
return style;
|
|
20
|
+
}
|
|
21
|
+
export const renderers = new Map([
|
|
22
|
+
['button', (item) => html `
|
|
23
|
+
<og-toolbar-button
|
|
24
|
+
data-id="${item.id}"
|
|
25
|
+
class="control"
|
|
26
|
+
.item="${item}"
|
|
27
|
+
style="${styleMap(getItemStyle(item))}">
|
|
28
|
+
</og-toolbar-button>
|
|
29
|
+
`],
|
|
30
|
+
['togglebutton', (item, value) => html `
|
|
31
|
+
<og-toolbar-button
|
|
32
|
+
data-id="${item.id}"
|
|
33
|
+
class="control"
|
|
34
|
+
.item="${item}"
|
|
35
|
+
type="toggle"
|
|
36
|
+
state="${value ? 'checked' : 'unchecked'}"
|
|
37
|
+
style="${styleMap(getItemStyle(item))}">
|
|
38
|
+
</og-toolbar-button>
|
|
39
|
+
`],
|
|
40
|
+
['dropdown', (item, value) => html `
|
|
41
|
+
<og-toolbar-dropdown
|
|
42
|
+
data-id="${item.id}"
|
|
43
|
+
class="control"
|
|
44
|
+
.item="${item}"
|
|
45
|
+
.value="${value}"
|
|
46
|
+
style="${styleMap(getItemStyle(item))}">
|
|
47
|
+
</og-toolbar-dropdown>
|
|
48
|
+
`],
|
|
49
|
+
['dropdown-custom', (item, value) => html `
|
|
50
|
+
<og-toolbar-customdropdown
|
|
51
|
+
data-id="${item.id}"
|
|
52
|
+
class="control"
|
|
53
|
+
.item="${item}"
|
|
54
|
+
.value="${value}"
|
|
55
|
+
style="${styleMap(getItemStyle(item))}">
|
|
56
|
+
</og-toolbar-customdropdown>
|
|
57
|
+
`],
|
|
58
|
+
['dropdown-button', (item) => html `
|
|
59
|
+
<og-toolbar-dropdownbutton
|
|
60
|
+
data-id="${item.id}"
|
|
61
|
+
class="control"
|
|
62
|
+
.item="${item}"
|
|
63
|
+
style="${styleMap(getItemStyle(item))}">
|
|
64
|
+
</og-toolbar-dropdownbutton>
|
|
65
|
+
`],
|
|
66
|
+
['dropdown-menu', (item) => html `
|
|
67
|
+
<og-toolbar-dropdownmenu
|
|
68
|
+
data-id="${item.id}"
|
|
69
|
+
class="control"
|
|
70
|
+
.item="${item}"
|
|
71
|
+
style="${styleMap(getItemStyle(item))}">
|
|
72
|
+
</og-toolbar-dropdownmenu>
|
|
73
|
+
`],
|
|
74
|
+
['color', (item, value) => html `
|
|
75
|
+
<og-toolbar-colorpicker
|
|
76
|
+
data-id="${item.id}"
|
|
77
|
+
class="control"
|
|
78
|
+
.item="${item}"
|
|
79
|
+
.value="${value}"
|
|
80
|
+
style="${styleMap(getItemStyle(item))}">
|
|
81
|
+
</og-toolbar-colorpicker>
|
|
82
|
+
`],
|
|
83
|
+
['text', (item, value) => html `
|
|
84
|
+
<og-toolbar-text
|
|
85
|
+
data-id="${item.id}"
|
|
86
|
+
class="control"
|
|
87
|
+
.item="${item}"
|
|
88
|
+
.value="${value}"
|
|
89
|
+
style="${styleMap(getItemStyle(item))}">
|
|
90
|
+
</og-toolbar-text>
|
|
91
|
+
`],
|
|
92
|
+
['label', (item, value) => html `
|
|
93
|
+
<label style="${styleMap(getItemStyle(item))}">${value}</label>
|
|
94
|
+
`],
|
|
95
|
+
]);
|
|
96
|
+
//# sourceMappingURL=renderers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../../src/ui/controls/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MA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AET,IAAI;aACH,KAAe;YAChB,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;;EAEtC,CAAC;IACF,CAAC,OAAO,EAAE,CAAC,IAAiB,EAAE,KAAe,EAAE,EAAE,CAAC,IAAI,CAAA;kBACrC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK;EACtD,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { dom } from \"@omegagrid/core\";\nimport { html } from \"lit\";\nimport { TemplateResult } from \"lit-html\";\nimport { StyleInfo, styleMap } from \"lit-html/directives/style-map.js\";\nimport { ToolbarItem, ToolbarItemType } from \"../../types\";\n\nconst defaultStyles = new Map<ToolbarItemType, StyleInfo>([\n\t['button', {}],\n\t['togglebutton', {}],\n\t['dropdown', {}],\n\t['dropdown-button', {width: '38px'}],\n\t['color', {width: '38px'}],\n\t['text', {width: '100px'}],\n]);\n\nfunction getItemStyle(item: ToolbarItem): StyleInfo {\n\tconst style: StyleInfo = {...defaultStyles.get(item.type)};\n\tstyle.display = item.hidden ? 'none' : null;\n\tif (item.width) style.width = dom.numToPixels(item.width);\n\tif (item.gap) style.marginLeft = dom.numToPixels(item.gap);\n\treturn style;\n}\n\nexport const renderers = new Map<ToolbarItemType, (item: ToolbarItem, value?: unknown) => TemplateResult<1>>([\n\t['button', (item: ToolbarItem) => html`\n\t\t<og-toolbar-button\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-button>\n\t`],\n\t['togglebutton', (item: ToolbarItem, value?: unknown) => html`\n\t\t<og-toolbar-button\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\ttype=\"toggle\"\n\t\t\tstate=\"${value ? 'checked' : 'unchecked'}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-button>\n\t`],\n\t['dropdown', (item: ToolbarItem, value?: unknown) => html`\n\t\t<og-toolbar-dropdown\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\t.value=\"${value as string}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-dropdown>\n\t`],\n\t['dropdown-custom', (item: ToolbarItem, value?: unknown) => html`\n\t\t<og-toolbar-customdropdown\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\t.value=\"${value as string}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-customdropdown>\n\t`],\n\t['dropdown-button', (item: ToolbarItem) => html`\n\t\t<og-toolbar-dropdownbutton\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-dropdownbutton>\n\t`],\n\t['dropdown-menu', (item: ToolbarItem) => html`\n\t\t<og-toolbar-dropdownmenu\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-dropdownmenu>\n\t`],\n\t['color', (item: ToolbarItem, value?: unknown) => html`\n\t\t<og-toolbar-colorpicker\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\t.value=\"${value as string}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-colorpicker>\n\t`],\n\t['text', (item: ToolbarItem, value?: unknown) => html`\n\t\t<og-toolbar-text\n\t\t\tdata-id=\"${item.id}\"\n\t\t\tclass=\"control\"\n\t\t\t.item=\"${item}\"\n\t\t\t.value=\"${value as string}\"\n\t\t\tstyle=\"${styleMap(getItemStyle(item))}\">\n\t\t</og-toolbar-text>\n\t`],\n\t['label', (item: ToolbarItem, value?: unknown) => html`\n\t\t<label style=\"${styleMap(getItemStyle(item))}\">${value}</label>\n\t`],\n]);"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Button } from '@omegagrid/core';
|
|
2
|
+
import { ToolbarItem } from '../../types';
|
|
3
|
+
export declare class ToolbarButton extends Button {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
item: ToolbarItem;
|
|
6
|
+
constructor();
|
|
7
|
+
firstUpdated(): void;
|
|
8
|
+
willUpdate(changedProps: Map<PropertyKey, undefined>): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=toolbarButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarButton.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,iBAAiB,CAAC;AAIrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,qBACa,aAAc,SAAQ,MAAM;IAExC,MAAM,CAAC,MAAM,4BAOV;IAGH,IAAI,EAAE,WAAW,CAAC;;IAOlB,YAAY;IAUZ,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC;CAepD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { Button, ColorTypes } from '@omegagrid/core';
|
|
8
|
+
import constants from '../../constants';
|
|
9
|
+
import { css, render, html } from 'lit';
|
|
10
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
11
|
+
import { actions } from '@omegagrid/core';
|
|
12
|
+
let ToolbarButton = class ToolbarButton extends Button {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.color = null;
|
|
16
|
+
}
|
|
17
|
+
firstUpdated() {
|
|
18
|
+
this.addEventListener('click', () => {
|
|
19
|
+
actions.dispatchActionEvent(this, 'toolbar', {
|
|
20
|
+
type: 'change',
|
|
21
|
+
key: this.item.id,
|
|
22
|
+
value: this.type == 'toggle' ? (this.state == 'checked') : this.item.value
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
willUpdate(changedProps) {
|
|
27
|
+
if (changedProps.has('item') && this.item) {
|
|
28
|
+
this.icon = this.item.icon;
|
|
29
|
+
this.text = this.item.text;
|
|
30
|
+
this.color = this.item.color ? this.item.color : (this.type == 'normal' ? ColorTypes.Gray : ColorTypes.Accent);
|
|
31
|
+
this.disabled = this.item.disabled || false;
|
|
32
|
+
if (this.item.content) {
|
|
33
|
+
render(html `<div slot="content">${this.item.content}</div>`, this);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
super.willUpdate(changedProps);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
ToolbarButton.styles = [...Button.styles, css `
|
|
40
|
+
:host {
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
display: block;
|
|
43
|
+
min-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
44
|
+
height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
45
|
+
}
|
|
46
|
+
`];
|
|
47
|
+
__decorate([
|
|
48
|
+
property({ type: Object })
|
|
49
|
+
], ToolbarButton.prototype, "item", void 0);
|
|
50
|
+
ToolbarButton = __decorate([
|
|
51
|
+
customElement('og-toolbar-button')
|
|
52
|
+
], ToolbarButton);
|
|
53
|
+
export { ToolbarButton };
|
|
54
|
+
//# sourceMappingURL=toolbarButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarButton.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarButton.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGnC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,MAAM;IAcxC;QACC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,YAAY;QACX,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE;YACnC,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE;gBAC5C,IAAI,EAAE,QAAQ;gBACd,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;gBACjB,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;aAC1E,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,UAAU,CAAC,YAAyC;QACnD,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC/G,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC;YAE5C,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACvB,MAAM,CAAC,IAAI,CAAA,uBAAuB,IAAI,CAAC,IAAI,CAAC,OAAO,QAAQ,EAAE,IAAI,CAAC,CAAC;YACpE,CAAC;QACF,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;;AAxCM,oBAAM,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAA;;;;gBAIvB,SAAS,CAAC,2BAA2B;aACxC,SAAS,CAAC,2BAA2B;;EAEhD,CAAC,AAPW,CAOV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACP;AAZN,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CA4CzB","sourcesContent":["import { Button, ColorTypes } from '@omegagrid/core';\nimport constants from '../../constants';\nimport { css, render, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ToolbarItem } from '../../types';\nimport { actions } from '@omegagrid/core';\n\n@customElement('og-toolbar-button')\nexport class ToolbarButton extends Button {\n\n\tstatic styles = [...Button.styles, css`\n\t\t:host {\n\t\t\tbox-sizing: border-box;\n\t\t\tdisplay: block;\n\t\t\tmin-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t\theight: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\titem: ToolbarItem;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.color = null;\n\t}\n\n\tfirstUpdated() {\n\t\tthis.addEventListener('click', () => {\n\t\t\tactions.dispatchActionEvent(this, 'toolbar', {\n\t\t\t\ttype: 'change',\n\t\t\t\tkey: this.item.id,\n\t\t\t\tvalue: this.type == 'toggle' ? (this.state == 'checked') : this.item.value\n\t\t\t});\n\t\t});\n\t}\n\n\twillUpdate(changedProps: Map<PropertyKey, undefined>) {\n\t\tif (changedProps.has('item') && this.item) {\n\t\t\tthis.icon = this.item.icon;\n\t\t\tthis.text = this.item.text;\n\t\t\tthis.color = this.item.color ? this.item.color : (this.type == 'normal' ? ColorTypes.Gray : ColorTypes.Accent);\n\t\t\tthis.disabled = this.item.disabled || false;\n\n\t\t\tif (this.item.content) {\n\t\t\t\trender(html`<div slot=\"content\">${this.item.content}</div>`, this);\n\t\t\t}\n\t\t}\n\t\n\t\tsuper.willUpdate(changedProps);\n\t}\n\n}"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { ToolbarItem } from '../../types';
|
|
3
|
+
import { Button, ColorPickerEvent, Dropdown, events } from '@omegagrid/core';
|
|
4
|
+
export declare class ToolbarColorPicker extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
item: ToolbarItem;
|
|
7
|
+
value: string;
|
|
8
|
+
dropdown: Dropdown;
|
|
9
|
+
button: Button;
|
|
10
|
+
btnContent: HTMLDivElement;
|
|
11
|
+
_onChange: (e: events.ChangeEvent<string>) => void;
|
|
12
|
+
_onPreview: (e: ColorPickerEvent) => void;
|
|
13
|
+
_onPreviewEnd: (e: ColorPickerEvent) => void;
|
|
14
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=toolbarColorPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarColorPicker.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarColorPicker.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,UAAU,EAAQ,MAAM,KAAK,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG7E,qBACa,kBAAmB,SAAQ,UAAU;IAEjD,MAAM,CAAC,MAAM,4BAmCV;IAGH,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,QAAQ,CAAC;IAGnB,MAAM,EAAE,MAAM,CAAC;IAGf,UAAU,EAAE,cAAc,CAAC;IAE3B,SAAS,GAAI,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAIzC;IAED,UAAU,GAAI,GAAG,gBAAgB,UAGhC;IAED,aAAa,GAAI,GAAG,gBAAgB,UAGnC;IAED,MAAM,6CAyBJ;CAEF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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 constants from '../../constants';
|
|
8
|
+
import { css, LitElement, html } from 'lit';
|
|
9
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
10
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
|
+
import { actions } from '@omegagrid/core';
|
|
12
|
+
let ToolbarColorPicker = class ToolbarColorPicker extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this._onChange = (e) => {
|
|
16
|
+
this.button.style.backgroundColor = e.value;
|
|
17
|
+
actions.dispatchActionEvent(this, 'toolbar', { type: 'select', key: this.item.id, value: e.value });
|
|
18
|
+
this.dropdown.close();
|
|
19
|
+
};
|
|
20
|
+
this._onPreview = (e) => {
|
|
21
|
+
this.button.style.backgroundColor = e.color;
|
|
22
|
+
actions.dispatchActionEvent(this, 'toolbar', { type: 'preview', key: this.item.id, value: e.color });
|
|
23
|
+
};
|
|
24
|
+
this._onPreviewEnd = (e) => {
|
|
25
|
+
this.button.style.backgroundColor = e.color;
|
|
26
|
+
actions.dispatchActionEvent(this, 'toolbar', { type: 'previewEnd', key: this.item.id, value: e.color });
|
|
27
|
+
};
|
|
28
|
+
this.render = () => html `
|
|
29
|
+
<og-button
|
|
30
|
+
mode="toggle"
|
|
31
|
+
color="gray"
|
|
32
|
+
style="${styleMap({ backgroundColor: this.value })}"
|
|
33
|
+
?disabled="${!!this.item.disabled}">
|
|
34
|
+
<div class="btn-content" slot="content">
|
|
35
|
+
${this.item.icon ? html `<og-icon .icon="${this.item.icon}"></og-icon>` : ``}
|
|
36
|
+
</div>
|
|
37
|
+
</og-button>
|
|
38
|
+
|
|
39
|
+
<og-dropdown
|
|
40
|
+
style="min-width: 14px; flex: 0"
|
|
41
|
+
color="gray"
|
|
42
|
+
alignment="left"
|
|
43
|
+
?disabled="${!!this.item.disabled}"
|
|
44
|
+
.positionOffset="${-constants.TOOLBAR_COMPONENT_SIZE_BASE}">
|
|
45
|
+
<og-colorpicker
|
|
46
|
+
slot="content"
|
|
47
|
+
@change="${this._onChange}"
|
|
48
|
+
@preview="${this._onPreview}"
|
|
49
|
+
@previewEnd="${this._onPreviewEnd}"
|
|
50
|
+
@mousedown="${(e) => e.stopPropagation()}">
|
|
51
|
+
</og-colorpicker>
|
|
52
|
+
</og-dropdown>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
ToolbarColorPicker.styles = [css `
|
|
57
|
+
:host {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
max-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
og-button {
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
display: block;
|
|
66
|
+
width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
67
|
+
height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
68
|
+
max-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
69
|
+
min-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
70
|
+
line-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
71
|
+
padding: 0;
|
|
72
|
+
flex: 0;
|
|
73
|
+
border-top-right-radius: 0;
|
|
74
|
+
border-bottom-right-radius: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.btn-content {
|
|
78
|
+
text-align: center;
|
|
79
|
+
margin-left: 1px;
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
og-button+og-dropdown {
|
|
86
|
+
border-top-left-radius: 0;
|
|
87
|
+
border-bottom-left-radius: 0;
|
|
88
|
+
border-left: none;
|
|
89
|
+
height: 100%;
|
|
90
|
+
}
|
|
91
|
+
`];
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: Object })
|
|
94
|
+
], ToolbarColorPicker.prototype, "item", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ type: String })
|
|
97
|
+
], ToolbarColorPicker.prototype, "value", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
query('og-dropdown')
|
|
100
|
+
], ToolbarColorPicker.prototype, "dropdown", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
query('og-button')
|
|
103
|
+
], ToolbarColorPicker.prototype, "button", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
query('.btn-content')
|
|
106
|
+
], ToolbarColorPicker.prototype, "btnContent", void 0);
|
|
107
|
+
ToolbarColorPicker = __decorate([
|
|
108
|
+
customElement('og-toolbar-colorpicker')
|
|
109
|
+
], ToolbarColorPicker);
|
|
110
|
+
export { ToolbarColorPicker };
|
|
111
|
+
//# sourceMappingURL=toolbarColorPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarColorPicker.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarColorPicker.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGnC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAsDN,cAAS,GAAG,CAAC,CAA6B,EAAE,EAAE;YAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC;YAC5C,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC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C,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;;;EAGtD,CAAC;IAEH,CAAC;;AA/FO,yBAAM,GAAG,CAAC,GAAG,CAAA;;;;iBAIJ,SAAS,CAAC,2BAA2B;;;;;;YAM1C,SAAS,CAAC,2BAA2B;aACpC,SAAS,CAAC,2BAA2B;iBACjC,SAAS,CAAC,2BAA2B;gBACtC,SAAS,CAAC,2BAA2B;kBACnC,SAAS,CAAC,2BAA2B;;;;;;;;;;;;;;;;;;;;;EAqBrD,CAAC,AAnCW,CAmCV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;gDACP;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;iDACX;AAGd;IADC,KAAK,CAAC,aAAa,CAAC;oDACF;AAGnB;IADC,KAAK,CAAC,WAAW,CAAC;kDACJ;AAGf;IADC,KAAK,CAAC,cAAc,CAAC;sDACK;AApDf,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CAiG9B","sourcesContent":["import constants from '../../constants';\nimport { css, LitElement, html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { ToolbarItem } from '../../types';\nimport { Button, ColorPickerEvent, Dropdown, events } from '@omegagrid/core';\nimport { actions } from '@omegagrid/core';\n\n@customElement('og-toolbar-colorpicker')\nexport class ToolbarColorPicker extends LitElement {\n\n\tstatic styles = [css`\n\t\t:host {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\tmax-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t}\n\n\t\tog-button {\n\t\t\tbox-sizing: border-box;\n\t\t\tdisplay: block;\n\t\t\twidth: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t\theight: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t\tmax-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t\tmin-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t\tline-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t\tpadding: 0;\n\t\t\tflex: 0;\n\t\t\tborder-top-right-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t}\n\n\t\t.btn-content {\n\t\t\ttext-align: center;\n\t\t\tmargin-left: 1px;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t}\n\n\t\tog-button+og-dropdown {\n\t\t\tborder-top-left-radius: 0;\n\t\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-left: none;\n\t\t\theight: 100%;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\titem: ToolbarItem;\n\n\t@property({type: String})\n\tvalue: string;\n\n\t@query('og-dropdown')\n\tdropdown: Dropdown;\n\n\t@query('og-button')\n\tbutton: Button;\n\n\t@query('.btn-content')\n\tbtnContent: HTMLDivElement;\n\n\t_onChange = (e: events.ChangeEvent<string>) => {\n\t\tthis.button.style.backgroundColor = e.value;\n\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'select', key: this.item.id, value: e.value});\n\t\tthis.dropdown.close();\n\t}\n\n\t_onPreview = (e: ColorPickerEvent) => {\n\t\tthis.button.style.backgroundColor = e.color;\n\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'preview', key: this.item.id, value: e.color});\n\t}\n\n\t_onPreviewEnd = (e: ColorPickerEvent) => {\n\t\tthis.button.style.backgroundColor = e.color;\n\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'previewEnd', key: this.item.id, value: e.color});\n\t}\n\t\n\trender = () => html`\n\t\t<og-button \n\t\t\tmode=\"toggle\"\n\t\t\tcolor=\"gray\"\n\t\t\tstyle=\"${styleMap({backgroundColor: this.value})}\"\n\t\t\t?disabled=\"${!!this.item.disabled}\">\n\t\t\t<div class=\"btn-content\" slot=\"content\">\n\t\t\t\t${this.item.icon ? html`<og-icon .icon=\"${this.item.icon}\"></og-icon>` : ``}\n\t\t\t</div>\n\t\t</og-button>\n\n\t\t<og-dropdown\n\t\t\tstyle=\"min-width: 14px; flex: 0\"\n\t\t\tcolor=\"gray\"\n\t\t\talignment=\"left\"\n\t\t\t?disabled=\"${!!this.item.disabled}\"\n\t\t\t.positionOffset=\"${-constants.TOOLBAR_COMPONENT_SIZE_BASE}\">\n\t\t\t<og-colorpicker\n\t\t\t\tslot=\"content\"\n\t\t\t\t@change=\"${this._onChange}\"\n\t\t\t\t@preview=\"${this._onPreview}\"\n\t\t\t\t@previewEnd=\"${this._onPreviewEnd}\"\n\t\t\t\t@mousedown=\"${(e: MouseEvent) => e.stopPropagation()}\">\n\t\t\t</og-colorpicker>\n\t\t</og-dropdown>\n\t`;\n\n}"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dropdown } from '@omegagrid/core';
|
|
2
|
+
import { ToolbarItem } from '../../types';
|
|
3
|
+
export declare class ToolbarCustomDropdown extends Dropdown {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
item: ToolbarItem;
|
|
6
|
+
value: string;
|
|
7
|
+
willUpdate(props: Map<string, unknown>): void;
|
|
8
|
+
getComponent(): Promise<HTMLElement>;
|
|
9
|
+
open(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=toolbarCustomDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarCustomDropdown.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarCustomDropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAIpE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,qBACa,qBAAsB,SAAQ,QAAQ;IAElD,MAAM,CAAC,MAAM,4BAMV;IAGH,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAEd,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAShC,YAAY;IAaZ,IAAI;CASV"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { ColorTypes, dom, Dropdown } from '@omegagrid/core';
|
|
8
|
+
import constants from '../../constants';
|
|
9
|
+
import { css } from 'lit';
|
|
10
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
11
|
+
import { actions } from '@omegagrid/core';
|
|
12
|
+
let ToolbarCustomDropdown = class ToolbarCustomDropdown extends Dropdown {
|
|
13
|
+
willUpdate(props) {
|
|
14
|
+
super.willUpdate(props);
|
|
15
|
+
this.style.width = dom.numToPixels(this.item.width || (this.item.text ? null : 23));
|
|
16
|
+
this.style.textAlign = this.item.text ? 'left' : 'center';
|
|
17
|
+
this.icon = this.item.icon;
|
|
18
|
+
this.color = ColorTypes.Gray;
|
|
19
|
+
this.noCaret = true;
|
|
20
|
+
}
|
|
21
|
+
async getComponent() {
|
|
22
|
+
if (!this.item.createComponent)
|
|
23
|
+
return null;
|
|
24
|
+
const component = await this.item.createComponent(this.item.id, this.value);
|
|
25
|
+
component.slot = 'inner-content';
|
|
26
|
+
component.addEventListener('change', (e) => {
|
|
27
|
+
this.close();
|
|
28
|
+
actions.dispatchActionEvent(this, 'toolbar', { type: 'select', key: this.item.id, value: e.value });
|
|
29
|
+
});
|
|
30
|
+
return component;
|
|
31
|
+
}
|
|
32
|
+
async open() {
|
|
33
|
+
const component = await this.getComponent();
|
|
34
|
+
if (component.parentElement != this.dropdown) {
|
|
35
|
+
dom.empty(this.dropdown);
|
|
36
|
+
this.dropdown.appendChild(component);
|
|
37
|
+
}
|
|
38
|
+
await super.open();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
ToolbarCustomDropdown.styles = [...Dropdown.styles, css `
|
|
42
|
+
:host {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
|
|
46
|
+
}
|
|
47
|
+
`];
|
|
48
|
+
__decorate([
|
|
49
|
+
property({ type: Object })
|
|
50
|
+
], ToolbarCustomDropdown.prototype, "item", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
property({ type: String })
|
|
53
|
+
], ToolbarCustomDropdown.prototype, "value", void 0);
|
|
54
|
+
ToolbarCustomDropdown = __decorate([
|
|
55
|
+
customElement('og-toolbar-customdropdown')
|
|
56
|
+
], ToolbarCustomDropdown);
|
|
57
|
+
export { ToolbarCustomDropdown };
|
|
58
|
+
//# sourceMappingURL=toolbarCustomDropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarCustomDropdown.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarCustomDropdown.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AACpE,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGnC,IAAM,qBAAqB,GAA3B,M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CAAC;IAED,KAAK,CAAC,IAAI;QACT,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5C,IAAI,SAAS,CAAC,aAAa,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC9C,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;;AA3CM,4BAAM,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAA;;;;aAI5B,SAAS,CAAC,2BAA2B;;EAEhD,CAAC,AANW,CAMV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACP;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;oDACX;AAdF,qBAAqB;IADjC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,qBAAqB,CA+CjC","sourcesContent":["import { ColorTypes, dom, Dropdown, events } from '@omegagrid/core';\nimport constants from '../../constants';\nimport { css } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ToolbarItem } from '../../types';\nimport { actions } from '@omegagrid/core';\n\n@customElement('og-toolbar-customdropdown')\nexport class ToolbarCustomDropdown extends Dropdown {\n\n\tstatic styles = [...Dropdown.styles, css`\n\t\t:host {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\theight: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\titem: ToolbarItem;\n\n\t@property({type: String})\n\tvalue: string;\n\n\twillUpdate(props: Map<string, unknown>) {\n\t\tsuper.willUpdate(props);\n\t\tthis.style.width = dom.numToPixels(this.item.width || (this.item.text ? null : 23));\n\t\tthis.style.textAlign = this.item.text ? 'left' : 'center';\n\t\tthis.icon = this.item.icon;\n\t\tthis.color = ColorTypes.Gray;\n\t\tthis.noCaret = true;\n\t}\n\n\tasync getComponent() {\n\t\tif (!this.item.createComponent) return null;\n\t\tconst component = await this.item.createComponent(this.item.id, this.value);\n\t\tcomponent.slot = 'inner-content';\n\n\t\tcomponent.addEventListener('change', (e: events.ChangeEvent) => {\n\t\t\tthis.close();\n\t\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'select', key: this.item.id, value: e.value});\n\t\t});\n\n\t\treturn component;\n\t}\n\n\tasync open() {\n\t\tconst component = await this.getComponent();\n\t\tif (component.parentElement != this.dropdown) {\n\t\t\tdom.empty(this.dropdown);\n\t\t\tthis.dropdown.appendChild(component);\n\t\t}\n\t\tawait super.open();\n\t}\n\n}"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { ToolbarItem } from '../../types';
|
|
3
|
+
import { SerializedValue, TreeDropdown } from '@omegagrid/tree';
|
|
4
|
+
export declare class ToolbarDropdown extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
tree: TreeDropdown;
|
|
7
|
+
item: ToolbarItem;
|
|
8
|
+
value: string;
|
|
9
|
+
updated(): void;
|
|
10
|
+
_onChange: () => void;
|
|
11
|
+
getValue(): (string & any[]) | SerializedValue[];
|
|
12
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=toolbarDropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarDropdown.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAA0B,eAAe,EAAe,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGrG,qBACa,eAAgB,SAAQ,UAAU;IAE9C,MAAM,CAAC,MAAM,4BAUV;IAGH,IAAI,EAAE,YAAY,CAAC;IAGnB,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO;IAaP,SAAS,aASR;IAED,QAAQ;IAMR,MAAM,6CAUJ;CAEF"}
|