@operato/app 0.4.3 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/src/filter-renderer/filter-resource-select.d.ts +4 -0
  3. package/dist/src/filter-renderer/filter-resource-select.js +79 -0
  4. package/dist/src/filter-renderer/filter-resource-select.js.map +1 -0
  5. package/dist/src/filter-renderer/index.d.ts +1 -0
  6. package/dist/src/filter-renderer/index.js +5 -0
  7. package/dist/src/filter-renderer/index.js.map +1 -0
  8. package/dist/src/grist-editor/index.d.ts +1 -0
  9. package/dist/src/grist-editor/index.js +28 -0
  10. package/dist/src/grist-editor/index.js.map +1 -0
  11. package/dist/src/grist-editor/ox-grist-editor-code.d.ts +7 -0
  12. package/dist/src/grist-editor/ox-grist-editor-code.js +53 -0
  13. package/dist/src/grist-editor/ox-grist-editor-code.js.map +1 -0
  14. package/dist/src/grist-editor/ox-grist-editor-crontab.d.ts +8 -0
  15. package/dist/src/grist-editor/ox-grist-editor-crontab.js +50 -0
  16. package/dist/src/grist-editor/ox-grist-editor-crontab.js.map +1 -0
  17. package/dist/src/grist-editor/ox-grist-editor-json.d.ts +7 -0
  18. package/dist/src/grist-editor/ox-grist-editor-json.js +54 -0
  19. package/dist/src/grist-editor/ox-grist-editor-json.js.map +1 -0
  20. package/dist/src/grist-editor/ox-grist-editor-parameters.d.ts +12 -0
  21. package/dist/src/grist-editor/ox-grist-editor-parameters.js +84 -0
  22. package/dist/src/grist-editor/ox-grist-editor-parameters.js.map +1 -0
  23. package/dist/src/grist-editor/ox-grist-editor-partition-keys.d.ts +11 -0
  24. package/dist/src/grist-editor/ox-grist-editor-partition-keys.js +74 -0
  25. package/dist/src/grist-editor/ox-grist-editor-partition-keys.js.map +1 -0
  26. package/dist/src/grist-editor/ox-grist-editor-resource-code.d.ts +6 -0
  27. package/dist/src/grist-editor/ox-grist-editor-resource-code.js +55 -0
  28. package/dist/src/grist-editor/ox-grist-editor-resource-code.js.map +1 -0
  29. package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +9 -0
  30. package/dist/src/grist-editor/ox-grist-editor-resource-id.js +72 -0
  31. package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -0
  32. package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +11 -0
  33. package/dist/src/grist-editor/ox-grist-editor-resource-object.js +104 -0
  34. package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -0
  35. package/dist/src/grist-editor/ox-grist-editor-value-map.d.ts +11 -0
  36. package/dist/src/grist-editor/ox-grist-editor-value-map.js +74 -0
  37. package/dist/src/grist-editor/ox-grist-editor-value-map.js.map +1 -0
  38. package/dist/src/grist-editor/ox-grist-renderer-crontab.d.ts +2 -0
  39. package/dist/src/grist-editor/ox-grist-renderer-crontab.js +26 -0
  40. package/dist/src/grist-editor/ox-grist-renderer-crontab.js.map +1 -0
  41. package/dist/src/grist-editor/ox-grist-renderer-resource-id.d.ts +2 -0
  42. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js +9 -0
  43. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -0
  44. package/dist/src/grist-editor/ox-grist-renderer-resource-object.d.ts +2 -0
  45. package/dist/src/grist-editor/ox-grist-renderer-resource-object.js +22 -0
  46. package/dist/src/grist-editor/ox-grist-renderer-resource-object.js.map +1 -0
  47. package/dist/src/grist-editor/ox-parameters-builder.d.ts +4 -0
  48. package/dist/src/grist-editor/ox-parameters-builder.js +118 -0
  49. package/dist/src/grist-editor/ox-parameters-builder.js.map +1 -0
  50. package/dist/src/grist-editor/ox-popup-code-input.d.ts +12 -0
  51. package/dist/src/grist-editor/ox-popup-code-input.js +71 -0
  52. package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -0
  53. package/dist/src/grist-editor/ox-popup-crontab-input.d.ts +11 -0
  54. package/dist/src/grist-editor/ox-popup-crontab-input.js +74 -0
  55. package/dist/src/grist-editor/ox-popup-crontab-input.js.map +1 -0
  56. package/dist/src/grist-editor/ox-popup-parameters-builder.d.ts +13 -0
  57. package/dist/src/grist-editor/ox-popup-parameters-builder.js +111 -0
  58. package/dist/src/grist-editor/ox-popup-parameters-builder.js.map +1 -0
  59. package/dist/src/grist-editor/ox-popup-partition-keys-input.d.ts +12 -0
  60. package/dist/src/grist-editor/ox-popup-partition-keys-input.js +98 -0
  61. package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +1 -0
  62. package/dist/src/grist-editor/ox-popup-value-map-input.d.ts +12 -0
  63. package/dist/src/grist-editor/ox-popup-value-map-input.js +104 -0
  64. package/dist/src/grist-editor/ox-popup-value-map-input.js.map +1 -0
  65. package/dist/src/grist-editor/ox-selector-resource-id.d.ts +24 -0
  66. package/dist/src/grist-editor/ox-selector-resource-id.js +202 -0
  67. package/dist/src/grist-editor/ox-selector-resource-id.js.map +1 -0
  68. package/dist/src/grist-editor/ox-selector-resource-object.d.ts +39 -0
  69. package/dist/src/grist-editor/ox-selector-resource-object.js +343 -0
  70. package/dist/src/grist-editor/ox-selector-resource-object.js.map +1 -0
  71. package/dist/src/input/index.d.ts +3 -0
  72. package/dist/src/input/index.js +4 -0
  73. package/dist/src/input/index.js.map +1 -0
  74. package/dist/src/input/ox-input-background-pattern.d.ts +31 -0
  75. package/dist/src/input/ox-input-background-pattern.js +150 -0
  76. package/dist/src/input/ox-input-background-pattern.js.map +1 -0
  77. package/dist/src/input/ox-input-fill-style.d.ts +41 -0
  78. package/dist/src/input/ox-input-fill-style.js +325 -0
  79. package/dist/src/input/ox-input-fill-style.js.map +1 -0
  80. package/dist/src/input/ox-input-graphql.d.ts +36 -0
  81. package/dist/src/input/ox-input-graphql.js +161 -0
  82. package/dist/src/input/ox-input-graphql.js.map +1 -0
  83. package/dist/src/input/ox-input-resource.d.ts +36 -0
  84. package/dist/src/input/ox-input-resource.js +161 -0
  85. package/dist/src/input/ox-input-resource.js.map +1 -0
  86. package/dist/src/property-editor/index.d.ts +24 -0
  87. package/dist/src/property-editor/index.js +58 -0
  88. package/dist/src/property-editor/index.js.map +1 -0
  89. package/dist/src/property-editor/ox-property-editor-graphql.d.ts +5 -0
  90. package/dist/src/property-editor/ox-property-editor-graphql.js +15 -0
  91. package/dist/src/property-editor/ox-property-editor-graphql.js.map +1 -0
  92. package/dist/tsconfig.tsbuildinfo +1 -1
  93. package/package.json +9 -8
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import '@operato/i18n/ox-i18n.js';
5
+ import '@operato/attachment/ox-attachment-selector.js';
6
+ import { OxFormField } from '@operato/input';
7
+ export declare type BackgroundPatternOption = {
8
+ image?: HTMLImageElement | string;
9
+ align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom';
10
+ offsetX?: number;
11
+ offsetY?: number;
12
+ width?: number;
13
+ height?: number;
14
+ fitPattern?: boolean;
15
+ };
16
+ /**
17
+ * 컴포넌트의 fill pattern을 편집하는 element
18
+ *
19
+ * Example:
20
+ * <ox-input-background-pattern
21
+ * @change="${e => { this.pattern = e.target.value }}"
22
+ * .value=${this.pattern}"
23
+ * ></ox-input-background-pattern>
24
+ */
25
+ export declare class OxInputBackgroundPattern extends OxFormField {
26
+ static styles: import("lit").CSSResult;
27
+ value?: BackgroundPatternOption;
28
+ render(): import("lit-html").TemplateResult<1>;
29
+ firstUpdated(): void;
30
+ _onChange(e: Event): void;
31
+ }
@@ -0,0 +1,150 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import '@operato/i18n/ox-i18n.js';
6
+ import '@operato/attachment/ox-attachment-selector.js';
7
+ import { css, html } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ import { OxFormField } from '@operato/input';
10
+ /**
11
+ * 컴포넌트의 fill pattern을 편집하는 element
12
+ *
13
+ * Example:
14
+ * <ox-input-background-pattern
15
+ * @change="${e => { this.pattern = e.target.value }}"
16
+ * .value=${this.pattern}"
17
+ * ></ox-input-background-pattern>
18
+ */
19
+ let OxInputBackgroundPattern = class OxInputBackgroundPattern extends OxFormField {
20
+ render() {
21
+ const value = this.value || {};
22
+ return html `
23
+ <label> <ox-i18n msgid="label.image" auto="">image</ox-i18n> </label>
24
+
25
+ <ox-attachment-selector
26
+ value-key="image"
27
+ .value=${value.image || ''}
28
+ .properties=${{
29
+ category: 'image'
30
+ }}
31
+ custom-editor
32
+ ></ox-attachment-selector>
33
+
34
+ <label> <ox-i18n msgid="label.align" auto="">align</ox-i18n> </label>
35
+
36
+ <select value-key="align" class="select-content" .value=${value.align}>
37
+ <option value="left-top">Left Top</option>
38
+ <option value="top">Top</option>
39
+ <option value="right-top">Right Top</option>
40
+ <option value="left">Left</option>
41
+ <option value="center">Center</option>
42
+ <option value="right">Right</option>
43
+ <option value="left-bottom">Left Bottom</option>
44
+ <option value="bottom">Bottom</option>
45
+ <option value="right-bottom">Right Bottom</option>
46
+ </select>
47
+
48
+ <div class="grid-10">
49
+ <label> <ox-i18n msgid="label.offset-x" auto="">offsetX</ox-i18n> </label>
50
+ <input type="number" value-key="offsetX" .value=${value.offsetX} />
51
+
52
+ <label> <ox-i18n msgid="label.offset-y" auto="">offsetY</ox-i18n> </label>
53
+ <input type="number" value-key="offsetY" .value=${value.offsetY} />
54
+
55
+ <label> <ox-i18n msgid="label.width" auto="">width</ox-i18n> </label>
56
+ <input type="number" value-key="width" .value=${value.width} />
57
+
58
+ <label> <ox-i18n msgid="label.height" auto="">height</ox-i18n> </label>
59
+ <input type="number" value-key="height" .value=${value.height} />
60
+ </div>
61
+
62
+ <div class="grid-10">
63
+ <input value-key="fitPattern" type="checkbox" .checked=${value.fitPattern} required />
64
+ <label> <ox-i18n msgid="label.fit" auto="">Fit</ox-i18n> </label>
65
+ </div>
66
+ `;
67
+ }
68
+ firstUpdated() {
69
+ this.renderRoot.addEventListener('change', this._onChange.bind(this));
70
+ }
71
+ _onChange(e) {
72
+ var element = e.target;
73
+ var key = element.getAttribute('value-key');
74
+ var value = element.value;
75
+ if (key == 'fitPattern') {
76
+ value = element.checked;
77
+ }
78
+ this.value = {
79
+ ...this.value,
80
+ [key]: value
81
+ };
82
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
83
+ }
84
+ };
85
+ OxInputBackgroundPattern.styles = css `
86
+ :host,
87
+ .grid-10 {
88
+ display: grid;
89
+ grid-template-columns: repeat(10, 1fr);
90
+ grid-gap: 5px;
91
+ grid-auto-rows: minmax(24px, auto);
92
+
93
+ align-items: center;
94
+ }
95
+
96
+ * {
97
+ align-self: stretch;
98
+ }
99
+
100
+ label {
101
+ grid-column: span 2;
102
+ text-align: right;
103
+ text-transform: capitalize;
104
+
105
+ align-self: center;
106
+ }
107
+
108
+ .grid-10 {
109
+ grid-column: span 10;
110
+ }
111
+
112
+ select,
113
+ input,
114
+ [custom-editor] {
115
+ grid-column: span 8;
116
+ }
117
+
118
+ select {
119
+ height: 100%;
120
+ border: 1px solid rgba(0, 0, 0, 0.2);
121
+ }
122
+
123
+ input[type='checkbox'] {
124
+ grid-column: 3 / 4;
125
+ align-self: center;
126
+ }
127
+
128
+ input[type='checkbox'] ~ label {
129
+ grid-column: span 7;
130
+ text-align: left;
131
+ }
132
+
133
+ .grid-10 > input[type='number'] {
134
+ grid-column: span 3;
135
+ border: 1px solid rgba(0, 0, 0, 0.2);
136
+ }
137
+
138
+ .grid-10 > label {
139
+ grid-column: span 2;
140
+ text-align: right;
141
+ }
142
+ `;
143
+ __decorate([
144
+ property({ type: Object })
145
+ ], OxInputBackgroundPattern.prototype, "value", void 0);
146
+ OxInputBackgroundPattern = __decorate([
147
+ customElement('ox-input-background-pattern')
148
+ ], OxInputBackgroundPattern);
149
+ export { OxInputBackgroundPattern };
150
+ //# sourceMappingURL=ox-input-background-pattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-input-background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AAG,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;CACF,CAAA;AAnIQ,+BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAgC;AA5DhD,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAoIpC;SApIY,wBAAwB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/attachment/ox-attachment-selector.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from '@operato/input'\n\nexport type BackgroundPatternOption = {\n image?: HTMLImageElement | 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}\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 = css`\n :host,\n .grid-10 {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n\n align-items: center;\n }\n\n * {\n align-self: stretch;\n }\n\n label {\n grid-column: span 2;\n text-align: right;\n text-transform: capitalize;\n\n align-self: center;\n }\n\n .grid-10 {\n grid-column: span 10;\n }\n\n select,\n input,\n [custom-editor] {\n grid-column: span 8;\n }\n\n select {\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n input[type='checkbox'] {\n grid-column: 3 / 4;\n align-self: center;\n }\n\n input[type='checkbox'] ~ label {\n grid-column: span 7;\n text-align: left;\n }\n\n .grid-10 > input[type='number'] {\n grid-column: span 3;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n .grid-10 > label {\n grid-column: span 2;\n text-align: right;\n }\n `\n\n @property({ type: Object }) value?: BackgroundPatternOption\n\n render() {\n const value = this.value || ({} as BackgroundPatternOption)\n\n return html`\n <label> <ox-i18n msgid=\"label.image\" auto=\"\">image</ox-i18n> </label>\n\n <ox-attachment-selector\n value-key=\"image\"\n .value=${value.image || ''}\n .properties=${{\n category: 'image'\n }}\n custom-editor\n ></ox-attachment-selector>\n\n <label> <ox-i18n msgid=\"label.align\" auto=\"\">align</ox-i18n> </label>\n\n <select value-key=\"align\" class=\"select-content\" .value=${value.align}>\n <option value=\"left-top\">Left Top</option>\n <option value=\"top\">Top</option>\n <option value=\"right-top\">Right Top</option>\n <option value=\"left\">Left</option>\n <option value=\"center\">Center</option>\n <option value=\"right\">Right</option>\n <option value=\"left-bottom\">Left Bottom</option>\n <option value=\"bottom\">Bottom</option>\n <option value=\"right-bottom\">Right Bottom</option>\n </select>\n\n <div class=\"grid-10\">\n <label> <ox-i18n msgid=\"label.offset-x\" auto=\"\">offsetX</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetX\" .value=${value.offsetX} />\n\n <label> <ox-i18n msgid=\"label.offset-y\" auto=\"\">offsetY</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetY\" .value=${value.offsetY} />\n\n <label> <ox-i18n msgid=\"label.width\" auto=\"\">width</ox-i18n> </label>\n <input type=\"number\" value-key=\"width\" .value=${value.width} />\n\n <label> <ox-i18n msgid=\"label.height\" auto=\"\">height</ox-i18n> </label>\n <input type=\"number\" value-key=\"height\" .value=${value.height} />\n </div>\n\n <div class=\"grid-10\">\n <input value-key=\"fitPattern\" type=\"checkbox\" .checked=${value.fitPattern} required />\n <label> <ox-i18n msgid=\"label.fit\" auto=\"\">Fit</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') {\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"]}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import '@operato/i18n/ox-i18n.js';
5
+ import '@operato/input/ox-input-color.js';
6
+ import '@operato/input/ox-input-color-stops.js';
7
+ import '@operato/input/ox-input-color-gradient.js';
8
+ import './ox-input-background-pattern.js';
9
+ import { BackgroundPatternOption } from './ox-input-background-pattern.js';
10
+ import { ColorStop, GradientOption, OxFormField } from '@operato/input';
11
+ import { PropertyValues } from 'lit';
12
+ export declare type FillStyle = {
13
+ type?: 'no' | 'solid' | 'gradient' | 'pattern';
14
+ gradientType?: 'linear' | 'radial';
15
+ colorStops?: ColorStop[];
16
+ rotation?: number;
17
+ center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom';
18
+ image?: HTMLImageElement | string;
19
+ offsetX?: number;
20
+ offsetY?: number;
21
+ width?: number;
22
+ height?: number;
23
+ align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom';
24
+ fitPattern?: boolean;
25
+ } | 'no' | string;
26
+ export declare class OxInputColorStyle extends OxFormField {
27
+ static styles: import("lit").CSSResult;
28
+ value?: FillStyle;
29
+ fillType?: string;
30
+ solid?: string;
31
+ gradient?: GradientOption;
32
+ pattern?: BackgroundPatternOption;
33
+ private _block_reset;
34
+ updated(changes: PropertyValues<this>): void;
35
+ render(): import("lit-html").TemplateResult<1>;
36
+ _onChangedValue(value: FillStyle): Promise<void>;
37
+ _onChangedFillType(e: Event): void;
38
+ _onChangedSolid(e: Event): void;
39
+ _onChandedGradient(e: Event): void;
40
+ _onChangedPattern(e: Event): void;
41
+ }
@@ -0,0 +1,325 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import { __decorate } from "tslib";
5
+ import '@operato/i18n/ox-i18n.js';
6
+ import '@operato/input/ox-input-color.js';
7
+ import '@operato/input/ox-input-color-stops.js';
8
+ import '@operato/input/ox-input-color-gradient.js';
9
+ import './ox-input-background-pattern.js';
10
+ import { OxFormField } from '@operato/input';
11
+ import { css, html } from 'lit';
12
+ import { customElement, property } from 'lit/decorators.js';
13
+ let OxInputColorStyle = class OxInputColorStyle extends OxFormField {
14
+ constructor() {
15
+ super(...arguments);
16
+ this._block_reset = false;
17
+ }
18
+ updated(changes) {
19
+ changes.has('value') && this._onChangedValue(this.value || {});
20
+ }
21
+ render() {
22
+ return html `
23
+ <div @change=${(e) => this._onChangedFillType(e)} fill-type>
24
+ <input
25
+ type="radio"
26
+ id="fill-type-no"
27
+ name="fill-type"
28
+ value="no"
29
+ .checked=${!this.fillType || this.fillType == 'no'}
30
+ />
31
+ <label for="fill-type-no"><ox-i18n msgid="label.no-fill">no fill</ox-i18n></label>
32
+ <input type="radio" id="fill-type-solid" name="fill-type" value="solid" .checked=${this.fillType == 'solid'} />
33
+ <label for="fill-type-solid"><ox-i18n msgid="label.solid">solid</ox-i18n></label>
34
+ <input
35
+ type="radio"
36
+ id="fill-type-gradient"
37
+ name="fill-type"
38
+ value="gradient"
39
+ .checked=${this.fillType == 'gradient'}
40
+ />
41
+ <label for="fill-type-gradient"><ox-i18n msgid="label.gradient">gradient</ox-i18n></label>
42
+ <input
43
+ type="radio"
44
+ id="fill-type-pattern"
45
+ name="fill-type"
46
+ value="pattern"
47
+ .checked=${this.fillType == 'pattern'}
48
+ />
49
+ <label for="fill-type-pattern"><ox-i18n msgid="label.pattern">pattern</ox-i18n></label>
50
+ </div>
51
+
52
+ <div editors>
53
+ <div ?active=${this.fillType == 'no'}></div>
54
+
55
+ <div class="grid-10" ?active=${this.fillType == 'solid'}>
56
+ <label class="icon-only-label color"></label>
57
+ <ox-input-color @change=${(e) => this._onChangedSolid(e)} .value=${this.solid}> </ox-input-color>
58
+ </div>
59
+
60
+ <div ?active=${this.fillType == 'gradient'}>
61
+ <ox-input-color-gradient @change=${(e) => this._onChandedGradient(e)} .value=${this.gradient}>
62
+ </ox-input-color-gradient>
63
+ </div>
64
+
65
+ <div ?active=${this.fillType == 'pattern'}>
66
+ <ox-input-background-pattern @change=${(e) => this._onChangedPattern(e)} .value=${this.pattern}>
67
+ </ox-input-background-pattern>
68
+ </div>
69
+ </div>
70
+ `;
71
+ }
72
+ async _onChangedValue(value) {
73
+ /*
74
+ * this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.
75
+ */
76
+ await this.requestUpdate();
77
+ /* 설정 값에 따라서, 멤버 속성을 설정한다. */
78
+ if (!value) {
79
+ this.fillType = 'no';
80
+ if (!this._block_reset) {
81
+ this.solid = undefined;
82
+ this.gradient = undefined;
83
+ this.pattern = undefined;
84
+ }
85
+ this._block_reset = false;
86
+ return;
87
+ }
88
+ switch (typeof value) {
89
+ case 'string':
90
+ this.fillType = 'solid';
91
+ this.solid = value;
92
+ if (!this._block_reset) {
93
+ this.gradient = undefined;
94
+ this.pattern = undefined;
95
+ }
96
+ break;
97
+ case 'object':
98
+ this.fillType = value.type;
99
+ if (value.type === 'gradient') {
100
+ this.gradient = {
101
+ type: value.gradientType || 'linear',
102
+ colorStops: value.colorStops || [
103
+ {
104
+ position: 0,
105
+ color: this.solid || '#000000'
106
+ },
107
+ {
108
+ position: 1,
109
+ color: this.solid || '#FFFFFF'
110
+ }
111
+ ],
112
+ rotation: Number(value.rotation) || 0,
113
+ center: value.center
114
+ };
115
+ if (!this._block_reset) {
116
+ this.pattern = undefined;
117
+ this.solid = undefined;
118
+ }
119
+ }
120
+ else if (value.type === 'pattern') {
121
+ this.pattern = {
122
+ image: value.image,
123
+ offsetX: Number(value.offsetX) || 0,
124
+ offsetY: Number(value.offsetY) || 0,
125
+ width: Number(value.width),
126
+ height: Number(value.height),
127
+ align: value.align,
128
+ fitPattern: value.fitPattern
129
+ };
130
+ if (!this._block_reset) {
131
+ this.gradient = undefined;
132
+ this.solid = undefined;
133
+ }
134
+ }
135
+ break;
136
+ default:
137
+ }
138
+ this._block_reset = false;
139
+ }
140
+ _onChangedFillType(e) {
141
+ const element = e.target;
142
+ this.fillType = element.value;
143
+ switch (this.fillType) {
144
+ case 'gradient':
145
+ if (!this.gradient) {
146
+ this.gradient = {
147
+ type: 'linear',
148
+ colorStops: [
149
+ {
150
+ position: 0,
151
+ color: this.solid || '#000000'
152
+ },
153
+ {
154
+ position: 1,
155
+ color: this.solid || '#FFFFFF'
156
+ }
157
+ ],
158
+ rotation: 0,
159
+ center: 'center'
160
+ };
161
+ }
162
+ this.value = {
163
+ type: 'gradient',
164
+ gradientType: this.gradient.type || 'linear',
165
+ colorStops: this.gradient.colorStops || [
166
+ {
167
+ position: 0,
168
+ color: this.solid || '#000000'
169
+ },
170
+ {
171
+ position: 1,
172
+ color: this.solid || '#FFFFFF'
173
+ }
174
+ ],
175
+ rotation: Number(this.gradient.rotation) || 0,
176
+ center: this.gradient.center
177
+ };
178
+ break;
179
+ case 'pattern':
180
+ if (!this.pattern)
181
+ this.pattern = {};
182
+ this.value = {
183
+ type: 'pattern',
184
+ image: this.pattern.image,
185
+ offsetX: Number(this.pattern.offsetX) || 0,
186
+ offsetY: Number(this.pattern.offsetY) || 0,
187
+ width: Number(this.pattern.width),
188
+ height: Number(this.pattern.height),
189
+ align: this.pattern.align,
190
+ fitPattern: this.pattern.fitPattern
191
+ };
192
+ break;
193
+ case 'solid':
194
+ if (!this.solid)
195
+ this.solid = '#fff';
196
+ this.value = this.solid;
197
+ break;
198
+ case 'no':
199
+ this.value = '';
200
+ break;
201
+ }
202
+ this._block_reset = true;
203
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
204
+ }
205
+ _onChangedSolid(e) {
206
+ if (this.fillType !== 'solid')
207
+ return;
208
+ this.solid = e.target.value;
209
+ this.value = this.solid;
210
+ this._block_reset = true;
211
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
212
+ }
213
+ _onChandedGradient(e) {
214
+ /*
215
+ * TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.
216
+ * 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.
217
+ */
218
+ if (this.fillType !== 'gradient') {
219
+ return;
220
+ }
221
+ this.gradient = e.target.value;
222
+ this.value = {
223
+ type: 'gradient',
224
+ gradientType: this.gradient.type || 'linear',
225
+ colorStops: this.gradient.colorStops || [
226
+ {
227
+ position: 0,
228
+ color: this.solid || '#000000'
229
+ },
230
+ {
231
+ position: 1,
232
+ color: this.solid || '#FFFFFF'
233
+ }
234
+ ],
235
+ rotation: Number(this.gradient.rotation) || 0,
236
+ center: this.gradient.center
237
+ };
238
+ this._block_reset = true;
239
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
240
+ }
241
+ _onChangedPattern(e) {
242
+ var _a, _b, _c, _d, _e, _f, _g;
243
+ if (this.fillType !== 'pattern')
244
+ return;
245
+ this.pattern = e.target.value;
246
+ this.value = {
247
+ type: 'pattern',
248
+ image: (_a = this.pattern) === null || _a === void 0 ? void 0 : _a.image,
249
+ offsetX: Number((_b = this.pattern) === null || _b === void 0 ? void 0 : _b.offsetX) || 0,
250
+ offsetY: Number((_c = this.pattern) === null || _c === void 0 ? void 0 : _c.offsetY) || 0,
251
+ width: Number((_d = this.pattern) === null || _d === void 0 ? void 0 : _d.width),
252
+ height: Number((_e = this.pattern) === null || _e === void 0 ? void 0 : _e.height),
253
+ align: (_f = this.pattern) === null || _f === void 0 ? void 0 : _f.align,
254
+ fitPattern: (_g = this.pattern) === null || _g === void 0 ? void 0 : _g.fitPattern
255
+ };
256
+ this._block_reset = true;
257
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
258
+ }
259
+ };
260
+ OxInputColorStyle.styles = css `
261
+ :host {
262
+ display: flex;
263
+ flex-direction: column;
264
+ }
265
+
266
+ [fill-type] {
267
+ display: flex;
268
+ margin: 0 0 14px 0;
269
+ }
270
+
271
+ [fill-type] * {
272
+ flex: auto;
273
+ margin: 0;
274
+ text-align: left;
275
+ align-self: center;
276
+ }
277
+
278
+ .grid-10 {
279
+ display: grid;
280
+
281
+ grid-template-columns: repeat(10, 1fr);
282
+ grid-gap: 5px;
283
+ grid-auto-rows: minmax(24px, auto);
284
+ }
285
+
286
+ .grid-10 > ox-input-color {
287
+ grid-column: span 4;
288
+ }
289
+
290
+ .grid-10 > .icon-only-label {
291
+ grid-column: span 1;
292
+
293
+ background: url(/assets/images/icon-properties-label.png) no-repeat;
294
+ float: left;
295
+ margin: 0;
296
+ }
297
+
298
+ .icon-only-label.color {
299
+ background-position: 70% -498px;
300
+ }
301
+
302
+ [editors] > :not([active]) {
303
+ display: none;
304
+ }
305
+ `;
306
+ __decorate([
307
+ property({ type: Object })
308
+ ], OxInputColorStyle.prototype, "value", void 0);
309
+ __decorate([
310
+ property({ type: String })
311
+ ], OxInputColorStyle.prototype, "fillType", void 0);
312
+ __decorate([
313
+ property({ type: String })
314
+ ], OxInputColorStyle.prototype, "solid", void 0);
315
+ __decorate([
316
+ property({ type: Object })
317
+ ], OxInputColorStyle.prototype, "gradient", void 0);
318
+ __decorate([
319
+ property({ type: Object })
320
+ ], OxInputColorStyle.prototype, "pattern", void 0);
321
+ OxInputColorStyle = __decorate([
322
+ customElement('ox-input-fill-style')
323
+ ], OxInputColorStyle);
324
+ export { OxInputColorStyle };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AM,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,CAAC,IAAI,CAAC;YAC3C,KAAK,EAAE,MAAM,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,CAAC;YAClC,MAAM,EAAE,MAAM,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC;YACpC,KAAK,EAAE,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK;YAC1B,UAAU,EAAE,MAAA,IAAI,CAAC,OAAO,0CAAE,UAAU;SACrC,CAAA;QAED,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;QACxB,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;AAnUQ,wBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6ClB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAkC;AApDlD,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAoU7B;SApUY,iBAAiB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/input/ox-input-color.js'\nimport '@operato/input/ox-input-color-stops.js'\nimport '@operato/input/ox-input-color-gradient.js'\nimport './ox-input-background-pattern.js'\n\nimport { BackgroundPatternOption, OxInputBackgroundPattern } from './ox-input-background-pattern.js'\nimport { ColorStop, GradientOption, OxFormField, OxInputColorGradient } from '@operato/input'\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.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 }\n | 'no'\n | string\n\n@customElement('ox-input-fill-style')\nexport class OxInputColorStyle extends OxFormField {\n static styles = 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 .grid-10 {\n display: grid;\n\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n }\n\n .grid-10 > ox-input-color {\n grid-column: span 4;\n }\n\n .grid-10 > .icon-only-label {\n grid-column: span 1;\n\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n float: left;\n margin: 0;\n }\n\n .icon-only-label.color {\n background-position: 70% -498px;\n }\n\n [editors] > :not([active]) {\n display: none;\n }\n `\n\n @property({ type: Object }) value?: FillStyle\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 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 <label for=\"fill-type-gradient\"><ox-i18n msgid=\"label.gradient\">gradient</ox-i18n></label>\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 </div>\n\n <div editors>\n <div ?active=${this.fillType == 'no'}></div>\n\n <div class=\"grid-10\" ?active=${this.fillType == 'solid'}>\n <label class=\"icon-only-label color\"></label>\n <ox-input-color @change=${(e: Event) => this._onChangedSolid(e)} .value=${this.solid}> </ox-input-color>\n </div>\n\n <div ?active=${this.fillType == 'gradient'}>\n <ox-input-color-gradient @change=${(e: Event) => this._onChandedGradient(e)} .value=${this.gradient}>\n </ox-input-color-gradient>\n </div>\n\n <div ?active=${this.fillType == 'pattern'}>\n <ox-input-background-pattern @change=${(e: Event) => this._onChangedPattern(e)} .value=${this.pattern}>\n </ox-input-background-pattern>\n </div>\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 }\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 }\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 }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ import 'codemirror/addon/display/fullscreen';
5
+ import 'codemirror/addon/display/autorefresh';
6
+ import 'codemirror/addon/hint/show-hint';
7
+ import 'codemirror/addon/lint/lint';
8
+ import 'codemirror-graphql/hint';
9
+ import 'codemirror-graphql/lint';
10
+ import 'codemirror-graphql/mode';
11
+ import { LitElement, PropertyValues } from 'lit';
12
+ import CodeMirror from 'codemirror';
13
+ /**
14
+ WEB Component for code-mirror graphql editor.
15
+
16
+ Example:
17
+
18
+ <ox-input-graphql value=${text} link=${link}>
19
+ </ox-input-graphql>
20
+ */
21
+ export default class OxInputGraphql extends LitElement {
22
+ static styles: import("lit").CSSResult[];
23
+ /**
24
+ * `value`는 에디터에서 작성중인 contents이다.
25
+ */
26
+ value?: string;
27
+ link?: string;
28
+ textarea: HTMLTextAreaElement;
29
+ private _self_changing;
30
+ private _changed;
31
+ private _editor?;
32
+ updated(changes: PropertyValues<this>): Promise<void>;
33
+ render(): import("lit-html").TemplateResult<1>;
34
+ getSchema(): Promise<import("graphql").GraphQLSchema>;
35
+ getEditor(): Promise<CodeMirror.EditorFromTextArea | undefined>;
36
+ }