@operato/app 8.0.0-beta.0 → 8.0.0-beta.2
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 +18 -0
- package/package.json +14 -14
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/server.mjs +0 -8
- package/demo/data-grist-test.html +0 -473
- package/demo/index.html +0 -35
- package/src/filter-renderer/filter-resource-select.ts +0 -133
- package/src/filter-renderer/index.ts +0 -6
- package/src/filters-form/filter-resource-code.ts +0 -11
- package/src/filters-form/filter-resource-object.ts +0 -11
- package/src/filters-form/filter-resource-select.ts +0 -130
- package/src/filters-form/index.ts +0 -14
- package/src/filters-form/ox-filter-resource-code.ts +0 -154
- package/src/filters-form/ox-filter-resource-object.ts +0 -224
- package/src/grist-editor/index.ts +0 -26
- package/src/grist-editor/ox-grist-editor-code.ts +0 -64
- package/src/grist-editor/ox-grist-editor-json.ts +0 -64
- package/src/grist-editor/ox-grist-editor-privilege.ts +0 -58
- package/src/grist-editor/ox-grist-editor-resource-code.ts +0 -30
- package/src/grist-editor/ox-grist-editor-resource-id.ts +0 -88
- package/src/grist-editor/ox-grist-editor-resource-object-legacy.ts +0 -131
- package/src/grist-editor/ox-grist-editor-resource-object.ts +0 -156
- package/src/grist-editor/ox-grist-renderer-crontab.ts +0 -18
- package/src/grist-editor/ox-grist-renderer-resource-code.ts +0 -85
- package/src/grist-editor/ox-grist-renderer-resource-id.ts +0 -17
- package/src/grist-editor/ox-grist-renderer-resource-object.ts +0 -26
- package/src/grist-editor/ox-popup-code-input.ts +0 -69
- package/src/grist-editor/ox-popup-privilege-input.ts +0 -93
- package/src/index.ts +0 -4
- package/src/input/index.ts +0 -3
- package/src/input/ox-input-background-pattern.ts +0 -196
- package/src/input/ox-input-fill-style.ts +0 -377
- package/src/input/ox-input-graphql.ts +0 -153
- package/src/property-editor/index.ts +0 -83
- package/src/property-editor/ox-property-editor-graphql.ts +0 -22
- package/src/property-editor/ox-property-editor-resource-object.ts +0 -148
- package/src/selector/ox-selector-resource-id.ts +0 -201
- package/src/selector/ox-selector-resource-object-legacy.ts +0 -367
- package/src/selector/ox-selector-resource-object.ts +0 -300
- package/stories/graphql-client.stories.ts +0 -73
- package/stories/ox-input-graphql.stories.ts +0 -70
- package/stories/ox-selector-resource-object.stories.ts +0 -98
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
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
|
-
|
|
11
|
-
import { css, html, PropertyValues } from 'lit'
|
|
12
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
13
|
-
|
|
14
|
-
import { ColorStop, GradientOption, OxFormField, OxInputColorGradient } from '@operato/input'
|
|
15
|
-
|
|
16
|
-
import { BackgroundPatternOption, OxInputBackgroundPattern } from './ox-input-background-pattern.js'
|
|
17
|
-
|
|
18
|
-
export type FillStyle =
|
|
19
|
-
| {
|
|
20
|
-
type?: 'no' | 'solid' | 'gradient' | 'pattern'
|
|
21
|
-
gradientType?: 'linear' | 'radial'
|
|
22
|
-
colorStops?: ColorStop[]
|
|
23
|
-
rotation?: number
|
|
24
|
-
center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'
|
|
25
|
-
image?: HTMLImageElement | string
|
|
26
|
-
offsetX?: number
|
|
27
|
-
offsetY?: number
|
|
28
|
-
width?: number
|
|
29
|
-
height?: number
|
|
30
|
-
align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'
|
|
31
|
-
fitPattern?: boolean
|
|
32
|
-
noRepeat?: boolean
|
|
33
|
-
color?: string
|
|
34
|
-
}
|
|
35
|
-
| 'no'
|
|
36
|
-
| string
|
|
37
|
-
|
|
38
|
-
@customElement('ox-input-fill-style')
|
|
39
|
-
export class OxInputColorStyle extends OxFormField {
|
|
40
|
-
static styles = css`
|
|
41
|
-
:host {
|
|
42
|
-
display: flex;
|
|
43
|
-
flex-direction: column;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
[fill-type] {
|
|
47
|
-
display: flex;
|
|
48
|
-
margin: 0 0 14px 0;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
[fill-type] * {
|
|
52
|
-
flex: auto;
|
|
53
|
-
margin: 0;
|
|
54
|
-
text-align: left;
|
|
55
|
-
align-self: center;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.grid-10 {
|
|
59
|
-
display: grid;
|
|
60
|
-
|
|
61
|
-
grid-template-columns: repeat(10, 1fr);
|
|
62
|
-
grid-gap: 5px;
|
|
63
|
-
grid-auto-rows: minmax(24px, auto);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.grid-10 > ox-input-color {
|
|
67
|
-
grid-column: span 4;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.grid-10 > .icon-only-label {
|
|
71
|
-
grid-column: span 1;
|
|
72
|
-
|
|
73
|
-
background: var(--url-icon-properties-label) no-repeat;
|
|
74
|
-
float: left;
|
|
75
|
-
margin: 0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.icon-only-label.color {
|
|
79
|
-
background-position: 100% -500px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
[editors] > :not([active]) {
|
|
83
|
-
display: none;
|
|
84
|
-
}
|
|
85
|
-
`
|
|
86
|
-
|
|
87
|
-
@property({ type: Object }) value?: FillStyle
|
|
88
|
-
@property({ type: String }) fillType?: string
|
|
89
|
-
@property({ type: String }) solid?: string
|
|
90
|
-
@property({ type: Object }) gradient?: GradientOption
|
|
91
|
-
@property({ type: Object }) pattern?: BackgroundPatternOption
|
|
92
|
-
|
|
93
|
-
@property({ type: Boolean, attribute: 'color-only' }) colorOnly: boolean = false
|
|
94
|
-
|
|
95
|
-
private _block_reset: boolean = false
|
|
96
|
-
|
|
97
|
-
updated(changes: PropertyValues<this>) {
|
|
98
|
-
changes.has('value') && this._onChangedValue(this.value || {})
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
render() {
|
|
102
|
-
return html`
|
|
103
|
-
<div @change=${(e: Event) => this._onChangedFillType(e)} fill-type>
|
|
104
|
-
<input
|
|
105
|
-
type="radio"
|
|
106
|
-
id="fill-type-no"
|
|
107
|
-
name="fill-type"
|
|
108
|
-
value="no"
|
|
109
|
-
.checked=${!this.fillType || this.fillType == 'no'}
|
|
110
|
-
/>
|
|
111
|
-
<label for="fill-type-no"><ox-i18n msgid="label.no-fill">no fill</ox-i18n></label>
|
|
112
|
-
<input type="radio" id="fill-type-solid" name="fill-type" value="solid" .checked=${this.fillType == 'solid'} />
|
|
113
|
-
<label for="fill-type-solid"><ox-i18n msgid="label.solid">solid</ox-i18n></label>
|
|
114
|
-
<input
|
|
115
|
-
type="radio"
|
|
116
|
-
id="fill-type-gradient"
|
|
117
|
-
name="fill-type"
|
|
118
|
-
value="gradient"
|
|
119
|
-
.checked=${this.fillType == 'gradient'}
|
|
120
|
-
/>
|
|
121
|
-
|
|
122
|
-
<label for="fill-type-gradient"><ox-i18n msgid="label.gradient">gradient</ox-i18n></label>
|
|
123
|
-
|
|
124
|
-
${this.colorOnly
|
|
125
|
-
? html``
|
|
126
|
-
: html`
|
|
127
|
-
<input
|
|
128
|
-
type="radio"
|
|
129
|
-
id="fill-type-pattern"
|
|
130
|
-
name="fill-type"
|
|
131
|
-
value="pattern"
|
|
132
|
-
.checked=${this.fillType == 'pattern'}
|
|
133
|
-
/>
|
|
134
|
-
<label for="fill-type-pattern"><ox-i18n msgid="label.pattern">pattern</ox-i18n></label>
|
|
135
|
-
`}
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<div editors>
|
|
139
|
-
<div ?active=${this.fillType == 'no'}></div>
|
|
140
|
-
|
|
141
|
-
<div class="grid-10" ?active=${this.fillType == 'solid'}>
|
|
142
|
-
<label class="icon-only-label color"></label>
|
|
143
|
-
<ox-input-color @change=${(e: Event) => this._onChangedSolid(e)} .value=${this.solid}> </ox-input-color>
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<div ?active=${this.fillType == 'gradient'}>
|
|
147
|
-
<ox-input-color-gradient @change=${(e: Event) => this._onChandedGradient(e)} .value=${this.gradient}>
|
|
148
|
-
</ox-input-color-gradient>
|
|
149
|
-
</div>
|
|
150
|
-
|
|
151
|
-
<div ?active=${this.fillType == 'pattern'}>
|
|
152
|
-
<ox-input-background-pattern @change=${(e: Event) => this._onChangedPattern(e)} .value=${this.pattern}>
|
|
153
|
-
</ox-input-background-pattern>
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
`
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
async _onChangedValue(value: FillStyle) {
|
|
160
|
-
/*
|
|
161
|
-
* this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.
|
|
162
|
-
*/
|
|
163
|
-
await this.requestUpdate()
|
|
164
|
-
|
|
165
|
-
/* 설정 값에 따라서, 멤버 속성을 설정한다. */
|
|
166
|
-
if (!value) {
|
|
167
|
-
this.fillType = 'no'
|
|
168
|
-
|
|
169
|
-
if (!this._block_reset) {
|
|
170
|
-
this.solid = undefined
|
|
171
|
-
this.gradient = undefined
|
|
172
|
-
this.pattern = undefined
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
this._block_reset = false
|
|
176
|
-
return
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
switch (typeof value) {
|
|
180
|
-
case 'string':
|
|
181
|
-
this.fillType = 'solid'
|
|
182
|
-
this.solid = value
|
|
183
|
-
|
|
184
|
-
if (!this._block_reset) {
|
|
185
|
-
this.gradient = undefined
|
|
186
|
-
this.pattern = undefined
|
|
187
|
-
}
|
|
188
|
-
break
|
|
189
|
-
case 'object':
|
|
190
|
-
this.fillType = value.type
|
|
191
|
-
|
|
192
|
-
if (value.type === 'gradient') {
|
|
193
|
-
this.gradient = {
|
|
194
|
-
type: value.gradientType || 'linear',
|
|
195
|
-
colorStops: value.colorStops || [
|
|
196
|
-
{
|
|
197
|
-
position: 0,
|
|
198
|
-
color: this.solid || '#000000'
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
position: 1,
|
|
202
|
-
color: this.solid || '#FFFFFF'
|
|
203
|
-
}
|
|
204
|
-
],
|
|
205
|
-
rotation: Number(value.rotation) || 0,
|
|
206
|
-
center: value.center
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (!this._block_reset) {
|
|
210
|
-
this.pattern = undefined
|
|
211
|
-
this.solid = undefined
|
|
212
|
-
}
|
|
213
|
-
} else if (value.type === 'pattern') {
|
|
214
|
-
this.pattern = {
|
|
215
|
-
image: value.image,
|
|
216
|
-
offsetX: Number(value.offsetX) || 0,
|
|
217
|
-
offsetY: Number(value.offsetY) || 0,
|
|
218
|
-
width: Number(value.width),
|
|
219
|
-
height: Number(value.height),
|
|
220
|
-
align: value.align,
|
|
221
|
-
fitPattern: value.fitPattern,
|
|
222
|
-
noRepeat: value.noRepeat,
|
|
223
|
-
color: value.color
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (!this._block_reset) {
|
|
227
|
-
this.gradient = undefined
|
|
228
|
-
this.solid = undefined
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
break
|
|
233
|
-
default:
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
this._block_reset = false
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
_onChangedFillType(e: Event) {
|
|
240
|
-
const element = e.target as HTMLInputElement
|
|
241
|
-
this.fillType = element.value
|
|
242
|
-
|
|
243
|
-
switch (this.fillType) {
|
|
244
|
-
case 'gradient':
|
|
245
|
-
if (!this.gradient) {
|
|
246
|
-
this.gradient = {
|
|
247
|
-
type: 'linear',
|
|
248
|
-
colorStops: [
|
|
249
|
-
{
|
|
250
|
-
position: 0,
|
|
251
|
-
color: this.solid || '#000000'
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
position: 1,
|
|
255
|
-
color: this.solid || '#FFFFFF'
|
|
256
|
-
}
|
|
257
|
-
],
|
|
258
|
-
rotation: 0,
|
|
259
|
-
center: 'center'
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
this.value = {
|
|
264
|
-
type: 'gradient',
|
|
265
|
-
gradientType: this.gradient.type || 'linear',
|
|
266
|
-
colorStops: this.gradient.colorStops || [
|
|
267
|
-
{
|
|
268
|
-
position: 0,
|
|
269
|
-
color: this.solid || '#000000'
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
position: 1,
|
|
273
|
-
color: this.solid || '#FFFFFF'
|
|
274
|
-
}
|
|
275
|
-
],
|
|
276
|
-
rotation: Number(this.gradient.rotation) || 0,
|
|
277
|
-
center: this.gradient.center
|
|
278
|
-
}
|
|
279
|
-
break
|
|
280
|
-
|
|
281
|
-
case 'pattern':
|
|
282
|
-
if (!this.pattern) this.pattern = {}
|
|
283
|
-
|
|
284
|
-
this.value = {
|
|
285
|
-
type: 'pattern',
|
|
286
|
-
image: this.pattern.image,
|
|
287
|
-
offsetX: Number(this.pattern.offsetX) || 0,
|
|
288
|
-
offsetY: Number(this.pattern.offsetY) || 0,
|
|
289
|
-
width: Number(this.pattern.width),
|
|
290
|
-
height: Number(this.pattern.height),
|
|
291
|
-
align: this.pattern.align,
|
|
292
|
-
fitPattern: this.pattern.fitPattern,
|
|
293
|
-
noRepeat: this.pattern.noRepeat,
|
|
294
|
-
color: this.pattern.color
|
|
295
|
-
}
|
|
296
|
-
break
|
|
297
|
-
|
|
298
|
-
case 'solid':
|
|
299
|
-
if (!this.solid) this.solid = '#fff'
|
|
300
|
-
this.value = this.solid
|
|
301
|
-
break
|
|
302
|
-
|
|
303
|
-
case 'no':
|
|
304
|
-
this.value = ''
|
|
305
|
-
break
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
this._block_reset = true
|
|
309
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
_onChangedSolid(e: Event) {
|
|
313
|
-
if (this.fillType !== 'solid') return
|
|
314
|
-
|
|
315
|
-
this.solid = (e.target as HTMLInputElement).value
|
|
316
|
-
|
|
317
|
-
this.value = this.solid
|
|
318
|
-
|
|
319
|
-
this._block_reset = true
|
|
320
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
_onChandedGradient(e: Event) {
|
|
324
|
-
/*
|
|
325
|
-
* TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.
|
|
326
|
-
* 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.
|
|
327
|
-
*/
|
|
328
|
-
|
|
329
|
-
if (this.fillType !== 'gradient') {
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
this.gradient = (e.target as OxInputColorGradient).value
|
|
334
|
-
|
|
335
|
-
this.value = {
|
|
336
|
-
type: 'gradient',
|
|
337
|
-
gradientType: this.gradient.type || 'linear',
|
|
338
|
-
colorStops: this.gradient.colorStops || [
|
|
339
|
-
{
|
|
340
|
-
position: 0,
|
|
341
|
-
color: this.solid || '#000000'
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
position: 1,
|
|
345
|
-
color: this.solid || '#FFFFFF'
|
|
346
|
-
}
|
|
347
|
-
],
|
|
348
|
-
rotation: Number(this.gradient.rotation) || 0,
|
|
349
|
-
center: this.gradient.center
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
this._block_reset = true
|
|
353
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
_onChangedPattern(e: Event) {
|
|
357
|
-
if (this.fillType !== 'pattern') return
|
|
358
|
-
|
|
359
|
-
this.pattern = (e.target as OxInputBackgroundPattern).value
|
|
360
|
-
|
|
361
|
-
this.value = {
|
|
362
|
-
type: 'pattern',
|
|
363
|
-
image: this.pattern?.image,
|
|
364
|
-
offsetX: Number(this.pattern?.offsetX) || 0,
|
|
365
|
-
offsetY: Number(this.pattern?.offsetY) || 0,
|
|
366
|
-
width: Number(this.pattern?.width),
|
|
367
|
-
height: Number(this.pattern?.height),
|
|
368
|
-
align: this.pattern?.align,
|
|
369
|
-
fitPattern: this.pattern?.fitPattern,
|
|
370
|
-
noRepeat: this.pattern?.noRepeat,
|
|
371
|
-
color: this.pattern?.color
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
this._block_reset = true
|
|
375
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
376
|
-
}
|
|
377
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { print } from 'graphql'
|
|
6
|
-
import { css, html, PropertyValues } from 'lit'
|
|
7
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
8
|
-
import { graphql } from 'cm6-graphql'
|
|
9
|
-
|
|
10
|
-
import { history, historyKeymap, indentWithTab } from '@codemirror/commands'
|
|
11
|
-
import { autocompletion, closeBrackets } from '@codemirror/autocomplete'
|
|
12
|
-
import { bracketMatching, syntaxHighlighting } from '@codemirror/language'
|
|
13
|
-
import { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark'
|
|
14
|
-
import { EditorView, highlightActiveLine, keymap, lineNumbers } from '@codemirror/view'
|
|
15
|
-
|
|
16
|
-
import { introspectSchema, wrapSchema } from '@graphql-tools/wrap'
|
|
17
|
-
import { GRAPHQL_URI } from '@operato/graphql'
|
|
18
|
-
import { OxFormField } from '@operato/input'
|
|
19
|
-
import { togglefullscreen } from '@operato/utils'
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
WEB Component for code-mirror graphql editor.
|
|
23
|
-
|
|
24
|
-
Example:
|
|
25
|
-
|
|
26
|
-
<ox-input-graphql value=${text} link=${link}>
|
|
27
|
-
</ox-input-graphql>
|
|
28
|
-
*/
|
|
29
|
-
@customElement('ox-input-graphql')
|
|
30
|
-
export default class OxInputGraphql extends OxFormField {
|
|
31
|
-
static styles = [
|
|
32
|
-
css`
|
|
33
|
-
:host {
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
36
|
-
position: relative;
|
|
37
|
-
background: white;
|
|
38
|
-
overflow: auto;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.cm-editor {
|
|
42
|
-
flex: 1;
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* `value`는 에디터에서 작성중인 contents이다.
|
|
49
|
-
*/
|
|
50
|
-
@property({ type: String }) value?: string
|
|
51
|
-
@property({ type: String }) link?: string
|
|
52
|
-
@property({ type: Boolean, attribute: 'show-line-numbers' }) showLineNumbers: boolean = false
|
|
53
|
-
|
|
54
|
-
private _self_changing: boolean = false
|
|
55
|
-
private _editor?: EditorView
|
|
56
|
-
private _changed: boolean = false
|
|
57
|
-
|
|
58
|
-
async updated(changes: PropertyValues<this>) {
|
|
59
|
-
const editor = await this.getEditor()
|
|
60
|
-
if (changes.has('value') && editor && !this._self_changing) {
|
|
61
|
-
const to = editor.state.doc.toString().length
|
|
62
|
-
editor.dispatch({
|
|
63
|
-
changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async getSchema() {
|
|
69
|
-
const executor = async ({ document, variables }: any) => {
|
|
70
|
-
const query = print(document)
|
|
71
|
-
const uri = this.link || GRAPHQL_URI
|
|
72
|
-
|
|
73
|
-
const fetchResult = await fetch(uri, {
|
|
74
|
-
method: 'POST',
|
|
75
|
-
headers: {
|
|
76
|
-
'Content-Type': 'application/json'
|
|
77
|
-
},
|
|
78
|
-
body: JSON.stringify({ query, variables })
|
|
79
|
-
})
|
|
80
|
-
return fetchResult.json()
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return await wrapSchema({
|
|
84
|
-
schema: await introspectSchema(executor),
|
|
85
|
-
executor
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async getEditor() {
|
|
90
|
-
if (!this._editor) {
|
|
91
|
-
var schema
|
|
92
|
-
try {
|
|
93
|
-
schema = await this.getSchema()
|
|
94
|
-
} catch (err) {
|
|
95
|
-
console.error(err)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
this._editor = new EditorView({
|
|
99
|
-
doc: this.value,
|
|
100
|
-
extensions: [
|
|
101
|
-
...(this.showLineNumbers ? [lineNumbers()] : []),
|
|
102
|
-
bracketMatching(),
|
|
103
|
-
closeBrackets(),
|
|
104
|
-
history(),
|
|
105
|
-
autocompletion(),
|
|
106
|
-
oneDark,
|
|
107
|
-
syntaxHighlighting(oneDarkHighlightStyle),
|
|
108
|
-
graphql(schema, {
|
|
109
|
-
onShowInDocs(field, type, parentType) {
|
|
110
|
-
alert(`Showing in docs.: Field: ${field}, Type: ${type}, ParentType: ${parentType}`)
|
|
111
|
-
},
|
|
112
|
-
onFillAllFields(view, schema, _query, cursor, token) {
|
|
113
|
-
alert(`Filling all fields. Token: ${token}`)
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
|
-
highlightActiveLine(),
|
|
117
|
-
history(),
|
|
118
|
-
keymap.of([...historyKeymap, indentWithTab]),
|
|
119
|
-
EditorView.updateListener.of(async v => {
|
|
120
|
-
if (v.docChanged) {
|
|
121
|
-
this._self_changing = true
|
|
122
|
-
this._changed = true
|
|
123
|
-
|
|
124
|
-
await this.updateComplete
|
|
125
|
-
|
|
126
|
-
this._self_changing = false
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
],
|
|
130
|
-
parent: this.renderRoot
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
this._editor.contentDOM.addEventListener('keydown', event => {
|
|
135
|
-
event.stopPropagation()
|
|
136
|
-
|
|
137
|
-
if (event.key === 'Escape') {
|
|
138
|
-
togglefullscreen(this._editor!.contentDOM)
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
this._editor.contentDOM.addEventListener('blur', e => {
|
|
143
|
-
if (!this._changed) {
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
this.value = this._editor!.state.doc.toString()
|
|
148
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
return this._editor
|
|
152
|
-
}
|
|
153
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import '@operato/property-editor/ox-property-editor-3axis.js'
|
|
2
|
-
import '@operato/property-editor/ox-property-editor-3dish.js'
|
|
3
|
-
import '@operato/property-editor/ox-property-editor-legend.js'
|
|
4
|
-
import '@operato/property-editor/ox-property-editor-number.js'
|
|
5
|
-
import '@operato/property-editor/ox-property-editor-unit-number.js'
|
|
6
|
-
import '@operato/property-editor/ox-property-editor-password.js'
|
|
7
|
-
import '@operato/property-editor/ox-property-editor-action.js'
|
|
8
|
-
import '@operato/property-editor/ox-property-editor-angle.js'
|
|
9
|
-
import '@operato/property-editor/ox-property-editor-string.js'
|
|
10
|
-
import '@operato/property-editor/ox-property-editor-data.js'
|
|
11
|
-
import '@operato/property-editor/ox-property-editor-date.js'
|
|
12
|
-
import '@operato/property-editor/ox-property-editor-month.js'
|
|
13
|
-
import '@operato/property-editor/ox-property-editor-time.js'
|
|
14
|
-
import '@operato/property-editor/ox-property-editor-datetime.js'
|
|
15
|
-
import '@operato/property-editor/ox-property-editor-checkbox.js'
|
|
16
|
-
import '@operato/property-editor/ox-property-editor-options.js'
|
|
17
|
-
import '@operato/property-editor/ox-property-editor-select.js'
|
|
18
|
-
import '@operato/property-editor/ox-property-editor-scene-component-id.js'
|
|
19
|
-
import '@operato/property-editor/ox-property-editor-color.js'
|
|
20
|
-
import '@operato/property-editor/ox-property-editor-multiple-colors.js'
|
|
21
|
-
import '@operato/property-editor/ox-property-editor-solid-colorstops.js'
|
|
22
|
-
import '@operato/property-editor/ox-property-editor-gradient-colorstops.js'
|
|
23
|
-
import '@operato/property-editor/ox-property-editor-textarea.js'
|
|
24
|
-
import '@operato/property-editor/ox-property-editor-table.js'
|
|
25
|
-
import '@operato/property-editor/ox-property-editor-key-values.js'
|
|
26
|
-
import '@operato/property-editor/ox-property-editor-partition-keys.js'
|
|
27
|
-
import '@operato/property-editor/ox-property-editor-value-map.js'
|
|
28
|
-
import '@operato/property-editor/ox-property-editor-value-ranges.js'
|
|
29
|
-
import '@operato/property-editor/ox-property-editor-hashtags.js'
|
|
30
|
-
import '@operato/property-editor/ox-property-editor-image.js'
|
|
31
|
-
import '@operato/property-editor/ox-property-editor-file.js'
|
|
32
|
-
import '@operato/attachment/ox-property-editor-attachment-selector.js'
|
|
33
|
-
import '@operato/attachment/ox-property-editor-image-selector.js'
|
|
34
|
-
import '@operato/font/ox-property-editor-font-selector.js'
|
|
35
|
-
import './ox-property-editor-graphql.js'
|
|
36
|
-
import './ox-property-editor-resource-object.js'
|
|
37
|
-
|
|
38
|
-
import { OxPropertyEditor } from '@operato/property-editor'
|
|
39
|
-
|
|
40
|
-
OxPropertyEditor.register({
|
|
41
|
-
'3axis': 'ox-property-editor-3axis',
|
|
42
|
-
'3dish': 'ox-property-editor-3dish',
|
|
43
|
-
legend: 'ox-property-editor-legend',
|
|
44
|
-
number: 'ox-property-editor-number',
|
|
45
|
-
'unit-number': 'ox-property-editor-unit-number',
|
|
46
|
-
slider: 'ox-property-editor-range',
|
|
47
|
-
password: 'ox-property-editor-password',
|
|
48
|
-
action: 'ox-property-editor-action',
|
|
49
|
-
angle: 'ox-property-editor-angle',
|
|
50
|
-
string: 'ox-property-editor-string',
|
|
51
|
-
textarea: 'ox-property-editor-textarea',
|
|
52
|
-
javascript: 'ox-property-editor-textarea',
|
|
53
|
-
script: 'ox-property-editor-textarea',
|
|
54
|
-
checkbox: 'ox-property-editor-checkbox',
|
|
55
|
-
boolean: 'ox-property-editor-checkbox',
|
|
56
|
-
select: 'ox-property-editor-select',
|
|
57
|
-
date: 'ox-property-editor-date',
|
|
58
|
-
month: 'ox-property-editor-month',
|
|
59
|
-
datetime: 'ox-property-editor-datetime',
|
|
60
|
-
time: 'ox-property-editor-time',
|
|
61
|
-
options: 'ox-property-editor-options',
|
|
62
|
-
data: 'ox-property-editor-data',
|
|
63
|
-
file: 'ox-property-editor-file',
|
|
64
|
-
image: 'ox-property-editor-image',
|
|
65
|
-
'range-input': 'ox-property-editor-range',
|
|
66
|
-
'attachment-selector': 'ox-property-editor-attachment-selector',
|
|
67
|
-
'gltf-selector': 'ox-property-editor-attachment-selector',
|
|
68
|
-
'image-selector': 'ox-property-editor-image-selector',
|
|
69
|
-
color: 'ox-property-editor-color',
|
|
70
|
-
'solid-color-stops': 'ox-property-editor-solid-colorstops',
|
|
71
|
-
'gradient-color-stops': 'ox-property-editor-gradient-colorstops',
|
|
72
|
-
'multiple-color': 'ox-property-editor-multiple-colors',
|
|
73
|
-
map: 'ox-property-editor-value-map',
|
|
74
|
-
range: 'ox-property-editor-value-ranges',
|
|
75
|
-
graphql: 'ox-property-editor-graphql',
|
|
76
|
-
'editor-table': 'ox-property-editor-table',
|
|
77
|
-
'id-input': 'ox-property-editor-scene-component-id',
|
|
78
|
-
'font-selector': 'ox-property-editor-font-selector',
|
|
79
|
-
'partition-keys': 'ox-property-editor-partion-keys',
|
|
80
|
-
'key-values': 'ox-property-editor-key-values',
|
|
81
|
-
hashtags: 'ox-property-editor-hashtags',
|
|
82
|
-
'resource-object': 'ox-property-editor-resource-object'
|
|
83
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import '../input/ox-input-graphql.js'
|
|
2
|
-
|
|
3
|
-
import { css, html, TemplateResult } from 'lit'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
|
|
7
|
-
|
|
8
|
-
@customElement('ox-property-editor-graphql')
|
|
9
|
-
export class OxPropertyEditorGraphQL extends OxPropertyEditor {
|
|
10
|
-
static styles = [
|
|
11
|
-
...OxPropertyEditor.styles,
|
|
12
|
-
css`
|
|
13
|
-
:host {
|
|
14
|
-
grid-template-rows: auto 1fr;
|
|
15
|
-
}
|
|
16
|
-
`
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
editorTemplate(value: any, spec: PropertySpec): TemplateResult {
|
|
20
|
-
return html` <ox-input-graphql class="multiline-input" id="editor" .value=${value} fullwidth> </ox-input-graphql> `
|
|
21
|
-
}
|
|
22
|
-
}
|