@operato/input 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +235 -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-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 +202 -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/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 +240 -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/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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-data.js","sourceRoot":"","sources":["../../src/ox-input-data.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,iBAAiB,CAAA;AAExB,OAAO,
|
1
|
+
{"version":3,"file":"ox-input-data.js","sourceRoot":"","sources":["../../src/ox-input-data.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,iBAAiB,CAAA;AAExB,OAAO,EAAkB,GAAG,EAAE,IAAI,EAA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AAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AA5HY,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CA4HvB;SA5HY,WAAW","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-code'\n\nimport { PropertyValues, css, html } from 'lit'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { OxInputCode } from './ox-input-code.js'\nimport { customElement } from 'lit/decorators.js'\n\n/**\nWEB Component for code-mirror based data editor.\n\nExample:\n\n <ox-input-data value=${text}>\n </ox-input-data>\n*/\n@customElement('ox-input-data')\nexport class OxInputData extends OxFormField {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n div[datatype] {\n display: flex;\n align-items: center;\n padding: 2px;\n background-color: rgba(0, 0, 0, 0.08);\n font-size: small;\n }\n\n div[datatype] mwc-icon {\n margin-left: auto;\n }\n\n ox-input-code {\n flex: 1;\n max-width: 260px;\n overflow: auto;\n }\n `\n ]\n\n render() {\n return html`\n <div datatype>\n <input\n type=\"radio\"\n name=\"data-type\"\n data-value=\"string\"\n .checked=${typeof this.value == 'string'}\n @click=${() => this._setDataType('string')}\n />string\n\n <input\n type=\"radio\"\n name=\"data-type\"\n data-value=\"number\"\n .checked=${typeof this.value == 'number'}\n @click=${() => this._setDataType('number')}\n />number\n\n <input\n type=\"radio\"\n name=\"data-type\"\n data-value=\"object\"\n .checked=${typeof this.value == 'object'}\n @click=${() => this._setDataType('object')}\n />object\n <mwc-icon @click=${() => this._clearData()} title=\"delete\">delete_forever</mwc-icon>\n </div>\n\n <ox-input-code .value=${this._getData(this.value)} editor> </ox-input-code>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', e => {\n e.stopPropagation()\n const target = e.target as OxInputCode\n if (target.hasAttribute('editor')) {\n this.value = target.value\n }\n\n const type = this.renderRoot.querySelector('input[name=data-type]:checked')?.getAttribute('data-value')\n this._setDataType(type)\n })\n }\n\n udpated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n this.value = this._getData(this.value)\n }\n }\n\n _setDataType(type: string | undefined | null) {\n if (typeof this.value !== type) {\n var value = this.value\n\n try {\n switch (type) {\n case 'string':\n this.value = String(value || '')\n break\n case 'number':\n if (!isNaN(value)) {\n this.value = Number(value)\n }\n break\n case 'object':\n this.value = eval('(' + value + ')')\n break\n }\n } catch (e) {\n console.log(e)\n }\n }\n\n this._onAfterValueChange()\n }\n\n _clearData() {\n this.value = undefined\n this._onAfterValueChange()\n }\n\n _getData(data: any) {\n return typeof data !== 'object' ? data || '' : JSON.stringify(data, null, 1)\n }\n\n _onAfterValueChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true\n })\n )\n }\n}\n"]}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import '@material/mwc-icon';
|
2
|
+
import { PropertyValues } from 'lit';
|
2
3
|
import { OxFormField } from './ox-form-field.js';
|
3
4
|
export declare class OxInputFile extends OxFormField {
|
4
5
|
static styles: import("lit").CSSResult[];
|
@@ -11,6 +12,7 @@ export declare class OxInputFile extends OxFormField {
|
|
11
12
|
attachFileList: boolean;
|
12
13
|
fileInput: HTMLInputElement;
|
13
14
|
render(): import("lit-html").TemplateResult<1>;
|
15
|
+
updated(changes: PropertyValues<this>): void;
|
14
16
|
firstUpdated(): void;
|
15
17
|
get files(): any;
|
16
18
|
reset(): void;
|
@@ -2,9 +2,9 @@ import { __decorate } from "tslib";
|
|
2
2
|
import '@material/mwc-icon';
|
3
3
|
import { css, html } from 'lit';
|
4
4
|
import { customElement, property, query } from 'lit/decorators.js';
|
5
|
-
import { ScrollbarStyles } from '@operato/styles';
|
6
5
|
import { FileDropHelper } from '@operato/utils';
|
7
6
|
import { OxFormField } from './ox-form-field.js';
|
7
|
+
import { ScrollbarStyles } from '@operato/styles';
|
8
8
|
let OxInputFile = class OxInputFile extends OxFormField {
|
9
9
|
constructor() {
|
10
10
|
super(...arguments);
|
@@ -122,6 +122,11 @@ let OxInputFile = class OxInputFile extends OxFormField {
|
|
122
122
|
: html ``}
|
123
123
|
`;
|
124
124
|
}
|
125
|
+
updated(changes) {
|
126
|
+
if (changes.has('value') && !(this.value instanceof Array)) {
|
127
|
+
this.value = !this.value ? [] : [this.value];
|
128
|
+
}
|
129
|
+
}
|
125
130
|
firstUpdated() {
|
126
131
|
FileDropHelper.set(this);
|
127
132
|
this.addEventListener('file-drop', (e) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-file.js","sourceRoot":"","sources":["../../src/ox-input-file.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,
|
1
|
+
{"version":3,"file":"ox-input-file.js","sourceRoot":"","sources":["../../src/ox-input-file.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,WAAW;IAA5C;;QAiFE,iBAAY,GAAY,KAAK,CAAA;QAE7B,mBAAc,GAAY,KAAK,CAAA;IAgGjC,CAAC;aAlLQ,WAAM,GAAG;QACd,eAAe;QACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqEF;KACF,CAAA;IAcD,MAAM;QACJ,IAAI,KA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E,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAqB;AAEhD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;iDAC1C;AAE7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;mDAC1C;AAET;IAArB,KAAK,CAAC,aAAa,CAAC;8CAA6B;AArFvC,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CAmLvB;SAnLY,WAAW","sourcesContent":["import '@material/mwc-icon'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { FileDropHelper } from '@operato/utils'\nimport { OxFormField } from './ox-form-field.js'\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-input-file')\nexport class OxInputFile extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n border-radius: var(--border-radius);\n align-items: center;\n justify-content: center;\n padding: var(--padding-default, 9px);\n min-height: 100px;\n text-transform: capitalize;\n\n border: var(--file-uploader-border);\n background-color: var(--main-section-background-color);\n font: var(--file-uploader-font) !important;\n color: var(--file-uploader-color);\n }\n :host > mwc-icon {\n color: var(--file-uploader-icon-color);\n --mdc-icon-size: var(--file-uploader-icon-size, 36px);\n }\n\n :host(.candrop) {\n background-color: var(--file-uploader-candrop-background-color);\n }\n\n #input-file {\n display: none;\n }\n\n label {\n position: relative;\n width: auto;\n border: none;\n text-transform: capitalize;\n\n padding: var(--file-uploader-label-padding);\n border-radius: var(--file-uploader-label-border-radius);\n background-color: var(--file-uploader-label-background-color);\n color: var(--file-uploader-label-color);\n font: var(--file-uploader-label-font) !important;\n }\n\n ul {\n max-width: 500px;\n width: 100%;\n list-style: none;\n margin: 5px 0 0 0;\n padding: 0;\n max-height: 46px;\n overflow: auto;\n background-color: rgba(var(--primary-color-rgb), 0.1);\n }\n li {\n text-align: left;\n\n padding: 3px 5px 2px 5px;\n border-bottom: var(--file-uploader-li-border-bottom);\n font: normal 14px var(--theme-font);\n }\n li mwc-icon {\n float: right;\n cursor: pointer;\n margin: var(--file-uploader-li-icon-margin);\n font-size: 1em;\n }\n li mwc-icon:hover,\n li mwc-icon:active {\n color: var(--file-uploader-li-icon-focus-color);\n }\n `\n ]\n\n @property({ type: Boolean }) multiple?: boolean\n @property({ type: String }) accept?: string\n @property({ type: String }) icon?: string\n @property({ type: String }) label?: string\n @property({ type: String }) description?: string\n @property({ type: Boolean, reflect: true, attribute: 'hide-filelist' })\n hideFileList: boolean = false\n @property({ type: Boolean, reflect: true, attribute: 'attach-filelist' })\n attachFileList: boolean = false\n\n @query('#input-file') fileInput!: HTMLInputElement\n\n render() {\n var files: File[] = this.value || []\n\n return html`\n <mwc-icon>upload</mwc-icon>\n\n <span>drop files here!</span>\n\n <input\n id=\"input-file\"\n type=\"file\"\n accept=${this.accept}\n ?multiple=${this.multiple}\n hidden\n capture=\"environment\"\n @change=${(e: Event) => this._onChangeValue(e)}\n />\n\n <label for=\"input-file\">${this.label || 'select files'}</label>\n\n ${!this.hideFileList && files?.length\n ? html` <ul>\n ${files.map(\n file => html`\n <li>\n - ${file.name}\n <mwc-icon\n @click=${(e: Event) => {\n files.splice(files.indexOf(file), 1)\n this.value = [...files]\n this._notifyChange()\n }}\n >delete_outline</mwc-icon\n >\n </li>\n `\n )}\n </ul>`\n : html``}\n `\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && !(this.value instanceof Array)) {\n this.value = !this.value ? [] : [this.value]\n }\n }\n\n firstUpdated() {\n FileDropHelper.set(this)\n\n this.addEventListener('file-drop', (e: Event) => {\n const detail = (e as CustomEvent).detail\n this.value = this.multiple ? detail : detail[0] ? [detail[0]] : []\n\n this._notifyChange()\n })\n }\n\n get files() {\n return this.value\n }\n\n reset() {\n this.fileInput.value = ''\n this.value = []\n\n this._notifyChange()\n }\n\n _onChangeValue(e: Event) {\n const fileInput = e.currentTarget as HTMLInputElement\n const files = this.value || []\n\n this.value = this.attachFileList\n ? [...files, ...Array.from(fileInput.files as FileList)]\n : [...Array.from(fileInput.files as FileList)]\n\n fileInput.files = null\n\n this._notifyChange()\n }\n\n _notifyChange() {\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|
@@ -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,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,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,O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O,yBAAyB;gBAC9F,CAAC,CAAC,IAAI,CAAA,EAAE;;KAEb,CAAA;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,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;;gB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F,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 {};
|