@operato/input 1.0.0-alpha.4 → 1.0.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +310 -0
- package/README.md +9 -6
- package/assets/images/icon-editor-gradient-direction.png +0 -0
- package/assets/images/icon-properties-label.png +0 -0
- package/assets/images/icon-properties-line-type.png +0 -0
- package/assets/images/icon-properties-table.png +0 -0
- package/demo/index-color-gradient.html +35 -0
- package/demo/index-color-stops.html +62 -0
- package/demo/index-color.html +35 -0
- package/demo/index-crontab.html +36 -0
- package/demo/index-file.html +41 -0
- package/demo/index-image.html +1 -1
- package/demo/index-multiple-colors.html +37 -0
- package/demo/index-options.html +43 -0
- package/demo/index-partition-keys.html +71 -0
- package/demo/index-range.html +40 -0
- package/demo/index-select.html +21 -14
- package/demo/index-table.html +39 -0
- package/demo/index-value-map.html +80 -0
- package/demo/index-value-ranges.html +80 -0
- package/demo/index.html +23 -54
- package/dist/src/index.d.ts +21 -11
- package/dist/src/index.js +21 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-checkbox.js +1 -1
- package/dist/src/ox-checkbox.js.map +1 -1
- package/dist/src/ox-input-code.d.ts +4 -4
- package/dist/src/ox-input-code.js +8 -8
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/src/ox-input-color-gradient.d.ts +26 -0
- package/dist/src/ox-input-color-gradient.js +318 -0
- package/dist/src/ox-input-color-gradient.js.map +1 -0
- package/dist/src/ox-input-color-stops.d.ts +71 -0
- package/dist/src/ox-input-color-stops.js +445 -0
- package/dist/src/ox-input-color-stops.js.map +1 -0
- package/dist/src/ox-input-color.d.ts +176 -0
- package/dist/src/ox-input-color.js +298 -0
- package/dist/src/ox-input-color.js.map +1 -0
- package/dist/src/ox-input-crontab.d.ts +23 -0
- package/dist/src/ox-input-crontab.js +560 -0
- package/dist/src/ox-input-crontab.js.map +1 -0
- package/dist/src/ox-input-data.d.ts +2 -2
- package/dist/src/ox-input-data.js +2 -2
- package/dist/src/ox-input-data.js.map +1 -1
- package/dist/src/ox-input-file.d.ts +2 -0
- package/dist/src/ox-input-file.js +6 -1
- package/dist/src/ox-input-file.js.map +1 -1
- package/dist/src/ox-input-layout/ox-input-card-layout.d.ts +4 -0
- package/dist/src/ox-input-layout/ox-input-card-layout.js +57 -0
- package/dist/src/ox-input-layout/ox-input-card-layout.js.map +1 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.d.ts +4 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.js +63 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.js.map +1 -0
- package/dist/src/ox-input-layout/ox-input-layout.d.ts +5 -0
- package/dist/src/ox-input-layout/ox-input-layout.js +73 -0
- package/dist/src/ox-input-layout/ox-input-layout.js.map +1 -0
- package/dist/src/ox-input-multiple-colors.d.ts +28 -0
- package/dist/src/ox-input-multiple-colors.js +113 -0
- package/dist/src/ox-input-multiple-colors.js.map +1 -0
- package/dist/src/ox-input-options.d.ts +22 -0
- package/dist/src/ox-input-options.js +137 -0
- package/dist/src/ox-input-options.js.map +1 -0
- package/dist/src/ox-input-partition-keys.d.ts +36 -0
- package/dist/src/ox-input-partition-keys.js +204 -0
- package/dist/src/ox-input-partition-keys.js.map +1 -0
- package/dist/src/ox-input-range.d.ts +4 -0
- package/dist/src/ox-input-range.js +161 -0
- package/dist/src/ox-input-range.js.map +1 -0
- package/dist/src/{ox-input-id.d.ts → ox-input-scene-component-id.d.ts} +0 -0
- package/dist/src/{ox-input-id.js → ox-input-scene-component-id.js} +2 -2
- package/dist/src/ox-input-scene-component-id.js.map +1 -0
- package/dist/src/ox-input-stack.d.ts +1 -1
- package/dist/src/ox-input-stack.js +1 -1
- package/dist/src/ox-input-stack.js.map +1 -1
- package/dist/src/ox-input-table.d.ts +8 -0
- package/dist/src/ox-input-table.js +379 -0
- package/dist/src/ox-input-table.js.map +1 -0
- package/dist/src/ox-input-value-map.d.ts +41 -0
- package/dist/src/ox-input-value-map.js +279 -0
- package/dist/src/ox-input-value-map.js.map +1 -0
- package/dist/src/ox-input-value-ranges.d.ts +41 -0
- package/dist/src/ox-input-value-ranges.js +298 -0
- package/dist/src/ox-input-value-ranges.js.map +1 -0
- package/dist/src/ox-select.d.ts +3 -0
- package/dist/src/ox-select.js +28 -3
- package/dist/src/ox-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -7
- package/src/index.ts +21 -11
- package/src/ox-checkbox.ts +1 -1
- package/src/ox-input-code.ts +9 -10
- package/src/ox-input-color-gradient.ts +343 -0
- package/src/ox-input-color-stops.ts +499 -0
- package/src/ox-input-color.ts +323 -0
- package/src/ox-input-crontab.ts +560 -0
- package/src/ox-input-data.ts +5 -5
- package/src/ox-input-file.ts +8 -3
- package/src/ox-input-layout/ox-input-card-layout.ts +58 -0
- package/src/ox-input-layout/ox-input-grid-layout.ts +64 -0
- package/src/ox-input-layout/ox-input-layout.ts +77 -0
- package/src/ox-input-multiple-colors.ts +113 -0
- package/src/ox-input-options.ts +165 -0
- package/src/ox-input-partition-keys.ts +243 -0
- package/src/ox-input-range.ts +147 -0
- package/src/{ox-input-id.ts → ox-input-scene-component-id.ts} +1 -1
- package/src/ox-input-stack.ts +1 -1
- package/src/ox-input-table.ts +404 -0
- package/src/{ox-input-keyvalues.ts.ing → ox-input-value-map.ts} +125 -94
- package/src/ox-input-value-ranges.ts +325 -0
- package/src/ox-select.ts +31 -5
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
- package/dist/src/ox-input-id.js.map +0 -1
- package/src/ox-input-ranges.ts.ing +0 -292
@@ -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,CA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AAC,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 {};
|
@@ -0,0 +1,204 @@
|
|
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, queryAll } from 'lit/decorators.js';
|
7
|
+
import { OxFormField } from './ox-form-field';
|
8
|
+
/**
|
9
|
+
key-value map for partitions editor element
|
10
|
+
|
11
|
+
Example:
|
12
|
+
|
13
|
+
<ox-input-partition-keys
|
14
|
+
value=${map}
|
15
|
+
</ox-input-partition-keys>
|
16
|
+
*/
|
17
|
+
let OxInputPartitionKeys = class OxInputPartitionKeys extends OxFormField {
|
18
|
+
constructor() {
|
19
|
+
super(...arguments);
|
20
|
+
this.value = {};
|
21
|
+
this._changingNow = false;
|
22
|
+
}
|
23
|
+
static { this.styles = css `
|
24
|
+
:host {
|
25
|
+
display: flex;
|
26
|
+
flex-direction: column;
|
27
|
+
align-content: center;
|
28
|
+
|
29
|
+
width: 100%;
|
30
|
+
overflow: hidden;
|
31
|
+
border: 1px solid #ccc;
|
32
|
+
}
|
33
|
+
|
34
|
+
div {
|
35
|
+
display: flex;
|
36
|
+
flex-flow: row nowrap;
|
37
|
+
align-items: center;
|
38
|
+
|
39
|
+
border-bottom: 1px solid #c0c0c0;
|
40
|
+
}
|
41
|
+
|
42
|
+
div:last-child {
|
43
|
+
border-bottom: none;
|
44
|
+
}
|
45
|
+
|
46
|
+
div > * {
|
47
|
+
min-width: 0px;
|
48
|
+
margin: 2px;
|
49
|
+
padding: 0;
|
50
|
+
}
|
51
|
+
|
52
|
+
button {
|
53
|
+
width: 20px;
|
54
|
+
text-align: center;
|
55
|
+
}
|
56
|
+
|
57
|
+
input {
|
58
|
+
flex: 1;
|
59
|
+
}
|
60
|
+
`; }
|
61
|
+
firstUpdated() {
|
62
|
+
this.renderRoot.addEventListener('change', this._onChange.bind(this));
|
63
|
+
}
|
64
|
+
render() {
|
65
|
+
const value = !this.value || typeof this.value !== 'object' ? {} : this.value;
|
66
|
+
return html `
|
67
|
+
${this._toArray(value).map(item => html `
|
68
|
+
<div data-record>
|
69
|
+
<input type="text" data-key placeholder="key" .value=${item.key} />
|
70
|
+
<input type="text" data-value placeholder="value" .value=${item.value} list="value-template" />
|
71
|
+
<button class="record-action" @click=${(e) => this._delete(e)} tabindex="-1">-</button>
|
72
|
+
<button class="record-action" @click=${(e) => this._up(e)} tabindex="-1">↑</button>
|
73
|
+
<button class="record-action" @click=${(e) => this._down(e)} tabindex="-1">↓</button>
|
74
|
+
</div>
|
75
|
+
`)}
|
76
|
+
|
77
|
+
<div data-record-new>
|
78
|
+
<input type="text" data-key placeholder="key" value="" />
|
79
|
+
<input type="text" data-value placeholder="value" value="" list="value-template" />
|
80
|
+
<button class="record-action" @click=${(e) => this._add()} tabindex="-1">+</button>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<datalist id="value-template">
|
84
|
+
<option value="%YYYY">year</option>
|
85
|
+
<option value="%MM">month</option>
|
86
|
+
<option value="%DD">day</option>
|
87
|
+
<option value="%YYYYMMDD">date</option>
|
88
|
+
</datalist>
|
89
|
+
`;
|
90
|
+
}
|
91
|
+
_onChange(e) {
|
92
|
+
if (this._changingNow) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
this._changingNow = true;
|
96
|
+
const input = e.target;
|
97
|
+
var value = input.value;
|
98
|
+
const record = e.target.closest('[data-record],[data-record-new]');
|
99
|
+
if (record.hasAttribute('data-record')) {
|
100
|
+
this._build();
|
101
|
+
}
|
102
|
+
else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {
|
103
|
+
this._add();
|
104
|
+
}
|
105
|
+
this._changingNow = false;
|
106
|
+
}
|
107
|
+
_build(includeNewRecord) {
|
108
|
+
if (includeNewRecord) {
|
109
|
+
var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]');
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
var records = this.renderRoot.querySelectorAll('[data-record]');
|
113
|
+
}
|
114
|
+
var newmap = {};
|
115
|
+
for (var i = 0; i < records.length; i++) {
|
116
|
+
var record = records[i];
|
117
|
+
const key = record.querySelector('[data-key]').value;
|
118
|
+
const inputs = record.querySelectorAll('[data-value]:not([style*="display: none"])');
|
119
|
+
if (!inputs || inputs.length == 0) {
|
120
|
+
continue;
|
121
|
+
}
|
122
|
+
var input = inputs[inputs.length - 1];
|
123
|
+
var value = input.value;
|
124
|
+
if (key) {
|
125
|
+
newmap[key] = value || '';
|
126
|
+
}
|
127
|
+
}
|
128
|
+
this.value = newmap;
|
129
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
|
130
|
+
}
|
131
|
+
/* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */
|
132
|
+
_toArray(map) {
|
133
|
+
var array = [];
|
134
|
+
for (var key in map) {
|
135
|
+
array.push({
|
136
|
+
key: key,
|
137
|
+
value: map[key]
|
138
|
+
});
|
139
|
+
}
|
140
|
+
return array;
|
141
|
+
}
|
142
|
+
_add() {
|
143
|
+
this._build(true);
|
144
|
+
const inputs = this.renderRoot.querySelectorAll('[data-record-new] input:not([style*="display: none"])');
|
145
|
+
for (var i = 0; i < inputs.length; i++) {
|
146
|
+
let input = inputs[i];
|
147
|
+
if (input.type == 'checkbox')
|
148
|
+
input.checked = false;
|
149
|
+
else
|
150
|
+
input.value = '';
|
151
|
+
}
|
152
|
+
inputs[0].focus();
|
153
|
+
}
|
154
|
+
_delete(e) {
|
155
|
+
const record = e.target.closest('[data-record]');
|
156
|
+
record.querySelector('[data-key]').value = '';
|
157
|
+
this._build();
|
158
|
+
}
|
159
|
+
_up(e) {
|
160
|
+
const record = e.target.closest('[data-record]');
|
161
|
+
const array = Array.from(this.records);
|
162
|
+
const index = array.indexOf(record) - 1;
|
163
|
+
if (index < 0) {
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
const deleted = array.splice(index, 1);
|
167
|
+
array.splice(index + 1, 0, ...deleted);
|
168
|
+
this.value = array.reduce((sum, record) => {
|
169
|
+
const key = record.querySelector('[data-key]').value;
|
170
|
+
const value = record.querySelector('[data-value]').value;
|
171
|
+
sum[key] = value;
|
172
|
+
return sum;
|
173
|
+
}, {});
|
174
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
|
175
|
+
}
|
176
|
+
_down(e) {
|
177
|
+
const record = e.target.closest('[data-record]');
|
178
|
+
const array = Array.from(this.records);
|
179
|
+
const index = array.indexOf(record);
|
180
|
+
if (index > array.length) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
array.splice(index, 1);
|
184
|
+
array.splice(index + 1, 0, record);
|
185
|
+
this.value = array.reduce((sum, record) => {
|
186
|
+
const key = record.querySelector('[data-key]').value;
|
187
|
+
const value = record.querySelector('[data-value]').value;
|
188
|
+
sum[key] = value;
|
189
|
+
return sum;
|
190
|
+
}, {});
|
191
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
|
192
|
+
}
|
193
|
+
};
|
194
|
+
__decorate([
|
195
|
+
property({ type: Object })
|
196
|
+
], OxInputPartitionKeys.prototype, "value", void 0);
|
197
|
+
__decorate([
|
198
|
+
queryAll('[data-record]')
|
199
|
+
], OxInputPartitionKeys.prototype, "records", void 0);
|
200
|
+
OxInputPartitionKeys = __decorate([
|
201
|
+
customElement('ox-input-partition-keys')
|
202
|
+
], OxInputPartitionKeys);
|
203
|
+
export { OxInputPartitionKeys };
|
204
|
+
//# sourceMappingURL=ox-input-partition-keys.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-partition-keys.js","sourceRoot":"","sources":["../../src/ox-input-partition-ke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jD,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CA4NhC;SA5NY,oBAAoB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property, queryAll } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\ntype PartitionKeys = { [key: string]: any }\ntype ArrayedPartitionKeys = { key: string; value: any }\n\n/**\n key-value map for partitions editor element\n \n Example:\n \n <ox-input-partition-keys \n value=${map}\n </ox-input-partition-keys>\n */\n@customElement('ox-input-partition-keys')\nexport class OxInputPartitionKeys extends OxFormField {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n align-content: center;\n\n width: 100%;\n overflow: hidden;\n border: 1px solid #ccc;\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n\n border-bottom: 1px solid #c0c0c0;\n }\n\n div:last-child {\n border-bottom: none;\n }\n\n div > * {\n min-width: 0px;\n margin: 2px;\n padding: 0;\n }\n\n button {\n width: 20px;\n text-align: center;\n }\n\n input {\n flex: 1;\n }\n `\n\n @property({ type: Object }) value: PartitionKeys = {}\n\n private _changingNow: boolean = false\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n render() {\n const value = !this.value || typeof this.value !== 'object' ? {} : this.value\n\n return html`\n ${this._toArray(value).map(\n item => html`\n <div data-record>\n <input type=\"text\" data-key placeholder=\"key\" .value=${item.key} />\n <input type=\"text\" data-value placeholder=\"value\" .value=${item.value} list=\"value-template\" />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._delete(e)} tabindex=\"-1\">-</button>\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._up(e)} tabindex=\"-1\">↑</button>\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._down(e)} tabindex=\"-1\">↓</button>\n </div>\n `\n )}\n\n <div data-record-new>\n <input type=\"text\" data-key placeholder=\"key\" value=\"\" />\n <input type=\"text\" data-value placeholder=\"value\" value=\"\" list=\"value-template\" />\n <button class=\"record-action\" @click=${(e: MouseEvent) => this._add()} tabindex=\"-1\">+</button>\n </div>\n\n <datalist id=\"value-template\">\n <option value=\"%YYYY\">year</option>\n <option value=\"%MM\">month</option>\n <option value=\"%DD\">day</option>\n <option value=\"%YYYYMMDD\">date</option>\n </datalist>\n `\n }\n\n _onChange(e: Event) {\n if (this._changingNow) {\n return\n }\n\n this._changingNow = true\n\n const input = e.target as HTMLInputElement\n var value = input.value\n\n const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement\n\n if (record.hasAttribute('data-record')) {\n this._build()\n } else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\n\n this._changingNow = false\n }\n\n _build(includeNewRecord?: boolean) {\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 newmap: PartitionKeys = {}\n\n for (var i = 0; i < records.length; i++) {\n var record = records[i]\n\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const inputs = record.querySelectorAll(\n '[data-value]:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement>\n\n if (!inputs || inputs.length == 0) {\n continue\n }\n\n var input = inputs[inputs.length - 1]\n\n var value = input.value\n\n if (key) {\n newmap[key] = value || ''\n }\n }\n\n this.value = newmap\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n /* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */\n _toArray(map: PartitionKeys) {\n var array: ArrayedPartitionKeys[] = []\n\n for (var key in map) {\n array.push({\n key: key,\n value: map[key]\n })\n }\n\n return array\n }\n\n _add() {\n this._build(true)\n\n const inputs = this.renderRoot.querySelectorAll(\n '[data-record-new] input:not([style*=\"display: none\"])'\n ) as NodeListOf<HTMLInputElement & { value: any }>\n\n for (var i = 0; i < inputs.length; i++) {\n let input = inputs[i]\n\n if (input.type == 'checkbox') input.checked = false\n else input.value = ''\n }\n\n inputs[0].focus()\n }\n\n _delete(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n\n ;(record!.querySelector('[data-key]') as HTMLInputElement)!.value = ''\n\n this._build()\n }\n\n @queryAll('[data-record]') records!: NodeListOf<HTMLElement>\n\n _up(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record) - 1\n\n if (index < 0) {\n return\n }\n\n const deleted = array.splice(index, 1)\n array.splice(index + 1, 0, ...deleted)\n\n this.value = array.reduce((sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = value\n return sum\n }, {} as { [key: string]: string })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n\n _down(e: MouseEvent) {\n const record = (e.target as Element).closest('[data-record]') as HTMLElement\n const array = Array.from(this.records)\n const index = array.indexOf(record)\n\n if (index > array.length) {\n return\n }\n\n array.splice(index, 1)\n array.splice(index + 1, 0, record)\n\n this.value = array.reduce((sum, record) => {\n const key = (record.querySelector('[data-key]') as HTMLInputElement).value\n const value = (record.querySelector('[data-value]') as HTMLInputElement).value\n\n sum[key] = value\n return sum\n }, {} as { [key: string]: string })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n }\n}\n"]}
|
@@ -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"]}
|
File without changes
|
@@ -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
|
5
|
+
export declare class OxInputStack extends OxFormField {
|
6
6
|
static styles: import("lit").CSSResult[];
|
7
7
|
/**
|
8
8
|
* `stack`은 stack에 의해 만들어진 층의 배열을 유지한다.
|