@omegagrid/toolbar 0.6.110 → 0.6.112

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,6 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { ToolbarItem } from '../../types';
3
- import { TreeDropdown } from '@omegagrid/tree';
3
+ import { SerializedValue, TreeDropdown } from '@omegagrid/tree';
4
4
  export declare class ToolbarDropdown extends LitElement {
5
5
  static styles: import("lit").CSSResult[];
6
6
  tree: TreeDropdown;
@@ -8,6 +8,7 @@ export declare class ToolbarDropdown extends LitElement {
8
8
  value: string;
9
9
  updated(): void;
10
10
  _onChange: () => void;
11
+ getValue(): (string & any[]) | SerializedValue[];
11
12
  render: () => import("lit-html").TemplateResult<1>;
12
13
  }
13
14
  //# sourceMappingURL=toolbarDropdown.d.ts.map
@@ -1 +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,EAAwD,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGrG,qBACa,eAAgB,SAAQ,UAAU;IAE9C,MAAM,CAAC,MAAM,4BAMV;IAGH,IAAI,EAAE,YAAY,CAAC;IAGnB,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO;IAaP,SAAS,aASR;IAED,MAAM,6CAQJ;CAEF"}
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,4BAMV;IAGH,IAAI,EAAE,YAAY,CAAC;IAGnB,IAAI,EAAE,WAAW,CAAC;IAGlB,KAAK,EAAE,MAAM,CAAC;IAEd,OAAO;IAaP,SAAS,aASR;IAED,QAAQ;IAMR,MAAM,6CAQJ;CAEF"}
@@ -29,7 +29,7 @@ let ToolbarDropdown = class ToolbarDropdown extends LitElement {
29
29
  @change="${this._onChange}"
30
30
  .adapter="${this.item.adapter}"
31
31
  .caption="${this.item.caption}"
32
- .value="${this.value == null ? null : [[this.value, 0, 1]]}">
32
+ .value="${this.getValue()}">
33
33
  </og-tree-dropdown>
34
34
  `;
35
35
  }
@@ -45,6 +45,9 @@ let ToolbarDropdown = class ToolbarDropdown extends LitElement {
45
45
  });
46
46
  }
47
47
  }
48
+ getValue() {
49
+ return Array.isArray(this.value) ? this.value : (this.value == null ? null : [[this.value, 0, 1]]);
50
+ }
48
51
  };
49
52
  ToolbarDropdown.styles = [css `
50
53
  :host {
@@ -1 +1 @@
1
- {"version":3,"file":"toolbarDropdown.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdown.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAc,UAAU,EAA8C,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGnC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAgCN,cAAS,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC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AAS,EAAE,KAAK;aAChB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;;AA5BM,sBAAM,GAAG,CAAC,GAAG,CAAA;;;;aAIR,SAAS,CAAC,2BAA2B;;EAEhD,CAAC,AANW,CAMV;AAGH;IADC,KAAK,CAAC,kBAAkB,CAAC;6CACP;AAGnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACP;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;8CACX;AAjBF,eAAe;IAD3B,aAAa,CAAC,qBAAqB,CAAC;GACxB,eAAe,CAqD3B","sourcesContent":["import { dom } from '@omegagrid/core';\nimport constants from '../../constants';\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ToolbarItem } from '../../types';\nimport { NodeSource, SelectMode, SerializedValue, TreeAdapter, TreeDropdown } from '@omegagrid/tree';\nimport { actions } from '@omegagrid/core';\n\n@customElement('og-toolbar-dropdown')\nexport class ToolbarDropdown 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\theight: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t}\n\t`];\n\n\t@query('og-tree-dropdown')\n\ttree: TreeDropdown;\n\n\t@property({type: Object})\n\titem: ToolbarItem;\n\n\t@property({type: String})\n\tvalue: string;\n\n\tupdated() {\n\t\tif (this.item.width) dom.setSize(this.tree, {w: this.item.width});\n\t\t\n\t\tif (!this.item.adapter) {\n\t\t\tthis.tree.setSourceData(this.item.items as NodeSource[], {\n\t\t\t\tglobalLevels: false,\n\t\t\t\tselectMode: SelectMode.Single,\n\t\t\t\tcheckboxes: false,\n\t\t\t\texpanders: false\n\t\t\t});\n\t\t}\n\t}\n\n\t_onChange = () => {\n\t\tthis.tree.close();\n\t\tconst serializedValue = this.tree.value;\n\t\tthis.value = serializedValue && serializedValue[0] && serializedValue[0][0] ? serializedValue[0][0] : null;\n\t\tactions.dispatchActionEvent(this, 'toolbar', {\n\t\t\ttype: 'change',\n\t\t\tkey: this.item.id,\n\t\t\tvalue: this.value\n\t\t});\n\t}\n\n\trender = () => html`\n\t\t<og-tree-dropdown\n\t\t\tcolor=\"gray\"\n\t\t\t@change=\"${this._onChange}\"\n\t\t\t.adapter=\"${this.item.adapter as TreeAdapter}\"\n\t\t\t.caption=\"${this.item.caption}\"\n\t\t\t.value=\"${this.value == null ? null : [[this.value, 0, 1]] as SerializedValue[]}\">\n\t\t</og-tree-dropdown>\n\t`;\n\n}"]}
1
+ {"version":3,"file":"toolbarDropdown.js","sourceRoot":"","sources":["../../../src/ui/controls/toolbarDropdown.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAc,UAAU,EAA8C,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGnC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAgCN,cAAS,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAClB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YACxC,IAAI,CAAC,KAAK,GAAG,eAAe,IAAI,eAAe,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3G,OAAO,CAA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AEhD,CAAC,AANW,CAMV;AAGH;IADC,KAAK,CAAC,kBAAkB,CAAC;6CACP;AAGnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;6CACP;AAGlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;8CACX;AAjBF,eAAe;IAD3B,aAAa,CAAC,qBAAqB,CAAC;GACxB,eAAe,CA2D3B","sourcesContent":["import { dom } from '@omegagrid/core';\nimport constants from '../../constants';\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ToolbarItem } from '../../types';\nimport { NodeSource, SelectMode, SerializedValue, TreeAdapter, TreeDropdown } from '@omegagrid/tree';\nimport { actions } from '@omegagrid/core';\n\n@customElement('og-toolbar-dropdown')\nexport class ToolbarDropdown 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\theight: ${constants.TOOLBAR_COMPONENT_SIZE_BASE}px;\n\t\t}\n\t`];\n\n\t@query('og-tree-dropdown')\n\ttree: TreeDropdown;\n\n\t@property({type: Object})\n\titem: ToolbarItem;\n\n\t@property({type: String})\n\tvalue: string;\n\n\tupdated() {\n\t\tif (this.item.width) dom.setSize(this.tree, {w: this.item.width});\n\t\t\n\t\tif (!this.item.adapter) {\n\t\t\tthis.tree.setSourceData(this.item.items as NodeSource[], {\n\t\t\t\tglobalLevels: false,\n\t\t\t\tselectMode: SelectMode.Single,\n\t\t\t\tcheckboxes: false,\n\t\t\t\texpanders: false\n\t\t\t});\n\t\t}\n\t}\n\n\t_onChange = () => {\n\t\tthis.tree.close();\n\t\tconst serializedValue = this.tree.value;\n\t\tthis.value = serializedValue && serializedValue[0] && serializedValue[0][0] ? serializedValue[0][0] : null;\n\t\tactions.dispatchActionEvent(this, 'toolbar', {\n\t\t\ttype: 'change',\n\t\t\tkey: this.item.id,\n\t\t\tvalue: this.value\n\t\t});\n\t}\n\n\tgetValue() {\n\t\treturn Array.isArray(this.value) ? this.value : (\n\t\t\tthis.value == null ? null : [[this.value, 0, 1]] as SerializedValue[]\n\t\t);\n\t}\n\n\trender = () => html`\n\t\t<og-tree-dropdown\n\t\t\tcolor=\"gray\"\n\t\t\t@change=\"${this._onChange}\"\n\t\t\t.adapter=\"${this.item.adapter as TreeAdapter}\"\n\t\t\t.caption=\"${this.item.caption}\"\n\t\t\t.value=\"${this.getValue()}\">\n\t\t</og-tree-dropdown>\n\t`;\n\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/toolbar",
3
- "version": "0.6.110",
3
+ "version": "0.6.112",
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.110",
31
- "@omegagrid/localize": "^0.6.110",
32
- "@omegagrid/tree": "^0.6.110",
30
+ "@omegagrid/core": "^0.6.112",
31
+ "@omegagrid/localize": "^0.6.112",
32
+ "@omegagrid/tree": "^0.6.112",
33
33
  "lit": "^3.1.1",
34
34
  "lit-html": "^3.1.1",
35
35
  "ts-debounce": "^4.0.0"