@operato/input 1.0.0-alpha.2 → 1.0.0-alpha.22

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 (101) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +9 -6
  3. package/assets/images/icon-editor-gradient-direction.png +0 -0
  4. package/assets/images/icon-properties-label.png +0 -0
  5. package/assets/images/icon-properties-line-type.png +0 -0
  6. package/assets/images/icon-properties-table.png +0 -0
  7. package/demo/index-color-gradient.html +35 -0
  8. package/demo/index-color-stops.html +62 -0
  9. package/demo/index-color.html +35 -0
  10. package/demo/index-file.html +41 -0
  11. package/demo/index-image.html +1 -1
  12. package/demo/index-multiple-colors.html +37 -0
  13. package/demo/index-options.html +43 -0
  14. package/demo/index-range.html +40 -0
  15. package/demo/index-table.html +39 -0
  16. package/demo/index-value-map.html +80 -0
  17. package/demo/index-value-ranges.html +80 -0
  18. package/demo/index.html +21 -54
  19. package/dist/src/index.d.ts +19 -11
  20. package/dist/src/index.js +19 -11
  21. package/dist/src/index.js.map +1 -1
  22. package/dist/src/ox-checkbox.js +1 -1
  23. package/dist/src/ox-checkbox.js.map +1 -1
  24. package/dist/src/ox-input-code.d.ts +4 -4
  25. package/dist/src/ox-input-code.js +8 -8
  26. package/dist/src/ox-input-code.js.map +1 -1
  27. package/dist/src/ox-input-color-gradient.d.ts +26 -0
  28. package/dist/src/ox-input-color-gradient.js +318 -0
  29. package/dist/src/ox-input-color-gradient.js.map +1 -0
  30. package/dist/src/ox-input-color-stops.d.ts +71 -0
  31. package/dist/src/ox-input-color-stops.js +445 -0
  32. package/dist/src/ox-input-color-stops.js.map +1 -0
  33. package/dist/src/ox-input-color.d.ts +176 -0
  34. package/dist/src/ox-input-color.js +298 -0
  35. package/dist/src/ox-input-color.js.map +1 -0
  36. package/dist/src/ox-input-data.d.ts +2 -2
  37. package/dist/src/ox-input-data.js +2 -2
  38. package/dist/src/ox-input-data.js.map +1 -1
  39. package/dist/src/ox-input-file.d.ts +2 -0
  40. package/dist/src/ox-input-file.js +6 -1
  41. package/dist/src/ox-input-file.js.map +1 -1
  42. package/dist/src/ox-input-layout/ox-input-card-layout.d.ts +4 -0
  43. package/dist/src/ox-input-layout/ox-input-card-layout.js +57 -0
  44. package/dist/src/ox-input-layout/ox-input-card-layout.js.map +1 -0
  45. package/dist/src/ox-input-layout/ox-input-grid-layout.d.ts +4 -0
  46. package/dist/src/ox-input-layout/ox-input-grid-layout.js +63 -0
  47. package/dist/src/ox-input-layout/ox-input-grid-layout.js.map +1 -0
  48. package/dist/src/ox-input-layout/ox-input-layout.d.ts +5 -0
  49. package/dist/src/ox-input-layout/ox-input-layout.js +73 -0
  50. package/dist/src/ox-input-layout/ox-input-layout.js.map +1 -0
  51. package/dist/src/ox-input-multiple-colors.d.ts +28 -0
  52. package/dist/src/ox-input-multiple-colors.js +113 -0
  53. package/dist/src/ox-input-multiple-colors.js.map +1 -0
  54. package/dist/src/ox-input-options.d.ts +22 -0
  55. package/dist/src/ox-input-options.js +137 -0
  56. package/dist/src/ox-input-options.js.map +1 -0
  57. package/dist/src/ox-input-range.d.ts +4 -0
  58. package/dist/src/ox-input-range.js +161 -0
  59. package/dist/src/ox-input-range.js.map +1 -0
  60. package/dist/src/{ox-input-id.d.ts → ox-input-scene-component-id.d.ts} +0 -0
  61. package/dist/src/{ox-input-id.js → ox-input-scene-component-id.js} +2 -2
  62. package/dist/src/ox-input-scene-component-id.js.map +1 -0
  63. package/dist/src/ox-input-stack.d.ts +1 -1
  64. package/dist/src/ox-input-stack.js +1 -1
  65. package/dist/src/ox-input-stack.js.map +1 -1
  66. package/dist/src/ox-input-table.d.ts +8 -0
  67. package/dist/src/ox-input-table.js +379 -0
  68. package/dist/src/ox-input-table.js.map +1 -0
  69. package/dist/src/ox-input-value-map.d.ts +41 -0
  70. package/dist/src/ox-input-value-map.js +278 -0
  71. package/dist/src/ox-input-value-map.js.map +1 -0
  72. package/dist/src/ox-input-value-ranges.d.ts +41 -0
  73. package/dist/src/ox-input-value-ranges.js +298 -0
  74. package/dist/src/ox-input-value-ranges.js.map +1 -0
  75. package/dist/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +23 -7
  77. package/src/index.ts +19 -11
  78. package/src/ox-checkbox.ts +1 -1
  79. package/src/ox-input-code.ts +9 -10
  80. package/src/ox-input-color-gradient.ts +343 -0
  81. package/src/ox-input-color-stops.ts +499 -0
  82. package/src/ox-input-color.ts +323 -0
  83. package/src/ox-input-data.ts +5 -5
  84. package/src/ox-input-file.ts +8 -3
  85. package/src/ox-input-layout/ox-input-card-layout.ts +58 -0
  86. package/src/ox-input-layout/ox-input-grid-layout.ts +64 -0
  87. package/src/ox-input-layout/ox-input-layout.ts +77 -0
  88. package/src/ox-input-multiple-colors.ts +113 -0
  89. package/src/ox-input-options.ts +165 -0
  90. package/src/ox-input-range.ts +147 -0
  91. package/src/{ox-input-id.ts → ox-input-scene-component-id.ts} +1 -1
  92. package/src/ox-input-stack.ts +1 -1
  93. package/src/ox-input-table.ts +404 -0
  94. package/src/{ox-input-keyvalues.ts.ing → ox-input-value-map.ts} +122 -93
  95. package/src/ox-input-value-ranges.ts +325 -0
  96. package/translations/en.json +1 -0
  97. package/translations/ko.json +1 -0
  98. package/translations/ms.json +1 -0
  99. package/translations/zh.json +1 -0
  100. package/dist/src/ox-input-id.js.map +0 -1
  101. package/src/ox-input-ranges.ts.ing +0 -292
@@ -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,E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AA;IACH,CAAC;IAED,cAAc,CAAC,CAAQ;QACrB,IAAI,OAAO,GAAG,CAAC,CAAC,MAAqB,CAAA;QACrC,IAAI,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAE3C,IAAI,CAAC,GAAG,EAAE;YACR,OAAM;SACP;QAED,YAAY;QACZ,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAA;QAEzB,IAAI,CAAC,KAAK,GAAG;YACX,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,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;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,EAA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AE,CAAA;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,CAAC,IAAI,MAAM,CAAE,CAAC,CAAC,MAAsB,CAAC,OAAO,CAAC,KAAK,CAAC;gBAAE,SAAQ;;gBAC7D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;SAChC;QAED,IAAI,CAAC,KAAK,GAAG,MAAM,CAAA;QACnB,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;AAxD4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,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,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAK7C,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,WAAW;IAA/C;;QAsB6B,UAAK,GAAa,EAAE,CAAA;QA4BvC,iBAAY,GAAY,KAAK,CAAA;IAsGvC,CAAC;aAvJQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;GAmBlB,CAAA;IAID,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,MAAM;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;QAE7D,OAAO,IAAI,CAAA;QACP,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CACnB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA;;wEAEoD,IAAI,CAAC,IAAI;0EACP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,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,4 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ export {};
@@ -0,0 +1,161 @@
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.js';
8
+ let OxInputRange = class OxInputRange extends OxFormField {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.value = 0;
12
+ this.step = 1;
13
+ this.min = -100;
14
+ this.max = 100;
15
+ }
16
+ static { this.styles = css `
17
+ :host {
18
+ font-size: 16px;
19
+ display: flex;
20
+ align-items: center;
21
+ padding: 1px 0;
22
+
23
+ width: 100%;
24
+ user-select: text;
25
+ }
26
+
27
+ input[type='number'] {
28
+ width: 48px;
29
+ overflow: hidden;
30
+ }
31
+
32
+ input[type='number'] {
33
+ color: black;
34
+ border: none;
35
+ font-weight: 300;
36
+ background: white;
37
+ padding: 1px 2px;
38
+ }
39
+
40
+ input[type='range'] {
41
+ -webkit-appearance: none;
42
+ border: none;
43
+ outline: none;
44
+ width: 100%;
45
+ flex: 1;
46
+ height: 16px;
47
+ background-color: transparent;
48
+ }
49
+ input[type='range']::-webkit-slider-runnable-track {
50
+ width: 100%;
51
+ height: 1px;
52
+ background: black;
53
+ border: none;
54
+ border-radius: 5px;
55
+ }
56
+ input[type='range']::-webkit-slider-thumb {
57
+ -webkit-appearance: none;
58
+ border: none;
59
+ height: 10px;
60
+ width: 10px;
61
+ border-radius: 50%;
62
+ background: black;
63
+ margin-top: -5px;
64
+ }
65
+ input[type='range']:focus {
66
+ outline: none;
67
+ }
68
+ input[type='range']:focus::-webkit-slider-runnable-track {
69
+ background: black;
70
+ }
71
+
72
+ input[type='range']::-moz-range-track {
73
+ width: 100%;
74
+ height: 1px;
75
+ background: black;
76
+ border: none;
77
+ border-radius: 5px;
78
+ }
79
+ input[type='range']::-moz-range-thumb {
80
+ border: none;
81
+ height: 10px;
82
+ width: 10px;
83
+ border-radius: 50%;
84
+ background: black;
85
+ }
86
+
87
+ input[type='range']:-moz-focusring {
88
+ outline: 1px solid black;
89
+ outline-offset: -1px;
90
+ }
91
+
92
+ input[type='range']::-ms-track {
93
+ width: 100%;
94
+ height: 1px;
95
+ background: black;
96
+ border-radius: 10px;
97
+ color: transparent;
98
+ border: none;
99
+ outline: none;
100
+ }
101
+ input[type='range']::-ms-thumb {
102
+ height: 10px;
103
+ width: 10px;
104
+ border-radius: 50%;
105
+ background: black;
106
+ border: none;
107
+ outline: none;
108
+ margin-top: 2px;
109
+ }
110
+
111
+ input:focus {
112
+ outline: none;
113
+ opacity: 1;
114
+ }
115
+ `; }
116
+ render() {
117
+ return html `
118
+ <input
119
+ type="range"
120
+ .value=${this.value}
121
+ .step=${this.step}
122
+ .min=${this.min}
123
+ .max=${this.max}
124
+ @input=${(e) => {
125
+ e.stopPropagation();
126
+ this.value = Number(e.target.value);
127
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
128
+ }}
129
+ />
130
+
131
+ <input
132
+ type="number"
133
+ .value=${this.value}
134
+ .step=${this.step}
135
+ .min=${this.min}
136
+ .max=${this.max}
137
+ @change=${(e) => {
138
+ e.stopPropagation();
139
+ this.value = Number(e.target.value);
140
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
141
+ }}
142
+ />
143
+ `;
144
+ }
145
+ };
146
+ __decorate([
147
+ property({ type: Number })
148
+ ], OxInputRange.prototype, "value", void 0);
149
+ __decorate([
150
+ property({ type: Number })
151
+ ], OxInputRange.prototype, "step", void 0);
152
+ __decorate([
153
+ property({ type: Number })
154
+ ], OxInputRange.prototype, "min", void 0);
155
+ __decorate([
156
+ property({ type: Number })
157
+ ], OxInputRange.prototype, "max", void 0);
158
+ OxInputRange = __decorate([
159
+ customElement('ox-input-range')
160
+ ], OxInputRange);
161
+ //# sourceMappingURL=ox-input-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-range.js","sourceRoot":"","sources":["../../src/ox-input-range.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGhD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,WAAW;IAAtC;;QAsG8B,UAAK,GAAW,CAAC,CAAA;QACjB,SAAI,GAAW,CAAC,CAAA;QAChB,QAAG,GAAW,CAAC,GAAG,CAAA;QAClB,QAAG,GAAW,GAAG,CAAA;IA+B/C,CAAC;aAvIQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGlB,CAAA;IAOD,MAAM;QACJ,OAAO,IAAI,CAAA;;;iBAGE,IAAI,CAAC,KAAK;gBACX,IAAI,CAAC,IAAI;eACV,IAAI,CAAC,GAAG;eACR,IAAI,CAAC,GAAG;iBACN,CAAC,CAAa,EAAE,EAAE;YACzB,CAAC,CAAC,eAAe,EAAE,CAAA;YACnB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;YACzD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAClF,CAAC;;;;;iBAKQ,IAAI,CAAC,KAAK;gBACX,IAAI,CAAC,IAAI;eACV,IAAI,CAAC,GAAG;eACR,IAAI,CAAC,GAAG;kBACL,CAAC,CAAQ,EAAE,EAAE;YACrB,CAAC,CAAC,eAAe,EAAE,CAAA;YACnB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;YACzD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QAClF,CAAC;;KAEJ,CAAA;IACH,CAAC;CACF,CAAA;AAlC6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAkB;AAzGzC,YAAY;IADjB,aAAa,CAAC,gBAAgB,CAAC;GAC1B,YAAY,CAwIjB","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.js'\n\n@customElement('ox-input-range')\nclass OxInputRange extends OxFormField {\n static styles = css`\n :host {\n font-size: 16px;\n display: flex;\n align-items: center;\n padding: 1px 0;\n\n width: 100%;\n user-select: text;\n }\n\n input[type='number'] {\n width: 48px;\n overflow: hidden;\n }\n\n input[type='number'] {\n color: black;\n border: none;\n font-weight: 300;\n background: white;\n padding: 1px 2px;\n }\n\n input[type='range'] {\n -webkit-appearance: none;\n border: none;\n outline: none;\n width: 100%;\n flex: 1;\n height: 16px;\n background-color: transparent;\n }\n input[type='range']::-webkit-slider-runnable-track {\n width: 100%;\n height: 1px;\n background: black;\n border: none;\n border-radius: 5px;\n }\n input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n border: none;\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: black;\n margin-top: -5px;\n }\n input[type='range']:focus {\n outline: none;\n }\n input[type='range']:focus::-webkit-slider-runnable-track {\n background: black;\n }\n\n input[type='range']::-moz-range-track {\n width: 100%;\n height: 1px;\n background: black;\n border: none;\n border-radius: 5px;\n }\n input[type='range']::-moz-range-thumb {\n border: none;\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: black;\n }\n\n input[type='range']:-moz-focusring {\n outline: 1px solid black;\n outline-offset: -1px;\n }\n\n input[type='range']::-ms-track {\n width: 100%;\n height: 1px;\n background: black;\n border-radius: 10px;\n color: transparent;\n border: none;\n outline: none;\n }\n input[type='range']::-ms-thumb {\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background: black;\n border: none;\n outline: none;\n margin-top: 2px;\n }\n\n input:focus {\n outline: none;\n opacity: 1;\n }\n `\n\n @property({ type: Number }) value: number = 0\n @property({ type: Number }) step: number = 1\n @property({ type: Number }) min: number = -100\n @property({ type: Number }) max: number = 100\n\n render() {\n return html`\n <input\n type=\"range\"\n .value=${this.value}\n .step=${this.step}\n .min=${this.min}\n .max=${this.max}\n @input=${(e: InputEvent) => {\n e.stopPropagation()\n this.value = Number((e.target as HTMLInputElement).value)\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }}\n />\n\n <input\n type=\"number\"\n .value=${this.value}\n .step=${this.step}\n .min=${this.min}\n .max=${this.max}\n @change=${(e: Event) => {\n e.stopPropagation()\n this.value = Number((e.target as HTMLInputElement).value)\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }}\n />\n `\n }\n}\n"]}
@@ -62,7 +62,7 @@ __decorate([
62
62
  state()
63
63
  ], OxInputId.prototype, "_ids", void 0);
64
64
  OxInputId = __decorate([
65
- customElement('ox-input-id')
65
+ customElement('ox-input-scene-component-id')
66
66
  ], OxInputId);
67
67
  export { OxInputId };
68
- //# sourceMappingURL=ox-input-id.js.map
68
+ //# sourceMappingURL=ox-input-scene-component-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-scene-component-id.js","sourceRoot":"","sources":["../../src/ox-input-scene-component-id.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7C,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,WAAW;IAA1C;;QAmBW,SAAI,GAAkB,EAAE,CAAA;IA0CnC,CAAC;aA5DQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;GAclB,CAAA;IAMD,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAA;QAE3B,OAAO,IAAI,CAAA;;;;iBAIE,IAAI,CAAC,KAAK,IAAI,EAAE;mBACd,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;kBAC3C,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;uBACrC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE;;;;2BAIlC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAA,kBAAkB,EAAE,aAAa,CAAC;KAC1E,CAAA;IACH,CAAC;IAED,eAAe,CAAC,CAAa;QAC3B,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;QAEvC,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,6BAA6B,EAAE;YAC7C,MAAM,EAAE;gBACN,SAAS;gBACT,QAAQ,EAAE,CAAC,GAAa,EAAE,EAAE;oBAC1B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;gBACjB,CAAC;aACF;SACF,CAAC,CACH,CAAA;IACH,CAAC;IAED,eAAe,CAAC,CAAa;QAC3B,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,KAAK,GAAI,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAA;QAEjD,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;AA5C6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAoD;AAEtE;IAAR,KAAK,EAAE;uCAAyB;AAnBtB,SAAS;IADrB,aAAa,CAAC,6BAA6B,CAAC;GAChC,SAAS,CA6DrB;SA7DY,SAAS","sourcesContent":["import { css, html } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-scene-component-id')\nexport class OxInputId extends OxFormField {\n static styles = css`\n :host {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n\n input {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n @property({ type: Object }) property: { component?: string } | null | undefined\n\n @state() _ids: Array<string> = []\n\n render() {\n const ids = this._ids || []\n\n return html`\n <input\n id=\"text\"\n type=\"text\"\n .value=${this.value || ''}\n @focusin=${(e: FocusEvent) => this._onInputFocused(e)}\n @change=${(e: InputEvent) => this._onInputChanged(e)}\n .placeholder=${this.getAttribute('placeholder') || ''}\n list=\"ids\"\n />\n\n <datalist id=\"ids\">${ids.map(id => html` <option value=${id}></option> `)}</datalist>\n `\n }\n\n _onInputFocused(e: FocusEvent) {\n var { component } = this.property || {}\n\n document.dispatchEvent(\n new CustomEvent('get-all-scene-component-ids', {\n detail: {\n component,\n callback: (ids: string[]) => {\n this._ids = ids\n }\n }\n })\n )\n }\n\n _onInputChanged(e: InputEvent) {\n e.stopPropagation()\n\n this.value = (e.target as HTMLInputElement).value\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
  import { OxFormField } from './ox-form-field';
5
- export default class OxInputStack extends OxFormField {
5
+ export declare class OxInputStack extends OxFormField {
6
6
  static styles: import("lit").CSSResult[];
7
7
  /**
8
8
  * `stack`은 stack에 의해 만들어진 층의 배열을 유지한다.
@@ -110,5 +110,5 @@ __decorate([
110
110
  OxInputStack = __decorate([
111
111
  customElement('ox-input-stack')
112
112
  ], OxInputStack);
113
- export default OxInputStack;
113
+ export { OxInputStack };
114
114
  //# sourceMappingURL=ox-input-stack.js.map