@operato/input 0.4.3 → 0.4.4

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 (51) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/src/ox-input-color-gradient.d.ts +26 -0
  3. package/dist/src/ox-input-color-gradient.js +318 -0
  4. package/dist/src/ox-input-color-gradient.js.map +1 -0
  5. package/dist/src/ox-input-color-stops.d.ts +71 -0
  6. package/dist/src/ox-input-color-stops.js +445 -0
  7. package/dist/src/ox-input-color-stops.js.map +1 -0
  8. package/dist/src/ox-input-color.d.ts +176 -0
  9. package/dist/src/ox-input-color.js +298 -0
  10. package/dist/src/ox-input-color.js.map +1 -0
  11. package/dist/src/ox-input-crontab.d.ts +23 -0
  12. package/dist/src/ox-input-crontab.js +560 -0
  13. package/dist/src/ox-input-crontab.js.map +1 -0
  14. package/dist/src/ox-input-layout/ox-input-card-layout.d.ts +4 -0
  15. package/dist/src/ox-input-layout/ox-input-card-layout.js +57 -0
  16. package/dist/src/ox-input-layout/ox-input-card-layout.js.map +1 -0
  17. package/dist/src/ox-input-layout/ox-input-grid-layout.d.ts +4 -0
  18. package/dist/src/ox-input-layout/ox-input-grid-layout.js +63 -0
  19. package/dist/src/ox-input-layout/ox-input-grid-layout.js.map +1 -0
  20. package/dist/src/ox-input-layout/ox-input-layout.d.ts +5 -0
  21. package/dist/src/ox-input-layout/ox-input-layout.js +73 -0
  22. package/dist/src/ox-input-layout/ox-input-layout.js.map +1 -0
  23. package/dist/src/ox-input-multiple-colors.d.ts +28 -0
  24. package/dist/src/ox-input-multiple-colors.js +113 -0
  25. package/dist/src/ox-input-multiple-colors.js.map +1 -0
  26. package/dist/src/ox-input-options.d.ts +22 -0
  27. package/dist/src/ox-input-options.js +137 -0
  28. package/dist/src/ox-input-options.js.map +1 -0
  29. package/dist/src/ox-input-partition-keys.d.ts +36 -0
  30. package/dist/src/ox-input-partition-keys.js +204 -0
  31. package/dist/src/ox-input-partition-keys.js.map +1 -0
  32. package/dist/src/ox-input-range.d.ts +4 -0
  33. package/dist/src/ox-input-range.js +161 -0
  34. package/dist/src/ox-input-range.js.map +1 -0
  35. package/dist/src/ox-input-scene-component-id.d.ts +11 -0
  36. package/dist/src/ox-input-scene-component-id.js +68 -0
  37. package/dist/src/ox-input-scene-component-id.js.map +1 -0
  38. package/dist/src/ox-input-table.d.ts +8 -0
  39. package/dist/src/ox-input-table.js +379 -0
  40. package/dist/src/ox-input-table.js.map +1 -0
  41. package/dist/src/ox-input-value-map.d.ts +41 -0
  42. package/dist/src/ox-input-value-map.js +279 -0
  43. package/dist/src/ox-input-value-map.js.map +1 -0
  44. package/dist/src/ox-input-value-ranges.d.ts +41 -0
  45. package/dist/src/ox-input-value-ranges.js +298 -0
  46. package/dist/src/ox-input-value-ranges.js.map +1 -0
  47. package/dist/src/ox-input-work-shift.d.ts +33 -0
  48. package/dist/src/ox-input-work-shift.js +229 -0
  49. package/dist/src/ox-input-work-shift.js.map +1 -0
  50. package/dist/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +5 -5
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import { LitElement, css, html } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ const DEFAULT = {
8
+ activeIndex: 0
9
+ };
10
+ let OxInputCardLayout = class OxInputCardLayout extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.activeIndex = 0;
14
+ }
15
+ static { this.styles = css `
16
+ :host {
17
+ display: inline-block;
18
+ }
19
+ `; }
20
+ firstUpdated() {
21
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this));
22
+ }
23
+ updated(changes) {
24
+ if (changes.has('value')) {
25
+ let { activeIndex } = this.value || DEFAULT;
26
+ this.activeIndex = activeIndex;
27
+ }
28
+ }
29
+ render() {
30
+ return html `
31
+ <label>active index</label>
32
+ <input type="number" value-key="activeIndex" .value=${this.activeIndex} />
33
+ `;
34
+ }
35
+ _onValueChange(e) {
36
+ var element = e.target;
37
+ var key = element.getAttribute('value-key');
38
+ if (!key) {
39
+ return;
40
+ }
41
+ this[key] = Number(element.value);
42
+ this.value = {
43
+ activeIndex: this.activeIndex
44
+ };
45
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
46
+ }
47
+ };
48
+ __decorate([
49
+ property({ type: Object })
50
+ ], OxInputCardLayout.prototype, "value", void 0);
51
+ __decorate([
52
+ property({ type: Number })
53
+ ], OxInputCardLayout.prototype, "activeIndex", void 0);
54
+ OxInputCardLayout = __decorate([
55
+ customElement('ox-input-card-layout')
56
+ ], OxInputCardLayout);
57
+ //# sourceMappingURL=ox-input-card-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-card-layout.js","sourceRoot":"","sources":["../../../src/ox-input-layout/ox-input-card-layout.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE,MAAM,OAAO,GAAG;IACd,WAAW,EAAE,CAAC;CACf,CAAA;AAGD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAQ8B,gBAAW,GAAW,CAAC,CAAA;IAqCrD,CAAC;aA5CQ,WAAM,GAAG,GAAG,CAAA;;;;GAIlB,CAAA;IAKD,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED,OAAO,CAAC,OAA6B;QACnC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACxB,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,OAAO,CAAA;YAE3C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;SAC/B;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;4DAE6C,IAAI,CAAC,WAAW;KACvE,CAAA;IACH,CAAC;IAED,cAAc,CAAC,CAAQ;QACrB,IAAI,OAAO,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC1C,IAAI,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAkB,CAAA;QAE5D,IAAI,CAAC,GAAG,EAAE;YACR,OAAM;SACP;QAED,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAEjC,IAAI,CAAC,KAAK,GAAG;YACX,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAA;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClF,CAAC;CACF,CAAA;AAtC6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAwB;AAR/C,iBAAiB;IADtB,aAAa,CAAC,sBAAsB,CAAC;GAChC,iBAAiB,CA6CtB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { LitElement, PropertyValues, css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nconst DEFAULT = {\n activeIndex: 0\n}\n\n@customElement('ox-input-card-layout')\nclass OxInputCardLayout extends LitElement {\n static styles = css`\n :host {\n display: inline-block;\n }\n `\n\n @property({ type: Object }) value: any\n @property({ type: Number }) activeIndex: number = 0\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onValueChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n let { activeIndex } = this.value || DEFAULT\n\n this.activeIndex = activeIndex\n }\n }\n\n render() {\n return html`\n <label>active index</label>\n <input type=\"number\" value-key=\"activeIndex\" .value=${this.activeIndex} />\n `\n }\n\n _onValueChange(e: Event) {\n var element = e.target as HTMLInputElement\n var key = element.getAttribute('value-key') as 'activeIndex'\n\n if (!key) {\n return\n }\n\n this[key] = Number(element.value)\n\n this.value = {\n activeIndex: this.activeIndex\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ export {};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import { LitElement, css, html } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ let OxInputGridLayout = class OxInputGridLayout extends LitElement {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.direction = 'row';
11
+ }
12
+ static { this.styles = css `
13
+ :host {
14
+ display: inline-block;
15
+ }
16
+ `; }
17
+ firstUpdated() {
18
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this));
19
+ }
20
+ updated(changes) {
21
+ if (changes.has('value')) {
22
+ let { direction = 'row' } = this.value || {};
23
+ this.direction = direction;
24
+ }
25
+ if (changes.has('value')) {
26
+ }
27
+ }
28
+ render() {
29
+ return html `
30
+ <label>direction</label>
31
+ <select value-key="direction" .value=${this.direction}>
32
+ <option value="row" selected>row</option>
33
+ <option value="column">column</option>
34
+ </select>
35
+ `;
36
+ }
37
+ _onValueChange(e) {
38
+ var element = e.target;
39
+ var key = element.getAttribute('value-key');
40
+ if (!key) {
41
+ return;
42
+ }
43
+ switch (key) {
44
+ case 'direction':
45
+ this.direction = element.value;
46
+ default:
47
+ }
48
+ this.value = {
49
+ direction: this.direction
50
+ };
51
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
52
+ }
53
+ };
54
+ __decorate([
55
+ property({ type: Object })
56
+ ], OxInputGridLayout.prototype, "value", void 0);
57
+ __decorate([
58
+ property({ type: String })
59
+ ], OxInputGridLayout.prototype, "direction", void 0);
60
+ OxInputGridLayout = __decorate([
61
+ customElement('ox-input-grid-layout')
62
+ ], OxInputGridLayout);
63
+ //# sourceMappingURL=ox-input-grid-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-grid-layout.js","sourceRoot":"","sources":["../../../src/ox-input-layout/ox-input-grid-layout.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAGlE,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAQ8B,cAAS,GAAqB,KAAK,CAAA;IA+CjE,CAAC;aAtDQ,WAAM,GAAG,GAAG,CAAA;;;;GAIlB,CAAA;IAKD,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED,OAAO,CAAC,OAA6B;QACnC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACxB,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;YAE5C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;SAC3B;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;SACzB;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;6CAE8B,IAAI,CAAC,SAAS;;;;KAItD,CAAA;IACH,CAAC;IAED,cAAc,CAAC,CAAQ;QACrB,IAAI,OAAO,GAAG,CAAC,CAAC,MAA2B,CAAA;QAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAE3C,IAAI,CAAC,GAAG,EAAE;YACR,OAAM;SACP;QAED,QAAQ,GAAG,EAAE;YACX,KAAK,WAAW;gBACd,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,KAAyB,CAAA;YACpD,QAAQ;SACT;QAED,IAAI,CAAC,KAAK,GAAG;YACX,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAA;QAED,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClF,CAAC;CACF,CAAA;AAhD6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAoC;AAR3D,iBAAiB;IADtB,aAAa,CAAC,sBAAsB,CAAC;GAChC,iBAAiB,CAuDtB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { LitElement, PropertyValues, css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\n@customElement('ox-input-grid-layout')\nclass OxInputGridLayout extends LitElement {\n static styles = css`\n :host {\n display: inline-block;\n }\n `\n\n @property({ type: Object }) value: any\n @property({ type: String }) direction: 'row' | 'column' = 'row'\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onValueChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n let { direction = 'row' } = this.value || {}\n\n this.direction = direction\n }\n\n if (changes.has('value')) {\n }\n }\n\n render() {\n return html`\n <label>direction</label>\n <select value-key=\"direction\" .value=${this.direction}>\n <option value=\"row\" selected>row</option>\n <option value=\"column\">column</option>\n </select>\n `\n }\n\n _onValueChange(e: Event) {\n var element = e.target as HTMLSelectElement\n var key = element.getAttribute('value-key')\n\n if (!key) {\n return\n }\n\n switch (key) {\n case 'direction':\n this.direction = element.value as 'row' | 'column'\n default:\n }\n\n this.value = {\n direction: this.direction\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import './things-grid-layout';
5
+ import './things-card-layout';
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import './things-grid-layout';
6
+ import './things-card-layout';
7
+ import { LitElement, html } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ // import './things-linear-horizontal-layout'
10
+ // import './things-linear-vertical-layout'
11
+ const layouts = ['absolute', 'card', 'grid', 'linear-horizontal', 'linear-vertical', 'table'];
12
+ let OxInputLayout = class OxInputLayout extends LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.value = {};
16
+ this.layout = '';
17
+ this.options = {};
18
+ }
19
+ firstUpdated() {
20
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this));
21
+ }
22
+ updated(changes) {
23
+ if (changes.has('value')) {
24
+ this.layout = this.value.layout;
25
+ this.options = this.value.options;
26
+ }
27
+ }
28
+ render() {
29
+ return html `
30
+ <div>
31
+ <select value-key="layout" .value=${this.layout}>
32
+ <option value="" selected></option>
33
+ ${layouts.map(layout => {
34
+ return html ` <option value=${layout}>${layout}</option> `;
35
+ })}
36
+ </select>
37
+
38
+ ${this.layout == 'grid'
39
+ ? html ` <things-grid-layout value-key="options" .value=${this.options}></things-grid-layout> `
40
+ : this.layout == 'card'
41
+ ? html ` <things-card-layout value-key="options" .value=${this.options}></things-card-layout> `
42
+ : html ``}
43
+ </div>
44
+ `;
45
+ }
46
+ _onValueChange(e) {
47
+ var element = e.target;
48
+ var key = element.getAttribute('value-key');
49
+ if (!key) {
50
+ return;
51
+ }
52
+ //@ts-ignore
53
+ this[key] = element.value;
54
+ this.value = {
55
+ layout: this.layout,
56
+ options: this.options
57
+ };
58
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
59
+ }
60
+ };
61
+ __decorate([
62
+ property({ type: Object })
63
+ ], OxInputLayout.prototype, "value", void 0);
64
+ __decorate([
65
+ property({ type: String })
66
+ ], OxInputLayout.prototype, "layout", void 0);
67
+ __decorate([
68
+ property({ type: Object })
69
+ ], OxInputLayout.prototype, "options", void 0);
70
+ OxInputLayout = __decorate([
71
+ customElement('ox-input-layout')
72
+ ], OxInputLayout);
73
+ //# sourceMappingURL=ox-input-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-layout.js","sourceRoot":"","sources":["../../../src/ox-input-layout/ox-input-layout.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,sBAAsB,CAAA;AAC7B,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE,6CAA6C;AAC7C,2CAA2C;AAE3C,MAAM,OAAO,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAA;AAG7F,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAC8B,UAAK,GAAQ,EAAE,CAAA;QACf,WAAM,GAOpB,EAAE,CAAA;QACY,YAAO,GAAQ,EAAE,CAAA;IAkD/C,CAAC;IAhDC,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC5E,CAAC;I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AA3D6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAOX;AACY;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAkB;AAVzC,aAAa;IADlB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,aAAa,CA4DlB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './things-grid-layout'\nimport './things-card-layout'\n\nimport { LitElement, PropertyValues, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\n// import './things-linear-horizontal-layout'\n// import './things-linear-vertical-layout'\n\nconst layouts = ['absolute', 'card', 'grid', 'linear-horizontal', 'linear-vertical', 'table']\n\n@customElement('ox-input-layout')\nclass OxInputLayout extends LitElement {\n @property({ type: Object }) value: any = {}\n @property({ type: String }) layout:\n | ''\n | 'absolute'\n | 'card'\n | 'grid'\n | 'linear-horizontal'\n | 'linear-vertical'\n | 'table' = ''\n @property({ type: Object }) options: any = {}\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onValueChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n this.layout = this.value.layout\n this.options = this.value.options\n }\n }\n\n render() {\n return html`\n <div>\n <select value-key=\"layout\" .value=${this.layout}>\n <option value=\"\" selected></option>\n ${layouts.map(layout => {\n return html` <option value=${layout}>${layout}</option> `\n })}\n </select>\n\n ${this.layout == 'grid'\n ? html` <things-grid-layout value-key=\"options\" .value=${this.options}></things-grid-layout> `\n : this.layout == 'card'\n ? html` <things-card-layout value-key=\"options\" .value=${this.options}></things-card-layout> `\n : html``}\n </div>\n `\n }\n\n _onValueChange(e: Event) {\n var element = e.target as HTMLElement\n var key = element.getAttribute('value-key')\n\n if (!key) {\n return\n }\n\n //@ts-ignore\n this[key] = element.value\n\n this.value = {\n layout: this.layout,\n options: this.options\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import './ox-input-color.js';
5
+ import { OxFormField } from './ox-form-field.js';
6
+ import { OxInputColor } from './ox-input-color.js';
7
+ /**
8
+ 색상 배열을 편집하는 컴포넌트이다.
9
+
10
+ 새로운 색상을 추가하고자 할 때는 `+` 버튼을 클릭한다.<br />
11
+ 색상을 제거하고자 할 때는 `-` 버튼을 클릭한다.<br />
12
+
13
+ Example:
14
+
15
+ <ox-input-multiple-colors values=${values}>
16
+ </ox-input-multiple-colors>
17
+ */
18
+ export declare class OxInputMultipleColors extends OxFormField {
19
+ static styles: import("lit").CSSResult;
20
+ value: string[];
21
+ colorsContainer: HTMLDivElement;
22
+ colors: NodeListOf<OxInputColor>;
23
+ firstUpdated(): void;
24
+ render(): import("lit-html").TemplateResult<1>;
25
+ _onValueChanged(): void;
26
+ _appendEditorColor(): void;
27
+ _removeEditorColor(e: Event): void;
28
+ }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import './ox-input-color.js';
6
+ import { css, html } from 'lit';
7
+ import { customElement, property, query, queryAll } from 'lit/decorators.js';
8
+ import { OxFormField } from './ox-form-field.js';
9
+ /**
10
+ 색상 배열을 편집하는 컴포넌트이다.
11
+
12
+ 새로운 색상을 추가하고자 할 때는 `+` 버튼을 클릭한다.<br />
13
+ 색상을 제거하고자 할 때는 `-` 버튼을 클릭한다.<br />
14
+
15
+ Example:
16
+
17
+ <ox-input-multiple-colors values=${values}>
18
+ </ox-input-multiple-colors>
19
+ */
20
+ let OxInputMultipleColors = class OxInputMultipleColors extends OxFormField {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.value = [];
24
+ }
25
+ static { this.styles = css `
26
+ :host {
27
+ display: inline-block;
28
+ }
29
+
30
+ #colors-container > div {
31
+ display: grid;
32
+ grid-template-columns: 22px 1fr 22px;
33
+ grid-gap: 5px;
34
+ align-items: center;
35
+ justify-content: left;
36
+ }
37
+
38
+ ox-input-color {
39
+ height: 25px;
40
+ width: 100%;
41
+ }
42
+
43
+ input[type='button'] {
44
+ width: 22px;
45
+ height: 25px;
46
+ border: 1px solid rgba(0, 0, 0, 0.15);
47
+ padding-top: 0px;
48
+ padding-bottom: 2px;
49
+ background-color: #f1f2f4;
50
+ color: #8f9192;
51
+ font-size: 16px;
52
+ }
53
+ `; }
54
+ firstUpdated() {
55
+ this.renderRoot.addEventListener('change', this._onValueChanged.bind(this));
56
+ }
57
+ render() {
58
+ return html `
59
+ <div id="colors-container">
60
+ ${(this.value || []).map((item, index) => html `
61
+ <div>
62
+ <input type="button" value="+" @click=${() => this._appendEditorColor()} data-index=${index} />
63
+
64
+ <ox-input-color .value=${item}> </ox-input-color>
65
+
66
+ ${(this.value || []).length > 1
67
+ ? html `
68
+ <input
69
+ type="button"
70
+ value="-"
71
+ @click=${(e) => this._removeEditorColor(e)}
72
+ data-index=${index}
73
+ />
74
+ `
75
+ : html ``}
76
+ </div>
77
+ `)}
78
+ </div>
79
+ `;
80
+ }
81
+ _onValueChanged() {
82
+ this.value = Array.from(this.colors).map(color => color.value);
83
+ }
84
+ _appendEditorColor() {
85
+ this.value = [...this.value, 'black'];
86
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
87
+ }
88
+ _removeEditorColor(e) {
89
+ var values = [];
90
+ for (var i = 0; i < this.value.length; i++) {
91
+ if (i == Number(e.target.dataset.index))
92
+ continue;
93
+ else
94
+ values.push(this.value[i]);
95
+ }
96
+ this.value = values;
97
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
98
+ }
99
+ };
100
+ __decorate([
101
+ property({ type: Array })
102
+ ], OxInputMultipleColors.prototype, "value", void 0);
103
+ __decorate([
104
+ query('#colors-container')
105
+ ], OxInputMultipleColors.prototype, "colorsContainer", void 0);
106
+ __decorate([
107
+ queryAll('ox-input-color')
108
+ ], OxInputMultipleColors.prototype, "colors", void 0);
109
+ OxInputMultipleColors = __decorate([
110
+ customElement('ox-input-multiple-colors')
111
+ ], OxInputMultipleColors);
112
+ export { OxInputMultipleColors };
113
+ //# sourceMappingURL=ox-input-multiple-colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-multiple-colors.js","sourceRoot":"","sources":["../../src/ox-input-multiple-colors.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD;;;;;;;;;;EAUE;AAGF,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,WAAW;IAAtD;;QA+B6B,UAAK,GAAa,EAAE,CAAA;IAwDjD,CAAC;aAtFQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BlB,CAAA;IAOD,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC7E,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CACtB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;sDAEuB,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,eAAe,KAAK;;uCAElE,IAAI;;gBAE3B,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAA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I,EAAE,KAAK,EAAE,CAAC;oDAAqB;AAEnB;IAA3B,KAAK,CAAC,mBAAmB,CAAC;8DAAiC;AAChC;IAA3B,QAAQ,CAAC,gBAAgB,CAAC;qDAAkC;AAlClD,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAuFjC;SAvFY,qBAAqB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAll } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { OxInputColor } from './ox-input-color.js'\n\n/**\n색상 배열을 편집하는 컴포넌트이다.\n\n새로운 색상을 추가하고자 할 때는 `+` 버튼을 클릭한다.<br />\n색상을 제거하고자 할 때는 `-` 버튼을 클릭한다.<br />\n\nExample:\n\n <ox-input-multiple-colors values=${values}>\n </ox-input-multiple-colors>\n*/\n\n@customElement('ox-input-multiple-colors')\nexport class OxInputMultipleColors extends OxFormField {\n static styles = css`\n :host {\n display: inline-block;\n }\n\n #colors-container > div {\n display: grid;\n grid-template-columns: 22px 1fr 22px;\n grid-gap: 5px;\n align-items: center;\n justify-content: left;\n }\n\n ox-input-color {\n height: 25px;\n width: 100%;\n }\n\n input[type='button'] {\n width: 22px;\n height: 25px;\n border: 1px solid rgba(0, 0, 0, 0.15);\n padding-top: 0px;\n padding-bottom: 2px;\n background-color: #f1f2f4;\n color: #8f9192;\n font-size: 16px;\n }\n `\n\n @property({ type: Array }) value: string[] = []\n\n @query('#colors-container') colorsContainer!: HTMLDivElement\n @queryAll('ox-input-color') colors!: NodeListOf<OxInputColor>\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onValueChanged.bind(this))\n }\n\n render() {\n return html`\n <div id=\"colors-container\">\n ${(this.value || []).map(\n (item, index) => html`\n <div>\n <input type=\"button\" value=\"+\" @click=${() => this._appendEditorColor()} data-index=${index} />\n\n <ox-input-color .value=${item}> </ox-input-color>\n\n ${(this.value || []).length > 1\n ? html`\n <input\n type=\"button\"\n value=\"-\"\n @click=${(e: Event) => this._removeEditorColor(e)}\n data-index=${index}\n />\n `\n : html``}\n </div>\n `\n )}\n </div>\n `\n }\n\n _onValueChanged() {\n this.value = Array.from(this.colors).map(color => color.value!)\n }\n\n _appendEditorColor() {\n this.value = [...this.value, 'black']\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _removeEditorColor(e: Event) {\n var values = []\n for (var i = 0; i < this.value.length; i++) {\n if (i == Number((e.target as HTMLElement).dataset.index)) continue\n else values.push(this.value[i])\n }\n\n this.value = values\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { OxFormField } from './ox-form-field';
5
+ declare type Option = {
6
+ text: string;
7
+ value: string;
8
+ };
9
+ export declare class OxInputOptions extends OxFormField {
10
+ static styles: import("lit").CSSResult;
11
+ value: Option[];
12
+ firstUpdated(): void;
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ private _changingNow;
15
+ _onChange(e: Event): void;
16
+ _build(includeNewRecord?: any): void;
17
+ sort(): void;
18
+ _add(): void;
19
+ _delete(e: Event): void;
20
+ protected appendFormData({ formData }: FormDataEvent): void;
21
+ }
22
+ export {};
@@ -0,0 +1,137 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import { css, html } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ import { OxFormField } from './ox-form-field';
8
+ let OxInputOptions = class OxInputOptions extends OxFormField {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.value = [];
12
+ this._changingNow = false;
13
+ }
14
+ static { this.styles = css `
15
+ div {
16
+ display: grid;
17
+ grid-template-columns: repeat(10, 1fr);
18
+ grid-gap: 5px;
19
+ grid-auto-rows: minmax(24px, auto);
20
+ }
21
+
22
+ input[data-text] {
23
+ grid-column: span 5;
24
+ }
25
+
26
+ input[data-value] {
27
+ grid-column: span 4;
28
+ }
29
+
30
+ button {
31
+ grid-column: span 1;
32
+ }
33
+ `; }
34
+ firstUpdated() {
35
+ this.renderRoot.addEventListener('change', this._onChange.bind(this));
36
+ }
37
+ render() {
38
+ const options = this.value instanceof Array ? this.value : [];
39
+ return html `
40
+ ${(options || []).map(item => html `
41
+ <div data-record="">
42
+ <input type="text" data-text="" placeholder="text" .value=${item.text} />
43
+ <input type="text" data-value="" placeholder="value" .value=${item.value} />
44
+ <button class="record-action" @click=${(e) => this._delete(e)} tabindex="-1">-</button>
45
+ </div>
46
+ `)}
47
+
48
+ <div data-record-new="">
49
+ <input type="text" data-text="" placeholder="text" value="" />
50
+ <input type="text" data-value="" placeholder="value" value="" @change=${(e) => this._add()} />
51
+ <button class="record-action" @click=${(e) => this._add()} tabindex="-1">+</button>
52
+ </div>
53
+ `;
54
+ }
55
+ _onChange(e) {
56
+ if (this._changingNow)
57
+ return;
58
+ this._changingNow = true;
59
+ var input = e.target;
60
+ var value = input.value;
61
+ var div = input.parentElement;
62
+ if (div && div.hasAttribute('data-record')) {
63
+ var dataList = div.querySelectorAll('[data-value]:not([hidden])');
64
+ for (var i = 0; i < dataList.length; i++) {
65
+ if (dataList[i] !== input) {
66
+ dataList[i].value = value || '';
67
+ }
68
+ }
69
+ }
70
+ if (div && div.hasAttribute('data-record'))
71
+ this._build(true);
72
+ else if (div && div.hasAttribute('data-record-new') && input.hasAttribute('data-value'))
73
+ this._add();
74
+ e.stopPropagation();
75
+ this._changingNow = false;
76
+ }
77
+ _build(includeNewRecord) {
78
+ if (includeNewRecord) {
79
+ var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]');
80
+ }
81
+ else {
82
+ var records = this.renderRoot.querySelectorAll('[data-record]');
83
+ }
84
+ var newoptions = [];
85
+ for (var i = 0; i < records.length; i++) {
86
+ var record = records[i];
87
+ var text = record.querySelector('[data-text]').value;
88
+ var inputs = record.querySelectorAll('[data-value]:not([style*="display: none"])');
89
+ if (!inputs || inputs.length == 0)
90
+ continue;
91
+ var input = inputs[inputs.length - 1];
92
+ var value = input.value;
93
+ if (text)
94
+ newoptions.push({ text: text, value: value || text });
95
+ }
96
+ this.value = newoptions;
97
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
98
+ }
99
+ sort() {
100
+ var sorter = function (a, b) {
101
+ return b.text < a.text ? 1 : -1;
102
+ };
103
+ this.value = [...this.value.sort(sorter)];
104
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
105
+ }
106
+ _add() {
107
+ this._build(true);
108
+ var inputs = this.renderRoot.querySelectorAll('[data-record-new] input:not([style*="display: none"])');
109
+ for (var i = 0; i < inputs.length; i++) {
110
+ let input = inputs[i];
111
+ input.value = '';
112
+ }
113
+ inputs[0].focus();
114
+ }
115
+ _delete(e) {
116
+ const record = e.target.parentElement;
117
+ const input = record && record.querySelector('[data-text]');
118
+ if (input) {
119
+ input.value = '';
120
+ }
121
+ this._build();
122
+ }
123
+ appendFormData({ formData }) {
124
+ if (!this.name)
125
+ return;
126
+ const value = this.value;
127
+ formData.append(this.name, typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value));
128
+ }
129
+ };
130
+ __decorate([
131
+ property({ type: Array })
132
+ ], OxInputOptions.prototype, "value", void 0);
133
+ OxInputOptions = __decorate([
134
+ customElement('ox-input-options')
135
+ ], OxInputOptions);
136
+ export { OxInputOptions };
137
+ //# sourceMappingURL=ox-input-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-options.js","sourceRoot":"","sources":["../../src/ox-input-options.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBA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EjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YACrB,KAAK,CAAC,KAAK,GAAG,EAAE,CAAA;SACjB;QAED,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAA;IACnB,CAAC;IAED,OAAO,CAAC,CAAQ;QACd,MAAM,MAAM,GAAI,CAAC,CAAC,MAAsB,CAAC,aAAa,CAAA;QACtD,MAAM,KAAK,GAAG,MAAM,IAAK,MAAM,CAAC,aAAa,CAAC,aAAa,CAAsB,CAAA;QAEjF,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,KAAK,GAAG,EAAE,CAAA;SACjB;QAED,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAES,cAAc,CAAC,EAAE,QAAQ,EAAiB;QAClD,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAEtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,QAAQ,CAAC,MAAM,CACb,IAAI,CAAC,IAAK,EACV,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACvG,CAAA;IACH,CAAC;CACF,CAAA;AAlI4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAAqB;AAtBpC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAwJ1B;SAxJY,cAAc","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\ntype Option = { text: string; value: string }\n\n@customElement('ox-input-options')\nexport class OxInputOptions extends OxFormField {\n static styles = css`\n div {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n }\n\n input[data-text] {\n grid-column: span 5;\n }\n\n input[data-value] {\n grid-column: span 4;\n }\n\n button {\n grid-column: span 1;\n }\n `\n\n @property({ type: Array }) value: Option[] = []\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n const options = this.value instanceof Array ? this.value : []\n\n return html`\n ${(options || []).map(\n item => html`\n <div data-record=\"\">\n <input type=\"text\" data-text=\"\" placeholder=\"text\" .value=${item.text} />\n <input type=\"text\" data-value=\"\" placeholder=\"value\" .value=${item.value} />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._delete(e)} tabindex=\"-1\">-</button>\n </div>\n `\n )}\n\n <div data-record-new=\"\">\n <input type=\"text\" data-text=\"\" placeholder=\"text\" value=\"\" />\n <input type=\"text\" data-value=\"\" placeholder=\"value\" value=\"\" @change=${(e: Event) => this._add()} />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._add()} tabindex=\"-1\">+</button>\n </div>\n `\n }\n\n private _changingNow: boolean = false\n\n _onChange(e: Event) {\n if (this._changingNow) return\n\n this._changingNow = true\n\n var input = e.target as HTMLInputElement\n var value = input.value\n\n var div = input.parentElement\n\n if (div && div.hasAttribute('data-record')) {\n var dataList = div.querySelectorAll('[data-value]:not([hidden])') as NodeListOf<HTMLInputElement>\n\n for (var i = 0; i < dataList.length; i++) {\n if (dataList[i] !== input) {\n dataList[i].value = value || ''\n }\n }\n }\n\n if (div && div.hasAttribute('data-record')) this._build(true)\n else if (div && div.hasAttribute('data-record-new') && input.hasAttribute('data-value')) this._add()\n\n e.stopPropagation()\n\n this._changingNow = false\n }\n\n _build(includeNewRecord?: any) {\n if (includeNewRecord) {\n var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>\n } else {\n var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>\n }\n\n var newoptions: Option[] = []\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n var text = (record.querySelector('[data-text]') as HTMLInputElement).value\n var inputs = record.querySelectorAll('[data-value]:not([style*=\"display: none\"])') as NodeListOf<HTMLInputElement>\n if (!inputs || inputs.length == 0) continue\n\n var input = inputs[inputs.length - 1]\n var value = input.value\n\n if (text) newoptions.push({ text: text, value: value || text })\n }\n\n this.value = newoptions\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n sort() {\n var sorter = function (a: Option, b: Option) {\n return b.text < a.text ? 1 : -1\n }\n\n this.value = [...this.value.sort(sorter)]\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n _add() {\n this._build(true)\n\n var inputs = this.renderRoot.querySelectorAll(\n '[data-record-new] input:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement>\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i]\n input.value = ''\n }\n\n inputs[0].focus()\n }\n\n _delete(e: Event) {\n const record = (e.target as HTMLElement).parentElement\n const input = record && (record.querySelector('[data-text]') as HTMLInputElement)\n\n if (input) {\n input.value = ''\n }\n\n this._build()\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { OxFormField } from './ox-form-field';
5
+ declare type PartitionKeys = {
6
+ [key: string]: any;
7
+ };
8
+ declare type ArrayedPartitionKeys = {
9
+ key: string;
10
+ value: any;
11
+ };
12
+ /**
13
+ key-value map for partitions editor element
14
+
15
+ Example:
16
+
17
+ <ox-input-partition-keys
18
+ value=${map}
19
+ </ox-input-partition-keys>
20
+ */
21
+ export declare class OxInputPartitionKeys extends OxFormField {
22
+ static styles: import("lit").CSSResult;
23
+ value: PartitionKeys;
24
+ private _changingNow;
25
+ firstUpdated(): void;
26
+ render(): import("lit-html").TemplateResult<1>;
27
+ _onChange(e: Event): void;
28
+ _build(includeNewRecord?: boolean): void;
29
+ _toArray(map: PartitionKeys): ArrayedPartitionKeys[];
30
+ _add(): void;
31
+ _delete(e: MouseEvent): void;
32
+ records: NodeListOf<HTMLElement>;
33
+ _up(e: MouseEvent): void;
34
+ _down(e: MouseEvent): void;
35
+ }
36
+ export {};