@operato/app 1.1.75 → 1.1.76

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 (53) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/src/filter-renderer/filter-resource-select.d.ts +1 -1
  3. package/dist/src/filter-renderer/filter-resource-select.js +1 -1
  4. package/dist/src/filter-renderer/filter-resource-select.js.map +1 -1
  5. package/dist/src/filters-form/filter-resource-select.d.ts +1 -1
  6. package/dist/src/filters-form/filter-resource-select.js +1 -1
  7. package/dist/src/filters-form/filter-resource-select.js.map +1 -1
  8. package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +1 -1
  9. package/dist/src/grist-editor/ox-grist-editor-resource-id.js +1 -1
  10. package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -1
  11. package/dist/src/grist-editor/ox-grist-editor-resource-object-legacy.d.ts +1 -1
  12. package/dist/src/grist-editor/ox-grist-editor-resource-object-legacy.js +1 -1
  13. package/dist/src/grist-editor/ox-grist-editor-resource-object-legacy.js.map +1 -1
  14. package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +1 -1
  15. package/dist/src/grist-editor/ox-grist-editor-resource-object.js +1 -1
  16. package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -1
  17. package/dist/src/property-editor/index.d.ts +1 -0
  18. package/dist/src/property-editor/index.js +3 -1
  19. package/dist/src/property-editor/index.js.map +1 -1
  20. package/dist/src/property-editor/ox-property-editor-graphql.d.ts +2 -1
  21. package/dist/src/property-editor/ox-property-editor-graphql.js.map +1 -1
  22. package/dist/src/property-editor/ox-property-editor-resource-object.d.ts +11 -0
  23. package/dist/src/property-editor/ox-property-editor-resource-object.js +107 -0
  24. package/dist/src/property-editor/ox-property-editor-resource-object.js.map +1 -0
  25. package/dist/src/{grist-editor → selector}/ox-selector-resource-id.d.ts +0 -0
  26. package/dist/src/{grist-editor → selector}/ox-selector-resource-id.js +0 -0
  27. package/dist/src/selector/ox-selector-resource-id.js.map +1 -0
  28. package/dist/src/{grist-editor → selector}/ox-selector-resource-object-legacy.d.ts +0 -0
  29. package/dist/src/{grist-editor → selector}/ox-selector-resource-object-legacy.js +0 -0
  30. package/dist/src/selector/ox-selector-resource-object-legacy.js.map +1 -0
  31. package/dist/src/{grist-editor → selector}/ox-selector-resource-object.d.ts +0 -0
  32. package/dist/src/{grist-editor → selector}/ox-selector-resource-object.js +0 -0
  33. package/dist/src/selector/ox-selector-resource-object.js.map +1 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +17 -13
  36. package/src/filter-renderer/filter-resource-select.ts +1 -1
  37. package/src/filters-form/filter-resource-select.ts +1 -1
  38. package/src/grist-editor/ox-grist-editor-resource-id.ts +1 -1
  39. package/src/grist-editor/ox-grist-editor-resource-object-legacy.ts +1 -1
  40. package/src/grist-editor/ox-grist-editor-resource-object.ts +1 -1
  41. package/src/property-editor/index.ts +3 -1
  42. package/src/property-editor/ox-property-editor-graphql.ts +2 -2
  43. package/src/property-editor/ox-property-editor-resource-object.ts +131 -0
  44. package/src/{grist-editor → selector}/ox-selector-resource-id.ts +0 -0
  45. package/src/{grist-editor → selector}/ox-selector-resource-object-legacy.ts +0 -0
  46. package/src/{grist-editor → selector}/ox-selector-resource-object.ts +0 -0
  47. package/dist/src/grist-editor/ox-selector-resource-id.js.map +0 -1
  48. package/dist/src/grist-editor/ox-selector-resource-object-legacy.js.map +0 -1
  49. package/dist/src/grist-editor/ox-selector-resource-object.js.map +0 -1
  50. package/dist/src/input/ox-input-resource.d.ts +0 -36
  51. package/dist/src/input/ox-input-resource.js +0 -161
  52. package/dist/src/input/ox-input-resource.js.map +0 -1
  53. package/src/input/ox-input-resource.ts +0 -169
@@ -1,169 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import 'codemirror/addon/display/fullscreen'
6
- import 'codemirror/addon/display/autorefresh'
7
- import 'codemirror/addon/hint/show-hint'
8
- import 'codemirror/addon/lint/lint'
9
- import 'codemirror-graphql/hint'
10
- import 'codemirror-graphql/lint'
11
- import 'codemirror-graphql/mode'
12
-
13
- import { GRAPHQL_URI, client } from '@operato/graphql'
14
- import { LitElement, PropertyValues, css, html, unsafeCSS } from 'lit'
15
- import { customElement, property, query } from 'lit/decorators.js'
16
- import { introspectSchema, wrapSchema } from '@graphql-tools/wrap'
17
-
18
- import CodeMirror from 'codemirror'
19
- import CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css'
20
- import FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css'
21
- import LintStyle from '!!text-loader!codemirror/addon/lint/lint.css'
22
- import NightThemeStyle from '!!text-loader!codemirror/theme/night.css'
23
- import ShowHintStyle from '!!text-loader!codemirror/addon/hint/show-hint.css'
24
- import { fetch } from 'cross-fetch'
25
- import { print } from 'graphql'
26
-
27
- /**
28
- WEB Component for code-mirror graphql editor.
29
-
30
- Example:
31
-
32
- <ox-input-graphql value=${text} link=${link}>
33
- </ox-input-graphql>
34
- */
35
- @customElement('ox-input-graphql')
36
- export default class OxInputGraphql extends LitElement {
37
- static styles = [
38
- css`
39
- ${unsafeCSS(CodeMirrorStyle)}
40
- ${unsafeCSS(FullScreenStyle)}
41
- ${unsafeCSS(NightThemeStyle)}
42
- ${unsafeCSS(LintStyle)}
43
- ${unsafeCSS(ShowHintStyle)}
44
- `,
45
- css`
46
- :host {
47
- display: block;
48
- position: relative;
49
- }
50
-
51
- textarea {
52
- display: block;
53
- height: 100%;
54
- width: 100%;
55
- resize: none;
56
- font-size: 16px;
57
- line-height: 20px;
58
- border: 0px;
59
- padding: 0px;
60
- }
61
- `
62
- ]
63
-
64
- /**
65
- * `value`는 에디터에서 작성중인 contents이다.
66
- */
67
- @property({ type: String }) value?: string
68
- @property({ type: String }) link?: string
69
-
70
- @query('textarea') textarea!: HTMLTextAreaElement
71
-
72
- private _self_changing: boolean = false
73
- private _changed: boolean = false
74
- private _editor?: CodeMirror.EditorFromTextArea
75
-
76
- async updated(changes: PropertyValues<this>) {
77
- if ((!this._editor || changes.has('value') || changes.has('link')) && !this._self_changing) {
78
- if (changes.has('link')) {
79
- this._editor = undefined
80
- }
81
- ;(await this.getEditor())!.setValue(this.value === undefined ? '' : String(this.value))
82
- // ;(await this.getEditor()).refresh()
83
- }
84
- }
85
-
86
- render() {
87
- return html` <textarea></textarea> `
88
- }
89
-
90
- async getSchema() {
91
- const executor = async ({ document, variables }: any) => {
92
- const query = print(document)
93
- const uri = this.link || GRAPHQL_URI
94
-
95
- const fetchResult = await fetch(uri, {
96
- method: 'POST',
97
- headers: {
98
- 'Content-Type': 'application/json'
99
- },
100
- body: JSON.stringify({ query, variables })
101
- })
102
- return fetchResult.json()
103
- }
104
-
105
- return await wrapSchema({
106
- schema: await introspectSchema(executor),
107
- executor
108
- })
109
- }
110
-
111
- async getEditor() {
112
- if (!this._editor) {
113
- try {
114
- var schema = await this.getSchema()
115
- } catch (err) {
116
- console.error(err)
117
- }
118
-
119
- if (this.textarea) {
120
- this._editor = CodeMirror.fromTextArea(this.textarea, {
121
- value: this.value,
122
- mode: 'graphql',
123
- lint: {
124
- //@ts-ignore
125
- schema
126
- },
127
- hintOptions: {
128
- //@ts-ignore
129
- schema
130
- },
131
- tabSize: 2,
132
- lineNumbers: false,
133
- showCursorWhenSelecting: true,
134
- theme: 'night',
135
- extraKeys: {
136
- F11: function (cm) {
137
- cm.setOption('fullScreen', !cm.getOption('fullScreen'))
138
- },
139
- Esc: function (cm) {
140
- cm.setOption('fullScreen', !cm.getOption('fullScreen'))
141
- }
142
- },
143
- autoRefresh: {
144
- delay: 500
145
- }
146
- })
147
-
148
- this._editor.on('blur', (editor: CodeMirror.Editor, e: FocusEvent) => {
149
- if (!this._changed) return
150
-
151
- this.value = editor.getValue()
152
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
153
- })
154
-
155
- this._editor.on('change', async (editor: CodeMirror.Editor, changeObj: CodeMirror.EditorChange) => {
156
- this._self_changing = true
157
-
158
- this._changed = true
159
-
160
- await this.requestUpdate()
161
-
162
- this._self_changing = false
163
- })
164
- }
165
- }
166
-
167
- return this._editor
168
- }
169
- }