@omegagrid/toolbar 0.6.105 → 0.6.106

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.
@@ -1 +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,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGrE,qBACa,kBAAmB,SAAQ,UAAU;IAEjD,MAAM,CAAC,MAAM,4BAiCV;IAGH,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,QAAQ,CAAC;IAGnB,UAAU,EAAE,cAAc,CAAC;IAE3B,SAAS,MAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAIzC;IAED,UAAU,MAAO,gBAAgB,UAGhC;IAED,aAAa,MAAO,gBAAgB,UAGnC;IAED,MAAM,6CAmBJ;CAEF"}
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,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGrE,qBACa,kBAAmB,SAAQ,UAAU;IAEjD,MAAM,CAAC,MAAM,4BAkCV;IAGH,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,QAAQ,CAAC;IAGnB,UAAU,EAAE,cAAc,CAAC;IAE3B,SAAS,MAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAIzC;IAED,UAAU,MAAO,gBAAgB,UAGhC;IAED,aAAa,MAAO,gBAAgB,UAGnC;IAED,MAAM,6CAmBJ;CAEF"}
@@ -79,6 +79,7 @@ ToolbarColorPicker.styles = [css `
79
79
  og-button+og-dropdown {
80
80
  border-top-left-radius: 0;
81
81
  border-bottom-left-radius: 0;
82
+ border-left: none;
82
83
  }
83
84
  `];
84
85
  __decorate([
@@ -1 +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;;QAiDN,cAAS,GAAG,CAAC,CAA6B,EAAE,EAAE;YAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC;YAChD,OAAO,CAAC,mBAAmB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAC,CAAC,CAAC;YAClG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC,CAAA;QAED,eAAU,GAAG,CAAC,CAAmB,EAAE,EAAE;YACpC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,GAAG,CAAC,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;;;;;EAmBrD,CAAC,AAjCW,CAiCV;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,aAAa,CAAC;sDACM;AA/Cf,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CAsF9B","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 { 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#btnContent {\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t\tmargin-left: 1px;\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}\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('#btnContent')\n\tbtnContent: HTMLDivElement;\n\n\t_onChange = (e: events.ChangeEvent<string>) => {\n\t\tthis.btnContent.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.btnContent.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.btnContent.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 mode=\"toggle\" color=\"gray\">\n\t\t\t<div id=\"btnContent\" slot=\"content\" style=\"${styleMap({backgroundColor: this.value})}\">\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\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\tpositionOffset=\"${-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>\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C,wBAAwB,CAAC;GAC3B,kBAAkB,CAuF9B","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 { 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#btnContent {\n\t\t\twidth: 20px;\n\t\t\theight: 20px;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t\tmargin-left: 1px;\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}\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('#btnContent')\n\tbtnContent: HTMLDivElement;\n\n\t_onChange = (e: events.ChangeEvent<string>) => {\n\t\tthis.btnContent.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.btnContent.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.btnContent.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 mode=\"toggle\" color=\"gray\">\n\t\t\t<div id=\"btnContent\" slot=\"content\" style=\"${styleMap({backgroundColor: this.value})}\">\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\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\tpositionOffset=\"${-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}"]}
@@ -3,10 +3,13 @@ import { LitElement } from 'lit';
3
3
  import { ToolbarItem } from '../../types';
4
4
  import { ToolbarGrid } from './toolbarGrid';
5
5
  import { ToolbarButton } from './toolbarButton';
6
+ import { Tree } from '@omegagrid/tree';
6
7
  export declare class ToolbarDropdownButton extends LitElement {
7
8
  static styles: import("lit").CSSResult[];
8
9
  gridRef: import("lit-html/directives/ref.js").Ref<ToolbarGrid>;
9
10
  get grid(): ToolbarGrid;
11
+ treeRef: import("lit-html/directives/ref.js").Ref<Tree>;
12
+ get tree(): Tree;
10
13
  dropdownRef: import("lit-html/directives/ref.js").Ref<Dropdown>;
11
14
  get dropdown(): Dropdown;
12
15
  button: ToolbarButton;
@@ -15,6 +18,7 @@ export declare class ToolbarDropdownButton extends LitElement {
15
18
  mode: 'dropdown' | 'button';
16
19
  willUpdate(): void;
17
20
  firstUpdated(): void;
21
+ get isGridDropdown(): boolean;
18
22
  render: () => import("lit-html").TemplateResult<1>;
19
23
  }
20
24
  //# sourceMappingURL=toolbarDropdownButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbarDropdownButton.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdownButton.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,qBACa,qBAAsB,SAAQ,UAAU;IAEpD,MAAM,CAAC,MAAM,4BA0BV;IAEH,OAAO,wDAA4B;IACnC,IAAI,IAAI,gBAAgC;IAExC,WAAW,qDAAyB;IACpC,IAAI,QAAQ,aAAoC;IAGhD,MAAM,EAAE,aAAa,CAAC;IAGtB,IAAI,EAAE,WAAW,CAAC;IAGlB,WAAW,EAAE,WAAW,CAAC;IAGzB,IAAI,EAAE,UAAU,GAAC,QAAQ,CAAY;IAErC,UAAU;IAYV,YAAY;IAiCZ,MAAM,6CAqBJ;CAEF"}
1
+ {"version":3,"file":"toolbarDropdownButton.d.ts","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdownButton.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAyB,MAAM,iBAAiB,CAAC;AAE9D,qBACa,qBAAsB,SAAQ,UAAU;IAEpD,MAAM,CAAC,MAAM,4BAqBV;IAEH,OAAO,wDAA4B;IACnC,IAAI,IAAI,gBAAgC;IAExC,OAAO,iDAAqB;IAC5B,IAAI,IAAI,SAAgC;IAExC,WAAW,qDAAyB;IACpC,IAAI,QAAQ,aAAoC;IAGhD,MAAM,EAAE,aAAa,CAAC;IAGtB,IAAI,EAAE,WAAW,CAAC;IAGlB,WAAW,EAAE,WAAW,CAAC;IAGzB,IAAI,EAAE,UAAU,GAAC,QAAQ,CAAY;IAErC,UAAU;IAYV,YAAY;IAgDZ,IAAI,cAAc,YAEjB;IAED,MAAM,6CAyBJ;CAEF"}
@@ -14,32 +14,38 @@ let ToolbarDropdownButton = class ToolbarDropdownButton extends LitElement {
14
14
  constructor() {
15
15
  super(...arguments);
16
16
  this.gridRef = createRef();
17
+ this.treeRef = createRef();
17
18
  this.dropdownRef = createRef();
18
19
  this.mode = 'button';
19
20
  this.render = () => html `
20
21
  ${this.mode == 'button' ? html `
21
22
  <og-toolbar-button
22
- mode="toggle"
23
- style="min-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px; flex: 0"
24
- color="gray"
25
- .item="${this.currentItem}">
23
+ .item="${this.isGridDropdown ? this.currentItem : this.item}">
26
24
  </og-toolbar-button>
27
25
  ` : null}
28
26
 
29
27
  <og-dropdown ${ref(this.dropdownRef)}
30
- style="min-width: 14px; flex: 0"
31
- color="gray"
32
- alignment="left"
28
+ .alignment="${this.isGridDropdown ? "left" : "right"}"
29
+ .width="${this.isGridDropdown ? 0 : this.item.width}"
30
+ .color="${this.item.color || 'gray'}"
33
31
  .icon="${this.mode == 'button' ? null : this.item.icon}"
34
- positionOffset="${-constants.TOOLBAR_COMPONENT_SIZE_BASE}">
35
- <og-toolbar-grid ${ref(this.gridRef)}
36
- slot="content"
37
- .items="${this.item.items}">
38
- </og-toolbar-grid>
32
+ .positionOffset="${this.isGridDropdown ? -constants.TOOLBAR_COMPONENT_SIZE_BASE : 0}">
33
+ ${this.isGridDropdown ? html `
34
+ <og-toolbar-grid ${ref(this.gridRef)}
35
+ slot="content"
36
+ .items="${this.item.items}">
37
+ </og-toolbar-grid>
38
+ ` : html `
39
+ <og-tree ${ref(this.treeRef)}
40
+ maxHeight="300"
41
+ slot="content">
42
+ </og-tree>
43
+ `}
39
44
  </og-dropdown>
40
45
  `;
41
46
  }
42
47
  get grid() { return this.gridRef.value; }
48
+ get tree() { return this.treeRef.value; }
43
49
  get dropdown() { return this.dropdownRef.value; }
44
50
  willUpdate() {
45
51
  if (!this.currentItem && this.item?.items) {
@@ -53,31 +59,49 @@ let ToolbarDropdownButton = class ToolbarDropdownButton extends LitElement {
53
59
  }
54
60
  }
55
61
  firstUpdated() {
56
- dom.on(this.grid, 'click', 'og-toolbar-button', (e, elm) => {
57
- this.currentItem = elm.item;
58
- this.dropdown.close();
59
- });
60
- let previewId = null;
61
- dom.on(this.grid, 'mousemove', 'og-toolbar-button', (_e, elm) => {
62
- if (previewId != elm.item.id) {
63
- previewId = elm.item.id;
64
- actions.dispatchActionEvent(this, 'toolbar', { type: 'preview', key: elm.item.id, value: elm.item.value });
65
- }
66
- });
67
- this.grid.addEventListener('mouseleave', () => {
68
- actions.dispatchActionEvent(this, 'toolbar', { type: 'previewEnd', key: previewId, value: null });
69
- previewId = null;
70
- });
71
- this.grid.addEventListener('toolbar.action', (e) => {
72
- actions.dispatchActionEvent(this, 'toolbar', e.action);
73
- });
62
+ if (this.grid) {
63
+ dom.on(this.grid, 'click', 'og-toolbar-button', (e, elm) => {
64
+ this.currentItem = elm.item;
65
+ this.dropdown.close();
66
+ });
67
+ let previewId = null;
68
+ dom.on(this.grid, 'mousemove', 'og-toolbar-button', (_e, elm) => {
69
+ if (previewId != elm.item.id) {
70
+ previewId = elm.item.id;
71
+ actions.dispatchActionEvent(this, 'toolbar', { type: 'preview', key: elm.item.id, value: elm.item.value });
72
+ }
73
+ });
74
+ this.grid.addEventListener('mouseleave', () => {
75
+ actions.dispatchActionEvent(this, 'toolbar', { type: 'previewEnd', key: previewId, value: null });
76
+ previewId = null;
77
+ });
78
+ this.grid.addEventListener('toolbar.action', (e) => {
79
+ actions.dispatchActionEvent(this, 'toolbar', e.action);
80
+ });
81
+ }
82
+ else {
83
+ this.tree.setSourceData((this.item.items || []), {
84
+ checkboxes: false
85
+ });
86
+ this.tree.addEventListener('select', (e) => {
87
+ this.dropdown.close();
88
+ actions.dispatchActionEvent(this, 'toolbar', { type: 'select', key: e.node.key, value: e.node.value });
89
+ });
90
+ }
74
91
  this.button?.addEventListener('click', () => {
75
- actions.dispatchActionEvent(this, 'toolbar', { type: 'select', key: this.currentItem.id, value: this.currentItem.value });
92
+ actions.dispatchActionEvent(this, 'toolbar', {
93
+ type: 'select',
94
+ key: (this.currentItem || this.item).id,
95
+ value: (this.currentItem || this.item).value
96
+ });
76
97
  });
77
98
  this.dropdown.addEventListener('mousedown', e => {
78
99
  e.stopPropagation();
79
100
  });
80
101
  }
102
+ get isGridDropdown() {
103
+ return this.item?.items && Array.isArray(this.item.items[0]) && this.item.items[0].length > 1;
104
+ }
81
105
  };
82
106
  ToolbarDropdownButton.styles = [css `
83
107
  :host {
@@ -87,23 +111,18 @@ ToolbarDropdownButton.styles = [css `
87
111
  }
88
112
 
89
113
  og-toolbar-button {
114
+ flex: 1;
90
115
  border-top-right-radius: 0;
91
116
  border-bottom-right-radius: 0;
117
+ min-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
92
118
  }
93
119
 
94
120
  og-toolbar-button+og-dropdown {
121
+ flex: 0 0 14px;
122
+ max-width: 14px;
95
123
  border-top-left-radius: 0;
96
124
  border-bottom-left-radius: 0;
97
- }
98
-
99
- og-button {
100
- box-sizing: border-box;
101
- display: block;
102
- width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
103
- height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
104
- max-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
105
- line-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;
106
- padding: 0;
125
+ border-left: none;
107
126
  }
108
127
  `];
109
128
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"toolbarDropdownButton.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdownButton.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGnC,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QA8BN,YAAO,GAAG,SAAS,EAAe,CAAC;QAGnC,gBAAW,GAAG,SAAS,EAAY,CAAC;QAapC,SAAI,GAAwB,QAAQ,CAAC;QA+CrC,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;IAChB,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;;;wBAGR,SAAS,CAAC,2BAA2B;;aAEhD,IAAI,CAAC,WAAW;;GAE1B,CAAC,CAAC,CAAC,IAAI;;iBAEO,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,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,EAAC,CAAC,CAAC;QACzH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE;YAC/C,CAAC,CAAC,eAAe,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACJ,CAAC;;AAzFM,4BAAM,GAAG,CAAC,GAAG,CAAA;;;;iBAIJ,SAAS,CAAC,2BAA2B;;;;;;;;;;;;;;;;YAgB1C,SAAS,CAAC,2BAA2B;aACpC,SAAS,CAAC,2BAA2B;iBACjC,SAAS,CAAC,2BAA2B;kBACpC,SAAS,CAAC,2BAA2B;;;EAGrD,CAAC,AA1BW,CA0BV;AASH;IADC,KAAK,CAAC,mBAAmB,CAAC;qDACL;AAGtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACP;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0DACA;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACY;AA9CzB,qBAAqB;IADjC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,qBAAqB,CAoHjC","sourcesContent":["import constants from '../../constants';\nimport { dom, Dropdown } from '@omegagrid/core';\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ToolbarItem } from '../../types';\nimport { ToolbarGrid } from './toolbarGrid';\nimport { createRef, ref } from 'lit-html/directives/ref.js';\nimport { ToolbarButton } from './toolbarButton';\nimport { actions } from '@omegagrid/core';\n\n@customElement('og-toolbar-dropdownbutton')\nexport class ToolbarDropdownButton 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-toolbar-button {\n\t\t\tborder-top-right-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t}\n\n\t\tog-toolbar-button+og-dropdown {\n\t\t\tborder-top-left-radius: 0;\n\t\t\tborder-bottom-left-radius: 0;\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\tline-height: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t\tpadding: 0;\n\t\t}\n\t`];\n\n\tgridRef = createRef<ToolbarGrid>();\n\tget grid() { return this.gridRef.value }\n\n\tdropdownRef = createRef<Dropdown>();\n\tget dropdown() { return this.dropdownRef.value }\n\n\t@query('og-toolbar-button')\n\tbutton: ToolbarButton;\n\n\t@property({type: Object})\n\titem: ToolbarItem;\n\n\t@property({type: Object})\n\tcurrentItem: ToolbarItem;\n\n\t@property({type: String})\n\tmode: 'dropdown'|'button' = 'button';\n\n\twillUpdate() {\n\t\tif (!this.currentItem && this.item?.items) {\n\t\t\tconst items = this.item.items as ToolbarItem[][];\n\t\t\tthis.currentItem = items.flatMap(row => row).find(item => item.default);\n\t\t\tif (!this.currentItem) this.currentItem = items[0][0];\n\t\t}\n\n\t\tif (this.item?.options?.mode) {\n\t\t\tthis.mode = this.item.options.mode as typeof this.mode;\n\t\t}\n\t}\n\n\tfirstUpdated() {\n\t\tdom.on(this.grid, 'click', 'og-toolbar-button', (e: PointerEvent, elm: ToolbarButton) => {\n\t\t\tthis.currentItem = elm.item;\n\t\t\tthis.dropdown.close();\n\t\t});\n\n\t\tlet previewId: string = null;\n\t\t\n\t\tdom.on(this.grid, 'mousemove', 'og-toolbar-button', (_e: MouseEvent, elm: ToolbarButton) => {\n\t\t\tif (previewId != elm.item.id) {\n\t\t\t\tpreviewId = elm.item.id;\n\t\t\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'preview', key: elm.item.id, value: elm.item.value});\n\t\t\t}\n\t\t});\n\n\t\tthis.grid.addEventListener('mouseleave', () => {\n\t\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'previewEnd', key: previewId, value: null});\n\t\t\tpreviewId = null;\n\t\t});\n\n\t\tthis.grid.addEventListener('toolbar.action', (e: actions.ActionEvent) => {\n\t\t\tactions.dispatchActionEvent(this, 'toolbar', e.action);\n\t\t});\n\n\t\tthis.button?.addEventListener('click', () => {\n\t\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'select', key: this.currentItem.id, value: this.currentItem.value});\n\t\t});\n\n\t\tthis.dropdown.addEventListener('mousedown', e => {\n\t\t\te.stopPropagation();\n\t\t});\n\t}\n\t\n\trender = () => html`\n\t\t${this.mode == 'button' ? html`\n\t\t\t<og-toolbar-button\n\t\t\t\tmode=\"toggle\"\n\t\t\t\tstyle=\"min-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px; flex: 0\"\n\t\t\t\tcolor=\"gray\"\n\t\t\t\t.item=\"${this.currentItem}\">\n\t\t\t</og-toolbar-button>\n\t\t` : null}\n\t\t\n\t\t<og-dropdown ${ref(this.dropdownRef)}\n\t\t\tstyle=\"min-width: 14px; flex: 0\"\n\t\t\tcolor=\"gray\"\n\t\t\talignment=\"left\"\n\t\t\t.icon=\"${this.mode == 'button' ? null : this.item.icon}\"\n\t\t\tpositionOffset=\"${-constants.TOOLBAR_COMPONENT_SIZE_BASE}\">\n\t\t\t<og-toolbar-grid ${ref(this.gridRef)}\n\t\t\t\tslot=\"content\"\n\t\t\t\t.items=\"${this.item.items}\">\n\t\t\t</og-toolbar-grid>\n\t\t</og-dropdown>\n\t`;\n\n}"]}
1
+ {"version":3,"file":"toolbarDropdownButton.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdownButton.ts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AC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/F,CAAC;;AA1GM,4BAAM,GAAG,CAAC,GAAG,CAAA;;;;iBAIJ,SAAS,CAAC,2BAA2B;;;;;;;gBAOtC,SAAS,CAAC,2BAA2B;;;;;;;;;;EAUnD,CAAC,AArBW,CAqBV;AAYH;IADC,KAAK,CAAC,mBAAmB,CAAC;qDACL;AAGtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACP;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0DACA;AAGzB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;mDACY;AA5CzB,qBAAqB;IADjC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,qBAAqB,CAyIjC","sourcesContent":["import constants from '../../constants';\nimport { dom, Dropdown } from '@omegagrid/core';\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ToolbarItem } from '../../types';\nimport { ToolbarGrid } from './toolbarGrid';\nimport { createRef, ref } from 'lit-html/directives/ref.js';\nimport { ToolbarButton } from './toolbarButton';\nimport { actions } from '@omegagrid/core';\nimport { Tree, TreeEvent, TreeSource } from '@omegagrid/tree';\n\n@customElement('og-toolbar-dropdownbutton')\nexport class ToolbarDropdownButton 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-toolbar-button {\n\t\t\tflex: 1;\n\t\t\tborder-top-right-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t\tmin-width: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t}\n\n\t\tog-toolbar-button+og-dropdown {\n\t\t\tflex: 0 0 14px;\n\t\t\tmax-width: 14px;\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}\n\t`];\n\n\tgridRef = createRef<ToolbarGrid>();\n\tget grid() { return this.gridRef.value }\n\n\ttreeRef = createRef<Tree>();\n\tget tree() { return this.treeRef.value }\n\n\tdropdownRef = createRef<Dropdown>();\n\tget dropdown() { return this.dropdownRef.value }\n\n\t@query('og-toolbar-button')\n\tbutton: ToolbarButton;\n\n\t@property({type: Object})\n\titem: ToolbarItem;\n\n\t@property({type: Object})\n\tcurrentItem: ToolbarItem;\n\n\t@property({type: String})\n\tmode: 'dropdown'|'button' = 'button';\n\n\twillUpdate() {\n\t\tif (!this.currentItem && this.item?.items) {\n\t\t\tconst items = this.item.items as ToolbarItem[][];\n\t\t\tthis.currentItem = items.flatMap(row => row).find(item => item.default);\n\t\t\tif (!this.currentItem) this.currentItem = items[0][0];\n\t\t}\n\n\t\tif (this.item?.options?.mode) {\n\t\t\tthis.mode = this.item.options.mode as typeof this.mode;\n\t\t}\n\t}\n\n\tfirstUpdated() {\n\t\tif (this.grid) {\n\t\t\tdom.on(this.grid, 'click', 'og-toolbar-button', (e: PointerEvent, elm: ToolbarButton) => {\n\t\t\t\tthis.currentItem = elm.item;\n\t\t\t\tthis.dropdown.close();\n\t\t\t});\n\n\t\t\tlet previewId: string = null;\n\t\t\t\n\t\t\tdom.on(this.grid, 'mousemove', 'og-toolbar-button', (_e: MouseEvent, elm: ToolbarButton) => {\n\t\t\t\tif (previewId != elm.item.id) {\n\t\t\t\t\tpreviewId = elm.item.id;\n\t\t\t\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'preview', key: elm.item.id, value: elm.item.value});\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.grid.addEventListener('mouseleave', () => {\n\t\t\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'previewEnd', key: previewId, value: null});\n\t\t\t\tpreviewId = null;\n\t\t\t});\n\n\t\t\tthis.grid.addEventListener('toolbar.action', (e: actions.ActionEvent) => {\n\t\t\t\tactions.dispatchActionEvent(this, 'toolbar', e.action);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.tree.setSourceData((this.item.items || []) as TreeSource, {\n\t\t\t\tcheckboxes: false\n\t\t\t});\n\n\t\t\tthis.tree.addEventListener('select', (e: TreeEvent) => {\n\t\t\t\tthis.dropdown.close();\n\t\t\t\tactions.dispatchActionEvent(this, 'toolbar', {type: 'select', key: e.node.key, value: e.node.value});\n\t\t\t});\n\t\t}\n\t\t\n\t\tthis.button?.addEventListener('click', () => {\n\t\t\tactions.dispatchActionEvent(this, 'toolbar', {\n\t\t\t\ttype: 'select', \n\t\t\t\tkey: (this.currentItem || this.item).id, \n\t\t\t\tvalue: (this.currentItem || this.item).value\n\t\t\t});\n\t\t});\n\n\t\tthis.dropdown.addEventListener('mousedown', e => {\n\t\t\te.stopPropagation();\n\t\t});\n\t}\n\n\tget isGridDropdown() {\n\t\treturn this.item?.items && Array.isArray(this.item.items[0]) && this.item.items[0].length > 1;\n\t}\n\t\n\trender = () => html`\n\t\t${this.mode == 'button' ? html`\n\t\t\t<og-toolbar-button\n\t\t\t\t.item=\"${this.isGridDropdown ? this.currentItem : this.item}\">\n\t\t\t</og-toolbar-button>\n\t\t` : null}\n\t\t\n\t\t<og-dropdown ${ref(this.dropdownRef)}\n\t\t\t.alignment=\"${this.isGridDropdown ? \"left\" : \"right\"}\"\n\t\t\t.width=\"${this.isGridDropdown ? 0 : this.item.width}\"\n\t\t\t.color=\"${this.item.color || 'gray'}\"\n\t\t\t.icon=\"${this.mode == 'button' ? null : this.item.icon}\"\n\t\t\t.positionOffset=\"${this.isGridDropdown ? -constants.TOOLBAR_COMPONENT_SIZE_BASE : 0}\">\n\t\t\t${this.isGridDropdown ? html`\n\t\t\t\t<og-toolbar-grid ${ref(this.gridRef)}\n\t\t\t\t\tslot=\"content\"\n\t\t\t\t\t.items=\"${this.item.items}\">\n\t\t\t\t</og-toolbar-grid>\n\t\t\t` : html`\n\t\t\t\t<og-tree ${ref(this.treeRef)}\n\t\t\t\t\tmaxHeight=\"300\"\n\t\t\t\t\tslot=\"content\">\n\t\t\t\t</og-tree>\n\t\t\t`}\n\t\t</og-dropdown>\n\t`;\n\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/toolbar",
3
- "version": "0.6.105",
3
+ "version": "0.6.106",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Toolbar component",
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.6.105",
31
- "@omegagrid/localize": "^0.6.105",
32
- "@omegagrid/tree": "^0.6.105",
30
+ "@omegagrid/core": "^0.6.106",
31
+ "@omegagrid/localize": "^0.6.106",
32
+ "@omegagrid/tree": "^0.6.106",
33
33
  "lit": "^3.1.1",
34
34
  "lit-html": "^3.1.1",
35
35
  "ts-debounce": "^4.0.0"