@operato/input 9.0.0-beta.11 → 9.0.0-beta.15

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 CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [9.0.0-beta.15](https://github.com/hatiolab/operato/compare/v9.0.0-beta.14...v9.0.0-beta.15) (2025-01-27)
7
+
8
+ **Note:** Version bump only for package @operato/input
9
+
10
+
11
+
12
+
13
+
14
+ ## [9.0.0-beta.14](https://github.com/hatiolab/operato/compare/v9.0.0-beta.13...v9.0.0-beta.14) (2025-01-27)
15
+
16
+
17
+ ### :rocket: New Features
18
+
19
+ * module property-panel ([d78e4cf](https://github.com/hatiolab/operato/commit/d78e4cf7080b95fa74e61b42094b9f3f59f1409b))
20
+
21
+
22
+
6
23
  ## [9.0.0-beta.11](https://github.com/hatiolab/operato/compare/v9.0.0-beta.10...v9.0.0-beta.11) (2025-01-25)
7
24
 
8
25
 
@@ -14,13 +14,10 @@ export * from './ox-input-barcode.js';
14
14
  export * from './ox-input-code.js';
15
15
  export * from './ox-input-color.js';
16
16
  export * from './ox-input-multiple-colors.js';
17
- export * from './ox-input-color-stops.js';
18
- export * from './ox-input-color-gradient.js';
19
17
  export * from './ox-input-file.js';
20
18
  export * from './ox-input-image.js';
21
19
  export * from './ox-input-value-ranges.js';
22
20
  export * from './ox-input-value-map.js';
23
- export * from './ox-input-table.js';
24
21
  export * from './ox-input-scene-component-id.js';
25
22
  export * from './ox-input-crontab.js';
26
23
  export * from './ox-input-partition-keys.js';
package/dist/src/index.js CHANGED
@@ -14,13 +14,10 @@ export * from './ox-input-barcode.js';
14
14
  export * from './ox-input-code.js';
15
15
  export * from './ox-input-color.js';
16
16
  export * from './ox-input-multiple-colors.js';
17
- export * from './ox-input-color-stops.js';
18
- export * from './ox-input-color-gradient.js';
19
17
  export * from './ox-input-file.js';
20
18
  export * from './ox-input-image.js';
21
19
  export * from './ox-input-value-ranges.js';
22
20
  export * from './ox-input-value-map.js';
23
- export * from './ox-input-table.js';
24
21
  export * from './ox-input-scene-component-id.js';
25
22
  export * from './ox-input-crontab.js';
26
23
  export * from './ox-input-partition-keys.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-switch.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-color-stops.js'\nexport * from './ox-input-color-gradient.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-table.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\nexport * from './ox-input-table-column-config.js'\nexport * from './ox-input-search.js'\nexport * from './ox-input-signature.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-switch.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\nexport * from './ox-input-table-column-config.js'\nexport * from './ox-input-search.js'\nexport * from './ox-input-signature.js'\n"]}
@@ -0,0 +1,35 @@
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 '@operato/attachment/ox-attachment-selector.js';
7
+ import './ox-input-color.js';
8
+ import { OxFormField } from './ox-form-field.js';
9
+ export type BackgroundPatternOption = {
10
+ image?: HTMLImageElement | string;
11
+ color?: string;
12
+ align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom';
13
+ offsetX?: number;
14
+ offsetY?: number;
15
+ width?: number;
16
+ height?: number;
17
+ fitPattern?: boolean;
18
+ noRepeat?: boolean;
19
+ };
20
+ /**
21
+ * 컴포넌트의 fill pattern을 편집하는 element
22
+ *
23
+ * Example:
24
+ * <ox-input-background-pattern
25
+ * @change="${e => { this.pattern = e.target.value }}"
26
+ * .value=${this.pattern}"
27
+ * ></ox-input-background-pattern>
28
+ */
29
+ export declare class OxInputBackgroundPattern extends OxFormField {
30
+ static styles: import("lit").CSSResult[];
31
+ value?: BackgroundPatternOption;
32
+ render(): import("lit-html").TemplateResult<1>;
33
+ firstUpdated(): void;
34
+ _onChange(e: Event): void;
35
+ }
@@ -0,0 +1,111 @@
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 '@operato/attachment/ox-attachment-selector.js';
8
+ import './ox-input-color.js';
9
+ import { css, html } from 'lit';
10
+ import { customElement, property } from 'lit/decorators.js';
11
+ import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js';
12
+ import { OxFormField } from './ox-form-field.js';
13
+ /**
14
+ * 컴포넌트의 fill pattern을 편집하는 element
15
+ *
16
+ * Example:
17
+ * <ox-input-background-pattern
18
+ * @change="${e => { this.pattern = e.target.value }}"
19
+ * .value=${this.pattern}"
20
+ * ></ox-input-background-pattern>
21
+ */
22
+ let OxInputBackgroundPattern = class OxInputBackgroundPattern extends OxFormField {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.value = undefined;
26
+ }
27
+ static { this.styles = [
28
+ PropertyGridStyles,
29
+ css `
30
+ :host {
31
+ display: flex;
32
+ }
33
+ `
34
+ ]; }
35
+ render() {
36
+ const value = this.value || {};
37
+ return html `
38
+ <div class="property-grid">
39
+ <label> <ox-i18n msgid="label.image">image</ox-i18n> </label>
40
+
41
+ <ox-attachment-selector
42
+ value-key="image"
43
+ .value=${value.image || ''}
44
+ .properties=${{
45
+ category: 'image'
46
+ }}
47
+ class="custom-editor"
48
+ ></ox-attachment-selector>
49
+
50
+ <label> <ox-i18n msgid="label.align">align</ox-i18n> </label>
51
+
52
+ <select value-key="align" .value=${value.align}>
53
+ <option value="left-top">Left Top</option>
54
+ <option value="top">Center Top</option>
55
+ <option value="right-top">Right Top</option>
56
+ <option value="left">Left Center</option>
57
+ <option value="center">Center Center</option>
58
+ <option value="right">Right Center</option>
59
+ <option value="left-bottom">Left Bottom</option>
60
+ <option value="bottom">Center Bottom</option>
61
+ <option value="right-bottom">Right Bottom</option>
62
+ </select>
63
+
64
+ <label> <ox-i18n msgid="label.offset-x">offsetX</ox-i18n> </label>
65
+ <input type="number" value-key="offsetX" .value=${value.offsetX} />
66
+
67
+ <label> <ox-i18n msgid="label.offset-y">offsetY</ox-i18n> </label>
68
+ <input type="number" value-key="offsetY" .value=${value.offsetY} />
69
+
70
+ <label> <ox-i18n msgid="label.width">width</ox-i18n> </label>
71
+ <input type="number" value-key="width" .value=${value.width} />
72
+
73
+ <label> <ox-i18n msgid="label.height">height</ox-i18n> </label>
74
+ <input type="number" value-key="height" .value=${value.height} />
75
+
76
+ <label><md-icon>format_color_fill</md-icon></label>
77
+ <ox-input-color class="custom-editor" value-key="color" .value=${value.color}> </ox-input-color>
78
+
79
+ <input id="fitPattern" value-key="fitPattern" type="checkbox" ?checked=${value.fitPattern} required />
80
+ <label for="fitPattern"> <ox-i18n msgid="label.fit">fit</ox-i18n> </label>
81
+
82
+ <input id="noRepeat" value-key="noRepeat" type="checkbox" ?checked=${value.noRepeat} required />
83
+ <label for="noRepeat"> <ox-i18n msgid="label.no-repeat">no repeat</ox-i18n> </label>
84
+ </div>
85
+ `;
86
+ }
87
+ firstUpdated() {
88
+ this.renderRoot.addEventListener('change', this._onChange.bind(this));
89
+ }
90
+ _onChange(e) {
91
+ var element = e.target;
92
+ var key = element.getAttribute('value-key');
93
+ var value = element.value;
94
+ if (key === 'fitPattern' || key === 'noRepeat') {
95
+ value = element.checked;
96
+ }
97
+ this.value = {
98
+ ...this.value,
99
+ [key]: value
100
+ };
101
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
102
+ }
103
+ };
104
+ __decorate([
105
+ property({ type: Object })
106
+ ], OxInputBackgroundPattern.prototype, "value", void 0);
107
+ OxInputBackgroundPattern = __decorate([
108
+ customElement('ox-input-background-pattern')
109
+ ], OxInputBackgroundPattern);
110
+ export { OxInputBackgroundPattern };
111
+ //# sourceMappingURL=ox-input-background-pattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-background-pattern.js","sourceRoot":"","sources":["../../src/ox-input-background-pattern.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,0BAA0B,CAAA;AACjC,OAAO,+CAA+C,CAAA;AACtD,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAchD;;;;;;;;GAQG;AAGI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,WAAW;IAAlD;;QAUuB,UAAK,GAA6B,SAAS,CAAA;IA4EzE,CAAC;aArFQ,WAAM,GAAG;QACd,kBAAkB;QAClB,GAAG,CAAA;;;;KAIF;KACF,AAPY,CAOZ;IAID,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAK,EAA8B,CAAA;QAE3D,OAAO,IAAI,CAAA;;;;;;mBAMI,KAAK,CAAC,KAAK,IAAI,EAAE;wBACZ;YACZ,QAAQ,EAAE,OAAO;SAClB;;;;;;2CAMgC,KAAK,CAAC,KAAK;;;;;;;;;;;;;0DAaI,KAAK,CAAC,OAAO;;;0DAGb,KAAK,CAAC,OAAO;;;wDAGf,KAAK,CAAC,KAAK;;;yDAGV,KAAK,CAAC,MAAM;;;yEAGI,KAAK,CAAC,KAAK;;iFAEH,KAAK,CAAC,UAAU;;;6EAGpB,KAAK,CAAC,QAAQ;;;KAGtF,CAAA;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACvE,CAAC;IAED,SAAS,CAAC,CAAQ;QAChB,IAAI,OAAO,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC1C,IAAI,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAC3C,IAAI,KAAK,GAAQ,OAAO,CAAC,KAAK,CAAA;QAE9B,IAAI,GAAG,KAAK,YAAY,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YAC/C,KAAK,GAAG,OAAO,CAAC,OAAO,CAAA;QACzB,CAAC;QAED,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,IAAI,CAAC,KAAK;YACb,CAAC,GAAI,CAAC,EAAE,KAAK;SACd,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;;AA3E2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA4C;AAV5D,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAsFpC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/attachment/ox-attachment-selector.js'\nimport './ox-input-color.js'\n\nimport { css, html } 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'\n\nexport type BackgroundPatternOption = {\n image?: HTMLImageElement | string\n color?: string\n align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'\n offsetX?: number\n offsetY?: number\n width?: number\n height?: number\n fitPattern?: boolean\n noRepeat?: boolean\n}\n\n/**\n * 컴포넌트의 fill pattern을 편집하는 element\n *\n * Example:\n * <ox-input-background-pattern\n * @change=\"${e => { this.pattern = e.target.value }}\"\n * .value=${this.pattern}\"\n * ></ox-input-background-pattern>\n */\n\n@customElement('ox-input-background-pattern')\nexport class OxInputBackgroundPattern extends OxFormField {\n static styles = [\n PropertyGridStyles,\n css`\n :host {\n display: flex;\n }\n `\n ]\n\n @property({ type: Object }) value?: BackgroundPatternOption = undefined\n\n render() {\n const value = this.value || ({} as BackgroundPatternOption)\n\n return html`\n <div class=\"property-grid\">\n <label> <ox-i18n msgid=\"label.image\">image</ox-i18n> </label>\n\n <ox-attachment-selector\n value-key=\"image\"\n .value=${value.image || ''}\n .properties=${{\n category: 'image'\n }}\n class=\"custom-editor\"\n ></ox-attachment-selector>\n\n <label> <ox-i18n msgid=\"label.align\">align</ox-i18n> </label>\n\n <select value-key=\"align\" .value=${value.align}>\n <option value=\"left-top\">Left Top</option>\n <option value=\"top\">Center Top</option>\n <option value=\"right-top\">Right Top</option>\n <option value=\"left\">Left Center</option>\n <option value=\"center\">Center Center</option>\n <option value=\"right\">Right Center</option>\n <option value=\"left-bottom\">Left Bottom</option>\n <option value=\"bottom\">Center Bottom</option>\n <option value=\"right-bottom\">Right Bottom</option>\n </select>\n\n <label> <ox-i18n msgid=\"label.offset-x\">offsetX</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetX\" .value=${value.offsetX} />\n\n <label> <ox-i18n msgid=\"label.offset-y\">offsetY</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetY\" .value=${value.offsetY} />\n\n <label> <ox-i18n msgid=\"label.width\">width</ox-i18n> </label>\n <input type=\"number\" value-key=\"width\" .value=${value.width} />\n\n <label> <ox-i18n msgid=\"label.height\">height</ox-i18n> </label>\n <input type=\"number\" value-key=\"height\" .value=${value.height} />\n\n <label><md-icon>format_color_fill</md-icon></label>\n <ox-input-color class=\"custom-editor\" value-key=\"color\" .value=${value.color}> </ox-input-color>\n\n <input id=\"fitPattern\" value-key=\"fitPattern\" type=\"checkbox\" ?checked=${value.fitPattern} required />\n <label for=\"fitPattern\"> <ox-i18n msgid=\"label.fit\">fit</ox-i18n> </label>\n\n <input id=\"noRepeat\" value-key=\"noRepeat\" type=\"checkbox\" ?checked=${value.noRepeat} required />\n <label for=\"noRepeat\"> <ox-i18n msgid=\"label.no-repeat\">no repeat</ox-i18n> </label>\n </div>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n _onChange(e: Event) {\n var element = e.target as HTMLInputElement\n var key = element.getAttribute('value-key')\n var value: any = element.value\n\n if (key === 'fitPattern' || key === 'noRepeat') {\n value = element.checked\n }\n\n this.value = {\n ...this.value,\n [key!]: value\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
+ import '@material/web/icon/icon.js';
4
5
  import '@operato/i18n/ox-i18n.js';
5
- import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
6
- import '@polymer/paper-listbox/paper-listbox.js';
7
- import '@polymer/paper-item/paper-item.js';
8
- import '@operato/input/ox-input-angle.js';
9
- import '@operato/input/ox-input-color-stops.js';
10
- import { ColorStop } from './ox-input-color-stops.js';
6
+ import './ox-select.js';
7
+ import './ox-input-angle.js';
8
+ import './ox-input-color-stops.js';
11
9
  import { OxFormField } from './ox-form-field.js';
10
+ import { ColorStop } from './ox-input-color-stops.js';
12
11
  export type GradientOption = {
13
12
  type: 'linear' | 'radial';
14
13
  rotation: number;
@@ -17,10 +16,10 @@ export type GradientOption = {
17
16
  colorStops?: ColorStop[];
18
17
  };
19
18
  export declare class OxInputColorGradient extends OxFormField {
20
- static styles: import("lit").CSSResult;
19
+ static styles: import("lit").CSSResult[];
21
20
  value: GradientOption;
22
21
  firstUpdated(): void;
23
- _onChange(e: Event): void;
24
22
  render(): import("lit-html").TemplateResult<1>;
25
- _convertDirectionToRotation(direction: string): number;
23
+ private onChange;
24
+ private convertDirectionToRotation;
26
25
  }
@@ -2,15 +2,16 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
  import { __decorate } from "tslib";
5
+ import '@material/web/icon/icon.js';
5
6
  import '@operato/i18n/ox-i18n.js';
6
- import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
7
- import '@polymer/paper-listbox/paper-listbox.js';
8
- import '@polymer/paper-item/paper-item.js';
9
- import '@operato/input/ox-input-angle.js';
10
- import '@operato/input/ox-input-color-stops.js';
7
+ import './ox-select.js';
8
+ import './ox-input-angle.js';
9
+ import './ox-input-color-stops.js';
11
10
  import { css, html } from 'lit';
12
11
  import { customElement, property } from 'lit/decorators.js';
13
12
  import { OxFormField } from './ox-form-field.js';
13
+ import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js';
14
+ import { GradientDirectionStyles } from '@operato/styles/gradient-direction-styles.js';
14
15
  let OxInputColorGradient = class OxInputColorGradient extends OxFormField {
15
16
  constructor() {
16
17
  super(...arguments);
@@ -20,152 +21,83 @@ let OxInputColorGradient = class OxInputColorGradient extends OxFormField {
20
21
  rotation: 0
21
22
  };
22
23
  }
23
- static { this.styles = css `
24
- :host {
25
- display: grid;
26
-
27
- grid-template-columns: repeat(10, 1fr);
28
- grid-gap: 5px;
29
- grid-auto-rows: minmax(24px, auto);
30
-
31
- align-items: center;
32
- }
33
-
34
- :host > * {
35
- align-self: stretch;
36
- }
37
-
38
- :host > label {
39
- grid-column: span 2;
40
- text-align: right;
41
- text-transform: capitalize;
42
- align-self: center;
43
- }
44
-
45
- :host > .icon-only-label {
46
- grid-column: span 1;
47
- }
48
-
49
- :host > input,
50
- :host > [editors] {
51
- grid-column: span 8;
52
- }
53
-
54
- :host > select {
55
- grid-column: span 4;
56
- height: 100%;
57
- border: 1px solid rgba(0, 0, 0, 0.2);
58
- }
59
-
60
- :host > ox-input-angle {
61
- grid-column: span 3;
62
- }
63
-
64
- ox-input-color-stops {
65
- grid-column: span 10;
66
- }
67
-
68
- .host > input[type='checkbox'] {
69
- grid-column: 3 / 4;
70
- }
71
-
72
- .host > input[type='checkbox'] ~ label {
73
- grid-column: span 7;
74
- text-align: left;
75
- }
76
-
77
- [editors] > :not([active-selector]) {
78
- display: none;
79
- }
80
-
81
- [gradient-direction] {
82
- overflow: hidden;
83
- max-width: 210px;
84
- }
85
-
86
- [gradient-direction] paper-item {
87
- background: url(/assets/images/icon-editor-gradient-direction.png) 50% 0 no-repeat;
88
- min-height: 32px;
89
- padding: 3px 5px;
90
- width: 30px;
91
- float: left;
92
- }
93
-
94
- [gradient-direction] [name='lefttop-to-rightbottom'] {
95
- background-position: 50% 4px;
96
- }
97
-
98
- [gradient-direction] [name='left-top'] {
99
- background-position: 50% 4px;
100
- }
101
-
102
- [gradient-direction] [name='top-to-bottom'] {
103
- background-position: 50% -46px;
104
- }
105
-
106
- [gradient-direction] [name='righttop-to-leftbottom'] {
107
- background-position: 50% -96px;
108
- }
109
-
110
- [gradient-direction] [name='right-top'] {
111
- background-position: 50% -96px;
112
- }
113
-
114
- [gradient-direction] [name='right-to-left'] {
115
- background-position: 50% -146px;
116
- }
117
-
118
- [gradient-direction] [name='rightbottom-to-lefttop'] {
119
- background-position: 50% -196px;
120
- }
121
-
122
- [gradient-direction] [name='right-bottom'] {
123
- background-position: 50% -196px;
124
- }
125
-
126
- [gradient-direction] [name='bottom-to-top'] {
127
- background-position: 50% -246px;
128
- }
129
-
130
- [gradient-direction] [name='leftbottom-to-righttop'] {
131
- background-position: 50% -296px;
132
- }
133
-
134
- [gradient-direction] [name='left-bottom'] {
135
- background-position: 50% -296px;
136
- }
137
-
138
- [gradient-direction] [name='left-to-right'] {
139
- background-position: 50% -346px;
140
- }
141
-
142
- [gradient-direction] [name='center-to-corner'] {
143
- background-position: 50% -396px;
144
- }
145
-
146
- [gradient-direction] [name='center'] {
147
- background-position: 50% -396px;
148
- }
149
-
150
- [gradient-direction] paper-item[focused] {
151
- background-color: rgba(255, 246, 143, 0.5);
152
- }
153
-
154
- .icon-only-label {
155
- top: 0 !important;
156
- width: 30px !important;
157
- height: 24px;
158
- background: url(/assets/images/icon-properties-label.png) no-repeat;
159
- }
160
-
161
- .icon-only-label.color {
162
- background-position: 70% -198px;
163
- }
164
- `; }
24
+ static { this.styles = [
25
+ PropertyGridStyles,
26
+ GradientDirectionStyles,
27
+ css `
28
+ :host {
29
+ display: flex;
30
+ }
31
+
32
+ [editors] > :not([active-selector]) {
33
+ display: none;
34
+ }
35
+ `
36
+ ]; }
165
37
  firstUpdated() {
166
- this.renderRoot.addEventListener('change', this._onChange.bind(this));
38
+ this.renderRoot.addEventListener('change', this.onChange.bind(this));
39
+ }
40
+ render() {
41
+ var selector = (this.value && this.value.type) || 'linear';
42
+ var { type = 'linear', direction = 'left-to-right', center = 'center', rotation = 0, colorStops } = this.value || {};
43
+ return html `
44
+ <div class="property-grid">
45
+ <label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
46
+ <select value-key="type" .value=${type || 'linear'} ?disabled=${this.disabled}>
47
+ <option>linear</option>
48
+ <option>radial</option>
49
+ </select>
50
+
51
+ <label><md-icon>format_color_fill</md-icon></label>
52
+ <ox-input-angle value-key="rotation" .value=${rotation || 0} ?disabled=${this.disabled}> </ox-input-angle>
53
+
54
+ <label> <ox-i18n msgid="label.direction">direction</ox-i18n> </label>
55
+ <div class="custom-editor" editors>
56
+ <ox-select ?active-selector=${selector == 'linear'} .value=${direction} value-key="direction">
57
+ <div class="gradient-direction" value=${String(direction || '')} slot="label"></div>
58
+ <ox-popup-list align-left nowrap>
59
+ <style>
60
+ ${GradientDirectionStyles.cssText}
61
+ </style>
62
+ <div class="gradient-direction" value="lefttop-to-rightbottom" option></div>
63
+ <div class="gradient-direction" value="top-to-bottom" option></div>
64
+ <div class="gradient-direction" value="righttop-to-leftbottom" option></div>
65
+ <div class="gradient-direction" value="right-to-left" option></div>
66
+ <div class="gradient-direction" value="rightbottom-to-lefttop" option></div>
67
+ <div class="gradient-direction" value="bottom-to-top" option></div>
68
+ <div class="gradient-direction" value="leftbottom-to-righttop" option></div>
69
+ <div class="gradient-direction" value="left-to-right" option></div>
70
+ <div class="gradient-direction" value="center-to-corner" option></div>
71
+ </ox-popup-list>
72
+ </ox-select>
73
+
74
+ <ox-select ?active-selector=${selector == 'radial'} .value=${center} value-key="center">
75
+ <div class="gradient-direction" value=${String(center || '')} slot="label"></div>
76
+ <ox-popup-list align-left nowrap>
77
+ <style>
78
+ ${GradientDirectionStyles.cssText}
79
+ </style>
80
+ <div class="gradient-direction" value="center" option></div>
81
+ <div class="gradient-direction" value="left-top" option></div>
82
+ <div class="gradient-direction" value="right-top" option></div>
83
+ <div class="gradient-direction" value="right-bottom" option></div>
84
+ <div class="gradient-direction" value="left-bottom" option></div>
85
+ </ox-popup-list>
86
+ </ox-select>
87
+ </div>
88
+
89
+ <ox-input-color-stops
90
+ value-key="colorStops"
91
+ type="gradient"
92
+ .value=${colorStops}
93
+ ?disabled=${this.disabled}
94
+ class="property-full-bleed"
95
+ >
96
+ </ox-input-color-stops>
97
+ </div>
98
+ `;
167
99
  }
168
- _onChange(e) {
100
+ onChange(e) {
169
101
  var element = e.target;
170
102
  var key = element.getAttribute('value-key');
171
103
  if (!key) {
@@ -185,12 +117,6 @@ let OxInputColorGradient = class OxInputColorGradient extends OxFormField {
185
117
  value = String(element.value);
186
118
  }
187
119
  break;
188
- case 'PAPER-BUTTON':
189
- value = element.active;
190
- break;
191
- case 'PAPER-LISTBOX':
192
- value = element.selected;
193
- break;
194
120
  default:
195
121
  value = element.value;
196
122
  break;
@@ -198,7 +124,7 @@ let OxInputColorGradient = class OxInputColorGradient extends OxFormField {
198
124
  if (key === 'rotation') {
199
125
  this.value = {
200
126
  ...this.value,
201
- rotation: value,
127
+ rotation: Number(value || 0),
202
128
  direction: undefined
203
129
  };
204
130
  }
@@ -207,7 +133,7 @@ let OxInputColorGradient = class OxInputColorGradient extends OxFormField {
207
133
  this.value = {
208
134
  ...this.value,
209
135
  direction: value,
210
- rotation: this._convertDirectionToRotation(value)
136
+ rotation: this.convertDirectionToRotation(String(value || 'left-to-right'))
211
137
  };
212
138
  }
213
139
  }
@@ -219,70 +145,7 @@ let OxInputColorGradient = class OxInputColorGradient extends OxFormField {
219
145
  }
220
146
  this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
221
147
  }
222
- render() {
223
- var selector = (this.value && this.value.type) || 'linear';
224
- var value = this.value || {};
225
- return html `
226
- <label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
227
- <select value-key="type" .value=${value.type || 'linear'} ?disabled=${this.disabled}>
228
- <option>linear</option>
229
- <option>radial</option>
230
- </select>
231
-
232
- <label class="icon-only-label color"></label>
233
- <ox-input-angle value-key="rotation" .value=${value.rotation || 0} ?disabled=${this.disabled}> </ox-input-angle>
234
-
235
- <label> <ox-i18n msgid="label.direction">direction</ox-i18n> </label>
236
- <div editors>
237
- <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'linear'} .value=${value.direction}>
238
- <paper-listbox
239
- @selected-changed=${(e) => this._onChange(e)}
240
- value-key="direction"
241
- slot="dropdown-content"
242
- gradient-direction
243
- .selected=${value.direction}
244
- attr-for-selected="name"
245
- >
246
- <paper-item name="lefttop-to-rightbottom"></paper-item>
247
- <paper-item name="top-to-bottom"></paper-item>
248
- <paper-item name="righttop-to-leftbottom"></paper-item>
249
- <paper-item name="right-to-left"></paper-item>
250
- <paper-item name="rightbottom-to-lefttop"></paper-item>
251
- <paper-item name="bottom-to-top"></paper-item>
252
- <paper-item name="leftbottom-to-righttop"></paper-item>
253
- <paper-item name="left-to-right"></paper-item>
254
- <paper-item name="center-to-corner"></paper-item>
255
- </paper-listbox>
256
- </paper-dropdown-menu>
257
-
258
- <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'radial'} .value=${value.center}>
259
- <paper-listbox
260
- @selected-changed=${(e) => this._onChange(e)}
261
- value-key="center"
262
- slot="dropdown-content"
263
- gradient-direction
264
- .selected=${value.center || 'center'}
265
- attr-for-selected="name"
266
- >
267
- <paper-item name="center"></paper-item>
268
- <paper-item name="left-top"></paper-item>
269
- <paper-item name="right-top"></paper-item>
270
- <paper-item name="right-bottom"></paper-item>
271
- <paper-item name="left-bottom"></paper-item>
272
- </paper-listbox>
273
- </paper-dropdown-menu>
274
- </div>
275
-
276
- <ox-input-color-stops
277
- value-key="colorStops"
278
- type="gradient"
279
- .value=${value.colorStops}
280
- ?disabled=${this.disabled}
281
- >
282
- </ox-input-color-stops>
283
- `;
284
- }
285
- _convertDirectionToRotation(direction) {
148
+ convertDirectionToRotation(direction) {
286
149
  var rotation;
287
150
  switch (direction) {
288
151
  case 'lefttop-to-rightbottom':