@operato/input 9.0.0-beta.6 → 9.0.0-beta.61
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 +239 -0
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-form-field.d.ts +2 -5
- package/dist/src/ox-form-field.js +2 -5
- package/dist/src/ox-form-field.js.map +1 -1
- package/dist/src/ox-input-angle.js +1 -3
- package/dist/src/ox-input-angle.js.map +1 -1
- package/dist/src/ox-input-background-pattern.d.ts +36 -0
- package/dist/src/ox-input-background-pattern.js +114 -0
- package/dist/src/ox-input-background-pattern.js.map +1 -0
- package/dist/src/ox-input-color-gradient.d.ts +12 -10
- package/dist/src/ox-input-color-gradient.js +104 -222
- package/dist/src/ox-input-color-gradient.js.map +1 -1
- package/dist/src/ox-input-color-stops.d.ts +26 -22
- package/dist/src/ox-input-color-stops.js +122 -151
- package/dist/src/ox-input-color-stops.js.map +1 -1
- package/dist/src/ox-input-color.d.ts +13 -5
- package/dist/src/ox-input-color.js +169 -96
- package/dist/src/ox-input-color.js.map +1 -1
- package/dist/src/ox-input-crontab.js +1 -0
- package/dist/src/ox-input-crontab.js.map +1 -1
- package/dist/src/ox-input-direction.js +1 -0
- package/dist/src/ox-input-direction.js.map +1 -1
- package/dist/src/ox-input-duration.js +4 -0
- package/dist/src/ox-input-duration.js.map +1 -1
- package/dist/src/ox-input-fill-style.d.ts +48 -0
- package/dist/src/ox-input-fill-style.js +330 -0
- package/dist/src/ox-input-fill-style.js.map +1 -0
- package/dist/src/ox-input-multiple-colors.js +2 -2
- package/dist/src/ox-input-multiple-colors.js.map +1 -1
- package/dist/src/ox-input-options.js +0 -1
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-privilege.js +1 -0
- package/dist/src/ox-input-privilege.js.map +1 -1
- package/dist/src/ox-input-range.js +2 -0
- package/dist/src/ox-input-range.js.map +1 -1
- package/dist/src/ox-input-select-buttons.d.ts +1 -1
- package/dist/src/ox-input-select-buttons.js +2 -2
- package/dist/src/ox-input-select-buttons.js.map +1 -1
- package/dist/src/ox-input-table.d.ts +20 -2
- package/dist/src/ox-input-table.js +67 -160
- package/dist/src/ox-input-table.js.map +1 -1
- package/dist/src/ox-select-floor.js +1 -0
- package/dist/src/ox-select-floor.js.map +1 -1
- package/dist/src/ox-select.d.ts +3 -0
- package/dist/src/ox-select.js +19 -9
- package/dist/src/ox-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -25
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/stories/image-for-select-floor.d.ts +0 -1
- package/dist/stories/image-for-select-floor.js +0 -2
- package/dist/stories/image-for-select-floor.js.map +0 -1
- package/dist/stories/ox-buttons-radio.stories.d.ts +0 -26
- package/dist/stories/ox-buttons-radio.stories.js +0 -75
- package/dist/stories/ox-buttons-radio.stories.js.map +0 -1
- package/dist/stories/ox-checkbox.stories.d.ts +0 -44
- package/dist/stories/ox-checkbox.stories.js +0 -84
- package/dist/stories/ox-checkbox.stories.js.map +0 -1
- package/dist/stories/ox-input-3axis.stories.d.ts +0 -26
- package/dist/stories/ox-input-3axis.stories.js +0 -63
- package/dist/stories/ox-input-3axis.stories.js.map +0 -1
- package/dist/stories/ox-input-3dish.stories.d.ts +0 -30
- package/dist/stories/ox-input-3dish.stories.js +0 -91
- package/dist/stories/ox-input-3dish.stories.js.map +0 -1
- package/dist/stories/ox-input-angle.stories.d.ts +0 -30
- package/dist/stories/ox-input-angle.stories.js +0 -69
- package/dist/stories/ox-input-angle.stories.js.map +0 -1
- package/dist/stories/ox-input-barcode.stories.d.ts +0 -47
- package/dist/stories/ox-input-barcode.stories.js +0 -89
- package/dist/stories/ox-input-barcode.stories.js.map +0 -1
- package/dist/stories/ox-input-code.stories.d.ts +0 -38
- package/dist/stories/ox-input-code.stories.js +0 -76
- package/dist/stories/ox-input-code.stories.js.map +0 -1
- package/dist/stories/ox-input-crontab.stories.d.ts +0 -29
- package/dist/stories/ox-input-crontab.stories.js +0 -67
- package/dist/stories/ox-input-crontab.stories.js.map +0 -1
- package/dist/stories/ox-input-data.stories.d.ts +0 -29
- package/dist/stories/ox-input-data.stories.js +0 -67
- package/dist/stories/ox-input-data.stories.js.map +0 -1
- package/dist/stories/ox-input-direction.stories.d.ts +0 -29
- package/dist/stories/ox-input-direction.stories.js +0 -76
- package/dist/stories/ox-input-direction.stories.js.map +0 -1
- package/dist/stories/ox-input-duration.stories.d.ts +0 -30
- package/dist/stories/ox-input-duration.stories.js +0 -69
- package/dist/stories/ox-input-duration.stories.js.map +0 -1
- package/dist/stories/ox-input-file.stories.d.ts +0 -53
- package/dist/stories/ox-input-file.stories.js +0 -80
- package/dist/stories/ox-input-file.stories.js.map +0 -1
- package/dist/stories/ox-input-hashtags.stories.d.ts +0 -33
- package/dist/stories/ox-input-hashtags.stories.js +0 -66
- package/dist/stories/ox-input-hashtags.stories.js.map +0 -1
- package/dist/stories/ox-input-i18n-label.stories.d.ts +0 -29
- package/dist/stories/ox-input-i18n-label.stories.js +0 -88
- package/dist/stories/ox-input-i18n-label.stories.js.map +0 -1
- package/dist/stories/ox-input-key-values.stories.d.ts +0 -33
- package/dist/stories/ox-input-key-values.stories.js +0 -81
- package/dist/stories/ox-input-key-values.stories.js.map +0 -1
- package/dist/stories/ox-input-mass-fraction.stories.d.ts +0 -37
- package/dist/stories/ox-input-mass-fraction.stories.js +0 -79
- package/dist/stories/ox-input-mass-fraction.stories.js.map +0 -1
- package/dist/stories/ox-input-multiple-colors.stories.d.ts +0 -24
- package/dist/stories/ox-input-multiple-colors.stories.js +0 -59
- package/dist/stories/ox-input-multiple-colors.stories.js.map +0 -1
- package/dist/stories/ox-input-options.stories.d.ts +0 -29
- package/dist/stories/ox-input-options.stories.js +0 -65
- package/dist/stories/ox-input-options.stories.js.map +0 -1
- package/dist/stories/ox-input-partition-keys.stories.d.ts +0 -29
- package/dist/stories/ox-input-partition-keys.stories.js +0 -69
- package/dist/stories/ox-input-partition-keys.stories.js.map +0 -1
- package/dist/stories/ox-input-privilege.stories.d.ts +0 -40
- package/dist/stories/ox-input-privilege.stories.js +0 -87
- package/dist/stories/ox-input-privilege.stories.js.map +0 -1
- package/dist/stories/ox-input-quantifier.stories.d.ts +0 -29
- package/dist/stories/ox-input-quantifier.stories.js +0 -63
- package/dist/stories/ox-input-quantifier.stories.js.map +0 -1
- package/dist/stories/ox-input-range.stories.d.ts +0 -41
- package/dist/stories/ox-input-range.stories.js +0 -64
- package/dist/stories/ox-input-range.stories.js.map +0 -1
- package/dist/stories/ox-input-search.stories.d.ts +0 -36
- package/dist/stories/ox-input-search.stories.js +0 -68
- package/dist/stories/ox-input-search.stories.js.map +0 -1
- package/dist/stories/ox-input-select-buttons.stories.d.ts +0 -38
- package/dist/stories/ox-input-select-buttons.stories.js +0 -94
- package/dist/stories/ox-input-select-buttons.stories.js.map +0 -1
- package/dist/stories/ox-input-signature.stories.d.ts +0 -25
- package/dist/stories/ox-input-signature.stories.js +0 -60
- package/dist/stories/ox-input-signature.stories.js.map +0 -1
- package/dist/stories/ox-input-switch.stories.d.ts +0 -38
- package/dist/stories/ox-input-switch.stories.js +0 -68
- package/dist/stories/ox-input-switch.stories.js.map +0 -1
- package/dist/stories/ox-input-table-column-config.stories.d.ts +0 -29
- package/dist/stories/ox-input-table-column-config.stories.js +0 -94
- package/dist/stories/ox-input-table-column-config.stories.js.map +0 -1
- package/dist/stories/ox-input-unit.stories.d.ts +0 -42
- package/dist/stories/ox-input-unit.stories.js +0 -123
- package/dist/stories/ox-input-unit.stories.js.map +0 -1
- package/dist/stories/ox-input-value-map.stories.d.ts +0 -39
- package/dist/stories/ox-input-value-map.stories.js +0 -69
- package/dist/stories/ox-input-value-map.stories.js.map +0 -1
- package/dist/stories/ox-input-value-ranges.stories.d.ts +0 -39
- package/dist/stories/ox-input-value-ranges.stories.js +0 -69
- package/dist/stories/ox-input-value-ranges.stories.js.map +0 -1
- package/dist/stories/ox-input-work-shift.stories.d.ts +0 -30
- package/dist/stories/ox-input-work-shift.stories.js +0 -91
- package/dist/stories/ox-input-work-shift.stories.js.map +0 -1
- package/dist/stories/ox-select-floor.stories.d.ts +0 -45
- package/dist/stories/ox-select-floor.stories.js +0 -166
- package/dist/stories/ox-select-floor.stories.js.map +0 -1
- package/dist/stories/ox-select-set-options.stories.d.ts +0 -48
- package/dist/stories/ox-select-set-options.stories.js +0 -178
- package/dist/stories/ox-select-set-options.stories.js.map +0 -1
- package/dist/stories/ox-select.stories.d.ts +0 -34
- package/dist/stories/ox-select.stories.js +0 -151
- package/dist/stories/ox-select.stories.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-duration.js","sourceRoot":"","sources":["../../src/ox-input-duration.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,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,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;
|
1
|
+
{"version":3,"file":"ox-input-duration.js","sourceRoot":"","sources":["../../src/ox-input-duration.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,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,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,WAAW;IAAzC;;QA0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AC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,CAAA;QAEvG,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAvG2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAA2B;AA0EtC;IAAf,KAAK,CAAC,OAAO,CAAC;6CAAwB;AACtB;IAAhB,KAAK,CAAC,QAAQ,CAAC;8CAAyB;AACtB;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAC1B;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA2B;AAvIlC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAkK3B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@customElement('ox-input-duration')\nexport class OxInputDuration extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n --md-filled-icon-button-container-height: var(--form-element-height-medium);\n --md-filled-icon-button-container-shape: var(--md-sys-shape-corner-small);\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n display: flex;\n flex-direction: row;\n\n align-items: center;\n }\n\n [padding] {\n min-width: 100px;\n }\n\n input {\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n max-width: 70px;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-color: var(--md-sys-color-secondary-fixed-dim);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--md-sys-color-error);\n color: var(--md-sys-color-error);\n }\n\n label {\n width: 100%;\n margin-right: var(--spacing-medium);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n `\n\n @property({ type: Number }) value?: number = undefined\n\n render() {\n var d = Number(this.value || 0)\n\n const days = Math.floor(d / (3600 * 24))\n d -= days * 24 * 3600\n const hours = Math.floor(d / 3600)\n d -= hours * 3600\n const minutes = Math.floor(d / 60)\n const seconds = d - minutes * 60\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <div padding></div>\n <input id=\"days\" type=\"number\" .value=${String(days || 0)} pattern=\"\\\\d*\" ?disabled=${this.disabled} />\n <label for=\"days\">${i18next.t('label.days')}</label>\n\n <input\n id=\"hours\"\n type=\"number\"\n .value=${String(hours || 0)}\n pattern=\"[01]?\\\\d|2[0-3]\"\n ?disabled=${this.disabled}\n />\n <label for=\"hour\">${i18next.t('label.hours')}</label>\n\n <input\n id=\"minutes\"\n type=\"number\"\n .value=${String(minutes || 0)}\n pattern=\"[0-5]?\\\\d\"\n ?disabled=${this.disabled}\n />\n <label for=\"minute\">${i18next.t('label.minutes')}</label>\n\n <input\n id=\"seconds\"\n type=\"number\"\n .value=${String(seconds || 0)}\n pattern=\"[0-5]?\\\\d\"\n ?disabled=${this.disabled}\n />\n <label for=\"second\">${i18next.t('label.seconds')}</label>\n\n <md-filled-icon-button\n type=\"button\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.value = 0\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n ?disabled=${this.disabled}\n >\n <md-icon>backspace</md-icon>\n </md-filled-icon-button>\n <div padding></div>\n </form>\n `\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n @query('#days') days!: HTMLInputElement\n @query('#hours') hours!: HTMLInputElement\n @query('#minutes') minutes!: HTMLInputElement\n @query('#seconds') seconds!: HTMLInputElement\n\n onChange(e: Event) {\n e.stopPropagation()\n\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n const days = Number(this.days.value)\n const hours = Number(this.hours.value)\n const minutes = Number(this.minutes.value)\n const seconds = Number(this.seconds.value)\n\n this.value = (days || 0) * 24 * 60 * 60 + (hours || 0) * 60 * 60 + (minutes || 0) * 60 + (seconds || 0)\n\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,48 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import '@material/web/icon/icon.js';
|
5
|
+
import '@operato/i18n/ox-i18n.js';
|
6
|
+
import './ox-input-color.js';
|
7
|
+
import './ox-input-color-stops.js';
|
8
|
+
import './ox-input-color-gradient.js';
|
9
|
+
import './ox-input-background-pattern.js';
|
10
|
+
import { PropertyValues } from 'lit';
|
11
|
+
import { OxFormField } from './ox-form-field.js';
|
12
|
+
import { ColorStop } from './ox-input-color-stops.js';
|
13
|
+
import { GradientOption } from './ox-input-color-gradient.js';
|
14
|
+
import { BackgroundPatternOption } from './ox-input-background-pattern.js';
|
15
|
+
export type FillStyle = {
|
16
|
+
type?: 'no' | 'solid' | 'gradient' | 'pattern';
|
17
|
+
gradientType?: 'linear' | 'radial';
|
18
|
+
colorStops?: ColorStop[];
|
19
|
+
rotation?: number;
|
20
|
+
center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom';
|
21
|
+
image?: HTMLImageElement | string;
|
22
|
+
offsetX?: number;
|
23
|
+
offsetY?: number;
|
24
|
+
width?: number;
|
25
|
+
height?: number;
|
26
|
+
align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom';
|
27
|
+
fitPattern?: boolean;
|
28
|
+
noRepeat?: boolean;
|
29
|
+
guideOnly?: boolean;
|
30
|
+
color?: string;
|
31
|
+
} | 'no' | string;
|
32
|
+
export declare class OxInputColorStyle extends OxFormField {
|
33
|
+
static styles: import("lit").CSSResult[];
|
34
|
+
value?: FillStyle;
|
35
|
+
fillType?: string;
|
36
|
+
solid?: string;
|
37
|
+
gradient?: GradientOption;
|
38
|
+
pattern?: BackgroundPatternOption;
|
39
|
+
colorOnly: boolean;
|
40
|
+
private _block_reset;
|
41
|
+
updated(changes: PropertyValues<this>): void;
|
42
|
+
render(): import("lit-html").TemplateResult<1>;
|
43
|
+
_onChangedValue(value: FillStyle): Promise<void>;
|
44
|
+
_onChangedFillType(e: Event): void;
|
45
|
+
_onChangedSolid(e: Event): void;
|
46
|
+
_onChandedGradient(e: Event): void;
|
47
|
+
_onChangedPattern(e: Event): void;
|
48
|
+
}
|
@@ -0,0 +1,330 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import { __decorate } from "tslib";
|
5
|
+
import '@material/web/icon/icon.js';
|
6
|
+
import '@operato/i18n/ox-i18n.js';
|
7
|
+
import './ox-input-color.js';
|
8
|
+
import './ox-input-color-stops.js';
|
9
|
+
import './ox-input-color-gradient.js';
|
10
|
+
import './ox-input-background-pattern.js';
|
11
|
+
import { css, html } from 'lit';
|
12
|
+
import { customElement, property } from 'lit/decorators.js';
|
13
|
+
import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js';
|
14
|
+
import { OxFormField } from './ox-form-field.js';
|
15
|
+
let OxInputColorStyle = class OxInputColorStyle extends OxFormField {
|
16
|
+
constructor() {
|
17
|
+
super(...arguments);
|
18
|
+
this.value = undefined;
|
19
|
+
this.colorOnly = false;
|
20
|
+
this._block_reset = false;
|
21
|
+
}
|
22
|
+
static { this.styles = [
|
23
|
+
PropertyGridStyles,
|
24
|
+
css `
|
25
|
+
:host {
|
26
|
+
display: flex;
|
27
|
+
flex-direction: column;
|
28
|
+
}
|
29
|
+
|
30
|
+
[fill-type] {
|
31
|
+
display: flex;
|
32
|
+
margin: 0 0 14px 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
[fill-type] * {
|
36
|
+
flex: auto;
|
37
|
+
margin: 0;
|
38
|
+
text-align: left;
|
39
|
+
align-self: center;
|
40
|
+
}
|
41
|
+
|
42
|
+
[editors] > :not([active]) {
|
43
|
+
display: none;
|
44
|
+
}
|
45
|
+
`
|
46
|
+
]; }
|
47
|
+
updated(changes) {
|
48
|
+
changes.has('value') && this._onChangedValue(this.value || {});
|
49
|
+
}
|
50
|
+
render() {
|
51
|
+
return html `
|
52
|
+
<div @change=${(e) => this._onChangedFillType(e)} fill-type>
|
53
|
+
<input
|
54
|
+
type="radio"
|
55
|
+
id="fill-type-no"
|
56
|
+
name="fill-type"
|
57
|
+
value="no"
|
58
|
+
.checked=${!this.fillType || this.fillType == 'no'}
|
59
|
+
/>
|
60
|
+
<label for="fill-type-no"><ox-i18n msgid="label.no-fill">no fill</ox-i18n></label>
|
61
|
+
<input type="radio" id="fill-type-solid" name="fill-type" value="solid" .checked=${this.fillType == 'solid'} />
|
62
|
+
<label for="fill-type-solid"><ox-i18n msgid="label.solid">solid</ox-i18n></label>
|
63
|
+
<input
|
64
|
+
type="radio"
|
65
|
+
id="fill-type-gradient"
|
66
|
+
name="fill-type"
|
67
|
+
value="gradient"
|
68
|
+
.checked=${this.fillType == 'gradient'}
|
69
|
+
/>
|
70
|
+
|
71
|
+
<label for="fill-type-gradient"><ox-i18n msgid="label.gradient">gradient</ox-i18n></label>
|
72
|
+
|
73
|
+
${this.colorOnly
|
74
|
+
? html ``
|
75
|
+
: html `
|
76
|
+
<input
|
77
|
+
type="radio"
|
78
|
+
id="fill-type-pattern"
|
79
|
+
name="fill-type"
|
80
|
+
value="pattern"
|
81
|
+
.checked=${this.fillType == 'pattern'}
|
82
|
+
/>
|
83
|
+
<label for="fill-type-pattern"><ox-i18n msgid="label.pattern">pattern</ox-i18n></label>
|
84
|
+
`}
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div editors>
|
88
|
+
<div ?active=${this.fillType == 'no'}></div>
|
89
|
+
|
90
|
+
<div class="property-grid" ?active=${this.fillType == 'solid'}>
|
91
|
+
<label><md-icon>format_color_fill</md-icon></label>
|
92
|
+
<ox-input-color class="custom-editor" @change=${(e) => this._onChangedSolid(e)} .value=${this.solid}>
|
93
|
+
</ox-input-color>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
<ox-input-color-gradient
|
97
|
+
?active=${this.fillType == 'gradient'}
|
98
|
+
@change=${(e) => this._onChandedGradient(e)}
|
99
|
+
.value=${this.gradient}
|
100
|
+
>
|
101
|
+
</ox-input-color-gradient>
|
102
|
+
|
103
|
+
<ox-input-background-pattern
|
104
|
+
?active=${this.fillType == 'pattern'}
|
105
|
+
@change=${(e) => this._onChangedPattern(e)}
|
106
|
+
.value=${this.pattern}
|
107
|
+
>
|
108
|
+
</ox-input-background-pattern>
|
109
|
+
</div>
|
110
|
+
`;
|
111
|
+
}
|
112
|
+
async _onChangedValue(value) {
|
113
|
+
/*
|
114
|
+
* this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.
|
115
|
+
*/
|
116
|
+
await this.requestUpdate();
|
117
|
+
/* 설정 값에 따라서, 멤버 속성을 설정한다. */
|
118
|
+
if (!value) {
|
119
|
+
this.fillType = 'no';
|
120
|
+
if (!this._block_reset) {
|
121
|
+
this.solid = undefined;
|
122
|
+
this.gradient = undefined;
|
123
|
+
this.pattern = undefined;
|
124
|
+
}
|
125
|
+
this._block_reset = false;
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
switch (typeof value) {
|
129
|
+
case 'string':
|
130
|
+
this.fillType = 'solid';
|
131
|
+
this.solid = value;
|
132
|
+
if (!this._block_reset) {
|
133
|
+
this.gradient = undefined;
|
134
|
+
this.pattern = undefined;
|
135
|
+
}
|
136
|
+
break;
|
137
|
+
case 'object':
|
138
|
+
this.fillType = value.type;
|
139
|
+
if (value.type === 'gradient') {
|
140
|
+
this.gradient = {
|
141
|
+
type: value.gradientType || 'linear',
|
142
|
+
colorStops: value.colorStops || [
|
143
|
+
{
|
144
|
+
position: 0,
|
145
|
+
color: this.solid || '#000000'
|
146
|
+
},
|
147
|
+
{
|
148
|
+
position: 1,
|
149
|
+
color: this.solid || '#FFFFFF'
|
150
|
+
}
|
151
|
+
],
|
152
|
+
rotation: Number(value.rotation) || 0,
|
153
|
+
center: value.center
|
154
|
+
};
|
155
|
+
if (!this._block_reset) {
|
156
|
+
this.pattern = undefined;
|
157
|
+
this.solid = undefined;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
else if (value.type === 'pattern') {
|
161
|
+
this.pattern = {
|
162
|
+
image: value.image,
|
163
|
+
offsetX: Number(value.offsetX) || 0,
|
164
|
+
offsetY: Number(value.offsetY) || 0,
|
165
|
+
width: Number(value.width),
|
166
|
+
height: Number(value.height),
|
167
|
+
align: value.align,
|
168
|
+
fitPattern: value.fitPattern,
|
169
|
+
noRepeat: value.noRepeat,
|
170
|
+
guideOnly: value.guideOnly,
|
171
|
+
color: value.color
|
172
|
+
};
|
173
|
+
if (!this._block_reset) {
|
174
|
+
this.gradient = undefined;
|
175
|
+
this.solid = undefined;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
break;
|
179
|
+
default:
|
180
|
+
}
|
181
|
+
this._block_reset = false;
|
182
|
+
}
|
183
|
+
_onChangedFillType(e) {
|
184
|
+
const element = e.target;
|
185
|
+
this.fillType = element.value;
|
186
|
+
switch (this.fillType) {
|
187
|
+
case 'gradient':
|
188
|
+
if (!this.gradient) {
|
189
|
+
this.gradient = {
|
190
|
+
type: 'linear',
|
191
|
+
colorStops: [
|
192
|
+
{
|
193
|
+
position: 0,
|
194
|
+
color: this.solid || '#000000'
|
195
|
+
},
|
196
|
+
{
|
197
|
+
position: 1,
|
198
|
+
color: this.solid || '#FFFFFF'
|
199
|
+
}
|
200
|
+
],
|
201
|
+
rotation: 0,
|
202
|
+
center: 'center'
|
203
|
+
};
|
204
|
+
}
|
205
|
+
this.value = {
|
206
|
+
type: 'gradient',
|
207
|
+
gradientType: this.gradient.type || 'linear',
|
208
|
+
colorStops: this.gradient.colorStops || [
|
209
|
+
{
|
210
|
+
position: 0,
|
211
|
+
color: this.solid || '#000000'
|
212
|
+
},
|
213
|
+
{
|
214
|
+
position: 1,
|
215
|
+
color: this.solid || '#FFFFFF'
|
216
|
+
}
|
217
|
+
],
|
218
|
+
rotation: Number(this.gradient.rotation) || 0,
|
219
|
+
center: this.gradient.center
|
220
|
+
};
|
221
|
+
break;
|
222
|
+
case 'pattern':
|
223
|
+
if (!this.pattern)
|
224
|
+
this.pattern = {};
|
225
|
+
this.value = {
|
226
|
+
type: 'pattern',
|
227
|
+
image: this.pattern.image,
|
228
|
+
offsetX: Number(this.pattern.offsetX) || 0,
|
229
|
+
offsetY: Number(this.pattern.offsetY) || 0,
|
230
|
+
width: Number(this.pattern.width),
|
231
|
+
height: Number(this.pattern.height),
|
232
|
+
align: this.pattern.align,
|
233
|
+
fitPattern: this.pattern.fitPattern,
|
234
|
+
noRepeat: this.pattern.noRepeat,
|
235
|
+
guideOnly: this.pattern.guideOnly,
|
236
|
+
color: this.pattern.color
|
237
|
+
};
|
238
|
+
break;
|
239
|
+
case 'solid':
|
240
|
+
if (!this.solid)
|
241
|
+
this.solid = '#fff';
|
242
|
+
this.value = this.solid;
|
243
|
+
break;
|
244
|
+
case 'no':
|
245
|
+
this.value = '';
|
246
|
+
break;
|
247
|
+
}
|
248
|
+
this._block_reset = true;
|
249
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
250
|
+
}
|
251
|
+
_onChangedSolid(e) {
|
252
|
+
if (this.fillType !== 'solid')
|
253
|
+
return;
|
254
|
+
this.solid = e.target.value;
|
255
|
+
this.value = this.solid;
|
256
|
+
this._block_reset = true;
|
257
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
258
|
+
}
|
259
|
+
_onChandedGradient(e) {
|
260
|
+
/*
|
261
|
+
* TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.
|
262
|
+
* 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.
|
263
|
+
*/
|
264
|
+
if (this.fillType !== 'gradient') {
|
265
|
+
return;
|
266
|
+
}
|
267
|
+
this.gradient = e.target.value;
|
268
|
+
this.value = {
|
269
|
+
type: 'gradient',
|
270
|
+
gradientType: this.gradient.type || 'linear',
|
271
|
+
colorStops: this.gradient.colorStops || [
|
272
|
+
{
|
273
|
+
position: 0,
|
274
|
+
color: this.solid || '#000000'
|
275
|
+
},
|
276
|
+
{
|
277
|
+
position: 1,
|
278
|
+
color: this.solid || '#FFFFFF'
|
279
|
+
}
|
280
|
+
],
|
281
|
+
rotation: Number(this.gradient.rotation) || 0,
|
282
|
+
center: this.gradient.center
|
283
|
+
};
|
284
|
+
this._block_reset = true;
|
285
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
286
|
+
}
|
287
|
+
_onChangedPattern(e) {
|
288
|
+
if (this.fillType !== 'pattern')
|
289
|
+
return;
|
290
|
+
this.pattern = e.target.value;
|
291
|
+
this.value = {
|
292
|
+
type: 'pattern',
|
293
|
+
image: this.pattern?.image,
|
294
|
+
offsetX: Number(this.pattern?.offsetX) || 0,
|
295
|
+
offsetY: Number(this.pattern?.offsetY) || 0,
|
296
|
+
width: Number(this.pattern?.width),
|
297
|
+
height: Number(this.pattern?.height),
|
298
|
+
align: this.pattern?.align,
|
299
|
+
fitPattern: this.pattern?.fitPattern,
|
300
|
+
noRepeat: this.pattern?.noRepeat,
|
301
|
+
guideOnly: this.pattern?.guideOnly,
|
302
|
+
color: this.pattern?.color
|
303
|
+
};
|
304
|
+
this._block_reset = true;
|
305
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
306
|
+
}
|
307
|
+
};
|
308
|
+
__decorate([
|
309
|
+
property({ type: Object })
|
310
|
+
], OxInputColorStyle.prototype, "value", void 0);
|
311
|
+
__decorate([
|
312
|
+
property({ type: String })
|
313
|
+
], OxInputColorStyle.prototype, "fillType", void 0);
|
314
|
+
__decorate([
|
315
|
+
property({ type: String })
|
316
|
+
], OxInputColorStyle.prototype, "solid", void 0);
|
317
|
+
__decorate([
|
318
|
+
property({ type: Object })
|
319
|
+
], OxInputColorStyle.prototype, "gradient", void 0);
|
320
|
+
__decorate([
|
321
|
+
property({ type: Object })
|
322
|
+
], OxInputColorStyle.prototype, "pattern", void 0);
|
323
|
+
__decorate([
|
324
|
+
property({ type: Boolean, attribute: 'color-only' })
|
325
|
+
], OxInputColorStyle.prototype, "colorOnly", void 0);
|
326
|
+
OxInputColorStyle = __decorate([
|
327
|
+
customElement('ox-input-fill-style')
|
328
|
+
], OxInputColorStyle);
|
329
|
+
export { OxInputColorStyle };
|
330
|
+
//# sourceMappingURL=ox-input-fill-style.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-fill-style.js","sourceRoot":"","sources":["../../src/ox-input-fill-style.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AACjC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,2BAA2B,CAAA;AAClC,OAAO,8BAA8B,CAAA;AACrC,OAAO,kCAAkC,CAAA;AAEzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAE5E,OAAO,EAA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,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;oDAA2B;AAjCrE,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAqU7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\nimport '@operato/i18n/ox-i18n.js'\nimport './ox-input-color.js'\nimport './ox-input-color-stops.js'\nimport './ox-input-color-gradient.js'\nimport './ox-input-background-pattern.js'\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { ColorStop } from './ox-input-color-stops.js'\nimport { GradientOption, OxInputColorGradient } from './ox-input-color-gradient.js'\nimport { BackgroundPatternOption, OxInputBackgroundPattern } from './ox-input-background-pattern.js'\n\nexport type FillStyle =\n | {\n type?: 'no' | 'solid' | 'gradient' | 'pattern'\n gradientType?: 'linear' | 'radial'\n colorStops?: ColorStop[]\n rotation?: number\n center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'\n image?: HTMLImageElement | string\n offsetX?: number\n offsetY?: number\n width?: number\n height?: number\n align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'\n fitPattern?: boolean\n noRepeat?: boolean\n guideOnly?: boolean\n color?: string\n }\n | 'no'\n | string\n\n@customElement('ox-input-fill-style')\nexport class OxInputColorStyle extends OxFormField {\n static styles = [\n PropertyGridStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n\n [fill-type] {\n display: flex;\n margin: 0 0 14px 0;\n }\n\n [fill-type] * {\n flex: auto;\n margin: 0;\n text-align: left;\n align-self: center;\n }\n\n [editors] > :not([active]) {\n display: none;\n }\n `\n ]\n\n @property({ type: Object }) value?: FillStyle = undefined\n @property({ type: String }) fillType?: string\n @property({ type: String }) solid?: string\n @property({ type: Object }) gradient?: GradientOption\n @property({ type: Object }) pattern?: BackgroundPatternOption\n\n @property({ type: Boolean, attribute: 'color-only' }) colorOnly: boolean = false\n\n private _block_reset: boolean = false\n\n updated(changes: PropertyValues<this>) {\n changes.has('value') && this._onChangedValue(this.value || {})\n }\n\n render() {\n return html`\n <div @change=${(e: Event) => this._onChangedFillType(e)} fill-type>\n <input\n type=\"radio\"\n id=\"fill-type-no\"\n name=\"fill-type\"\n value=\"no\"\n .checked=${!this.fillType || this.fillType == 'no'}\n />\n <label for=\"fill-type-no\"><ox-i18n msgid=\"label.no-fill\">no fill</ox-i18n></label>\n <input type=\"radio\" id=\"fill-type-solid\" name=\"fill-type\" value=\"solid\" .checked=${this.fillType == 'solid'} />\n <label for=\"fill-type-solid\"><ox-i18n msgid=\"label.solid\">solid</ox-i18n></label>\n <input\n type=\"radio\"\n id=\"fill-type-gradient\"\n name=\"fill-type\"\n value=\"gradient\"\n .checked=${this.fillType == 'gradient'}\n />\n\n <label for=\"fill-type-gradient\"><ox-i18n msgid=\"label.gradient\">gradient</ox-i18n></label>\n\n ${this.colorOnly\n ? html``\n : html`\n <input\n type=\"radio\"\n id=\"fill-type-pattern\"\n name=\"fill-type\"\n value=\"pattern\"\n .checked=${this.fillType == 'pattern'}\n />\n <label for=\"fill-type-pattern\"><ox-i18n msgid=\"label.pattern\">pattern</ox-i18n></label>\n `}\n </div>\n\n <div editors>\n <div ?active=${this.fillType == 'no'}></div>\n\n <div class=\"property-grid\" ?active=${this.fillType == 'solid'}>\n <label><md-icon>format_color_fill</md-icon></label>\n <ox-input-color class=\"custom-editor\" @change=${(e: Event) => this._onChangedSolid(e)} .value=${this.solid}>\n </ox-input-color>\n </div>\n\n <ox-input-color-gradient\n ?active=${this.fillType == 'gradient'}\n @change=${(e: Event) => this._onChandedGradient(e)}\n .value=${this.gradient!}\n >\n </ox-input-color-gradient>\n\n <ox-input-background-pattern\n ?active=${this.fillType == 'pattern'}\n @change=${(e: Event) => this._onChangedPattern(e)}\n .value=${this.pattern}\n >\n </ox-input-background-pattern>\n </div>\n `\n }\n\n async _onChangedValue(value: FillStyle) {\n /*\n * this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.\n */\n await this.requestUpdate()\n\n /* 설정 값에 따라서, 멤버 속성을 설정한다. */\n if (!value) {\n this.fillType = 'no'\n\n if (!this._block_reset) {\n this.solid = undefined\n this.gradient = undefined\n this.pattern = undefined\n }\n\n this._block_reset = false\n return\n }\n\n switch (typeof value) {\n case 'string':\n this.fillType = 'solid'\n this.solid = value\n\n if (!this._block_reset) {\n this.gradient = undefined\n this.pattern = undefined\n }\n break\n case 'object':\n this.fillType = value.type\n\n if (value.type === 'gradient') {\n this.gradient = {\n type: value.gradientType || 'linear',\n colorStops: value.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(value.rotation) || 0,\n center: value.center\n }\n\n if (!this._block_reset) {\n this.pattern = undefined\n this.solid = undefined\n }\n } else if (value.type === 'pattern') {\n this.pattern = {\n image: value.image,\n offsetX: Number(value.offsetX) || 0,\n offsetY: Number(value.offsetY) || 0,\n width: Number(value.width),\n height: Number(value.height),\n align: value.align,\n fitPattern: value.fitPattern,\n noRepeat: value.noRepeat,\n guideOnly: value.guideOnly,\n color: value.color\n }\n\n if (!this._block_reset) {\n this.gradient = undefined\n this.solid = undefined\n }\n }\n\n break\n default:\n }\n\n this._block_reset = false\n }\n\n _onChangedFillType(e: Event) {\n const element = e.target as HTMLInputElement\n this.fillType = element.value\n\n switch (this.fillType) {\n case 'gradient':\n if (!this.gradient) {\n this.gradient = {\n type: 'linear',\n colorStops: [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: 0,\n center: 'center'\n }\n }\n\n this.value = {\n type: 'gradient',\n gradientType: this.gradient.type || 'linear',\n colorStops: this.gradient.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(this.gradient.rotation) || 0,\n center: this.gradient.center\n }\n break\n\n case 'pattern':\n if (!this.pattern) this.pattern = {}\n\n this.value = {\n type: 'pattern',\n image: this.pattern.image,\n offsetX: Number(this.pattern.offsetX) || 0,\n offsetY: Number(this.pattern.offsetY) || 0,\n width: Number(this.pattern.width),\n height: Number(this.pattern.height),\n align: this.pattern.align,\n fitPattern: this.pattern.fitPattern,\n noRepeat: this.pattern.noRepeat,\n guideOnly: this.pattern.guideOnly,\n color: this.pattern.color\n }\n break\n\n case 'solid':\n if (!this.solid) this.solid = '#fff'\n this.value = this.solid\n break\n\n case 'no':\n this.value = ''\n break\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChangedSolid(e: Event) {\n if (this.fillType !== 'solid') return\n\n this.solid = (e.target as HTMLInputElement).value\n\n this.value = this.solid\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChandedGradient(e: Event) {\n /*\n * TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.\n * 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.\n */\n\n if (this.fillType !== 'gradient') {\n return\n }\n\n this.gradient = (e.target as OxInputColorGradient).value\n\n this.value = {\n type: 'gradient',\n gradientType: this.gradient.type || 'linear',\n colorStops: this.gradient.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(this.gradient.rotation) || 0,\n center: this.gradient.center\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChangedPattern(e: Event) {\n if (this.fillType !== 'pattern') return\n\n this.pattern = (e.target as OxInputBackgroundPattern).value\n\n this.value = {\n type: 'pattern',\n image: this.pattern?.image,\n offsetX: Number(this.pattern?.offsetX) || 0,\n offsetY: Number(this.pattern?.offsetY) || 0,\n width: Number(this.pattern?.width),\n height: Number(this.pattern?.height),\n align: this.pattern?.align,\n fitPattern: this.pattern?.fitPattern,\n noRepeat: this.pattern?.noRepeat,\n guideOnly: this.pattern?.guideOnly,\n color: this.pattern?.color\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
|
@@ -73,7 +73,7 @@ let OxInputMultipleColors = class OxInputMultipleColors extends OxFormField {
|
|
73
73
|
<div id="colors-container">
|
74
74
|
${(this.value || []).map((item, index) => html `
|
75
75
|
<div>
|
76
|
-
<button @
|
76
|
+
<button @click=${(e) => this._appendEditorColor(e)} data-index=${index} ?disabled=${this.disabled}>
|
77
77
|
<md-icon>add</md-icon>
|
78
78
|
</button>
|
79
79
|
<ox-input-color .value=${item} ?disabled=${this.disabled}> </ox-input-color>
|
@@ -81,7 +81,7 @@ let OxInputMultipleColors = class OxInputMultipleColors extends OxFormField {
|
|
81
81
|
${(this.value || []).length > 1
|
82
82
|
? html `
|
83
83
|
<button
|
84
|
-
@
|
84
|
+
@click=${(e) => this._removeEditorColor(e)}
|
85
85
|
data-index=${index}
|
86
86
|
?disabled=${this.disabled}
|
87
87
|
>
|
@@ -1 +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;AAC5B,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAAE,MAAM,IAAI,WAAW,EA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\nimport '@material/web/icon/icon.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query, queryAll } from 'lit/decorators.js'\nimport { random as randomColor, TinyColor } from '@ctrl/tinycolor'\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 --md-icon-size: var(--fontsize-default, 14px);\n }\n\n #colors-container > div {\n display: grid;\n grid-template-columns: 34px 1fr 34px;\n grid-gap: var(--spacing-medium);\n align-items: center;\n justify-content: left;\n margin-bottom: var(--spacing-tiny, 2px);\n }\n\n ox-input-color {\n width: 100%;\n }\n\n md-icon {\n pointer-events: none;\n }\n\n button {\n height: 100%;\n border: var(--button-border);\n border-radius: 0;\n background-color: transparent;\n line-height: 0.8;\n color: var(--md-sys-color-on-surface);\n cursor: pointer;\n }\n\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--md-sys-color-on-primary);\n color: var(--md-sys-color-primary);\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 <button @click=${(e: Event) => this._appendEditorColor(e)} data-index=${index} ?disabled=${this.disabled}>\n <md-icon>add</md-icon>\n </button>\n <ox-input-color .value=${item} ?disabled=${this.disabled}> </ox-input-color>\n\n ${(this.value || []).length > 1\n ? html`\n <button\n @click=${(e: Event) => this._removeEditorColor(e)}\n data-index=${index}\n ?disabled=${this.disabled}\n >\n <md-icon>remove</md-icon>\n </button>\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(e: Event) {\n const idx = Number((e.target as HTMLElement).getAttribute('data-index'))\n const hue = this.value[idx] || '#fff'\n this.value.splice(idx + 1, 0, randomColor({ hue }).toRgbString())\n this.value = [...this.value]\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).getAttribute('data-index'))) {\n continue\n } else {\n values.push(this.value[i])\n }\n }\n\n this.value = values\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-options.js","sourceRoot":"","sources":["../../src/ox-input-options.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAKzC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QAwDsB,UAAK,GAAa,EAAE,CAAA;QAwCvC,iBAAY,GAAY,KAAK,CAAA;IAyGvC,CAAC;aAxMQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDlB,AArDY,CAqDZ;IAID,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IA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C,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,IAAI,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YACrB,KAAK,CAAC,KAAK,GAAG,EAAE,CAAA;QAClB,CAAC;QAED,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAA;IACnB,CAAC;IAED,OAAO,CAAC,CAAQ;QACd,MAAM,MAAM,GAAI,CAAC,CAAC,MAAsB,CAAC,aAAa,CAAA;QACtD,MAAM,KAAK,GAAG,MAAM,IAAK,MAAM,CAAC,aAAa,CAAC,aAAa,CAAsB,CAAA;QAEjF,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,KAAK,GAAG,EAAE,CAAA;QAClB,CAAC;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;;AAhJ0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAAqB;AAxDpC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAyM1B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\n\ntype Option = { text: string; value: string }\n\n@customElement('ox-input-options')\nexport class OxInputOptions extends OxFormField {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n margin-bottom: var(--spacing-large);\n\n --md-icon-size: var(--fontsize-default, 14px);\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--spacing-medium);\n margin-bottom: var(--spacing-small);\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button + button {\n margin-left: -5px;\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--md-sys-color-primary-container);\n }\n\n input {\n flex: 1;\n min-width: 80px;\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n }\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n button.hidden {\n opacity: 0;\n cursor: default;\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} ?disabled=${this.disabled} />\n <input type=\"text\" data-value=\"\" placeholder=\"value\" .value=${item.value} ?disabled=${this.disabled} />\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._delete(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>remove</md-icon>\n </button>\n </div>\n `\n )}\n ${this.disabled\n ? nothing\n : html`\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\">\n <md-icon>add</md-icon>\n </button>\n </div>\n `}\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') && input.hasAttribute('data-value')) {\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')) {\n this._build(true)\n } else if (div && div.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\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"]}
|
1
|
+
{"version":3,"file":"ox-input-options.js","sourceRoot":"","sources":["../../src/ox-input-options.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAKzC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QAuDsB,UAAK,GAAa,EAAE,CAAA;QAwCvC,iBAAY,GAAY,KAAK,CAAA;IAyGvC,CAAC;aAvMQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDlB,AApDY,CAoDZ;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,CAA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,CAAC;IAED,OAAO,CAAC,CAAQ;QACd,MAAM,MAAM,GAAI,CAAC,CAAC,MAAsB,CAAC,aAAa,CAAA;QACtD,MAAM,KAAK,GAAG,MAAM,IAAK,MAAM,CAAC,aAAa,CAAC,aAAa,CAAsB,CAAA;QAEjF,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,KAAK,GAAG,EAAE,CAAA;QAClB,CAAC;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;;AAhJ0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6CAAqB;AAvDpC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAwM1B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\n\nimport { css, html, nothing } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\n\ntype Option = { text: string; value: string }\n\n@customElement('ox-input-options')\nexport class OxInputOptions extends OxFormField {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n\n --md-icon-size: var(--fontsize-default, 14px);\n }\n\n div {\n display: flex;\n flex-flow: row nowrap;\n gap: var(--spacing-medium);\n margin-bottom: var(--spacing-small);\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button + button {\n margin-left: -5px;\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--md-sys-color-primary-container);\n }\n\n input {\n flex: 1;\n min-width: 80px;\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n }\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n button.hidden {\n opacity: 0;\n cursor: default;\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} ?disabled=${this.disabled} />\n <input type=\"text\" data-value=\"\" placeholder=\"value\" .value=${item.value} ?disabled=${this.disabled} />\n <button\n class=\"record-action\"\n @click=${(e: MouseEvent) => this._delete(e)}\n tabindex=\"-1\"\n ?disabled=${this.disabled}\n >\n <md-icon>remove</md-icon>\n </button>\n </div>\n `\n )}\n ${this.disabled\n ? nothing\n : html`\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\">\n <md-icon>add</md-icon>\n </button>\n </div>\n `}\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') && input.hasAttribute('data-value')) {\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')) {\n this._build(true)\n } else if (div && div.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {\n this._add()\n }\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"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-privilege.js","sourceRoot":"","sources":["../../src/ox-input-privilege.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;
|
1
|
+
{"version":3,"file":"ox-input-privilege.js","sourceRoot":"","sources":["../../src/ox-input-privilege.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QA2EuB,UAAK,GAKtB,IAAI,CAAA;QAEY,eAAU,GAAmE,EAAE,CAAA;IAmE5G,CAAC;aApJQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwElB,AAxEY,CAwEZ;IAaD,MA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KAAK,IAAI,IAAI;YACpB,KAAK,EAAE,SAAS,IAAI,IAAI;SACzB,CAAA;IACH,CAAC;IAED,YAAY;QACV,CAAC;QAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAsB,CAAC,KAAK,EAAE,CAAA;IACvE,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;QAE9B,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAzE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAKZ;AAEY;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAgF;AAEnF;IAAtB,KAAK,CAAC,MAAM,CAAC;8CAA+B;AApFlC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAqJ5B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field.js'\n\n@customElement('ox-input-privilege')\nexport class OxInputPrivilege extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n width: 100%;\n height: 100%;\n }\n\n select {\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n\n max-height: 35px;\n }\n\n select:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n div[values] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 10px;\n }\n\n div[values] > [col1] {\n text-align: right;\n align-self: center;\n }\n\n div[values] > [col2] {\n text-align: left;\n align-self: center;\n margin-right: auto;\n }\n\n input {\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n padding-right: 0;\n max-width: 70px;\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n label {\n margin-right: var(--spacing-medium);\n font: normal 0.8em var(--theme-font);\n color: var(--md-sys-color-on-primary-container);\n }\n `\n\n @property({ type: Object }) value?: {\n category: string\n privilege: string\n owner?: boolean\n super?: boolean\n } | null = null\n\n @property({ type: Array }) privileges: { privilege: string; category: string; description: string }[] = []\n\n @query('form') private form!: HTMLFormElement\n\n render() {\n const { category, privilege, owner, super: superUser } = this.value || {}\n const privileges = this.privileges || []\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <div values>\n <label for=\"privilege\" col1>${i18next.t('label.privilege')}</label>\n <select id=\"privilege\" name=\"privilege\" value=${ifDefined(privilege)} ?disabled=${this.disabled}>\n <option value=\"\"> </option>\n ${privileges.map(\n p =>\n html`<option\n value=${`${p.category}:${p.privilege}`}\n ?selected=${category == p.category && privilege == p.privilege}\n >\n ${p.description}\n </option>`\n )}\n </select>\n\n <label for=\"owner\" col1>${i18next.t('label.domain-owner')}</label>\n <input id=\"owner\" type=\"checkbox\" name=\"owner\" ?checked=${owner} col2 ?disabled=${this.disabled} />\n\n <label for=\"super\" col1>${i18next.t('label.superuser')}</label>\n <input id=\"super\" type=\"checkbox\" name=\"super\" ?checked=${superUser} col2 ?disabled=${this.disabled} />\n </div>\n </form>\n `\n }\n\n buildValue() {\n const formData = new FormData(this.form)\n\n const [category = '', privilege = ''] = (formData.get('privilege') as string).split(':')\n const owner = formData.get('owner') as string\n const superUser = formData.get('super') as string\n\n return {\n category,\n privilege,\n owner: owner == 'on',\n super: superUser == 'on'\n }\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n onChange(e: Event) {\n e.stopPropagation()\n\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|
@@ -25,12 +25,14 @@ let OxInputRange = class OxInputRange extends OxFormField {
|
|
25
25
|
|
26
26
|
input[type='number'] {
|
27
27
|
width: 48px;
|
28
|
+
height: 100%;
|
28
29
|
border: 0;
|
29
30
|
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
|
30
31
|
padding: var(--spacing-tiny);
|
31
32
|
font: var(--input-font);
|
32
33
|
color: var(--md-sys-color-on-primary-container);
|
33
34
|
}
|
35
|
+
|
34
36
|
input[type='number']:focus {
|
35
37
|
outline: none;
|
36
38
|
border-bottom: 1px solid var(--md-sys-color-on-primary-container);
|